From 8f32ec863f54fc640b54fab4a4e81c419c41f4d9 Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Wed, 2 Sep 2020 22:19:24 -0600 Subject: [PATCH 01/40] Updated gitignore --- .gitignore | 3 ++- Rom24/pysrc/db.py | 2 +- Rom24/pysrc/instance.py | 6 ++--- Rom24/pysrc/miniboa/__init__.py | 27 +------------------- Rom24/pysrc/miniboa/{async.py => asyncio.py} | 0 5 files changed, 7 insertions(+), 31 deletions(-) rename Rom24/pysrc/miniboa/{async.py => asyncio.py} (100%) diff --git a/.gitignore b/.gitignore index f6ee0a7..ffe41e4 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ __pycache__/ *.pyproj *.sln *.suo -.idea/ \ No newline at end of file +.idea/ +venv/ \ No newline at end of file diff --git a/Rom24/pysrc/db.py b/Rom24/pysrc/db.py index 55092fa..6add1af 100644 --- a/Rom24/pysrc/db.py +++ b/Rom24/pysrc/db.py @@ -95,7 +95,7 @@ def boot_db(): '-----------------------------------------', ) spaces = '\n' + ' ' * 51 - logger.boot(spaces.join(results)) + logger.info(spaces.join(results)) def init_instance(): diff --git a/Rom24/pysrc/instance.py b/Rom24/pysrc/instance.py index f49acfb..a69a885 100644 --- a/Rom24/pysrc/instance.py +++ b/Rom24/pysrc/instance.py @@ -263,11 +263,11 @@ def save(): players[i].save(force=True) for i in items: it = items[i] - if it.in_living() is not None: + if it.in_living is not None: continue - if it.in_room() is not None: + if it.in_room is not None: continue - if it.in_item() is not None: + if it.in_item is not None: continue it.save(force=True) diff --git a/Rom24/pysrc/miniboa/__init__.py b/Rom24/pysrc/miniboa/__init__.py index 194920e..bd04869 100644 --- a/Rom24/pysrc/miniboa/__init__.py +++ b/Rom24/pysrc/miniboa/__init__.py @@ -1,26 +1 @@ -# -*- coding: utf-8 -*- line endings: unix -*- -# ------------------------------------------------------------------------------ -# miniboa/__init__.py -# Copyright 2009 Jim Storch -# 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. -#------------------------------------------------------------------------------ -# Changes made by pR0Ps.CM[at]gmail[dot]com on 18/07/2012 -# -Updated for use with Python 3.x -# -Repackaged into a single file to simplify distribution -# -Other misc fixes and changes -# -# Report any bugs in this implementation to me (email above) -#------------------------------------------------------------------------------ -# Additional changes by Quixadhal on 2014.06.16 -# -Re-split code into multiple files, for ease of maintenance -# -Rewrote terminal system -#------------------------------------------------------------------------------ - -from miniboa.async import TelnetServer +from miniboa.asyncio import TelnetServer diff --git a/Rom24/pysrc/miniboa/async.py b/Rom24/pysrc/miniboa/asyncio.py similarity index 100% rename from Rom24/pysrc/miniboa/async.py rename to Rom24/pysrc/miniboa/asyncio.py From 8d5a8a629b4573d343efc125c824619e803c087f Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Wed, 2 Sep 2020 22:38:26 -0600 Subject: [PATCH 02/40] Removing source C stuff --- Rom24/src/Makefile | 22 - Rom24/src/Makefile.linux | 19 - Rom24/src/Makefile.normal | 18 - Rom24/src/Makefile.solaris | 19 - Rom24/src/act_comm.c | 1999 --------------- Rom24/src/act_enter.c | 214 -- Rom24/src/act_info.c | 2755 --------------------- Rom24/src/act_move.c | 1640 ------------- Rom24/src/act_obj.c | 2989 ----------------------- Rom24/src/act_wiz.c | 4378 --------------------------------- Rom24/src/alias.c | 273 --- Rom24/src/ban.c | 309 --- Rom24/src/comm.c | 2572 -------------------- Rom24/src/const.c | 2125 ---------------- Rom24/src/db.c | 3372 -------------------------- Rom24/src/db.h | 52 - Rom24/src/db2.c | 493 ---- Rom24/src/effects.c | 621 ----- Rom24/src/fight.c | 3095 ------------------------ Rom24/src/flags.c | 249 -- Rom24/src/handler.c | 2912 ---------------------- Rom24/src/healer.c | 196 -- Rom24/src/interp.c | 796 ------ Rom24/src/interp.h | 298 --- Rom24/src/lookup.c | 106 - Rom24/src/lookup.h | 32 - Rom24/src/magic.c | 4699 ------------------------------------ Rom24/src/magic.h | 130 - Rom24/src/magic2.c | 174 -- Rom24/src/merc.h | 2322 ------------------ Rom24/src/music.c | 350 --- Rom24/src/music.h | 43 - Rom24/src/note.c | 960 -------- Rom24/src/recycle.c | 652 ----- Rom24/src/recycle.h | 112 - Rom24/src/save.c | 1665 ------------- Rom24/src/scan.c | 127 - Rom24/src/skills.c | 1069 -------- Rom24/src/special.c | 1042 -------- Rom24/src/tables.c | 322 --- Rom24/src/tables.h | 81 - Rom24/src/telnet.h | 87 - Rom24/src/update.c | 1127 --------- 43 files changed, 46516 deletions(-) delete mode 100644 Rom24/src/Makefile delete mode 100644 Rom24/src/Makefile.linux delete mode 100644 Rom24/src/Makefile.normal delete mode 100644 Rom24/src/Makefile.solaris delete mode 100644 Rom24/src/act_comm.c delete mode 100644 Rom24/src/act_enter.c delete mode 100644 Rom24/src/act_info.c delete mode 100644 Rom24/src/act_move.c delete mode 100644 Rom24/src/act_obj.c delete mode 100644 Rom24/src/act_wiz.c delete mode 100644 Rom24/src/alias.c delete mode 100644 Rom24/src/ban.c delete mode 100644 Rom24/src/comm.c delete mode 100644 Rom24/src/const.c delete mode 100644 Rom24/src/db.c delete mode 100644 Rom24/src/db.h delete mode 100644 Rom24/src/db2.c delete mode 100644 Rom24/src/effects.c delete mode 100644 Rom24/src/fight.c delete mode 100644 Rom24/src/flags.c delete mode 100644 Rom24/src/handler.c delete mode 100644 Rom24/src/healer.c delete mode 100644 Rom24/src/interp.c delete mode 100644 Rom24/src/interp.h delete mode 100644 Rom24/src/lookup.c delete mode 100644 Rom24/src/lookup.h delete mode 100644 Rom24/src/magic.c delete mode 100644 Rom24/src/magic.h delete mode 100644 Rom24/src/magic2.c delete mode 100644 Rom24/src/merc.h delete mode 100644 Rom24/src/music.c delete mode 100644 Rom24/src/music.h delete mode 100644 Rom24/src/note.c delete mode 100644 Rom24/src/recycle.c delete mode 100644 Rom24/src/recycle.h delete mode 100644 Rom24/src/save.c delete mode 100644 Rom24/src/scan.c delete mode 100644 Rom24/src/skills.c delete mode 100644 Rom24/src/special.c delete mode 100644 Rom24/src/tables.c delete mode 100644 Rom24/src/tables.h delete mode 100644 Rom24/src/telnet.h delete mode 100644 Rom24/src/update.c diff --git a/Rom24/src/Makefile b/Rom24/src/Makefile deleted file mode 100644 index 8728499..0000000 --- a/Rom24/src/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -CC = gcc -PROF = -O -g -NOCRYPT = -C_FLAGS = -Wall $(PROF) $(NOCRYPT) -L_FLAGS = $(PROF) - -O_FILES = act_comm.o act_enter.o act_info.o act_move.o act_obj.o act_wiz.o \ - alias.o ban.o comm.o const.o db.o db2.o effects.o fight.o flags.o \ - handler.o healer.o interp.o note.o lookup.o magic.o magic2.o \ - music.o recycle.o save.o scan.o skills.o special.o tables.o \ - update.o -lcrypt - -rom: $(O_FILES) - rm -f rom - $(CC) $(L_FLAGS) -o rom $(O_FILES) - -.c.o: merc.h - $(CC) -c $(C_FLAGS) $< - -clean: - @rm -f *.o - make diff --git a/Rom24/src/Makefile.linux b/Rom24/src/Makefile.linux deleted file mode 100644 index cf44f87..0000000 --- a/Rom24/src/Makefile.linux +++ /dev/null @@ -1,19 +0,0 @@ -CC = gcc -PROF = -O -g -NOCRYPT = -C_FLAGS = -Wall $(PROF) $(NOCRYPT) -L_FLAGS = $(PROF) -LIBS = -lcrypt - -O_FILES = act_comm.o act_enter.o act_info.o act_move.o act_obj.o act_wiz.o \ - alias.o ban.o comm.o const.o db.o db2.o effects.o fight.o flags.o \ - handler.o healer.o interp.o note.o lookup.o magic.o magic2.o \ - music.o recycle.o save.o scan.o skills.o special.o tables.o \ - update.o - -rom: $(O_FILES) - rm -f rom - $(CC) $(L_FLAGS) -o rom $(O_FILES) $(LIBS) - -.c.o: merc.h - $(CC) -c $(C_FLAGS) $< diff --git a/Rom24/src/Makefile.normal b/Rom24/src/Makefile.normal deleted file mode 100644 index efcc512..0000000 --- a/Rom24/src/Makefile.normal +++ /dev/null @@ -1,18 +0,0 @@ -CC = gcc -PROF = -O -g -NOCRYPT = -C_FLAGS = -Wall $(PROF) $(NOCRYPT) -L_FLAGS = $(PROF) - -O_FILES = act_comm.o act_enter.o act_info.o act_move.o act_obj.o act_wiz.o \ - alias.o ban.o comm.o const.o db.o db2.o effects.o fight.o flags.o \ - handler.o healer.o interp.o note.o lookup.o magic.o magic2.o \ - music.o recycle.o save.o scan.o skills.o special.o tables.o \ - update.o - -rom: $(O_FILES) - rm -f rom - $(CC) $(L_FLAGS) -o rom $(O_FILES) - -.c.o: merc.h - $(CC) -c $(C_FLAGS) $< diff --git a/Rom24/src/Makefile.solaris b/Rom24/src/Makefile.solaris deleted file mode 100644 index 5d0038c..0000000 --- a/Rom24/src/Makefile.solaris +++ /dev/null @@ -1,19 +0,0 @@ -CC = gcc -PROF = -O -g -NOCRYPT = -C_FLAGS = -Wall $(PROF) $(NOCRYPT) -L_FLAGS = $(PROF) -LIBS = -lsocket -lresolv -lnsl - -O_FILES = act_comm.o act_enter.o act_info.o act_move.o act_obj.o act_wiz.o \ - alias.o ban.o comm.o const.o db.o db2.o effects.o fight.o flags.o \ - handler.o healer.o interp.o note.o lookup.o magic.o magic2.o \ - music.o recycle.o save.o scan.o skills.o special.o tables.o \ - update.o - -rom: $(O_FILES) - rm -f rom - $(CC) $(L_FLAGS) -o rom $(O_FILES) $(LIBS) - -.c.o: merc.h - $(CC) -c $(C_FLAGS) $< diff --git a/Rom24/src/act_comm.c b/Rom24/src/act_comm.c deleted file mode 100644 index a11bf11..0000000 --- a/Rom24/src/act_comm.c +++ /dev/null @@ -1,1999 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#include -#endif -#include -#include -#include -#include -#include -#include "merc.h" -#include "interp.h" -#include "recycle.h" -#include "tables.h" - -/* RT code to delete yourself */ - -void do_delet( CHAR_DATA *ch, char *argument) -{ - send_to_char("You must type the full command to delete yourself.\n\r",ch); -} - -void do_delete( CHAR_DATA *ch, char *argument) -{ - char strsave[MAX_INPUT_LENGTH]; - - if (IS_NPC(ch)) - return; - - if (ch->pcdata->confirm_delete) - { - if (argument[0] != '\0') - { - send_to_char("Delete status removed.\n\r",ch); - ch->pcdata->confirm_delete = FALSE; - return; - } - else - { - sprintf( strsave, "%s%s", PLAYER_DIR, capitalize( ch->name ) ); - wiznet("$N turns $Mself into line noise.",ch,NULL,0,0,0); - stop_fighting(ch,TRUE); - do_function(ch, &do_quit, ""); - unlink(strsave); - return; - } - } - - if (argument[0] != '\0') - { - send_to_char("Just type delete. No argument.\n\r",ch); - return; - } - - send_to_char("Type delete again to confirm this command.\n\r",ch); - send_to_char("WARNING: this command is irreversible.\n\r",ch); - send_to_char("Typing delete with an argument will undo delete status.\n\r", - ch); - ch->pcdata->confirm_delete = TRUE; - wiznet("$N is contemplating deletion.",ch,NULL,0,0,get_trust(ch)); -} - - -/* RT code to display channel status */ - -void do_channels( CHAR_DATA *ch, char *argument) -{ - char buf[MAX_STRING_LENGTH]; - - /* lists all channels and their status */ - send_to_char(" channel status\n\r",ch); - send_to_char("---------------------\n\r",ch); - - send_to_char("gossip ",ch); - if (!IS_SET(ch->comm,COMM_NOGOSSIP)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("auction ",ch); - if (!IS_SET(ch->comm,COMM_NOAUCTION)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("music ",ch); - if (!IS_SET(ch->comm,COMM_NOMUSIC)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("Q/A ",ch); - if (!IS_SET(ch->comm,COMM_NOQUESTION)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("Quote ",ch); - if (!IS_SET(ch->comm,COMM_NOQUOTE)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("grats ",ch); - if (!IS_SET(ch->comm,COMM_NOGRATS)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - if (IS_IMMORTAL(ch)) - { - send_to_char("god channel ",ch); - if(!IS_SET(ch->comm,COMM_NOWIZ)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - } - - send_to_char("shouts ",ch); - if (!IS_SET(ch->comm,COMM_SHOUTSOFF)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("tells ",ch); - if (!IS_SET(ch->comm,COMM_DEAF)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("quiet mode ",ch); - if (IS_SET(ch->comm,COMM_QUIET)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - if (IS_SET(ch->comm,COMM_AFK)) - send_to_char("You are AFK.\n\r",ch); - - if (IS_SET(ch->comm,COMM_SNOOP_PROOF)) - send_to_char("You are immune to snooping.\n\r",ch); - - if (ch->lines != PAGELEN) - { - if (ch->lines) - { - sprintf(buf,"You display %d lines of scroll.\n\r",ch->lines+2); - send_to_char(buf,ch); - } - else - send_to_char("Scroll buffering is off.\n\r",ch); - } - - if (ch->prompt != NULL) - { - sprintf(buf,"Your current prompt is: %s\n\r",ch->prompt); - send_to_char(buf,ch); - } - - if (IS_SET(ch->comm,COMM_NOSHOUT)) - send_to_char("You cannot shout.\n\r",ch); - - if (IS_SET(ch->comm,COMM_NOTELL)) - send_to_char("You cannot use tell.\n\r",ch); - - if (IS_SET(ch->comm,COMM_NOCHANNELS)) - send_to_char("You cannot use channels.\n\r",ch); - - if (IS_SET(ch->comm,COMM_NOEMOTE)) - send_to_char("You cannot show emotions.\n\r",ch); - -} - -/* RT deaf blocks out all shouts */ - -void do_deaf( CHAR_DATA *ch, char *argument) -{ - - if (IS_SET(ch->comm,COMM_DEAF)) - { - send_to_char("You can now hear tells again.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_DEAF); - } - else - { - send_to_char("From now on, you won't hear tells.\n\r",ch); - SET_BIT(ch->comm,COMM_DEAF); - } -} - -/* RT quiet blocks out all communication */ - -void do_quiet ( CHAR_DATA *ch, char * argument) -{ - if (IS_SET(ch->comm,COMM_QUIET)) - { - send_to_char("Quiet mode removed.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_QUIET); - } - else - { - send_to_char("From now on, you will only hear says and emotes.\n\r",ch); - SET_BIT(ch->comm,COMM_QUIET); - } -} - -/* afk command */ - -void do_afk ( CHAR_DATA *ch, char * argument) -{ - if (IS_SET(ch->comm,COMM_AFK)) - { - send_to_char("AFK mode removed. Type 'replay' to see tells.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_AFK); - } - else - { - send_to_char("You are now in AFK mode.\n\r",ch); - SET_BIT(ch->comm,COMM_AFK); - } -} - -void do_replay (CHAR_DATA *ch, char *argument) -{ - if (IS_NPC(ch)) - { - send_to_char("You can't replay.\n\r",ch); - return; - } - - if (buf_string(ch->pcdata->buffer)[0] == '\0') - { - send_to_char("You have no tells to replay.\n\r",ch); - return; - } - - page_to_char(buf_string(ch->pcdata->buffer),ch); - clear_buf(ch->pcdata->buffer); -} - -/* RT auction rewritten in ROM style */ -void do_auction( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - DESCRIPTOR_DATA *d; - - if (argument[0] == '\0' ) - { - if (IS_SET(ch->comm,COMM_NOAUCTION)) - { - send_to_char("Auction channel is now ON.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_NOAUCTION); - } - else - { - send_to_char("Auction channel is now OFF.\n\r",ch); - SET_BIT(ch->comm,COMM_NOAUCTION); - } - } - else /* auction message sent, turn auction on if it is off */ - { - if (IS_SET(ch->comm,COMM_QUIET)) - { - send_to_char("You must turn off quiet mode first.\n\r",ch); - return; - } - - if (IS_SET(ch->comm,COMM_NOCHANNELS)) - { - send_to_char("The gods have revoked your channel priviliges.\n\r",ch); - return; - } - - REMOVE_BIT(ch->comm,COMM_NOAUCTION); - } - - sprintf( buf, "You auction '%s'\n\r", argument ); - send_to_char( buf, ch ); - for ( d = descriptor_list; d != NULL; d = d->next ) - { - CHAR_DATA *victim; - - victim = d->original ? d->original : d->character; - - if ( d->connected == CON_PLAYING && - d->character != ch && - !IS_SET(victim->comm,COMM_NOAUCTION) && - !IS_SET(victim->comm,COMM_QUIET) ) - { - act_new("$n auctions '$t'", - ch,argument,d->character,TO_VICT,POS_DEAD); - } - } -} - -/* RT chat replaced with ROM gossip */ -void do_gossip( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - DESCRIPTOR_DATA *d; - - if (argument[0] == '\0' ) - { - if (IS_SET(ch->comm,COMM_NOGOSSIP)) - { - send_to_char("Gossip channel is now ON.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_NOGOSSIP); - } - else - { - send_to_char("Gossip channel is now OFF.\n\r",ch); - SET_BIT(ch->comm,COMM_NOGOSSIP); - } - } - else /* gossip message sent, turn gossip on if it isn't already */ - { - if (IS_SET(ch->comm,COMM_QUIET)) - { - send_to_char("You must turn off quiet mode first.\n\r",ch); - return; - } - - if (IS_SET(ch->comm,COMM_NOCHANNELS)) - { - send_to_char("The gods have revoked your channel priviliges.\n\r",ch); - return; - - } - - REMOVE_BIT(ch->comm,COMM_NOGOSSIP); - - sprintf( buf, "You gossip '%s'\n\r", argument ); - send_to_char( buf, ch ); - for ( d = descriptor_list; d != NULL; d = d->next ) - { - CHAR_DATA *victim; - - victim = d->original ? d->original : d->character; - - if ( d->connected == CON_PLAYING && - d->character != ch && - !IS_SET(victim->comm,COMM_NOGOSSIP) && - !IS_SET(victim->comm,COMM_QUIET) ) - { - act_new( "$n gossips '$t'", - ch,argument, d->character, TO_VICT,POS_SLEEPING ); - } - } - } -} - -void do_grats( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - DESCRIPTOR_DATA *d; - - if (argument[0] == '\0' ) - { - if (IS_SET(ch->comm,COMM_NOGRATS)) - { - send_to_char("Grats channel is now ON.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_NOGRATS); - } - else - { - send_to_char("Grats channel is now OFF.\n\r",ch); - SET_BIT(ch->comm,COMM_NOGRATS); - } - } - else /* grats message sent, turn grats on if it isn't already */ - { - if (IS_SET(ch->comm,COMM_QUIET)) - { - send_to_char("You must turn off quiet mode first.\n\r",ch); - return; - } - - if (IS_SET(ch->comm,COMM_NOCHANNELS)) - { - send_to_char("The gods have revoked your channel priviliges.\n\r",ch); - return; - - } - - REMOVE_BIT(ch->comm,COMM_NOGRATS); - - sprintf( buf, "You grats '%s'\n\r", argument ); - send_to_char( buf, ch ); - for ( d = descriptor_list; d != NULL; d = d->next ) - { - CHAR_DATA *victim; - - victim = d->original ? d->original : d->character; - - if ( d->connected == CON_PLAYING && - d->character != ch && - !IS_SET(victim->comm,COMM_NOGRATS) && - !IS_SET(victim->comm,COMM_QUIET) ) - { - act_new( "$n grats '$t'", - ch,argument, d->character, TO_VICT,POS_SLEEPING ); - } - } - } -} - -void do_quote( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - DESCRIPTOR_DATA *d; - - if (argument[0] == '\0' ) - { - if (IS_SET(ch->comm,COMM_NOQUOTE)) - { - send_to_char("Quote channel is now ON.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_NOQUOTE); - } - else - { - send_to_char("Quote channel is now OFF.\n\r",ch); - SET_BIT(ch->comm,COMM_NOQUOTE); - } - } - else /* quote message sent, turn quote on if it isn't already */ - { - if (IS_SET(ch->comm,COMM_QUIET)) - { - send_to_char("You must turn off quiet mode first.\n\r",ch); - return; - } - - if (IS_SET(ch->comm,COMM_NOCHANNELS)) - { - send_to_char("The gods have revoked your channel priviliges.\n\r",ch); - return; - - } - - REMOVE_BIT(ch->comm,COMM_NOQUOTE); - - sprintf( buf, "You quote '%s'\n\r", argument ); - send_to_char( buf, ch ); - for ( d = descriptor_list; d != NULL; d = d->next ) - { - CHAR_DATA *victim; - - victim = d->original ? d->original : d->character; - - if ( d->connected == CON_PLAYING && - d->character != ch && - !IS_SET(victim->comm,COMM_NOQUOTE) && - !IS_SET(victim->comm,COMM_QUIET) ) - { - act_new( "$n quotes '$t'", - ch,argument, d->character, TO_VICT,POS_SLEEPING ); - } - } - } -} - -/* RT question channel */ -void do_question( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - DESCRIPTOR_DATA *d; - - if (argument[0] == '\0' ) - { - if (IS_SET(ch->comm,COMM_NOQUESTION)) - { - send_to_char("Q/A channel is now ON.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_NOQUESTION); - } - else - { - send_to_char("Q/A channel is now OFF.\n\r",ch); - SET_BIT(ch->comm,COMM_NOQUESTION); - } - } - else /* question sent, turn Q/A on if it isn't already */ - { - if (IS_SET(ch->comm,COMM_QUIET)) - { - send_to_char("You must turn off quiet mode first.\n\r",ch); - return; - } - - if (IS_SET(ch->comm,COMM_NOCHANNELS)) - { - send_to_char("The gods have revoked your channel priviliges.\n\r",ch); - return; - } - - REMOVE_BIT(ch->comm,COMM_NOQUESTION); - - sprintf( buf, "You question '%s'\n\r", argument ); - send_to_char( buf, ch ); - for ( d = descriptor_list; d != NULL; d = d->next ) - { - CHAR_DATA *victim; - - victim = d->original ? d->original : d->character; - - if ( d->connected == CON_PLAYING && - d->character != ch && - !IS_SET(victim->comm,COMM_NOQUESTION) && - !IS_SET(victim->comm,COMM_QUIET) ) - { - act_new("$n questions '$t'", - ch,argument,d->character,TO_VICT,POS_SLEEPING); - } - } - } -} - -/* RT answer channel - uses same line as questions */ -void do_answer( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - DESCRIPTOR_DATA *d; - - if (argument[0] == '\0' ) - { - if (IS_SET(ch->comm,COMM_NOQUESTION)) - { - send_to_char("Q/A channel is now ON.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_NOQUESTION); - } - else - { - send_to_char("Q/A channel is now OFF.\n\r",ch); - SET_BIT(ch->comm,COMM_NOQUESTION); - } - } - else /* answer sent, turn Q/A on if it isn't already */ - { - if (IS_SET(ch->comm,COMM_QUIET)) - { - send_to_char("You must turn off quiet mode first.\n\r",ch); - return; - } - - if (IS_SET(ch->comm,COMM_NOCHANNELS)) - { - send_to_char("The gods have revoked your channel priviliges.\n\r",ch); - return; - } - - REMOVE_BIT(ch->comm,COMM_NOQUESTION); - - sprintf( buf, "You answer '%s'\n\r", argument ); - send_to_char( buf, ch ); - for ( d = descriptor_list; d != NULL; d = d->next ) - { - CHAR_DATA *victim; - - victim = d->original ? d->original : d->character; - - if ( d->connected == CON_PLAYING && - d->character != ch && - !IS_SET(victim->comm,COMM_NOQUESTION) && - !IS_SET(victim->comm,COMM_QUIET) ) - { - act_new("$n answers '$t'", - ch,argument,d->character,TO_VICT,POS_SLEEPING); - } - } - } -} - -/* RT music channel */ -void do_music( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - DESCRIPTOR_DATA *d; - - if (argument[0] == '\0' ) - { - if (IS_SET(ch->comm,COMM_NOMUSIC)) - { - send_to_char("Music channel is now ON.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_NOMUSIC); - } - else - { - send_to_char("Music channel is now OFF.\n\r",ch); - SET_BIT(ch->comm,COMM_NOMUSIC); - } - } - else /* music sent, turn music on if it isn't already */ - { - if (IS_SET(ch->comm,COMM_QUIET)) - { - send_to_char("You must turn off quiet mode first.\n\r",ch); - return; - } - - if (IS_SET(ch->comm,COMM_NOCHANNELS)) - { - send_to_char("The gods have revoked your channel priviliges.\n\r",ch); - return; - } - - REMOVE_BIT(ch->comm,COMM_NOMUSIC); - - sprintf( buf, "You MUSIC: '%s'\n\r", argument ); - send_to_char( buf, ch ); - sprintf( buf, "$n MUSIC: '%s'", argument ); - for ( d = descriptor_list; d != NULL; d = d->next ) - { - CHAR_DATA *victim; - - victim = d->original ? d->original : d->character; - - if ( d->connected == CON_PLAYING && - d->character != ch && - !IS_SET(victim->comm,COMM_NOMUSIC) && - !IS_SET(victim->comm,COMM_QUIET) ) - { - act_new("$n MUSIC: '$t'", - ch,argument,d->character,TO_VICT,POS_SLEEPING); - } - } - } -} - -/* clan channels */ -void do_clantalk( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - DESCRIPTOR_DATA *d; - - if (!is_clan(ch) || clan_table[ch->clan].independent) - { - send_to_char("You aren't in a clan.\n\r",ch); - return; - } - if ( argument[0] == '\0' ) - { - if (IS_SET(ch->comm,COMM_NOCLAN)) - { - send_to_char("Clan channel is now ON\n\r",ch); - REMOVE_BIT(ch->comm,COMM_NOCLAN); - } - else - { - send_to_char("Clan channel is now OFF\n\r",ch); - SET_BIT(ch->comm,COMM_NOCLAN); - } - return; - } - - if (IS_SET(ch->comm,COMM_NOCHANNELS)) - { - send_to_char("The gods have revoked your channel priviliges.\n\r",ch); - return; - } - - REMOVE_BIT(ch->comm,COMM_NOCLAN); - - sprintf( buf, "You clan '%s'\n\r", argument ); - send_to_char( buf, ch ); - sprintf( buf, "$n clans '%s'", argument ); - for ( d = descriptor_list; d != NULL; d = d->next ) - { - if ( d->connected == CON_PLAYING && - d->character != ch && - is_same_clan(ch,d->character) && - !IS_SET(d->character->comm,COMM_NOCLAN) && - !IS_SET(d->character->comm,COMM_QUIET) ) - { - act_new("$n clans '$t'",ch,argument,d->character,TO_VICT,POS_DEAD); - } - } - - return; -} - -void do_immtalk( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - DESCRIPTOR_DATA *d; - - if ( argument[0] == '\0' ) - { - if (IS_SET(ch->comm,COMM_NOWIZ)) - { - send_to_char("Immortal channel is now ON\n\r",ch); - REMOVE_BIT(ch->comm,COMM_NOWIZ); - } - else - { - send_to_char("Immortal channel is now OFF\n\r",ch); - SET_BIT(ch->comm,COMM_NOWIZ); - } - return; - } - - REMOVE_BIT(ch->comm,COMM_NOWIZ); - - sprintf( buf, "$n: %s", argument ); - act_new("$n: $t",ch,argument,NULL,TO_CHAR,POS_DEAD); - for ( d = descriptor_list; d != NULL; d = d->next ) - { - if ( d->connected == CON_PLAYING && - IS_IMMORTAL(d->character) && - !IS_SET(d->character->comm,COMM_NOWIZ) ) - { - act_new("$n: $t",ch,argument,d->character,TO_VICT,POS_DEAD); - } - } - - return; -} - - - -void do_say( CHAR_DATA *ch, char *argument ) -{ - if ( argument[0] == '\0' ) - { - send_to_char( "Say what?\n\r", ch ); - return; - } - - act( "$n says '$T'", ch, NULL, argument, TO_ROOM ); - act( "You say '$T'", ch, NULL, argument, TO_CHAR ); - return; -} - - - -void do_shout( CHAR_DATA *ch, char *argument ) -{ - DESCRIPTOR_DATA *d; - - if (argument[0] == '\0' ) - { - if (IS_SET(ch->comm,COMM_SHOUTSOFF)) - { - send_to_char("You can hear shouts again.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_SHOUTSOFF); - } - else - { - send_to_char("You will no longer hear shouts.\n\r",ch); - SET_BIT(ch->comm,COMM_SHOUTSOFF); - } - return; - } - - if ( IS_SET(ch->comm, COMM_NOSHOUT) ) - { - send_to_char( "You can't shout.\n\r", ch ); - return; - } - - REMOVE_BIT(ch->comm,COMM_SHOUTSOFF); - - WAIT_STATE( ch, 12 ); - - act( "You shout '$T'", ch, NULL, argument, TO_CHAR ); - for ( d = descriptor_list; d != NULL; d = d->next ) - { - CHAR_DATA *victim; - - victim = d->original ? d->original : d->character; - - if ( d->connected == CON_PLAYING && - d->character != ch && - !IS_SET(victim->comm, COMM_SHOUTSOFF) && - !IS_SET(victim->comm, COMM_QUIET) ) - { - act("$n shouts '$t'",ch,argument,d->character,TO_VICT); - } - } - - return; -} - - - -void do_tell( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH],buf[MAX_STRING_LENGTH]; - CHAR_DATA *victim; - - if ( IS_SET(ch->comm, COMM_NOTELL) || IS_SET(ch->comm,COMM_DEAF)) - { - send_to_char( "Your message didn't get through.\n\r", ch ); - return; - } - - if ( IS_SET(ch->comm, COMM_QUIET) ) - { - send_to_char( "You must turn off quiet mode first.\n\r", ch); - return; - } - - if (IS_SET(ch->comm,COMM_DEAF)) - { - send_to_char("You must turn off deaf mode first.\n\r",ch); - return; - } - - argument = one_argument( argument, arg ); - - if ( arg[0] == '\0' || argument[0] == '\0' ) - { - send_to_char( "Tell whom what?\n\r", ch ); - return; - } - - /* - * Can tell to PC's anywhere, but NPC's only in same room. - * -- Furey - */ - if ( ( victim = get_char_world( ch, arg ) ) == NULL - || ( IS_NPC(victim) && victim->in_room != ch->in_room ) ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - - if ( victim->desc == NULL && !IS_NPC(victim)) - { - act("$N seems to have misplaced $S link...try again later.", - ch,NULL,victim,TO_CHAR); - sprintf(buf,"%s tells you '%s'\n\r",PERS(ch,victim),argument); - buf[0] = UPPER(buf[0]); - add_buf(victim->pcdata->buffer,buf); - return; - } - - if ( !(IS_IMMORTAL(ch) && ch->level > LEVEL_IMMORTAL) && !IS_AWAKE(victim) ) - { - act( "$E can't hear you.", ch, 0, victim, TO_CHAR ); - return; - } - - if ((IS_SET(victim->comm,COMM_QUIET) || IS_SET(victim->comm,COMM_DEAF)) - && !IS_IMMORTAL(ch)) - { - act( "$E is not receiving tells.", ch, 0, victim, TO_CHAR ); - return; - } - - if (IS_SET(victim->comm,COMM_AFK)) - { - if (IS_NPC(victim)) - { - act("$E is AFK, and not receiving tells.",ch,NULL,victim,TO_CHAR); - return; - } - - act("$E is AFK, but your tell will go through when $E returns.", - ch,NULL,victim,TO_CHAR); - sprintf(buf,"%s tells you '%s'\n\r",PERS(ch,victim),argument); - buf[0] = UPPER(buf[0]); - add_buf(victim->pcdata->buffer,buf); - return; - } - - act( "You tell $N '$t'", ch, argument, victim, TO_CHAR ); - act_new("$n tells you '$t'",ch,argument,victim,TO_VICT,POS_DEAD); - victim->reply = ch; - - return; -} - - - -void do_reply( CHAR_DATA *ch, char *argument ) -{ - CHAR_DATA *victim; - char buf[MAX_STRING_LENGTH]; - - if ( IS_SET(ch->comm, COMM_NOTELL) ) - { - send_to_char( "Your message didn't get through.\n\r", ch ); - return; - } - - if ( ( victim = ch->reply ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - - if ( victim->desc == NULL && !IS_NPC(victim)) - { - act("$N seems to have misplaced $S link...try again later.", - ch,NULL,victim,TO_CHAR); - sprintf(buf,"%s tells you '%s'\n\r",PERS(ch,victim),argument); - buf[0] = UPPER(buf[0]); - add_buf(victim->pcdata->buffer,buf); - return; - } - - if ( !IS_IMMORTAL(ch) && !IS_AWAKE(victim) ) - { - act( "$E can't hear you.", ch, 0, victim, TO_CHAR ); - return; - } - - if ((IS_SET(victim->comm,COMM_QUIET) || IS_SET(victim->comm,COMM_DEAF)) - && !IS_IMMORTAL(ch) && !IS_IMMORTAL(victim)) - { - act_new( "$E is not receiving tells.", ch, 0, victim, TO_CHAR,POS_DEAD); - return; - } - - if (!IS_IMMORTAL(victim) && !IS_AWAKE(ch)) - { - send_to_char( "In your dreams, or what?\n\r", ch ); - return; - } - - if (IS_SET(victim->comm,COMM_AFK)) - { - if (IS_NPC(victim)) - { - act_new("$E is AFK, and not receiving tells.", - ch,NULL,victim,TO_CHAR,POS_DEAD); - return; - } - - act_new("$E is AFK, but your tell will go through when $E returns.", - ch,NULL,victim,TO_CHAR,POS_DEAD); - sprintf(buf,"%s tells you '%s'\n\r",PERS(ch,victim),argument); - buf[0] = UPPER(buf[0]); - add_buf(victim->pcdata->buffer,buf); - return; - } - - act_new("You tell $N '$t'",ch,argument,victim,TO_CHAR,POS_DEAD); - act_new("$n tells you '$t'",ch,argument,victim,TO_VICT,POS_DEAD); - victim->reply = ch; - - return; -} - - - -void do_yell( CHAR_DATA *ch, char *argument ) -{ - DESCRIPTOR_DATA *d; - - if ( IS_SET(ch->comm, COMM_NOSHOUT) ) - { - send_to_char( "You can't yell.\n\r", ch ); - return; - } - - if ( argument[0] == '\0' ) - { - send_to_char( "Yell what?\n\r", ch ); - return; - } - - - act("You yell '$t'",ch,argument,NULL,TO_CHAR); - for ( d = descriptor_list; d != NULL; d = d->next ) - { - if ( d->connected == CON_PLAYING - && d->character != ch - && d->character->in_room != NULL - && d->character->in_room->area == ch->in_room->area - && !IS_SET(d->character->comm,COMM_QUIET) ) - { - act("$n yells '$t'",ch,argument,d->character,TO_VICT); - } - } - - return; -} - - -void do_emote( CHAR_DATA *ch, char *argument ) -{ - if ( !IS_NPC(ch) && IS_SET(ch->comm, COMM_NOEMOTE) ) - { - send_to_char( "You can't show your emotions.\n\r", ch ); - return; - } - - if ( argument[0] == '\0' ) - { - send_to_char( "Emote what?\n\r", ch ); - return; - } - - act( "$n $T", ch, NULL, argument, TO_ROOM ); - act( "$n $T", ch, NULL, argument, TO_CHAR ); - return; -} - - -void do_pmote( CHAR_DATA *ch, char *argument ) -{ - CHAR_DATA *vch; - 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) ) - { - send_to_char( "You can't show your emotions.\n\r", ch ); - return; - } - - if ( argument[0] == '\0' ) - { - send_to_char( "Emote what?\n\r", ch ); - return; - } - - act( "$n $t", ch, argument, NULL, TO_CHAR ); - - 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) - { - act("$N $t",vch,argument,ch,TO_CHAR); - continue; - } - - strcpy(temp,argument); - temp[strlen(argument) - strlen(letter)] = '\0'; - last[0] = '\0'; - name = vch->name; - - for (; *letter != '\0'; letter++) - { - if (*letter == '\'' && matches == strlen(vch->name)) - { - strcat(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)) - { - strcat(temp,"you"); - last[0] = '\0'; - name = vch->name; - continue; - } - strncat(last,letter,1); - continue; - } - - matches = 0; - strcat(temp,last); - strncat(temp,letter,1); - last[0] = '\0'; - name = vch->name; - } - - act("$N $t",vch,temp,ch,TO_CHAR); - } - - return; -} - - -/* - * All the posing stuff. - */ -struct pose_table_type -{ - char * message[2*MAX_CLASS]; -}; - -const struct pose_table_type pose_table [] = -{ - { - { - "You sizzle with energy.", - "$n sizzles with energy.", - "You feel very holy.", - "$n looks very holy.", - "You perform a small card trick.", - "$n performs a small card trick.", - "You show your bulging muscles.", - "$n shows $s bulging muscles." - } - }, - - { - { - "You turn into a butterfly, then return to your normal shape.", - "$n turns into a butterfly, then returns to $s normal shape.", - "You nonchalantly turn wine into water.", - "$n nonchalantly turns wine into water.", - "You wiggle your ears alternately.", - "$n wiggles $s ears alternately.", - "You crack nuts between your fingers.", - "$n cracks nuts between $s fingers." - } - }, - - { - { - "Blue sparks fly from your fingers.", - "Blue sparks fly from $n's fingers.", - "A halo appears over your head.", - "A halo appears over $n's head.", - "You nimbly tie yourself into a knot.", - "$n nimbly ties $mself into a knot.", - "You grizzle your teeth and look mean.", - "$n grizzles $s teeth and looks mean." - } - }, - - { - { - "Little red lights dance in your eyes.", - "Little red lights dance in $n's eyes.", - "You recite words of wisdom.", - "$n recites words of wisdom.", - "You juggle with daggers, apples, and eyeballs.", - "$n juggles with daggers, apples, and eyeballs.", - "You hit your head, and your eyes roll.", - "$n hits $s head, and $s eyes roll." - } - }, - - { - { - "A slimy green monster appears before you and bows.", - "A slimy green monster appears before $n and bows.", - "Deep in prayer, you levitate.", - "Deep in prayer, $n levitates.", - "You steal the underwear off every person in the room.", - "Your underwear is gone! $n stole it!", - "Crunch, crunch -- you munch a bottle.", - "Crunch, crunch -- $n munches a bottle." - } - }, - - { - { - "You turn everybody into a little pink elephant.", - "You are turned into a little pink elephant by $n.", - "An angel consults you.", - "An angel consults $n.", - "The dice roll ... and you win again.", - "The dice roll ... and $n wins again.", - "... 98, 99, 100 ... you do pushups.", - "... 98, 99, 100 ... $n does pushups." - } - }, - - { - { - "A small ball of light dances on your fingertips.", - "A small ball of light dances on $n's fingertips.", - "Your body glows with an unearthly light.", - "$n's body glows with an unearthly light.", - "You count the money in everyone's pockets.", - "Check your money, $n is counting it.", - "Arnold Schwarzenegger admires your physique.", - "Arnold Schwarzenegger admires $n's physique." - } - }, - - { - { - "Smoke and fumes leak from your nostrils.", - "Smoke and fumes leak from $n's nostrils.", - "A spot light hits you.", - "A spot light hits $n.", - "You balance a pocket knife on your tongue.", - "$n balances a pocket knife on your tongue.", - "Watch your feet, you are juggling granite boulders.", - "Watch your feet, $n is juggling granite boulders." - } - }, - - { - { - "The light flickers as you rap in magical languages.", - "The light flickers as $n raps in magical languages.", - "Everyone levitates as you pray.", - "You levitate as $n prays.", - "You produce a coin from everyone's ear.", - "$n produces a coin from your ear.", - "Oomph! You squeeze water out of a granite boulder.", - "Oomph! $n squeezes water out of a granite boulder." - } - }, - - { - { - "Your head disappears.", - "$n's head disappears.", - "A cool breeze refreshes you.", - "A cool breeze refreshes $n.", - "You step behind your shadow.", - "$n steps behind $s shadow.", - "You pick your teeth with a spear.", - "$n picks $s teeth with a spear." - } - }, - - { - { - "A fire elemental singes your hair.", - "A fire elemental singes $n's hair.", - "The sun pierces through the clouds to illuminate you.", - "The sun pierces through the clouds to illuminate $n.", - "Your eyes dance with greed.", - "$n's eyes dance with greed.", - "Everyone is swept off their foot by your hug.", - "You are swept off your feet by $n's hug." - } - }, - - { - { - "The sky changes color to match your eyes.", - "The sky changes color to match $n's eyes.", - "The ocean parts before you.", - "The ocean parts before $n.", - "You deftly steal everyone's weapon.", - "$n deftly steals your weapon.", - "Your karate chop splits a tree.", - "$n's karate chop splits a tree." - } - }, - - { - { - "The stones dance to your command.", - "The stones dance to $n's command.", - "A thunder cloud kneels to you.", - "A thunder cloud kneels to $n.", - "The Grey Mouser buys you a beer.", - "The Grey Mouser buys $n a beer.", - "A strap of your armor breaks over your mighty thews.", - "A strap of $n's armor breaks over $s mighty thews." - } - }, - - { - { - "The heavens and grass change colour as you smile.", - "The heavens and grass change colour as $n smiles.", - "The Burning Man speaks to you.", - "The Burning Man speaks to $n.", - "Everyone's pocket explodes with your fireworks.", - "Your pocket explodes with $n's fireworks.", - "A boulder cracks at your frown.", - "A boulder cracks at $n's frown." - } - }, - - { - { - "Everyone's clothes are transparent, and you are laughing.", - "Your clothes are transparent, and $n is laughing.", - "An eye in a pyramid winks at you.", - "An eye in a pyramid winks at $n.", - "Everyone discovers your dagger a centimeter from their eye.", - "You discover $n's dagger a centimeter from your eye.", - "Mercenaries arrive to do your bidding.", - "Mercenaries arrive to do $n's bidding." - } - }, - - { - { - "A black hole swallows you.", - "A black hole swallows $n.", - "Valentine Michael Smith offers you a glass of water.", - "Valentine Michael Smith offers $n a glass of water.", - "Where did you go?", - "Where did $n go?", - "Four matched Percherons bring in your chariot.", - "Four matched Percherons bring in $n's chariot." - } - }, - - { - { - "The world shimmers in time with your whistling.", - "The world shimmers in time with $n's whistling.", - "The great god Mota gives you a staff.", - "The great god Mota gives $n a staff.", - "Click.", - "Click.", - "Atlas asks you to relieve him.", - "Atlas asks $n to relieve him." - } - } -}; - - - -void do_pose( CHAR_DATA *ch, char *argument ) -{ - int level; - int pose; - - if ( IS_NPC(ch) ) - return; - - level = UMIN( ch->level, sizeof(pose_table) / sizeof(pose_table[0]) - 1 ); - pose = number_range(0, level); - - act( pose_table[pose].message[2*ch->class+0], ch, NULL, NULL, TO_CHAR ); - act( pose_table[pose].message[2*ch->class+1], ch, NULL, NULL, TO_ROOM ); - - return; -} - - - -void do_bug( CHAR_DATA *ch, char *argument ) -{ - append_file( ch, BUG_FILE, argument ); - send_to_char( "Bug logged.\n\r", ch ); - return; -} - -void do_typo( CHAR_DATA *ch, char *argument ) -{ - append_file( ch, TYPO_FILE, argument ); - send_to_char( "Typo logged.\n\r", ch ); - return; -} - -void do_rent( CHAR_DATA *ch, char *argument ) -{ - send_to_char( "There is no rent here. Just save and quit.\n\r", ch ); - return; -} - - -void do_qui( CHAR_DATA *ch, char *argument ) -{ - send_to_char( "If you want to QUIT, you have to spell it out.\n\r", ch ); - return; -} - - - -void do_quit( CHAR_DATA *ch, char *argument ) -{ - DESCRIPTOR_DATA *d,*d_next; - int id; - - if ( IS_NPC(ch) ) - return; - - if ( ch->position == POS_FIGHTING ) - { - send_to_char( "No way! You are fighting.\n\r", ch ); - return; - } - - if ( ch->position < POS_STUNNED ) - { - send_to_char( "You're not DEAD yet.\n\r", ch ); - return; - } - send_to_char( - "Alas, all good things must come to an end.\n\r",ch); - act( "$n has left the game.", ch, NULL, NULL, TO_ROOM ); - sprintf( log_buf, "%s has quit.", ch->name ); - log_string( log_buf ); - wiznet("$N rejoins the real world.",ch,NULL,WIZ_LOGINS,0,get_trust(ch)); - - /* - * After extract_char the ch is no longer valid! - */ - save_char_obj( ch ); - id = ch->id; - d = ch->desc; - extract_char( ch, TRUE ); - if ( d != NULL ) - close_socket( d ); - - /* toast evil cheating bastards */ - for (d = descriptor_list; d != NULL; d = d_next) - { - CHAR_DATA *tch; - - d_next = d->next; - tch = d->original ? d->original : d->character; - if (tch && tch->id == id) - { - extract_char(tch,TRUE); - close_socket(d); - } - } - - return; -} - - - -void do_save( CHAR_DATA *ch, char *argument ) -{ - if ( IS_NPC(ch) ) - return; - - save_char_obj( ch ); - send_to_char("Saving. Remember that ROM has automatic saving now.\n\r", ch); - WAIT_STATE(ch,4 * PULSE_VIOLENCE); - return; -} - - - -void do_follow( CHAR_DATA *ch, char *argument ) -{ -/* RT changed to allow unlimited following and follow the NOFOLLOW rules */ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Follow whom?\n\r", ch ); - return; - } - - if ( ( victim = get_char_room( ch, arg ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - - if ( IS_AFFECTED(ch, AFF_CHARM) && ch->master != NULL ) - { - act( "But you'd rather follow $N!", ch, NULL, ch->master, TO_CHAR ); - return; - } - - if ( victim == ch ) - { - if ( ch->master == NULL ) - { - send_to_char( "You already follow yourself.\n\r", ch ); - return; - } - stop_follower(ch); - return; - } - - if (!IS_NPC(victim) && IS_SET(victim->act,PLR_NOFOLLOW) && !IS_IMMORTAL(ch)) - { - act("$N doesn't seem to want any followers.\n\r", - ch,NULL,victim, TO_CHAR); - return; - } - - REMOVE_BIT(ch->act,PLR_NOFOLLOW); - - if ( ch->master != NULL ) - stop_follower( ch ); - - add_follower( ch, victim ); - return; -} - - -void add_follower( CHAR_DATA *ch, CHAR_DATA *master ) -{ - if ( ch->master != NULL ) - { - bug( "Add_follower: non-null master.", 0 ); - return; - } - - ch->master = master; - ch->leader = NULL; - - if ( can_see( master, ch ) ) - act( "$n now follows you.", ch, NULL, master, TO_VICT ); - - act( "You now follow $N.", ch, NULL, master, TO_CHAR ); - - return; -} - - - -void stop_follower( CHAR_DATA *ch ) -{ - if ( ch->master == NULL ) - { - bug( "Stop_follower: null master.", 0 ); - return; - } - - if ( IS_AFFECTED(ch, AFF_CHARM) ) - { - REMOVE_BIT( ch->affected_by, AFF_CHARM ); - affect_strip( ch, gsn_charm_person ); - } - - if ( can_see( ch->master, ch ) && ch->in_room != NULL) - { - act( "$n stops following you.", ch, NULL, ch->master, TO_VICT ); - act( "You stop following $N.", ch, NULL, ch->master, TO_CHAR ); - } - if (ch->master->pet == ch) - ch->master->pet = NULL; - - ch->master = NULL; - ch->leader = NULL; - return; -} - -/* nukes charmed monsters and pets */ -void nuke_pets( CHAR_DATA *ch ) -{ - CHAR_DATA *pet; - - if ((pet = ch->pet) != NULL) - { - stop_follower(pet); - if (pet->in_room != NULL) - act("$N slowly fades away.",ch,NULL,pet,TO_NOTVICT); - extract_char(pet,TRUE); - } - ch->pet = NULL; - - return; -} - - - -void die_follower( CHAR_DATA *ch ) -{ - CHAR_DATA *fch; - - if ( ch->master != NULL ) - { - if (ch->master->pet == ch) - ch->master->pet = NULL; - stop_follower( ch ); - } - - ch->leader = NULL; - - for ( fch = char_list; fch != NULL; fch = fch->next ) - { - if ( fch->master == ch ) - stop_follower( fch ); - if ( fch->leader == ch ) - fch->leader = fch; - } - - return; -} - - - -void do_order( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH],arg2[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - CHAR_DATA *och; - CHAR_DATA *och_next; - bool found; - bool fAll; - - argument = one_argument( argument, arg ); - one_argument(argument,arg2); - - if (!str_cmp(arg2,"delete")) - { - send_to_char("That will NOT be done.\n\r",ch); - return; - } - - if ( arg[0] == '\0' || argument[0] == '\0' ) - { - send_to_char( "Order whom to do what?\n\r", ch ); - return; - } - - if ( IS_AFFECTED( ch, AFF_CHARM ) ) - { - send_to_char( "You feel like taking, not giving, orders.\n\r", ch ); - return; - } - - if ( !str_cmp( arg, "all" ) ) - { - fAll = TRUE; - victim = NULL; - } - else - { - fAll = FALSE; - if ( ( victim = get_char_room( ch, arg ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - - if ( victim == ch ) - { - send_to_char( "Aye aye, right away!\n\r", ch ); - return; - } - - if (!IS_AFFECTED(victim, AFF_CHARM) || victim->master != ch - || (IS_IMMORTAL(victim) && victim->trust >= ch->trust)) - { - send_to_char( "Do it yourself!\n\r", ch ); - return; - } - } - - found = FALSE; - for ( och = ch->in_room->people; och != NULL; och = och_next ) - { - och_next = och->next_in_room; - - if ( IS_AFFECTED(och, AFF_CHARM) - && och->master == ch - && ( fAll || och == victim ) ) - { - found = TRUE; - sprintf( buf, "$n orders you to '%s'.", argument ); - act( buf, ch, NULL, och, TO_VICT ); - interpret( och, argument ); - } - } - - if ( found ) - { - WAIT_STATE(ch,PULSE_VIOLENCE); - send_to_char( "Ok.\n\r", ch ); - } - else - send_to_char( "You have no followers here.\n\r", ch ); - return; -} - - - -void do_group( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - CHAR_DATA *gch; - CHAR_DATA *leader; - - leader = (ch->leader != NULL) ? ch->leader : ch; - sprintf( buf, "%s's group:\n\r", PERS(leader, ch) ); - send_to_char( buf, ch ); - - for ( gch = char_list; gch != NULL; gch = gch->next ) - { - if ( is_same_group( gch, ch ) ) - { - sprintf( buf, - "[%2d %s] %-16s %4d/%4d hp %4d/%4d mana %4d/%4d mv %5d xp\n\r", - gch->level, - IS_NPC(gch) ? "Mob" : class_table[gch->class].who_name, - capitalize( PERS(gch, ch) ), - gch->hit, gch->max_hit, - gch->mana, gch->max_mana, - gch->move, gch->max_move, - gch->exp ); - send_to_char( buf, ch ); - } - } - return; - } - - if ( ( victim = get_char_room( ch, arg ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - - if ( ch->master != NULL || ( ch->leader != NULL && ch->leader != ch ) ) - { - send_to_char( "But you are following someone else!\n\r", ch ); - return; - } - - if ( victim->master != ch && ch != victim ) - { - act_new("$N isn't following you.",ch,NULL,victim,TO_CHAR,POS_SLEEPING); - return; - } - - if (IS_AFFECTED(victim,AFF_CHARM)) - { - send_to_char("You can't remove charmed mobs from your group.\n\r",ch); - return; - } - - if (IS_AFFECTED(ch,AFF_CHARM)) - { - act_new("You like your master too much to leave $m!", - ch,NULL,victim,TO_VICT,POS_SLEEPING); - return; - } - - if ( is_same_group( victim, ch ) && ch != victim ) - { - victim->leader = NULL; - act_new("$n removes $N from $s group.", - ch,NULL,victim,TO_NOTVICT,POS_RESTING); - act_new("$n removes you from $s group.", - ch,NULL,victim,TO_VICT,POS_SLEEPING); - act_new("You remove $N from your group.", - ch,NULL,victim,TO_CHAR,POS_SLEEPING); - return; - } - - victim->leader = ch; - act_new("$N joins $n's group.",ch,NULL,victim,TO_NOTVICT,POS_RESTING); - act_new("You join $n's group.",ch,NULL,victim,TO_VICT,POS_SLEEPING); - act_new("$N joins your group.",ch,NULL,victim,TO_CHAR,POS_SLEEPING); - return; -} - - - -/* - * 'Split' originally by Gnort, God of Chaos. - */ -void do_split( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg1[MAX_INPUT_LENGTH],arg2[MAX_INPUT_LENGTH]; - CHAR_DATA *gch; - int members; - int amount_gold = 0, amount_silver = 0; - int share_gold, share_silver; - int extra_gold, extra_silver; - - argument = one_argument( argument, arg1 ); - one_argument( argument, arg2 ); - - if ( arg1[0] == '\0' ) - { - send_to_char( "Split how much?\n\r", ch ); - return; - } - - amount_silver = atoi( arg1 ); - - if (arg2[0] != '\0') - amount_gold = atoi(arg2); - - if ( amount_gold < 0 || amount_silver < 0) - { - send_to_char( "Your group wouldn't like that.\n\r", ch ); - return; - } - - if ( amount_gold == 0 && amount_silver == 0 ) - { - send_to_char( "You hand out zero coins, but no one notices.\n\r", ch ); - return; - } - - if ( ch->gold < amount_gold || ch->silver < amount_silver) - { - send_to_char( "You don't have that much to split.\n\r", ch ); - return; - } - - members = 0; - for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room ) - { - if ( is_same_group( gch, ch ) && !IS_AFFECTED(gch,AFF_CHARM)) - members++; - } - - if ( members < 2 ) - { - send_to_char( "Just keep it all.\n\r", ch ); - return; - } - - share_silver = amount_silver / members; - extra_silver = amount_silver % members; - - share_gold = amount_gold / members; - extra_gold = amount_gold % members; - - if ( share_gold == 0 && share_silver == 0 ) - { - send_to_char( "Don't even bother, cheapskate.\n\r", ch ); - return; - } - - ch->silver -= amount_silver; - ch->silver += share_silver + extra_silver; - ch->gold -= amount_gold; - ch->gold += share_gold + extra_gold; - - if (share_silver > 0) - { - sprintf(buf, - "You split %d silver coins. Your share is %d silver.\n\r", - amount_silver,share_silver + extra_silver); - send_to_char(buf,ch); - } - - if (share_gold > 0) - { - sprintf(buf, - "You split %d gold coins. Your share is %d gold.\n\r", - amount_gold,share_gold + extra_gold); - send_to_char(buf,ch); - } - - if (share_gold == 0) - { - sprintf(buf,"$n splits %d silver coins. Your share is %d silver.", - amount_silver,share_silver); - } - else if (share_silver == 0) - { - sprintf(buf,"$n splits %d gold coins. Your share is %d gold.", - amount_gold,share_gold); - } - else - { - sprintf(buf, -"$n splits %d silver and %d gold coins, giving you %d silver and %d gold.\n\r", - amount_silver,amount_gold,share_silver,share_gold); - } - - for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room ) - { - if ( gch != ch && is_same_group(gch,ch) && !IS_AFFECTED(gch,AFF_CHARM)) - { - act( buf, ch, NULL, gch, TO_VICT ); - gch->gold += share_gold; - gch->silver += share_silver; - } - } - - return; -} - - - -void do_gtell( CHAR_DATA *ch, char *argument ) -{ - CHAR_DATA *gch; - - if ( argument[0] == '\0' ) - { - send_to_char( "Tell your group what?\n\r", ch ); - return; - } - - if ( IS_SET( ch->comm, COMM_NOTELL ) ) - { - send_to_char( "Your message didn't get through!\n\r", ch ); - return; - } - - for ( gch = char_list; gch != NULL; gch = gch->next ) - { - if ( is_same_group( gch, ch ) ) - act_new("$n tells the group '$t'", - ch,argument,gch,TO_VICT,POS_SLEEPING); - } - - return; -} - -def do_commands( self, rgument ) -{ - char buf[MAX_STRING_LENGTH]; - int cmd; - int col; - - col = 0; - for ( cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++ ) - { - if ( cmd_table[cmd].level < LEVEL_HERO - && cmd_table[cmd].level <= get_trust( ch ) - && cmd_table[cmd].show) - { - sprintf( buf, "%-12s", cmd_table[cmd].name ); - send_to_char( buf, ch ); - if ( ++col % 6 == 0 ) - send_to_char( "\n\r", ch ); - } - } - - if ( col % 6 != 0 ) - send_to_char( "\n\r", ch ); - return; -} - -void do_wizhelp( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - int cmd; - int col; - - col = 0; - for ( cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++ ) - { - if ( cmd_table[cmd].level >= LEVEL_HERO - && cmd_table[cmd].level <= get_trust( ch ) - && cmd_table[cmd].show) - { - sprintf( buf, "%-12s", cmd_table[cmd].name ); - send_to_char( buf, ch ); - if ( ++col % 6 == 0 ) - send_to_char( "\n\r", ch ); - } - } - - if ( col % 6 != 0 ) - send_to_char( "\n\r", ch ); - return; -} - - -/* - * It is very important that this be an equivalence relation: - * (1) A ~ A - * (2) if A ~ B then B ~ A - * (3) if A ~ B and B ~ C, then A ~ C - */ -bool is_same_group( CHAR_DATA *ach, CHAR_DATA *bch ) -{ - if ( ach == NULL || bch == NULL) - return FALSE; - - if ( ach->leader != NULL ) ach = ach->leader; - if ( bch->leader != NULL ) bch = bch->leader; - return ach == bch; -} diff --git a/Rom24/src/act_enter.c b/Rom24/src/act_enter.c deleted file mode 100644 index c9a7f8c..0000000 --- a/Rom24/src/act_enter.c +++ /dev/null @@ -1,214 +0,0 @@ -/*************************************************************************** - * 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-1998 Russ Taylor * -* ROM has been brought to you by the ROM consortium * -* Russ Taylor (rtaylor@hypercube.org) * -* Gabrielle Taylor (gtaylor@efn.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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#include -#else -#include -#include -#endif -#include -#include -#include -#include "merc.h" -#include "interp.h" - -/* random room generation procedure */ -ROOM_INDEX_DATA *get_random_room(CHAR_DATA *ch) -{ - ROOM_INDEX_DATA *room; - - for ( ; ; ) - { - room = get_room_index( number_range( 0, 65535 ) ); - if ( room != NULL ) - if ( can_see_room(ch,room) - && !room_is_private(room) - && !IS_SET(room->room_flags, ROOM_PRIVATE) - && !IS_SET(room->room_flags, ROOM_SOLITARY) - && !IS_SET(room->room_flags, ROOM_SAFE) - && (IS_NPC(ch) || IS_SET(ch->act,ACT_AGGRESSIVE) - || !IS_SET(room->room_flags,ROOM_LAW))) - break; - } - - return room; -} - -/* RT Enter portals */ -void do_enter( CHAR_DATA *ch, char *argument) -{ - ROOM_INDEX_DATA *location; - - if ( ch->fighting != NULL ) - return; - - /* nifty portal stuff */ - if (argument[0] != '\0') - { - ROOM_INDEX_DATA *old_room; - OBJ_DATA *portal; - CHAR_DATA *fch, *fch_next; - - old_room = ch->in_room; - - portal = get_obj_list( ch, argument, ch->in_room->contents ); - - if (portal == NULL) - { - send_to_char("You don't see that here.\n\r",ch); - return; - } - - if (portal->item_type != ITEM_PORTAL - || (IS_SET(portal->value[1],EX_CLOSED) && !IS_TRUSTED(ch,ANGEL))) - { - send_to_char("You can't seem to find a way in.\n\r",ch); - return; - } - - if (!IS_TRUSTED(ch,ANGEL) && !IS_SET(portal->value[2],GATE_NOCURSE) - && (IS_AFFECTED(ch,AFF_CURSE) - || IS_SET(old_room->room_flags,ROOM_NO_RECALL))) - { - send_to_char("Something prevents you from leaving...\n\r",ch); - return; - } - - if (IS_SET(portal->value[2],GATE_RANDOM) || portal->value[3] == -1) - { - location = get_random_room(ch); - portal->value[3] = location->vnum; /* for record keeping :) */ - } - else if (IS_SET(portal->value[2],GATE_BUGGY) && (number_percent() < 5)) - location = get_random_room(ch); - else - location = get_room_index(portal->value[3]); - - if (location == NULL - || location == old_room - || !can_see_room(ch,location) - || (room_is_private(location) && !IS_TRUSTED(ch,IMPLEMENTOR))) - { - act("$p doesn't seem to go anywhere.",ch,portal,NULL,TO_CHAR); - return; - } - - if (IS_NPC(ch) && IS_SET(ch->act,ACT_AGGRESSIVE) - && IS_SET(location->room_flags,ROOM_LAW)) - { - send_to_char("Something prevents you from leaving...\n\r",ch); - return; - } - - act("$n steps into $p.",ch,portal,NULL,TO_ROOM); - - if (IS_SET(portal->value[2],GATE_NORMAL_EXIT)) - act("You enter $p.",ch,portal,NULL,TO_CHAR); - else - act("You walk through $p and find yourself somewhere else...", - ch,portal,NULL,TO_CHAR); - - char_from_room(ch); - char_to_room(ch, location); - - if (IS_SET(portal->value[2],GATE_GOWITH)) /* take the gate along */ - { - obj_from_room(portal); - obj_to_room(portal,location); - } - - if (IS_SET(portal->value[2],GATE_NORMAL_EXIT)) - act("$n has arrived.",ch,portal,NULL,TO_ROOM); - else - act("$n has arrived through $p.",ch,portal,NULL,TO_ROOM); - - do_function(ch, &do_look, "auto"); - - /* charges */ - if (portal->value[0] > 0) - { - portal->value[0]--; - if (portal->value[0] == 0) - portal->value[0] = -1; - } - - /* protect against circular follows */ - if (old_room == location) - return; - - for ( fch = old_room->people; fch != NULL; fch = fch_next ) - { - fch_next = fch->next_in_room; - - if (portal == NULL || portal->value[0] == -1) - /* no following through dead portals */ - continue; - - if ( fch->master == ch && IS_AFFECTED(fch,AFF_CHARM) - && fch->position < POS_STANDING) - do_function(fch, &do_stand, ""); - - if ( fch->master == ch && fch->position == POS_STANDING) - { - - if (IS_SET(ch->in_room->room_flags,ROOM_LAW) - && (IS_NPC(fch) && IS_SET(fch->act,ACT_AGGRESSIVE))) - { - act("You can't bring $N into the city.", - ch,NULL,fch,TO_CHAR); - act("You aren't allowed in the city.", - fch,NULL,NULL,TO_CHAR); - continue; - } - - act( "You follow $N.", fch, NULL, ch, TO_CHAR ); - do_function(fch, &do_enter, argument); - } - } - - if (portal != NULL && portal->value[0] == -1) - { - act("$p fades out of existence.",ch,portal,NULL,TO_CHAR); - if (ch->in_room == old_room) - act("$p fades out of existence.",ch,portal,NULL,TO_ROOM); - else if (old_room->people != NULL) - { - act("$p fades out of existence.", - old_room->people,portal,NULL,TO_CHAR); - act("$p fades out of existence.", - old_room->people,portal,NULL,TO_ROOM); - } - extract_obj(portal); - } - return; - } - - send_to_char("Nope, can't do it.\n\r",ch); - return; -} diff --git a/Rom24/src/act_info.c b/Rom24/src/act_info.c deleted file mode 100644 index e966f4d..0000000 --- a/Rom24/src/act_info.c +++ /dev/null @@ -1,2755 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#include -#endif -#include -#include -#include -#include -#include -#include "merc.h" -#include "interp.h" -#include "magic.h" -#include "recycle.h" -#include "tables.h" -#include "lookup.h" - -char * const where_name [] = -{ - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", -}; - - -/* for keeping track of the player count */ -int max_on = 0; - -/* - * Local functions. - */ -char * format_obj_to_char args( ( OBJ_DATA *obj, CHAR_DATA *ch, - bool fShort ) ); -void show_list_to_char args( ( OBJ_DATA *list, CHAR_DATA *ch, - bool fShort, bool fShowNothing ) ); -void show_char_to_char_0 args( ( CHAR_DATA *victim, CHAR_DATA *ch ) ); -void show_char_to_char_1 args( ( CHAR_DATA *victim, CHAR_DATA *ch ) ); -void show_char_to_char args( ( CHAR_DATA *list, CHAR_DATA *ch ) ); -bool check_blind args( ( CHAR_DATA *ch ) ); - - - -char *format_obj_to_char( OBJ_DATA *obj, CHAR_DATA *ch, bool fShort ) -{ - static char buf[MAX_STRING_LENGTH]; - - buf[0] = '\0'; - - if ((fShort && (obj->short_descr == NULL || obj->short_descr[0] == '\0')) - || (obj->description == NULL || obj->description[0] == '\0')) - return buf; - - if ( IS_OBJ_STAT(obj, ITEM_INVIS) ) strcat( buf, "(Invis) " ); - if ( IS_AFFECTED(ch, AFF_DETECT_EVIL) - && IS_OBJ_STAT(obj, ITEM_EVIL) ) strcat( buf, "(Red Aura) " ); - if (IS_AFFECTED(ch, AFF_DETECT_GOOD) - && IS_OBJ_STAT(obj,ITEM_BLESS)) strcat(buf,"(Blue Aura) " ); - if ( IS_AFFECTED(ch, AFF_DETECT_MAGIC) - && IS_OBJ_STAT(obj, ITEM_MAGIC) ) strcat( buf, "(Magical) " ); - if ( IS_OBJ_STAT(obj, ITEM_GLOW) ) strcat( buf, "(Glowing) " ); - if ( IS_OBJ_STAT(obj, ITEM_HUM) ) strcat( buf, "(Humming) " ); - - if ( fShort ) - { - if ( obj->short_descr != NULL ) - strcat( buf, obj->short_descr ); - } - else - { - if ( obj->description != NULL) - strcat( buf, obj->description ); - } - - return buf; -} - - - -/* - * Show a list to a character. - * Can coalesce duplicated items. - */ -void show_list_to_char( OBJ_DATA *list, CHAR_DATA *ch, bool fShort, bool fShowNothing ) -{ - char buf[MAX_STRING_LENGTH]; - BUFFER *output; - char **prgpstrShow; - int *prgnShow; - char *pstrShow; - OBJ_DATA *obj; - int nShow; - int iShow; - int count; - bool fCombine; - - if ( ch->desc == NULL ) - return; - - /* - * Alloc space for output lines. - */ - output = new_buf(); - - count = 0; - for ( obj = list; obj != NULL; obj = obj->next_content ) - count++; - prgpstrShow = alloc_mem( count * sizeof(char *) ); - prgnShow = alloc_mem( count * sizeof(int) ); - nShow = 0; - - /* - * Format the list of objects. - */ - for ( obj = list; obj != NULL; obj = obj->next_content ) - { - if ( obj->wear_loc == WEAR_NONE && can_see_obj( ch, obj )) - { - pstrShow = format_obj_to_char( obj, ch, fShort ); - - fCombine = FALSE; - - if ( IS_NPC(ch) || IS_SET(ch->comm, COMM_COMBINE) ) - { - /* - * Look for duplicates, case sensitive. - * Matches tend to be near end so run loop backwords. - */ - for ( iShow = nShow - 1; iShow >= 0; iShow-- ) - { - if ( !strcmp( prgpstrShow[iShow], pstrShow ) ) - { - prgnShow[iShow]++; - fCombine = TRUE; - break; - } - } - } - - /* - * Couldn't combine, or didn't want to. - */ - if ( !fCombine ) - { - prgpstrShow [nShow] = str_dup( pstrShow ); - prgnShow [nShow] = 1; - nShow++; - } - } - } - - /* - * Output the formatted list. - */ - for ( iShow = 0; iShow < nShow; iShow++ ) - { - if (prgpstrShow[iShow][0] == '\0') - { - free_string(prgpstrShow[iShow]); - continue; - } - - if ( IS_NPC(ch) || IS_SET(ch->comm, COMM_COMBINE) ) - { - if ( prgnShow[iShow] != 1 ) - { - sprintf( buf, "(%2d) ", prgnShow[iShow] ); - add_buf(output,buf); - } - else - { - add_buf(output," "); - } - } - add_buf(output,prgpstrShow[iShow]); - add_buf(output,"\n\r"); - free_string( prgpstrShow[iShow] ); - } - - if ( fShowNothing && nShow == 0 ) - { - if ( IS_NPC(ch) || IS_SET(ch->comm, COMM_COMBINE) ) - send_to_char( " ", ch ); - send_to_char( "Nothing.\n\r", ch ); - } - page_to_char(buf_string(output),ch); - - /* - * Clean up. - */ - free_buf(output); - free_mem( prgpstrShow, count * sizeof(char *) ); - free_mem( prgnShow, count * sizeof(int) ); - - return; -} - - - -void show_char_to_char_0( CHAR_DATA *victim, CHAR_DATA *ch ) -{ - char buf[MAX_STRING_LENGTH],message[MAX_STRING_LENGTH]; - - buf[0] = '\0'; - - if ( IS_SET(victim->comm,COMM_AFK ) ) strcat( buf, "[AFK] " ); - if ( IS_AFFECTED(victim, AFF_INVISIBLE) ) strcat( buf, "(Invis) " ); - if ( victim->invis_level >= LEVEL_HERO ) strcat( buf, "(Wizi) " ); - if ( IS_AFFECTED(victim, AFF_HIDE) ) strcat( buf, "(Hide) " ); - if ( IS_AFFECTED(victim, AFF_CHARM) ) strcat( buf, "(Charmed) " ); - if ( IS_AFFECTED(victim, AFF_PASS_DOOR) ) strcat( buf, "(Translucent) "); - if ( IS_AFFECTED(victim, AFF_FAERIE_FIRE) ) strcat( buf, "(Pink Aura) " ); - if ( IS_EVIL(victim) - && IS_AFFECTED(ch, AFF_DETECT_EVIL) ) strcat( buf, "(Red Aura) " ); - if ( IS_GOOD(victim) - && IS_AFFECTED(ch, AFF_DETECT_GOOD) ) strcat( buf, "(Golden Aura) "); - if ( IS_AFFECTED(victim, AFF_SANCTUARY) ) strcat( buf, "(White Aura) " ); - if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_KILLER ) ) - strcat( buf, "(KILLER) " ); - if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_THIEF ) ) - strcat( buf, "(THIEF) " ); - if ( victim->position == victim->start_pos && victim->long_descr[0] != '\0' ) - { - strcat( buf, victim->long_descr ); - send_to_char( buf, ch ); - return; - } - - strcat( buf, PERS( victim, ch ) ); - if ( !IS_NPC(victim) && !IS_SET(ch->comm, COMM_BRIEF) - && victim->position == POS_STANDING && ch->on == NULL ) - strcat( buf, victim->pcdata->title ); - - switch ( victim->position ) - { - case POS_DEAD: strcat( buf, " is DEAD!!" ); break; - case POS_MORTAL: strcat( buf, " is mortally wounded." ); break; - case POS_INCAP: strcat( buf, " is incapacitated." ); break; - case POS_STUNNED: strcat( buf, " is lying here stunned." ); break; - case POS_SLEEPING: - if (victim->on != NULL) - { - if (IS_SET(victim->on->value[2],SLEEP_AT)) - { - sprintf(message," is sleeping at %s.", - victim->on->short_descr); - strcat(buf,message); - } - else if (IS_SET(victim->on->value[2],SLEEP_ON)) - { - sprintf(message," is sleeping on %s.", - victim->on->short_descr); - strcat(buf,message); - } - else - { - sprintf(message, " is sleeping in %s.", - victim->on->short_descr); - strcat(buf,message); - } - } - else - strcat(buf," is sleeping here."); - break; - case POS_RESTING: - if (victim->on != NULL) - { - if (IS_SET(victim->on->value[2],REST_AT)) - { - sprintf(message," is resting at %s.", - victim->on->short_descr); - strcat(buf,message); - } - else if (IS_SET(victim->on->value[2],REST_ON)) - { - sprintf(message," is resting on %s.", - victim->on->short_descr); - strcat(buf,message); - } - else - { - sprintf(message, " is resting in %s.", - victim->on->short_descr); - strcat(buf,message); - } - } - else - strcat( buf, " is resting here." ); - break; - case POS_SITTING: - if (victim->on != NULL) - { - if (IS_SET(victim->on->value[2],SIT_AT)) - { - sprintf(message," is sitting at %s.", - victim->on->short_descr); - strcat(buf,message); - } - else if (IS_SET(victim->on->value[2],SIT_ON)) - { - sprintf(message," is sitting on %s.", - victim->on->short_descr); - strcat(buf,message); - } - else - { - sprintf(message, " is sitting in %s.", - victim->on->short_descr); - strcat(buf,message); - } - } - else - strcat(buf, " is sitting here."); - break; - case POS_STANDING: - if (victim->on != NULL) - { - if (IS_SET(victim->on->value[2],STAND_AT)) - { - sprintf(message," is standing at %s.", - victim->on->short_descr); - strcat(buf,message); - } - else if (IS_SET(victim->on->value[2],STAND_ON)) - { - sprintf(message," is standing on %s.", - victim->on->short_descr); - strcat(buf,message); - } - else - { - sprintf(message," is standing in %s.", - victim->on->short_descr); - strcat(buf,message); - } - } - else - strcat( buf, " is here." ); - break; - case POS_FIGHTING: - strcat( buf, " is here, fighting " ); - if ( victim->fighting == NULL ) - strcat( buf, "thin air??" ); - else if ( victim->fighting == ch ) - strcat( buf, "YOU!" ); - else if ( victim->in_room == victim->fighting->in_room ) - { - strcat( buf, PERS( victim->fighting, ch ) ); - strcat( buf, "." ); - } - else - strcat( buf, "someone who left??" ); - break; - } - - strcat( buf, "\n\r" ); - buf[0] = UPPER(buf[0]); - send_to_char( buf, ch ); - return; -} - - - -void show_char_to_char_1( CHAR_DATA *victim, CHAR_DATA *ch ) -{ - char buf[MAX_STRING_LENGTH]; - OBJ_DATA *obj; - int iWear; - int percent; - bool found; - - if ( can_see( victim, ch ) ) - { - if (ch == victim) - act( "$n looks at $mself.",ch,NULL,NULL,TO_ROOM); - else - { - act( "$n looks at you.", ch, NULL, victim, TO_VICT ); - act( "$n looks at $N.", ch, NULL, victim, TO_NOTVICT ); - } - } - - if ( victim->description[0] != '\0' ) - { - send_to_char( victim->description, ch ); - } - else - { - act( "You see nothing special about $M.", ch, NULL, victim, TO_CHAR ); - } - - if ( victim->max_hit > 0 ) - percent = ( 100 * victim->hit ) / victim->max_hit; - else - percent = -1; - - strcpy( buf, PERS(victim, ch) ); - - if (percent >= 100) - strcat( buf, " is in excellent condition.\n\r"); - else if (percent >= 90) - strcat( buf, " has a few scratches.\n\r"); - else if (percent >= 75) - strcat( buf," has some small wounds and bruises.\n\r"); - else if (percent >= 50) - strcat( buf, " has quite a few wounds.\n\r"); - else if (percent >= 30) - strcat( buf, " has some big nasty wounds and scratches.\n\r"); - else if (percent >= 15) - strcat ( buf, " looks pretty hurt.\n\r"); - else if (percent >= 0 ) - strcat (buf, " is in awful condition.\n\r"); - else - strcat(buf, " is bleeding to death.\n\r"); - - buf[0] = UPPER(buf[0]); - send_to_char( buf, ch ); - - found = FALSE; - for ( iWear = 0; iWear < MAX_WEAR; iWear++ ) - { - if ( ( obj = get_eq_char( victim, iWear ) ) != NULL - && can_see_obj( ch, obj ) ) - { - if ( !found ) - { - send_to_char( "\n\r", ch ); - act( "$N is using:", ch, NULL, victim, TO_CHAR ); - found = TRUE; - } - send_to_char( where_name[iWear], ch ); - send_to_char( format_obj_to_char( obj, ch, TRUE ), ch ); - send_to_char( "\n\r", ch ); - } - } - - if ( victim != ch - && !IS_NPC(ch) - && number_percent( ) < get_skill(ch,gsn_peek)) - { - send_to_char( "\n\rYou peek at the inventory:\n\r", ch ); - check_improve(ch,gsn_peek,TRUE,4); - show_list_to_char( victim->carrying, ch, TRUE, TRUE ); - } - - return; -} - - - -void show_char_to_char( CHAR_DATA *list, CHAR_DATA *ch ) -{ - CHAR_DATA *rch; - - for ( rch = list; rch != NULL; rch = rch->next_in_room ) - { - if ( rch == ch ) - continue; - - if ( get_trust(ch) < rch->invis_level) - continue; - - if ( can_see( ch, rch ) ) - { - show_char_to_char_0( rch, ch ); - } - else if ( room_is_dark( ch->in_room ) - && IS_AFFECTED(rch, AFF_INFRARED ) ) - { - send_to_char( "You see glowing red eyes watching YOU!\n\r", ch ); - } - } - - return; -} - - - -bool check_blind( CHAR_DATA *ch ) -{ - - if (!IS_NPC(ch) && IS_SET(ch->act,PLR_HOLYLIGHT)) - return TRUE; - - if ( IS_AFFECTED(ch, AFF_BLIND) ) - { - send_to_char( "You can't see a thing!\n\r", ch ); - return FALSE; - } - - return TRUE; -} - -/* changes your scroll */ -void do_scroll(CHAR_DATA *ch, char *argument) -{ - char arg[MAX_INPUT_LENGTH]; - char buf[100]; - int lines; - - one_argument(argument,arg); - - if (arg[0] == '\0') - { - if (ch->lines == 0) - send_to_char("You do not page long messages.\n\r",ch); - else - { - sprintf(buf,"You currently display %d lines per page.\n\r", - ch->lines + 2); - send_to_char(buf,ch); - } - return; - } - - if (!is_number(arg)) - { - send_to_char("You must provide a number.\n\r",ch); - return; - } - - lines = atoi(arg); - - if (lines == 0) - { - send_to_char("Paging disabled.\n\r",ch); - ch->lines = 0; - return; - } - - if (lines < 10 || lines > 100) - { - send_to_char("You must provide a reasonable number.\n\r",ch); - return; - } - - sprintf(buf,"Scroll set to %d lines.\n\r",lines); - send_to_char(buf,ch); - ch->lines = lines - 2; -} - -/* RT does socials */ -void do_socials(CHAR_DATA *ch, char *argument) -{ - char buf[MAX_STRING_LENGTH]; - int iSocial; - int col; - - col = 0; - - for (iSocial = 0; social_table[iSocial].name[0] != '\0'; iSocial++) - { - sprintf(buf,"%-12s",social_table[iSocial].name); - send_to_char(buf,ch); - if (++col % 6 == 0) - send_to_char("\n\r",ch); - } - - if ( col % 6 != 0) - send_to_char("\n\r",ch); - return; -} - - - -/* RT Commands to replace news, motd, imotd, etc from ROM */ - -void do_motd(CHAR_DATA *ch, char *argument) -{ - do_function(ch, &do_help, "motd"); -} - -void do_imotd(CHAR_DATA *ch, char *argument) -{ - do_function(ch, &do_help, "imotd"); -} - -void do_rules(CHAR_DATA *ch, char *argument) -{ - do_function(ch, &do_help, "rules"); -} - -void do_story(CHAR_DATA *ch, char *argument) -{ - do_function(ch, &do_help, "story"); -} - -void do_wizlist(CHAR_DATA *ch, char *argument) -{ - do_function(ch, &do_help, "wizlist"); -} - -/* RT this following section holds all the auto commands from ROM, as well as - replacements for config */ - -void do_autolist(CHAR_DATA *ch, char *argument) -{ - /* lists most player flags */ - if (IS_NPC(ch)) - return; - - send_to_char(" action status\n\r",ch); - send_to_char("---------------------\n\r",ch); - - send_to_char("autoassist ",ch); - if (IS_SET(ch->act,PLR_AUTOASSIST)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("autoexit ",ch); - if (IS_SET(ch->act,PLR_AUTOEXIT)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("autogold ",ch); - if (IS_SET(ch->act,PLR_AUTOGOLD)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("autoloot ",ch); - if (IS_SET(ch->act,PLR_AUTOLOOT)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("autosac ",ch); - if (IS_SET(ch->act,PLR_AUTOSAC)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("autosplit ",ch); - if (IS_SET(ch->act,PLR_AUTOSPLIT)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("compact mode ",ch); - if (IS_SET(ch->comm,COMM_COMPACT)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("prompt ",ch); - if (IS_SET(ch->comm,COMM_PROMPT)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("combine items ",ch); - if (IS_SET(ch->comm,COMM_COMBINE)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - if (!IS_SET(ch->act,PLR_CANLOOT)) - send_to_char("Your corpse is safe from thieves.\n\r",ch); - else - send_to_char("Your corpse may be looted.\n\r",ch); - - if (IS_SET(ch->act,PLR_NOSUMMON)) - send_to_char("You cannot be summoned.\n\r",ch); - else - send_to_char("You can be summoned.\n\r",ch); - - if (IS_SET(ch->act,PLR_NOFOLLOW)) - send_to_char("You do not welcome followers.\n\r",ch); - else - send_to_char("You accept followers.\n\r",ch); -} - -void do_autoassist(CHAR_DATA *ch, char *argument) -{ - if (IS_NPC(ch)) - return; - - if (IS_SET(ch->act,PLR_AUTOASSIST)) - { - send_to_char("Autoassist removed.\n\r",ch); - REMOVE_BIT(ch->act,PLR_AUTOASSIST); - } - else - { - send_to_char("You will now assist when needed.\n\r",ch); - SET_BIT(ch->act,PLR_AUTOASSIST); - } -} - -void do_autoexit(CHAR_DATA *ch, char *argument) -{ - if (IS_NPC(ch)) - return; - - if (IS_SET(ch->act,PLR_AUTOEXIT)) - { - send_to_char("Exits will no longer be displayed.\n\r",ch); - REMOVE_BIT(ch->act,PLR_AUTOEXIT); - } - else - { - send_to_char("Exits will now be displayed.\n\r",ch); - SET_BIT(ch->act,PLR_AUTOEXIT); - } -} - -void do_autogold(CHAR_DATA *ch, char *argument) -{ - if (IS_NPC(ch)) - return; - - if (IS_SET(ch->act,PLR_AUTOGOLD)) - { - send_to_char("Autogold removed.\n\r",ch); - REMOVE_BIT(ch->act,PLR_AUTOGOLD); - } - else - { - send_to_char("Automatic gold looting set.\n\r",ch); - SET_BIT(ch->act,PLR_AUTOGOLD); - } -} - -void do_autoloot(CHAR_DATA *ch, char *argument) -{ - if (IS_NPC(ch)) - return; - - if (IS_SET(ch->act,PLR_AUTOLOOT)) - { - send_to_char("Autolooting removed.\n\r",ch); - REMOVE_BIT(ch->act,PLR_AUTOLOOT); - } - else - { - send_to_char("Automatic corpse looting set.\n\r",ch); - SET_BIT(ch->act,PLR_AUTOLOOT); - } -} - -void do_autosac(CHAR_DATA *ch, char *argument) -{ - if (IS_NPC(ch)) - return; - - if (IS_SET(ch->act,PLR_AUTOSAC)) - { - send_to_char("Autosacrificing removed.\n\r",ch); - REMOVE_BIT(ch->act,PLR_AUTOSAC); - } - else - { - send_to_char("Automatic corpse sacrificing set.\n\r",ch); - SET_BIT(ch->act,PLR_AUTOSAC); - } -} - -void do_autosplit(CHAR_DATA *ch, char *argument) -{ - if (IS_NPC(ch)) - return; - - if (IS_SET(ch->act,PLR_AUTOSPLIT)) - { - send_to_char("Autosplitting removed.\n\r",ch); - REMOVE_BIT(ch->act,PLR_AUTOSPLIT); - } - else - { - send_to_char("Automatic gold splitting set.\n\r",ch); - SET_BIT(ch->act,PLR_AUTOSPLIT); - } -} - -void do_brief(CHAR_DATA *ch, char *argument) -{ - if (IS_SET(ch->comm,COMM_BRIEF)) - { - send_to_char("Full descriptions activated.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_BRIEF); - } - else - { - send_to_char("Short descriptions activated.\n\r",ch); - SET_BIT(ch->comm,COMM_BRIEF); - } -} - -void do_compact(CHAR_DATA *ch, char *argument) -{ - if (IS_SET(ch->comm,COMM_COMPACT)) - { - send_to_char("Compact mode removed.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_COMPACT); - } - else - { - send_to_char("Compact mode set.\n\r",ch); - SET_BIT(ch->comm,COMM_COMPACT); - } -} - -void do_show(CHAR_DATA *ch, char *argument) -{ - if (IS_SET(ch->comm,COMM_SHOW_AFFECTS)) - { - send_to_char("Affects will no longer be shown in score.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_SHOW_AFFECTS); - } - else - { - send_to_char("Affects will now be shown in score.\n\r",ch); - SET_BIT(ch->comm,COMM_SHOW_AFFECTS); - } -} - -void do_prompt(CHAR_DATA *ch, char *argument) -{ - char buf[MAX_STRING_LENGTH]; - - if ( argument[0] == '\0' ) - { - if (IS_SET(ch->comm,COMM_PROMPT)) - { - send_to_char("You will no longer see prompts.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_PROMPT); - } - else - { - send_to_char("You will now see prompts.\n\r",ch); - SET_BIT(ch->comm,COMM_PROMPT); - } - return; - } - - if( !strcmp( argument, "all" ) ) - strcpy( buf, "<%hhp %mm %vmv> "); - else - { - if ( strlen(argument) > 50 ) - argument[50] = '\0'; - strcpy( buf, argument ); - smash_tilde( buf ); - if (str_suffix("%c",buf)) - strcat(buf," "); - - } - - free_string( ch->prompt ); - ch->prompt = str_dup( buf ); - sprintf(buf,"Prompt set to %s\n\r",ch->prompt ); - send_to_char(buf,ch); - return; -} - -void do_combine(CHAR_DATA *ch, char *argument) -{ - if (IS_SET(ch->comm,COMM_COMBINE)) - { - send_to_char("Long inventory selected.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_COMBINE); - } - else - { - send_to_char("Combined inventory selected.\n\r",ch); - SET_BIT(ch->comm,COMM_COMBINE); - } -} - -void do_noloot(CHAR_DATA *ch, char *argument) -{ - if (IS_NPC(ch)) - return; - - if (IS_SET(ch->act,PLR_CANLOOT)) - { - send_to_char("Your corpse is now safe from thieves.\n\r",ch); - REMOVE_BIT(ch->act,PLR_CANLOOT); - } - else - { - send_to_char("Your corpse may now be looted.\n\r",ch); - SET_BIT(ch->act,PLR_CANLOOT); - } -} - -void do_nofollow(CHAR_DATA *ch, char *argument) -{ - if (IS_NPC(ch)) - return; - - if (IS_SET(ch->act,PLR_NOFOLLOW)) - { - send_to_char("You now accept followers.\n\r",ch); - REMOVE_BIT(ch->act,PLR_NOFOLLOW); - } - else - { - send_to_char("You no longer accept followers.\n\r",ch); - SET_BIT(ch->act,PLR_NOFOLLOW); - die_follower( ch ); - } -} - -void do_nosummon(CHAR_DATA *ch, char *argument) -{ - if (IS_NPC(ch)) - { - if (IS_SET(ch->imm_flags,IMM_SUMMON)) - { - send_to_char("You are no longer immune to summon.\n\r",ch); - REMOVE_BIT(ch->imm_flags,IMM_SUMMON); - } - else - { - send_to_char("You are now immune to summoning.\n\r",ch); - SET_BIT(ch->imm_flags,IMM_SUMMON); - } - } - else - { - if (IS_SET(ch->act,PLR_NOSUMMON)) - { - send_to_char("You are no longer immune to summon.\n\r",ch); - REMOVE_BIT(ch->act,PLR_NOSUMMON); - } - else - { - send_to_char("You are now immune to summoning.\n\r",ch); - SET_BIT(ch->act,PLR_NOSUMMON); - } - } -} - -void do_look( CHAR_DATA *ch, char *argument ) -{ - char buf [MAX_STRING_LENGTH]; - char arg1 [MAX_INPUT_LENGTH]; - char arg2 [MAX_INPUT_LENGTH]; - char arg3 [MAX_INPUT_LENGTH]; - EXIT_DATA *pexit; - CHAR_DATA *victim; - OBJ_DATA *obj; - char *pdesc; - int door; - int number,count; - - if ( ch->desc == NULL ) - return; - - if ( ch->position < POS_SLEEPING ) - { - send_to_char( "You can't see anything but stars!\n\r", ch ); - return; - } - - if ( ch->position == POS_SLEEPING ) - { - send_to_char( "You can't see anything, you're sleeping!\n\r", ch ); - return; - } - - if ( !check_blind( ch ) ) - return; - - if ( !IS_NPC(ch) - && !IS_SET(ch->act, PLR_HOLYLIGHT) - && room_is_dark( ch->in_room ) ) - { - send_to_char( "It is pitch black ... \n\r", ch ); - show_char_to_char( ch->in_room->people, ch ); - return; - } - - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - number = number_argument(arg1,arg3); - count = 0; - - if ( arg1[0] == '\0' || !str_cmp( arg1, "auto" ) ) - { - /* 'look' or 'look auto' */ - send_to_char( ch->in_room->name, ch ); - - if (IS_IMMORTAL(ch) && (IS_NPC(ch) || IS_SET(ch->act,PLR_HOLYLIGHT))) - { - sprintf(buf," [Room %d]",ch->in_room->vnum); - send_to_char(buf,ch); - } - - send_to_char( "\n\r", ch ); - - if ( arg1[0] == '\0' - || ( !IS_NPC(ch) && !IS_SET(ch->comm, COMM_BRIEF) ) ) - { - send_to_char( " ",ch); - send_to_char( ch->in_room->description, ch ); - } - - if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_AUTOEXIT) ) - { - send_to_char("\n\r",ch); - do_function(ch, &do_exits, "auto" ); - } - - show_list_to_char( ch->in_room->contents, ch, FALSE, FALSE ); - show_char_to_char( ch->in_room->people, ch ); - return; - } - - if ( !str_cmp( arg1, "i" ) || !str_cmp(arg1, "in") || !str_cmp(arg1,"on")) - { - /* 'look in' */ - if ( arg2[0] == '\0' ) - { - send_to_char( "Look in what?\n\r", ch ); - return; - } - - if ( ( obj = get_obj_here( ch, arg2 ) ) == NULL ) - { - send_to_char( "You do not see that here.\n\r", ch ); - return; - } - - switch ( obj->item_type ) - { - default: - send_to_char( "That is not a container.\n\r", ch ); - break; - - case ITEM_DRINK_CON: - if ( obj->value[1] <= 0 ) - { - send_to_char( "It is empty.\n\r", ch ); - break; - } - - sprintf( buf, "It's %sfilled with a %s liquid.\n\r", - obj->value[1] < obj->value[0] / 4 - ? "less than half-" : - obj->value[1] < 3 * obj->value[0] / 4 - ? "about half-" : "more than half-", - liq_table[obj->value[2]].liq_color - ); - - send_to_char( buf, ch ); - break; - - case ITEM_CONTAINER: - case ITEM_CORPSE_NPC: - case ITEM_CORPSE_PC: - if ( IS_SET(obj->value[1], CONT_CLOSED) ) - { - send_to_char( "It is closed.\n\r", ch ); - break; - } - - act( "$p holds:", ch, obj, NULL, TO_CHAR ); - show_list_to_char( obj->contains, ch, TRUE, TRUE ); - break; - } - return; - } - - if ( ( victim = get_char_room( ch, arg1 ) ) != NULL ) - { - show_char_to_char_1( victim, ch ); - return; - } - - for ( obj = ch->carrying; obj != NULL; obj = obj->next_content ) - { - if ( can_see_obj( ch, obj ) ) - { /* player can see object */ - pdesc = get_extra_descr( arg3, obj->extra_descr ); - if ( pdesc != NULL ) - { if (++count == number) - { - send_to_char( pdesc, ch ); - return; - } - else continue; - } - pdesc = get_extra_descr( arg3, obj->pIndexData->extra_descr ); - if ( pdesc != NULL ) - { if (++count == number) - { - send_to_char( pdesc, ch ); - return; - } - else continue; - } - if ( is_name( arg3, obj->name ) ) - if (++count == number) - { - send_to_char( obj->description, ch ); - send_to_char( "\n\r",ch); - return; - } - } - } - - for ( obj = ch->in_room->contents; obj != NULL; obj = obj->next_content ) - { - if ( can_see_obj( ch, obj ) ) - { - pdesc = get_extra_descr( arg3, obj->extra_descr ); - if ( pdesc != NULL ) - if (++count == number) - { - send_to_char( pdesc, ch ); - return; - } - - pdesc = get_extra_descr( arg3, obj->pIndexData->extra_descr ); - if ( pdesc != NULL ) - if (++count == number) - { - send_to_char( pdesc, ch ); - return; - } - - if ( is_name( arg3, obj->name ) ) - if (++count == number) - { - send_to_char( obj->description, ch ); - send_to_char("\n\r",ch); - return; - } - } - } - - pdesc = get_extra_descr(arg3,ch->in_room->extra_descr); - if (pdesc != NULL) - { - if (++count == number) - { - send_to_char(pdesc,ch); - return; - } - } - - if (count > 0 && count != number) - { - if (count == 1) - sprintf(buf,"You only see one %s here.\n\r",arg3); - else - sprintf(buf,"You only see %d of those here.\n\r",count); - - send_to_char(buf,ch); - return; - } - - if ( !str_cmp( arg1, "n" ) || !str_cmp( arg1, "north" ) ) door = 0; - else if ( !str_cmp( arg1, "e" ) || !str_cmp( arg1, "east" ) ) door = 1; - else if ( !str_cmp( arg1, "s" ) || !str_cmp( arg1, "south" ) ) door = 2; - else if ( !str_cmp( arg1, "w" ) || !str_cmp( arg1, "west" ) ) door = 3; - else if ( !str_cmp( arg1, "u" ) || !str_cmp( arg1, "up" ) ) door = 4; - else if ( !str_cmp( arg1, "d" ) || !str_cmp( arg1, "down" ) ) door = 5; - else - { - send_to_char( "You do not see that here.\n\r", ch ); - return; - } - - /* 'look direction' */ - if ( ( pexit = ch->in_room->exit[door] ) == NULL ) - { - send_to_char( "Nothing special there.\n\r", ch ); - return; - } - - if ( pexit->description != NULL && pexit->description[0] != '\0' ) - send_to_char( pexit->description, ch ); - else - send_to_char( "Nothing special there.\n\r", ch ); - - if ( pexit->keyword != NULL - && pexit->keyword[0] != '\0' - && pexit->keyword[0] != ' ' ) - { - if ( IS_SET(pexit->exit_info, EX_CLOSED) ) - { - act( "The $d is closed.", ch, NULL, pexit->keyword, TO_CHAR ); - } - else if ( IS_SET(pexit->exit_info, EX_ISDOOR) ) - { - act( "The $d is open.", ch, NULL, pexit->keyword, TO_CHAR ); - } - } - - return; -} - -/* RT added back for the hell of it */ -void do_read (CHAR_DATA *ch, char *argument ) -{ - do_function(ch, &do_look, argument); -} - -void do_examine( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Examine what?\n\r", ch ); - return; - } - - do_function(ch, &do_look, arg ); - - if ( ( obj = get_obj_here( ch, arg ) ) != NULL ) - { - switch ( obj->item_type ) - { - default: - break; - - case ITEM_JUKEBOX: - do_function(ch, &do_play, "list"); - break; - - case ITEM_MONEY: - if (obj->value[0] == 0) - { - if (obj->value[1] == 0) - sprintf(buf,"Odd...there's no coins in the pile.\n\r"); - else if (obj->value[1] == 1) - sprintf(buf,"Wow. One gold coin.\n\r"); - else - sprintf(buf,"There are %d gold coins in the pile.\n\r", - obj->value[1]); - } - else if (obj->value[1] == 0) - { - if (obj->value[0] == 1) - sprintf(buf,"Wow. One silver coin.\n\r"); - else - sprintf(buf,"There are %d silver coins in the pile.\n\r", - obj->value[0]); - } - else - sprintf(buf, - "There are %d gold and %d silver coins in the pile.\n\r", - obj->value[1],obj->value[0]); - send_to_char(buf,ch); - break; - - case ITEM_DRINK_CON: - case ITEM_CONTAINER: - case ITEM_CORPSE_NPC: - case ITEM_CORPSE_PC: - sprintf(buf,"in %s",argument); - do_function(ch, &do_look, buf ); - } - } - - return; -} - - - -/* - * Thanks to Zrin for auto-exit part. - */ -void do_exits( CHAR_DATA *ch, char *argument ) -{ - extern char * const dir_name[]; - char buf[MAX_STRING_LENGTH]; - EXIT_DATA *pexit; - bool found; - bool fAuto; - int door; - - fAuto = !str_cmp( argument, "auto" ); - - if ( !check_blind( ch ) ) - return; - - if (fAuto) - sprintf(buf,"[Exits:"); - else if (IS_IMMORTAL(ch)) - sprintf(buf,"Obvious exits from room %d:\n\r",ch->in_room->vnum); - else - sprintf(buf,"Obvious exits:\n\r"); - - found = FALSE; - for ( door = 0; door <= 5; door++ ) - { - if ( ( pexit = ch->in_room->exit[door] ) != NULL - && pexit->u1.to_room != NULL - && can_see_room(ch,pexit->u1.to_room) - && !IS_SET(pexit->exit_info, EX_CLOSED) ) - { - found = TRUE; - if ( fAuto ) - { - strcat( buf, " " ); - strcat( buf, dir_name[door] ); - } - else - { - sprintf( buf + strlen(buf), "%-5s - %s", - capitalize( dir_name[door] ), - room_is_dark( pexit->u1.to_room ) - ? "Too dark to tell" - : pexit->u1.to_room->name - ); - if (IS_IMMORTAL(ch)) - sprintf(buf + strlen(buf), - " (room %d)\n\r",pexit->u1.to_room->vnum); - else - sprintf(buf + strlen(buf), "\n\r"); - } - } - } - - if ( !found ) - strcat( buf, fAuto ? " none" : "None.\n\r" ); - - if ( fAuto ) - strcat( buf, "]\n\r" ); - - send_to_char( buf, ch ); - return; -} - -void do_worth( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - - if (IS_NPC(ch)) - { - sprintf(buf,"You have %ld gold and %ld silver.\n\r", - ch->gold,ch->silver); - send_to_char(buf,ch); - return; - } - - sprintf(buf, - "You have %ld gold, %ld silver, and %d experience (%d exp to level).\n\r", - ch->gold, ch->silver,ch->exp, - (ch->level + 1) * exp_per_level(ch,ch->pcdata->points) - ch->exp); - - send_to_char(buf,ch); - - return; -} - - -void do_score( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - int i; - - sprintf( buf, - "You are %s%s, level %d, %d years old (%d hours).\n\r", - ch->name, - IS_NPC(ch) ? "" : ch->pcdata->title, - ch->level, get_age(ch), - ( ch->played + (int) (current_time - ch->logon) ) / 3600); - send_to_char( buf, ch ); - - if ( get_trust( ch ) != ch->level ) - { - sprintf( buf, "You are trusted at level %d.\n\r", - get_trust( ch ) ); - send_to_char( buf, ch ); - } - - sprintf(buf, "Race: %s Sex: %s Class: %s\n\r", - race_table[ch->race].name, - ch->sex == 0 ? "sexless" : ch->sex == 1 ? "male" : "female", - IS_NPC(ch) ? "mobile" : class_table[ch->class].name); - send_to_char(buf,ch); - - - sprintf( buf, - "You have %d/%d hit, %d/%d mana, %d/%d movement.\n\r", - ch->hit, ch->max_hit, - ch->mana, ch->max_mana, - ch->move, ch->max_move); - send_to_char( buf, ch ); - - sprintf( buf, - "You have %d practices and %d training sessions.\n\r", - ch->practice, ch->train); - send_to_char( buf, ch ); - - sprintf( buf, - "You are carrying %d/%d items with weight %ld/%d pounds.\n\r", - ch->carry_number, can_carry_n(ch), - get_carry_weight(ch) / 10, can_carry_w(ch) /10 ); - send_to_char( buf, ch ); - - sprintf( buf, - "Str: %d(%d) Int: %d(%d) Wis: %d(%d) Dex: %d(%d) Con: %d(%d)\n\r", - ch->perm_stat[STAT_STR], - get_curr_stat(ch,STAT_STR), - ch->perm_stat[STAT_INT], - get_curr_stat(ch,STAT_INT), - ch->perm_stat[STAT_WIS], - get_curr_stat(ch,STAT_WIS), - ch->perm_stat[STAT_DEX], - get_curr_stat(ch,STAT_DEX), - ch->perm_stat[STAT_CON], - get_curr_stat(ch,STAT_CON) ); - send_to_char( buf, ch ); - - sprintf( buf, - "You have scored %d exp, and have %ld gold and %ld silver coins.\n\r", - ch->exp, ch->gold, ch->silver ); - send_to_char( buf, ch ); - - /* RT shows exp to level */ - if (!IS_NPC(ch) && ch->level < LEVEL_HERO) - { - sprintf (buf, - "You need %d exp to level.\n\r", - ((ch->level + 1) * exp_per_level(ch,ch->pcdata->points) - ch->exp)); - send_to_char( buf, ch ); - } - - sprintf( buf, "Wimpy set to %d hit points.\n\r", ch->wimpy ); - send_to_char( buf, ch ); - - if ( !IS_NPC(ch) && ch->pcdata->condition[COND_DRUNK] > 10 ) - send_to_char( "You are drunk.\n\r", ch ); - if ( !IS_NPC(ch) && ch->pcdata->condition[COND_THIRST] == 0 ) - send_to_char( "You are thirsty.\n\r", ch ); - if ( !IS_NPC(ch) && ch->pcdata->condition[COND_HUNGER] == 0 ) - send_to_char( "You are hungry.\n\r", ch ); - - switch ( ch->position ) - { - case POS_DEAD: - send_to_char( "You are DEAD!!\n\r", ch ); - break; - case POS_MORTAL: - send_to_char( "You are mortally wounded.\n\r", ch ); - break; - case POS_INCAP: - send_to_char( "You are incapacitated.\n\r", ch ); - break; - case POS_STUNNED: - send_to_char( "You are stunned.\n\r", ch ); - break; - case POS_SLEEPING: - send_to_char( "You are sleeping.\n\r", ch ); - break; - case POS_RESTING: - send_to_char( "You are resting.\n\r", ch ); - break; - case POS_SITTING: - send_to_char( "You are sitting.\n\r", ch ); - break; - case POS_STANDING: - send_to_char( "You are standing.\n\r", ch ); - break; - case POS_FIGHTING: - send_to_char( "You are fighting.\n\r", ch ); - break; - } - - - /* print AC values */ - if (ch->level >= 25) - { - sprintf( buf,"Armor: pierce: %d bash: %d slash: %d magic: %d\n\r", - GET_AC(ch,AC_PIERCE), - GET_AC(ch,AC_BASH), - GET_AC(ch,AC_SLASH), - GET_AC(ch,AC_EXOTIC)); - send_to_char(buf,ch); - } - - for (i = 0; i < 4; i++) - { - char * temp; - - switch(i) - { - case(AC_PIERCE): temp = "piercing"; break; - case(AC_BASH): temp = "bashing"; break; - case(AC_SLASH): temp = "slashing"; break; - case(AC_EXOTIC): temp = "magic"; break; - default: temp = "error"; break; - } - - send_to_char("You are ", ch); - - if (GET_AC(ch,i) >= 101 ) - sprintf(buf,"hopelessly vulnerable to %s.\n\r",temp); - else if (GET_AC(ch,i) >= 80) - sprintf(buf,"defenseless against %s.\n\r",temp); - else if (GET_AC(ch,i) >= 60) - sprintf(buf,"barely protected from %s.\n\r",temp); - else if (GET_AC(ch,i) >= 40) - sprintf(buf,"slightly armored against %s.\n\r",temp); - else if (GET_AC(ch,i) >= 20) - sprintf(buf,"somewhat armored against %s.\n\r",temp); - else if (GET_AC(ch,i) >= 0) - sprintf(buf,"armored against %s.\n\r",temp); - else if (GET_AC(ch,i) >= -20) - sprintf(buf,"well-armored against %s.\n\r",temp); - else if (GET_AC(ch,i) >= -40) - sprintf(buf,"very well-armored against %s.\n\r",temp); - else if (GET_AC(ch,i) >= -60) - sprintf(buf,"heavily armored against %s.\n\r",temp); - else if (GET_AC(ch,i) >= -80) - sprintf(buf,"superbly armored against %s.\n\r",temp); - else if (GET_AC(ch,i) >= -100) - sprintf(buf,"almost invulnerable to %s.\n\r",temp); - else - sprintf(buf,"divinely armored against %s.\n\r",temp); - - send_to_char(buf,ch); - } - - - /* RT wizinvis and holy light */ - if ( IS_IMMORTAL(ch)) - { - send_to_char("Holy Light: ",ch); - if (IS_SET(ch->act,PLR_HOLYLIGHT)) - send_to_char("on",ch); - else - send_to_char("off",ch); - - if (ch->invis_level) - { - sprintf( buf, " Invisible: level %d",ch->invis_level); - send_to_char(buf,ch); - } - - if (ch->incog_level) - { - sprintf(buf," Incognito: level %d",ch->incog_level); - send_to_char(buf,ch); - } - send_to_char("\n\r",ch); - } - - if ( ch->level >= 15 ) - { - sprintf( buf, "Hitroll: %d Damroll: %d.\n\r", - GET_HITROLL(ch), GET_DAMROLL(ch) ); - send_to_char( buf, ch ); - } - - if ( ch->level >= 10 ) - { - sprintf( buf, "Alignment: %d. ", ch->alignment ); - send_to_char( buf, ch ); - } - - send_to_char( "You are ", ch ); - if ( ch->alignment > 900 ) send_to_char( "angelic.\n\r", ch ); - else if ( ch->alignment > 700 ) send_to_char( "saintly.\n\r", ch ); - else if ( ch->alignment > 350 ) send_to_char( "good.\n\r", ch ); - else if ( ch->alignment > 100 ) send_to_char( "kind.\n\r", ch ); - else if ( ch->alignment > -100 ) send_to_char( "neutral.\n\r", ch ); - else if ( ch->alignment > -350 ) send_to_char( "mean.\n\r", ch ); - else if ( ch->alignment > -700 ) send_to_char( "evil.\n\r", ch ); - else if ( ch->alignment > -900 ) send_to_char( "demonic.\n\r", ch ); - else send_to_char( "satanic.\n\r", ch ); - - if (IS_SET(ch->comm,COMM_SHOW_AFFECTS)) - do_function(ch, &do_affects, ""); -} - -void do_affects(CHAR_DATA *ch, char *argument ) -{ - AFFECT_DATA *paf, *paf_last = NULL; - char buf[MAX_STRING_LENGTH]; - - if ( ch->affected != NULL ) - { - send_to_char( "You are affected by the following spells:\n\r", ch ); - for ( paf = ch->affected; paf != NULL; paf = paf->next ) - { - if (paf_last != NULL && paf->type == paf_last->type) - if (ch->level >= 20) - sprintf( buf, " "); - else - continue; - else - sprintf( buf, "Spell: %-15s", skill_table[paf->type].name ); - - send_to_char( buf, ch ); - - if ( ch->level >= 20 ) - { - sprintf( buf, - ": modifies %s by %d ", - affect_loc_name( paf->location ), - paf->modifier); - send_to_char( buf, ch ); - if ( paf->duration == -1 ) - sprintf( buf, "permanently" ); - else - sprintf( buf, "for %d hours", paf->duration ); - send_to_char( buf, ch ); - } - - send_to_char( "\n\r", ch ); - paf_last = paf; - } - } - else - send_to_char("You are not affected by any spells.\n\r",ch); - - return; -} - - - -char * const day_name [] = -{ - "the Moon", "the Bull", "Deception", "Thunder", "Freedom", - "the Great Gods", "the Sun" -}; - -char * const month_name [] = -{ - "Winter", "the Winter Wolf", "the Frost Giant", "the Old Forces", - "the Grand Struggle", "the Spring", "Nature", "Futility", "the Dragon", - "the Sun", "the Heat", "the Battle", "the Dark Shades", "the Shadows", - "the Long Shadows", "the Ancient Darkness", "the Great Evil" -}; - -void do_time( CHAR_DATA *ch, char *argument ) -{ - extern char str_boot_time[]; - char buf[MAX_STRING_LENGTH]; - char *suf; - int day; - - day = time_info.day + 1; - - if ( day > 4 && day < 20 ) suf = "th"; - else if ( day % 10 == 1 ) suf = "st"; - else if ( day % 10 == 2 ) suf = "nd"; - else if ( day % 10 == 3 ) suf = "rd"; - else suf = "th"; - - sprintf( buf, - "It is %d o'clock %s, Day of %s, %d%s the Month of %s.\n\r", - (time_info.hour % 12 == 0) ? 12 : time_info.hour %12, - time_info.hour >= 12 ? "pm" : "am", - day_name[day % 7], - day, suf, - month_name[time_info.month]); - send_to_char(buf,ch); - sprintf(buf,"ROM started up at %s\n\rThe system time is %s.\n\r", - str_boot_time, - (char *) ctime( ¤t_time ) - ); - - send_to_char( buf, ch ); - return; -} - - - -void do_weather( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - - static char * const sky_look[4] = - { - "cloudless", - "cloudy", - "rainy", - "lit by flashes of lightning" - }; - - if ( !IS_OUTSIDE(ch) ) - { - send_to_char( "You can't see the weather indoors.\n\r", ch ); - return; - } - - sprintf( buf, "The sky is %s and %s.\n\r", - sky_look[weather_info.sky], - weather_info.change >= 0 - ? "a warm southerly breeze blows" - : "a cold northern gust blows" - ); - send_to_char( buf, ch ); - return; -} - -void do_help( CHAR_DATA *ch, char *argument ) -{ - HELP_DATA *pHelp; - BUFFER *output; - bool found = FALSE; - char argall[MAX_INPUT_LENGTH],argone[MAX_INPUT_LENGTH]; - int level; - - output = new_buf(); - - if ( argument[0] == '\0' ) - argument = "summary"; - - /* this parts handles help a b so that it returns help 'a b' */ - argall[0] = '\0'; - while (argument[0] != '\0' ) - { - argument = one_argument(argument,argone); - if (argall[0] != '\0') - strcat(argall," "); - strcat(argall,argone); - } - - for ( pHelp = help_first; pHelp != NULL; pHelp = pHelp->next ) - { - level = (pHelp->level < 0) ? -1 * pHelp->level - 1 : pHelp->level; - - if (level > get_trust( ch ) ) - continue; - - if ( is_name( argall, pHelp->keyword ) ) - { - /* add seperator if found */ - if (found) - add_buf(output, - "\n\r============================================================\n\r\n\r"); - if ( pHelp->level >= 0 && str_cmp( argall, "imotd" ) ) - { - add_buf(output,pHelp->keyword); - add_buf(output,"\n\r"); - } - - /* - * Strip leading '.' to allow initial blanks. - */ - if ( pHelp->text[0] == '.' ) - add_buf(output,pHelp->text+1); - else - add_buf(output,pHelp->text); - found = TRUE; - /* small hack :) */ - if (ch->desc != NULL && ch->desc->connected != CON_PLAYING - && ch->desc->connected != CON_GEN_GROUPS) - break; - } - } - - if (!found) - send_to_char( "No help on that word.\n\r", ch ); - else - page_to_char(buf_string(output),ch); - free_buf(output); -} - - -/* whois command */ -void do_whois (CHAR_DATA *ch, char *argument) -{ - char arg[MAX_INPUT_LENGTH]; - BUFFER *output; - char buf[MAX_STRING_LENGTH]; - DESCRIPTOR_DATA *d; - bool found = FALSE; - - one_argument(argument,arg); - - if (arg[0] == '\0') - { - send_to_char("You must provide a name.\n\r",ch); - return; - } - - output = new_buf(); - - for (d = descriptor_list; d != NULL; d = d->next) - { - CHAR_DATA *wch; - char const *class; - - if (d->connected != CON_PLAYING || !can_see(ch,d->character)) - continue; - - wch = ( d->original != NULL ) ? d->original : d->character; - - if (!can_see(ch,wch)) - continue; - - if (!str_prefix(arg,wch->name)) - { - found = TRUE; - - /* work out the printing */ - class = class_table[wch->class].who_name; - switch(wch->level) - { - case MAX_LEVEL - 0 : class = "IMP"; break; - case MAX_LEVEL - 1 : class = "CRE"; break; - case MAX_LEVEL - 2 : class = "SUP"; break; - case MAX_LEVEL - 3 : class = "DEI"; break; - case MAX_LEVEL - 4 : class = "GOD"; break; - case MAX_LEVEL - 5 : class = "IMM"; break; - case MAX_LEVEL - 6 : class = "DEM"; break; - case MAX_LEVEL - 7 : class = "ANG"; break; - case MAX_LEVEL - 8 : class = "AVA"; break; - } - - /* a little formatting */ - sprintf(buf, "[%2d %6s %s] %s%s%s%s%s%s%s%s\n\r", - wch->level, - wch->race < MAX_PC_RACE ? pc_race_table[wch->race].who_name - : " ", - class, - wch->incog_level >= LEVEL_HERO ? "(Incog) ": "", - wch->invis_level >= LEVEL_HERO ? "(Wizi) " : "", - clan_table[wch->clan].who_name, - IS_SET(wch->comm, COMM_AFK) ? "[AFK] " : "", - IS_SET(wch->act,PLR_KILLER) ? "(KILLER) " : "", - IS_SET(wch->act,PLR_THIEF) ? "(THIEF) " : "", - wch->name, IS_NPC(wch) ? "" : wch->pcdata->title); - add_buf(output,buf); - } - } - - if (!found) - { - send_to_char("No one of that name is playing.\n\r",ch); - return; - } - - page_to_char(buf_string(output),ch); - free_buf(output); -} - - -/* - * New 'who' command originally by Alander of Rivers of Mud. - */ -void do_who( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char buf2[MAX_STRING_LENGTH]; - BUFFER *output; - DESCRIPTOR_DATA *d; - int iClass; - int iRace; - int iClan; - int iLevelLower; - int iLevelUpper; - int nNumber; - int nMatch; - bool rgfClass[MAX_CLASS]; - bool rgfRace[MAX_PC_RACE]; - bool rgfClan[MAX_CLAN]; - bool fClassRestrict = FALSE; - bool fClanRestrict = FALSE; - bool fClan = FALSE; - bool fRaceRestrict = FALSE; - bool fImmortalOnly = FALSE; - - /* - * Set default arguments. - */ - iLevelLower = 0; - iLevelUpper = MAX_LEVEL; - for ( iClass = 0; iClass < MAX_CLASS; iClass++ ) - rgfClass[iClass] = FALSE; - for ( iRace = 0; iRace < MAX_PC_RACE; iRace++ ) - rgfRace[iRace] = FALSE; - for (iClan = 0; iClan < MAX_CLAN; iClan++) - rgfClan[iClan] = FALSE; - - /* - * Parse arguments. - */ - nNumber = 0; - for ( ;; ) - { - char arg[MAX_STRING_LENGTH]; - - argument = one_argument( argument, arg ); - if ( arg[0] == '\0' ) - break; - - if ( is_number( arg ) ) - { - switch ( ++nNumber ) - { - case 1: iLevelLower = atoi( arg ); break; - case 2: iLevelUpper = atoi( arg ); break; - default: - send_to_char( "Only two level numbers allowed.\n\r", ch ); - return; - } - } - else - { - - /* - * Look for classes to turn on. - */ - if (!str_prefix(arg,"immortals")) - { - fImmortalOnly = TRUE; - } - else - { - iClass = class_lookup(arg); - if (iClass == -1) - { - iRace = race_lookup(arg); - - if (iRace == 0 || iRace >= MAX_PC_RACE) - { - if (!str_prefix(arg,"clan")) - fClan = TRUE; - else - { - iClan = clan_lookup(arg); - if (iClan) - { - fClanRestrict = TRUE; - rgfClan[iClan] = TRUE; - } - else - { - send_to_char( - "That's not a valid race, class, or clan.\n\r", - ch); - return; - } - } - } - else - { - fRaceRestrict = TRUE; - rgfRace[iRace] = TRUE; - } - } - else - { - fClassRestrict = TRUE; - rgfClass[iClass] = TRUE; - } - } - } - } - - /* - * Now show matching chars. - */ - nMatch = 0; - buf[0] = '\0'; - output = new_buf(); - for ( d = descriptor_list; d != NULL; d = d->next ) - { - CHAR_DATA *wch; - char const *class; - - /* - * Check for match against restrictions. - * Don't use trust as that exposes trusted mortals. - */ - if ( d->connected != CON_PLAYING || !can_see( ch, d->character ) ) - continue; - - wch = ( d->original != NULL ) ? d->original : d->character; - - if (!can_see(ch,wch)) - continue; - - if ( wch->level < iLevelLower - || wch->level > iLevelUpper - || ( fImmortalOnly && wch->level < LEVEL_IMMORTAL ) - || ( fClassRestrict && !rgfClass[wch->class] ) - || ( fRaceRestrict && !rgfRace[wch->race]) - || ( fClan && !is_clan(wch)) - || ( fClanRestrict && !rgfClan[wch->clan])) - continue; - - nMatch++; - - /* - * Figure out what to print for class. - */ - class = class_table[wch->class].who_name; - switch ( wch->level ) - { - default: break; - { - case MAX_LEVEL - 0 : class = "IMP"; break; - case MAX_LEVEL - 1 : class = "CRE"; break; - case MAX_LEVEL - 2 : class = "SUP"; break; - case MAX_LEVEL - 3 : class = "DEI"; break; - case MAX_LEVEL - 4 : class = "GOD"; break; - case MAX_LEVEL - 5 : class = "IMM"; break; - case MAX_LEVEL - 6 : class = "DEM"; break; - case MAX_LEVEL - 7 : class = "ANG"; break; - case MAX_LEVEL - 8 : class = "AVA"; break; - } - } - - /* - * Format it up. - */ - sprintf( buf, "[%2d %6s %s] %s%s%s%s%s%s%s%s\n\r", - wch->level, - wch->race < MAX_PC_RACE ? pc_race_table[wch->race].who_name - : " ", - class, - wch->incog_level >= LEVEL_HERO ? "(Incog) " : "", - wch->invis_level >= LEVEL_HERO ? "(Wizi) " : "", - clan_table[wch->clan].who_name, - IS_SET(wch->comm, COMM_AFK) ? "[AFK] " : "", - IS_SET(wch->act, PLR_KILLER) ? "(KILLER) " : "", - IS_SET(wch->act, PLR_THIEF) ? "(THIEF) " : "", - wch->name, - IS_NPC(wch) ? "" : wch->pcdata->title ); - add_buf(output,buf); - } - - sprintf( buf2, "\n\rPlayers found: %d\n\r", nMatch ); - add_buf(output,buf2); - page_to_char( buf_string(output), ch ); - free_buf(output); - return; -} - -void do_count ( CHAR_DATA *ch, char *argument ) -{ - int count; - DESCRIPTOR_DATA *d; - char buf[MAX_STRING_LENGTH]; - - count = 0; - - for ( d = descriptor_list; d != NULL; d = d->next ) - if ( d->connected == CON_PLAYING && can_see( ch, d->character ) ) - count++; - - max_on = UMAX(count,max_on); - - if (max_on == count) - sprintf(buf,"There are %d characters on, the most so far today.\n\r", - count); - else - sprintf(buf,"There are %d characters on, the most on today was %d.\n\r", - count,max_on); - - send_to_char(buf,ch); -} - -void do_inventory( CHAR_DATA *ch, char *argument ) -{ - send_to_char( "You are carrying:\n\r", ch ); - show_list_to_char( ch->carrying, ch, TRUE, TRUE ); - return; -} - - - -void do_equipment( CHAR_DATA *ch, char *argument ) -{ - OBJ_DATA *obj; - int iWear; - bool found; - - send_to_char( "You are using:\n\r", ch ); - found = FALSE; - for ( iWear = 0; iWear < MAX_WEAR; iWear++ ) - { - if ( ( obj = get_eq_char( ch, iWear ) ) == NULL ) - continue; - - send_to_char( where_name[iWear], ch ); - if ( can_see_obj( ch, obj ) ) - { - send_to_char( format_obj_to_char( obj, ch, TRUE ), ch ); - send_to_char( "\n\r", ch ); - } - else - { - send_to_char( "something.\n\r", ch ); - } - found = TRUE; - } - - if ( !found ) - send_to_char( "Nothing.\n\r", ch ); - - return; -} - - - -void do_compare( CHAR_DATA *ch, char *argument ) -{ - char arg1[MAX_INPUT_LENGTH]; - char arg2[MAX_INPUT_LENGTH]; - OBJ_DATA *obj1; - OBJ_DATA *obj2; - int value1; - int value2; - char *msg; - - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - if ( arg1[0] == '\0' ) - { - send_to_char( "Compare what to what?\n\r", ch ); - return; - } - - if ( ( obj1 = get_obj_carry( ch, arg1, ch ) ) == NULL ) - { - send_to_char( "You do not have that item.\n\r", ch ); - return; - } - - if (arg2[0] == '\0') - { - for (obj2 = ch->carrying; obj2 != NULL; obj2 = obj2->next_content) - { - if (obj2->wear_loc != WEAR_NONE - && can_see_obj(ch,obj2) - && obj1->item_type == obj2->item_type - && (obj1->wear_flags & obj2->wear_flags & ~ITEM_TAKE) != 0 ) - break; - } - - if (obj2 == NULL) - { - send_to_char("You aren't wearing anything comparable.\n\r",ch); - return; - } - } - - else if ( (obj2 = get_obj_carry(ch,arg2,ch) ) == NULL ) - { - send_to_char("You do not have that item.\n\r",ch); - return; - } - - msg = NULL; - value1 = 0; - value2 = 0; - - if ( obj1 == obj2 ) - { - msg = "You compare $p to itself. It looks about the same."; - } - else if ( obj1->item_type != obj2->item_type ) - { - msg = "You can't compare $p and $P."; - } - else - { - switch ( obj1->item_type ) - { - default: - msg = "You can't compare $p and $P."; - break; - - case ITEM_ARMOR: - value1 = obj1->value[0] + obj1->value[1] + obj1->value[2]; - value2 = obj2->value[0] + obj2->value[1] + obj2->value[2]; - break; - - case ITEM_WEAPON: - if (obj1->pIndexData->new_format) - value1 = (1 + obj1->value[2]) * obj1->value[1]; - else - value1 = obj1->value[1] + obj1->value[2]; - - if (obj2->pIndexData->new_format) - value2 = (1 + obj2->value[2]) * obj2->value[1]; - else - value2 = obj2->value[1] + obj2->value[2]; - break; - } - } - - if ( msg == NULL ) - { - if ( value1 == value2 ) msg = "$p and $P look about the same."; - else if ( value1 > value2 ) msg = "$p looks better than $P."; - else msg = "$p looks worse than $P."; - } - - act( msg, ch, obj1, obj2, TO_CHAR ); - return; -} - - - -void do_credits( CHAR_DATA *ch, char *argument ) -{ - do_function(ch, &do_help, "diku" ); - return; -} - - - -void do_where( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - DESCRIPTOR_DATA *d; - bool found; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Players near you:\n\r", ch ); - found = FALSE; - for ( d = descriptor_list; d; d = d->next ) - { - if ( d->connected == CON_PLAYING - && ( victim = d->character ) != NULL - && !IS_NPC(victim) - && victim->in_room != NULL - && !IS_SET(victim->in_room->room_flags,ROOM_NOWHERE) - && (is_room_owner(ch,victim->in_room) - || !room_is_private(victim->in_room)) - && victim->in_room->area == ch->in_room->area - && can_see( ch, victim ) ) - { - found = TRUE; - sprintf( buf, "%-28s %s\n\r", - victim->name, victim->in_room->name ); - send_to_char( buf, ch ); - } - } - if ( !found ) - send_to_char( "None\n\r", ch ); - } - else - { - found = FALSE; - for ( victim = char_list; victim != NULL; victim = victim->next ) - { - if ( victim->in_room != NULL - && victim->in_room->area == ch->in_room->area - && !IS_AFFECTED(victim, AFF_HIDE) - && !IS_AFFECTED(victim, AFF_SNEAK) - && can_see( ch, victim ) - && is_name( arg, victim->name ) ) - { - found = TRUE; - sprintf( buf, "%-28s %s\n\r", - PERS(victim, ch), victim->in_room->name ); - send_to_char( buf, ch ); - break; - } - } - if ( !found ) - act( "You didn't find any $T.", ch, NULL, arg, TO_CHAR ); - } - - return; -} - - - - -void do_consider( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - char *msg; - int diff; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Consider killing whom?\n\r", ch ); - return; - } - - if ( ( victim = get_char_room( ch, arg ) ) == NULL ) - { - send_to_char( "They're not here.\n\r", ch ); - return; - } - - if (is_safe(ch,victim)) - { - send_to_char("Don't even think about it.\n\r",ch); - return; - } - - diff = victim->level - ch->level; - - if ( diff <= -10 ) msg = "You can kill $N naked and weaponless."; - else if ( diff <= -5 ) msg = "$N is no match for you."; - else if ( diff <= -2 ) msg = "$N looks like an easy kill."; - else if ( diff <= 1 ) msg = "The perfect match!"; - else if ( diff <= 4 ) msg = "$N says 'Do you feel lucky, punk?'."; - else if ( diff <= 9 ) msg = "$N laughs at you mercilessly."; - else msg = "Death will thank you for your gift."; - - act( msg, ch, NULL, victim, TO_CHAR ); - return; -} - - - -void set_title( CHAR_DATA *ch, char *title ) -{ - char buf[MAX_STRING_LENGTH]; - - if ( IS_NPC(ch) ) - { - bug( "Set_title: NPC.", 0 ); - return; - } - - if ( title[0] != '.' && title[0] != ',' && title[0] != '!' && title[0] != '?' ) - { - buf[0] = ' '; - strcpy( buf+1, title ); - } - else - { - strcpy( buf, title ); - } - - free_string( ch->pcdata->title ); - ch->pcdata->title = str_dup( buf ); - return; -} - - - -void do_title( CHAR_DATA *ch, char *argument ) -{ - if ( IS_NPC(ch) ) - return; - - if ( argument[0] == '\0' ) - { - send_to_char( "Change your title to what?\n\r", ch ); - return; - } - - if ( strlen(argument) > 45 ) - argument[45] = '\0'; - - smash_tilde( argument ); - set_title( ch, argument ); - send_to_char( "Ok.\n\r", ch ); -} - - - -void do_description( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - - if ( argument[0] != '\0' ) - { - buf[0] = '\0'; - smash_tilde( argument ); - - if (argument[0] == '-') - { - int len; - bool found = FALSE; - - if (ch->description == NULL || ch->description[0] == '\0') - { - send_to_char("No lines left to remove.\n\r",ch); - return; - } - - strcpy(buf,ch->description); - - for (len = strlen(buf); len > 0; len--) - { - if (buf[len] == '\r') - { - if (!found) /* back it up */ - { - if (len > 0) - len--; - found = TRUE; - } - else /* found the second one */ - { - buf[len + 1] = '\0'; - free_string(ch->description); - ch->description = str_dup(buf); - send_to_char( "Your description is:\n\r", ch ); - send_to_char( ch->description ? ch->description : - "(None).\n\r", ch ); - return; - } - } - } - buf[0] = '\0'; - free_string(ch->description); - ch->description = str_dup(buf); - send_to_char("Description cleared.\n\r",ch); - return; - } - if ( argument[0] == '+' ) - { - if ( ch->description != NULL ) - strcat( buf, ch->description ); - argument++; - while ( isspace(*argument) ) - argument++; - } - - if ( strlen(buf) >= 1024) - { - send_to_char( "Description too long.\n\r", ch ); - return; - } - - strcat( buf, argument ); - strcat( buf, "\n\r" ); - free_string( ch->description ); - ch->description = str_dup( buf ); - } - - send_to_char( "Your description is:\n\r", ch ); - send_to_char( ch->description ? ch->description : "(None).\n\r", ch ); - return; -} - - - -void do_report( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_INPUT_LENGTH]; - - sprintf( buf, - "You say 'I have %d/%d hp %d/%d mana %d/%d mv %d xp.'\n\r", - ch->hit, ch->max_hit, - ch->mana, ch->max_mana, - ch->move, ch->max_move, - ch->exp ); - - send_to_char( buf, ch ); - - sprintf( buf, "$n says 'I have %d/%d hp %d/%d mana %d/%d mv %d xp.'", - ch->hit, ch->max_hit, - ch->mana, ch->max_mana, - ch->move, ch->max_move, - ch->exp ); - - act( buf, ch, NULL, NULL, TO_ROOM ); - - return; -} - - - -void do_practice( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - int sn; - - if ( IS_NPC(ch) ) - return; - - if ( argument[0] == '\0' ) - { - int col; - - col = 0; - for ( sn = 0; sn < MAX_SKILL; sn++ ) - { - if ( skill_table[sn].name == NULL ) - break; - if ( ch->level < skill_table[sn].skill_level[ch->class] - || ch->pcdata->learned[sn] < 1 /* skill is not known */) - continue; - - sprintf( buf, "%-18s %3d%% ", - skill_table[sn].name, ch->pcdata->learned[sn] ); - send_to_char( buf, ch ); - if ( ++col % 3 == 0 ) - send_to_char( "\n\r", ch ); - } - - if ( col % 3 != 0 ) - send_to_char( "\n\r", ch ); - - sprintf( buf, "You have %d practice sessions left.\n\r", - ch->practice ); - send_to_char( buf, ch ); - } - else - { - CHAR_DATA *mob; - int adept; - - if ( !IS_AWAKE(ch) ) - { - send_to_char( "In your dreams, or what?\n\r", ch ); - return; - } - - for ( mob = ch->in_room->people; mob != NULL; mob = mob->next_in_room ) - { - if ( IS_NPC(mob) && IS_SET(mob->act, ACT_PRACTICE) ) - break; - } - - if ( mob == NULL ) - { - send_to_char( "You can't do that here.\n\r", ch ); - return; - } - - if ( ch->practice <= 0 ) - { - send_to_char( "You have no practice sessions left.\n\r", ch ); - return; - } - - if ( ( sn = find_spell( ch,argument ) ) < 0 - || ( !IS_NPC(ch) - && (ch->level < skill_table[sn].skill_level[ch->class] - || ch->pcdata->learned[sn] < 1 /* skill is not known */ - || skill_table[sn].rating[ch->class] == 0))) - { - send_to_char( "You can't practice that.\n\r", ch ); - return; - } - - adept = IS_NPC(ch) ? 100 : class_table[ch->class].skill_adept; - - if ( ch->pcdata->learned[sn] >= adept ) - { - sprintf( buf, "You are already learned at %s.\n\r", - skill_table[sn].name ); - send_to_char( buf, ch ); - } - else - { - ch->practice--; - ch->pcdata->learned[sn] += - int_app[get_curr_stat(ch,STAT_INT)].learn / - skill_table[sn].rating[ch->class]; - if ( ch->pcdata->learned[sn] < adept ) - { - act( "You practice $T.", - ch, NULL, skill_table[sn].name, TO_CHAR ); - act( "$n practices $T.", - ch, NULL, skill_table[sn].name, TO_ROOM ); - } - else - { - ch->pcdata->learned[sn] = adept; - act( "You are now learned at $T.", - ch, NULL, skill_table[sn].name, TO_CHAR ); - act( "$n is now learned at $T.", - ch, NULL, skill_table[sn].name, TO_ROOM ); - } - } - } - return; -} - - - -/* - * 'Wimpy' originally by Dionysos. - */ -void do_wimpy( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - int wimpy; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - wimpy = ch->max_hit / 5; - else - wimpy = atoi( arg ); - - if ( wimpy < 0 ) - { - send_to_char( "Your courage exceeds your wisdom.\n\r", ch ); - return; - } - - if ( wimpy > ch->max_hit/2 ) - { - send_to_char( "Such cowardice ill becomes you.\n\r", ch ); - return; - } - - ch->wimpy = wimpy; - sprintf( buf, "Wimpy set to %d hit points.\n\r", wimpy ); - send_to_char( buf, ch ); - return; -} - - - -void do_password( CHAR_DATA *ch, char *argument ) -{ - char arg1[MAX_INPUT_LENGTH]; - char arg2[MAX_INPUT_LENGTH]; - char *pArg; - char *pwdnew; - char *p; - char cEnd; - - if ( IS_NPC(ch) ) - return; - - /* - * Can't use one_argument here because it smashes case. - * So we just steal all its code. Bleagh. - */ - pArg = arg1; - while ( isspace(*argument) ) - argument++; - - cEnd = ' '; - if ( *argument == '\'' || *argument == '"' ) - cEnd = *argument++; - - while ( *argument != '\0' ) - { - if ( *argument == cEnd ) - { - argument++; - break; - } - *pArg++ = *argument++; - } - *pArg = '\0'; - - pArg = arg2; - while ( isspace(*argument) ) - argument++; - - cEnd = ' '; - if ( *argument == '\'' || *argument == '"' ) - cEnd = *argument++; - - while ( *argument != '\0' ) - { - if ( *argument == cEnd ) - { - argument++; - break; - } - *pArg++ = *argument++; - } - *pArg = '\0'; - - if ( arg1[0] == '\0' || arg2[0] == '\0' ) - { - send_to_char( "Syntax: password .\n\r", ch ); - return; - } - - if ( strcmp( crypt( arg1, ch->pcdata->pwd ), ch->pcdata->pwd ) ) - { - WAIT_STATE( ch, 40 ); - send_to_char( "Wrong password. Wait 10 seconds.\n\r", ch ); - return; - } - - if ( strlen(arg2) < 5 ) - { - send_to_char( - "New password must be at least five characters long.\n\r", ch ); - return; - } - - /* - * No tilde allowed because of player file format. - */ - pwdnew = crypt( arg2, ch->name ); - for ( p = pwdnew; *p != '\0'; p++ ) - { - if ( *p == '~' ) - { - send_to_char( - "New password not acceptable, try again.\n\r", ch ); - return; - } - } - - free_string( ch->pcdata->pwd ); - ch->pcdata->pwd = str_dup( pwdnew ); - save_char_obj( ch ); - send_to_char( "Ok.\n\r", ch ); - return; -} diff --git a/Rom24/src/act_move.c b/Rom24/src/act_move.c deleted file mode 100644 index 4fe4289..0000000 --- a/Rom24/src/act_move.c +++ /dev/null @@ -1,1640 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#include -#else -#include -#include -#endif -#include -#include -#include "merc.h" -#include "interp.h" - -char * const dir_name [] = -{ - "north", "east", "south", "west", "up", "down" -}; - -const sh_int rev_dir [] = -{ - 2, 3, 0, 1, 5, 4 -}; - -const sh_int movement_loss [SECT_MAX] = -{ - 1, 2, 2, 3, 4, 6, 4, 1, 6, 10, 6 -}; - - - -/* - * Local functions. - */ -int find_door args( ( CHAR_DATA *ch, char *arg ) ); -bool has_key args( ( CHAR_DATA *ch, int key ) ); - - - -void move_char( CHAR_DATA *ch, int door, bool follow ) -{ - CHAR_DATA *fch; - CHAR_DATA *fch_next; - ROOM_INDEX_DATA *in_room; - ROOM_INDEX_DATA *to_room; - EXIT_DATA *pexit; - - if ( door < 0 || door > 5 ) - { - bug( "Do_move: bad door %d.", door ); - return; - } - - in_room = ch->in_room; - if ( ( pexit = in_room->exit[door] ) == NULL - || ( to_room = pexit->u1.to_room ) == NULL - || !can_see_room(ch,pexit->u1.to_room)) - { - send_to_char( "Alas, you cannot go that way.\n\r", ch ); - return; - } - - if (IS_SET(pexit->exit_info, EX_CLOSED) - && (!IS_AFFECTED(ch, AFF_PASS_DOOR) || IS_SET(pexit->exit_info,EX_NOPASS)) - && !IS_TRUSTED(ch,ANGEL)) - { - act( "The $d is closed.", ch, NULL, pexit->keyword, TO_CHAR ); - return; - } - - if ( IS_AFFECTED(ch, AFF_CHARM) - && ch->master != NULL - && in_room == ch->master->in_room ) - { - send_to_char( "What? And leave your beloved master?\n\r", ch ); - return; - } - - if ( !is_room_owner(ch,to_room) && room_is_private( to_room ) ) - { - send_to_char( "That room is private right now.\n\r", ch ); - return; - } - - if ( !IS_NPC(ch) ) - { - int iClass, iGuild; - int move; - - for ( iClass = 0; iClass < MAX_CLASS; iClass++ ) - { - for ( iGuild = 0; iGuild < MAX_GUILD; iGuild ++) - { - if ( iClass != ch->class - && to_room->vnum == class_table[iClass].guild[iGuild] ) - { - send_to_char( "You aren't allowed in there.\n\r", ch ); - return; - } - } - } - - if ( in_room->sector_type == SECT_AIR - || to_room->sector_type == SECT_AIR ) - { - if ( !IS_AFFECTED(ch, AFF_FLYING) && !IS_IMMORTAL(ch)) - { - send_to_char( "You can't fly.\n\r", ch ); - return; - } - } - - if (( in_room->sector_type == SECT_WATER_NOSWIM - || to_room->sector_type == SECT_WATER_NOSWIM ) - && !IS_AFFECTED(ch,AFF_FLYING)) - { - OBJ_DATA *obj; - bool found; - - /* - * Look for a boat. - */ - found = FALSE; - - if (IS_IMMORTAL(ch)) - found = TRUE; - - for ( obj = ch->carrying; obj != NULL; obj = obj->next_content ) - { - if ( obj->item_type == ITEM_BOAT ) - { - found = TRUE; - break; - } - } - if ( !found ) - { - send_to_char( "You need a boat to go there.\n\r", ch ); - return; - } - } - - move = movement_loss[UMIN(SECT_MAX-1, in_room->sector_type)] - + movement_loss[UMIN(SECT_MAX-1, to_room->sector_type)] - ; - - move /= 2; /* i.e. the average */ - - - /* conditional effects */ - if (IS_AFFECTED(ch,AFF_FLYING) || IS_AFFECTED(ch,AFF_HASTE)) - move /= 2; - - if (IS_AFFECTED(ch,AFF_SLOW)) - move *= 2; - - if ( ch->move < move ) - { - send_to_char( "You are too exhausted.\n\r", ch ); - return; - } - - WAIT_STATE( ch, 1 ); - ch->move -= move; - } - - if ( !IS_AFFECTED(ch, AFF_SNEAK) - && ch->invis_level < LEVEL_HERO) - act( "$n leaves $T.", ch, NULL, dir_name[door], TO_ROOM ); - - char_from_room( ch ); - char_to_room( ch, to_room ); - if ( !IS_AFFECTED(ch, AFF_SNEAK) - && ch->invis_level < LEVEL_HERO) - act( "$n has arrived.", ch, NULL, NULL, TO_ROOM ); - - do_function(ch, &do_look, "auto" ); - - if (in_room == to_room) /* no circular follows */ - return; - - for ( fch = in_room->people; fch != NULL; fch = fch_next ) - { - fch_next = fch->next_in_room; - - if ( fch->master == ch && IS_AFFECTED(fch,AFF_CHARM) - && fch->position < POS_STANDING) - do_function(fch, &do_stand, ""); - - if ( fch->master == ch && fch->position == POS_STANDING - && can_see_room(fch,to_room)) - { - - if (IS_SET(ch->in_room->room_flags,ROOM_LAW) - && (IS_NPC(fch) && IS_SET(fch->act,ACT_AGGRESSIVE))) - { - act("You can't bring $N into the city.", - ch,NULL,fch,TO_CHAR); - act("You aren't allowed in the city.", - fch,NULL,NULL,TO_CHAR); - continue; - } - - act( "You follow $N.", fch, NULL, ch, TO_CHAR ); - move_char( fch, door, TRUE ); - } - } - - return; -} - - - -void do_north( CHAR_DATA *ch, char *argument ) -{ - move_char( ch, DIR_NORTH, FALSE ); - return; -} - - - -void do_east( CHAR_DATA *ch, char *argument ) -{ - move_char( ch, DIR_EAST, FALSE ); - return; -} - - - -void do_south( CHAR_DATA *ch, char *argument ) -{ - move_char( ch, DIR_SOUTH, FALSE ); - return; -} - - - -void do_west( CHAR_DATA *ch, char *argument ) -{ - move_char( ch, DIR_WEST, FALSE ); - return; -} - - - -void do_up( CHAR_DATA *ch, char *argument ) -{ - move_char( ch, DIR_UP, FALSE ); - return; -} - - - -void do_down( CHAR_DATA *ch, char *argument ) -{ - move_char( ch, DIR_DOWN, FALSE ); - return; -} - - - -int find_door( CHAR_DATA *ch, char *arg ) -{ - EXIT_DATA *pexit; - int door; - - if ( !str_cmp( arg, "n" ) || !str_cmp( arg, "north" ) ) door = 0; - else if ( !str_cmp( arg, "e" ) || !str_cmp( arg, "east" ) ) door = 1; - else if ( !str_cmp( arg, "s" ) || !str_cmp( arg, "south" ) ) door = 2; - else if ( !str_cmp( arg, "w" ) || !str_cmp( arg, "west" ) ) door = 3; - else if ( !str_cmp( arg, "u" ) || !str_cmp( arg, "up" ) ) door = 4; - else if ( !str_cmp( arg, "d" ) || !str_cmp( arg, "down" ) ) door = 5; - else - { - for ( door = 0; door <= 5; door++ ) - { - if ( ( pexit = ch->in_room->exit[door] ) != NULL - && IS_SET(pexit->exit_info, EX_ISDOOR) - && pexit->keyword != NULL - && is_name( arg, pexit->keyword ) ) - return door; - } - act( "I see no $T here.", ch, NULL, arg, TO_CHAR ); - return -1; - } - - if ( ( pexit = ch->in_room->exit[door] ) == NULL ) - { - act( "I see no door $T here.", ch, NULL, arg, TO_CHAR ); - return -1; - } - - if ( !IS_SET(pexit->exit_info, EX_ISDOOR) ) - { - send_to_char( "You can't do that.\n\r", ch ); - return -1; - } - - return door; -} - - - -void do_open( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - int door; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Open what?\n\r", ch ); - return; - } - - if ( ( obj = get_obj_here( ch, arg ) ) != NULL ) - { - /* open portal */ - if (obj->item_type == ITEM_PORTAL) - { - if (!IS_SET(obj->value[1], EX_ISDOOR)) - { - send_to_char("You can't do that.\n\r",ch); - return; - } - - if (!IS_SET(obj->value[1], EX_CLOSED)) - { - send_to_char("It's already open.\n\r",ch); - return; - } - - if (IS_SET(obj->value[1], EX_LOCKED)) - { - send_to_char("It's locked.\n\r",ch); - return; - } - - REMOVE_BIT(obj->value[1], EX_CLOSED); - act("You open $p.",ch,obj,NULL,TO_CHAR); - act("$n opens $p.",ch,obj,NULL,TO_ROOM); - return; - } - - /* 'open object' */ - if ( obj->item_type != ITEM_CONTAINER) - { send_to_char( "That's not a container.\n\r", ch ); return; } - if ( !IS_SET(obj->value[1], CONT_CLOSED) ) - { send_to_char( "It's already open.\n\r", ch ); return; } - if ( !IS_SET(obj->value[1], CONT_CLOSEABLE) ) - { send_to_char( "You can't do that.\n\r", ch ); return; } - if ( IS_SET(obj->value[1], CONT_LOCKED) ) - { send_to_char( "It's locked.\n\r", ch ); return; } - - REMOVE_BIT(obj->value[1], CONT_CLOSED); - act("You open $p.",ch,obj,NULL,TO_CHAR); - act( "$n opens $p.", ch, obj, NULL, TO_ROOM ); - return; - } - - if ( ( door = find_door( ch, arg ) ) >= 0 ) - { - /* 'open door' */ - ROOM_INDEX_DATA *to_room; - EXIT_DATA *pexit; - EXIT_DATA *pexit_rev; - - pexit = ch->in_room->exit[door]; - if ( !IS_SET(pexit->exit_info, EX_CLOSED) ) - { send_to_char( "It's already open.\n\r", ch ); return; } - if ( IS_SET(pexit->exit_info, EX_LOCKED) ) - { send_to_char( "It's locked.\n\r", ch ); return; } - - REMOVE_BIT(pexit->exit_info, EX_CLOSED); - act( "$n opens the $d.", ch, NULL, pexit->keyword, TO_ROOM ); - send_to_char( "Ok.\n\r", ch ); - - /* open the other side */ - if ( ( to_room = pexit->u1.to_room ) != NULL - && ( pexit_rev = to_room->exit[rev_dir[door]] ) != NULL - && pexit_rev->u1.to_room == ch->in_room ) - { - CHAR_DATA *rch; - - REMOVE_BIT( pexit_rev->exit_info, EX_CLOSED ); - for ( rch = to_room->people; rch != NULL; rch = rch->next_in_room ) - act( "The $d opens.", rch, NULL, pexit_rev->keyword, TO_CHAR ); - } - } - - return; -} - - - -void do_close( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - int door; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Close what?\n\r", ch ); - return; - } - - if ( ( obj = get_obj_here( ch, arg ) ) != NULL ) - { - /* portal stuff */ - if (obj->item_type == ITEM_PORTAL) - { - - if (!IS_SET(obj->value[1],EX_ISDOOR) - || IS_SET(obj->value[1],EX_NOCLOSE)) - { - send_to_char("You can't do that.\n\r",ch); - return; - } - - if (IS_SET(obj->value[1],EX_CLOSED)) - { - send_to_char("It's already closed.\n\r",ch); - return; - } - - SET_BIT(obj->value[1],EX_CLOSED); - act("You close $p.",ch,obj,NULL,TO_CHAR); - act("$n closes $p.",ch,obj,NULL,TO_ROOM); - return; - } - - /* 'close object' */ - if ( obj->item_type != ITEM_CONTAINER ) - { send_to_char( "That's not a container.\n\r", ch ); return; } - if ( IS_SET(obj->value[1], CONT_CLOSED) ) - { send_to_char( "It's already closed.\n\r", ch ); return; } - if ( !IS_SET(obj->value[1], CONT_CLOSEABLE) ) - { send_to_char( "You can't do that.\n\r", ch ); return; } - - SET_BIT(obj->value[1], CONT_CLOSED); - act("You close $p.",ch,obj,NULL,TO_CHAR); - act( "$n closes $p.", ch, obj, NULL, TO_ROOM ); - return; - } - - if ( ( door = find_door( ch, arg ) ) >= 0 ) - { - /* 'close door' */ - ROOM_INDEX_DATA *to_room; - EXIT_DATA *pexit; - EXIT_DATA *pexit_rev; - - pexit = ch->in_room->exit[door]; - if ( IS_SET(pexit->exit_info, EX_CLOSED) ) - { send_to_char( "It's already closed.\n\r", ch ); return; } - - SET_BIT(pexit->exit_info, EX_CLOSED); - act( "$n closes the $d.", ch, NULL, pexit->keyword, TO_ROOM ); - send_to_char( "Ok.\n\r", ch ); - - /* close the other side */ - if ( ( to_room = pexit->u1.to_room ) != NULL - && ( pexit_rev = to_room->exit[rev_dir[door]] ) != 0 - && pexit_rev->u1.to_room == ch->in_room ) - { - CHAR_DATA *rch; - - SET_BIT( pexit_rev->exit_info, EX_CLOSED ); - for ( rch = to_room->people; rch != NULL; rch = rch->next_in_room ) - act( "The $d closes.", rch, NULL, pexit_rev->keyword, TO_CHAR ); - } - } - - return; -} - - - -bool has_key( CHAR_DATA *ch, int key ) -{ - OBJ_DATA *obj; - - for ( obj = ch->carrying; obj != NULL; obj = obj->next_content ) - { - if ( obj->pIndexData->vnum == key ) - return TRUE; - } - - return FALSE; -} - - - -void do_lock( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - int door; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Lock what?\n\r", ch ); - return; - } - - if ( ( obj = get_obj_here( ch, arg ) ) != NULL ) - { - /* portal stuff */ - if (obj->item_type == ITEM_PORTAL) - { - if (!IS_SET(obj->value[1],EX_ISDOOR) - || IS_SET(obj->value[1],EX_NOCLOSE)) - { - send_to_char("You can't do that.\n\r",ch); - return; - } - if (!IS_SET(obj->value[1],EX_CLOSED)) - { - send_to_char("It's not closed.\n\r",ch); - return; - } - - if (obj->value[4] < 0 || IS_SET(obj->value[1],EX_NOLOCK)) - { - send_to_char("It can't be locked.\n\r",ch); - return; - } - - if (!has_key(ch,obj->value[4])) - { - send_to_char("You lack the key.\n\r",ch); - return; - } - - if (IS_SET(obj->value[1],EX_LOCKED)) - { - send_to_char("It's already locked.\n\r",ch); - return; - } - - SET_BIT(obj->value[1],EX_LOCKED); - act("You lock $p.",ch,obj,NULL,TO_CHAR); - act("$n locks $p.",ch,obj,NULL,TO_ROOM); - return; - } - - /* 'lock object' */ - if ( obj->item_type != ITEM_CONTAINER ) - { send_to_char( "That's not a container.\n\r", ch ); return; } - if ( !IS_SET(obj->value[1], CONT_CLOSED) ) - { send_to_char( "It's not closed.\n\r", ch ); return; } - if ( obj->value[2] < 0 ) - { send_to_char( "It can't be locked.\n\r", ch ); return; } - if ( !has_key( ch, obj->value[2] ) ) - { send_to_char( "You lack the key.\n\r", ch ); return; } - if ( IS_SET(obj->value[1], CONT_LOCKED) ) - { send_to_char( "It's already locked.\n\r", ch ); return; } - - SET_BIT(obj->value[1], CONT_LOCKED); - act("You lock $p.",ch,obj,NULL,TO_CHAR); - act( "$n locks $p.", ch, obj, NULL, TO_ROOM ); - return; - } - - if ( ( door = find_door( ch, arg ) ) >= 0 ) - { - /* 'lock door' */ - ROOM_INDEX_DATA *to_room; - EXIT_DATA *pexit; - EXIT_DATA *pexit_rev; - - pexit = ch->in_room->exit[door]; - if ( !IS_SET(pexit->exit_info, EX_CLOSED) ) - { send_to_char( "It's not closed.\n\r", ch ); return; } - if ( pexit->key < 0 ) - { send_to_char( "It can't be locked.\n\r", ch ); return; } - if ( !has_key( ch, pexit->key) ) - { send_to_char( "You lack the key.\n\r", ch ); return; } - if ( IS_SET(pexit->exit_info, EX_LOCKED) ) - { send_to_char( "It's already locked.\n\r", ch ); return; } - - SET_BIT(pexit->exit_info, EX_LOCKED); - send_to_char( "*Click*\n\r", ch ); - act( "$n locks the $d.", ch, NULL, pexit->keyword, TO_ROOM ); - - /* lock the other side */ - if ( ( to_room = pexit->u1.to_room ) != NULL - && ( pexit_rev = to_room->exit[rev_dir[door]] ) != 0 - && pexit_rev->u1.to_room == ch->in_room ) - { - SET_BIT( pexit_rev->exit_info, EX_LOCKED ); - } - } - - return; -} - - - -void do_unlock( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - int door; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Unlock what?\n\r", ch ); - return; - } - - if ( ( obj = get_obj_here( ch, arg ) ) != NULL ) - { - /* portal stuff */ - if (obj->item_type == ITEM_PORTAL) - { - if (!IS_SET(obj->value[1],EX_ISDOOR)) - { - send_to_char("You can't do that.\n\r",ch); - return; - } - - if (!IS_SET(obj->value[1],EX_CLOSED)) - { - send_to_char("It's not closed.\n\r",ch); - return; - } - - if (obj->value[4] < 0) - { - send_to_char("It can't be unlocked.\n\r",ch); - return; - } - - if (!has_key(ch,obj->value[4])) - { - send_to_char("You lack the key.\n\r",ch); - return; - } - - if (!IS_SET(obj->value[1],EX_LOCKED)) - { - send_to_char("It's already unlocked.\n\r",ch); - return; - } - - REMOVE_BIT(obj->value[1],EX_LOCKED); - act("You unlock $p.",ch,obj,NULL,TO_CHAR); - act("$n unlocks $p.",ch,obj,NULL,TO_ROOM); - return; - } - - /* 'unlock object' */ - if ( obj->item_type != ITEM_CONTAINER ) - { send_to_char( "That's not a container.\n\r", ch ); return; } - if ( !IS_SET(obj->value[1], CONT_CLOSED) ) - { send_to_char( "It's not closed.\n\r", ch ); return; } - if ( obj->value[2] < 0 ) - { send_to_char( "It can't be unlocked.\n\r", ch ); return; } - if ( !has_key( ch, obj->value[2] ) ) - { send_to_char( "You lack the key.\n\r", ch ); return; } - if ( !IS_SET(obj->value[1], CONT_LOCKED) ) - { send_to_char( "It's already unlocked.\n\r", ch ); return; } - - REMOVE_BIT(obj->value[1], CONT_LOCKED); - act("You unlock $p.",ch,obj,NULL,TO_CHAR); - act( "$n unlocks $p.", ch, obj, NULL, TO_ROOM ); - return; - } - - if ( ( door = find_door( ch, arg ) ) >= 0 ) - { - /* 'unlock door' */ - ROOM_INDEX_DATA *to_room; - EXIT_DATA *pexit; - EXIT_DATA *pexit_rev; - - pexit = ch->in_room->exit[door]; - if ( !IS_SET(pexit->exit_info, EX_CLOSED) ) - { send_to_char( "It's not closed.\n\r", ch ); return; } - if ( pexit->key < 0 ) - { send_to_char( "It can't be unlocked.\n\r", ch ); return; } - if ( !has_key( ch, pexit->key) ) - { send_to_char( "You lack the key.\n\r", ch ); return; } - if ( !IS_SET(pexit->exit_info, EX_LOCKED) ) - { send_to_char( "It's already unlocked.\n\r", ch ); return; } - - REMOVE_BIT(pexit->exit_info, EX_LOCKED); - send_to_char( "*Click*\n\r", ch ); - act( "$n unlocks the $d.", ch, NULL, pexit->keyword, TO_ROOM ); - - /* unlock the other side */ - if ( ( to_room = pexit->u1.to_room ) != NULL - && ( pexit_rev = to_room->exit[rev_dir[door]] ) != NULL - && pexit_rev->u1.to_room == ch->in_room ) - { - REMOVE_BIT( pexit_rev->exit_info, EX_LOCKED ); - } - } - - return; -} - - - -void do_pick( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *gch; - OBJ_DATA *obj; - int door; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Pick what?\n\r", ch ); - return; - } - - WAIT_STATE( ch, skill_table[gsn_pick_lock].beats ); - - /* look for guards */ - for ( gch = ch->in_room->people; gch; gch = gch->next_in_room ) - { - if ( IS_NPC(gch) && IS_AWAKE(gch) && ch->level + 5 < gch->level ) - { - act( "$N is standing too close to the lock.", - ch, NULL, gch, TO_CHAR ); - return; - } - } - - if ( !IS_NPC(ch) && number_percent( ) > get_skill(ch,gsn_pick_lock)) - { - send_to_char( "You failed.\n\r", ch); - check_improve(ch,gsn_pick_lock,FALSE,2); - return; - } - - if ( ( obj = get_obj_here( ch, arg ) ) != NULL ) - { - /* portal stuff */ - if (obj->item_type == ITEM_PORTAL) - { - if (!IS_SET(obj->value[1],EX_ISDOOR)) - { - send_to_char("You can't do that.\n\r",ch); - return; - } - - if (!IS_SET(obj->value[1],EX_CLOSED)) - { - send_to_char("It's not closed.\n\r",ch); - return; - } - - if (obj->value[4] < 0) - { - send_to_char("It can't be unlocked.\n\r",ch); - return; - } - - if (IS_SET(obj->value[1],EX_PICKPROOF)) - { - send_to_char("You failed.\n\r",ch); - return; - } - - REMOVE_BIT(obj->value[1],EX_LOCKED); - act("You pick the lock on $p.",ch,obj,NULL,TO_CHAR); - act("$n picks the lock on $p.",ch,obj,NULL,TO_ROOM); - check_improve(ch,gsn_pick_lock,TRUE,2); - return; - } - - - - - - /* 'pick object' */ - if ( obj->item_type != ITEM_CONTAINER ) - { send_to_char( "That's not a container.\n\r", ch ); return; } - if ( !IS_SET(obj->value[1], CONT_CLOSED) ) - { send_to_char( "It's not closed.\n\r", ch ); return; } - if ( obj->value[2] < 0 ) - { send_to_char( "It can't be unlocked.\n\r", ch ); return; } - if ( !IS_SET(obj->value[1], CONT_LOCKED) ) - { send_to_char( "It's already unlocked.\n\r", ch ); return; } - if ( IS_SET(obj->value[1], CONT_PICKPROOF) ) - { send_to_char( "You failed.\n\r", ch ); return; } - - REMOVE_BIT(obj->value[1], CONT_LOCKED); - act("You pick the lock on $p.",ch,obj,NULL,TO_CHAR); - act("$n picks the lock on $p.",ch,obj,NULL,TO_ROOM); - check_improve(ch,gsn_pick_lock,TRUE,2); - return; - } - - if ( ( door = find_door( ch, arg ) ) >= 0 ) - { - /* 'pick door' */ - ROOM_INDEX_DATA *to_room; - EXIT_DATA *pexit; - EXIT_DATA *pexit_rev; - - pexit = ch->in_room->exit[door]; - if ( !IS_SET(pexit->exit_info, EX_CLOSED) && !IS_IMMORTAL(ch)) - { send_to_char( "It's not closed.\n\r", ch ); return; } - if ( pexit->key < 0 && !IS_IMMORTAL(ch)) - { send_to_char( "It can't be picked.\n\r", ch ); return; } - if ( !IS_SET(pexit->exit_info, EX_LOCKED) ) - { send_to_char( "It's already unlocked.\n\r", ch ); return; } - if ( IS_SET(pexit->exit_info, EX_PICKPROOF) && !IS_IMMORTAL(ch)) - { send_to_char( "You failed.\n\r", ch ); return; } - - REMOVE_BIT(pexit->exit_info, EX_LOCKED); - send_to_char( "*Click*\n\r", ch ); - act( "$n picks the $d.", ch, NULL, pexit->keyword, TO_ROOM ); - check_improve(ch,gsn_pick_lock,TRUE,2); - - /* pick the other side */ - if ( ( to_room = pexit->u1.to_room ) != NULL - && ( pexit_rev = to_room->exit[rev_dir[door]] ) != NULL - && pexit_rev->u1.to_room == ch->in_room ) - { - REMOVE_BIT( pexit_rev->exit_info, EX_LOCKED ); - } - } - - return; -} - - - - -void do_stand( CHAR_DATA *ch, char *argument ) -{ - OBJ_DATA *obj = NULL; - - if (argument[0] != '\0') - { - if (ch->position == POS_FIGHTING) - { - send_to_char("Maybe you should finish fighting first?\n\r",ch); - return; - } - obj = get_obj_list(ch,argument,ch->in_room->contents); - if (obj == NULL) - { - send_to_char("You don't see that here.\n\r",ch); - return; - } - if (obj->item_type != ITEM_FURNITURE - || (!IS_SET(obj->value[2],STAND_AT) - && !IS_SET(obj->value[2],STAND_ON) - && !IS_SET(obj->value[2],STAND_IN))) - { - send_to_char("You can't seem to find a place to stand.\n\r",ch); - return; - } - if (ch->on != obj && count_users(obj) >= obj->value[0]) - { - act_new("There's no room to stand on $p.", - ch,obj,NULL,TO_CHAR,POS_DEAD); - return; - } - ch->on = obj; - } - - switch ( ch->position ) - { - case POS_SLEEPING: - if ( IS_AFFECTED(ch, AFF_SLEEP) ) - { send_to_char( "You can't wake up!\n\r", ch ); return; } - - if (obj == NULL) - { - send_to_char( "You wake and stand up.\n\r", ch ); - act( "$n wakes and stands up.", ch, NULL, NULL, TO_ROOM ); - ch->on = NULL; - } - else if (IS_SET(obj->value[2],STAND_AT)) - { - act_new("You wake and stand at $p.",ch,obj,NULL,TO_CHAR,POS_DEAD); - act("$n wakes and stands at $p.",ch,obj,NULL,TO_ROOM); - } - else if (IS_SET(obj->value[2],STAND_ON)) - { - act_new("You wake and stand on $p.",ch,obj,NULL,TO_CHAR,POS_DEAD); - act("$n wakes and stands on $p.",ch,obj,NULL,TO_ROOM); - } - else - { - act_new("You wake and stand in $p.",ch,obj,NULL,TO_CHAR,POS_DEAD); - act("$n wakes and stands in $p.",ch,obj,NULL,TO_ROOM); - } - ch->position = POS_STANDING; - do_function(ch, &do_look, "auto"); - break; - - case POS_RESTING: case POS_SITTING: - if (obj == NULL) - { - send_to_char( "You stand up.\n\r", ch ); - act( "$n stands up.", ch, NULL, NULL, TO_ROOM ); - ch->on = NULL; - } - else if (IS_SET(obj->value[2],STAND_AT)) - { - act("You stand at $p.",ch,obj,NULL,TO_CHAR); - act("$n stands at $p.",ch,obj,NULL,TO_ROOM); - } - else if (IS_SET(obj->value[2],STAND_ON)) - { - act("You stand on $p.",ch,obj,NULL,TO_CHAR); - act("$n stands on $p.",ch,obj,NULL,TO_ROOM); - } - else - { - act("You stand in $p.",ch,obj,NULL,TO_CHAR); - act("$n stands on $p.",ch,obj,NULL,TO_ROOM); - } - ch->position = POS_STANDING; - break; - - case POS_STANDING: - send_to_char( "You are already standing.\n\r", ch ); - break; - - case POS_FIGHTING: - send_to_char( "You are already fighting!\n\r", ch ); - break; - } - - return; -} - - - -void do_rest( CHAR_DATA *ch, char *argument ) -{ - OBJ_DATA *obj = NULL; - - if (ch->position == POS_FIGHTING) - { - send_to_char("You are already fighting!\n\r",ch); - return; - } - - /* okay, now that we know we can rest, find an object to rest on */ - if (argument[0] != '\0') - { - obj = get_obj_list(ch,argument,ch->in_room->contents); - if (obj == NULL) - { - send_to_char("You don't see that here.\n\r",ch); - return; - } - } - else obj = ch->on; - - if (obj != NULL) - { - if (obj->item_type != ITEM_FURNITURE - || (!IS_SET(obj->value[2],REST_ON) - && !IS_SET(obj->value[2],REST_IN) - && !IS_SET(obj->value[2],REST_AT))) - { - send_to_char("You can't rest on that.\n\r",ch); - return; - } - - if (obj != NULL && ch->on != obj && count_users(obj) >= obj->value[0]) - { - act_new("There's no more room on $p.",ch,obj,NULL,TO_CHAR,POS_DEAD); - return; - } - - ch->on = obj; - } - - switch ( ch->position ) - { - case POS_SLEEPING: - if (IS_AFFECTED(ch,AFF_SLEEP)) - { - send_to_char("You can't wake up!\n\r",ch); - return; - } - - if (obj == NULL) - { - send_to_char( "You wake up and start resting.\n\r", ch ); - act ("$n wakes up and starts resting.",ch,NULL,NULL,TO_ROOM); - } - else if (IS_SET(obj->value[2],REST_AT)) - { - act_new("You wake up and rest at $p.", - ch,obj,NULL,TO_CHAR,POS_SLEEPING); - act("$n wakes up and rests at $p.",ch,obj,NULL,TO_ROOM); - } - else if (IS_SET(obj->value[2],REST_ON)) - { - act_new("You wake up and rest on $p.", - ch,obj,NULL,TO_CHAR,POS_SLEEPING); - act("$n wakes up and rests on $p.",ch,obj,NULL,TO_ROOM); - } - else - { - act_new("You wake up and rest in $p.", - ch,obj,NULL,TO_CHAR,POS_SLEEPING); - act("$n wakes up and rests in $p.",ch,obj,NULL,TO_ROOM); - } - ch->position = POS_RESTING; - break; - - case POS_RESTING: - send_to_char( "You are already resting.\n\r", ch ); - break; - - case POS_STANDING: - if (obj == NULL) - { - send_to_char( "You rest.\n\r", ch ); - act( "$n sits down and rests.", ch, NULL, NULL, TO_ROOM ); - } - else if (IS_SET(obj->value[2],REST_AT)) - { - act("You sit down at $p and rest.",ch,obj,NULL,TO_CHAR); - act("$n sits down at $p and rests.",ch,obj,NULL,TO_ROOM); - } - else if (IS_SET(obj->value[2],REST_ON)) - { - act("You sit on $p and rest.",ch,obj,NULL,TO_CHAR); - act("$n sits on $p and rests.",ch,obj,NULL,TO_ROOM); - } - else - { - act("You rest in $p.",ch,obj,NULL,TO_CHAR); - act("$n rests in $p.",ch,obj,NULL,TO_ROOM); - } - ch->position = POS_RESTING; - break; - - case POS_SITTING: - if (obj == NULL) - { - send_to_char("You rest.\n\r",ch); - act("$n rests.",ch,NULL,NULL,TO_ROOM); - } - else if (IS_SET(obj->value[2],REST_AT)) - { - act("You rest at $p.",ch,obj,NULL,TO_CHAR); - act("$n rests at $p.",ch,obj,NULL,TO_ROOM); - } - else if (IS_SET(obj->value[2],REST_ON)) - { - act("You rest on $p.",ch,obj,NULL,TO_CHAR); - act("$n rests on $p.",ch,obj,NULL,TO_ROOM); - } - else - { - act("You rest in $p.",ch,obj,NULL,TO_CHAR); - act("$n rests in $p.",ch,obj,NULL,TO_ROOM); - } - ch->position = POS_RESTING; - break; - } - - - return; -} - - -void do_sit (CHAR_DATA *ch, char *argument ) -{ - OBJ_DATA *obj = NULL; - - if (ch->position == POS_FIGHTING) - { - send_to_char("Maybe you should finish this fight first?\n\r",ch); - return; - } - - /* okay, now that we know we can sit, find an object to sit on */ - if (argument[0] != '\0') - { - obj = get_obj_list(ch,argument,ch->in_room->contents); - if (obj == NULL) - { - send_to_char("You don't see that here.\n\r",ch); - return; - } - } - else obj = ch->on; - - if (obj != NULL) - { - if (obj->item_type != ITEM_FURNITURE - || (!IS_SET(obj->value[2],SIT_ON) - && !IS_SET(obj->value[2],SIT_IN) - && !IS_SET(obj->value[2],SIT_AT))) - { - send_to_char("You can't sit on that.\n\r",ch); - return; - } - - if (obj != NULL && ch->on != obj && count_users(obj) >= obj->value[0]) - { - act_new("There's no more room on $p.",ch,obj,NULL,TO_CHAR,POS_DEAD); - return; - } - - ch->on = obj; - } - switch (ch->position) - { - case POS_SLEEPING: - if (IS_AFFECTED(ch,AFF_SLEEP)) - { - send_to_char("You can't wake up!\n\r",ch); - return; - } - - if (obj == NULL) - { - send_to_char( "You wake and sit up.\n\r", ch ); - act( "$n wakes and sits up.", ch, NULL, NULL, TO_ROOM ); - } - else if (IS_SET(obj->value[2],SIT_AT)) - { - act_new("You wake and sit at $p.",ch,obj,NULL,TO_CHAR,POS_DEAD); - act("$n wakes and sits at $p.",ch,obj,NULL,TO_ROOM); - } - else if (IS_SET(obj->value[2],SIT_ON)) - { - act_new("You wake and sit on $p.",ch,obj,NULL,TO_CHAR,POS_DEAD); - act("$n wakes and sits at $p.",ch,obj,NULL,TO_ROOM); - } - else - { - act_new("You wake and sit in $p.",ch,obj,NULL,TO_CHAR,POS_DEAD); - act("$n wakes and sits in $p.",ch,obj,NULL,TO_ROOM); - } - - ch->position = POS_SITTING; - break; - case POS_RESTING: - if (obj == NULL) - send_to_char("You stop resting.\n\r",ch); - else if (IS_SET(obj->value[2],SIT_AT)) - { - act("You sit at $p.",ch,obj,NULL,TO_CHAR); - act("$n sits at $p.",ch,obj,NULL,TO_ROOM); - } - - else if (IS_SET(obj->value[2],SIT_ON)) - { - act("You sit on $p.",ch,obj,NULL,TO_CHAR); - act("$n sits on $p.",ch,obj,NULL,TO_ROOM); - } - ch->position = POS_SITTING; - break; - case POS_SITTING: - send_to_char("You are already sitting down.\n\r",ch); - break; - case POS_STANDING: - if (obj == NULL) - { - send_to_char("You sit down.\n\r",ch); - act("$n sits down on the ground.",ch,NULL,NULL,TO_ROOM); - } - else if (IS_SET(obj->value[2],SIT_AT)) - { - act("You sit down at $p.",ch,obj,NULL,TO_CHAR); - act("$n sits down at $p.",ch,obj,NULL,TO_ROOM); - } - else if (IS_SET(obj->value[2],SIT_ON)) - { - act("You sit on $p.",ch,obj,NULL,TO_CHAR); - act("$n sits on $p.",ch,obj,NULL,TO_ROOM); - } - else - { - act("You sit down in $p.",ch,obj,NULL,TO_CHAR); - act("$n sits down in $p.",ch,obj,NULL,TO_ROOM); - } - ch->position = POS_SITTING; - break; - } - return; -} - - -void do_sleep( CHAR_DATA *ch, char *argument ) -{ - OBJ_DATA *obj = NULL; - - switch ( ch->position ) - { - case POS_SLEEPING: - send_to_char( "You are already sleeping.\n\r", ch ); - break; - - case POS_RESTING: - case POS_SITTING: - case POS_STANDING: - if (argument[0] == '\0' && ch->on == NULL) - { - send_to_char( "You go to sleep.\n\r", ch ); - act( "$n goes to sleep.", ch, NULL, NULL, TO_ROOM ); - ch->position = POS_SLEEPING; - } - else /* find an object and sleep on it */ - { - if (argument[0] == '\0') - obj = ch->on; - else - obj = get_obj_list( ch, argument, ch->in_room->contents ); - - if (obj == NULL) - { - send_to_char("You don't see that here.\n\r",ch); - return; - } - if (obj->item_type != ITEM_FURNITURE - || (!IS_SET(obj->value[2],SLEEP_ON) - && !IS_SET(obj->value[2],SLEEP_IN) - && !IS_SET(obj->value[2],SLEEP_AT))) - { - send_to_char("You can't sleep on that!\n\r",ch); - return; - } - - if (ch->on != obj && count_users(obj) >= obj->value[0]) - { - act_new("There is no room on $p for you.", - ch,obj,NULL,TO_CHAR,POS_DEAD); - return; - } - - ch->on = obj; - if (IS_SET(obj->value[2],SLEEP_AT)) - { - act("You go to sleep at $p.",ch,obj,NULL,TO_CHAR); - act("$n goes to sleep at $p.",ch,obj,NULL,TO_ROOM); - } - else if (IS_SET(obj->value[2],SLEEP_ON)) - { - act("You go to sleep on $p.",ch,obj,NULL,TO_CHAR); - act("$n goes to sleep on $p.",ch,obj,NULL,TO_ROOM); - } - else - { - act("You go to sleep in $p.",ch,obj,NULL,TO_CHAR); - act("$n goes to sleep in $p.",ch,obj,NULL,TO_ROOM); - } - ch->position = POS_SLEEPING; - } - break; - - case POS_FIGHTING: - send_to_char( "You are already fighting!\n\r", ch ); - break; - } - - return; -} - - - -void do_wake( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - - one_argument( argument, arg ); - if ( arg[0] == '\0' ) - { do_function(ch, &do_stand, ""); return; } - - if ( !IS_AWAKE(ch) ) - { send_to_char( "You are asleep yourself!\n\r", ch ); return; } - - if ( ( victim = get_char_room( ch, arg ) ) == NULL ) - { send_to_char( "They aren't here.\n\r", ch ); return; } - - if ( IS_AWAKE(victim) ) - { act( "$N is already awake.", ch, NULL, victim, TO_CHAR ); return; } - - if ( IS_AFFECTED(victim, AFF_SLEEP) ) - { act( "You can't wake $M!", ch, NULL, victim, TO_CHAR ); return; } - - act_new( "$n wakes you.", ch, NULL, victim, TO_VICT,POS_SLEEPING ); - do_function(ch, &do_stand, ""); - return; -} - - - -void do_sneak( CHAR_DATA *ch, char *argument ) -{ - AFFECT_DATA af; - - send_to_char( "You attempt to move silently.\n\r", ch ); - affect_strip( ch, gsn_sneak ); - - if (IS_AFFECTED(ch,AFF_SNEAK)) - return; - - if ( number_percent( ) < get_skill(ch,gsn_sneak)) - { - check_improve(ch,gsn_sneak,TRUE,3); - af.where = TO_AFFECTS; - af.type = gsn_sneak; - af.level = ch->level; - af.duration = ch->level; - af.location = APPLY_NONE; - af.modifier = 0; - af.bitvector = AFF_SNEAK; - affect_to_char( ch, &af ); - } - else - check_improve(ch,gsn_sneak,FALSE,3); - - return; -} - - - -void do_hide( CHAR_DATA *ch, char *argument ) -{ - send_to_char( "You attempt to hide.\n\r", ch ); - - if ( IS_AFFECTED(ch, AFF_HIDE) ) - REMOVE_BIT(ch->affected_by, AFF_HIDE); - - if ( number_percent( ) < get_skill(ch,gsn_hide)) - { - SET_BIT(ch->affected_by, AFF_HIDE); - check_improve(ch,gsn_hide,TRUE,3); - } - else - check_improve(ch,gsn_hide,FALSE,3); - - return; -} - - - -/* - * Contributed by Alander. - */ -void do_visible( CHAR_DATA *ch, char *argument ) -{ - affect_strip ( ch, gsn_invis ); - affect_strip ( ch, gsn_mass_invis ); - affect_strip ( ch, gsn_sneak ); - REMOVE_BIT ( ch->affected_by, AFF_HIDE ); - REMOVE_BIT ( ch->affected_by, AFF_INVISIBLE ); - REMOVE_BIT ( ch->affected_by, AFF_SNEAK ); - send_to_char( "Ok.\n\r", ch ); - return; -} - - - -void do_recall( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - CHAR_DATA *victim; - ROOM_INDEX_DATA *location; - - if (IS_NPC(ch) && !IS_SET(ch->act,ACT_PET)) - { - send_to_char("Only players can recall.\n\r",ch); - return; - } - - act( "$n prays for transportation!", ch, 0, 0, TO_ROOM ); - - if ( ( location = get_room_index( ROOM_VNUM_TEMPLE ) ) == NULL ) - { - send_to_char( "You are completely lost.\n\r", ch ); - return; - } - - if ( ch->in_room == location ) - return; - - if ( IS_SET(ch->in_room->room_flags, ROOM_NO_RECALL) - || IS_AFFECTED(ch, AFF_CURSE)) - { - send_to_char( "Mota has forsaken you.\n\r", ch ); - return; - } - - if ( ( victim = ch->fighting ) != NULL ) - { - int lose,skill; - - skill = get_skill(ch,gsn_recall); - - if ( number_percent() < 80 * skill / 100 ) - { - check_improve(ch,gsn_recall,FALSE,6); - WAIT_STATE( ch, 4 ); - sprintf( buf, "You failed!.\n\r"); - send_to_char( buf, ch ); - return; - } - - lose = (ch->desc != NULL) ? 25 : 50; - gain_exp( ch, 0 - lose ); - check_improve(ch,gsn_recall,TRUE,4); - sprintf( buf, "You recall from combat! You lose %d exps.\n\r", lose ); - send_to_char( buf, ch ); - stop_fighting( ch, TRUE ); - - } - - ch->move /= 2; - act( "$n disappears.", ch, NULL, NULL, TO_ROOM ); - char_from_room( ch ); - char_to_room( ch, location ); - act( "$n appears in the room.", ch, NULL, NULL, TO_ROOM ); - do_function(ch, &do_look, "auto" ); - - if (ch->pet != NULL) - do_function(ch->pet, &do_recall, ""); - - return; -} - - - -void do_train( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - CHAR_DATA *mob; - sh_int stat = - 1; - char *pOutput = NULL; - int cost; - - if ( IS_NPC(ch) ) - return; - - /* - * Check for trainer. - */ - for ( mob = ch->in_room->people; mob; mob = mob->next_in_room ) - { - if ( IS_NPC(mob) && IS_SET(mob->act, ACT_TRAIN) ) - break; - } - - if ( mob == NULL ) - { - send_to_char( "You can't do that here.\n\r", ch ); - return; - } - - if ( argument[0] == '\0' ) - { - sprintf( buf, "You have %d training sessions.\n\r", ch->train ); - send_to_char( buf, ch ); - argument = "foo"; - } - - cost = 1; - - if ( !str_cmp( argument, "str" ) ) - { - if ( class_table[ch->class].attr_prime == STAT_STR ) - cost = 1; - stat = STAT_STR; - pOutput = "strength"; - } - - else if ( !str_cmp( argument, "int" ) ) - { - if ( class_table[ch->class].attr_prime == STAT_INT ) - cost = 1; - stat = STAT_INT; - pOutput = "intelligence"; - } - - else if ( !str_cmp( argument, "wis" ) ) - { - if ( class_table[ch->class].attr_prime == STAT_WIS ) - cost = 1; - stat = STAT_WIS; - pOutput = "wisdom"; - } - - else if ( !str_cmp( argument, "dex" ) ) - { - if ( class_table[ch->class].attr_prime == STAT_DEX ) - cost = 1; - stat = STAT_DEX; - pOutput = "dexterity"; - } - - else if ( !str_cmp( argument, "con" ) ) - { - if ( class_table[ch->class].attr_prime == STAT_CON ) - cost = 1; - stat = STAT_CON; - pOutput = "constitution"; - } - - else if ( !str_cmp(argument, "hp" ) ) - cost = 1; - - else if ( !str_cmp(argument, "mana" ) ) - cost = 1; - - else - { - strcpy( buf, "You can train:" ); - if ( ch->perm_stat[STAT_STR] < get_max_train(ch,STAT_STR)) - strcat( buf, " str" ); - if ( ch->perm_stat[STAT_INT] < get_max_train(ch,STAT_INT)) - strcat( buf, " int" ); - if ( ch->perm_stat[STAT_WIS] < get_max_train(ch,STAT_WIS)) - strcat( buf, " wis" ); - if ( ch->perm_stat[STAT_DEX] < get_max_train(ch,STAT_DEX)) - strcat( buf, " dex" ); - if ( ch->perm_stat[STAT_CON] < get_max_train(ch,STAT_CON)) - strcat( buf, " con" ); - strcat( buf, " hp mana"); - - if ( buf[strlen(buf)-1] != ':' ) - { - strcat( buf, ".\n\r" ); - send_to_char( buf, ch ); - } - else - { - /* - * This message dedicated to Jordan ... you big stud! - */ - act( "You have nothing left to train, you $T!", - ch, NULL, - ch->sex == SEX_MALE ? "big stud" : - ch->sex == SEX_FEMALE ? "hot babe" : - "wild thing", - TO_CHAR ); - } - - return; - } - - if (!str_cmp("hp",argument)) - { - if ( cost > ch->train ) - { - send_to_char( "You don't have enough training sessions.\n\r", ch ); - return; - } - - ch->train -= cost; - ch->pcdata->perm_hit += 10; - ch->max_hit += 10; - ch->hit +=10; - act( "Your durability increases!",ch,NULL,NULL,TO_CHAR); - act( "$n's durability increases!",ch,NULL,NULL,TO_ROOM); - return; - } - - if (!str_cmp("mana",argument)) - { - if ( cost > ch->train ) - { - send_to_char( "You don't have enough training sessions.\n\r", ch ); - return; - } - - ch->train -= cost; - ch->pcdata->perm_mana += 10; - ch->max_mana += 10; - ch->mana += 10; - act( "Your power increases!",ch,NULL,NULL,TO_CHAR); - act( "$n's power increases!",ch,NULL,NULL,TO_ROOM); - return; - } - - if ( ch->perm_stat[stat] >= get_max_train(ch,stat) ) - { - act( "Your $T is already at maximum.", ch, NULL, pOutput, TO_CHAR ); - return; - } - - if ( cost > ch->train ) - { - send_to_char( "You don't have enough training sessions.\n\r", ch ); - return; - } - - ch->train -= cost; - - ch->perm_stat[stat] += 1; - act( "Your $T increases!", ch, NULL, pOutput, TO_CHAR ); - act( "$n's $T increases!", ch, NULL, pOutput, TO_ROOM ); - return; -} diff --git a/Rom24/src/act_obj.c b/Rom24/src/act_obj.c deleted file mode 100644 index ede4c33..0000000 --- a/Rom24/src/act_obj.c +++ /dev/null @@ -1,2989 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#include -#else -#include -#include -#endif -#include -#include -#include -#include "merc.h" -#include "interp.h" - -/* - * Local functions. - */ -#define CD CHAR_DATA -#define OD OBJ_DATA -bool remove_obj args( (CHAR_DATA *ch, int iWear, bool fReplace ) ); -void wear_obj args( (CHAR_DATA *ch, OBJ_DATA *obj, bool fReplace ) ); -CD * find_keeper args( (CHAR_DATA *ch ) ); -int get_cost args( (CHAR_DATA *keeper, OBJ_DATA *obj, bool fBuy ) ); -void obj_to_keeper args( (OBJ_DATA *obj, CHAR_DATA *ch ) ); -OD * get_obj_keeper args( (CHAR_DATA *ch,CHAR_DATA *keeper,char *argument)); - -#undef OD -#undef CD - -/* RT part of the corpse looting code */ - -bool can_loot(CHAR_DATA *ch, OBJ_DATA *obj) -{ - CHAR_DATA *owner, *wch; - - if (IS_IMMORTAL(ch)) - return TRUE; - - if (!obj->owner || obj->owner == NULL) - return TRUE; - - owner = NULL; - for ( wch = char_list; wch != NULL ; wch = wch->next ) - if (!str_cmp(wch->name,obj->owner)) - owner = wch; - - if (owner == NULL) - return TRUE; - - if (!str_cmp(ch->name,owner->name)) - return TRUE; - - if (!IS_NPC(owner) && IS_SET(owner->act,PLR_CANLOOT)) - return TRUE; - - if (is_same_group(ch,owner)) - return TRUE; - - return FALSE; -} - - -void get_obj( CHAR_DATA *ch, OBJ_DATA *obj, OBJ_DATA *container ) -{ - /* variables for AUTOSPLIT */ - CHAR_DATA *gch; - int members; - char buffer[100]; - - if ( !CAN_WEAR(obj, ITEM_TAKE) ) - { - send_to_char( "You can't take that.\n\r", ch ); - return; - } - - if ( ch->carry_number + get_obj_number( obj ) > can_carry_n( ch ) ) - { - act( "$d: you can't carry that many items.", - ch, NULL, obj->name, TO_CHAR ); - return; - } - - if ((!obj->in_obj || obj->in_obj->carried_by != ch) - && (get_carry_weight(ch) + get_obj_weight(obj) > can_carry_w(ch))) - { - act( "$d: you can't carry that much weight.", - ch, NULL, obj->name, TO_CHAR ); - return; - } - - if (!can_loot(ch,obj)) - { - act("Corpse looting is not permitted.",ch,NULL,NULL,TO_CHAR ); - return; - } - - if (obj->in_room != NULL) - { - for (gch = obj->in_room->people; gch != NULL; gch = gch->next_in_room) - if (gch->on == obj) - { - act("$N appears to be using $p.", - ch,obj,gch,TO_CHAR); - return; - } - } - - - if ( container != NULL ) - { - if (container->pIndexData->vnum == OBJ_VNUM_PIT - && get_trust(ch) < obj->level) - { - send_to_char("You are not powerful enough to use it.\n\r",ch); - return; - } - - if (container->pIndexData->vnum == OBJ_VNUM_PIT - && !CAN_WEAR(container, ITEM_TAKE) - && !IS_OBJ_STAT(obj,ITEM_HAD_TIMER)) - obj->timer = 0; - act( "You get $p from $P.", ch, obj, container, TO_CHAR ); - act( "$n gets $p from $P.", ch, obj, container, TO_ROOM ); - REMOVE_BIT(obj->extra_flags,ITEM_HAD_TIMER); - obj_from_obj( obj ); - } - else - { - act( "You get $p.", ch, obj, container, TO_CHAR ); - act( "$n gets $p.", ch, obj, container, TO_ROOM ); - obj_from_room( obj ); - } - - if ( obj->item_type == ITEM_MONEY) - { - ch->silver += obj->value[0]; - ch->gold += obj->value[1]; - if (IS_SET(ch->act,PLR_AUTOSPLIT)) - { /* AUTOSPLIT code */ - members = 0; - for (gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room ) - { - if (!IS_AFFECTED(gch,AFF_CHARM) && is_same_group( gch, ch ) ) - members++; - } - - if ( members > 1 && (obj->value[0] > 1 || obj->value[1])) - { - sprintf(buffer,"%d %d",obj->value[0],obj->value[1]); - do_function(ch, &do_split, buffer); - } - } - - extract_obj( obj ); - } - else - { - obj_to_char( obj, ch ); - } - - return; -} - - - -void do_get( CHAR_DATA *ch, char *argument ) -{ - char arg1[MAX_INPUT_LENGTH]; - char arg2[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - OBJ_DATA *obj_next; - OBJ_DATA *container; - bool found; - - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - - if (!str_cmp(arg2,"from")) - argument = one_argument(argument,arg2); - - /* Get type. */ - if ( arg1[0] == '\0' ) - { - send_to_char( "Get what?\n\r", ch ); - return; - } - - if ( arg2[0] == '\0' ) - { - if ( str_cmp( arg1, "all" ) && str_prefix( "all.", arg1 ) ) - { - /* 'get obj' */ - obj = get_obj_list( ch, arg1, ch->in_room->contents ); - if ( obj == NULL ) - { - act( "I see no $T here.", ch, NULL, arg1, TO_CHAR ); - return; - } - - get_obj( ch, obj, NULL ); - } - else - { - /* 'get all' or 'get all.obj' */ - found = FALSE; - for ( obj = ch->in_room->contents; obj != NULL; obj = obj_next ) - { - obj_next = obj->next_content; - if ( ( arg1[3] == '\0' || is_name( &arg1[4], obj->name ) ) - && can_see_obj( ch, obj ) ) - { - found = TRUE; - get_obj( ch, obj, NULL ); - } - } - - if ( !found ) - { - if ( arg1[3] == '\0' ) - send_to_char( "I see nothing here.\n\r", ch ); - else - act( "I see no $T here.", ch, NULL, &arg1[4], TO_CHAR ); - } - } - } - else - { - /* 'get ... container' */ - if ( !str_cmp( arg2, "all" ) || !str_prefix( "all.", arg2 ) ) - { - send_to_char( "You can't do that.\n\r", ch ); - return; - } - - if ( ( container = get_obj_here( ch, arg2 ) ) == NULL ) - { - act( "I see no $T here.", ch, NULL, arg2, TO_CHAR ); - return; - } - - switch ( container->item_type ) - { - default: - send_to_char( "That's not a container.\n\r", ch ); - return; - - case ITEM_CONTAINER: - case ITEM_CORPSE_NPC: - break; - - case ITEM_CORPSE_PC: - { - - if (!can_loot(ch,container)) - { - send_to_char( "You can't do that.\n\r", ch ); - return; - } - } - } - - if ( IS_SET(container->value[1], CONT_CLOSED) ) - { - act( "The $d is closed.", ch, NULL, container->name, TO_CHAR ); - return; - } - - if ( str_cmp( arg1, "all" ) && str_prefix( "all.", arg1 ) ) - { - /* 'get obj container' */ - obj = get_obj_list( ch, arg1, container->contains ); - if ( obj == NULL ) - { - act( "I see nothing like that in the $T.", - ch, NULL, arg2, TO_CHAR ); - return; - } - get_obj( ch, obj, container ); - } - else - { - /* 'get all container' or 'get all.obj container' */ - found = FALSE; - for ( obj = container->contains; obj != NULL; obj = obj_next ) - { - obj_next = obj->next_content; - if ( ( arg1[3] == '\0' || is_name( &arg1[4], obj->name ) ) - && can_see_obj( ch, obj ) ) - { - found = TRUE; - if (container->pIndexData->vnum == OBJ_VNUM_PIT - && !IS_IMMORTAL(ch)) - { - send_to_char("Don't be so greedy!\n\r",ch); - return; - } - get_obj( ch, obj, container ); - } - } - - if ( !found ) - { - if ( arg1[3] == '\0' ) - act( "I see nothing in the $T.", - ch, NULL, arg2, TO_CHAR ); - else - act( "I see nothing like that in the $T.", - ch, NULL, arg2, TO_CHAR ); - } - } - } - - return; -} - - - -void do_put( CHAR_DATA *ch, char *argument ) -{ - char arg1[MAX_INPUT_LENGTH]; - char arg2[MAX_INPUT_LENGTH]; - OBJ_DATA *container; - OBJ_DATA *obj; - OBJ_DATA *obj_next; - - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - - if (!str_cmp(arg2,"in") || !str_cmp(arg2,"on")) - argument = one_argument(argument,arg2); - - if ( arg1[0] == '\0' || arg2[0] == '\0' ) - { - send_to_char( "Put what in what?\n\r", ch ); - return; - } - - if ( !str_cmp( arg2, "all" ) || !str_prefix( "all.", arg2 ) ) - { - send_to_char( "You can't do that.\n\r", ch ); - return; - } - - if ( ( container = get_obj_here( ch, arg2 ) ) == NULL ) - { - act( "I see no $T here.", ch, NULL, arg2, TO_CHAR ); - return; - } - - if ( container->item_type != ITEM_CONTAINER ) - { - send_to_char( "That's not a container.\n\r", ch ); - return; - } - - if ( IS_SET(container->value[1], CONT_CLOSED) ) - { - act( "The $d is closed.", ch, NULL, container->name, TO_CHAR ); - return; - } - - if ( str_cmp( arg1, "all" ) && str_prefix( "all.", arg1 ) ) - { - /* 'put obj container' */ - if ( ( obj = get_obj_carry( ch, arg1, ch ) ) == NULL ) - { - send_to_char( "You do not have that item.\n\r", ch ); - return; - } - - if ( obj == container ) - { - send_to_char( "You can't fold it into itself.\n\r", ch ); - return; - } - - if ( !can_drop_obj( ch, obj ) ) - { - send_to_char( "You can't let go of it.\n\r", ch ); - return; - } - - if (WEIGHT_MULT(obj) != 100) - { - send_to_char("You have a feeling that would be a bad idea.\n\r",ch); - return; - } - - if (get_obj_weight( obj ) + get_true_weight( container ) - > (container->value[0] * 10) - || get_obj_weight(obj) > (container->value[3] * 10)) - { - send_to_char( "It won't fit.\n\r", ch ); - return; - } - - if (container->pIndexData->vnum == OBJ_VNUM_PIT - && !CAN_WEAR(container,ITEM_TAKE)) - { if (obj->timer) - SET_BIT(obj->extra_flags,ITEM_HAD_TIMER); - else - obj->timer = number_range(100,200); - } - obj_from_char( obj ); - obj_to_obj( obj, container ); - - if (IS_SET(container->value[1],CONT_PUT_ON)) - { - act("$n puts $p on $P.",ch,obj,container, TO_ROOM); - act("You put $p on $P.",ch,obj,container, TO_CHAR); - } - else - { - act( "$n puts $p in $P.", ch, obj, container, TO_ROOM ); - act( "You put $p in $P.", ch, obj, container, TO_CHAR ); - } - } - else - { - /* 'put all container' or 'put all.obj container' */ - for ( obj = ch->carrying; obj != NULL; obj = obj_next ) - { - obj_next = obj->next_content; - - if ( ( arg1[3] == '\0' || is_name( &arg1[4], obj->name ) ) - && can_see_obj( ch, obj ) - && WEIGHT_MULT(obj) == 100 - && obj->wear_loc == WEAR_NONE - && obj != container - && can_drop_obj( ch, obj ) - && get_obj_weight( obj ) + get_true_weight( container ) - <= (container->value[0] * 10) - && get_obj_weight(obj) < (container->value[3] * 10)) - { - if (container->pIndexData->vnum == OBJ_VNUM_PIT - && !CAN_WEAR(obj, ITEM_TAKE) ) - { if (obj->timer) - SET_BIT(obj->extra_flags,ITEM_HAD_TIMER); - else - obj->timer = number_range(100,200); - } - obj_from_char( obj ); - obj_to_obj( obj, container ); - - if (IS_SET(container->value[1],CONT_PUT_ON)) - { - act("$n puts $p on $P.",ch,obj,container, TO_ROOM); - act("You put $p on $P.",ch,obj,container, TO_CHAR); - } - else - { - act( "$n puts $p in $P.", ch, obj, container, TO_ROOM ); - act( "You put $p in $P.", ch, obj, container, TO_CHAR ); - } - } - } - } - - return; -} - - - -void do_drop( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - OBJ_DATA *obj_next; - bool found; - - argument = one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Drop what?\n\r", ch ); - return; - } - - if ( is_number( arg ) ) - { - /* 'drop NNNN coins' */ - int amount, gold = 0, silver = 0; - - amount = atoi(arg); - argument = one_argument( argument, arg ); - if ( amount <= 0 - || ( str_cmp( arg, "coins" ) && str_cmp( arg, "coin" ) && - str_cmp( arg, "gold" ) && str_cmp( arg, "silver") ) ) - { - send_to_char( "Sorry, you can't do that.\n\r", ch ); - return; - } - - if ( !str_cmp( arg, "coins") || !str_cmp(arg,"coin") - || !str_cmp( arg, "silver")) - { - if (ch->silver < amount) - { - send_to_char("You don't have that much silver.\n\r",ch); - return; - } - - ch->silver -= amount; - silver = amount; - } - - else - { - if (ch->gold < amount) - { - send_to_char("You don't have that much gold.\n\r",ch); - return; - } - - ch->gold -= amount; - gold = amount; - } - - for ( obj = ch->in_room->contents; obj != NULL; obj = obj_next ) - { - obj_next = obj->next_content; - - switch ( obj->pIndexData->vnum ) - { - case OBJ_VNUM_SILVER_ONE: - silver += 1; - extract_obj(obj); - break; - - case OBJ_VNUM_GOLD_ONE: - gold += 1; - extract_obj( obj ); - break; - - case OBJ_VNUM_SILVER_SOME: - silver += obj->value[0]; - extract_obj(obj); - break; - - case OBJ_VNUM_GOLD_SOME: - gold += obj->value[1]; - extract_obj( obj ); - break; - - case OBJ_VNUM_COINS: - silver += obj->value[0]; - gold += obj->value[1]; - extract_obj(obj); - break; - } - } - - obj_to_room( create_money( gold, silver ), ch->in_room ); - act( "$n drops some coins.", ch, NULL, NULL, TO_ROOM ); - send_to_char( "OK.\n\r", ch ); - return; - } - - if ( str_cmp( arg, "all" ) && str_prefix( "all.", arg ) ) - { - /* 'drop obj' */ - if ( ( obj = get_obj_carry( ch, arg, ch ) ) == NULL ) - { - send_to_char( "You do not have that item.\n\r", ch ); - return; - } - - if ( !can_drop_obj( ch, obj ) ) - { - send_to_char( "You can't let go of it.\n\r", ch ); - return; - } - - obj_from_char( obj ); - obj_to_room( obj, ch->in_room ); - act( "$n drops $p.", ch, obj, NULL, TO_ROOM ); - act( "You drop $p.", ch, obj, NULL, TO_CHAR ); - if (IS_OBJ_STAT(obj,ITEM_MELT_DROP)) - { - act("$p dissolves into smoke.",ch,obj,NULL,TO_ROOM); - act("$p dissolves into smoke.",ch,obj,NULL,TO_CHAR); - extract_obj(obj); - } - } - else - { - /* 'drop all' or 'drop all.obj' */ - found = FALSE; - for ( obj = ch->carrying; obj != NULL; obj = obj_next ) - { - obj_next = obj->next_content; - - if ( ( arg[3] == '\0' || is_name( &arg[4], obj->name ) ) - && can_see_obj( ch, obj ) - && obj->wear_loc == WEAR_NONE - && can_drop_obj( ch, obj ) ) - { - found = TRUE; - obj_from_char( obj ); - obj_to_room( obj, ch->in_room ); - act( "$n drops $p.", ch, obj, NULL, TO_ROOM ); - act( "You drop $p.", ch, obj, NULL, TO_CHAR ); - if (IS_OBJ_STAT(obj,ITEM_MELT_DROP)) - { - act("$p dissolves into smoke.",ch,obj,NULL,TO_ROOM); - act("$p dissolves into smoke.",ch,obj,NULL,TO_CHAR); - extract_obj(obj); - } - } - } - - if ( !found ) - { - if ( arg[3] == '\0' ) - act( "You are not carrying anything.", - ch, NULL, arg, TO_CHAR ); - else - act( "You are not carrying any $T.", - ch, NULL, &arg[4], TO_CHAR ); - } - } - - return; -} - - - -void do_give( CHAR_DATA *ch, char *argument ) -{ - char arg1 [MAX_INPUT_LENGTH]; - char arg2 [MAX_INPUT_LENGTH]; - char buf[MAX_STRING_LENGTH]; - CHAR_DATA *victim; - OBJ_DATA *obj; - - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - - if ( arg1[0] == '\0' || arg2[0] == '\0' ) - { - send_to_char( "Give what to whom?\n\r", ch ); - return; - } - - if ( is_number( arg1 ) ) - { - /* 'give NNNN coins victim' */ - int amount; - bool silver; - - amount = atoi(arg1); - if ( amount <= 0 - || ( str_cmp( arg2, "coins" ) && str_cmp( arg2, "coin" ) && - str_cmp( arg2, "gold" ) && str_cmp( arg2, "silver")) ) - { - send_to_char( "Sorry, you can't do that.\n\r", ch ); - return; - } - - silver = str_cmp(arg2,"gold"); - - argument = one_argument( argument, arg2 ); - if ( arg2[0] == '\0' ) - { - send_to_char( "Give what to whom?\n\r", ch ); - return; - } - - if ( ( victim = get_char_room( ch, arg2 ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - - if ( (!silver && ch->gold < amount) || (silver && ch->silver < amount) ) - { - send_to_char( "You haven't got that much.\n\r", ch ); - return; - } - - if (silver) - { - ch->silver -= amount; - victim->silver += amount; - } - else - { - ch->gold -= amount; - victim->gold += amount; - } - - sprintf(buf,"$n gives you %d %s.",amount, silver ? "silver" : "gold"); - act( buf, ch, NULL, victim, TO_VICT ); - act( "$n gives $N some coins.", ch, NULL, victim, TO_NOTVICT ); - sprintf(buf,"You give $N %d %s.",amount, silver ? "silver" : "gold"); - act( buf, ch, NULL, victim, TO_CHAR ); - - if (IS_NPC(victim) && IS_SET(victim->act,ACT_IS_CHANGER)) - { - int change; - - change = (silver ? 95 * amount / 100 / 100 - : 95 * amount); - - - if (!silver && change > victim->silver) - victim->silver += change; - - if (silver && change > victim->gold) - victim->gold += change; - - if (change < 1 && can_see(victim,ch)) - { - act( - "$n tells you 'I'm sorry, you did not give me enough to change.'" - ,victim,NULL,ch,TO_VICT); - ch->reply = victim; - sprintf(buf,"%d %s %s", - amount, silver ? "silver" : "gold",ch->name); - do_function(victim, &do_give, buf); - } - else if (can_see(victim,ch)) - { - sprintf(buf,"%d %s %s", - change, silver ? "gold" : "silver",ch->name); - do_function(victim, &do_give, buf); - if (silver) - { - sprintf(buf,"%d silver %s", - (95 * amount / 100 - change * 100),ch->name); - do_function(victim, &do_give, buf); - } - act("$n tells you 'Thank you, come again.'", - victim,NULL,ch,TO_VICT); - ch->reply = victim; - } - } - return; - } - - if ( ( obj = get_obj_carry( ch, arg1, ch ) ) == NULL ) - { - send_to_char( "You do not have that item.\n\r", ch ); - return; - } - - if ( obj->wear_loc != WEAR_NONE ) - { - send_to_char( "You must remove it first.\n\r", ch ); - return; - } - - if ( ( victim = get_char_room( ch, arg2 ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - - if (IS_NPC(victim) && victim->pIndexData->pShop != NULL) - { - act("$N tells you 'Sorry, you'll have to sell that.'", - ch,NULL,victim,TO_CHAR); - ch->reply = victim; - return; - } - - if ( !can_drop_obj( ch, obj ) ) - { - send_to_char( "You can't let go of it.\n\r", ch ); - return; - } - - if ( victim->carry_number + get_obj_number( obj ) > can_carry_n( victim ) ) - { - act( "$N has $S hands full.", ch, NULL, victim, TO_CHAR ); - return; - } - - if (get_carry_weight(victim) + get_obj_weight(obj) > can_carry_w( victim ) ) - { - act( "$N can't carry that much weight.", ch, NULL, victim, TO_CHAR ); - return; - } - - if ( !can_see_obj( victim, obj ) ) - { - act( "$N can't see it.", ch, NULL, victim, TO_CHAR ); - return; - } - - obj_from_char( obj ); - obj_to_char( obj, victim ); - act( "$n gives $p to $N.", ch, obj, victim, TO_NOTVICT ); - act( "$n gives you $p.", ch, obj, victim, TO_VICT ); - act( "You give $p to $N.", ch, obj, victim, TO_CHAR ); - return; -} - - -/* for poisoning weapons and food/drink */ -void do_envenom(CHAR_DATA *ch, char *argument) -{ - OBJ_DATA *obj; - AFFECT_DATA af; - int percent,skill; - - /* find out what */ - if (argument[0] == '\0') - { - send_to_char("Envenom what item?\n\r",ch); - return; - } - - obj = get_obj_list(ch,argument,ch->carrying); - - if (obj== NULL) - { - send_to_char("You don't have that item.\n\r",ch); - return; - } - - if ((skill = get_skill(ch,gsn_envenom)) < 1) - { - send_to_char("Are you crazy? You'd poison yourself!\n\r",ch); - return; - } - - if (obj->item_type == ITEM_FOOD || obj->item_type == ITEM_DRINK_CON) - { - if (IS_OBJ_STAT(obj,ITEM_BLESS) || IS_OBJ_STAT(obj,ITEM_BURN_PROOF)) - { - act("You fail to poison $p.",ch,obj,NULL,TO_CHAR); - return; - } - - if (number_percent() < skill) /* success! */ - { - act("$n treats $p with deadly poison.",ch,obj,NULL,TO_ROOM); - act("You treat $p with deadly poison.",ch,obj,NULL,TO_CHAR); - if (!obj->value[3]) - { - obj->value[3] = 1; - check_improve(ch,gsn_envenom,TRUE,4); - } - WAIT_STATE(ch,skill_table[gsn_envenom].beats); - return; - } - - act("You fail to poison $p.",ch,obj,NULL,TO_CHAR); - if (!obj->value[3]) - check_improve(ch,gsn_envenom,FALSE,4); - WAIT_STATE(ch,skill_table[gsn_envenom].beats); - return; - } - - if (obj->item_type == ITEM_WEAPON) - { - if (IS_WEAPON_STAT(obj,WEAPON_FLAMING) - || IS_WEAPON_STAT(obj,WEAPON_FROST) - || IS_WEAPON_STAT(obj,WEAPON_VAMPIRIC) - || IS_WEAPON_STAT(obj,WEAPON_SHARP) - || IS_WEAPON_STAT(obj,WEAPON_VORPAL) - || IS_WEAPON_STAT(obj,WEAPON_SHOCKING) - || IS_OBJ_STAT(obj,ITEM_BLESS) || IS_OBJ_STAT(obj,ITEM_BURN_PROOF)) - { - act("You can't seem to envenom $p.",ch,obj,NULL,TO_CHAR); - return; - } - - if (obj->value[3] < 0 - || attack_table[obj->value[3]].damage == DAM_BASH) - { - send_to_char("You can only envenom edged weapons.\n\r",ch); - return; - } - - if (IS_WEAPON_STAT(obj,WEAPON_POISON)) - { - act("$p is already envenomed.",ch,obj,NULL,TO_CHAR); - return; - } - - percent = number_percent(); - if (percent < skill) - { - - af.where = TO_WEAPON; - af.type = gsn_poison; - af.level = ch->level * percent / 100; - af.duration = ch->level/2 * percent / 100; - af.location = 0; - af.modifier = 0; - af.bitvector = WEAPON_POISON; - affect_to_obj(obj,&af); - - act("$n coats $p with deadly venom.",ch,obj,NULL,TO_ROOM); - act("You coat $p with venom.",ch,obj,NULL,TO_CHAR); - check_improve(ch,gsn_envenom,TRUE,3); - WAIT_STATE(ch,skill_table[gsn_envenom].beats); - return; - } - else - { - act("You fail to envenom $p.",ch,obj,NULL,TO_CHAR); - check_improve(ch,gsn_envenom,FALSE,3); - WAIT_STATE(ch,skill_table[gsn_envenom].beats); - return; - } - } - - act("You can't poison $p.",ch,obj,NULL,TO_CHAR); - return; -} - -void do_fill( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - char buf[MAX_STRING_LENGTH]; - OBJ_DATA *obj; - OBJ_DATA *fountain; - bool found; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Fill what?\n\r", ch ); - return; - } - - if ( ( obj = get_obj_carry( ch, arg, ch ) ) == NULL ) - { - send_to_char( "You do not have that item.\n\r", ch ); - return; - } - - found = FALSE; - for ( fountain = ch->in_room->contents; fountain != NULL; - fountain = fountain->next_content ) - { - if ( fountain->item_type == ITEM_FOUNTAIN ) - { - found = TRUE; - break; - } - } - - if ( !found ) - { - send_to_char( "There is no fountain here!\n\r", ch ); - return; - } - - if ( obj->item_type != ITEM_DRINK_CON ) - { - send_to_char( "You can't fill that.\n\r", ch ); - return; - } - - if ( obj->value[1] != 0 && obj->value[2] != fountain->value[2] ) - { - send_to_char( "There is already another liquid in it.\n\r", ch ); - return; - } - - if ( obj->value[1] >= obj->value[0] ) - { - send_to_char( "Your container is full.\n\r", ch ); - return; - } - - sprintf(buf,"You fill $p with %s from $P.", - liq_table[fountain->value[2]].liq_name); - act( buf, ch, obj,fountain, TO_CHAR ); - sprintf(buf,"$n fills $p with %s from $P.", - liq_table[fountain->value[2]].liq_name); - act(buf,ch,obj,fountain,TO_ROOM); - obj->value[2] = fountain->value[2]; - obj->value[1] = obj->value[0]; - return; -} - -void do_pour (CHAR_DATA *ch, char *argument) -{ - char arg[MAX_STRING_LENGTH],buf[MAX_STRING_LENGTH]; - OBJ_DATA *out, *in; - CHAR_DATA *vch = NULL; - int amount; - - argument = one_argument(argument,arg); - - if (arg[0] == '\0' || argument[0] == '\0') - { - send_to_char("Pour what into what?\n\r",ch); - return; - } - - - if ((out = get_obj_carry(ch,arg, ch)) == NULL) - { - send_to_char("You don't have that item.\n\r",ch); - return; - } - - if (out->item_type != ITEM_DRINK_CON) - { - send_to_char("That's not a drink container.\n\r",ch); - return; - } - - if (!str_cmp(argument,"out")) - { - if (out->value[1] == 0) - { - send_to_char("It's already empty.\n\r",ch); - return; - } - - out->value[1] = 0; - out->value[3] = 0; - sprintf(buf,"You invert $p, spilling %s all over the ground.", - liq_table[out->value[2]].liq_name); - act(buf,ch,out,NULL,TO_CHAR); - - sprintf(buf,"$n inverts $p, spilling %s all over the ground.", - liq_table[out->value[2]].liq_name); - act(buf,ch,out,NULL,TO_ROOM); - return; - } - - if ((in = get_obj_here(ch,argument)) == NULL) - { - vch = get_char_room(ch,argument); - - if (vch == NULL) - { - send_to_char("Pour into what?\n\r",ch); - return; - } - - in = get_eq_char(vch,WEAR_HOLD); - - if (in == NULL) - { - send_to_char("They aren't holding anything.",ch); - return; - } - } - - if (in->item_type != ITEM_DRINK_CON) - { - send_to_char("You can only pour into other drink containers.\n\r",ch); - return; - } - - if (in == out) - { - send_to_char("You cannot change the laws of physics!\n\r",ch); - return; - } - - if (in->value[1] != 0 && in->value[2] != out->value[2]) - { - send_to_char("They don't hold the same liquid.\n\r",ch); - return; - } - - if (out->value[1] == 0) - { - act("There's nothing in $p to pour.",ch,out,NULL,TO_CHAR); - return; - } - - if (in->value[1] >= in->value[0]) - { - act("$p is already filled to the top.",ch,in,NULL,TO_CHAR); - return; - } - - amount = UMIN(out->value[1],in->value[0] - in->value[1]); - - in->value[1] += amount; - out->value[1] -= amount; - in->value[2] = out->value[2]; - - if (vch == NULL) - { - sprintf(buf,"You pour %s from $p into $P.", - liq_table[out->value[2]].liq_name); - act(buf,ch,out,in,TO_CHAR); - sprintf(buf,"$n pours %s from $p into $P.", - liq_table[out->value[2]].liq_name); - act(buf,ch,out,in,TO_ROOM); - } - else - { - sprintf(buf,"You pour some %s for $N.", - liq_table[out->value[2]].liq_name); - act(buf,ch,NULL,vch,TO_CHAR); - sprintf(buf,"$n pours you some %s.", - liq_table[out->value[2]].liq_name); - act(buf,ch,NULL,vch,TO_VICT); - sprintf(buf,"$n pours some %s for $N.", - liq_table[out->value[2]].liq_name); - act(buf,ch,NULL,vch,TO_NOTVICT); - - } -} - -void do_drink( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - int amount; - int liquid; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - for ( obj = ch->in_room->contents; obj; obj = obj->next_content ) - { - if ( obj->item_type == ITEM_FOUNTAIN ) - break; - } - - if ( obj == NULL ) - { - send_to_char( "Drink what?\n\r", ch ); - return; - } - } - else - { - if ( ( obj = get_obj_here( ch, arg ) ) == NULL ) - { - send_to_char( "You can't find it.\n\r", ch ); - return; - } - } - - if ( !IS_NPC(ch) && ch->pcdata->condition[COND_DRUNK] > 10 ) - { - send_to_char( "You fail to reach your mouth. *Hic*\n\r", ch ); - return; - } - - switch ( obj->item_type ) - { - default: - send_to_char( "You can't drink from that.\n\r", ch ); - return; - - case ITEM_FOUNTAIN: - if ( ( liquid = obj->value[2] ) < 0 ) - { - bug( "Do_drink: bad liquid number %d.", liquid ); - liquid = obj->value[2] = 0; - } - amount = liq_table[liquid].liq_affect[4] * 3; - break; - - case ITEM_DRINK_CON: - if ( obj->value[1] <= 0 ) - { - send_to_char( "It is already empty.\n\r", ch ); - return; - } - - if ( ( liquid = obj->value[2] ) < 0 ) - { - bug( "Do_drink: bad liquid number %d.", liquid ); - liquid = obj->value[2] = 0; - } - - amount = liq_table[liquid].liq_affect[4]; - amount = UMIN(amount, obj->value[1]); - break; - } - if (!IS_NPC(ch) && !IS_IMMORTAL(ch) - && ch->pcdata->condition[COND_FULL] > 45) - { - send_to_char("You're too full to drink more.\n\r",ch); - return; - } - - act( "$n drinks $T from $p.", - ch, obj, liq_table[liquid].liq_name, TO_ROOM ); - act( "You drink $T from $p.", - ch, obj, liq_table[liquid].liq_name, TO_CHAR ); - - gain_condition( ch, COND_DRUNK, - amount * liq_table[liquid].liq_affect[COND_DRUNK] / 36 ); - gain_condition( ch, COND_FULL, - amount * liq_table[liquid].liq_affect[COND_FULL] / 4 ); - gain_condition( ch, COND_THIRST, - amount * liq_table[liquid].liq_affect[COND_THIRST] / 10 ); - gain_condition(ch, COND_HUNGER, - amount * liq_table[liquid].liq_affect[COND_HUNGER] / 2 ); - - if ( !IS_NPC(ch) && ch->pcdata->condition[COND_DRUNK] > 10 ) - send_to_char( "You feel drunk.\n\r", ch ); - if ( !IS_NPC(ch) && ch->pcdata->condition[COND_FULL] > 40 ) - send_to_char( "You are full.\n\r", ch ); - if ( !IS_NPC(ch) && ch->pcdata->condition[COND_THIRST] > 40 ) - send_to_char( "Your thirst is quenched.\n\r", ch ); - - if ( obj->value[3] != 0 ) - { - /* The drink was poisoned ! */ - AFFECT_DATA af; - - act( "$n chokes and gags.", ch, NULL, NULL, TO_ROOM ); - send_to_char( "You choke and gag.\n\r", ch ); - af.where = TO_AFFECTS; - af.type = gsn_poison; - af.level = number_fuzzy(amount); - af.duration = 3 * amount; - af.location = APPLY_NONE; - af.modifier = 0; - af.bitvector = AFF_POISON; - affect_join( ch, &af ); - } - - if (obj->value[0] > 0) - obj->value[1] -= amount; - - return; -} - - - -void do_eat( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - - one_argument( argument, arg ); - if ( arg[0] == '\0' ) - { - send_to_char( "Eat what?\n\r", ch ); - return; - } - - if ( ( obj = get_obj_carry( ch, arg, ch ) ) == NULL ) - { - send_to_char( "You do not have that item.\n\r", ch ); - return; - } - - if ( !IS_IMMORTAL(ch) ) - { - if ( obj->item_type != ITEM_FOOD && obj->item_type != ITEM_PILL ) - { - send_to_char( "That's not edible.\n\r", ch ); - return; - } - - if ( !IS_NPC(ch) && ch->pcdata->condition[COND_FULL] > 40 ) - { - send_to_char( "You are too full to eat more.\n\r", ch ); - return; - } - } - - act( "$n eats $p.", ch, obj, NULL, TO_ROOM ); - act( "You eat $p.", ch, obj, NULL, TO_CHAR ); - - switch ( obj->item_type ) - { - - case ITEM_FOOD: - if ( !IS_NPC(ch) ) - { - int condition; - - condition = ch->pcdata->condition[COND_HUNGER]; - gain_condition( ch, COND_FULL, obj->value[0] ); - gain_condition( ch, COND_HUNGER, obj->value[1]); - if ( condition == 0 && ch->pcdata->condition[COND_HUNGER] > 0 ) - send_to_char( "You are no longer hungry.\n\r", ch ); - else if ( ch->pcdata->condition[COND_FULL] > 40 ) - send_to_char( "You are full.\n\r", ch ); - } - - if ( obj->value[3] != 0 ) - { - /* The food was poisoned! */ - AFFECT_DATA af; - - act( "$n chokes and gags.", ch, 0, 0, TO_ROOM ); - send_to_char( "You choke and gag.\n\r", ch ); - - af.where = TO_AFFECTS; - af.type = gsn_poison; - af.level = number_fuzzy(obj->value[0]); - af.duration = 2 * obj->value[0]; - af.location = APPLY_NONE; - af.modifier = 0; - af.bitvector = AFF_POISON; - affect_join( ch, &af ); - } - break; - - case ITEM_PILL: - obj_cast_spell( obj->value[1], obj->value[0], ch, ch, NULL ); - obj_cast_spell( obj->value[2], obj->value[0], ch, ch, NULL ); - obj_cast_spell( obj->value[3], obj->value[0], ch, ch, NULL ); - break; - } - - extract_obj( obj ); - return; -} - - - -/* - * Remove an object. - */ -bool remove_obj( CHAR_DATA *ch, int iWear, bool fReplace ) -{ - OBJ_DATA *obj; - - if ( ( obj = get_eq_char( ch, iWear ) ) == NULL ) - return TRUE; - - if ( !fReplace ) - return FALSE; - - if ( IS_SET(obj->extra_flags, ITEM_NOREMOVE) ) - { - act( "You can't remove $p.", ch, obj, NULL, TO_CHAR ); - return FALSE; - } - - unequip_char( ch, obj ); - act( "$n stops using $p.", ch, obj, NULL, TO_ROOM ); - act( "You stop using $p.", ch, obj, NULL, TO_CHAR ); - return TRUE; -} - - - -/* - * Wear one object. - * Optional replacement of existing objects. - * Big repetitive code, ick. - */ -void wear_obj( CHAR_DATA *ch, OBJ_DATA *obj, bool fReplace ) -{ - char buf[MAX_STRING_LENGTH]; - - if ( ch->level < obj->level ) - { - sprintf( buf, "You must be level %d to use this object.\n\r", - obj->level ); - send_to_char( buf, ch ); - act( "$n tries to use $p, but is too inexperienced.", - ch, obj, NULL, TO_ROOM ); - return; - } - - if ( obj->item_type == ITEM_LIGHT ) - { - if ( !remove_obj( ch, WEAR_LIGHT, fReplace ) ) - return; - act( "$n lights $p and holds it.", ch, obj, NULL, TO_ROOM ); - act( "You light $p and hold it.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_LIGHT ); - return; - } - - if ( CAN_WEAR( obj, ITEM_WEAR_FINGER ) ) - { - if ( get_eq_char( ch, WEAR_FINGER_L ) != NULL - && get_eq_char( ch, WEAR_FINGER_R ) != NULL - && !remove_obj( ch, WEAR_FINGER_L, fReplace ) - && !remove_obj( ch, WEAR_FINGER_R, fReplace ) ) - return; - - if ( get_eq_char( ch, WEAR_FINGER_L ) == NULL ) - { - act( "$n wears $p on $s left finger.", ch, obj, NULL, TO_ROOM ); - act( "You wear $p on your left finger.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_FINGER_L ); - return; - } - - if ( get_eq_char( ch, WEAR_FINGER_R ) == NULL ) - { - act( "$n wears $p on $s right finger.", ch, obj, NULL, TO_ROOM ); - act( "You wear $p on your right finger.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_FINGER_R ); - return; - } - - bug( "Wear_obj: no free finger.", 0 ); - send_to_char( "You already wear two rings.\n\r", ch ); - return; - } - - if ( CAN_WEAR( obj, ITEM_WEAR_NECK ) ) - { - if ( get_eq_char( ch, WEAR_NECK_1 ) != NULL - && get_eq_char( ch, WEAR_NECK_2 ) != NULL - && !remove_obj( ch, WEAR_NECK_1, fReplace ) - && !remove_obj( ch, WEAR_NECK_2, fReplace ) ) - return; - - if ( get_eq_char( ch, WEAR_NECK_1 ) == NULL ) - { - act( "$n wears $p around $s neck.", ch, obj, NULL, TO_ROOM ); - act( "You wear $p around your neck.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_NECK_1 ); - return; - } - - if ( get_eq_char( ch, WEAR_NECK_2 ) == NULL ) - { - act( "$n wears $p around $s neck.", ch, obj, NULL, TO_ROOM ); - act( "You wear $p around your neck.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_NECK_2 ); - return; - } - - bug( "Wear_obj: no free neck.", 0 ); - send_to_char( "You already wear two neck items.\n\r", ch ); - return; - } - - if ( CAN_WEAR( obj, ITEM_WEAR_BODY ) ) - { - if ( !remove_obj( ch, WEAR_BODY, fReplace ) ) - return; - act( "$n wears $p on $s torso.", ch, obj, NULL, TO_ROOM ); - act( "You wear $p on your torso.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_BODY ); - return; - } - - if ( CAN_WEAR( obj, ITEM_WEAR_HEAD ) ) - { - if ( !remove_obj( ch, WEAR_HEAD, fReplace ) ) - return; - act( "$n wears $p on $s head.", ch, obj, NULL, TO_ROOM ); - act( "You wear $p on your head.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_HEAD ); - return; - } - - if ( CAN_WEAR( obj, ITEM_WEAR_LEGS ) ) - { - if ( !remove_obj( ch, WEAR_LEGS, fReplace ) ) - return; - act( "$n wears $p on $s legs.", ch, obj, NULL, TO_ROOM ); - act( "You wear $p on your legs.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_LEGS ); - return; - } - - if ( CAN_WEAR( obj, ITEM_WEAR_FEET ) ) - { - if ( !remove_obj( ch, WEAR_FEET, fReplace ) ) - return; - act( "$n wears $p on $s feet.", ch, obj, NULL, TO_ROOM ); - act( "You wear $p on your feet.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_FEET ); - return; - } - - if ( CAN_WEAR( obj, ITEM_WEAR_HANDS ) ) - { - if ( !remove_obj( ch, WEAR_HANDS, fReplace ) ) - return; - act( "$n wears $p on $s hands.", ch, obj, NULL, TO_ROOM ); - act( "You wear $p on your hands.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_HANDS ); - return; - } - - if ( CAN_WEAR( obj, ITEM_WEAR_ARMS ) ) - { - if ( !remove_obj( ch, WEAR_ARMS, fReplace ) ) - return; - act( "$n wears $p on $s arms.", ch, obj, NULL, TO_ROOM ); - act( "You wear $p on your arms.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_ARMS ); - return; - } - - if ( CAN_WEAR( obj, ITEM_WEAR_ABOUT ) ) - { - if ( !remove_obj( ch, WEAR_ABOUT, fReplace ) ) - return; - act( "$n wears $p about $s torso.", ch, obj, NULL, TO_ROOM ); - act( "You wear $p about your torso.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_ABOUT ); - return; - } - - if ( CAN_WEAR( obj, ITEM_WEAR_WAIST ) ) - { - if ( !remove_obj( ch, WEAR_WAIST, fReplace ) ) - return; - act( "$n wears $p about $s waist.", ch, obj, NULL, TO_ROOM ); - act( "You wear $p about your waist.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_WAIST ); - return; - } - - if ( CAN_WEAR( obj, ITEM_WEAR_WRIST ) ) - { - if ( get_eq_char( ch, WEAR_WRIST_L ) != NULL - && get_eq_char( ch, WEAR_WRIST_R ) != NULL - && !remove_obj( ch, WEAR_WRIST_L, fReplace ) - && !remove_obj( ch, WEAR_WRIST_R, fReplace ) ) - return; - - if ( get_eq_char( ch, WEAR_WRIST_L ) == NULL ) - { - act( "$n wears $p around $s left wrist.", - ch, obj, NULL, TO_ROOM ); - act( "You wear $p around your left wrist.", - ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_WRIST_L ); - return; - } - - if ( get_eq_char( ch, WEAR_WRIST_R ) == NULL ) - { - act( "$n wears $p around $s right wrist.", - ch, obj, NULL, TO_ROOM ); - act( "You wear $p around your right wrist.", - ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_WRIST_R ); - return; - } - - bug( "Wear_obj: no free wrist.", 0 ); - send_to_char( "You already wear two wrist items.\n\r", ch ); - return; - } - - if ( CAN_WEAR( obj, ITEM_WEAR_SHIELD ) ) - { - OBJ_DATA *weapon; - - if ( !remove_obj( ch, WEAR_SHIELD, fReplace ) ) - return; - - weapon = get_eq_char(ch,WEAR_WIELD); - if (weapon != NULL && ch->size < SIZE_LARGE - && IS_WEAPON_STAT(weapon,WEAPON_TWO_HANDS)) - { - send_to_char("Your hands are tied up with your weapon!\n\r",ch); - return; - } - - act( "$n wears $p as a shield.", ch, obj, NULL, TO_ROOM ); - act( "You wear $p as a shield.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_SHIELD ); - return; - } - - if ( CAN_WEAR( obj, ITEM_WIELD ) ) - { - int sn,skill; - - if ( !remove_obj( ch, WEAR_WIELD, fReplace ) ) - return; - - if ( !IS_NPC(ch) - && get_obj_weight(obj) > (str_app[get_curr_stat(ch,STAT_STR)].wield - * 10)) - { - send_to_char( "It is too heavy for you to wield.\n\r", ch ); - return; - } - - if (!IS_NPC(ch) && ch->size < SIZE_LARGE - && IS_WEAPON_STAT(obj,WEAPON_TWO_HANDS) - && get_eq_char(ch,WEAR_SHIELD) != NULL) - { - send_to_char("You need two hands free for that weapon.\n\r",ch); - return; - } - - act( "$n wields $p.", ch, obj, NULL, TO_ROOM ); - act( "You wield $p.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_WIELD ); - - sn = get_weapon_sn(ch); - - if (sn == gsn_hand_to_hand) - return; - - skill = get_weapon_skill(ch,sn); - - if (skill >= 100) - act("$p feels like a part of you!",ch,obj,NULL,TO_CHAR); - else if (skill > 85) - act("You feel quite confident with $p.",ch,obj,NULL,TO_CHAR); - else if (skill > 70) - act("You are skilled with $p.",ch,obj,NULL,TO_CHAR); - else if (skill > 50) - act("Your skill with $p is adequate.",ch,obj,NULL,TO_CHAR); - else if (skill > 25) - act("$p feels a little clumsy in your hands.",ch,obj,NULL,TO_CHAR); - else if (skill > 1) - act("You fumble and almost drop $p.",ch,obj,NULL,TO_CHAR); - else - act("You don't even know which end is up on $p.", - ch,obj,NULL,TO_CHAR); - - return; - } - - if ( CAN_WEAR( obj, ITEM_HOLD ) ) - { - if ( !remove_obj( ch, WEAR_HOLD, fReplace ) ) - return; - act( "$n holds $p in $s hand.", ch, obj, NULL, TO_ROOM ); - act( "You hold $p in your hand.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_HOLD ); - return; - } - - if ( CAN_WEAR(obj,ITEM_WEAR_FLOAT) ) - { - if (!remove_obj(ch,WEAR_FLOAT, fReplace) ) - return; - act("$n releases $p to float next to $m.",ch,obj,NULL,TO_ROOM); - act("You release $p and it floats next to you.",ch,obj,NULL,TO_CHAR); - equip_char(ch,obj,WEAR_FLOAT); - return; - } - - if ( fReplace ) - send_to_char( "You can't wear, wield, or hold that.\n\r", ch ); - - return; -} - - - -void do_wear( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Wear, wield, or hold what?\n\r", ch ); - return; - } - - if ( !str_cmp( arg, "all" ) ) - { - OBJ_DATA *obj_next; - - for ( obj = ch->carrying; obj != NULL; obj = obj_next ) - { - obj_next = obj->next_content; - if ( obj->wear_loc == WEAR_NONE && can_see_obj( ch, obj ) ) - wear_obj( ch, obj, FALSE ); - } - return; - } - else - { - if ( ( obj = get_obj_carry( ch, arg, ch ) ) == NULL ) - { - send_to_char( "You do not have that item.\n\r", ch ); - return; - } - - wear_obj( ch, obj, TRUE ); - } - - return; -} - - - -void do_remove( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Remove what?\n\r", ch ); - return; - } - - if ( ( obj = get_obj_wear( ch, arg ) ) == NULL ) - { - send_to_char( "You do not have that item.\n\r", ch ); - return; - } - - remove_obj( ch, obj->wear_loc, TRUE ); - return; -} - - - -void do_sacrifice( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - char buf[MAX_STRING_LENGTH]; - OBJ_DATA *obj; - int silver; - - /* variables for AUTOSPLIT */ - CHAR_DATA *gch; - int members; - char buffer[100]; - - - one_argument( argument, arg ); - - if ( arg[0] == '\0' || !str_cmp( arg, ch->name ) ) - { - act( "$n offers $mself to Mota, who graciously declines.", - ch, NULL, NULL, TO_ROOM ); - send_to_char( - "Mota appreciates your offer and may accept it later.\n\r", ch ); - return; - } - - obj = get_obj_list( ch, arg, ch->in_room->contents ); - if ( obj == NULL ) - { - send_to_char( "You can't find it.\n\r", ch ); - return; - } - - if ( obj->item_type == ITEM_CORPSE_PC ) - { - if (obj->contains) - { - send_to_char( - "Mota wouldn't like that.\n\r",ch); - return; - } - } - - - if ( !CAN_WEAR(obj, ITEM_TAKE) || CAN_WEAR(obj, ITEM_NO_SAC)) - { - act( "$p is not an acceptable sacrifice.", ch, obj, 0, TO_CHAR ); - return; - } - - if (obj->in_room != NULL) - { - for (gch = obj->in_room->people; gch != NULL; gch = gch->next_in_room) - if (gch->on == obj) - { - act("$N appears to be using $p.", - ch,obj,gch,TO_CHAR); - return; - } - } - - silver = UMAX(1,obj->level * 3); - - if (obj->item_type != ITEM_CORPSE_NPC && obj->item_type != ITEM_CORPSE_PC) - silver = UMIN(silver,obj->cost); - - if (silver == 1) - send_to_char( - "Mota gives you one silver coin for your sacrifice.\n\r", ch ); - else - { - sprintf(buf,"Mota gives you %d silver coins for your sacrifice.\n\r", - silver); - send_to_char(buf,ch); - } - - ch->silver += silver; - - if (IS_SET(ch->act,PLR_AUTOSPLIT) ) - { /* AUTOSPLIT code */ - members = 0; - for (gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room ) - { - if ( is_same_group( gch, ch ) ) - members++; - } - - if ( members > 1 && silver > 1) - { - sprintf(buffer,"%d",silver); - do_function(ch, &do_split, buffer); - } - } - - act( "$n sacrifices $p to Mota.", ch, obj, NULL, TO_ROOM ); - wiznet("$N sends up $p as a burnt offering.", - ch,obj,WIZ_SACCING,0,0); - extract_obj( obj ); - return; -} - - - -void do_quaff( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Quaff what?\n\r", ch ); - return; - } - - if ( ( obj = get_obj_carry( ch, arg, ch ) ) == NULL ) - { - send_to_char( "You do not have that potion.\n\r", ch ); - return; - } - - if ( obj->item_type != ITEM_POTION ) - { - send_to_char( "You can quaff only potions.\n\r", ch ); - return; - } - - if (ch->level < obj->level) - { - send_to_char("This liquid is too powerful for you to drink.\n\r",ch); - return; - } - - act( "$n quaffs $p.", ch, obj, NULL, TO_ROOM ); - act( "You quaff $p.", ch, obj, NULL ,TO_CHAR ); - - obj_cast_spell( obj->value[1], obj->value[0], ch, ch, NULL ); - obj_cast_spell( obj->value[2], obj->value[0], ch, ch, NULL ); - obj_cast_spell( obj->value[3], obj->value[0], ch, ch, NULL ); - - extract_obj( obj ); - return; -} - - - -void do_recite( CHAR_DATA *ch, char *argument ) -{ - char arg1[MAX_INPUT_LENGTH]; - char arg2[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - OBJ_DATA *scroll; - OBJ_DATA *obj; - - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - - if ( ( scroll = get_obj_carry( ch, arg1, ch ) ) == NULL ) - { - send_to_char( "You do not have that scroll.\n\r", ch ); - return; - } - - if ( scroll->item_type != ITEM_SCROLL ) - { - send_to_char( "You can recite only scrolls.\n\r", ch ); - return; - } - - if ( ch->level < scroll->level) - { - send_to_char( - "This scroll is too complex for you to comprehend.\n\r",ch); - return; - } - - obj = NULL; - if ( arg2[0] == '\0' ) - { - victim = ch; - } - else - { - if ( ( victim = get_char_room ( ch, arg2 ) ) == NULL - && ( obj = get_obj_here ( ch, arg2 ) ) == NULL ) - { - send_to_char( "You can't find it.\n\r", ch ); - return; - } - } - - act( "$n recites $p.", ch, scroll, NULL, TO_ROOM ); - act( "You recite $p.", ch, scroll, NULL, TO_CHAR ); - - if (number_percent() >= 20 + get_skill(ch,gsn_scrolls) * 4/5) - { - send_to_char("You mispronounce a syllable.\n\r",ch); - check_improve(ch,gsn_scrolls,FALSE,2); - } - - else - { - obj_cast_spell( scroll->value[1], scroll->value[0], ch, victim, obj ); - obj_cast_spell( scroll->value[2], scroll->value[0], ch, victim, obj ); - obj_cast_spell( scroll->value[3], scroll->value[0], ch, victim, obj ); - check_improve(ch,gsn_scrolls,TRUE,2); - } - - extract_obj( scroll ); - return; -} - - - -void do_brandish( CHAR_DATA *ch, char *argument ) -{ - CHAR_DATA *vch; - CHAR_DATA *vch_next; - OBJ_DATA *staff; - int sn; - - if ( ( staff = get_eq_char( ch, WEAR_HOLD ) ) == NULL ) - { - send_to_char( "You hold nothing in your hand.\n\r", ch ); - return; - } - - if ( staff->item_type != ITEM_STAFF ) - { - send_to_char( "You can brandish only with a staff.\n\r", ch ); - return; - } - - if ( ( sn = staff->value[3] ) < 0 - || sn >= MAX_SKILL - || skill_table[sn].spell_fun == 0 ) - { - bug( "Do_brandish: bad sn %d.", sn ); - return; - } - - WAIT_STATE( ch, 2 * PULSE_VIOLENCE ); - - if ( staff->value[2] > 0 ) - { - act( "$n brandishes $p.", ch, staff, NULL, TO_ROOM ); - act( "You brandish $p.", ch, staff, NULL, TO_CHAR ); - if ( ch->level < staff->level - || number_percent() >= 20 + get_skill(ch,gsn_staves) * 4/5) - { - act ("You fail to invoke $p.",ch,staff,NULL,TO_CHAR); - act ("...and nothing happens.",ch,NULL,NULL,TO_ROOM); - check_improve(ch,gsn_staves,FALSE,2); - } - - else for ( vch = ch->in_room->people; vch; vch = vch_next ) - { - vch_next = vch->next_in_room; - - switch ( skill_table[sn].target ) - { - default: - bug( "Do_brandish: bad target for sn %d.", sn ); - return; - - case TAR_IGNORE: - if ( vch != ch ) - continue; - break; - - case TAR_CHAR_OFFENSIVE: - if ( IS_NPC(ch) ? IS_NPC(vch) : !IS_NPC(vch) ) - continue; - break; - - case TAR_CHAR_DEFENSIVE: - if ( IS_NPC(ch) ? !IS_NPC(vch) : IS_NPC(vch) ) - continue; - break; - - case TAR_CHAR_SELF: - if ( vch != ch ) - continue; - break; - } - - obj_cast_spell( staff->value[3], staff->value[0], ch, vch, NULL ); - check_improve(ch,gsn_staves,TRUE,2); - } - } - - if ( --staff->value[2] <= 0 ) - { - act( "$n's $p blazes bright and is gone.", ch, staff, NULL, TO_ROOM ); - act( "Your $p blazes bright and is gone.", ch, staff, NULL, TO_CHAR ); - extract_obj( staff ); - } - - return; -} - - - -void do_zap( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - OBJ_DATA *wand; - OBJ_DATA *obj; - - one_argument( argument, arg ); - if ( arg[0] == '\0' && ch->fighting == NULL ) - { - send_to_char( "Zap whom or what?\n\r", ch ); - return; - } - - if ( ( wand = get_eq_char( ch, WEAR_HOLD ) ) == NULL ) - { - send_to_char( "You hold nothing in your hand.\n\r", ch ); - return; - } - - if ( wand->item_type != ITEM_WAND ) - { - send_to_char( "You can zap only with a wand.\n\r", ch ); - return; - } - - obj = NULL; - if ( arg[0] == '\0' ) - { - if ( ch->fighting != NULL ) - { - victim = ch->fighting; - } - else - { - send_to_char( "Zap whom or what?\n\r", ch ); - return; - } - } - else - { - if ( ( victim = get_char_room ( ch, arg ) ) == NULL - && ( obj = get_obj_here ( ch, arg ) ) == NULL ) - { - send_to_char( "You can't find it.\n\r", ch ); - return; - } - } - - WAIT_STATE( ch, 2 * PULSE_VIOLENCE ); - - if ( wand->value[2] > 0 ) - { - if ( victim != NULL ) - { - act( "$n zaps $N with $p.", ch, wand, victim, TO_NOTVICT ); - act( "You zap $N with $p.", ch, wand, victim, TO_CHAR ); - act( "$n zaps you with $p.",ch, wand, victim, TO_VICT ); - } - else - { - act( "$n zaps $P with $p.", ch, wand, obj, TO_ROOM ); - act( "You zap $P with $p.", ch, wand, obj, TO_CHAR ); - } - - if (ch->level < wand->level - || number_percent() >= 20 + get_skill(ch,gsn_wands) * 4/5) - { - act( "Your efforts with $p produce only smoke and sparks.", - ch,wand,NULL,TO_CHAR); - act( "$n's efforts with $p produce only smoke and sparks.", - ch,wand,NULL,TO_ROOM); - check_improve(ch,gsn_wands,FALSE,2); - } - else - { - obj_cast_spell( wand->value[3], wand->value[0], ch, victim, obj ); - check_improve(ch,gsn_wands,TRUE,2); - } - } - - if ( --wand->value[2] <= 0 ) - { - act( "$n's $p explodes into fragments.", ch, wand, NULL, TO_ROOM ); - act( "Your $p explodes into fragments.", ch, wand, NULL, TO_CHAR ); - extract_obj( wand ); - } - - return; -} - - - -void do_steal( CHAR_DATA *ch, char *argument ) -{ - char buf [MAX_STRING_LENGTH]; - char arg1 [MAX_INPUT_LENGTH]; - char arg2 [MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - OBJ_DATA *obj; - int percent; - - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - - if ( arg1[0] == '\0' || arg2[0] == '\0' ) - { - send_to_char( "Steal what from whom?\n\r", ch ); - return; - } - - if ( ( victim = get_char_room( ch, arg2 ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - - if ( victim == ch ) - { - send_to_char( "That's pointless.\n\r", ch ); - return; - } - - if (is_safe(ch,victim)) - return; - - if ( IS_NPC(victim) - && victim->position == POS_FIGHTING) - { - send_to_char( "Kill stealing is not permitted.\n\r" - "You'd better not -- you might get hit.\n\r",ch); - return; - } - - WAIT_STATE( ch, skill_table[gsn_steal].beats ); - percent = number_percent(); - - if (!IS_AWAKE(victim)) - percent -= 10; - else if (!can_see(victim,ch)) - percent += 25; - else - percent += 50; - - if ( ((ch->level + 7 < victim->level || ch->level -7 > victim->level) - && !IS_NPC(victim) && !IS_NPC(ch) ) - || ( !IS_NPC(ch) && percent > get_skill(ch,gsn_steal)) - || ( !IS_NPC(ch) && !is_clan(ch)) ) - { - /* - * Failure. - */ - send_to_char( "Oops.\n\r", ch ); - affect_strip(ch,gsn_sneak); - REMOVE_BIT(ch->affected_by,AFF_SNEAK); - - act( "$n tried to steal from you.\n\r", ch, NULL, victim, TO_VICT ); - act( "$n tried to steal from $N.\n\r", ch, NULL, victim, TO_NOTVICT ); - switch(number_range(0,3)) - { - case 0 : - sprintf( buf, "%s is a lousy thief!", ch->name ); - break; - case 1 : - sprintf( buf, "%s couldn't rob %s way out of a paper bag!", - ch->name,(ch->sex == 2) ? "her" : "his"); - break; - case 2 : - sprintf( buf,"%s tried to rob me!",ch->name ); - break; - case 3 : - sprintf(buf,"Keep your hands out of there, %s!",ch->name); - break; - } - if (!IS_AWAKE(victim)) - do_function(victim, &do_wake, ""); - if (IS_AWAKE(victim)) - do_function(victim, &do_yell, buf ); - if ( !IS_NPC(ch) ) - { - if ( IS_NPC(victim) ) - { - check_improve(ch,gsn_steal,FALSE,2); - multi_hit( victim, ch, TYPE_UNDEFINED ); - } - else - { - sprintf(buf,"$N tried to steal from %s.",victim->name); - wiznet(buf,ch,NULL,WIZ_FLAGS,0,0); - if ( !IS_SET(ch->act, PLR_THIEF) ) - { - SET_BIT(ch->act, PLR_THIEF); - send_to_char( "*** You are now a THIEF!! ***\n\r", ch ); - save_char_obj( ch ); - } - } - } - - return; - } - - if ( !str_cmp( arg1, "coin" ) - || !str_cmp( arg1, "coins" ) - || !str_cmp( arg1, "gold" ) - || !str_cmp( arg1, "silver")) - { - int gold, silver; - - gold = victim->gold * number_range(1, ch->level) / MAX_LEVEL; - silver = victim->silver * number_range(1,ch->level) / MAX_LEVEL; - if ( gold <= 0 && silver <= 0 ) - { - send_to_char( "You couldn't get any coins.\n\r", ch ); - return; - } - - ch->gold += gold; - ch->silver += silver; - victim->silver -= silver; - victim->gold -= gold; - if (silver <= 0) - sprintf( buf, "Bingo! You got %d gold coins.\n\r", gold ); - else if (gold <= 0) - sprintf( buf, "Bingo! You got %d silver coins.\n\r",silver); - else - sprintf(buf, "Bingo! You got %d silver and %d gold coins.\n\r", - silver,gold); - - send_to_char( buf, ch ); - check_improve(ch,gsn_steal,TRUE,2); - return; - } - - if ( ( obj = get_obj_carry( victim, arg1, ch ) ) == NULL ) - { - send_to_char( "You can't find it.\n\r", ch ); - return; - } - - if ( !can_drop_obj( ch, obj ) - || IS_SET(obj->extra_flags, ITEM_INVENTORY) - || obj->level > ch->level ) - { - send_to_char( "You can't pry it away.\n\r", ch ); - return; - } - - if ( ch->carry_number + get_obj_number( obj ) > can_carry_n( ch ) ) - { - send_to_char( "You have your hands full.\n\r", ch ); - return; - } - - if ( ch->carry_weight + get_obj_weight( obj ) > can_carry_w( ch ) ) - { - send_to_char( "You can't carry that much weight.\n\r", ch ); - return; - } - - obj_from_char( obj ); - obj_to_char( obj, ch ); - act("You pocket $p.",ch,obj,NULL,TO_CHAR); - check_improve(ch,gsn_steal,TRUE,2); - send_to_char( "Got it!\n\r", ch ); - return; -} - - - -/* - * Shopping commands. - */ -CHAR_DATA *find_keeper( CHAR_DATA *ch ) -{ - /*char buf[MAX_STRING_LENGTH];*/ - CHAR_DATA *keeper; - SHOP_DATA *pShop; - - pShop = NULL; - for ( keeper = ch->in_room->people; keeper; keeper = keeper->next_in_room ) - { - if ( IS_NPC(keeper) && (pShop = keeper->pIndexData->pShop) != NULL ) - break; - } - - if ( pShop == NULL ) - { - send_to_char( "You can't do that here.\n\r", ch ); - return NULL; - } - - /* - * Undesirables. - * - if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_KILLER) ) - { - do_function(keeper, &do_say, "Killers are not welcome!"); - sprintf(buf, "%s the KILLER is over here!\n\r", ch->name); - do_function(keeper, &do_yell, buf ); - return NULL; - } - - if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_THIEF) ) - { - do_function(keeper, &do_say, "Thieves are not welcome!"); - sprintf(buf, "%s the THIEF is over here!\n\r", ch->name); - do_function(keeper, &do_yell, buf ); - return NULL; - } - */ - /* - * Shop hours. - */ - if ( time_info.hour < pShop->open_hour ) - { - do_function(keeper, &do_say, "Sorry, I am closed. Come back later."); - return NULL; - } - - if ( time_info.hour > pShop->close_hour ) - { - do_function(keeper, &do_say, "Sorry, I am closed. Come back tomorrow."); - return NULL; - } - - /* - * Invisible or hidden people. - */ - if ( !can_see( keeper, ch ) ) - { - do_function(keeper, &do_say, "I don't trade with folks I can't see."); - return NULL; - } - - return keeper; -} - -/* insert an object at the right spot for the keeper */ -void obj_to_keeper( OBJ_DATA *obj, CHAR_DATA *ch ) -{ - OBJ_DATA *t_obj, *t_obj_next; - - /* see if any duplicates are found */ - for (t_obj = ch->carrying; t_obj != NULL; t_obj = t_obj_next) - { - t_obj_next = t_obj->next_content; - - if (obj->pIndexData == t_obj->pIndexData - && !str_cmp(obj->short_descr,t_obj->short_descr)) - { - /* if this is an unlimited item, destroy the new one */ - if (IS_OBJ_STAT(t_obj,ITEM_INVENTORY)) - { - extract_obj(obj); - return; - } - obj->cost = t_obj->cost; /* keep it standard */ - break; - } - } - - if (t_obj == NULL) - { - obj->next_content = ch->carrying; - ch->carrying = obj; - } - else - { - obj->next_content = t_obj->next_content; - t_obj->next_content = obj; - } - - obj->carried_by = ch; - obj->in_room = NULL; - obj->in_obj = NULL; - ch->carry_number += get_obj_number( obj ); - ch->carry_weight += get_obj_weight( obj ); -} - -/* get an object from a shopkeeper's list */ -OBJ_DATA *get_obj_keeper( CHAR_DATA *ch, CHAR_DATA *keeper, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - int number; - int count; - - number = number_argument( argument, arg ); - count = 0; - for ( obj = keeper->carrying; obj != NULL; obj = obj->next_content ) - { - if (obj->wear_loc == WEAR_NONE - && can_see_obj( keeper, obj ) - && can_see_obj(ch,obj) - && is_name( arg, obj->name ) ) - { - if ( ++count == number ) - return obj; - - /* skip other objects of the same name */ - while (obj->next_content != NULL - && obj->pIndexData == obj->next_content->pIndexData - && !str_cmp(obj->short_descr,obj->next_content->short_descr)) - obj = obj->next_content; - } - } - - return NULL; -} - -int get_cost( CHAR_DATA *keeper, OBJ_DATA *obj, bool fBuy ) -{ - SHOP_DATA *pShop; - int cost; - - if ( obj == NULL || ( pShop = keeper->pIndexData->pShop ) == NULL ) - return 0; - - if ( fBuy ) - { - cost = obj->cost * pShop->profit_buy / 100; - } - else - { - OBJ_DATA *obj2; - int itype; - - cost = 0; - for ( itype = 0; itype < MAX_TRADE; itype++ ) - { - if ( obj->item_type == pShop->buy_type[itype] ) - { - cost = obj->cost * pShop->profit_sell / 100; - break; - } - } - - if (!IS_OBJ_STAT(obj,ITEM_SELL_EXTRACT)) - for ( obj2 = keeper->carrying; obj2; obj2 = obj2->next_content ) - { - if ( obj->pIndexData == obj2->pIndexData - && !str_cmp(obj->short_descr,obj2->short_descr) ) - { if (IS_OBJ_STAT(obj2,ITEM_INVENTORY)) - cost /= 2; - else - cost = cost * 3 / 4; - } - } - } - - if ( obj->item_type == ITEM_STAFF || obj->item_type == ITEM_WAND ) - { - if (obj->value[1] == 0) - cost /= 4; - else - cost = cost * obj->value[2] / obj->value[1]; - } - - return cost; -} - - - -void do_buy( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - int cost,roll; - - if ( argument[0] == '\0' ) - { - send_to_char( "Buy what?\n\r", ch ); - return; - } - - if ( IS_SET(ch->in_room->room_flags, ROOM_PET_SHOP) ) - { - char arg[MAX_INPUT_LENGTH]; - char buf[MAX_STRING_LENGTH]; - CHAR_DATA *pet; - ROOM_INDEX_DATA *pRoomIndexNext; - ROOM_INDEX_DATA *in_room; - - smash_tilde(argument); - - if ( IS_NPC(ch) ) - return; - - argument = one_argument(argument,arg); - - /* hack to make new thalos pets work */ - if (ch->in_room->vnum == 9621) - pRoomIndexNext = get_room_index(9706); - else - pRoomIndexNext = get_room_index( ch->in_room->vnum + 1 ); - if ( pRoomIndexNext == NULL ) - { - bug( "Do_buy: bad pet shop at vnum %d.", ch->in_room->vnum ); - send_to_char( "Sorry, you can't buy that here.\n\r", ch ); - return; - } - - in_room = ch->in_room; - ch->in_room = pRoomIndexNext; - pet = get_char_room( ch, arg ); - ch->in_room = in_room; - - if ( pet == NULL || !IS_SET(pet->act, ACT_PET) ) - { - send_to_char( "Sorry, you can't buy that here.\n\r", ch ); - return; - } - - if ( ch->pet != NULL ) - { - send_to_char("You already own a pet.\n\r",ch); - return; - } - - cost = 10 * pet->level * pet->level; - - if ( (ch->silver + 100 * ch->gold) < cost ) - { - send_to_char( "You can't afford it.\n\r", ch ); - return; - } - - if ( ch->level < pet->level ) - { - send_to_char( - "You're not powerful enough to master this pet.\n\r", ch ); - return; - } - - /* haggle */ - roll = number_percent(); - if (roll < get_skill(ch,gsn_haggle)) - { - cost -= cost / 2 * roll / 100; - sprintf(buf,"You haggle the price down to %d coins.\n\r",cost); - send_to_char(buf,ch); - check_improve(ch,gsn_haggle,TRUE,4); - - } - - deduct_cost(ch,cost); - pet = create_mobile( pet->pIndexData ); - SET_BIT(pet->act, ACT_PET); - SET_BIT(pet->affected_by, AFF_CHARM); - pet->comm = COMM_NOTELL|COMM_NOSHOUT|COMM_NOCHANNELS; - - argument = one_argument( argument, arg ); - if ( arg[0] != '\0' ) - { - sprintf( buf, "%s %s", pet->name, arg ); - free_string( pet->name ); - pet->name = str_dup( buf ); - } - - sprintf( buf, "%sA neck tag says 'I belong to %s'.\n\r", - pet->description, ch->name ); - free_string( pet->description ); - pet->description = str_dup( buf ); - - char_to_room( pet, ch->in_room ); - add_follower( pet, ch ); - pet->leader = ch; - ch->pet = pet; - send_to_char( "Enjoy your pet.\n\r", ch ); - act( "$n bought $N as a pet.", ch, NULL, pet, TO_ROOM ); - return; - } - else - { - CHAR_DATA *keeper; - OBJ_DATA *obj,*t_obj; - char arg[MAX_INPUT_LENGTH]; - int number, count = 1; - - if ( ( keeper = find_keeper( ch ) ) == NULL ) - return; - - number = mult_argument(argument,arg); - obj = get_obj_keeper( ch,keeper, arg ); - cost = get_cost( keeper, obj, TRUE ); - - if (number < 1 || number > 99) - { - act("$n tells you 'Get real!",keeper,NULL,ch,TO_VICT); - return; - } - - if ( cost <= 0 || !can_see_obj( ch, obj ) ) - { - act( "$n tells you 'I don't sell that -- try 'list''.", - keeper, NULL, ch, TO_VICT ); - ch->reply = keeper; - return; - } - - if (!IS_OBJ_STAT(obj,ITEM_INVENTORY)) - { - for (t_obj = obj->next_content; - count < number && t_obj != NULL; - t_obj = t_obj->next_content) - { - if (t_obj->pIndexData == obj->pIndexData - && !str_cmp(t_obj->short_descr,obj->short_descr)) - count++; - else - break; - } - - if (count < number) - { - act("$n tells you 'I don't have that many in stock.", - keeper,NULL,ch,TO_VICT); - ch->reply = keeper; - return; - } - } - - if ( (ch->silver + ch->gold * 100) < cost * number ) - { - if (number > 1) - act("$n tells you 'You can't afford to buy that many.", - keeper,obj,ch,TO_VICT); - else - act( "$n tells you 'You can't afford to buy $p'.", - keeper, obj, ch, TO_VICT ); - ch->reply = keeper; - return; - } - - if ( obj->level > ch->level ) - { - act( "$n tells you 'You can't use $p yet'.", - keeper, obj, ch, TO_VICT ); - ch->reply = keeper; - return; - } - - if (ch->carry_number + number * get_obj_number(obj) > can_carry_n(ch)) - { - send_to_char( "You can't carry that many items.\n\r", ch ); - return; - } - - if ( ch->carry_weight + number * get_obj_weight(obj) > can_carry_w(ch)) - { - send_to_char( "You can't carry that much weight.\n\r", ch ); - return; - } - - /* haggle */ - roll = number_percent(); - if (!IS_OBJ_STAT(obj,ITEM_SELL_EXTRACT) - && roll < get_skill(ch,gsn_haggle)) - { - cost -= obj->cost / 2 * roll / 100; - act("You haggle with $N.",ch,NULL,keeper,TO_CHAR); - check_improve(ch,gsn_haggle,TRUE,4); - } - - if (number > 1) - { - sprintf(buf,"$n buys $p[%d].",number); - act(buf,ch,obj,NULL,TO_ROOM); - sprintf(buf,"You buy $p[%d] for %d silver.",number,cost * number); - act(buf,ch,obj,NULL,TO_CHAR); - } - else - { - act( "$n buys $p.", ch, obj, NULL, TO_ROOM ); - sprintf(buf,"You buy $p for %d silver.",cost); - act( buf, ch, obj, NULL, TO_CHAR ); - } - deduct_cost(ch,cost * number); - keeper->gold += cost * number/100; - keeper->silver += cost * number - (cost * number/100) * 100; - - for (count = 0; count < number; count++) - { - if ( IS_SET( obj->extra_flags, ITEM_INVENTORY ) ) - t_obj = create_object( obj->pIndexData, obj->level ); - else - { - t_obj = obj; - obj = obj->next_content; - obj_from_char( t_obj ); - } - - if (t_obj->timer > 0 && !IS_OBJ_STAT(t_obj,ITEM_HAD_TIMER)) - t_obj->timer = 0; - REMOVE_BIT(t_obj->extra_flags,ITEM_HAD_TIMER); - obj_to_char( t_obj, ch ); - if (cost < t_obj->cost) - t_obj->cost = cost; - } - } -} - - - -void do_list( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - - if ( IS_SET(ch->in_room->room_flags, ROOM_PET_SHOP) ) - { - ROOM_INDEX_DATA *pRoomIndexNext; - CHAR_DATA *pet; - bool found; - - /* hack to make new thalos pets work */ - if (ch->in_room->vnum == 9621) - pRoomIndexNext = get_room_index(9706); - else - pRoomIndexNext = get_room_index( ch->in_room->vnum + 1 ); - - if ( pRoomIndexNext == NULL ) - { - bug( "Do_list: bad pet shop at vnum %d.", ch->in_room->vnum ); - send_to_char( "You can't do that here.\n\r", ch ); - return; - } - - found = FALSE; - for ( pet = pRoomIndexNext->people; pet; pet = pet->next_in_room ) - { - if ( IS_SET(pet->act, ACT_PET) ) - { - if ( !found ) - { - found = TRUE; - send_to_char( "Pets for sale:\n\r", ch ); - } - sprintf( buf, "[%2d] %8d - %s\n\r", - pet->level, - 10 * pet->level * pet->level, - pet->short_descr ); - send_to_char( buf, ch ); - } - } - if ( !found ) - send_to_char( "Sorry, we're out of pets right now.\n\r", ch ); - return; - } - else - { - CHAR_DATA *keeper; - OBJ_DATA *obj; - int cost,count; - bool found; - char arg[MAX_INPUT_LENGTH]; - - if ( ( keeper = find_keeper( ch ) ) == NULL ) - return; - one_argument(argument,arg); - - found = FALSE; - for ( obj = keeper->carrying; obj; obj = obj->next_content ) - { - if ( obj->wear_loc == WEAR_NONE - && can_see_obj( ch, obj ) - && ( cost = get_cost( keeper, obj, TRUE ) ) > 0 - && ( arg[0] == '\0' - || is_name(arg,obj->name) )) - { - if ( !found ) - { - found = TRUE; - send_to_char( "[Lv Price Qty] Item\n\r", ch ); - } - - if (IS_OBJ_STAT(obj,ITEM_INVENTORY)) - sprintf(buf,"[%2d %5d -- ] %s\n\r", - obj->level,cost,obj->short_descr); - else - { - count = 1; - - while (obj->next_content != NULL - && obj->pIndexData == obj->next_content->pIndexData - && !str_cmp(obj->short_descr, - obj->next_content->short_descr)) - { - obj = obj->next_content; - count++; - } - sprintf(buf,"[%2d %5d %2d ] %s\n\r", - obj->level,cost,count,obj->short_descr); - } - send_to_char( buf, ch ); - } - } - - if ( !found ) - send_to_char( "You can't buy anything here.\n\r", ch ); - return; - } -} - - - -void do_sell( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *keeper; - OBJ_DATA *obj; - int cost,roll; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Sell what?\n\r", ch ); - return; - } - - if ( ( keeper = find_keeper( ch ) ) == NULL ) - return; - - if ( ( obj = get_obj_carry( ch, arg, ch ) ) == NULL ) - { - act( "$n tells you 'You don't have that item'.", - keeper, NULL, ch, TO_VICT ); - ch->reply = keeper; - return; - } - - if ( !can_drop_obj( ch, obj ) ) - { - send_to_char( "You can't let go of it.\n\r", ch ); - return; - } - - if (!can_see_obj(keeper,obj)) - { - act("$n doesn't see what you are offering.",keeper,NULL,ch,TO_VICT); - return; - } - - if ( ( cost = get_cost( keeper, obj, FALSE ) ) <= 0 ) - { - act( "$n looks uninterested in $p.", keeper, obj, ch, TO_VICT ); - return; - } - if ( cost > (keeper-> silver + 100 * keeper->gold) ) - { - act("$n tells you 'I'm afraid I don't have enough wealth to buy $p.", - keeper,obj,ch,TO_VICT); - return; - } - - act( "$n sells $p.", ch, obj, NULL, TO_ROOM ); - /* haggle */ - roll = number_percent(); - if (!IS_OBJ_STAT(obj,ITEM_SELL_EXTRACT) && roll < get_skill(ch,gsn_haggle)) - { - send_to_char("You haggle with the shopkeeper.\n\r",ch); - cost += obj->cost / 2 * roll / 100; - cost = UMIN(cost,95 * get_cost(keeper,obj,TRUE) / 100); - cost = UMIN(cost,(keeper->silver + 100 * keeper->gold)); - check_improve(ch,gsn_haggle,TRUE,4); - } - sprintf( buf, "You sell $p for %d silver and %d gold piece%s.", - cost - (cost/100) * 100, cost/100, cost == 1 ? "" : "s" ); - act( buf, ch, obj, NULL, TO_CHAR ); - ch->gold += cost/100; - ch->silver += cost - (cost/100) * 100; - deduct_cost(keeper,cost); - if ( keeper->gold < 0 ) - keeper->gold = 0; - if ( keeper->silver< 0) - keeper->silver = 0; - - if ( obj->item_type == ITEM_TRASH || IS_OBJ_STAT(obj,ITEM_SELL_EXTRACT)) - { - extract_obj( obj ); - } - else - { - obj_from_char( obj ); - if (obj->timer) - SET_BIT(obj->extra_flags,ITEM_HAD_TIMER); - else - obj->timer = number_range(50,100); - obj_to_keeper( obj, keeper ); - } - - return; -} - - - -void do_value( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *keeper; - OBJ_DATA *obj; - int cost; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Value what?\n\r", ch ); - return; - } - - if ( ( keeper = find_keeper( ch ) ) == NULL ) - return; - - if ( ( obj = get_obj_carry( ch, arg, ch ) ) == NULL ) - { - act( "$n tells you 'You don't have that item'.", - keeper, NULL, ch, TO_VICT ); - ch->reply = keeper; - return; - } - - if (!can_see_obj(keeper,obj)) - { - act("$n doesn't see what you are offering.",keeper,NULL,ch,TO_VICT); - return; - } - - if ( !can_drop_obj( ch, obj ) ) - { - send_to_char( "You can't let go of it.\n\r", ch ); - return; - } - - if ( ( cost = get_cost( keeper, obj, FALSE ) ) <= 0 ) - { - act( "$n looks uninterested in $p.", keeper, obj, ch, TO_VICT ); - return; - } - - sprintf( buf, - "$n tells you 'I'll give you %d silver and %d gold coins for $p'.", - cost - (cost/100) * 100, cost/100 ); - act( buf, keeper, obj, ch, TO_VICT ); - ch->reply = keeper; - - return; -} diff --git a/Rom24/src/act_wiz.c b/Rom24/src/act_wiz.c deleted file mode 100644 index de7617f..0000000 --- a/Rom24/src/act_wiz.c +++ /dev/null @@ -1,4378 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#include -#else -#include -#include -#endif -#include -#include -#include -#include "merc.h" -#include "interp.h" -#include "recycle.h" -#include "tables.h" -#include "lookup.h" - -/* - * Local functions. - */ -ROOM_INDEX_DATA * find_location args( ( CHAR_DATA *ch, char *arg ) ); - -void do_wiznet( CHAR_DATA *ch, char *argument ) -{ - int flag; - char buf[MAX_STRING_LENGTH]; - - 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; - } - - /* show wiznet status */ - 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")) - /* list of all wiznet options */ - { - 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)) - { - sprintf(buf,"You will no longer see %s on wiznet.\n\r", - wiznet_table[flag].name); - send_to_char(buf,ch); - REMOVE_BIT(ch->wiznet,wiznet_table[flag].flag); - return; - } - else - { - sprintf(buf,"You will now see %s on wiznet.\n\r", - wiznet_table[flag].name); - send_to_char(buf,ch); - 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) -{ - DESCRIPTOR_DATA *d; - - 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) - { - if (IS_SET(d->character->wiznet,WIZ_PREFIX)) - send_to_char("--> ",d->character); - act_new(string,d->character,obj,ch,TO_CHAR,POS_DEAD); - } - } - - return; -} - -void do_guild( CHAR_DATA *ch, char *argument ) -{ - char arg1[MAX_INPUT_LENGTH],arg2[MAX_INPUT_LENGTH]; - char buf[MAX_STRING_LENGTH]; - CHAR_DATA *victim; - int clan; - - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - - if ( arg1[0] == '\0' || arg2[0] == '\0' ) - { - send_to_char( "Syntax: guild \n\r",ch); - return; - } - if ( ( victim = get_char_world( ch, arg1 ) ) == NULL ) - { - send_to_char( "They aren't playing.\n\r", ch ); - return; - } - - if (!str_prefix(arg2,"none")) - { - send_to_char("They are now clanless.\n\r",ch); - send_to_char("You are now a member of no clan!\n\r",victim); - victim->clan = 0; - return; - } - - if ((clan = clan_lookup(arg2)) == 0) - { - send_to_char("No such clan exists.\n\r",ch); - return; - } - - if (clan_table[clan].independent) - { - sprintf(buf,"They are now a %s.\n\r",clan_table[clan].name); - send_to_char(buf,ch); - sprintf(buf,"You are now a %s.\n\r",clan_table[clan].name); - send_to_char(buf,victim); - } - else - { - sprintf(buf,"They are now a member of clan %s.\n\r", - capitalize(clan_table[clan].name)); - send_to_char(buf,ch); - sprintf(buf,"You are now a member of clan %s.\n\r", - capitalize(clan_table[clan].name)); - } - - victim->clan = clan; -} - -/* equips a character */ -void do_outfit ( CHAR_DATA *ch, char *argument ) -{ - OBJ_DATA *obj; - int i,sn,vnum; - - if (ch->level > 5 || IS_NPC(ch)) - { - send_to_char("Find it yourself!\n\r",ch); - return; - } - - if ( ( obj = get_eq_char( ch, WEAR_LIGHT ) ) == NULL ) - { - obj = create_object( get_obj_index(OBJ_VNUM_SCHOOL_BANNER), 0 ); - obj->cost = 0; - obj_to_char( obj, ch ); - equip_char( ch, obj, WEAR_LIGHT ); - } - - if ( ( obj = get_eq_char( ch, WEAR_BODY ) ) == NULL ) - { - obj = create_object( get_obj_index(OBJ_VNUM_SCHOOL_VEST), 0 ); - obj->cost = 0; - obj_to_char( obj, ch ); - equip_char( ch, obj, WEAR_BODY ); - } - - /* do the weapon thing */ - if ((obj = get_eq_char(ch,WEAR_WIELD)) == NULL) - { - sn = 0; - vnum = OBJ_VNUM_SCHOOL_SWORD; /* just in case! */ - - for (i = 0; weapon_table[i].name != NULL; i++) - { - if (ch->pcdata->learned[sn] < - ch->pcdata->learned[*weapon_table[i].gsn]) - { - sn = *weapon_table[i].gsn; - vnum = weapon_table[i].vnum; - } - } - - obj = create_object(get_obj_index(vnum),0); - obj_to_char(obj,ch); - equip_char(ch,obj,WEAR_WIELD); - } - - if (((obj = get_eq_char(ch,WEAR_WIELD)) == NULL - || !IS_WEAPON_STAT(obj,WEAPON_TWO_HANDS)) - && (obj = get_eq_char( ch, WEAR_SHIELD ) ) == NULL ) - { - obj = create_object( get_obj_index(OBJ_VNUM_SCHOOL_SHIELD), 0 ); - obj->cost = 0; - obj_to_char( obj, ch ); - equip_char( ch, obj, WEAR_SHIELD ); - } - - send_to_char("You have been equipped by Mota.\n\r",ch); -} - - -/* RT nochannels command, for those spammers */ -void do_nochannels( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH], buf[MAX_STRING_LENGTH]; - 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 ); - send_to_char( "NOCHANNELS removed.\n\r", ch ); - sprintf(buf,"$N restores channels to %s",victim->name); - wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); - } - else - { - SET_BIT(victim->comm, COMM_NOCHANNELS); - send_to_char( "The gods have revoked your channel priviliges.\n\r", - victim ); - send_to_char( "NOCHANNELS set.\n\r", ch ); - sprintf(buf,"$N revokes %s's channels.",victim->name); - wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); - } - - return; -} - - -void do_smote(CHAR_DATA *ch, char *argument ) -{ - CHAR_DATA *vch; - 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) ) - { - send_to_char( "You can't show your emotions.\n\r", ch ); - return; - } - - if ( argument[0] == '\0' ) - { - send_to_char( "Emote what?\n\r", ch ); - return; - } - - if (strstr(argument,ch->name) == NULL) - { - send_to_char("You must include your name in an smote.\n\r",ch); - return; - } - - send_to_char(argument,ch); - send_to_char("\n\r",ch); - - 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) - { - send_to_char(argument,vch); - send_to_char("\n\r",vch); - continue; - } - - strcpy(temp,argument); - temp[strlen(argument) - strlen(letter)] = '\0'; - last[0] = '\0'; - name = vch->name; - - for (; *letter != '\0'; letter++) - { - if (*letter == '\'' && matches == strlen(vch->name)) - { - strcat(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)) - { - strcat(temp,"you"); - last[0] = '\0'; - name = vch->name; - continue; - } - strncat(last,letter,1); - continue; - } - - matches = 0; - strcat(temp,last); - strncat(temp,letter,1); - last[0] = '\0'; - name = vch->name; - } - - send_to_char(temp,vch); - send_to_char("\n\r",vch); - } - - return; -} - -void do_bamfin( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - - if ( !IS_NPC(ch) ) - { - smash_tilde( argument ); - - if (argument[0] == '\0') - { - sprintf(buf,"Your poofin is %s\n\r",ch->pcdata->bamfin); - send_to_char(buf,ch); - 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 ); - - sprintf(buf,"Your poofin is now %s\n\r",ch->pcdata->bamfin); - send_to_char(buf,ch); - } - return; -} - -void do_bamfout( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - - if ( !IS_NPC(ch) ) - { - smash_tilde( argument ); - - if (argument[0] == '\0') - { - sprintf(buf,"Your poofout is %s\n\r",ch->pcdata->bamfout); - send_to_char(buf,ch); - 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 ); - - sprintf(buf,"Your poofout is now %s\n\r",ch->pcdata->bamfout); - send_to_char(buf,ch); - } - return; -} - - - -void do_deny( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH],buf[MAX_STRING_LENGTH]; - 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,0); - send_to_char( "OK.\n\r", ch ); - save_char_obj(victim); - stop_fighting(victim,TRUE); - do_function(victim, &do_quit, "" ); - - return; -} - - - -void do_disconnect( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - 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 ) - { - close_socket( d ); - send_to_char( "Ok.\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 ) - { - 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_socket( d ); - send_to_char( "Ok.\n\r", ch ); - return; - } - } - - bug( "Do_disconnect: desc not found.", 0 ); - send_to_char( "Descriptor not found!\n\r", ch ); - return; -} - - - -void do_pardon( CHAR_DATA *ch, char *argument ) -{ - char arg1[MAX_INPUT_LENGTH]; - char arg2[MAX_INPUT_LENGTH]; - 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 .\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 ( !str_cmp( arg2, "killer" ) ) - { - if ( IS_SET(victim->act, PLR_KILLER) ) - { - REMOVE_BIT( victim->act, PLR_KILLER ); - send_to_char( "Killer flag removed.\n\r", ch ); - send_to_char( "You are no longer a KILLER.\n\r", victim ); - } - return; - } - - if ( !str_cmp( arg2, "thief" ) ) - { - if ( IS_SET(victim->act, PLR_THIEF) ) - { - REMOVE_BIT( victim->act, PLR_THIEF ); - send_to_char( "Thief flag removed.\n\r", ch ); - send_to_char( "You are no longer a THIEF.\n\r", victim ); - } - return; - } - - send_to_char( "Syntax: pardon .\n\r", ch ); - return; -} - - - -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); - send_to_char( argument, d->character ); - send_to_char( "\n\r", d->character ); - } - } - - return; -} - - - -void do_recho( CHAR_DATA *ch, char *argument ) -{ - DESCRIPTOR_DATA *d; - - if ( argument[0] == '\0' ) - { - send_to_char( "Local echo what?\n\r", ch ); - - return; - } - - for ( d = descriptor_list; d; d = d->next ) - { - if ( d->connected == CON_PLAYING - && d->character->in_room == ch->in_room ) - { - if (get_trust(d->character) >= get_trust(ch)) - send_to_char( "local> ",d->character); - send_to_char( argument, d->character ); - send_to_char( "\n\r", d->character ); - } - } - - return; -} - -void do_zecho(CHAR_DATA *ch, char *argument) -{ - DESCRIPTOR_DATA *d; - - if (argument[0] == '\0') - { - send_to_char("Zone echo what?\n\r",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 (get_trust(d->character) >= get_trust(ch)) - send_to_char("zone> ",d->character); - send_to_char(argument,d->character); - send_to_char("\n\r",d->character); - } - } -} - -void do_pecho( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - - argument = one_argument(argument, arg); - - if ( argument[0] == '\0' || arg[0] == '\0' ) - { - send_to_char("Personal echo what?\n\r", ch); - return; - } - - if ( (victim = get_char_world(ch, arg) ) == NULL ) - { - send_to_char("Target not found.\n\r",ch); - return; - } - - if (get_trust(victim) >= get_trust(ch) && get_trust(ch) != MAX_LEVEL) - send_to_char( "personal> ",victim); - - send_to_char(argument,victim); - send_to_char("\n\r",victim); - send_to_char( "personal> ",ch); - send_to_char(argument,ch); - send_to_char("\n\r",ch); -} - - -ROOM_INDEX_DATA *find_location( CHAR_DATA *ch, char *arg ) -{ - CHAR_DATA *victim; - OBJ_DATA *obj; - - if ( is_number(arg) ) - return 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; -} - - - -void do_transfer( CHAR_DATA *ch, char *argument ) -{ - 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 ); - 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 ( 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 ) ) - { - char buf[MAX_STRING_LENGTH]; - sprintf( buf, "%s %s", d->character->name, arg2 ); - do_function(ch, &do_transfer, buf ); - } - } - return; - } - - /* - * Thanks to Grodyn for the optional location parameter. - */ - 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 ( !is_room_owner(ch,location) && room_is_private( location ) - && get_trust(ch) < MAX_LEVEL) - { - send_to_char( "That room is private right now.\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 ) - { - send_to_char( "They are in limbo.\n\r", ch ); - return; - } - - if ( victim->fighting != NULL ) - stop_fighting( victim, TRUE ); - act( "$n disappears in a mushroom cloud.", victim, NULL, NULL, TO_ROOM ); - char_from_room( victim ); - char_to_room( victim, location ); - act( "$n arrives from a puff of smoke.", victim, NULL, NULL, TO_ROOM ); - if ( ch != victim ) - act( "$n has transferred you.", ch, NULL, victim, TO_VICT ); - do_function(victim, &do_look, "auto" ); - send_to_char( "Ok.\n\r", ch ); -} - - - -void do_at( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - ROOM_INDEX_DATA *location; - ROOM_INDEX_DATA *original; - OBJ_DATA *on; - CHAR_DATA *wch; - - 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 (!is_room_owner(ch,location) && room_is_private( location ) - && get_trust(ch) < MAX_LEVEL) - { - send_to_char( "That room is private right now.\n\r", ch ); - return; - } - - original = ch->in_room; - on = ch->on; - char_from_room( ch ); - char_to_room( ch, location ); - interpret( ch, argument ); - - /* - * See if 'ch' still exists before continuing! - * Handles 'at XXXX quit' case. - */ - for ( wch = char_list; wch != NULL; wch = wch->next ) - { - if ( wch == ch ) - { - char_from_room( ch ); - char_to_room( ch, original ); - ch->on = on; - break; - } - } - - return; -} - - - -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 (!is_room_owner(ch,location) && 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 ( 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_function(ch, &do_look, "auto" ); - return; -} - -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 ( 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_function(ch, &do_look, "auto" ); - return; -} - -/* RT to replace the 3 stat commands */ - -void do_stat ( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - char *string; - OBJ_DATA *obj; - ROOM_INDEX_DATA *location; - CHAR_DATA *victim; - - string = one_argument(argument, arg); - if ( arg[0] == '\0') - { - send_to_char("Syntax:\n\r",ch); - send_to_char(" stat \n\r",ch); - send_to_char(" stat obj \n\r",ch); - send_to_char(" stat mob \n\r",ch); - send_to_char(" stat room \n\r",ch); - return; - } - - if (!str_cmp(arg,"room")) - { - do_function(ch, &do_rstat, string); - return; - } - - if (!str_cmp(arg,"obj")) - { - do_function(ch, &do_ostat, string); - return; - } - - if(!str_cmp(arg,"char") || !str_cmp(arg,"mob")) - { - do_function(ch, &do_mstat, string); - return; - } - - /* do it the old way */ - - obj = get_obj_world(ch,argument); - if (obj != NULL) - { - do_function(ch, &do_ostat, argument); - return; - } - - victim = get_char_world(ch,argument); - if (victim != NULL) - { - do_function(ch, &do_mstat, argument); - return; - } - - location = find_location(ch,argument); - if (location != NULL) - { - do_function(ch, &do_rstat, argument); - return; - } - - send_to_char("Nothing by that name found anywhere.\n\r",ch); -} - -void do_rstat( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - 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 (!is_room_owner(ch,location) && 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; - } - - sprintf( buf, "Name: '%s'\n\rArea: '%s'\n\r", - location->name, - location->area->name ); - send_to_char( buf, ch ); - - sprintf( buf, - "Vnum: %d Sector: %d Light: %d Healing: %d Mana: %d\n\r", - location->vnum, - location->sector_type, - location->light, - location->heal_rate, - location->mana_rate ); - send_to_char( buf, ch ); - - sprintf( buf, - "Room flags: %d.\n\rDescription:\n\r%s", - location->room_flags, - location->description ); - send_to_char( buf, ch ); - - 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 ) - { - sprintf( buf, - "Door: %d. To: %d. Key: %d. Exit flags: %d.\n\rKeyword: '%s'. Description: %s", - - door, - (pexit->u1.to_room == NULL ? -1 : pexit->u1.to_room->vnum), - pexit->key, - pexit->exit_info, - pexit->keyword, - pexit->description[0] != '\0' - ? pexit->description : "(none).\n\r" ); - send_to_char( buf, ch ); - } - } - - return; -} - - - -void do_ostat( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - AFFECT_DATA *paf; - OBJ_DATA *obj; - - 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; - } - - sprintf( buf, "Name(s): %s\n\r", - obj->name ); - send_to_char( buf, ch ); - - sprintf( buf, "Vnum: %d Format: %s Type: %s Resets: %d\n\r", - obj->pIndexData->vnum, obj->pIndexData->new_format ? "new" : "old", - item_name(obj->item_type), obj->pIndexData->reset_num ); - send_to_char( buf, ch ); - - sprintf( buf, "Short description: %s\n\rLong description: %s\n\r", - obj->short_descr, obj->description ); - send_to_char( buf, ch ); - - sprintf( buf, "Wear bits: %s\n\rExtra bits: %s\n\r", - wear_bit_name(obj->wear_flags), extra_bit_name( obj->extra_flags ) ); - send_to_char( buf, ch ); - - sprintf( buf, "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) ); - send_to_char( buf, ch ); - - sprintf( buf, "Level: %d Cost: %d Condition: %d Timer: %d\n\r", - obj->level, obj->cost, obj->condition, obj->timer ); - send_to_char( buf, ch ); - - sprintf( buf, - "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 ); - send_to_char( buf, ch ); - - sprintf( buf, "Values: %d %d %d %d %d\n\r", - obj->value[0], obj->value[1], obj->value[2], obj->value[3], - obj->value[4] ); - send_to_char( buf, ch ); - - /* now give out vital statistics as per identify */ - - switch ( obj->item_type ) - { - case ITEM_SCROLL: - case ITEM_POTION: - case ITEM_PILL: - sprintf( buf, "Level %d spells of:", obj->value[0] ); - send_to_char( buf, ch ); - - if ( obj->value[1] >= 0 && obj->value[1] < MAX_SKILL ) - { - send_to_char( " '", ch ); - send_to_char( skill_table[obj->value[1]].name, ch ); - send_to_char( "'", ch ); - } - - if ( obj->value[2] >= 0 && obj->value[2] < MAX_SKILL ) - { - send_to_char( " '", ch ); - send_to_char( skill_table[obj->value[2]].name, ch ); - send_to_char( "'", ch ); - } - - if ( obj->value[3] >= 0 && obj->value[3] < MAX_SKILL ) - { - send_to_char( " '", ch ); - send_to_char( skill_table[obj->value[3]].name, ch ); - send_to_char( "'", ch ); - } - - if (obj->value[4] >= 0 && obj->value[4] < MAX_SKILL) - { - send_to_char(" '",ch); - send_to_char(skill_table[obj->value[4]].name,ch); - send_to_char("'",ch); - } - - send_to_char( ".\n\r", ch ); - break; - - case ITEM_WAND: - case ITEM_STAFF: - sprintf( buf, "Has %d(%d) charges of level %d", - obj->value[1], obj->value[2], obj->value[0] ); - send_to_char( buf, ch ); - - if ( obj->value[3] >= 0 && obj->value[3] < MAX_SKILL ) - { - send_to_char( " '", ch ); - send_to_char( skill_table[obj->value[3]].name, ch ); - send_to_char( "'", ch ); - } - - send_to_char( ".\n\r", ch ); - break; - - case ITEM_DRINK_CON: - sprintf(buf,"It holds %s-colored %s.\n\r", - liq_table[obj->value[2]].liq_color, - liq_table[obj->value[2]].liq_name); - send_to_char(buf,ch); - 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/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) - sprintf(buf,"Damage is %dd%d (average %d)\n\r", - obj->value[1],obj->value[2], - (1 + obj->value[2]) * obj->value[1] / 2); - else - sprintf( buf, "Damage is %d to %d (average %d)\n\r", - obj->value[1], obj->value[2], - ( obj->value[1] + obj->value[2] ) / 2 ); - send_to_char( buf, ch ); - - sprintf(buf,"Damage noun is %s.\n\r", - (obj->value[3] > 0 && obj->value[3] < MAX_DAMAGE_MESSAGE) ? - attack_table[obj->value[3]].noun : "undefined"); - send_to_char(buf,ch); - - if (obj->value[4]) /* weapon flags */ - { - sprintf(buf,"Weapons flags: %s\n\r", - weapon_bit_name(obj->value[4])); - send_to_char(buf,ch); - } - break; - - case ITEM_ARMOR: - sprintf( buf, - "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] ); - send_to_char( buf, ch ); - break; - - case ITEM_CONTAINER: - sprintf(buf,"Capacity: %d# Maximum weight: %d# flags: %s\n\r", - obj->value[0], obj->value[3], cont_bit_name(obj->value[1])); - send_to_char(buf,ch); - if (obj->value[4] != 100) - { - sprintf(buf,"Weight multiplier: %d%%\n\r", - obj->value[4]); - send_to_char(buf,ch); - } - break; - } - - - 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 ) - { - sprintf( buf, "Affects %s by %d, level %d", - affect_loc_name( paf->location ), paf->modifier,paf->level ); - send_to_char(buf,ch); - if ( paf->duration > -1) - sprintf(buf,", %d hours.\n\r",paf->duration); - else - sprintf(buf,".\n\r"); - send_to_char( buf, ch ); - if (paf->bitvector) - { - switch(paf->where) - { - case TO_AFFECTS: - sprintf(buf,"Adds %s affect.\n", - affect_bit_name(paf->bitvector)); - break; - case TO_WEAPON: - sprintf(buf,"Adds %s weapon flags.\n", - weapon_bit_name(paf->bitvector)); - break; - case TO_OBJECT: - sprintf(buf,"Adds %s object flag.\n", - extra_bit_name(paf->bitvector)); - break; - case TO_IMMUNE: - sprintf(buf,"Adds immunity to %s.\n", - imm_bit_name(paf->bitvector)); - break; - case TO_RESIST: - sprintf(buf,"Adds resistance to %s.\n\r", - imm_bit_name(paf->bitvector)); - break; - case TO_VULN: - sprintf(buf,"Adds vulnerability to %s.\n\r", - imm_bit_name(paf->bitvector)); - break; - default: - sprintf(buf,"Unknown bit %d: %d\n\r", - paf->where,paf->bitvector); - break; - } - send_to_char(buf,ch); - } - } - - if (!obj->enchanted) - for ( paf = obj->pIndexData->affected; paf != NULL; paf = paf->next ) - { - sprintf( buf, "Affects %s by %d, level %d.\n\r", - affect_loc_name( paf->location ), paf->modifier,paf->level ); - send_to_char( buf, ch ); - if (paf->bitvector) - { - switch(paf->where) - { - case TO_AFFECTS: - sprintf(buf,"Adds %s affect.\n", - affect_bit_name(paf->bitvector)); - break; - case TO_OBJECT: - sprintf(buf,"Adds %s object flag.\n", - extra_bit_name(paf->bitvector)); - break; - case TO_IMMUNE: - sprintf(buf,"Adds immunity to %s.\n", - imm_bit_name(paf->bitvector)); - break; - case TO_RESIST: - sprintf(buf,"Adds resistance to %s.\n\r", - imm_bit_name(paf->bitvector)); - break; - case TO_VULN: - sprintf(buf,"Adds vulnerability to %s.\n\r", - imm_bit_name(paf->bitvector)); - break; - default: - sprintf(buf,"Unknown bit %d: %d\n\r", - paf->where,paf->bitvector); - break; - } - send_to_char(buf,ch); - } - } - - return; -} - - - -void do_mstat( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - AFFECT_DATA *paf; - CHAR_DATA *victim; - - 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; - } - - sprintf( buf, "Name: %s\n\r", - victim->name); - send_to_char( buf, ch ); - - sprintf( buf, - "Vnum: %d Format: %s Race: %s Group: %d Sex: %s Room: %d\n\r", - IS_NPC(victim) ? victim->pIndexData->vnum : 0, - IS_NPC(victim) ? victim->pIndexData->new_format ? "new" : "old" : "pc", - race_table[victim->race].name, - IS_NPC(victim) ? victim->group : 0, sex_table[victim->sex].name, - victim->in_room == NULL ? 0 : victim->in_room->vnum - ); - send_to_char( buf, ch ); - - if (IS_NPC(victim)) - { - sprintf(buf,"Count: %d Killed: %d\n\r", - victim->pIndexData->count,victim->pIndexData->killed); - send_to_char(buf,ch); - } - - sprintf( buf, - "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) ); - send_to_char( buf, ch ); - - sprintf( buf, "Hp: %d/%d Mana: %d/%d Move: %d/%d Practices: %d\n\r", - victim->hit, victim->max_hit, - victim->mana, victim->max_mana, - victim->move, victim->max_move, - IS_NPC(ch) ? 0 : victim->practice ); - send_to_char( buf, ch ); - - sprintf( buf, - "Lv: %d Class: %s Align: %d Gold: %ld Silver: %ld Exp: %d\n\r", - victim->level, - IS_NPC(victim) ? "mobile" : class_table[victim->class].name, - victim->alignment, - victim->gold, victim->silver, victim->exp ); - send_to_char( buf, ch ); - - sprintf(buf,"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)); - send_to_char(buf,ch); - - sprintf( buf, - "Hit: %d Dam: %d Saves: %d Size: %s Position: %s Wimpy: %d\n\r", - GET_HITROLL(victim), GET_DAMROLL(victim), victim->saving_throw, - size_table[victim->size].name, position_table[victim->position].name, - victim->wimpy ); - send_to_char( buf, ch ); - - if (IS_NPC(victim) && victim->pIndexData->new_format) - { - sprintf(buf, "Damage: %dd%d Message: %s\n\r", - victim->damage[DICE_NUMBER],victim->damage[DICE_TYPE], - attack_table[victim->dam_type].noun); - send_to_char(buf,ch); - } - sprintf( buf, "Fighting: %s\n\r", - victim->fighting ? victim->fighting->name : "(none)" ); - send_to_char( buf, ch ); - - if ( !IS_NPC(victim) ) - { - sprintf( buf, - "Thirst: %d Hunger: %d Full: %d Drunk: %d\n\r", - victim->pcdata->condition[COND_THIRST], - victim->pcdata->condition[COND_HUNGER], - victim->pcdata->condition[COND_FULL], - victim->pcdata->condition[COND_DRUNK] ); - send_to_char( buf, ch ); - } - - sprintf( buf, "Carry number: %d Carry weight: %ld\n\r", - victim->carry_number, get_carry_weight(victim) / 10 ); - send_to_char( buf, ch ); - - - if (!IS_NPC(victim)) - { - sprintf( buf, - "Age: %d Played: %d Last Level: %d Timer: %d\n\r", - get_age(victim), - (int) (victim->played + current_time - victim->logon) / 3600, - victim->pcdata->last_level, - victim->timer ); - send_to_char( buf, ch ); - } - - sprintf(buf, "Act: %s\n\r",act_bit_name(victim->act)); - send_to_char(buf,ch); - - if (victim->comm) - { - sprintf(buf,"Comm: %s\n\r",comm_bit_name(victim->comm)); - send_to_char(buf,ch); - } - - if (IS_NPC(victim) && victim->off_flags) - { - sprintf(buf, "Offense: %s\n\r",off_bit_name(victim->off_flags)); - send_to_char(buf,ch); - } - - if (victim->imm_flags) - { - sprintf(buf, "Immune: %s\n\r",imm_bit_name(victim->imm_flags)); - send_to_char(buf,ch); - } - - if (victim->res_flags) - { - sprintf(buf, "Resist: %s\n\r", imm_bit_name(victim->res_flags)); - send_to_char(buf,ch); - } - - if (victim->vuln_flags) - { - sprintf(buf, "Vulnerable: %s\n\r", imm_bit_name(victim->vuln_flags)); - send_to_char(buf,ch); - } - - sprintf(buf, "Form: %s\n\rParts: %s\n\r", - form_bit_name(victim->form), part_bit_name(victim->parts)); - send_to_char(buf,ch); - - if (victim->affected_by) - { - sprintf(buf, "Affected by %s\n\r", - affect_bit_name(victim->affected_by)); - send_to_char(buf,ch); - } - - sprintf( buf, "Master: %s Leader: %s Pet: %s\n\r", - victim->master ? victim->master->name : "(none)", - victim->leader ? victim->leader->name : "(none)", - victim->pet ? victim->pet->name : "(none)"); - send_to_char( buf, ch ); - - sprintf( buf, "Short description: %s\n\rLong description: %s", - victim->short_descr, - victim->long_descr[0] != '\0' ? victim->long_descr : "(none)\n\r" ); - send_to_char( buf, ch ); - - if ( IS_NPC(victim) && victim->spec_fun != 0 ) - { - sprintf(buf,"Mobile has special procedure %s.\n\r", - spec_name(victim->spec_fun)); - send_to_char(buf,ch); - } - - for ( paf = victim->affected; paf != NULL; paf = paf->next ) - { - sprintf( buf, - "Spell: '%s' modifies %s by %d for %d hours with bits %s, level %d.\n\r", - skill_table[(int) paf->type].name, - affect_loc_name( paf->location ), - paf->modifier, - paf->duration, - affect_bit_name( paf->bitvector ), - paf->level - ); - send_to_char( buf, ch ); - } - - return; -} - -/* ofind and mfind replaced with vnum, vnum skill also added */ - -void do_vnum(CHAR_DATA *ch, char *argument) -{ - char arg[MAX_INPUT_LENGTH]; - char *string; - - string = one_argument(argument,arg); - - if (arg[0] == '\0') - { - send_to_char("Syntax:\n\r",ch); - send_to_char(" vnum obj \n\r",ch); - send_to_char(" vnum mob \n\r",ch); - send_to_char(" vnum skill \n\r",ch); - return; - } - - if (!str_cmp(arg,"obj")) - { - do_function(ch, &do_ofind, string); - return; - } - - if (!str_cmp(arg,"mob") || !str_cmp(arg,"char")) - { - do_function(ch, &do_mfind, string); - return; - } - - if (!str_cmp(arg,"skill") || !str_cmp(arg,"spell")) - { - do_function (ch, &do_slookup, string); - return; - } - /* do both */ - do_function(ch, &do_mfind, argument); - do_function(ch, &do_ofind, argument); -} - - -void do_mfind( CHAR_DATA *ch, char *argument ) -{ - extern int top_mob_index; - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - MOB_INDEX_DATA *pMobIndex; - int vnum; - int nMatch; - bool fAll; - bool found; - - one_argument( argument, arg ); - if ( arg[0] == '\0' ) - { - send_to_char( "Find whom?\n\r", ch ); - return; - } - - fAll = FALSE; /* !str_cmp( arg, "all" ); */ - 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 ( fAll || is_name( argument, pMobIndex->player_name ) ) - { - found = TRUE; - sprintf( buf, "[%5d] %s\n\r", - pMobIndex->vnum, pMobIndex->short_descr ); - send_to_char( buf, ch ); - } - } - } - - if ( !found ) - send_to_char( "No mobiles by that name.\n\r", ch ); - - return; -} - - - -void do_ofind( CHAR_DATA *ch, char *argument ) -{ - extern int top_obj_index; - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - OBJ_INDEX_DATA *pObjIndex; - int vnum; - int nMatch; - bool fAll; - bool found; - - one_argument( argument, arg ); - if ( arg[0] == '\0' ) - { - send_to_char( "Find what?\n\r", ch ); - return; - } - - fAll = FALSE; /* !str_cmp( arg, "all" ); */ - 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 ( fAll || is_name( argument, pObjIndex->name ) ) - { - found = TRUE; - sprintf( buf, "[%5d] %s\n\r", - pObjIndex->vnum, pObjIndex->short_descr ); - send_to_char( buf, ch ); - } - } - } - - if ( !found ) - send_to_char( "No objects by that name.\n\r", ch ); - - return; -} - - -void do_owhere(CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_INPUT_LENGTH]; - BUFFER *buffer; - OBJ_DATA *obj; - OBJ_DATA *in_obj; - bool found; - int number = 0, max_found; - - found = FALSE; - 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 ) - { - if ( !can_see_obj( ch, obj ) || !is_name( argument, obj->name ) - || ch->level < obj->level) - continue; - - 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,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)) - 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_mwhere( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - BUFFER *buffer; - CHAR_DATA *victim; - bool found; - int count = 0; - - if ( argument[0] == '\0' ) - { - DESCRIPTOR_DATA *d; - - /* show characters logged */ - - buffer = new_buf(); - 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) - sprintf(buf,"%3d) %s (in the body of %s) is in %s [%d]\n\r", - count, d->original->name,victim->short_descr, - victim->in_room->name,victim->in_room->vnum); - else - sprintf(buf,"%3d) %s is in %s [%d]\n\r", - count, victim->name,victim->in_room->name, - victim->in_room->vnum); - add_buf(buffer,buf); - } - } - - page_to_char(buf_string(buffer),ch); - free_buf(buffer); - return; - } - - found = FALSE; - buffer = new_buf(); - for ( victim = char_list; victim != NULL; victim = victim->next ) - { - if ( victim->in_room != NULL - && is_name( argument, victim->name ) ) - { - 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 ) - act( "You didn't find any $T.", ch, NULL, argument, TO_CHAR ); - else - page_to_char(buf_string(buffer),ch); - - free_buf(buffer); - - return; -} - - - -void do_reboo( CHAR_DATA *ch, char *argument ) -{ - send_to_char( "If you want to REBOOT, spell it out.\n\r", ch ); - return; -} - - - -void do_reboot( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - extern bool merc_down; - DESCRIPTOR_DATA *d,*d_next; - CHAR_DATA *vch; - - if (ch->invis_level < LEVEL_HERO) - { - sprintf( buf, "Reboot by %s.", ch->name ); - do_function(ch, &do_echo, buf ); - } - - merc_down = TRUE; - for ( d = descriptor_list; d != NULL; d = d_next ) - { - d_next = d->next; - vch = d->original ? d->original : d->character; - if (vch != NULL) - save_char_obj(vch); - close_socket(d); - } - - return; -} - -void do_shutdow( CHAR_DATA *ch, char *argument ) -{ - send_to_char( "If you want to SHUTDOWN, spell it out.\n\r", ch ); - return; -} - -void do_shutdown( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - extern bool merc_down; - DESCRIPTOR_DATA *d,*d_next; - CHAR_DATA *vch; - - 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_function(ch, &do_echo, buf ); - } - merc_down = TRUE; - for ( d = descriptor_list; d != NULL; d = d_next) - { - d_next = d->next; - vch = d->original ? d->original : d->character; - if (vch != NULL) - save_char_obj(vch); - close_socket(d); - } - return; -} - -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)) - { - act_new("$N is no longer snoop-proof.",ch,NULL,victim,TO_CHAR,POS_DEAD); - send_to_char("Your snoop-proofing was just removed.\n\r",victim); - REMOVE_BIT(victim->comm,COMM_SNOOP_PROOF); - } - else - { - act_new("$N is now snoop-proof.",ch,NULL,victim,TO_CHAR,POS_DEAD); - send_to_char("You are now immune to snooping.\n\r",victim); - SET_BIT(victim->comm,COMM_SNOOP_PROOF); - } -} - - - -void do_snoop( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - DESCRIPTOR_DATA *d; - CHAR_DATA *victim; - char buf[MAX_STRING_LENGTH]; - - 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 ) - { - send_to_char( "No descriptor to snoop.\n\r", ch ); - 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)); - 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 ) - { - send_to_char( "Busy already.\n\r", 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)) - { - send_to_char("That character is in a private room.\n\r",ch); - return; - } - - if ( get_trust( victim ) >= get_trust( ch ) - || IS_SET(victim->comm,COMM_SNOOP_PROOF)) - { - send_to_char( "You failed.\n\r", 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 ) - { - send_to_char( "No snoop loops.\n\r", ch ); - return; - } - } - } - - victim->desc->snoop_by = 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)); - send_to_char( "Ok.\n\r", ch ); - return; -} - - - -void do_switch( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH], buf[MAX_STRING_LENGTH]; - 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( "Ok.\n\r", ch ); - return; - } - - if (!IS_NPC(victim)) - { - send_to_char("You can only switch into mobiles.\n\r",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)) - { - send_to_char("That character is in a private room.\n\r",ch); - return; - } - - if ( victim->desc != NULL ) - { - send_to_char( "Character in use.\n\r", ch ); - 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; - /* change communications to match */ - if (ch->prompt != NULL) - victim->prompt = str_dup(ch->prompt); - victim->comm = ch->comm; - victim->lines = ch->lines; - send_to_char( "Ok.\n\r", victim ); - return; -} - - - -void do_return( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - - 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. Type replay to see any 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->desc->character = ch->desc->original; - ch->desc->original = NULL; - ch->desc->character->desc = ch->desc; - ch->desc = NULL; - return; -} - -/* 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; -} - -/* 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_object(c_obj->pIndexData,0); - clone_object(c_obj,t_obj); - obj_to_obj(t_obj,clone); - recursive_clone(ch,c_obj,t_obj); - } - } -} - -/* command that is similar to load */ -void do_clone(CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - char *rest; - CHAR_DATA *mob; - OBJ_DATA *obj; - - 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,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,rest); - if (mob == NULL) - { - send_to_char("You don't see that here.\n\r",ch); - return; - } - } - else /* find both */ - { - mob = get_char_room(ch,argument); - obj = get_obj_here(ch,argument); - if (mob == NULL && obj == NULL) - { - send_to_char("You don't see that here.\n\r",ch); - return; - } - } - - /* clone an object */ - if (obj != NULL) - { - OBJ_DATA *clone; - - if (!obj_check(ch,obj)) - { - send_to_char( - "Your powers are not great enough for such a task.\n\r",ch); - return; - } - - 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[MAX_STRING_LENGTH]; - - if (!IS_NPC(mob)) - { - send_to_char("You can only clone mobiles.\n\r",ch); - return; - } - - 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)) - { - send_to_char( - "Your powers are not great enough for such a task.\n\r",ch); - return; - } - - clone = create_mobile(mob->pIndexData); - clone_mobile(mob,clone); - - for (obj = mob->carrying; obj != NULL; obj = obj->next_content) - { - if (obj_check(ch,obj)) - { - 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)); - return; - } -} - -/* RT to replace the two load commands */ - -void do_load(CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - - argument = one_argument(argument,arg); - - if (arg[0] == '\0') - { - send_to_char("Syntax:\n\r",ch); - send_to_char(" load mob \n\r",ch); - send_to_char(" load obj \n\r",ch); - return; - } - - if (!str_cmp(arg,"mob") || !str_cmp(arg,"char")) - { - do_function(ch, &do_mload, argument); - return; - } - - if (!str_cmp(arg,"obj")) - { - do_function(ch, &do_oload, argument); - return; - } - /* echo syntax */ - do_function(ch, &do_load, ""); -} - - -void do_mload( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - MOB_INDEX_DATA *pMobIndex; - CHAR_DATA *victim; - char buf[MAX_STRING_LENGTH]; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' || !is_number(arg) ) - { - send_to_char( "Syntax: load mob .\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 ); - sprintf(buf,"$N loads %s.",victim->short_descr); - wiznet(buf,ch,NULL,WIZ_LOAD,WIZ_SECURE,get_trust(ch)); - send_to_char( "Ok.\n\r", ch ); - return; -} - - - -void do_oload( CHAR_DATA *ch, char *argument ) -{ - char arg1[MAX_INPUT_LENGTH] ,arg2[MAX_INPUT_LENGTH]; - OBJ_INDEX_DATA *pObjIndex; - OBJ_DATA *obj; - int level; - - argument = one_argument( argument, arg1 ); - one_argument( argument, arg2 ); - - if ( arg1[0] == '\0' || !is_number(arg1)) - { - send_to_char( "Syntax: load obj .\n\r", ch ); - return; - } - - level = get_trust(ch); /* default */ - - if ( arg2[0] != '\0') /* load with a level */ - { - if (!is_number(arg2)) - { - send_to_char( "Syntax: oload .\n\r", ch ); - return; - } - level = atoi(arg2); - if (level < 0 || level > get_trust(ch)) - { - send_to_char( "Level must be be between 0 and your level.\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 ); - wiznet("$N loads $p.",ch,obj,WIZ_LOAD,WIZ_SECURE,get_trust(ch)); - send_to_char( "Ok.\n\r", ch ); - return; -} - - - -void do_purge( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - char buf[100]; - CHAR_DATA *victim; - OBJ_DATA *obj; - DESCRIPTOR_DATA *d; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - /* 'purge' */ - 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 /* 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); - send_to_char( "Ok.\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) ) - { - - 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); - sprintf(buf,"%s tried to purge you!\n\r",ch->name); - send_to_char(buf,victim); - return; - } - - act("$n disintegrates $N.",ch,0,victim,TO_NOTVICT); - - if (victim->level > 1) - save_char_obj( victim ); - d = victim->desc; - extract_char( victim, TRUE ); - if ( d != NULL ) - close_socket( d ); - - return; - } - - act( "$n purges $N.", ch, NULL, victim, TO_NOTVICT ); - extract_char( victim, TRUE ); - return; -} - - - -void do_advance( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg1[MAX_INPUT_LENGTH]; - char arg2[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - int level; - int iLevel; - - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - - if ( arg1[0] == '\0' || arg2[0] == '\0' || !is_number( arg2 ) ) - { - send_to_char( "Syntax: advance .\n\r", ch ); - return; - } - - if ( ( victim = get_char_world( ch, arg1 ) ) == NULL ) - { - send_to_char( "That player is not here.\n\r", ch); - return; - } - - if ( IS_NPC(victim) ) - { - send_to_char( "Not on NPC's.\n\r", ch ); - return; - } - - if ( ( level = atoi( arg2 ) ) < 1 || level > MAX_LEVEL ) - { - sprintf(buf,"Level must be 1 to %d.\n\r", MAX_LEVEL); - send_to_char(buf, ch); - return; - } - - if ( level > get_trust( ch ) ) - { - send_to_char( "Limited to your trust level.\n\r", ch ); - return; - } - - /* - * Lower level: - * Reset to level 1. - * Then raise again. - * Currently, an imp can lower another imp. - * -- Swiftest - */ - if ( level <= victim->level ) - { - int temp_prac; - - send_to_char( "Lowering a player's level!\n\r", ch ); - send_to_char( "**** OOOOHHHHHHHHHH NNNNOOOO ****\n\r", victim ); - temp_prac = victim->practice; - victim->level = 1; - victim->exp = exp_per_level(victim,victim->pcdata->points); - victim->max_hit = 10; - victim->max_mana = 100; - victim->max_move = 100; - victim->practice = 0; - victim->hit = victim->max_hit; - victim->mana = victim->max_mana; - victim->move = victim->max_move; - advance_level( victim, TRUE ); - victim->practice = temp_prac; - } - else - { - send_to_char( "Raising a player's level!\n\r", ch ); - send_to_char( "**** OOOOHHHHHHHHHH YYYYEEEESSS ****\n\r", victim ); - } - - for ( iLevel = victim->level ; iLevel < level; iLevel++ ) - { - victim->level += 1; - advance_level( victim,TRUE); - } - sprintf(buf,"You are now level %d.\n\r",victim->level); - send_to_char(buf,victim); - victim->exp = exp_per_level(victim,victim->pcdata->points) - * UMAX( 1, victim->level ); - victim->trust = 0; - save_char_obj(victim); - return; -} - - - -void do_trust( CHAR_DATA *ch, char *argument ) -{ - char arg1[MAX_INPUT_LENGTH]; - char arg2[MAX_INPUT_LENGTH]; - char buf[MAX_STRING_LENGTH]; - CHAR_DATA *victim; - int level; - - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - - if ( arg1[0] == '\0' || arg2[0] == '\0' || !is_number( arg2 ) ) - { - send_to_char( "Syntax: trust .\n\r", ch ); - return; - } - - if ( ( victim = get_char_world( ch, arg1 ) ) == NULL ) - { - send_to_char( "That player is not here.\n\r", ch); - return; - } - - if ( ( level = atoi( arg2 ) ) < 0 || level > MAX_LEVEL ) - { - sprintf(buf, "Level must be 0 (reset) or 1 to %d.\n\r",MAX_LEVEL); - send_to_char(buf, ch); - return; - } - - if ( level > get_trust( ch ) ) - { - send_to_char( "Limited to your trust.\n\r", ch ); - return; - } - - victim->trust = level; - return; -} - - - -void do_restore( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH], buf[MAX_STRING_LENGTH]; - CHAR_DATA *victim; - CHAR_DATA *vch; - DESCRIPTOR_DATA *d; - - one_argument( argument, arg ); - if (arg[0] == '\0' || !str_cmp(arg,"room")) - { - /* cure room */ - - for (vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room) - { - affect_strip(vch,gsn_plague); - affect_strip(vch,gsn_poison); - affect_strip(vch,gsn_blindness); - affect_strip(vch,gsn_sleep); - affect_strip(vch,gsn_curse); - - vch->hit = vch->max_hit; - vch->mana = vch->max_mana; - vch->move = vch->max_move; - update_pos( vch); - act("$n has restored you.",ch,NULL,vch,TO_VICT); - } - - sprintf(buf,"$N restored room %d.",ch->in_room->vnum); - wiznet(buf,ch,NULL,WIZ_RESTORE,WIZ_SECURE,get_trust(ch)); - - send_to_char("Room restored.\n\r",ch); - return; - - } - - if ( get_trust(ch) >= MAX_LEVEL - 1 && !str_cmp(arg,"all")) - { - /* cure all */ - - for (d = descriptor_list; d != NULL; d = d->next) - { - victim = d->character; - - if (victim == NULL || IS_NPC(victim)) - continue; - - affect_strip(victim,gsn_plague); - affect_strip(victim,gsn_poison); - affect_strip(victim,gsn_blindness); - affect_strip(victim,gsn_sleep); - affect_strip(victim,gsn_curse); - - victim->hit = victim->max_hit; - victim->mana = victim->max_mana; - victim->move = victim->max_move; - update_pos( victim); - if (victim->in_room != NULL) - act("$n has restored you.",ch,NULL,victim,TO_VICT); - } - send_to_char("All active players restored.\n\r",ch); - return; - } - - if ( ( victim = get_char_world( ch, arg ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - - affect_strip(victim,gsn_plague); - affect_strip(victim,gsn_poison); - affect_strip(victim,gsn_blindness); - affect_strip(victim,gsn_sleep); - affect_strip(victim,gsn_curse); - victim->hit = victim->max_hit; - victim->mana = victim->max_mana; - victim->move = victim->max_move; - update_pos( victim ); - act( "$n has restored you.", ch, NULL, victim, TO_VICT ); - sprintf(buf,"$N restored %s", - IS_NPC(victim) ? victim->short_descr : victim->name); - wiznet(buf,ch,NULL,WIZ_RESTORE,WIZ_SECURE,get_trust(ch)); - send_to_char( "Ok.\n\r", ch ); - return; -} - - -void do_freeze( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH],buf[MAX_STRING_LENGTH]; - CHAR_DATA *victim; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Freeze 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; - } - - if ( IS_SET(victim->act, PLR_FREEZE) ) - { - REMOVE_BIT(victim->act, PLR_FREEZE); - send_to_char( "You can play again.\n\r", victim ); - send_to_char( "FREEZE removed.\n\r", ch ); - sprintf(buf,"$N thaws %s.",victim->name); - wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); - } - else - { - SET_BIT(victim->act, PLR_FREEZE); - send_to_char( "You can't do ANYthing!\n\r", victim ); - send_to_char( "FREEZE set.\n\r", ch ); - sprintf(buf,"$N puts %s in the deep freeze.",victim->name); - wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); - } - - save_char_obj( victim ); - - return; -} - - - -void do_log( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Log whom?\n\r", ch ); - return; - } - - if ( !str_cmp( arg, "all" ) ) - { - if ( fLogAll ) - { - fLogAll = FALSE; - send_to_char( "Log ALL off.\n\r", ch ); - } - else - { - fLogAll = TRUE; - send_to_char( "Log ALL on.\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; - } - - /* - * No level check, gods can log anyone. - */ - if ( IS_SET(victim->act, PLR_LOG) ) - { - REMOVE_BIT(victim->act, PLR_LOG); - send_to_char( "LOG removed.\n\r", ch ); - } - else - { - SET_BIT(victim->act, PLR_LOG); - send_to_char( "LOG set.\n\r", ch ); - } - - return; -} - - - -void do_noemote( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH],buf[MAX_STRING_LENGTH]; - CHAR_DATA *victim; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Noemote 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 ( get_trust( victim ) >= get_trust( ch ) ) - { - send_to_char( "You failed.\n\r", ch ); - return; - } - - if ( IS_SET(victim->comm, COMM_NOEMOTE) ) - { - REMOVE_BIT(victim->comm, COMM_NOEMOTE); - send_to_char( "You can emote again.\n\r", victim ); - send_to_char( "NOEMOTE removed.\n\r", ch ); - sprintf(buf,"$N restores emotes to %s.",victim->name); - wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); - } - else - { - SET_BIT(victim->comm, COMM_NOEMOTE); - send_to_char( "You can't emote!\n\r", victim ); - send_to_char( "NOEMOTE set.\n\r", ch ); - sprintf(buf,"$N revokes %s's emotes.",victim->name); - wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); - } - - return; -} - - - -void do_noshout( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH],buf[MAX_STRING_LENGTH]; - CHAR_DATA *victim; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Noshout 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; - } - - if ( IS_SET(victim->comm, COMM_NOSHOUT) ) - { - REMOVE_BIT(victim->comm, COMM_NOSHOUT); - send_to_char( "You can shout again.\n\r", victim ); - send_to_char( "NOSHOUT removed.\n\r", ch ); - sprintf(buf,"$N restores shouts to %s.",victim->name); - wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); - } - else - { - SET_BIT(victim->comm, COMM_NOSHOUT); - send_to_char( "You can't shout!\n\r", victim ); - send_to_char( "NOSHOUT set.\n\r", ch ); - sprintf(buf,"$N revokes %s's shouts.",victim->name); - wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); - } - - return; -} - - - -void do_notell( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH],buf[MAX_STRING_LENGTH]; - CHAR_DATA *victim; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Notell 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_NOTELL) ) - { - REMOVE_BIT(victim->comm, COMM_NOTELL); - send_to_char( "You can tell again.\n\r", victim ); - send_to_char( "NOTELL removed.\n\r", ch ); - sprintf(buf,"$N restores tells to %s.",victim->name); - wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); - } - else - { - SET_BIT(victim->comm, COMM_NOTELL); - send_to_char( "You can't tell!\n\r", victim ); - send_to_char( "NOTELL set.\n\r", ch ); - sprintf(buf,"$N revokes %s's tells.",victim->name); - wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); - } - - return; -} - - - -void do_peace( CHAR_DATA *ch, char *argument ) -{ - CHAR_DATA *rch; - - for ( rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room ) - { - if ( rch->fighting != NULL ) - stop_fighting( rch, TRUE ); - if (IS_NPC(rch) && IS_SET(rch->act,ACT_AGGRESSIVE)) - REMOVE_BIT(rch->act,ACT_AGGRESSIVE); - } - - send_to_char( "Ok.\n\r", ch ); - return; -} - -void do_wizlock( CHAR_DATA *ch, char *argument ) -{ - extern bool wizlock; - wizlock = !wizlock; - - if ( wizlock ) - { - wiznet("$N has wizlocked the game.",ch,NULL,0,0,0); - send_to_char( "Game wizlocked.\n\r", ch ); - } - else - { - wiznet("$N removes wizlock.",ch,NULL,0,0,0); - send_to_char( "Game un-wizlocked.\n\r", ch ); - } - - return; -} - -/* RT anti-newbie code */ - -void do_newlock( CHAR_DATA *ch, char *argument ) -{ - extern bool newlock; - newlock = !newlock; - - if ( newlock ) - { - wiznet("$N locks out new characters.",ch,NULL,0,0,0); - send_to_char( "New characters have been locked out.\n\r", ch ); - } - else - { - wiznet("$N allows new characters back in.",ch,NULL,0,0,0); - send_to_char( "Newlock removed.\n\r", ch ); - } - - return; -} - - -void do_slookup( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - int sn; - - one_argument( argument, arg ); - if ( arg[0] == '\0' ) - { - send_to_char( "Lookup which skill or spell?\n\r", ch ); - return; - } - - if ( !str_cmp( arg, "all" ) ) - { - for ( sn = 0; sn < MAX_SKILL; sn++ ) - { - if ( skill_table[sn].name == NULL ) - break; - sprintf( buf, "Sn: %3d Slot: %3d Skill/spell: '%s'\n\r", - sn, skill_table[sn].slot, skill_table[sn].name ); - send_to_char( buf, ch ); - } - } - else - { - if ( ( sn = skill_lookup( arg ) ) < 0 ) - { - send_to_char( "No such skill or spell.\n\r", ch ); - return; - } - - sprintf( buf, "Sn: %3d Slot: %3d Skill/spell: '%s'\n\r", - sn, skill_table[sn].slot, skill_table[sn].name ); - send_to_char( buf, ch ); - } - - return; -} - -/* RT set replaces sset, mset, oset, and rset */ - -void do_set( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - - argument = one_argument(argument,arg); - - if (arg[0] == '\0') - { - send_to_char("Syntax:\n\r",ch); - send_to_char(" set mob \n\r",ch); - send_to_char(" set obj \n\r",ch); - send_to_char(" set room \n\r",ch); - send_to_char(" set skill \n\r",ch); - return; - } - - if (!str_prefix(arg,"mobile") || !str_prefix(arg,"character")) - { - do_function(ch, &do_mset, argument); - return; - } - - if (!str_prefix(arg,"skill") || !str_prefix(arg,"spell")) - { - do_function(ch, &do_sset, argument); - return; - } - - if (!str_prefix(arg,"object")) - { - do_function(ch, &do_oset, argument); - return; - } - - if (!str_prefix(arg,"room")) - { - do_function(ch, &do_rset, argument); - return; - } - /* echo syntax */ - do_function(ch, &do_set, ""); -} - - -void do_sset( CHAR_DATA *ch, char *argument ) -{ - char arg1 [MAX_INPUT_LENGTH]; - char arg2 [MAX_INPUT_LENGTH]; - char arg3 [MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - int value; - int sn; - bool fAll; - - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - argument = one_argument( argument, arg3 ); - - if ( arg1[0] == '\0' || arg2[0] == '\0' || arg3[0] == '\0' ) - { - send_to_char( "Syntax:\n\r",ch); - send_to_char( " set skill \n\r", ch); - send_to_char( " set skill all \n\r",ch); - send_to_char(" (use the name of the skill, not the number)\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; - } - - fAll = !str_cmp( arg2, "all" ); - sn = 0; - if ( !fAll && ( sn = skill_lookup( arg2 ) ) < 0 ) - { - send_to_char( "No such skill or spell.\n\r", ch ); - return; - } - - /* - * Snarf the value. - */ - if ( !is_number( arg3 ) ) - { - send_to_char( "Value must be numeric.\n\r", ch ); - return; - } - - value = atoi( arg3 ); - if ( value < 0 || value > 100 ) - { - send_to_char( "Value range is 0 to 100.\n\r", ch ); - return; - } - - if ( fAll ) - { - for ( sn = 0; sn < MAX_SKILL; sn++ ) - { - if ( skill_table[sn].name != NULL ) - victim->pcdata->learned[sn] = value; - } - } - else - { - victim->pcdata->learned[sn] = value; - } - - return; -} - - -void do_mset( CHAR_DATA *ch, char *argument ) -{ - char arg1 [MAX_INPUT_LENGTH]; - char arg2 [MAX_INPUT_LENGTH]; - char arg3 [MAX_INPUT_LENGTH]; - char buf[100]; - CHAR_DATA *victim; - int value; - - smash_tilde( argument ); - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - strcpy( arg3, argument ); - - if ( arg1[0] == '\0' || arg2[0] == '\0' || arg3[0] == '\0' ) - { - send_to_char("Syntax:\n\r",ch); - send_to_char(" set char \n\r",ch); - send_to_char( " Field being one of:\n\r", ch ); - send_to_char( " str int wis dex con sex class level\n\r", ch ); - send_to_char( " race group gold silver hp mana move prac\n\r",ch); - send_to_char( " align train thirst hunger drunk full\n\r", ch ); - return; - } - - if ( ( victim = get_char_world( ch, arg1 ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - - /* clear zones for mobs */ - victim->zone = NULL; - - /* - * Snarf the value (which need not be numeric). - */ - value = is_number( arg3 ) ? atoi( arg3 ) : -1; - - /* - * Set something. - */ - if ( !str_cmp( arg2, "str" ) ) - { - if ( value < 3 || value > get_max_train(victim,STAT_STR) ) - { - sprintf(buf, - "Strength range is 3 to %d\n\r.", - get_max_train(victim,STAT_STR)); - send_to_char(buf,ch); - return; - } - - victim->perm_stat[STAT_STR] = value; - return; - } - - if ( !str_cmp( arg2, "int" ) ) - { - if ( value < 3 || value > get_max_train(victim,STAT_INT) ) - { - sprintf(buf, - "Intelligence range is 3 to %d.\n\r", - get_max_train(victim,STAT_INT)); - send_to_char(buf,ch); - return; - } - - victim->perm_stat[STAT_INT] = value; - return; - } - - if ( !str_cmp( arg2, "wis" ) ) - { - if ( value < 3 || value > get_max_train(victim,STAT_WIS) ) - { - sprintf(buf, - "Wisdom range is 3 to %d.\n\r",get_max_train(victim,STAT_WIS)); - send_to_char( buf, ch ); - return; - } - - victim->perm_stat[STAT_WIS] = value; - return; - } - - if ( !str_cmp( arg2, "dex" ) ) - { - if ( value < 3 || value > get_max_train(victim,STAT_DEX) ) - { - sprintf(buf, - "Dexterity range is 3 to %d.\n\r", - get_max_train(victim,STAT_DEX)); - send_to_char( buf, ch ); - return; - } - - victim->perm_stat[STAT_DEX] = value; - return; - } - - if ( !str_cmp( arg2, "con" ) ) - { - if ( value < 3 || value > get_max_train(victim,STAT_CON) ) - { - sprintf(buf, - "Constitution range is 3 to %d.\n\r", - get_max_train(victim,STAT_CON)); - send_to_char( buf, ch ); - return; - } - - victim->perm_stat[STAT_CON] = value; - return; - } - - if ( !str_prefix( arg2, "sex" ) ) - { - if ( value < 0 || value > 2 ) - { - send_to_char( "Sex range is 0 to 2.\n\r", ch ); - return; - } - victim->sex = value; - if (!IS_NPC(victim)) - victim->pcdata->true_sex = value; - return; - } - - if ( !str_prefix( arg2, "class" ) ) - { - int class; - - if (IS_NPC(victim)) - { - send_to_char("Mobiles have no class.\n\r",ch); - return; - } - - class = class_lookup(arg3); - if ( class == -1 ) - { - char buf[MAX_STRING_LENGTH]; - - strcpy( buf, "Possible classes are: " ); - for ( class = 0; class < MAX_CLASS; class++ ) - { - if ( class > 0 ) - strcat( buf, " " ); - strcat( buf, class_table[class].name ); - } - strcat( buf, ".\n\r" ); - - send_to_char(buf,ch); - return; - } - - victim->class = class; - return; - } - - if ( !str_prefix( arg2, "level" ) ) - { - if ( !IS_NPC(victim) ) - { - send_to_char( "Not on PC's.\n\r", ch ); - return; - } - - if ( value < 0 || value > MAX_LEVEL ) - { - sprintf(buf, "Level range is 0 to %d.\n\r", MAX_LEVEL); - send_to_char(buf, ch); - return; - } - victim->level = value; - return; - } - - if ( !str_prefix( arg2, "gold" ) ) - { - victim->gold = value; - return; - } - - if ( !str_prefix(arg2, "silver" ) ) - { - victim->silver = value; - return; - } - - if ( !str_prefix( arg2, "hp" ) ) - { - if ( value < -10 || value > 30000 ) - { - send_to_char( "Hp range is -10 to 30,000 hit points.\n\r", ch ); - return; - } - victim->max_hit = value; - if (!IS_NPC(victim)) - victim->pcdata->perm_hit = value; - return; - } - - if ( !str_prefix( arg2, "mana" ) ) - { - if ( value < 0 || value > 30000 ) - { - send_to_char( "Mana range is 0 to 30,000 mana points.\n\r", ch ); - return; - } - victim->max_mana = value; - if (!IS_NPC(victim)) - victim->pcdata->perm_mana = value; - return; - } - - if ( !str_prefix( arg2, "move" ) ) - { - if ( value < 0 || value > 30000 ) - { - send_to_char( "Move range is 0 to 30,000 move points.\n\r", ch ); - return; - } - victim->max_move = value; - if (!IS_NPC(victim)) - victim->pcdata->perm_move = value; - return; - } - - if ( !str_prefix( arg2, "practice" ) ) - { - if ( value < 0 || value > 250 ) - { - send_to_char( "Practice range is 0 to 250 sessions.\n\r", ch ); - return; - } - victim->practice = value; - return; - } - - if ( !str_prefix( arg2, "train" )) - { - if (value < 0 || value > 50 ) - { - send_to_char("Training session range is 0 to 50 sessions.\n\r",ch); - return; - } - victim->train = value; - return; - } - - if ( !str_prefix( arg2, "align" ) ) - { - if ( value < -1000 || value > 1000 ) - { - send_to_char( "Alignment range is -1000 to 1000.\n\r", ch ); - return; - } - victim->alignment = value; - return; - } - - if ( !str_prefix( arg2, "thirst" ) ) - { - if ( IS_NPC(victim) ) - { - send_to_char( "Not on NPC's.\n\r", ch ); - return; - } - - if ( value < -1 || value > 100 ) - { - send_to_char( "Thirst range is -1 to 100.\n\r", ch ); - return; - } - - victim->pcdata->condition[COND_THIRST] = value; - return; - } - - if ( !str_prefix( arg2, "drunk" ) ) - { - if ( IS_NPC(victim) ) - { - send_to_char( "Not on NPC's.\n\r", ch ); - return; - } - - if ( value < -1 || value > 100 ) - { - send_to_char( "Drunk range is -1 to 100.\n\r", ch ); - return; - } - - victim->pcdata->condition[COND_DRUNK] = value; - return; - } - - if ( !str_prefix( arg2, "full" ) ) - { - if ( IS_NPC(victim) ) - { - send_to_char( "Not on NPC's.\n\r", ch ); - return; - } - - if ( value < -1 || value > 100 ) - { - send_to_char( "Full range is -1 to 100.\n\r", ch ); - return; - } - - victim->pcdata->condition[COND_FULL] = value; - return; - } - - if ( !str_prefix( arg2, "hunger" ) ) - { - if ( IS_NPC(victim) ) - { - send_to_char( "Not on NPC's.\n\r", ch ); - return; - } - - if ( value < -1 || value > 100 ) - { - send_to_char( "Full range is -1 to 100.\n\r", ch ); - return; - } - - victim->pcdata->condition[COND_HUNGER] = value; - return; - } - - if (!str_prefix( arg2, "race" ) ) - { - int race; - - race = race_lookup(arg3); - - if ( race == 0) - { - send_to_char("That is not a valid race.\n\r",ch); - return; - } - - if (!IS_NPC(victim) && !race_table[race].pc_race) - { - send_to_char("That is not a valid player race.\n\r",ch); - return; - } - - victim->race = race; - return; - } - - if (!str_prefix(arg2,"group")) - { - if (!IS_NPC(victim)) - { - send_to_char("Only on NPCs.\n\r",ch); - return; - } - victim->group = value; - return; - } - - - /* - * Generate usage message. - */ - do_function(ch, &do_mset, "" ); - return; -} - -void do_string( CHAR_DATA *ch, char *argument ) -{ - char type [MAX_INPUT_LENGTH]; - char arg1 [MAX_INPUT_LENGTH]; - char arg2 [MAX_INPUT_LENGTH]; - char arg3 [MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - OBJ_DATA *obj; - - smash_tilde( argument ); - argument = one_argument( argument, type ); - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - strcpy( arg3, argument ); - - if ( type[0] == '\0' || arg1[0] == '\0' || arg2[0] == '\0' || arg3[0] == '\0' ) - { - send_to_char("Syntax:\n\r",ch); - send_to_char(" string char \n\r",ch); - send_to_char(" fields: name short long desc title spec\n\r",ch); - send_to_char(" string obj \n\r",ch); - send_to_char(" fields: name short long extended\n\r",ch); - return; - } - - if (!str_prefix(type,"character") || !str_prefix(type,"mobile")) - { - if ( ( victim = get_char_world( ch, arg1 ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - - /* clear zone for mobs */ - victim->zone = NULL; - - /* string something */ - - if ( !str_prefix( arg2, "name" ) ) - { - if ( !IS_NPC(victim) ) - { - send_to_char( "Not on PC's.\n\r", ch ); - return; - } - free_string( victim->name ); - victim->name = str_dup( arg3 ); - return; - } - - if ( !str_prefix( arg2, "description" ) ) - { - free_string(victim->description); - victim->description = str_dup(arg3); - return; - } - - if ( !str_prefix( arg2, "short" ) ) - { - free_string( victim->short_descr ); - victim->short_descr = str_dup( arg3 ); - return; - } - - if ( !str_prefix( arg2, "long" ) ) - { - free_string( victim->long_descr ); - strcat(arg3,"\n\r"); - victim->long_descr = str_dup( arg3 ); - return; - } - - if ( !str_prefix( arg2, "title" ) ) - { - if ( IS_NPC(victim) ) - { - send_to_char( "Not on NPC's.\n\r", ch ); - return; - } - - set_title( victim, arg3 ); - return; - } - - if ( !str_prefix( arg2, "spec" ) ) - { - if ( !IS_NPC(victim) ) - { - send_to_char( "Not on PC's.\n\r", ch ); - return; - } - - if ( ( victim->spec_fun = spec_lookup( arg3 ) ) == 0 ) - { - send_to_char( "No such spec fun.\n\r", ch ); - return; - } - - return; - } - } - - if (!str_prefix(type,"object")) - { - /* string an obj */ - - if ( ( obj = get_obj_world( ch, arg1 ) ) == NULL ) - { - send_to_char( "Nothing like that in heaven or earth.\n\r", ch ); - return; - } - - if ( !str_prefix( arg2, "name" ) ) - { - free_string( obj->name ); - obj->name = str_dup( arg3 ); - return; - } - - if ( !str_prefix( arg2, "short" ) ) - { - free_string( obj->short_descr ); - obj->short_descr = str_dup( arg3 ); - return; - } - - if ( !str_prefix( arg2, "long" ) ) - { - free_string( obj->description ); - obj->description = str_dup( arg3 ); - return; - } - - if ( !str_prefix( arg2, "ed" ) || !str_prefix( arg2, "extended")) - { - EXTRA_DESCR_DATA *ed; - - argument = one_argument( argument, arg3 ); - if ( argument == NULL ) - { - send_to_char( "Syntax: oset ed \n\r", - ch ); - return; - } - - strcat(argument,"\n\r"); - - ed = new_extra_descr(); - - ed->keyword = str_dup( arg3 ); - ed->description = str_dup( argument ); - ed->next = obj->extra_descr; - obj->extra_descr = ed; - return; - } - } - - - /* echo bad use message */ - do_function(ch, &do_string, ""); -} - - - -void do_oset( CHAR_DATA *ch, char *argument ) -{ - char arg1 [MAX_INPUT_LENGTH]; - char arg2 [MAX_INPUT_LENGTH]; - char arg3 [MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - int value; - - smash_tilde( argument ); - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - strcpy( arg3, argument ); - - if ( arg1[0] == '\0' || arg2[0] == '\0' || arg3[0] == '\0' ) - { - send_to_char("Syntax:\n\r",ch); - send_to_char(" set obj \n\r",ch); - send_to_char(" Field being one of:\n\r", ch ); - send_to_char(" value0 value1 value2 value3 value4 (v1-v4)\n\r", ch ); - send_to_char(" extra wear level weight cost timer\n\r", ch ); - return; - } - - if ( ( obj = get_obj_world( ch, arg1 ) ) == NULL ) - { - send_to_char( "Nothing like that in heaven or earth.\n\r", ch ); - return; - } - - /* - * Snarf the value (which need not be numeric). - */ - value = atoi( arg3 ); - - /* - * Set something. - */ - if ( !str_cmp( arg2, "value0" ) || !str_cmp( arg2, "v0" ) ) - { - obj->value[0] = UMIN(50,value); - return; - } - - if ( !str_cmp( arg2, "value1" ) || !str_cmp( arg2, "v1" ) ) - { - obj->value[1] = value; - return; - } - - if ( !str_cmp( arg2, "value2" ) || !str_cmp( arg2, "v2" ) ) - { - obj->value[2] = value; - return; - } - - if ( !str_cmp( arg2, "value3" ) || !str_cmp( arg2, "v3" ) ) - { - obj->value[3] = value; - return; - } - - if ( !str_cmp( arg2, "value4" ) || !str_cmp( arg2, "v4" ) ) - { - obj->value[4] = value; - return; - } - - if ( !str_prefix( arg2, "extra" ) ) - { - obj->extra_flags = value; - return; - } - - if ( !str_prefix( arg2, "wear" ) ) - { - obj->wear_flags = value; - return; - } - - if ( !str_prefix( arg2, "level" ) ) - { - obj->level = value; - return; - } - - if ( !str_prefix( arg2, "weight" ) ) - { - obj->weight = value; - return; - } - - if ( !str_prefix( arg2, "cost" ) ) - { - obj->cost = value; - return; - } - - if ( !str_prefix( arg2, "timer" ) ) - { - obj->timer = value; - return; - } - - /* - * Generate usage message. - */ - do_function(ch, &do_oset, "" ); - return; -} - - - -void do_rset( CHAR_DATA *ch, char *argument ) -{ - char arg1 [MAX_INPUT_LENGTH]; - char arg2 [MAX_INPUT_LENGTH]; - char arg3 [MAX_INPUT_LENGTH]; - ROOM_INDEX_DATA *location; - int value; - - smash_tilde( argument ); - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - strcpy( arg3, argument ); - - if ( arg1[0] == '\0' || arg2[0] == '\0' || arg3[0] == '\0' ) - { - send_to_char( "Syntax:\n\r",ch); - send_to_char( " set room \n\r",ch); - send_to_char( " Field being one of:\n\r", ch ); - send_to_char( " flags sector\n\r", ch ); - return; - } - - if ( ( location = find_location( ch, arg1 ) ) == NULL ) - { - send_to_char( "No such location.\n\r", ch ); - return; - } - - if (!is_room_owner(ch,location) && 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; - } - - /* - * Snarf the value. - */ - if ( !is_number( arg3 ) ) - { - send_to_char( "Value must be numeric.\n\r", ch ); - return; - } - value = atoi( arg3 ); - - /* - * Set something. - */ - if ( !str_prefix( arg2, "flags" ) ) - { - location->room_flags = value; - return; - } - - if ( !str_prefix( arg2, "sector" ) ) - { - location->sector_type = value; - return; - } - - /* - * Generate usage message. - */ - do_function(ch, &do_rset, ""); - return; -} - - - -void do_sockets( CHAR_DATA *ch, char *argument ) -{ - char buf[2 * MAX_STRING_LENGTH]; - char buf2[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - DESCRIPTOR_DATA *d; - int count; - - count = 0; - buf[0] = '\0'; - - one_argument(argument,arg); - for ( d = descriptor_list; d != NULL; d = d->next ) - { - if ( d->character != NULL && can_see( ch, d->character ) - && (arg[0] == '\0' || is_name(arg,d->character->name) - || (d->original && is_name(arg,d->original->name)))) - { - count++; - sprintf( buf + strlen(buf), "[%3d %2d] %s@%s\n\r", - d->descriptor, - d->connected, - d->original ? d->original->name : - d->character ? d->character->name : "(none)", - d->host - ); - } - } - if (count == 0) - { - send_to_char("No one by that name is connected.\n\r",ch); - return; - } - - sprintf( buf2, "%d user%s\n\r", count, count == 1 ? "" : "s" ); - strcat(buf,buf2); - page_to_char( buf, ch ); - return; -} - - - -/* - * Thanks to Grodyn for pointing out bugs in this function. - */ -void do_force( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - char arg2[MAX_INPUT_LENGTH]; - - argument = one_argument( argument, arg ); - - if ( arg[0] == '\0' || argument[0] == '\0' ) - { - send_to_char( "Force whom to do what?\n\r", ch ); - return; - } - - one_argument(argument,arg2); - - if (!str_cmp(arg2,"delete")) - { - send_to_char("That will NOT be done.\n\r",ch); - return; - } - - sprintf( buf, "$n forces you to '%s'.", argument ); - - if ( !str_cmp( arg, "all" ) ) - { - CHAR_DATA *vch; - CHAR_DATA *vch_next; - - if (get_trust(ch) < MAX_LEVEL - 3) - { - send_to_char("Not at your level!\n\r",ch); - return; - } - - for ( vch = char_list; vch != NULL; vch = vch_next ) - { - vch_next = vch->next; - - if ( !IS_NPC(vch) && get_trust( vch ) < get_trust( ch ) ) - { - act( buf, ch, NULL, vch, TO_VICT ); - interpret( vch, argument ); - } - } - } - else if (!str_cmp(arg,"players")) - { - CHAR_DATA *vch; - CHAR_DATA *vch_next; - - if (get_trust(ch) < MAX_LEVEL - 2) - { - send_to_char("Not at your level!\n\r",ch); - return; - } - - for ( vch = char_list; vch != NULL; vch = vch_next ) - { - vch_next = vch->next; - - if ( !IS_NPC(vch) && get_trust( vch ) < get_trust( ch ) - && vch->level < LEVEL_HERO) - { - act( buf, ch, NULL, vch, TO_VICT ); - interpret( vch, argument ); - } - } - } - else if (!str_cmp(arg,"gods")) - { - CHAR_DATA *vch; - CHAR_DATA *vch_next; - - if (get_trust(ch) < MAX_LEVEL - 2) - { - send_to_char("Not at your level!\n\r",ch); - return; - } - - for ( vch = char_list; vch != NULL; vch = vch_next ) - { - vch_next = vch->next; - - if ( !IS_NPC(vch) && get_trust( vch ) < get_trust( ch ) - && vch->level >= LEVEL_HERO) - { - act( buf, ch, NULL, vch, TO_VICT ); - interpret( vch, argument ); - } - } - } - else - { - CHAR_DATA *victim; - - 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( "Aye aye, right away!\n\r", 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)) - { - send_to_char("That character is in a private room.\n\r",ch); - return; - } - - if ( get_trust( victim ) >= get_trust( ch ) ) - { - send_to_char( "Do it yourself!\n\r", ch ); - return; - } - - if ( !IS_NPC(victim) && get_trust(ch) < MAX_LEVEL -3) - { - send_to_char("Not at your level!\n\r",ch); - return; - } - - act( buf, ch, NULL, victim, TO_VICT ); - interpret( victim, argument ); - } - - send_to_char( "Ok.\n\r", ch ); - return; -} - - - -/* - * New routines by Dionysos. - */ -void do_invis( CHAR_DATA *ch, char *argument ) -{ - int level; - char arg[MAX_STRING_LENGTH]; - - /* RT code for taking a level argument */ - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - /* take the default path */ - - if ( ch->invis_level) - { - ch->invis_level = 0; - act( "$n slowly fades into existence.", ch, NULL, NULL, TO_ROOM ); - send_to_char( "You slowly fade back into existence.\n\r", ch ); - } - else - { - ch->invis_level = get_trust(ch); - act( "$n slowly fades into thin air.", ch, NULL, NULL, TO_ROOM ); - send_to_char( "You slowly vanish into thin air.\n\r", ch ); - } - else - /* do the level thing */ - { - level = atoi(arg); - if (level < 2 || level > get_trust(ch)) - { - send_to_char("Invis level must be between 2 and your level.\n\r",ch); - return; - } - else - { - ch->reply = NULL; - ch->invis_level = level; - act( "$n slowly fades into thin air.", ch, NULL, NULL, TO_ROOM ); - send_to_char( "You slowly vanish into thin air.\n\r", ch ); - } - } - - return; -} - - -void do_incognito( CHAR_DATA *ch, char *argument ) -{ - int level; - char arg[MAX_STRING_LENGTH]; - - /* RT code for taking a level argument */ - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - /* take the default path */ - - if ( ch->incog_level) - { - ch->incog_level = 0; - act( "$n is no longer cloaked.", ch, NULL, NULL, TO_ROOM ); - send_to_char( "You are no longer cloaked.\n\r", ch ); - } - else - { - ch->incog_level = get_trust(ch); - act( "$n cloaks $s presence.", ch, NULL, NULL, TO_ROOM ); - send_to_char( "You cloak your presence.\n\r", ch ); - } - else - /* do the level thing */ - { - level = atoi(arg); - if (level < 2 || level > get_trust(ch)) - { - send_to_char("Incog level must be between 2 and your level.\n\r",ch); - return; - } - else - { - ch->reply = NULL; - ch->incog_level = level; - act( "$n cloaks $s presence.", ch, NULL, NULL, TO_ROOM ); - send_to_char( "You cloak your presence.\n\r", ch ); - } - } - - return; -} - - - -void do_holylight( CHAR_DATA *ch, char *argument ) -{ - if ( IS_NPC(ch) ) - return; - - if ( IS_SET(ch->act, PLR_HOLYLIGHT) ) - { - REMOVE_BIT(ch->act, PLR_HOLYLIGHT); - send_to_char( "Holy light mode off.\n\r", ch ); - } - else - { - SET_BIT(ch->act, PLR_HOLYLIGHT); - send_to_char( "Holy light mode on.\n\r", ch ); - } - - return; -} - -/* prefix command: it will put the string typed on each line typed */ - -void do_prefi (CHAR_DATA *ch, char *argument) -{ - send_to_char("You cannot abbreviate the prefix command.\r\n",ch); - return; -} - -void do_prefix (CHAR_DATA *ch, char *argument) -{ - char buf[MAX_INPUT_LENGTH]; - - if (argument[0] == '\0') - { - if (ch->prefix[0] == '\0') - { - send_to_char("You have no prefix to clear.\r\n",ch); - return; - } - - send_to_char("Prefix removed.\r\n",ch); - free_string(ch->prefix); - ch->prefix = str_dup(""); - return; - } - - if (ch->prefix[0] != '\0') - { - sprintf(buf,"Prefix changed to %s.\r\n",argument); - free_string(ch->prefix); - } - else - { - sprintf(buf,"Prefix set to %s.\r\n",argument); - } - - ch->prefix = str_dup(argument); -} diff --git a/Rom24/src/alias.c b/Rom24/src/alias.c deleted file mode 100644 index 8f1fa6f..0000000 --- a/Rom24/src/alias.c +++ /dev/null @@ -1,273 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#endif -#include -#include -#include -#include "merc.h" - -/* does aliasing and other fun stuff */ -void substitute_alias(DESCRIPTOR_DATA *d, char *argument) -{ - CHAR_DATA *ch; - char buf[MAX_STRING_LENGTH],prefix[MAX_INPUT_LENGTH],name[MAX_INPUT_LENGTH]; - char *point; - int alias; - - ch = d->original ? d->original : d->character; - - /* check for prefix */ - if (ch->prefix[0] != '\0' && str_prefix("prefix",argument)) - { - if (strlen(ch->prefix) + strlen(argument) > MAX_INPUT_LENGTH) - send_to_char("Line to long, prefix not processed.\r\n",ch); - else - { - sprintf(prefix,"%s %s",ch->prefix,argument); - argument = prefix; - } - } - - if (IS_NPC(ch) || ch->pcdata->alias[0] == NULL - || !str_prefix("alias",argument) || !str_prefix("una",argument) - || !str_prefix("prefix",argument)) - { - interpret(d->character,argument); - return; - } - - strcpy(buf,argument); - - for (alias = 0; alias < MAX_ALIAS; alias++) /* go through the aliases */ - { - if (ch->pcdata->alias[alias] == NULL) - break; - - if (!str_prefix(ch->pcdata->alias[alias],argument)) - { - point = one_argument(argument,name); - if (!strcmp(ch->pcdata->alias[alias],name)) - { - buf[0] = '\0'; - strcat(buf,ch->pcdata->alias_sub[alias]); - strcat(buf," "); - strcat(buf,point); - - if (strlen(buf) > MAX_INPUT_LENGTH - 1) - { - send_to_char( - "Alias substitution too long. Truncated.\r\n",ch); - buf[MAX_INPUT_LENGTH -1] = '\0'; - } - break; - } - } - } - interpret(d->character,buf); -} - -void do_alia(CHAR_DATA *ch, char *argument) -{ - send_to_char("I'm sorry, alias must be entered in full.\n\r",ch); - return; -} - -void do_alias(CHAR_DATA *ch, char *argument) -{ - CHAR_DATA *rch; - char arg[MAX_INPUT_LENGTH],buf[MAX_STRING_LENGTH]; - int pos; - - smash_tilde(argument); - - if (ch->desc == NULL) - rch = ch; - else - rch = ch->desc->original ? ch->desc->original : ch; - - if (IS_NPC(rch)) - return; - - argument = one_argument(argument,arg); - - - if (arg[0] == '\0') - { - - if (rch->pcdata->alias[0] == NULL) - { - send_to_char("You have no aliases defined.\n\r",ch); - return; - } - send_to_char("Your current aliases are:\n\r",ch); - - for (pos = 0; pos < MAX_ALIAS; pos++) - { - if (rch->pcdata->alias[pos] == NULL - || rch->pcdata->alias_sub[pos] == NULL) - break; - - sprintf(buf," %s: %s\n\r",rch->pcdata->alias[pos], - rch->pcdata->alias_sub[pos]); - send_to_char(buf,ch); - } - return; - } - - if (!str_prefix("una",arg) || !str_cmp("alias",arg)) - { - send_to_char("Sorry, that word is reserved.\n\r",ch); - return; - } - - if (argument[0] == '\0') - { - for (pos = 0; pos < MAX_ALIAS; pos++) - { - if (rch->pcdata->alias[pos] == NULL - || rch->pcdata->alias_sub[pos] == NULL) - break; - - if (!str_cmp(arg,rch->pcdata->alias[pos])) - { - sprintf(buf,"%s aliases to '%s'.\n\r",rch->pcdata->alias[pos], - rch->pcdata->alias_sub[pos]); - send_to_char(buf,ch); - return; - } - } - - send_to_char("That alias is not defined.\n\r",ch); - return; - } - - if (!str_prefix(argument,"delete") || !str_prefix(argument,"prefix")) - { - send_to_char("That shall not be done!\n\r",ch); - return; - } - - for (pos = 0; pos < MAX_ALIAS; pos++) - { - if (rch->pcdata->alias[pos] == NULL) - break; - - if (!str_cmp(arg,rch->pcdata->alias[pos])) /* redefine an alias */ - { - free_string(rch->pcdata->alias_sub[pos]); - rch->pcdata->alias_sub[pos] = str_dup(argument); - sprintf(buf,"%s is now realiased to '%s'.\n\r",arg,argument); - send_to_char(buf,ch); - return; - } - } - - if (pos >= MAX_ALIAS) - { - send_to_char("Sorry, you have reached the alias limit.\n\r",ch); - return; - } - - /* make a new alias */ - rch->pcdata->alias[pos] = str_dup(arg); - rch->pcdata->alias_sub[pos] = str_dup(argument); - sprintf(buf,"%s is now aliased to '%s'.\n\r",arg,argument); - send_to_char(buf,ch); -} - - -void do_unalias(CHAR_DATA *ch, char *argument) -{ - CHAR_DATA *rch; - char arg[MAX_INPUT_LENGTH]; - int pos; - bool found = FALSE; - - if (ch->desc == NULL) - rch = ch; - else - rch = ch->desc->original ? ch->desc->original : ch; - - if (IS_NPC(rch)) - return; - - argument = one_argument(argument,arg); - - if (arg[0] == '\0') - { - send_to_char("Unalias what?\n\r",ch); - return; - } - - for (pos = 0; pos < MAX_ALIAS; pos++) - { - if (rch->pcdata->alias[pos] == NULL) - break; - - if (found) - { - rch->pcdata->alias[pos-1] = rch->pcdata->alias[pos]; - rch->pcdata->alias_sub[pos-1] = rch->pcdata->alias_sub[pos]; - rch->pcdata->alias[pos] = NULL; - rch->pcdata->alias_sub[pos] = NULL; - continue; - } - - if(!strcmp(arg,rch->pcdata->alias[pos])) - { - send_to_char("Alias removed.\n\r",ch); - free_string(rch->pcdata->alias[pos]); - free_string(rch->pcdata->alias_sub[pos]); - rch->pcdata->alias[pos] = NULL; - rch->pcdata->alias_sub[pos] = NULL; - found = TRUE; - } - } - - if (!found) - send_to_char("No alias of that name to remove.\n\r",ch); -} - - - - - - - - - - - - - - - diff --git a/Rom24/src/ban.c b/Rom24/src/ban.c deleted file mode 100644 index 4656d10..0000000 --- a/Rom24/src/ban.c +++ /dev/null @@ -1,309 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#include -#else -#include -#include -#endif -#include -#include -#include -#include -#include "merc.h" -#include "recycle.h" - -BAN_DATA *ban_list; - -void save_bans(void) -{ - BAN_DATA *pban; - FILE *fp; - bool found = FALSE; - - fclose( fpReserve ); - if ( ( fp = fopen( BAN_FILE, "w" ) ) == NULL ) - { - perror( BAN_FILE ); - } - - for (pban = ban_list; pban != NULL; pban = pban->next) - { - if (IS_SET(pban->ban_flags,BAN_PERMANENT)) - { - found = TRUE; - fprintf(fp,"%-20s %-2d %s\n",pban->name,pban->level, - print_flags(pban->ban_flags)); - } - } - - fclose(fp); - fpReserve = fopen( NULL_FILE, "r" ); - if (!found) - unlink(BAN_FILE); -} - -void load_bans(void) -{ - FILE *fp; - BAN_DATA *ban_last; - - if ( ( fp = fopen( BAN_FILE, "r" ) ) == NULL ) - return; - - ban_last = NULL; - for ( ; ; ) - { - BAN_DATA *pban; - if ( feof(fp) ) - { - fclose( fp ); - return; - } - - pban = new_ban(); - - pban->name = str_dup(fread_word(fp)); - pban->level = fread_number(fp); - pban->ban_flags = fread_flag(fp); - fread_to_eol(fp); - - if (ban_list == NULL) - ban_list = pban; - else - ban_last->next = pban; - ban_last = pban; - } -} - -bool check_ban(char *site,int type) -{ - BAN_DATA *pban; - char host[MAX_STRING_LENGTH]; - - strcpy(host,capitalize(site)); - host[0] = LOWER(host[0]); - - for ( pban = ban_list; pban != NULL; pban = pban->next ) - { - if(!IS_SET(pban->ban_flags,type)) - continue; - - if (IS_SET(pban->ban_flags,BAN_PREFIX) - && IS_SET(pban->ban_flags,BAN_SUFFIX) - && strstr(pban->name,host) != NULL) - return TRUE; - - if (IS_SET(pban->ban_flags,BAN_PREFIX) - && !str_suffix(pban->name,host)) - return TRUE; - - if (IS_SET(pban->ban_flags,BAN_SUFFIX) - && !str_prefix(pban->name,host)) - return TRUE; - } - - return FALSE; -} - - -void ban_site(CHAR_DATA *ch, char *argument, bool fPerm) -{ - char buf[MAX_STRING_LENGTH],buf2[MAX_STRING_LENGTH]; - char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH]; - char *name; - BUFFER *buffer; - BAN_DATA *pban, *prev; - bool prefix = FALSE,suffix = FALSE; - int type; - - argument = one_argument(argument,arg1); - argument = one_argument(argument,arg2); - - if ( arg1[0] == '\0' ) - { - if (ban_list == NULL) - { - send_to_char("No sites banned at this time.\n\r",ch); - return; - } - buffer = new_buf(); - - add_buf(buffer,"Banned sites level type status\n\r"); - for (pban = ban_list;pban != NULL;pban = pban->next) - { - sprintf(buf2,"%s%s%s", - IS_SET(pban->ban_flags,BAN_PREFIX) ? "*" : "", - pban->name, - IS_SET(pban->ban_flags,BAN_SUFFIX) ? "*" : ""); - sprintf(buf,"%-12s %-3d %-7s %s\n\r", - buf2, pban->level, - IS_SET(pban->ban_flags,BAN_NEWBIES) ? "newbies" : - IS_SET(pban->ban_flags,BAN_PERMIT) ? "permit" : - IS_SET(pban->ban_flags,BAN_ALL) ? "all" : "", - IS_SET(pban->ban_flags,BAN_PERMANENT) ? "perm" : "temp"); - add_buf(buffer,buf); - } - - page_to_char( buf_string(buffer), ch ); - free_buf(buffer); - return; - } - - /* find out what type of ban */ - if (arg2[0] == '\0' || !str_prefix(arg2,"all")) - type = BAN_ALL; - else if (!str_prefix(arg2,"newbies")) - type = BAN_NEWBIES; - else if (!str_prefix(arg2,"permit")) - type = BAN_PERMIT; - else - { - send_to_char("Acceptable ban types are all, newbies, and permit.\n\r", - ch); - return; - } - - name = arg1; - - if (name[0] == '*') - { - prefix = TRUE; - name++; - } - - if (name[strlen(name) - 1] == '*') - { - suffix = TRUE; - name[strlen(name) - 1] = '\0'; - } - - if (strlen(name) == 0) - { - send_to_char("You have to ban SOMETHING.\n\r",ch); - return; - } - - prev = NULL; - for ( pban = ban_list; pban != NULL; prev = pban, pban = pban->next ) - { - if (!str_cmp(name,pban->name)) - { - if (pban->level > get_trust(ch)) - { - send_to_char( "That ban was set by a higher power.\n\r", ch ); - return; - } - else - { - if (prev == NULL) - ban_list = pban->next; - else - prev->next = pban->next; - free_ban(pban); - } - } - } - - pban = new_ban(); - pban->name = str_dup(name); - pban->level = get_trust(ch); - - /* set ban type */ - pban->ban_flags = type; - - if (prefix) - SET_BIT(pban->ban_flags,BAN_PREFIX); - if (suffix) - SET_BIT(pban->ban_flags,BAN_SUFFIX); - if (fPerm) - SET_BIT(pban->ban_flags,BAN_PERMANENT); - - pban->next = ban_list; - ban_list = pban; - save_bans(); - sprintf(buf,"%s has been banned.\n\r",pban->name); - send_to_char( buf, ch ); - return; -} - -void do_ban(CHAR_DATA *ch, char *argument) -{ - ban_site(ch,argument,FALSE); -} - -void do_permban(CHAR_DATA *ch, char *argument) -{ - ban_site(ch,argument,TRUE); -} - -void do_allow( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - char buf[MAX_STRING_LENGTH]; - BAN_DATA *prev; - BAN_DATA *curr; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Remove which site from the ban list?\n\r", ch ); - return; - } - - prev = NULL; - for ( curr = ban_list; curr != NULL; prev = curr, curr = curr->next ) - { - if ( !str_cmp( arg, curr->name ) ) - { - if (curr->level > get_trust(ch)) - { - send_to_char( - "You are not powerful enough to lift that ban.\n\r",ch); - return; - } - if ( prev == NULL ) - ban_list = ban_list->next; - else - prev->next = curr->next; - - free_ban(curr); - sprintf(buf,"Ban on %s lifted.\n\r",arg); - send_to_char( buf, ch ); - save_bans(); - return; - } - } - - send_to_char( "Site is not banned.\n\r", ch ); - return; -} - - diff --git a/Rom24/src/comm.c b/Rom24/src/comm.c deleted file mode 100644 index 3a60c68..0000000 --- a/Rom24/src/comm.c +++ /dev/null @@ -1,2572 +0,0 @@ -/*************************************************************************** - * 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. * - * * - * Thanks to abaddon for proof-reading our comm.c and pointing out bugs. * - * Any remaining bugs are, of course, our work, not his. :) * - * * - * 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 * -***************************************************************************/ - -/* - * This file contains all of the OS-dependent stuff: - * startup, signals, BSD sockets for tcp/ip, i/o, timing. - * - * The data flow for input is: - * Game_loop ---> Read_from_descriptor ---> Read - * Game_loop ---> Read_from_buffer - * - * The data flow for output is: - * Game_loop ---> Process_Output ---> Write_to_descriptor -> Write - * - * The OS-dependent functions are Read_from_descriptor and Write_to_descriptor. - * -- Furey 26 Jan 1993 - */ - -#if defined(macintosh) -#include -#else -#include -#include -#endif - -#include -#include -#include -#include -#include -#include - -#include "merc.h" -#include "interp.h" -#include "recycle.h" -#include "tables.h" - -/* - * Malloc debugging stuff. - */ -#if defined(sun) -#undef MALLOC_DEBUG -#endif - -#if defined(MALLOC_DEBUG) -#include -extern int malloc_debug args( ( int ) ); -extern int malloc_verify args( ( void ) ); -#endif - - - -/* - * Signal handling. - * Apollo has a problem with __attribute(atomic) in signal.h, - * I dance around it. - */ -#if defined(apollo) -#define __attribute(x) -#endif - -#if defined(unix) -#include -#endif - -#if defined(apollo) -#undef __attribute -#endif - - - -/* - * Socket and TCP/IP stuff. - */ -#if defined(macintosh) || defined(MSDOS) -const char echo_off_str [] = { '\0' }; -const char echo_on_str [] = { '\0' }; -const char go_ahead_str [] = { '\0' }; -#endif - -#if defined(unix) -#include -#include -#include -#include -#include "telnet.h" -const char echo_off_str [] = { IAC, WILL, TELOPT_ECHO, '\0' }; -const char echo_on_str [] = { IAC, WONT, TELOPT_ECHO, '\0' }; -const char go_ahead_str [] = { IAC, GA, '\0' }; -#endif - - - -/* - * OS-dependent declarations. - */ -#if defined(_AIX) -#include -int accept args( ( int s, struct sockaddr *addr, int *addrlen ) ); -int bind args( ( int s, struct sockaddr *name, int namelen ) ); -void bzero args( ( char *b, int length ) ); -int getpeername args( ( int s, struct sockaddr *name, int *namelen ) ); -int getsockname args( ( int s, struct sockaddr *name, int *namelen ) ); -int gettimeofday args( ( struct timeval *tp, struct timezone *tzp ) ); -int listen args( ( int s, int backlog ) ); -int setsockopt args( ( int s, int level, int optname, void *optval, - int optlen ) ); -int socket args( ( int domain, int type, int protocol ) ); -#endif - -#if defined(apollo) -#include -void bzero args( ( char *b, int length ) ); -#endif - -#if defined(__hpux) -int accept args( ( int s, void *addr, int *addrlen ) ); -int bind args( ( int s, const void *addr, int addrlen ) ); -void bzero args( ( char *b, int length ) ); -int getpeername args( ( int s, void *addr, int *addrlen ) ); -int getsockname args( ( int s, void *name, int *addrlen ) ); -int gettimeofday args( ( struct timeval *tp, struct timezone *tzp ) ); -int listen args( ( int s, int backlog ) ); -int setsockopt args( ( int s, int level, int optname, - const void *optval, int optlen ) ); -int socket args( ( int domain, int type, int protocol ) ); -#endif - -#if defined(interactive) -#include -#include -#endif - -#if defined(linux) -/* - Linux shouldn't need these. If you have a problem compiling, try - uncommenting these functions. -*/ -/* -int accept args( ( int s, struct sockaddr *addr, int *addrlen ) ); -int bind args( ( int s, struct sockaddr *name, int namelen ) ); -int getpeername args( ( int s, struct sockaddr *name, int *namelen ) ); -int getsockname args( ( int s, struct sockaddr *name, int *namelen ) ); -int listen args( ( int s, int backlog ) ); -*/ - -int close args( ( int fd ) ); -int gettimeofday args( ( struct timeval *tp, struct timezone *tzp ) ); -int read args( ( int fd, char *buf, int nbyte ) ); -int select args( ( int width, fd_set *readfds, fd_set *writefds, - fd_set *exceptfds, struct timeval *timeout ) ); -int socket args( ( int domain, int type, int protocol ) ); -int write args( ( int fd, char *buf, int nbyte ) ); -#endif - -#if defined(macintosh) -#include -#include -#include -struct timeval -{ - time_t tv_sec; - time_t tv_usec; -}; -#if !defined(isascii) -#define isascii(c) ( (c) < 0200 ) -#endif -static long theKeys [4]; - -int gettimeofday args( ( struct timeval *tp, void *tzp ) ); -#endif - -#if defined(MIPS_OS) -extern int errno; -#endif - -#if defined(MSDOS) -int gettimeofday args( ( struct timeval *tp, void *tzp ) ); -int kbhit args( ( void ) ); -#endif - -#if defined(NeXT) -int close args( ( int fd ) ); -int fcntl args( ( int fd, int cmd, int arg ) ); -#if !defined(htons) -u_short htons args( ( u_short hostshort ) ); -#endif -#if !defined(ntohl) -u_long ntohl args( ( u_long hostlong ) ); -#endif -int read args( ( int fd, char *buf, int nbyte ) ); -int select args( ( int width, fd_set *readfds, fd_set *writefds, - fd_set *exceptfds, struct timeval *timeout ) ); -int write args( ( int fd, char *buf, int nbyte ) ); -#endif - -#if defined(sequent) -int accept args( ( int s, struct sockaddr *addr, int *addrlen ) ); -int bind args( ( int s, struct sockaddr *name, int namelen ) ); -int close args( ( int fd ) ); -int fcntl args( ( int fd, int cmd, int arg ) ); -int getpeername args( ( int s, struct sockaddr *name, int *namelen ) ); -int getsockname args( ( int s, struct sockaddr *name, int *namelen ) ); -int gettimeofday args( ( struct timeval *tp, struct timezone *tzp ) ); -#if !defined(htons) -u_short htons args( ( u_short hostshort ) ); -#endif -int listen args( ( int s, int backlog ) ); -#if !defined(ntohl) -u_long ntohl args( ( u_long hostlong ) ); -#endif -int read args( ( int fd, char *buf, int nbyte ) ); -int select args( ( int width, fd_set *readfds, fd_set *writefds, - fd_set *exceptfds, struct timeval *timeout ) ); -int setsockopt args( ( int s, int level, int optname, caddr_t optval, - int optlen ) ); -int socket args( ( int domain, int type, int protocol ) ); -int write args( ( int fd, char *buf, int nbyte ) ); -#endif - -/* This includes Solaris Sys V as well */ -#if defined(sun) -int accept args( ( int s, struct sockaddr *addr, int *addrlen ) ); -int bind args( ( int s, struct sockaddr *name, int namelen ) ); -void bzero args( ( char *b, int length ) ); -int close args( ( int fd ) ); -int getpeername args( ( int s, struct sockaddr *name, int *namelen ) ); -int getsockname args( ( int s, struct sockaddr *name, int *namelen ) ); -int listen args( ( int s, int backlog ) ); -int read args( ( int fd, char *buf, int nbyte ) ); -int select args( ( int width, fd_set *readfds, fd_set *writefds, - fd_set *exceptfds, struct timeval *timeout ) ); - -#if !defined(__SVR4) -int gettimeofday args( ( struct timeval *tp, struct timezone *tzp ) ); - -#if defined(SYSV) -int setsockopt args( ( int s, int level, int optname, - const char *optval, int optlen ) ); -#else -int setsockopt args( ( int s, int level, int optname, void *optval, - int optlen ) ); -#endif -#endif -int socket args( ( int domain, int type, int protocol ) ); -int write args( ( int fd, char *buf, int nbyte ) ); -#endif - -#if defined(ultrix) -int accept args( ( int s, struct sockaddr *addr, int *addrlen ) ); -int bind args( ( int s, struct sockaddr *name, int namelen ) ); -void bzero args( ( char *b, int length ) ); -int close args( ( int fd ) ); -int getpeername args( ( int s, struct sockaddr *name, int *namelen ) ); -int getsockname args( ( int s, struct sockaddr *name, int *namelen ) ); -int gettimeofday args( ( struct timeval *tp, struct timezone *tzp ) ); -int listen args( ( int s, int backlog ) ); -int read args( ( int fd, char *buf, int nbyte ) ); -int select args( ( int width, fd_set *readfds, fd_set *writefds, - fd_set *exceptfds, struct timeval *timeout ) ); -int setsockopt args( ( int s, int level, int optname, void *optval, - int optlen ) ); -int socket args( ( int domain, int type, int protocol ) ); -int write args( ( int fd, char *buf, int nbyte ) ); -#endif - - - -/* - * Global variables. - */ -DESCRIPTOR_DATA * descriptor_list; /* All open descriptors */ -DESCRIPTOR_DATA * d_next; /* Next descriptor in loop */ -FILE * fpReserve; /* Reserved file handle */ -bool god; /* All new chars are gods! */ -bool merc_down; /* Shutdown */ -bool wizlock; /* Game is wizlocked */ -bool newlock; /* Game is newlocked */ -char str_boot_time[MAX_INPUT_LENGTH]; -time_t current_time; /* time of this pulse */ - - - -/* - * OS-dependent local functions. - */ -#if defined(macintosh) || defined(MSDOS) -void game_loop_mac_msdos args( ( void ) ); -bool read_from_descriptor args( ( DESCRIPTOR_DATA *d ) ); -bool write_to_descriptor args( ( int desc, char *txt, int length ) ); -#endif - -#if defined(unix) -void game_loop_unix args( ( int control ) ); -int init_socket args( ( int port ) ); -void init_descriptor args( ( int control ) ); -bool read_from_descriptor args( ( DESCRIPTOR_DATA *d ) ); -bool write_to_descriptor args( ( int desc, char *txt, int length ) ); -#endif - - - - -/* - * Other local functions (OS-independent). - */ -bool check_parse_name args( ( char *name ) ); -bool check_reconnect args( ( DESCRIPTOR_DATA *d, char *name, - bool fConn ) ); -bool check_playing args( ( DESCRIPTOR_DATA *d, char *name ) ); -int main args( ( int argc, char **argv ) ); -void nanny args( ( DESCRIPTOR_DATA *d, char *argument ) ); -bool process_output args( ( DESCRIPTOR_DATA *d, bool fPrompt ) ); -void read_from_buffer args( ( DESCRIPTOR_DATA *d ) ); -void stop_idling args( ( CHAR_DATA *ch ) ); -void bust_a_prompt args( ( CHAR_DATA *ch ) ); - - -int main( int argc, char **argv ) -{ - struct timeval now_time; - int port; - -#if defined(unix) - int control; -#endif - - /* - * Memory debugging if needed. - */ -#if defined(MALLOC_DEBUG) - malloc_debug( 2 ); -#endif - - /* - * Init time. - */ - gettimeofday( &now_time, NULL ); - current_time = (time_t) now_time.tv_sec; - strcpy( str_boot_time, ctime( ¤t_time ) ); - - /* - * Macintosh console initialization. - */ -#if defined(macintosh) - console_options.nrows = 31; - cshow( stdout ); - csetmode( C_RAW, stdin ); - cecho2file( "log file", 1, stderr ); -#endif - - /* - * Reserve one channel for our use. - */ - if ( ( fpReserve = fopen( NULL_FILE, "r" ) ) == NULL ) - { - perror( NULL_FILE ); - exit( 1 ); - } - - /* - * Get the port number. - */ - port = 4000; - if ( argc > 1 ) - { - if ( !is_number( argv[1] ) ) - { - fprintf( stderr, "Usage: %s [port #]\n", argv[0] ); - exit( 1 ); - } - else if ( ( port = atoi( argv[1] ) ) <= 1024 ) - { - fprintf( stderr, "Port number must be above 1024.\n" ); - exit( 1 ); - } - } - - /* - * Run the game. - */ -#if defined(macintosh) || defined(MSDOS) - boot_db( ); - log_string( "Merc is ready to rock." ); - game_loop_mac_msdos( ); -#endif - -#if defined(unix) - control = init_socket( port ); - boot_db( ); - sprintf( log_buf, "ROM is ready to rock on port %d.", port ); - log_string( log_buf ); - game_loop_unix( control ); - close (control); -#endif - - /* - * That's all, folks. - */ - log_string( "Normal termination of game." ); - exit( 0 ); - return 0; -} - - - -#if defined(unix) -int init_socket( int port ) -{ - static struct sockaddr_in sa_zero; - struct sockaddr_in sa; - int x = 1; - int fd; - - if ( ( fd = socket( AF_INET, SOCK_STREAM, 0 ) ) < 0 ) - { - perror( "Init_socket: socket" ); - exit( 1 ); - } - - if ( setsockopt( fd, SOL_SOCKET, SO_REUSEADDR, - (char *) &x, sizeof(x) ) < 0 ) - { - perror( "Init_socket: SO_REUSEADDR" ); - close(fd); - exit( 1 ); - } - -#if defined(SO_DONTLINGER) && !defined(SYSV) - { - struct linger ld; - - ld.l_onoff = 1; - ld.l_linger = 1000; - - if ( setsockopt( fd, SOL_SOCKET, SO_DONTLINGER, - (char *) &ld, sizeof(ld) ) < 0 ) - { - perror( "Init_socket: SO_DONTLINGER" ); - close(fd); - exit( 1 ); - } - } -#endif - - sa = sa_zero; - sa.sin_family = AF_INET; - sa.sin_port = htons( port ); - - if ( bind( fd, (struct sockaddr *) &sa, sizeof(sa) ) < 0 ) - { - perror("Init socket: bind" ); - close(fd); - exit(1); - } - - - if ( listen( fd, 3 ) < 0 ) - { - perror("Init socket: listen"); - close(fd); - exit(1); - } - - return fd; -} -#endif - - - -#if defined(macintosh) || defined(MSDOS) -void game_loop_mac_msdos( void ) -{ - struct timeval last_time; - struct timeval now_time; - static DESCRIPTOR_DATA dcon; - - gettimeofday( &last_time, NULL ); - current_time = (time_t) last_time.tv_sec; - - /* - * New_descriptor analogue. - */ - dcon.descriptor = 0; - dcon.connected = CON_GET_NAME; - dcon.host = str_dup( "localhost" ); - dcon.outsize = 2000; - dcon.outbuf = alloc_mem( dcon.outsize ); - dcon.next = descriptor_list; - dcon.showstr_head = NULL; - dcon.showstr_point = NULL; - descriptor_list = &dcon; - - /* - * Send the greeting. - */ - { - extern char * help_greeting; - if ( help_greeting[0] == '.' ) - write_to_buffer( &dcon, help_greeting+1, 0 ); - else - write_to_buffer( &dcon, help_greeting , 0 ); - } - - /* Main loop */ - while ( !merc_down ) - { - DESCRIPTOR_DATA *d; - - /* - * Process input. - */ - for ( d = descriptor_list; d != NULL; d = d_next ) - { - d_next = d->next; - d->fcommand = FALSE; - -#if defined(MSDOS) - if ( kbhit( ) ) -#endif - { - if ( d->character != NULL ) - d->character->timer = 0; - if ( !read_from_descriptor( d ) ) - { - if ( d->character != NULL && d->connected == CON_PLAYING) - save_char_obj( d->character ); - d->outtop = 0; - close_socket( d ); - continue; - } - } - - if (d->character != NULL && d->character->daze > 0) - --d->character->daze; - - if ( d->character != NULL && d->character->wait > 0 ) - { - --d->character->wait; - continue; - } - - read_from_buffer( d ); - if ( d->incomm[0] != '\0' ) - { - d->fcommand = TRUE; - stop_idling( d->character ); - - if ( d->connected == CON_PLAYING ) - substitute_alias( d, d->incomm ); - else - nanny( d, d->incomm ); - - d->incomm[0] = '\0'; - } - } - - - - /* - * Autonomous game motion. - */ - update_handler( ); - - - - /* - * Output. - */ - for ( d = descriptor_list; d != NULL; d = d_next ) - { - d_next = d->next; - - if ( ( d->fcommand || d->outtop > 0 ) ) - { - if ( !process_output( d, TRUE ) ) - { - if ( d->character != NULL && d->connected == CON_PLAYING) - save_char_obj( d->character ); - d->outtop = 0; - close_socket( d ); - } - } - } - - - - /* - * Synchronize to a clock. - * Busy wait (blargh). - */ - now_time = last_time; - for ( ; ; ) - { - int delta; - -#if defined(MSDOS) - if ( kbhit( ) ) -#endif - { - if ( dcon.character != NULL ) - dcon.character->timer = 0; - if ( !read_from_descriptor( &dcon ) ) - { - if ( dcon.character != NULL && d->connected == CON_PLAYING) - save_char_obj( d->character ); - dcon.outtop = 0; - close_socket( &dcon ); - } -#if defined(MSDOS) - break; -#endif - } - - gettimeofday( &now_time, NULL ); - delta = ( now_time.tv_sec - last_time.tv_sec ) * 1000 * 1000 - + ( now_time.tv_usec - last_time.tv_usec ); - if ( delta >= 1000000 / PULSE_PER_SECOND ) - break; - } - last_time = now_time; - current_time = (time_t) last_time.tv_sec; - } - - return; -} -#endif - - - -#if defined(unix) -void game_loop_unix( int control ) -{ - static struct timeval null_time; - struct timeval last_time; - - signal( SIGPIPE, SIG_IGN ); - gettimeofday( &last_time, NULL ); - current_time = (time_t) last_time.tv_sec; - - /* Main loop */ - while ( !merc_down ) - { - fd_set in_set; - fd_set out_set; - fd_set exc_set; - DESCRIPTOR_DATA *d; - int maxdesc; - -#if defined(MALLOC_DEBUG) - if ( malloc_verify( ) != 1 ) - abort( ); -#endif - - /* - * Poll all active descriptors. - */ - FD_ZERO( &in_set ); - FD_ZERO( &out_set ); - FD_ZERO( &exc_set ); - FD_SET( control, &in_set ); - maxdesc = control; - for ( d = descriptor_list; d; d = d->next ) - { - maxdesc = UMAX( maxdesc, d->descriptor ); - FD_SET( d->descriptor, &in_set ); - FD_SET( d->descriptor, &out_set ); - FD_SET( d->descriptor, &exc_set ); - } - - if ( select( maxdesc+1, &in_set, &out_set, &exc_set, &null_time ) < 0 ) - { - perror( "Game_loop: select: poll" ); - exit( 1 ); - } - - /* - * New connection? - */ - if ( FD_ISSET( control, &in_set ) ) - init_descriptor( control ); - - /* - * Kick out the freaky folks. - */ - for ( d = descriptor_list; d != NULL; d = d_next ) - { - d_next = d->next; - if ( FD_ISSET( d->descriptor, &exc_set ) ) - { - FD_CLR( d->descriptor, &in_set ); - FD_CLR( d->descriptor, &out_set ); - if ( d->character && d->connected == CON_PLAYING) - save_char_obj( d->character ); - d->outtop = 0; - close_socket( d ); - } - } - - /* - * Process input. - */ - for ( d = descriptor_list; d != NULL; d = d_next ) - { - d_next = d->next; - d->fcommand = FALSE; - - if ( FD_ISSET( d->descriptor, &in_set ) ) - { - if ( d->character != NULL ) - d->character->timer = 0; - if ( !read_from_descriptor( d ) ) - { - FD_CLR( d->descriptor, &out_set ); - if ( d->character != NULL && d->connected == CON_PLAYING) - save_char_obj( d->character ); - d->outtop = 0; - close_socket( d ); - continue; - } - } - - if (d->character != NULL && d->character->daze > 0) - --d->character->daze; - - if ( d->character != NULL && d->character->wait > 0 ) - { - --d->character->wait; - continue; - } - - read_from_buffer( d ); - if ( d->incomm[0] != '\0' ) - { - d->fcommand = TRUE; - stop_idling( d->character ); - - if (d->showstr_point) - show_string(d,d->incomm); - else if ( d->connected == CON_PLAYING ) - substitute_alias( d, d->incomm ); - else - nanny( d, d->incomm ); - - d->incomm[0] = '\0'; - } - } - - - - /* - * Autonomous game motion. - */ - update_handler( ); - - - - /* - * Output. - */ - for ( d = descriptor_list; d != NULL; d = d_next ) - { - d_next = d->next; - - if ( ( d->fcommand || d->outtop > 0 ) - && FD_ISSET(d->descriptor, &out_set) ) - { - if ( !process_output( d, TRUE ) ) - { - if ( d->character != NULL && d->connected == CON_PLAYING) - save_char_obj( d->character ); - d->outtop = 0; - close_socket( d ); - } - } - } - - - - /* - * Synchronize to a clock. - * Sleep( last_time + 1/PULSE_PER_SECOND - now ). - * Careful here of signed versus unsigned arithmetic. - */ - { - struct timeval now_time; - long secDelta; - long usecDelta; - - gettimeofday( &now_time, NULL ); - usecDelta = ((int) last_time.tv_usec) - ((int) now_time.tv_usec) - + 1000000 / PULSE_PER_SECOND; - secDelta = ((int) last_time.tv_sec ) - ((int) now_time.tv_sec ); - while ( usecDelta < 0 ) - { - usecDelta += 1000000; - secDelta -= 1; - } - - while ( usecDelta >= 1000000 ) - { - usecDelta -= 1000000; - secDelta += 1; - } - - if ( secDelta > 0 || ( secDelta == 0 && usecDelta > 0 ) ) - { - struct timeval stall_time; - - stall_time.tv_usec = usecDelta; - stall_time.tv_sec = secDelta; - if ( select( 0, NULL, NULL, NULL, &stall_time ) < 0 ) - { - perror( "Game_loop: select: stall" ); - exit( 1 ); - } - } - } - - gettimeofday( &last_time, NULL ); - current_time = (time_t) last_time.tv_sec; - } - - return; -} -#endif - - - -#if defined(unix) -void init_descriptor( int control ) -{ - char buf[MAX_STRING_LENGTH]; - DESCRIPTOR_DATA *dnew; - struct sockaddr_in sock; - struct hostent *from; - int desc; - socklen_t size; - - size = sizeof(sock); - getsockname( control, (struct sockaddr *) &sock, &size ); - if ( ( desc = accept( control, (struct sockaddr *) &sock, &size) ) < 0 ) - { - perror( "New_descriptor: accept" ); - return; - } - -#if !defined(FNDELAY) -#define FNDELAY O_NDELAY -#endif - - if ( fcntl( desc, F_SETFL, FNDELAY ) == -1 ) - { - perror( "New_descriptor: fcntl: FNDELAY" ); - return; - } - - /* - * Cons a new descriptor. - */ - dnew = new_descriptor(); - - dnew->descriptor = desc; - dnew->connected = CON_GET_NAME; - dnew->showstr_head = NULL; - dnew->showstr_point = NULL; - dnew->outsize = 2000; - dnew->outbuf = alloc_mem( dnew->outsize ); - - size = sizeof(sock); - if ( getpeername( desc, (struct sockaddr *) &sock, &size ) < 0 ) - { - perror( "New_descriptor: getpeername" ); - dnew->host = str_dup( "(unknown)" ); - } - else - { - /* - * Would be nice to use inet_ntoa here but it takes a struct arg, - * which ain't very compatible between gcc and system libraries. - */ - int addr; - - addr = ntohl( sock.sin_addr.s_addr ); - sprintf( buf, "%d.%d.%d.%d", - ( addr >> 24 ) & 0xFF, ( addr >> 16 ) & 0xFF, - ( addr >> 8 ) & 0xFF, ( addr ) & 0xFF - ); - sprintf( log_buf, "Sock.sinaddr: %s", buf ); - log_string( log_buf ); - from = gethostbyaddr( (char *) &sock.sin_addr, - sizeof(sock.sin_addr), AF_INET ); - dnew->host = str_dup( from ? from->h_name : buf ); - } - - /* - * Swiftest: I added the following to ban sites. I don't - * endorse banning of sites, but Copper has few descriptors now - * and some people from certain sites keep abusing access by - * using automated 'autodialers' and leaving connections hanging. - * - * Furey: added suffix check by request of Nickel of HiddenWorlds. - */ - if ( check_ban(dnew->host,BAN_ALL)) - { - write_to_descriptor( desc, - "Your site has been banned from this mud.\n\r", 0 ); - close( desc ); - free_descriptor(dnew); - return; - } - /* - * Init descriptor data. - */ - dnew->next = descriptor_list; - descriptor_list = dnew; - - /* - * Send the greeting. - */ - { - extern char * help_greeting; - if ( help_greeting[0] == '.' ) - write_to_buffer( dnew, help_greeting+1, 0 ); - else - write_to_buffer( dnew, help_greeting , 0 ); - } - - return; -} -#endif - - - -void close_socket( DESCRIPTOR_DATA *dclose ) -{ - CHAR_DATA *ch; - - if ( dclose->outtop > 0 ) - process_output( dclose, FALSE ); - - if ( dclose->snoop_by != NULL ) - { - write_to_buffer( dclose->snoop_by, - "Your victim has left the game.\n\r", 0 ); - } - - { - DESCRIPTOR_DATA *d; - - for ( d = descriptor_list; d != NULL; d = d->next ) - { - if ( d->snoop_by == dclose ) - d->snoop_by = NULL; - } - } - - if ( ( ch = dclose->character ) != NULL ) - { - sprintf( log_buf, "Closing link to %s.", ch->name ); - log_string( log_buf ); - /* cut down on wiznet spam when rebooting */ - if ( dclose->connected == CON_PLAYING && !merc_down) - { - act( "$n has lost $s link.", ch, NULL, NULL, TO_ROOM ); - wiznet("Net death has claimed $N.",ch,NULL,WIZ_LINKS,0,0); - ch->desc = NULL; - } - else - { - free_char(dclose->original ? dclose->original : - dclose->character ); - } - } - - if ( d_next == dclose ) - d_next = d_next->next; - - if ( dclose == descriptor_list ) - { - descriptor_list = descriptor_list->next; - } - else - { - DESCRIPTOR_DATA *d; - - for ( d = descriptor_list; d && d->next != dclose; d = d->next ) - ; - if ( d != NULL ) - d->next = dclose->next; - else - bug( "Close_socket: dclose not found.", 0 ); - } - - close( dclose->descriptor ); - free_descriptor(dclose); -#if defined(MSDOS) || defined(macintosh) - exit(1); -#endif - return; -} - - - -bool read_from_descriptor( DESCRIPTOR_DATA *d ) -{ - int iStart; - - /* Hold horses if pending command already. */ - if ( d->incomm[0] != '\0' ) - return TRUE; - - /* Check for overflow. */ - iStart = strlen(d->inbuf); - if ( iStart >= sizeof(d->inbuf) - 10 ) - { - sprintf( log_buf, "%s input overflow!", d->host ); - log_string( log_buf ); - write_to_descriptor( d->descriptor, - "\n\r*** PUT A LID ON IT!!! ***\n\r", 0 ); - return FALSE; - } - - /* Snarf input. */ -#if defined(macintosh) - for ( ; ; ) - { - int c; - c = getc( stdin ); - if ( c == '\0' || c == EOF ) - break; - putc( c, stdout ); - if ( c == '\r' ) - putc( '\n', stdout ); - d->inbuf[iStart++] = c; - if ( iStart > sizeof(d->inbuf) - 10 ) - break; - } -#endif - -#if defined(MSDOS) || defined(unix) - for ( ; ; ) - { - int nRead; - - nRead = read( d->descriptor, d->inbuf + iStart, - sizeof(d->inbuf) - 10 - iStart ); - if ( nRead > 0 ) - { - iStart += nRead; - if ( d->inbuf[iStart-1] == '\n' || d->inbuf[iStart-1] == '\r' ) - break; - } - else if ( nRead == 0 ) - { - log_string( "EOF encountered on read." ); - return FALSE; - } - else if ( errno == EWOULDBLOCK ) - break; - else - { - perror( "Read_from_descriptor" ); - return FALSE; - } - } -#endif - - d->inbuf[iStart] = '\0'; - return TRUE; -} - - - -/* - * Transfer one line from input buffer to input line. - */ -void read_from_buffer( DESCRIPTOR_DATA *d ) -{ - int i, j, k; - - /* - * Hold horses if pending command already. - */ - if ( d->incomm[0] != '\0' ) - return; - - /* - * Look for at least one new line. - */ - for ( i = 0; d->inbuf[i] != '\n' && d->inbuf[i] != '\r'; i++ ) - { - if ( d->inbuf[i] == '\0' ) - return; - } - - /* - * Canonical input processing. - */ - for ( i = 0, k = 0; d->inbuf[i] != '\n' && d->inbuf[i] != '\r'; i++ ) - { - if ( k >= MAX_INPUT_LENGTH - 2 ) - { - write_to_descriptor( d->descriptor, "Line too long.\n\r", 0 ); - - /* skip the rest of the line */ - for ( ; d->inbuf[i] != '\0'; i++ ) - { - if ( d->inbuf[i] == '\n' || d->inbuf[i] == '\r' ) - break; - } - d->inbuf[i] = '\n'; - d->inbuf[i+1] = '\0'; - break; - } - - if ( d->inbuf[i] == '\b' && k > 0 ) - --k; - else if ( isascii(d->inbuf[i]) && isprint(d->inbuf[i]) ) - d->incomm[k++] = d->inbuf[i]; - } - - /* - * Finish off the line. - */ - if ( k == 0 ) - d->incomm[k++] = ' '; - d->incomm[k] = '\0'; - - /* - * Deal with bozos with #repeat 1000 ... - */ - - if ( k > 1 || d->incomm[0] == '!' ) - { - if ( d->incomm[0] != '!' && strcmp( d->incomm, d->inlast ) ) - { - d->repeat = 0; - } - else - { - if (++d->repeat >= 25 && d->character - && d->connected == CON_PLAYING) - { - sprintf( log_buf, "%s input spamming!", d->host ); - log_string( log_buf ); - wiznet("Spam spam spam $N spam spam spam spam spam!", - d->character,NULL,WIZ_SPAM,0,get_trust(d->character)); - if (d->incomm[0] == '!') - wiznet(d->inlast,d->character,NULL,WIZ_SPAM,0, - get_trust(d->character)); - else - wiznet(d->incomm,d->character,NULL,WIZ_SPAM,0, - get_trust(d->character)); - - d->repeat = 0; -/* - write_to_descriptor( d->descriptor, - "\n\r*** PUT A LID ON IT!!! ***\n\r", 0 ); - strcpy( d->incomm, "quit" ); -*/ - } - } - } - - - /* - * Do '!' substitution. - */ - if ( d->incomm[0] == '!' ) - strcpy( d->incomm, d->inlast ); - else - strcpy( d->inlast, d->incomm ); - - /* - * Shift the input buffer. - */ - while ( d->inbuf[i] == '\n' || d->inbuf[i] == '\r' ) - i++; - for ( j = 0; ( d->inbuf[j] = d->inbuf[i+j] ) != '\0'; j++ ) - ; - return; -} - - - -/* - * Low level output function. - */ -bool process_output( DESCRIPTOR_DATA *d, bool fPrompt ) -{ - extern bool merc_down; - - /* - * Bust a prompt. - */ - if (!merc_down && d->showstr_point) - write_to_buffer(d,"[Hit Return to continue]\n\r",0); - else if (fPrompt && !merc_down && d->connected == CON_PLAYING) - { - CHAR_DATA *ch; - CHAR_DATA *victim; - - ch = d->character; - - /* battle prompt */ - if ((victim = ch->fighting) != NULL && can_see(ch,victim)) - { - int percent; - char wound[100]; - char buf[MAX_STRING_LENGTH]; - - if (victim->max_hit > 0) - percent = victim->hit * 100 / victim->max_hit; - else - percent = -1; - - if (percent >= 100) - sprintf(wound,"is in excellent condition."); - else if (percent >= 90) - sprintf(wound,"has a few scratches."); - else if (percent >= 75) - sprintf(wound,"has some small wounds and bruises."); - else if (percent >= 50) - sprintf(wound,"has quite a few wounds."); - else if (percent >= 30) - sprintf(wound,"has some big nasty wounds and scratches."); - else if (percent >= 15) - sprintf(wound,"looks pretty hurt."); - else if (percent >= 0) - sprintf(wound,"is in awful condition."); - else - sprintf(wound,"is bleeding to death."); - - sprintf(buf,"%s %s \n\r", - IS_NPC(victim) ? victim->short_descr : victim->name,wound); - buf[0] = UPPER(buf[0]); - write_to_buffer( d, buf, 0); - } - - - ch = d->original ? d->original : d->character; - if (!IS_SET(ch->comm, COMM_COMPACT) ) - write_to_buffer( d, "\n\r", 2 ); - - - if ( IS_SET(ch->comm, COMM_PROMPT) ) - bust_a_prompt( d->character ); - - if (IS_SET(ch->comm,COMM_TELNET_GA)) - write_to_buffer(d,go_ahead_str,0); - } - - /* - * Short-circuit if nothing to write. - */ - if ( d->outtop == 0 ) - return TRUE; - - /* - * Snoop-o-rama. - */ - if ( d->snoop_by != NULL ) - { - if (d->character != NULL) - write_to_buffer( d->snoop_by, d->character->name,0); - write_to_buffer( d->snoop_by, "> ", 2 ); - write_to_buffer( d->snoop_by, d->outbuf, d->outtop ); - } - - /* - * OS-dependent output. - */ - if ( !write_to_descriptor( d->descriptor, d->outbuf, d->outtop ) ) - { - d->outtop = 0; - return FALSE; - } - else - { - d->outtop = 0; - return TRUE; - } -} - -/* - * Bust a prompt (player settable prompt) - * coded by Morgenes for Aldara Mud - */ -void bust_a_prompt( CHAR_DATA *ch ) -{ - char buf[MAX_STRING_LENGTH]; - char buf2[MAX_STRING_LENGTH]; - const char *str; - const char *i; - char *point; - char doors[MAX_INPUT_LENGTH]; - EXIT_DATA *pexit; - bool found; - const char *dir_name[] = {"N","E","S","W","U","D"}; - int door; - - point = buf; - str = ch->prompt; - if (str == NULL || str[0] == '\0') - { - sprintf( buf, "<%dhp %dm %dmv> %s", - ch->hit,ch->mana,ch->move,ch->prefix); - send_to_char(buf,ch); - return; - } - - if (IS_SET(ch->comm,COMM_AFK)) - { - send_to_char(" ",ch); - return; - } - - while( *str != '\0' ) - { - if( *str != '%' ) - { - *point++ = *str++; - continue; - } - ++str; - switch( *str ) - { - default : - i = " "; break; - case 'e': - found = FALSE; - doors[0] = '\0'; - for (door = 0; door < 6; door++) - { - if ((pexit = ch->in_room->exit[door]) != NULL - && pexit ->u1.to_room != NULL - && (can_see_room(ch,pexit->u1.to_room) - || (IS_AFFECTED(ch,AFF_INFRARED) - && !IS_AFFECTED(ch,AFF_BLIND))) - && !IS_SET(pexit->exit_info,EX_CLOSED)) - { - found = TRUE; - strcat(doors,dir_name[door]); - } - } - if (!found) - strcat(buf,"none"); - sprintf(buf2,"%s",doors); - i = buf2; break; - case 'c' : - sprintf(buf2,"%s","\n\r"); - i = buf2; break; - case 'h' : - sprintf( buf2, "%d", ch->hit ); - i = buf2; break; - case 'H' : - sprintf( buf2, "%d", ch->max_hit ); - i = buf2; break; - case 'm' : - sprintf( buf2, "%d", ch->mana ); - i = buf2; break; - case 'M' : - sprintf( buf2, "%d", ch->max_mana ); - i = buf2; break; - case 'v' : - sprintf( buf2, "%d", ch->move ); - i = buf2; break; - case 'V' : - sprintf( buf2, "%d", ch->max_move ); - i = buf2; break; - case 'x' : - sprintf( buf2, "%d", ch->exp ); - i = buf2; break; - case 'X' : - sprintf(buf2, "%d", IS_NPC(ch) ? 0 : - (ch->level + 1) * exp_per_level(ch,ch->pcdata->points) - ch->exp); - i = buf2; break; - case 'g' : - sprintf( buf2, "%ld", ch->gold); - i = buf2; break; - case 's' : - sprintf( buf2, "%ld", ch->silver); - i = buf2; break; - case 'a' : - if( ch->level > 9 ) - sprintf( buf2, "%d", ch->alignment ); - else - sprintf( buf2, "%s", IS_GOOD(ch) ? "good" : IS_EVIL(ch) ? - "evil" : "neutral" ); - i = buf2; break; - case 'r' : - if( ch->in_room != NULL ) - sprintf( buf2, "%s", - ((!IS_NPC(ch) && IS_SET(ch->act,PLR_HOLYLIGHT)) || - (!IS_AFFECTED(ch,AFF_BLIND) && !room_is_dark( ch->in_room ))) - ? ch->in_room->name : "darkness"); - else - sprintf( buf2, " " ); - i = buf2; break; - case 'R' : - if( IS_IMMORTAL( ch ) && ch->in_room != NULL ) - sprintf( buf2, "%d", ch->in_room->vnum ); - else - sprintf( buf2, " " ); - i = buf2; break; - case 'z' : - if( IS_IMMORTAL( ch ) && ch->in_room != NULL ) - sprintf( buf2, "%s", ch->in_room->area->name ); - else - sprintf( buf2, " " ); - i = buf2; break; - case '%' : - sprintf( buf2, "%%" ); - i = buf2; break; - } - ++str; - while( (*point = *i) != '\0' ) - ++point, ++i; - } - write_to_buffer( ch->desc, buf, point - buf ); - - if (ch->prefix[0] != '\0') - write_to_buffer(ch->desc,ch->prefix,0); - return; -} - - - -/* - * Append onto an output buffer. - */ -void write_to_buffer( DESCRIPTOR_DATA *d, const char *txt, int length ) -{ - /* - * Find length in case caller didn't. - */ - if ( length <= 0 ) - length = strlen(txt); - - /* - * Initial \n\r if needed. - */ - if ( d->outtop == 0 && !d->fcommand ) - { - d->outbuf[0] = '\n'; - d->outbuf[1] = '\r'; - d->outtop = 2; - } - - /* - * Expand the buffer as needed. - */ - while ( d->outtop + length >= d->outsize ) - { - char *outbuf; - - if (d->outsize >= 32000) - { - bug("Buffer overflow. Closing.\n\r",0); - close_socket(d); - return; - } - outbuf = alloc_mem( 2 * d->outsize ); - strncpy( outbuf, d->outbuf, d->outtop ); - free_mem( d->outbuf, d->outsize ); - d->outbuf = outbuf; - d->outsize *= 2; - } - - /* - * Copy. - */ - strncpy( d->outbuf + d->outtop, txt, length ); - d->outtop += length; - return; -} - - - -/* - * Lowest level output function. - * Write a block of text to the file descriptor. - * If this gives errors on very long blocks (like 'ofind all'), - * try lowering the max block size. - */ -bool write_to_descriptor( int desc, char *txt, int length ) -{ - int iStart; - int nWrite; - int nBlock; - -#if defined(macintosh) || defined(MSDOS) - if ( desc == 0 ) - desc = 1; -#endif - - if ( length <= 0 ) - length = strlen(txt); - - for ( iStart = 0; iStart < length; iStart += nWrite ) - { - nBlock = UMIN( length - iStart, 4096 ); - if ( ( nWrite = write( desc, txt + iStart, nBlock ) ) < 0 ) - { perror( "Write_to_descriptor" ); return FALSE; } - } - - return TRUE; -} - - - -/* - * Deal with sockets that haven't logged in yet. - */ -void nanny( DESCRIPTOR_DATA *d, char *argument ) -{ - DESCRIPTOR_DATA *d_old, *d_next; - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *ch; - char *pwdnew; - char *p; - int iClass,race,i,weapon; - bool fOld; - - while ( isspace(*argument) ) - argument++; - - ch = d->character; - - switch ( d->connected ) - { - - default: - bug( "Nanny: bad d->connected %d.", d->connected ); - close_socket( d ); - return; - - case CON_GET_NAME: - if ( argument[0] == '\0' ) - { - close_socket( d ); - return; - } - - argument[0] = UPPER(argument[0]); - if ( !check_parse_name( argument ) ) - { - write_to_buffer( d, "Illegal name, try another.\n\rName: ", 0 ); - return; - } - - fOld = load_char_obj( d, argument ); - ch = d->character; - - if (IS_SET(ch->act, PLR_DENY)) - { - sprintf( log_buf, "Denying access to %s@%s.", argument, d->host ); - log_string( log_buf ); - write_to_buffer( d, "You are denied access.\n\r", 0 ); - close_socket( d ); - return; - } - - if (check_ban(d->host,BAN_PERMIT) && !IS_SET(ch->act,PLR_PERMIT)) - { - write_to_buffer(d,"Your site has been banned from this mud.\n\r",0); - close_socket(d); - return; - } - - if ( check_reconnect( d, argument, FALSE ) ) - { - fOld = TRUE; - } - else - { - if ( wizlock && !IS_IMMORTAL(ch)) - { - write_to_buffer( d, "The game is wizlocked.\n\r", 0 ); - close_socket( d ); - return; - } - } - - if ( fOld ) - { - /* Old player */ - write_to_buffer( d, "Password: ", 0 ); - write_to_buffer( d, echo_off_str, 0 ); - d->connected = CON_GET_OLD_PASSWORD; - return; - } - else - { - /* New player */ - if (newlock) - { - write_to_buffer( d, "The game is newlocked.\n\r", 0 ); - close_socket( d ); - return; - } - - if (check_ban(d->host,BAN_NEWBIES)) - { - write_to_buffer(d, - "New players are not allowed from your site.\n\r",0); - close_socket(d); - return; - } - - sprintf( buf, "Did I get that right, %s (Y/N)? ", argument ); - write_to_buffer( d, buf, 0 ); - d->connected = CON_CONFIRM_NEW_NAME; - return; - } - break; - - case CON_GET_OLD_PASSWORD: -#if defined(unix) - write_to_buffer( d, "\n\r", 2 ); -#endif - - if ( strcmp( crypt( argument, ch->pcdata->pwd ), ch->pcdata->pwd )) - { - write_to_buffer( d, "Wrong password.\n\r", 0 ); - close_socket( d ); - return; - } - - write_to_buffer( d, echo_on_str, 0 ); - - if (check_playing(d,ch->name)) - return; - - if ( check_reconnect( d, ch->name, TRUE ) ) - return; - - sprintf( log_buf, "%s@%s has connected.", ch->name, d->host ); - log_string( log_buf ); - wiznet(log_buf,NULL,NULL,WIZ_SITES,0,get_trust(ch)); - - if ( IS_IMMORTAL(ch) ) - { - do_function(ch, &do_help, "imotd" ); - d->connected = CON_READ_IMOTD; - } - else - { - do_function(ch, &do_help, "motd" ); - d->connected = CON_READ_MOTD; - } - break; - -/* RT code for breaking link */ - - case CON_BREAK_CONNECT: - switch( *argument ) - { - case 'y' : case 'Y': - for ( d_old = descriptor_list; d_old != NULL; d_old = d_next ) - { - d_next = d_old->next; - if (d_old == d || d_old->character == NULL) - continue; - - if (str_cmp(ch->name,d_old->original ? - d_old->original->name : d_old->character->name)) - continue; - - close_socket(d_old); - } - if (check_reconnect(d,ch->name,TRUE)) - return; - write_to_buffer(d,"Reconnect attempt failed.\n\rName: ",0); - if ( d->character != NULL ) - { - free_char( d->character ); - d->character = NULL; - } - d->connected = CON_GET_NAME; - break; - - case 'n' : case 'N': - write_to_buffer(d,"Name: ",0); - if ( d->character != NULL ) - { - free_char( d->character ); - d->character = NULL; - } - d->connected = CON_GET_NAME; - break; - - default: - write_to_buffer(d,"Please type Y or N? ",0); - break; - } - break; - - case CON_CONFIRM_NEW_NAME: - switch ( *argument ) - { - case 'y': case 'Y': - sprintf( buf, "New character.\n\rGive me a password for %s: %s", - ch->name, echo_off_str ); - write_to_buffer( d, buf, 0 ); - d->connected = CON_GET_NEW_PASSWORD; - break; - - case 'n': case 'N': - write_to_buffer( d, "Ok, what IS it, then? ", 0 ); - free_char( d->character ); - d->character = NULL; - d->connected = CON_GET_NAME; - break; - - default: - write_to_buffer( d, "Please type Yes or No? ", 0 ); - break; - } - break; - - case CON_GET_NEW_PASSWORD: -#if defined(unix) - write_to_buffer( d, "\n\r", 2 ); -#endif - - if ( strlen(argument) < 5 ) - { - write_to_buffer( d, - "Password must be at least five characters long.\n\rPassword: ", - 0 ); - return; - } - - pwdnew = crypt( argument, ch->name ); - for ( p = pwdnew; *p != '\0'; p++ ) - { - if ( *p == '~' ) - { - write_to_buffer( d, - "New password not acceptable, try again.\n\rPassword: ", - 0 ); - return; - } - } - - free_string( ch->pcdata->pwd ); - ch->pcdata->pwd = str_dup( pwdnew ); - write_to_buffer( d, "Please retype password: ", 0 ); - d->connected = CON_CONFIRM_NEW_PASSWORD; - break; - - case CON_CONFIRM_NEW_PASSWORD: -#if defined(unix) - write_to_buffer( d, "\n\r", 2 ); -#endif - - if ( strcmp( crypt( argument, ch->pcdata->pwd ), ch->pcdata->pwd ) ) - { - write_to_buffer( d, "Passwords don't match.\n\rRetype password: ", - 0 ); - d->connected = CON_GET_NEW_PASSWORD; - return; - } - - write_to_buffer( d, echo_on_str, 0 ); - write_to_buffer(d,"The following races are available:\n\r ",0); - for ( race = 1; race_table[race].name != NULL; race++ ) - { - if (!race_table[race].pc_race) - break; - write_to_buffer(d,race_table[race].name,0); - write_to_buffer(d," ",1); - } - write_to_buffer(d,"\n\r",0); - write_to_buffer(d,"What is your race (help for more information)? ",0); - d->connected = CON_GET_NEW_RACE; - break; - - case CON_GET_NEW_RACE: - one_argument(argument,arg); - - if (!strcmp(arg,"help")) - { - argument = one_argument(argument,arg); - if (argument[0] == '\0') - do_function(ch, &do_help, "race help"); - else - do_function(ch, &do_help, argument); - write_to_buffer(d, - "What is your race (help for more information)? ",0); - break; - } - - race = race_lookup(argument); - - if (race == 0 || !race_table[race].pc_race) - { - write_to_buffer(d,"That is not a valid race.\n\r",0); - write_to_buffer(d,"The following races are available:\n\r ",0); - for ( race = 1; race_table[race].name != NULL; race++ ) - { - if (!race_table[race].pc_race) - break; - write_to_buffer(d,race_table[race].name,0); - write_to_buffer(d," ",1); - } - write_to_buffer(d,"\n\r",0); - write_to_buffer(d, - "What is your race? (help for more information) ",0); - break; - } - - ch->race = race; - /* initialize stats */ - for (i = 0; i < MAX_STATS; i++) - ch->perm_stat[i] = pc_race_table[race].stats[i]; - ch->affected_by = ch->affected_by|race_table[race].aff; - ch->imm_flags = ch->imm_flags|race_table[race].imm; - ch->res_flags = ch->res_flags|race_table[race].res; - ch->vuln_flags = ch->vuln_flags|race_table[race].vuln; - ch->form = race_table[race].form; - ch->parts = race_table[race].parts; - - /* add skills */ - for (i = 0; i < 5; i++) - { - if (pc_race_table[race].skills[i] == NULL) - break; - group_add(ch,pc_race_table[race].skills[i],FALSE); - } - /* add cost */ - ch->pcdata->points = pc_race_table[race].points; - ch->size = pc_race_table[race].size; - - write_to_buffer( d, "What is your sex (M/F)? ", 0 ); - d->connected = CON_GET_NEW_SEX; - break; - - - case CON_GET_NEW_SEX: - switch ( argument[0] ) - { - case 'm': case 'M': ch->sex = SEX_MALE; - ch->pcdata->true_sex = SEX_MALE; - break; - case 'f': case 'F': ch->sex = SEX_FEMALE; - ch->pcdata->true_sex = SEX_FEMALE; - break; - default: - write_to_buffer( d, "That's not a sex.\n\rWhat IS your sex? ", 0 ); - return; - } - - strcpy( buf, "Select a class [" ); - for ( iClass = 0; iClass < MAX_CLASS; iClass++ ) - { - if ( iClass > 0 ) - strcat( buf, " " ); - strcat( buf, class_table[iClass].name ); - } - strcat( buf, "]: " ); - write_to_buffer( d, buf, 0 ); - d->connected = CON_GET_NEW_CLASS; - break; - - case CON_GET_NEW_CLASS: - iClass = class_lookup(argument); - - if ( iClass == -1 ) - { - write_to_buffer( d, - "That's not a class.\n\rWhat IS your class? ", 0 ); - return; - } - - ch->class = iClass; - - sprintf( log_buf, "%s@%s new player.", ch->name, d->host ); - log_string( log_buf ); - wiznet("Newbie alert! $N sighted.",ch,NULL,WIZ_NEWBIE,0,0); - wiznet(log_buf,NULL,NULL,WIZ_SITES,0,get_trust(ch)); - - write_to_buffer( d, "\n\r", 2 ); - write_to_buffer( d, "You may be good, neutral, or evil.\n\r",0); - write_to_buffer( d, "Which alignment (G/N/E)? ",0); - d->connected = CON_GET_ALIGNMENT; - break; - -case CON_GET_ALIGNMENT: - switch( argument[0]) - { - case 'g' : case 'G' : ch->alignment = 750; break; - case 'n' : case 'N' : ch->alignment = 0; break; - case 'e' : case 'E' : ch->alignment = -750; break; - default: - write_to_buffer(d,"That's not a valid alignment.\n\r",0); - write_to_buffer(d,"Which alignment (G/N/E)? ",0); - return; - } - - write_to_buffer(d,"\n\r",0); - - group_add(ch,"rom basics",FALSE); - group_add(ch,class_table[ch->class].base_group,FALSE); - ch->pcdata->learned[gsn_recall] = 50; - write_to_buffer(d,"Do you wish to customize this character?\n\r",0); - write_to_buffer(d,"Customization takes time, but allows a wider range of skills and abilities.\n\r",0); - write_to_buffer(d,"Customize (Y/N)? ",0); - d->connected = CON_DEFAULT_CHOICE; - break; - -case CON_DEFAULT_CHOICE: - write_to_buffer(d,"\n\r",2); - switch ( argument[0] ) - { - case 'y': case 'Y': - ch->gen_data = new_gen_data(); - ch->gen_data->points_chosen = ch->pcdata->points; - do_function(ch, &do_help, "group header"); - list_group_costs(ch); - write_to_buffer(d,"You already have the following skills:\n\r",0); - do_function(ch, &do_skills, ""); - do_function(ch, &do_help, "menu choice"); - d->connected = CON_GEN_GROUPS; - break; - case 'n': case 'N': - group_add(ch,class_table[ch->class].default_group,TRUE); - write_to_buffer( d, "\n\r", 2 ); - write_to_buffer(d, - "Please pick a weapon from the following choices:\n\r",0); - buf[0] = '\0'; - for ( i = 0; weapon_table[i].name != NULL; i++) - if (ch->pcdata->learned[*weapon_table[i].gsn] > 0) - { - strcat(buf,weapon_table[i].name); - strcat(buf," "); - } - strcat(buf,"\n\rYour choice? "); - write_to_buffer(d,buf,0); - d->connected = CON_PICK_WEAPON; - break; - default: - write_to_buffer( d, "Please answer (Y/N)? ", 0 ); - return; - } - break; - - case CON_PICK_WEAPON: - write_to_buffer(d,"\n\r",2); - weapon = weapon_lookup(argument); - if (weapon == -1 || ch->pcdata->learned[*weapon_table[weapon].gsn] <= 0) - { - write_to_buffer(d, - "That's not a valid selection. Choices are:\n\r",0); - buf[0] = '\0'; - for ( i = 0; weapon_table[i].name != NULL; i++) - if (ch->pcdata->learned[*weapon_table[i].gsn] > 0) - { - strcat(buf,weapon_table[i].name); - strcat(buf," "); - } - strcat(buf,"\n\rYour choice? "); - write_to_buffer(d,buf,0); - return; - } - - ch->pcdata->learned[*weapon_table[weapon].gsn] = 40; - write_to_buffer(d,"\n\r",2); - do_function(ch, &do_help, "motd"); - d->connected = CON_READ_MOTD; - break; - - case CON_GEN_GROUPS: - send_to_char("\n\r",ch); - - if (!str_cmp(argument,"done")) - { - if (ch->pcdata->points == pc_race_table[ch->race].points) - { - send_to_char("You didn't pick anything.\n\r",ch); - break; - } - - if (ch->pcdata->points <= 40 + pc_race_table[ch->race].points) - { - sprintf(buf, - "You must take at least %d points of skills and groups", - 40 + pc_race_table[ch->race].points); - send_to_char(buf, ch); - break; - } - - sprintf(buf,"Creation points: %d\n\r",ch->pcdata->points); - send_to_char(buf,ch); - sprintf(buf,"Experience per level: %d\n\r", - exp_per_level(ch,ch->gen_data->points_chosen)); - if (ch->pcdata->points < 40) - ch->train = (40 - ch->pcdata->points + 1) / 2; - free_gen_data(ch->gen_data); - ch->gen_data = NULL; - send_to_char(buf,ch); - write_to_buffer( d, "\n\r", 2 ); - write_to_buffer(d, - "Please pick a weapon from the following choices:\n\r",0); - buf[0] = '\0'; - for ( i = 0; weapon_table[i].name != NULL; i++) - if (ch->pcdata->learned[*weapon_table[i].gsn] > 0) - { - strcat(buf,weapon_table[i].name); - strcat(buf," "); - } - strcat(buf,"\n\rYour choice? "); - write_to_buffer(d,buf,0); - d->connected = CON_PICK_WEAPON; - break; - } - - if (!parse_gen_groups(ch,argument)) - send_to_char( - "Choices are: list,learned,premise,add,drop,info,help, and done.\n\r" - ,ch); - - do_function(ch, &do_help, "menu choice"); - break; - - case CON_READ_IMOTD: - write_to_buffer(d,"\n\r",2); - do_function(ch, &do_help, "motd"); - d->connected = CON_READ_MOTD; - break; - - case CON_READ_MOTD: - if ( ch->pcdata == NULL || ch->pcdata->pwd[0] == '\0') - { - write_to_buffer( d, "Warning! Null password!\n\r",0 ); - write_to_buffer( d, "Please report old password with bug.\n\r",0); - write_to_buffer( d, - "Type 'password null ' to fix.\n\r",0); - } - - write_to_buffer( d, - "\n\rWelcome to ROM 2.4. Please do not feed the mobiles.\n\r", - 0 ); - ch->next = char_list; - char_list = ch; - d->connected = CON_PLAYING; - reset_char(ch); - - if ( ch->level == 0 ) - { - - ch->perm_stat[class_table[ch->class].attr_prime] += 3; - - ch->level = 1; - ch->exp = exp_per_level(ch,ch->pcdata->points); - ch->hit = ch->max_hit; - ch->mana = ch->max_mana; - ch->move = ch->max_move; - ch->train = 3; - ch->practice = 5; - sprintf( buf, "the %s", - title_table [ch->class] [ch->level] - [ch->sex == SEX_FEMALE ? 1 : 0] ); - set_title( ch, buf ); - - do_function (ch, &do_outfit,""); - obj_to_char(create_object(get_obj_index(OBJ_VNUM_MAP),0),ch); - - char_to_room( ch, get_room_index( ROOM_VNUM_SCHOOL ) ); - send_to_char("\n\r",ch); - do_function(ch, &do_help, "newbie info"); - send_to_char("\n\r",ch); - } - else if ( ch->in_room != NULL ) - { - char_to_room( ch, ch->in_room ); - } - else if ( IS_IMMORTAL(ch) ) - { - char_to_room( ch, get_room_index( ROOM_VNUM_CHAT ) ); - } - else - { - char_to_room( ch, get_room_index( ROOM_VNUM_TEMPLE ) ); - } - - act( "$n has entered the game.", ch, NULL, NULL, TO_ROOM ); - do_function(ch, &do_look, "auto" ); - - wiznet("$N has left real life behind.",ch,NULL, - WIZ_LOGINS,WIZ_SITES,get_trust(ch)); - - if (ch->pet != NULL) - { - char_to_room(ch->pet,ch->in_room); - act("$n has entered the game.",ch->pet,NULL,NULL,TO_ROOM); - } - - do_function(ch, &do_unread, ""); - break; - } - - return; -} - - - -/* - * Parse a name for acceptability. - */ -bool check_parse_name( char *name ) -{ - int clan; - - /* - * Reserved words. - */ - if (is_exact_name(name, - "all auto immortal self someone something the you loner")) - { - return FALSE; - } - - /* check clans */ - for (clan = 0; clan < MAX_CLAN; clan++) - { - if (LOWER(name[0]) == LOWER(clan_table[clan].name[0]) - && !str_cmp(name,clan_table[clan].name)) - return FALSE; - } - - if (str_cmp(capitalize(name),"Alander") && (!str_prefix("Alan",name) - || !str_suffix("Alander",name))) - return FALSE; - - /* - * Length restrictions. - */ - - if ( strlen(name) < 2 ) - return FALSE; - -#if defined(MSDOS) - if ( strlen(name) > 8 ) - return FALSE; -#endif - -#if defined(macintosh) || defined(unix) - if ( strlen(name) > 12 ) - return FALSE; -#endif - - /* - * Alphanumerics only. - * Lock out IllIll twits. - */ - { - char *pc; - bool fIll,adjcaps = FALSE,cleancaps = FALSE; - int total_caps = 0; - - fIll = TRUE; - for ( pc = name; *pc != '\0'; pc++ ) - { - if ( !isalpha(*pc) ) - return FALSE; - - if ( isupper(*pc)) /* ugly anti-caps hack */ - { - if (adjcaps) - cleancaps = TRUE; - total_caps++; - adjcaps = TRUE; - } - else - adjcaps = FALSE; - - if ( LOWER(*pc) != 'i' && LOWER(*pc) != 'l' ) - fIll = FALSE; - } - - if ( fIll ) - return FALSE; - - if (cleancaps || (total_caps > (strlen(name)) / 2 && strlen(name) < 3)) - return FALSE; - } - - /* - * Prevent players from naming themselves after mobs. - */ - { - extern MOB_INDEX_DATA *mob_index_hash[MAX_KEY_HASH]; - MOB_INDEX_DATA *pMobIndex; - int iHash; - - for ( iHash = 0; iHash < MAX_KEY_HASH; iHash++ ) - { - for ( pMobIndex = mob_index_hash[iHash]; - pMobIndex != NULL; - pMobIndex = pMobIndex->next ) - { - if ( is_name( name, pMobIndex->player_name ) ) - return FALSE; - } - } - } - - return TRUE; -} - - - -/* - * Look for link-dead player to reconnect. - */ -bool check_reconnect( DESCRIPTOR_DATA *d, char *name, bool fConn ) -{ - CHAR_DATA *ch; - - for ( ch = char_list; ch != NULL; ch = ch->next ) - { - if ( !IS_NPC(ch) - && (!fConn || ch->desc == NULL) - && !str_cmp( d->character->name, ch->name ) ) - { - if ( fConn == FALSE ) - { - free_string( d->character->pcdata->pwd ); - d->character->pcdata->pwd = str_dup( ch->pcdata->pwd ); - } - else - { - free_char( d->character ); - d->character = ch; - ch->desc = d; - ch->timer = 0; - send_to_char( - "Reconnecting. Type replay to see missed tells.\n\r", ch ); - act( "$n has reconnected.", ch, NULL, NULL, TO_ROOM ); - - sprintf( log_buf, "%s@%s reconnected.", ch->name, d->host ); - log_string( log_buf ); - wiznet("$N groks the fullness of $S link.", - ch,NULL,WIZ_LINKS,0,0); - d->connected = CON_PLAYING; - } - return TRUE; - } - } - - return FALSE; -} - - - -/* - * Check if already playing. - */ -bool check_playing( DESCRIPTOR_DATA *d, char *name ) -{ - DESCRIPTOR_DATA *dold; - - for ( dold = descriptor_list; dold; dold = dold->next ) - { - if ( dold != d - && dold->character != NULL - && dold->connected != CON_GET_NAME - && dold->connected != CON_GET_OLD_PASSWORD - && !str_cmp( name, dold->original - ? dold->original->name : dold->character->name ) ) - { - write_to_buffer( d, "That character is already playing.\n\r",0); - write_to_buffer( d, "Do you wish to connect anyway (Y/N)?",0); - d->connected = CON_BREAK_CONNECT; - return TRUE; - } - } - - return FALSE; -} - - - -void stop_idling( CHAR_DATA *ch ) -{ - if ( ch == NULL - || ch->desc == NULL - || ch->desc->connected != CON_PLAYING - || ch->was_in_room == NULL - || ch->in_room != get_room_index(ROOM_VNUM_LIMBO)) - return; - - ch->timer = 0; - char_from_room( ch ); - char_to_room( ch, ch->was_in_room ); - ch->was_in_room = NULL; - act( "$n has returned from the void.", ch, NULL, NULL, TO_ROOM ); - return; -} - - - -/* - * Write to one char. - */ -void send_to_char( const char *txt, CHAR_DATA *ch ) -{ - if ( txt != NULL && ch->desc != NULL ) - write_to_buffer( ch->desc, txt, strlen(txt) ); - return; -} - -/* - * Send a page to one char. - */ -void page_to_char( const char *txt, CHAR_DATA *ch ) -{ - if ( txt == NULL || ch->desc == NULL) - return; - - if (ch->lines == 0 ) - { - send_to_char(txt,ch); - return; - } - -#if defined(macintosh) - send_to_char(txt,ch); -#else - ch->desc->showstr_head = alloc_mem(strlen(txt) + 1); - strcpy(ch->desc->showstr_head,txt); - ch->desc->showstr_point = ch->desc->showstr_head; - show_string(ch->desc,""); -#endif -} - - -/* string pager */ -void show_string(struct descriptor_data *d, char *input) -{ - char buffer[4*MAX_STRING_LENGTH]; - char buf[MAX_INPUT_LENGTH]; - register char *scan, *chk; - int lines = 0, toggle = 1; - int show_lines; - - one_argument(input,buf); - if (buf[0] != '\0') - { - if (d->showstr_head) - { - free_mem(d->showstr_head,strlen(d->showstr_head)); - d->showstr_head = 0; - } - d->showstr_point = 0; - return; - } - - if (d->character) - show_lines = d->character->lines; - else - show_lines = 0; - - for (scan = buffer; ; scan++, d->showstr_point++) - { - if (((*scan = *d->showstr_point) == '\n' || *scan == '\r') - && (toggle = -toggle) < 0) - lines++; - - else if (!*scan || (show_lines > 0 && lines >= show_lines)) - { - *scan = '\0'; - write_to_buffer(d,buffer,strlen(buffer)); - for (chk = d->showstr_point; isspace(*chk); chk++); - { - if (!*chk) - { - if (d->showstr_head) - { - free_mem(d->showstr_head,strlen(d->showstr_head)); - d->showstr_head = 0; - } - d->showstr_point = 0; - } - } - return; - } - } - return; -} - - -/* quick sex fixer */ -void fix_sex(CHAR_DATA *ch) -{ - if (ch->sex < 0 || ch->sex > 2) - ch->sex = IS_NPC(ch) ? 0 : ch->pcdata->true_sex; -} - -void act_new( const char *format, CHAR_DATA *ch, const void *arg1, - const void *arg2, int type, int min_pos) -{ - static char * const he_she [] = { "it", "he", "she" }; - static char * const him_her [] = { "it", "him", "her" }; - static char * const his_her [] = { "its", "his", "her" }; - - char buf[MAX_STRING_LENGTH]; - char fname[MAX_INPUT_LENGTH]; - CHAR_DATA *to; - CHAR_DATA *vch = (CHAR_DATA *) arg2; - OBJ_DATA *obj1 = (OBJ_DATA *) arg1; - OBJ_DATA *obj2 = (OBJ_DATA *) arg2; - const char *str; - const char *i; - char *point; - - /* - * Discard null and zero-length messages. - */ - if ( format == NULL || format[0] == '\0' ) - return; - - /* discard null rooms and chars */ - if (ch == NULL || ch->in_room == NULL) - return; - - to = ch->in_room->people; - if ( type == TO_VICT ) - { - if ( vch == NULL ) - { - bug( "Act: null vch with TO_VICT.", 0 ); - return; - } - - if (vch->in_room == NULL) - return; - - to = vch->in_room->people; - } - - for ( ; to != NULL; to = to->next_in_room ) - { - if ( to->desc == NULL || to->position < min_pos ) - continue; - - if ( (type == TO_CHAR) && to != ch ) - continue; - if ( type == TO_VICT && ( to != vch || to == ch ) ) - continue; - if ( type == TO_ROOM && to == ch ) - continue; - if ( type == TO_NOTVICT && (to == ch || to == vch) ) - continue; - - point = buf; - str = format; - while ( *str != '\0' ) - { - if ( *str != '$' ) - { - *point++ = *str++; - continue; - } - ++str; - - if ( arg2 == NULL && *str >= 'A' && *str <= 'Z' ) - { - bug( "Act: missing arg2 for code %d.", *str ); - i = " <@@@> "; - } - else - { - switch ( *str ) - { - default: bug( "Act: bad code %d.", *str ); - i = " <@@@> "; break; - /* Thx alex for 't' idea */ - case 't': i = (char *) arg1; break; - case 'T': i = (char *) arg2; break; - case 'n': i = PERS( ch, to ); break; - case 'N': i = PERS( vch, to ); break; - case 'e': i = he_she [URANGE(0, ch ->sex, 2)]; break; - case 'E': i = he_she [URANGE(0, vch ->sex, 2)]; break; - case 'm': i = him_her [URANGE(0, ch ->sex, 2)]; break; - case 'M': i = him_her [URANGE(0, vch ->sex, 2)]; break; - case 's': i = his_her [URANGE(0, ch ->sex, 2)]; break; - case 'S': i = his_her [URANGE(0, vch ->sex, 2)]; break; - - case 'p': - i = can_see_obj( to, obj1 ) - ? obj1->short_descr - : "something"; - break; - - case 'P': - i = can_see_obj( to, obj2 ) - ? obj2->short_descr - : "something"; - break; - - case 'd': - if ( arg2 == NULL || ((char *) arg2)[0] == '\0' ) - { - i = "door"; - } - else - { - one_argument( (char *) arg2, fname ); - i = fname; - } - break; - } - } - - ++str; - while ( ( *point = *i ) != '\0' ) - ++point, ++i; - } - - *point++ = '\n'; - *point++ = '\r'; - buf[0] = UPPER(buf[0]); - write_to_buffer( to->desc, buf, point - buf ); - } - - return; -} - - - -/* - * Macintosh support functions. - */ -#if defined(macintosh) -int gettimeofday( struct timeval *tp, void *tzp ) -{ - tp->tv_sec = time( NULL ); - tp->tv_usec = 0; -} -#endif diff --git a/Rom24/src/const.c b/Rom24/src/const.c deleted file mode 100644 index 71eae1f..0000000 --- a/Rom24/src/const.c +++ /dev/null @@ -1,2125 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#endif -#include -#include -#include "merc.h" -#include "magic.h" -#include "interp.h" - - -/* item type list */ -const struct item_type item_table [] = -{ - { ITEM_LIGHT, "light" }, - { ITEM_SCROLL, "scroll" }, - { ITEM_WAND, "wand" }, - { ITEM_STAFF, "staff" }, - { ITEM_WEAPON, "weapon" }, - { ITEM_TREASURE, "treasure" }, - { ITEM_ARMOR, "armor" }, - { ITEM_POTION, "potion" }, - { ITEM_CLOTHING, "clothing" }, - { ITEM_FURNITURE, "furniture" }, - { ITEM_TRASH, "trash" }, - { ITEM_CONTAINER, "container" }, - { ITEM_DRINK_CON, "drink" }, - { ITEM_KEY, "key" }, - { ITEM_FOOD, "food" }, - { ITEM_MONEY, "money" }, - { ITEM_BOAT, "boat" }, - { ITEM_CORPSE_NPC,"npc_corpse" }, - { ITEM_CORPSE_PC, "pc_corpse" }, - { ITEM_FOUNTAIN, "fountain" }, - { ITEM_PILL, "pill" }, - { ITEM_PROTECT, "protect" }, - { ITEM_MAP, "map" }, - { ITEM_PORTAL, "portal" }, - { ITEM_WARP_STONE,"warp_stone" }, - { ITEM_ROOM_KEY, "room_key" }, - { ITEM_GEM, "gem" }, - { ITEM_JEWELRY, "jewelry" }, - { ITEM_JUKEBOX, "jukebox" }, - { 0, NULL } -}; - - -/* weapon selection table */ -const struct weapon_type weapon_table [] = -{ - { "sword", OBJ_VNUM_SCHOOL_SWORD, WEAPON_SWORD, &gsn_sword }, - { "mace", OBJ_VNUM_SCHOOL_MACE, WEAPON_MACE, &gsn_mace }, - { "dagger", OBJ_VNUM_SCHOOL_DAGGER, WEAPON_DAGGER, &gsn_dagger }, - { "axe", OBJ_VNUM_SCHOOL_AXE, WEAPON_AXE, &gsn_axe }, - { "staff", OBJ_VNUM_SCHOOL_STAFF, WEAPON_SPEAR, &gsn_spear }, - { "flail", OBJ_VNUM_SCHOOL_FLAIL, WEAPON_FLAIL, &gsn_flail }, - { "whip", OBJ_VNUM_SCHOOL_WHIP, WEAPON_WHIP, &gsn_whip }, - { "polearm", OBJ_VNUM_SCHOOL_POLEARM,WEAPON_POLEARM, &gsn_polearm }, - { NULL, 0, 0, NULL } -}; - - - -/* wiznet table and prototype for future flag setting */ -const struct wiznet_type wiznet_table [] = -{ - { "on", WIZ_ON, IM }, - { "prefix", WIZ_PREFIX, IM }, - { "ticks", WIZ_TICKS, IM }, - { "logins", WIZ_LOGINS, IM }, - { "sites", WIZ_SITES, L4 }, - { "links", WIZ_LINKS, L7 }, - { "newbies", WIZ_NEWBIE, IM }, - { "spam", WIZ_SPAM, L5 }, - { "deaths", WIZ_DEATHS, IM }, - { "resets", WIZ_RESETS, L4 }, - { "mobdeaths", WIZ_MOBDEATHS, L4 }, - { "flags", WIZ_FLAGS, L5 }, - { "penalties", WIZ_PENALTIES, L5 }, - { "saccing", WIZ_SACCING, L5 }, - { "levels", WIZ_LEVELS, IM }, - { "load", WIZ_LOAD, L2 }, - { "restore", WIZ_RESTORE, L2 }, - { "snoops", WIZ_SNOOPS, L2 }, - { "switches", WIZ_SWITCHES, L2 }, - { "secure", WIZ_SECURE, L1 }, - { NULL, 0, 0 } -}; - -/* attack table -- not very organized :( */ -const struct attack_type attack_table [MAX_DAMAGE_MESSAGE] = -{ - { "none", "hit", -1 }, /* 0 */ - { "slice", "slice", DAM_SLASH }, - { "stab", "stab", DAM_PIERCE }, - { "slash", "slash", DAM_SLASH }, - { "whip", "whip", DAM_SLASH }, - { "claw", "claw", DAM_SLASH }, /* 5 */ - { "blast", "blast", DAM_BASH }, - { "pound", "pound", DAM_BASH }, - { "crush", "crush", DAM_BASH }, - { "grep", "grep", DAM_SLASH }, - { "bite", "bite", DAM_PIERCE }, /* 10 */ - { "pierce", "pierce", DAM_PIERCE }, - { "suction", "suction", DAM_BASH }, - { "beating", "beating", DAM_BASH }, - { "digestion", "digestion", DAM_ACID }, - { "charge", "charge", DAM_BASH }, /* 15 */ - { "slap", "slap", DAM_BASH }, - { "punch", "punch", DAM_BASH }, - { "wrath", "wrath", DAM_ENERGY }, - { "magic", "magic", DAM_ENERGY }, - { "divine", "divine power", DAM_HOLY }, /* 20 */ - { "cleave", "cleave", DAM_SLASH }, - { "scratch", "scratch", DAM_PIERCE }, - { "peck", "peck", DAM_PIERCE }, - { "peckb", "peck", DAM_BASH }, - { "chop", "chop", DAM_SLASH }, /* 25 */ - { "sting", "sting", DAM_PIERCE }, - { "smash", "smash", DAM_BASH }, - { "shbite", "shocking bite",DAM_LIGHTNING }, - { "flbite", "flaming bite", DAM_FIRE }, - { "frbite", "freezing bite", DAM_COLD }, /* 30 */ - { "acbite", "acidic bite", DAM_ACID }, - { "chomp", "chomp", DAM_PIERCE }, - { "drain", "life drain", DAM_NEGATIVE }, - { "thrust", "thrust", DAM_PIERCE }, - { "slime", "slime", DAM_ACID }, - { "shock", "shock", DAM_LIGHTNING }, - { "thwack", "thwack", DAM_BASH }, - { "flame", "flame", DAM_FIRE }, - { "chill", "chill", DAM_COLD }, - { NULL, NULL, 0 } -}; - -/* race table */ -const struct race_type race_table [] = -{ -/* - { - name, pc_race?, - act bits, aff_by bits, off bits, - imm, res, vuln, - form, parts - }, -*/ - { "unique", FALSE, 0, 0, 0, 0, 0, 0, 0, 0 }, - - { - "human", TRUE, - 0, 0, 0, - 0, 0, 0, - A|H|M|V, A|B|C|D|E|F|G|H|I|J|K - }, - - { - "elf", TRUE, - 0, AFF_INFRARED, 0, - 0, RES_CHARM, VULN_IRON, - A|H|M|V, A|B|C|D|E|F|G|H|I|J|K - }, - - { - "dwarf", TRUE, - 0, AFF_INFRARED, 0, - 0, RES_POISON|RES_DISEASE, VULN_DROWNING, - A|H|M|V, A|B|C|D|E|F|G|H|I|J|K - }, - - { - "giant", TRUE, - 0, 0, 0, - 0, RES_FIRE|RES_COLD, VULN_MENTAL|VULN_LIGHTNING, - A|H|M|V, A|B|C|D|E|F|G|H|I|J|K - }, - - { - "bat", FALSE, - 0, AFF_FLYING|AFF_DARK_VISION, OFF_DODGE|OFF_FAST, - 0, 0, VULN_LIGHT, - A|G|V, A|C|D|E|F|H|J|K|P - }, - - { - "bear", FALSE, - 0, 0, OFF_CRUSH|OFF_DISARM|OFF_BERSERK, - 0, RES_BASH|RES_COLD, 0, - A|G|V, A|B|C|D|E|F|H|J|K|U|V - }, - - { - "cat", FALSE, - 0, AFF_DARK_VISION, OFF_FAST|OFF_DODGE, - 0, 0, 0, - A|G|V, A|C|D|E|F|H|J|K|Q|U|V - }, - - { - "centipede", FALSE, - 0, AFF_DARK_VISION, 0, - 0, RES_PIERCE|RES_COLD, VULN_BASH, - A|B|G|O, A|C|K - }, - - { - "dog", FALSE, - 0, 0, OFF_FAST, - 0, 0, 0, - A|G|V, A|C|D|E|F|H|J|K|U|V - }, - - { - "doll", FALSE, - 0, 0, 0, - IMM_COLD|IMM_POISON|IMM_HOLY|IMM_NEGATIVE|IMM_MENTAL|IMM_DISEASE - |IMM_DROWNING, RES_BASH|RES_LIGHT, - VULN_SLASH|VULN_FIRE|VULN_ACID|VULN_LIGHTNING|VULN_ENERGY, - E|J|M|cc, A|B|C|G|H|K - }, - - { "dragon", FALSE, - 0, AFF_INFRARED|AFF_FLYING, 0, - 0, RES_FIRE|RES_BASH|RES_CHARM, - VULN_PIERCE|VULN_COLD, - A|H|Z, A|C|D|E|F|G|H|I|J|K|P|Q|U|V|X - }, - - { - "fido", FALSE, - 0, 0, OFF_DODGE|ASSIST_RACE, - 0, 0, VULN_MAGIC, - A|B|G|V, A|C|D|E|F|H|J|K|Q|V - }, - - { - "fox", FALSE, - 0, AFF_DARK_VISION, OFF_FAST|OFF_DODGE, - 0, 0, 0, - A|G|V, A|C|D|E|F|H|J|K|Q|V - }, - - { - "goblin", FALSE, - 0, AFF_INFRARED, 0, - 0, RES_DISEASE, VULN_MAGIC, - A|H|M|V, A|B|C|D|E|F|G|H|I|J|K - }, - - { - "hobgoblin", FALSE, - 0, AFF_INFRARED, 0, - 0, RES_DISEASE|RES_POISON, 0, - A|H|M|V, A|B|C|D|E|F|G|H|I|J|K|Y - }, - - { - "kobold", FALSE, - 0, AFF_INFRARED, 0, - 0, RES_POISON, VULN_MAGIC, - A|B|H|M|V, A|B|C|D|E|F|G|H|I|J|K|Q - }, - - { - "lizard", FALSE, - 0, 0, 0, - 0, RES_POISON, VULN_COLD, - A|G|X|cc, A|C|D|E|F|H|K|Q|V - }, - - { - "modron", FALSE, - 0, AFF_INFRARED, ASSIST_RACE|ASSIST_ALIGN, - IMM_CHARM|IMM_DISEASE|IMM_MENTAL|IMM_HOLY|IMM_NEGATIVE, - RES_FIRE|RES_COLD|RES_ACID, 0, - H, A|B|C|G|H|J|K - }, - - { - "orc", FALSE, - 0, AFF_INFRARED, 0, - 0, RES_DISEASE, VULN_LIGHT, - A|H|M|V, A|B|C|D|E|F|G|H|I|J|K - }, - - { - "pig", FALSE, - 0, 0, 0, - 0, 0, 0, - A|G|V, A|C|D|E|F|H|J|K - }, - - { - "rabbit", FALSE, - 0, 0, OFF_DODGE|OFF_FAST, - 0, 0, 0, - A|G|V, A|C|D|E|F|H|J|K - }, - - { - "school monster", FALSE, - ACT_NOALIGN, 0, 0, - IMM_CHARM|IMM_SUMMON, 0, VULN_MAGIC, - A|M|V, A|B|C|D|E|F|H|J|K|Q|U - }, - - { - "snake", FALSE, - 0, 0, 0, - 0, RES_POISON, VULN_COLD, - A|G|X|Y|cc, A|D|E|F|K|L|Q|V|X - }, - - { - "song bird", FALSE, - 0, AFF_FLYING, OFF_FAST|OFF_DODGE, - 0, 0, 0, - A|G|W, A|C|D|E|F|H|K|P - }, - - { - "troll", FALSE, - 0, AFF_REGENERATION|AFF_INFRARED|AFF_DETECT_HIDDEN, - OFF_BERSERK, - 0, RES_CHARM|RES_BASH, VULN_FIRE|VULN_ACID, - A|B|H|M|V, A|B|C|D|E|F|G|H|I|J|K|U|V - }, - - { - "water fowl", FALSE, - 0, AFF_SWIM|AFF_FLYING, 0, - 0, RES_DROWNING, 0, - A|G|W, A|C|D|E|F|H|K|P - }, - - { - "wolf", FALSE, - 0, AFF_DARK_VISION, OFF_FAST|OFF_DODGE, - 0, 0, 0, - A|G|V, A|C|D|E|F|J|K|Q|V - }, - - { - "wyvern", FALSE, - 0, AFF_FLYING|AFF_DETECT_INVIS|AFF_DETECT_HIDDEN, - OFF_BASH|OFF_FAST|OFF_DODGE, - IMM_POISON, 0, VULN_LIGHT, - A|B|G|Z, A|C|D|E|F|H|J|K|Q|V|X - }, - - { - "unique", FALSE, - 0, 0, 0, - 0, 0, 0, - 0, 0 - }, - - - { - NULL, 0, 0, 0, 0, 0, 0 - } -}; - -const struct pc_race_type pc_race_table [] = -{ - { "null race", "", 0, { 100, 100, 100, 100 }, - { "" }, { 13, 13, 13, 13, 13 }, { 18, 18, 18, 18, 18 }, 0 }, - -/* - { - "race name", short name, points, { class multipliers }, - { bonus skills }, - { base stats }, { max stats }, size - }, -*/ - { - "human", "Human", 0, { 100, 100, 100, 100 }, - { "" }, - { 13, 13, 13, 13, 13 }, { 18, 18, 18, 18, 18 }, SIZE_MEDIUM - }, - - { - "elf", " Elf ", 5, { 100, 125, 100, 120 }, - { "sneak", "hide" }, - { 12, 14, 13, 15, 11 }, { 16, 20, 18, 21, 15 }, SIZE_SMALL - }, - - { - "dwarf", "Dwarf", 8, { 150, 100, 125, 100 }, - { "berserk" }, - { 14, 12, 14, 10, 15 }, { 20, 16, 19, 14, 21 }, SIZE_MEDIUM - }, - - { - "giant", "Giant", 6, { 200, 150, 150, 105 }, - { "bash", "fast healing" }, - { 16, 11, 13, 11, 14 }, { 22, 15, 18, 15, 20 }, SIZE_LARGE - } -}; - - - - -/* - * Class table. - */ -const struct class_type class_table [MAX_CLASS] = -{ - { - "mage", "Mag", STAT_INT, OBJ_VNUM_SCHOOL_DAGGER, - { 3018, 9618 }, 75, 20, 6, 6, 8, TRUE, - "mage basics", "mage default" - }, - - { - "cleric", "Cle", STAT_WIS, OBJ_VNUM_SCHOOL_MACE, - { 3003, 9619 }, 75, 20, 2, 7, 10, TRUE, - "cleric basics", "cleric default" - }, - - { - "thief", "Thi", STAT_DEX, OBJ_VNUM_SCHOOL_DAGGER, - { 3028, 9639 }, 75, 20, -4, 8, 13, FALSE, - "thief basics", "thief default" - }, - - { - "warrior", "War", STAT_STR, OBJ_VNUM_SCHOOL_SWORD, - { 3022, 9633 }, 75, 20, -10, 11, 15, FALSE, - "warrior basics", "warrior default" - } -}; - - - -/* - * Titles. - */ -char * const title_table [MAX_CLASS][MAX_LEVEL+1][2] = -{ - { - { "Man", "Woman" }, - - { "Apprentice of Magic", "Apprentice of Magic" }, - { "Spell Student", "Spell Student" }, - { "Scholar of Magic", "Scholar of Magic" }, - { "Delver in Spells", "Delveress in Spells" }, - { "Medium of Magic", "Medium of Magic" }, - - { "Scribe of Magic", "Scribess of Magic" }, - { "Seer", "Seeress" }, - { "Sage", "Sage" }, - { "Illusionist", "Illusionist" }, - { "Abjurer", "Abjuress" }, - - { "Invoker", "Invoker" }, - { "Enchanter", "Enchantress" }, - { "Conjurer", "Conjuress" }, - { "Magician", "Witch" }, - { "Creator", "Creator" }, - - { "Savant", "Savant" }, - { "Magus", "Craftess" }, - { "Wizard", "Wizard" }, - { "Warlock", "War Witch" }, - { "Sorcerer", "Sorceress" }, - - { "Elder Sorcerer", "Elder Sorceress" }, - { "Grand Sorcerer", "Grand Sorceress" }, - { "Great Sorcerer", "Great Sorceress" }, - { "Golem Maker", "Golem Maker" }, - { "Greater Golem Maker", "Greater Golem Maker" }, - - { "Maker of Stones", "Maker of Stones", }, - { "Maker of Potions", "Maker of Potions", }, - { "Maker of Scrolls", "Maker of Scrolls", }, - { "Maker of Wands", "Maker of Wands", }, - { "Maker of Staves", "Maker of Staves", }, - - { "Demon Summoner", "Demon Summoner" }, - { "Greater Demon Summoner", "Greater Demon Summoner" }, - { "Dragon Charmer", "Dragon Charmer" }, - { "Greater Dragon Charmer", "Greater Dragon Charmer" }, - { "Master of all Magic", "Master of all Magic" }, - - { "Master Mage", "Master Mage" }, - { "Master Mage", "Master Mage" }, - { "Master Mage", "Master Mage" }, - { "Master Mage", "Master Mage" }, - { "Master Mage", "Master Mage" }, - - { "Master Mage", "Master Mage" }, - { "Master Mage", "Master Mage" }, - { "Master Mage", "Master Mage" }, - { "Master Mage", "Master Mage" }, - { "Master Mage", "Master Mage" }, - - { "Master Mage", "Master Mage" }, - { "Master Mage", "Master Mage" }, - { "Master Mage", "Master Mage" }, - { "Master Mage", "Master Mage" }, - { "Master Mage", "Master Mage" }, - - { "Mage Hero", "Mage Heroine" }, - { "Avatar of Magic", "Avatar of Magic" }, - { "Angel of Magic", "Angel of Magic" }, - { "Demigod of Magic", "Demigoddess of Magic" }, - { "Immortal of Magic", "Immortal of Magic" }, - { "God of Magic", "Goddess of Magic" }, - { "Deity of Magic", "Deity of Magic" }, - { "Supremity of Magic", "Supremity of Magic" }, - { "Creator", "Creator" }, - { "Implementor", "Implementress" } - }, - - { - { "Man", "Woman" }, - - { "Believer", "Believer" }, - { "Attendant", "Attendant" }, - { "Acolyte", "Acolyte" }, - { "Novice", "Novice" }, - { "Missionary", "Missionary" }, - - { "Adept", "Adept" }, - { "Deacon", "Deaconess" }, - { "Vicar", "Vicaress" }, - { "Priest", "Priestess" }, - { "Minister", "Lady Minister" }, - - { "Canon", "Canon" }, - { "Levite", "Levitess" }, - { "Curate", "Curess" }, - { "Monk", "Nun" }, - { "Healer", "Healess" }, - - { "Chaplain", "Chaplain" }, - { "Expositor", "Expositress" }, - { "Bishop", "Bishop" }, - { "Arch Bishop", "Arch Lady of the Church" }, - { "Patriarch", "Matriarch" }, - - { "Elder Patriarch", "Elder Matriarch" }, - { "Grand Patriarch", "Grand Matriarch" }, - { "Great Patriarch", "Great Matriarch" }, - { "Demon Killer", "Demon Killer" }, - { "Greater Demon Killer", "Greater Demon Killer" }, - - { "Cardinal of the Sea", "Cardinal of the Sea" }, - { "Cardinal of the Earth", "Cardinal of the Earth" }, - { "Cardinal of the Air", "Cardinal of the Air" }, - { "Cardinal of the Ether", "Cardinal of the Ether" }, - { "Cardinal of the Heavens", "Cardinal of the Heavens" }, - - { "Avatar of an Immortal", "Avatar of an Immortal" }, - { "Avatar of a Deity", "Avatar of a Deity" }, - { "Avatar of a Supremity", "Avatar of a Supremity" }, - { "Avatar of an Implementor", "Avatar of an Implementor" }, - { "Master of all Divinity", "Mistress of all Divinity" }, - - { "Master Cleric", "Master Cleric" }, - { "Master Cleric", "Master Cleric" }, - { "Master Cleric", "Master Cleric" }, - { "Master Cleric", "Master Cleric" }, - { "Master Cleric", "Master Cleric" }, - - { "Master Cleric", "Master Cleric" }, - { "Master Cleric", "Master Cleric" }, - { "Master Cleric", "Master Cleric" }, - { "Master Cleric", "Master Cleric" }, - { "Master Cleric", "Master Cleric" }, - - { "Master Cleric", "Master Cleric" }, - { "Master Cleric", "Master Cleric" }, - { "Master Cleric", "Master Cleric" }, - { "Master Cleric", "Master Cleric" }, - { "Master Cleric", "Master Cleric" }, - - { "Holy Hero", "Holy Heroine" }, - { "Holy Avatar", "Holy Avatar" }, - { "Angel", "Angel" }, - { "Demigod", "Demigoddess", }, - { "Immortal", "Immortal" }, - { "God", "Goddess" }, - { "Deity", "Deity" }, - { "Supreme Master", "Supreme Mistress" }, - { "Creator", "Creator" }, - { "Implementor", "Implementress" } - }, - - { - { "Man", "Woman" }, - - { "Pilferer", "Pilferess" }, - { "Footpad", "Footpad" }, - { "Filcher", "Filcheress" }, - { "Pick-Pocket", "Pick-Pocket" }, - { "Sneak", "Sneak" }, - - { "Pincher", "Pincheress" }, - { "Cut-Purse", "Cut-Purse" }, - { "Snatcher", "Snatcheress" }, - { "Sharper", "Sharpress" }, - { "Rogue", "Rogue" }, - - { "Robber", "Robber" }, - { "Magsman", "Magswoman" }, - { "Highwayman", "Highwaywoman" }, - { "Burglar", "Burglaress" }, - { "Thief", "Thief" }, - - { "Knifer", "Knifer" }, - { "Quick-Blade", "Quick-Blade" }, - { "Killer", "Murderess" }, - { "Brigand", "Brigand" }, - { "Cut-Throat", "Cut-Throat" }, - - { "Spy", "Spy" }, - { "Grand Spy", "Grand Spy" }, - { "Master Spy", "Master Spy" }, - { "Assassin", "Assassin" }, - { "Greater Assassin", "Greater Assassin" }, - - { "Master of Vision", "Mistress of Vision" }, - { "Master of Hearing", "Mistress of Hearing" }, - { "Master of Smell", "Mistress of Smell" }, - { "Master of Taste", "Mistress of Taste" }, - { "Master of Touch", "Mistress of Touch" }, - - { "Crime Lord", "Crime Mistress" }, - { "Infamous Crime Lord", "Infamous Crime Mistress" }, - { "Greater Crime Lord", "Greater Crime Mistress" }, - { "Master Crime Lord", "Master Crime Mistress" }, - { "Godfather", "Godmother" }, - - { "Master Thief", "Master Thief" }, - { "Master Thief", "Master Thief" }, - { "Master Thief", "Master Thief" }, - { "Master Thief", "Master Thief" }, - { "Master Thief", "Master Thief" }, - - { "Master Thief", "Master Thief" }, - { "Master Thief", "Master Thief" }, - { "Master Thief", "Master Thief" }, - { "Master Thief", "Master Thief" }, - { "Master Thief", "Master Thief" }, - - { "Master Thief", "Master Thief" }, - { "Master Thief", "Master Thief" }, - { "Master Thief", "Master Thief" }, - { "Master Thief", "Master Thief" }, - { "Master Thief", "Master Thief" }, - - { "Assassin Hero", "Assassin Heroine" }, - { "Avatar of Death", "Avatar of Death", }, - { "Angel of Death", "Angel of Death" }, - { "Demigod of Assassins", "Demigoddess of Assassins" }, - { "Immortal Assasin", "Immortal Assassin" }, - { "God of Assassins", "God of Assassins", }, - { "Deity of Assassins", "Deity of Assassins" }, - { "Supreme Master", "Supreme Mistress" }, - { "Creator", "Creator" }, - { "Implementor", "Implementress" } - }, - - { - { "Man", "Woman" }, - - { "Swordpupil", "Swordpupil" }, - { "Recruit", "Recruit" }, - { "Sentry", "Sentress" }, - { "Fighter", "Fighter" }, - { "Soldier", "Soldier" }, - - { "Warrior", "Warrior" }, - { "Veteran", "Veteran" }, - { "Swordsman", "Swordswoman" }, - { "Fencer", "Fenceress" }, - { "Combatant", "Combatess" }, - - { "Hero", "Heroine" }, - { "Myrmidon", "Myrmidon" }, - { "Swashbuckler", "Swashbuckleress" }, - { "Mercenary", "Mercenaress" }, - { "Swordmaster", "Swordmistress" }, - - { "Lieutenant", "Lieutenant" }, - { "Champion", "Lady Champion" }, - { "Dragoon", "Lady Dragoon" }, - { "Cavalier", "Lady Cavalier" }, - { "Knight", "Lady Knight" }, - - { "Grand Knight", "Grand Knight" }, - { "Master Knight", "Master Knight" }, - { "Paladin", "Paladin" }, - { "Grand Paladin", "Grand Paladin" }, - { "Demon Slayer", "Demon Slayer" }, - - { "Greater Demon Slayer", "Greater Demon Slayer" }, - { "Dragon Slayer", "Dragon Slayer" }, - { "Greater Dragon Slayer", "Greater Dragon Slayer" }, - { "Underlord", "Underlord" }, - { "Overlord", "Overlord" }, - - { "Baron of Thunder", "Baroness of Thunder" }, - { "Baron of Storms", "Baroness of Storms" }, - { "Baron of Tornadoes", "Baroness of Tornadoes" }, - { "Baron of Hurricanes", "Baroness of Hurricanes" }, - { "Baron of Meteors", "Baroness of Meteors" }, - - { "Master Warrior", "Master Warrior" }, - { "Master Warrior", "Master Warrior" }, - { "Master Warrior", "Master Warrior" }, - { "Master Warrior", "Master Warrior" }, - { "Master Warrior", "Master Warrior" }, - - { "Master Warrior", "Master Warrior" }, - { "Master Warrior", "Master Warrior" }, - { "Master Warrior", "Master Warrior" }, - { "Master Warrior", "Master Warrior" }, - { "Master Warrior", "Master Warrior" }, - - { "Master Warrior", "Master Warrior" }, - { "Master Warrior", "Master Warrior" }, - { "Master Warrior", "Master Warrior" }, - { "Master Warrior", "Master Warrior" }, - { "Master Warrior", "Master Warrior" }, - - { "Knight Hero", "Knight Heroine" }, - { "Avatar of War", "Avatar of War" }, - { "Angel of War", "Angel of War" }, - { "Demigod of War", "Demigoddess of War" }, - { "Immortal Warlord", "Immortal Warlord" }, - { "God of War", "God of War" }, - { "Deity of War", "Deity of War" }, - { "Supreme Master of War", "Supreme Mistress of War" }, - { "Creator", "Creator" }, - { "Implementor", "Implementress" } - } -}; - - - -/* - * Attribute bonus tables. - */ -const struct str_app_type str_app [26] = -{ - { -5, -4, 0, 0 }, /* 0 */ - { -5, -4, 3, 1 }, /* 1 */ - { -3, -2, 3, 2 }, - { -3, -1, 10, 3 }, /* 3 */ - { -2, -1, 25, 4 }, - { -2, -1, 55, 5 }, /* 5 */ - { -1, 0, 80, 6 }, - { -1, 0, 90, 7 }, - { 0, 0, 100, 8 }, - { 0, 0, 100, 9 }, - { 0, 0, 115, 10 }, /* 10 */ - { 0, 0, 115, 11 }, - { 0, 0, 130, 12 }, - { 0, 0, 130, 13 }, /* 13 */ - { 0, 1, 140, 14 }, - { 1, 1, 150, 15 }, /* 15 */ - { 1, 2, 165, 16 }, - { 2, 3, 180, 22 }, - { 2, 3, 200, 25 }, /* 18 */ - { 3, 4, 225, 30 }, - { 3, 5, 250, 35 }, /* 20 */ - { 4, 6, 300, 40 }, - { 4, 6, 350, 45 }, - { 5, 7, 400, 50 }, - { 5, 8, 450, 55 }, - { 6, 9, 500, 60 } /* 25 */ -}; - - - -const struct int_app_type int_app [26] = -{ - { 3 }, /* 0 */ - { 5 }, /* 1 */ - { 7 }, - { 8 }, /* 3 */ - { 9 }, - { 10 }, /* 5 */ - { 11 }, - { 12 }, - { 13 }, - { 15 }, - { 17 }, /* 10 */ - { 19 }, - { 22 }, - { 25 }, - { 28 }, - { 31 }, /* 15 */ - { 34 }, - { 37 }, - { 40 }, /* 18 */ - { 44 }, - { 49 }, /* 20 */ - { 55 }, - { 60 }, - { 70 }, - { 80 }, - { 85 } /* 25 */ -}; - - - -const struct wis_app_type wis_app [26] = -{ - { 0 }, /* 0 */ - { 0 }, /* 1 */ - { 0 }, - { 0 }, /* 3 */ - { 0 }, - { 1 }, /* 5 */ - { 1 }, - { 1 }, - { 1 }, - { 1 }, - { 1 }, /* 10 */ - { 1 }, - { 1 }, - { 1 }, - { 1 }, - { 2 }, /* 15 */ - { 2 }, - { 2 }, - { 3 }, /* 18 */ - { 3 }, - { 3 }, /* 20 */ - { 3 }, - { 4 }, - { 4 }, - { 4 }, - { 5 } /* 25 */ -}; - - - -const struct dex_app_type dex_app [26] = -{ - { 60 }, /* 0 */ - { 50 }, /* 1 */ - { 50 }, - { 40 }, - { 30 }, - { 20 }, /* 5 */ - { 10 }, - { 0 }, - { 0 }, - { 0 }, - { 0 }, /* 10 */ - { 0 }, - { 0 }, - { 0 }, - { 0 }, - { - 10 }, /* 15 */ - { - 15 }, - { - 20 }, - { - 30 }, - { - 40 }, - { - 50 }, /* 20 */ - { - 60 }, - { - 75 }, - { - 90 }, - { -105 }, - { -120 } /* 25 */ -}; - - -const struct con_app_type con_app [26] = -{ - { -4, 20 }, /* 0 */ - { -3, 25 }, /* 1 */ - { -2, 30 }, - { -2, 35 }, /* 3 */ - { -1, 40 }, - { -1, 45 }, /* 5 */ - { -1, 50 }, - { 0, 55 }, - { 0, 60 }, - { 0, 65 }, - { 0, 70 }, /* 10 */ - { 0, 75 }, - { 0, 80 }, - { 0, 85 }, - { 0, 88 }, - { 1, 90 }, /* 15 */ - { 2, 95 }, - { 2, 97 }, - { 3, 99 }, /* 18 */ - { 3, 99 }, - { 4, 99 }, /* 20 */ - { 4, 99 }, - { 5, 99 }, - { 6, 99 }, - { 7, 99 }, - { 8, 99 } /* 25 */ -}; - - - -/* - * Liquid properties. - * Used in world.obj. - */ -const struct liq_type liq_table [] = -{ -/* name color proof, full, thirst, food, ssize */ - { "water", "clear", { 0, 1, 10, 0, 16 } }, - { "beer", "amber", { 12, 1, 8, 1, 12 } }, - { "red wine", "burgundy", { 30, 1, 8, 1, 5 } }, - { "ale", "brown", { 15, 1, 8, 1, 12 } }, - { "dark ale", "dark", { 16, 1, 8, 1, 12 } }, - - { "whisky", "golden", { 120, 1, 5, 0, 2 } }, - { "lemonade", "pink", { 0, 1, 9, 2, 12 } }, - { "firebreather", "boiling", { 190, 0, 4, 0, 2 } }, - { "local specialty", "clear", { 151, 1, 3, 0, 2 } }, - { "slime mold juice", "green", { 0, 2, -8, 1, 2 } }, - - { "milk", "white", { 0, 2, 9, 3, 12 } }, - { "tea", "tan", { 0, 1, 8, 0, 6 } }, - { "coffee", "black", { 0, 1, 8, 0, 6 } }, - { "blood", "red", { 0, 2, -1, 2, 6 } }, - { "salt water", "clear", { 0, 1, -2, 0, 1 } }, - - { "coke", "brown", { 0, 2, 9, 2, 12 } }, - { "root beer", "brown", { 0, 2, 9, 2, 12 } }, - { "elvish wine", "green", { 35, 2, 8, 1, 5 } }, - { "white wine", "golden", { 28, 1, 8, 1, 5 } }, - { "champagne", "golden", { 32, 1, 8, 1, 5 } }, - - { "mead", "honey-colored",{ 34, 2, 8, 2, 12 } }, - { "rose wine", "pink", { 26, 1, 8, 1, 5 } }, - { "benedictine wine", "burgundy", { 40, 1, 8, 1, 5 } }, - { "vodka", "clear", { 130, 1, 5, 0, 2 } }, - { "cranberry juice", "red", { 0, 1, 9, 2, 12 } }, - - { "orange juice", "orange", { 0, 2, 9, 3, 12 } }, - { "absinthe", "green", { 200, 1, 4, 0, 2 } }, - { "brandy", "golden", { 80, 1, 5, 0, 4 } }, - { "aquavit", "clear", { 140, 1, 5, 0, 2 } }, - { "schnapps", "clear", { 90, 1, 5, 0, 2 } }, - - { "icewine", "purple", { 50, 2, 6, 1, 5 } }, - { "amontillado", "burgundy", { 35, 2, 8, 1, 5 } }, - { "sherry", "red", { 38, 2, 7, 1, 5 } }, - { "framboise", "red", { 50, 1, 7, 1, 5 } }, - { "rum", "amber", { 151, 1, 4, 0, 2 } }, - - { "cordial", "clear", { 100, 1, 5, 0, 2 } }, - { NULL, NULL, { 0, 0, 0, 0, 0 } } -}; - - - -/* - * The skill and spell table. - * Slot numbers must never be changed as they appear in #OBJECTS sections. - */ -#define SLOT(n) n - -const struct skill_type skill_table [MAX_SKILL] = -{ - -/* - * Magic spells. - */ - - { - "reserved", { 99, 99, 99, 99 }, { 99, 99, 99, 99}, - 0, TAR_IGNORE, POS_STANDING, - NULL, SLOT( 0), 0, 0, - "", "", "" - }, - - { - "acid blast", { 28, 53, 35, 32 }, { 1, 1, 2, 2}, - spell_acid_blast, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(70), 20, 12, - "acid blast", "!Acid Blast!" - }, - - { - "armor", { 7, 2, 10, 5 }, { 1, 1, 2, 2}, - spell_armor, TAR_CHAR_DEFENSIVE, POS_STANDING, - NULL, SLOT( 1), 5, 12, - "", "You feel less armored.", "" - }, - - { - "bless", { 53, 7, 53, 8 }, { 1, 1, 2, 2}, - spell_bless, TAR_OBJ_CHAR_DEF, POS_STANDING, - NULL, SLOT( 3), 5, 12, - "", "You feel less righteous.", - "$p's holy aura fades." - }, - - { - "blindness", { 12, 8, 17, 15 }, { 1, 1, 2, 2}, - spell_blindness, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - &gsn_blindness, SLOT( 4), 5, 12, - "", "You can see again.", "" - }, - - { - "burning hands", { 7, 53, 10, 9 }, { 1, 1, 2, 2}, - spell_burning_hands, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT( 5), 15, 12, - "burning hands", "!Burning Hands!", "" - }, - - { - "call lightning", { 26, 18, 31, 22 }, { 1, 1, 2, 2}, - spell_call_lightning, TAR_IGNORE, POS_FIGHTING, - NULL, SLOT( 6), 15, 12, - "lightning bolt", "!Call Lightning!", "" - }, - - { "calm", { 48, 16, 50, 20 }, { 1, 1, 2, 2}, - spell_calm, TAR_IGNORE, POS_FIGHTING, - NULL, SLOT(509), 30, 12, - "", "You have lost your peace of mind.", "" - }, - - { - "cancellation", { 18, 26, 34, 34 }, { 1, 1, 2, 2}, - spell_cancellation, TAR_CHAR_DEFENSIVE, POS_FIGHTING, - NULL, SLOT(507), 20, 12, - "" "!cancellation!", "" - }, - - { - "cause critical", { 53, 13, 53, 19 }, { 1, 1, 2, 2}, - spell_cause_critical, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(63), 20, 12, - "spell", "!Cause Critical!", "" - }, - - { - "cause light", { 53, 1, 53, 3 }, { 1, 1, 2, 2}, - spell_cause_light, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(62), 15, 12, - "spell", "!Cause Light!", "" - }, - - { - "cause serious", { 53, 7, 53, 10 }, { 1, 1, 2, 2}, - spell_cause_serious, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(64), 17, 12, - "spell", "!Cause Serious!", "" - }, - - { - "chain lightning", { 33, 53, 39, 36 }, { 1, 1, 2, 2}, - spell_chain_lightning, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(500), 25, 12, - "lightning", "!Chain Lightning!", "" - }, - - { - "change sex", { 53, 53, 53, 53 }, { 1, 1, 2, 2}, - spell_change_sex, TAR_CHAR_DEFENSIVE, POS_FIGHTING, - NULL, SLOT(82), 15, 12, - "", "Your body feels familiar again.", "" - }, - - { - "charm person", { 20, 53, 25, 53 }, { 1, 1, 2, 2}, - spell_charm_person, TAR_CHAR_OFFENSIVE, POS_STANDING, - &gsn_charm_person, SLOT( 7), 5, 12, - "", "You feel more self-confident.", "" - }, - - { - "chill touch", { 4, 53, 6, 6 }, { 1, 1, 2, 2}, - spell_chill_touch, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT( 8), 15, 12, - "chilling touch", "You feel less cold.", "" - }, - - { - "colour spray", { 16, 53, 22, 20 }, { 1, 1, 2, 2}, - spell_colour_spray, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(10), 15, 12, - "colour spray", "!Colour Spray!", "" - }, - - { - "continual light", { 6, 4, 6, 9 }, { 1, 1, 2, 2}, - spell_continual_light, TAR_IGNORE, POS_STANDING, - NULL, SLOT(57), 7, 12, - "", "!Continual Light!", "" - }, - - { - "control weather", { 15, 19, 28, 22 }, { 1, 1, 2, 2}, - spell_control_weather, TAR_IGNORE, POS_STANDING, - NULL, SLOT(11), 25, 12, - "", "!Control Weather!", "" - }, - - { - "create food", { 10, 5, 11, 12 }, { 1, 1, 2, 2}, - spell_create_food, TAR_IGNORE, POS_STANDING, - NULL, SLOT(12), 5, 12, - "", "!Create Food!", "" - }, - - { - "create rose", { 16, 11, 10, 24 }, { 1, 1, 2, 2 }, - spell_create_rose, TAR_IGNORE, POS_STANDING, - NULL, SLOT(511), 30, 12, - "", "!Create Rose!", "" - }, - - { - "create spring", { 14, 17, 23, 20 }, { 1, 1, 2, 2}, - spell_create_spring, TAR_IGNORE, POS_STANDING, - NULL, SLOT(80), 20, 12, - "", "!Create Spring!", "" - }, - - { - "create water", { 8, 3, 12, 11 }, { 1, 1, 2, 2}, - spell_create_water, TAR_OBJ_INV, POS_STANDING, - NULL, SLOT(13), 5, 12, - "", "!Create Water!", "" - }, - - { - "cure blindness", { 53, 6, 53, 8 }, { 1, 1, 2, 2}, - spell_cure_blindness, TAR_CHAR_DEFENSIVE, POS_FIGHTING, - NULL, SLOT(14), 5, 12, - "", "!Cure Blindness!", "" - }, - - { - "cure critical", { 53, 13, 53, 19 }, { 1, 1, 2, 2}, - spell_cure_critical, TAR_CHAR_DEFENSIVE, POS_FIGHTING, - NULL, SLOT(15), 20, 12, - "", "!Cure Critical!", "" - }, - - { - "cure disease", { 53, 13, 53, 14 }, { 1, 1, 2, 2}, - spell_cure_disease, TAR_CHAR_DEFENSIVE, POS_STANDING, - NULL, SLOT(501), 20, 12, - "", "!Cure Disease!", "" - }, - - { - "cure light", { 53, 1, 53, 3 }, { 1, 1, 2, 2}, - spell_cure_light, TAR_CHAR_DEFENSIVE, POS_FIGHTING, - NULL, SLOT(16), 10, 12, - "", "!Cure Light!", "" - }, - - { - "cure poison", { 53, 14, 53, 16 }, { 1, 1, 2, 2}, - spell_cure_poison, TAR_CHAR_DEFENSIVE, POS_STANDING, - NULL, SLOT(43), 5, 12, - "", "!Cure Poison!", "" - }, - - { - "cure serious", { 53, 7, 53, 10 }, { 1, 1, 2, 2}, - spell_cure_serious, TAR_CHAR_DEFENSIVE, POS_FIGHTING, - NULL, SLOT(61), 15, 12, - "", "!Cure Serious!", "" - }, - - { - "curse", { 18, 18, 26, 22 }, { 1, 1, 2, 2}, - spell_curse, TAR_OBJ_CHAR_OFF, POS_FIGHTING, - &gsn_curse, SLOT(17), 20, 12, - "curse", "The curse wears off.", - "$p is no longer impure." - }, - - { - "demonfire", { 53, 34, 53, 45 }, { 1, 1, 2, 2}, - spell_demonfire, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(505), 20, 12, - "torments", "!Demonfire!", "" - }, - - { - "detect evil", { 11, 4, 12, 53 }, { 1, 1, 2, 2}, - spell_detect_evil, TAR_CHAR_SELF, POS_STANDING, - NULL, SLOT(18), 5, 12, - "", "The red in your vision disappears.", "" - }, - - { - "detect good", { 11, 4, 12, 53 }, { 1, 1, 2, 2}, - spell_detect_good, TAR_CHAR_SELF, POS_STANDING, - NULL, SLOT(513), 5, 12, - "", "The gold in your vision disappears.", "" - }, - - { - "detect hidden", { 15, 11, 12, 53 }, { 1, 1, 2, 2}, - spell_detect_hidden, TAR_CHAR_SELF, POS_STANDING, - NULL, SLOT(44), 5, 12, - "", "You feel less aware of your surroundings.", - "" - }, - - { - "detect invis", { 3, 8, 6, 53 }, { 1, 1, 2, 2}, - spell_detect_invis, TAR_CHAR_SELF, POS_STANDING, - NULL, SLOT(19), 5, 12, - "", "You no longer see invisible objects.", - "" - }, - - { - "detect magic", { 2, 6, 5, 53 }, { 1, 1, 2, 2}, - spell_detect_magic, TAR_CHAR_SELF, POS_STANDING, - NULL, SLOT(20), 5, 12, - "", "The detect magic wears off.", "" - }, - - { - "detect poison", { 15, 7, 9, 53 }, { 1, 1, 2, 2}, - spell_detect_poison, TAR_OBJ_INV, POS_STANDING, - NULL, SLOT(21), 5, 12, - "", "!Detect Poison!", "" - }, - - { - "dispel evil", { 53, 15, 53, 21 }, { 1, 1, 2, 2}, - spell_dispel_evil, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(22), 15, 12, - "dispel evil", "!Dispel Evil!", "" - }, - - { - "dispel good", { 53, 15, 53, 21 }, { 1, 1, 2, 2}, - spell_dispel_good, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(512), 15, 12, - "dispel good", "!Dispel Good!", "" - }, - - { - "dispel magic", { 16, 24, 30, 30 }, { 1, 1, 2, 2}, - spell_dispel_magic, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(59), 15, 12, - "", "!Dispel Magic!", "" - }, - - { - "earthquake", { 53, 10, 53, 14 }, { 1, 1, 2, 2}, - spell_earthquake, TAR_IGNORE, POS_FIGHTING, - NULL, SLOT(23), 15, 12, - "earthquake", "!Earthquake!", "" - }, - - { - "enchant armor", { 16, 53, 53, 53 }, { 2, 2, 4, 4 }, - spell_enchant_armor, TAR_OBJ_INV, POS_STANDING, - NULL, SLOT(510), 100, 24, - "", "!Enchant Armor!", "" - }, - - { - "enchant weapon", { 17, 53, 53, 53 }, { 2, 2, 4, 4}, - spell_enchant_weapon, TAR_OBJ_INV, POS_STANDING, - NULL, SLOT(24), 100, 24, - "", "!Enchant Weapon!", "" - }, - - { - "energy drain", { 19, 22, 26, 23 }, { 1, 1, 2, 2}, - spell_energy_drain, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(25), 35, 12, - "energy drain", "!Energy Drain!", "" - }, - - { - "faerie fire", { 6, 3, 5, 8 }, { 1, 1, 2, 2}, - spell_faerie_fire, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(72), 5, 12, - "faerie fire", "The pink aura around you fades away.", - "" - }, - - { - "faerie fog", { 14, 21, 16, 24 }, { 1, 1, 2, 2}, - spell_faerie_fog, TAR_IGNORE, POS_STANDING, - NULL, SLOT(73), 12, 12, - "faerie fog", "!Faerie Fog!", "" - }, - - { - "farsight", { 14, 16, 16, 53 }, { 1, 1, 2, 2}, - spell_farsight, TAR_IGNORE, POS_STANDING, - NULL, SLOT(521), 36, 20, - "farsight", "!Farsight!", "" - }, - - { - "fireball", { 22, 53, 30, 26 }, { 1, 1, 2, 2}, - spell_fireball, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(26), 15, 12, - "fireball", "!Fireball!", "" - }, - - { - "fireproof", { 13, 12, 19, 18 }, { 1, 1, 2, 2}, - spell_fireproof, TAR_OBJ_INV, POS_STANDING, - NULL, SLOT(523), 10, 12, - "", "", "$p's protective aura fades." - }, - - { - "flamestrike", { 53, 20, 53, 27 }, { 1, 1, 2, 2}, - spell_flamestrike, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(65), 20, 12, - "flamestrike", "!Flamestrike!", "" - }, - - { - "fly", { 10, 18, 20, 22 }, { 1, 1, 2, 2}, - spell_fly, TAR_CHAR_DEFENSIVE, POS_STANDING, - NULL, SLOT(56), 10, 18, - "", "You slowly float to the ground.", "" - }, - - { - "floating disc", { 4, 10, 7, 16 }, { 1, 1, 2, 2}, - spell_floating_disc, TAR_IGNORE, POS_STANDING, - NULL, SLOT(522), 40, 24, - "", "!Floating disc!", "" - }, - - { - "frenzy", { 53, 24, 53, 26 }, { 1, 1, 2, 2}, - spell_frenzy, TAR_CHAR_DEFENSIVE, POS_STANDING, - NULL, SLOT(504), 30, 24, - "", "Your rage ebbs.", "" - }, - - { - "gate", { 27, 17, 32, 28 }, { 1, 1, 2, 2}, - spell_gate, TAR_IGNORE, POS_FIGHTING, - NULL, SLOT(83), 80, 12, - "", "!Gate!", "" - }, - - { - "giant strength", { 11, 53, 22, 20 }, { 1, 1, 2, 2}, - spell_giant_strength, TAR_CHAR_DEFENSIVE, POS_STANDING, - NULL, SLOT(39), 20, 12, - "", "You feel weaker.", "" - }, - - { - "harm", { 53, 23, 53, 28 }, { 1, 1, 2, 2}, - spell_harm, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(27), 35, 12, - "harm spell", "!Harm!, """ - }, - - { - "haste", { 21, 53, 26, 29 }, { 1, 1, 2, 2}, - spell_haste, TAR_CHAR_DEFENSIVE, POS_FIGHTING, - NULL, SLOT(502), 30, 12, - "", "You feel yourself slow down.", "" - }, - - { - "heal", { 53, 21, 33, 30 }, { 1, 1, 2, 2}, - spell_heal, TAR_CHAR_DEFENSIVE, POS_FIGHTING, - NULL, SLOT(28), 50, 12, - "", "!Heal!", "" - }, - - { - "heat metal", { 53, 16, 53, 23 }, { 1, 1, 2, 2 }, - spell_heat_metal, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(516), 25, 18, - "spell", "!Heat Metal!", "" - }, - - { - "holy word", { 53, 36, 53, 42 }, { 2, 2, 4, 4}, - spell_holy_word, TAR_IGNORE, POS_FIGHTING, - NULL, SLOT(506), 200, 24, - "divine wrath", "!Holy Word!", "" - }, - - { - "identify", { 15, 16, 18, 53 }, { 1, 1, 2, 2}, - spell_identify, TAR_OBJ_INV, POS_STANDING, - NULL, SLOT(53), 12, 24, - "", "!Identify!", "" - }, - - { - "infravision", { 9, 13, 10, 16 }, { 1, 1, 2, 2}, - spell_infravision, TAR_CHAR_DEFENSIVE, POS_STANDING, - NULL, SLOT(77), 5, 18, - "", "You no longer see in the dark.", "" - }, - - { - "invisibility", { 5, 53, 9, 53 }, { 1, 1, 2, 2}, - spell_invis, TAR_OBJ_CHAR_DEF, POS_STANDING, - &gsn_invis, SLOT(29), 5, 12, - "", "You are no longer invisible.", - "$p fades into view." - }, - - { - "know alignment", { 12, 9, 20, 53 }, { 1, 1, 2, 2}, - spell_know_alignment, TAR_CHAR_DEFENSIVE, POS_FIGHTING, - NULL, SLOT(58), 9, 12, - "", "!Know Alignment!", "" - }, - - { - "lightning bolt", { 13, 23, 18, 16 }, { 1, 1, 2, 2}, - spell_lightning_bolt, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(30), 15, 12, - "lightning bolt", "!Lightning Bolt!", "" - }, - - { - "locate object", { 9, 15, 11, 53 }, { 1, 1, 2, 2}, - spell_locate_object, TAR_IGNORE, POS_STANDING, - NULL, SLOT(31), 20, 18, - "", "!Locate Object!", "" - }, - - { - "magic missile", { 1, 53, 2, 2 }, { 1, 1, 2, 2}, - spell_magic_missile, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(32), 15, 12, - "magic missile", "!Magic Missile!", "" - }, - - { - "mass healing", { 53, 38, 53, 46 }, { 2, 2, 4, 4}, - spell_mass_healing, TAR_IGNORE, POS_STANDING, - NULL, SLOT(508), 100, 36, - "", "!Mass Healing!", "" - }, - - { - "mass invis", { 22, 25, 31, 53 }, { 1, 1, 2, 2}, - spell_mass_invis, TAR_IGNORE, POS_STANDING, - &gsn_mass_invis, SLOT(69), 20, 24, - "", "You are no longer invisible.", "" - }, - - { - "nexus", { 40, 35, 50, 45 }, { 2, 2, 4, 4}, - spell_nexus, TAR_IGNORE, POS_STANDING, - NULL, SLOT(520), 150, 36, - "", "!Nexus!", "" - }, - - { - "pass door", { 24, 32, 25, 37 }, { 1, 1, 2, 2}, - spell_pass_door, TAR_CHAR_SELF, POS_STANDING, - NULL, SLOT(74), 20, 12, - "", "You feel solid again.", "" - }, - - { - "plague", { 23, 17, 36, 26 }, { 1, 1, 2, 2}, - spell_plague, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - &gsn_plague, SLOT(503), 20, 12, - "sickness", "Your sores vanish.", "" - }, - - { - "poison", { 17, 12, 15, 21 }, { 1, 1, 2, 2}, - spell_poison, TAR_OBJ_CHAR_OFF, POS_FIGHTING, - &gsn_poison, SLOT(33), 10, 12, - "poison", "You feel less sick.", - "The poison on $p dries up." - }, - - { - "portal", { 35, 30, 45, 40 }, { 2, 2, 4, 4}, - spell_portal, TAR_IGNORE, POS_STANDING, - NULL, SLOT(519), 100, 24, - "", "!Portal!", "" - }, - - { - "protection evil", { 12, 9, 17, 11 }, { 1, 1, 2, 2}, - spell_protection_evil, TAR_CHAR_SELF, POS_STANDING, - NULL, SLOT(34), 5, 12, - "", "You feel less protected.", "" - }, - - { - "protection good", { 12, 9, 17, 11 }, { 1, 1, 2, 2}, - spell_protection_good, TAR_CHAR_SELF, POS_STANDING, - NULL, SLOT(514), 5, 12, - "", "You feel less protected.", "" - }, - - { - "ray of truth", { 53, 35, 53, 47 }, { 1, 1, 2, 2}, - spell_ray_of_truth, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(518), 20, 12, - "ray of truth", "!Ray of Truth!", "" - }, - - { - "recharge", { 9, 53, 53, 53 }, { 1, 1, 2, 2 }, - spell_recharge, TAR_OBJ_INV, POS_STANDING, - NULL, SLOT(517), 60, 24, - "", "!Recharge!", "" - }, - - { - "refresh", { 8, 5, 12, 9 }, { 1, 1, 2, 2}, - spell_refresh, TAR_CHAR_DEFENSIVE, POS_STANDING, - NULL, SLOT(81), 12, 18, - "refresh", "!Refresh!", "" - }, - - { - "remove curse", { 53, 18, 53, 22 }, { 1, 1, 2, 2}, - spell_remove_curse, TAR_OBJ_CHAR_DEF, POS_STANDING, - NULL, SLOT(35), 5, 12, - "", "!Remove Curse!", "" - }, - - { - "sanctuary", { 36, 20, 42, 30 }, { 1, 1, 2, 2}, - spell_sanctuary, TAR_CHAR_DEFENSIVE, POS_STANDING, - &gsn_sanctuary, SLOT(36), 75, 12, - "", "The white aura around your body fades.", - "" - }, - - { - "shield", { 20, 35, 35, 40 }, { 1, 1, 2, 2}, - spell_shield, TAR_CHAR_DEFENSIVE, POS_STANDING, - NULL, SLOT(67), 12, 18, - "", "Your force shield shimmers then fades away.", - "" - }, - - { - "shocking grasp", { 10, 53, 14, 13 }, { 1, 1, 2, 2}, - spell_shocking_grasp, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(53), 15, 12, - "shocking grasp", "!Shocking Grasp!", "" - }, - - { - "sleep", { 10, 53, 11, 53 }, { 1, 1, 2, 2}, - spell_sleep, TAR_CHAR_OFFENSIVE, POS_STANDING, - &gsn_sleep, SLOT(38), 15, 12, - "", "You feel less tired.", "" - }, - - { - "slow", { 23, 30, 29, 32 }, { 1, 1, 2, 2}, - spell_slow, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(515), 30, 12, - "", "You feel yourself speed up.", "" - }, - - { - "stone skin", { 25, 40, 40, 45 }, { 1, 1, 2, 2}, - spell_stone_skin, TAR_CHAR_SELF, POS_STANDING, - NULL, SLOT(66), 12, 18, - "", "Your skin feels soft again.", "" - }, - - { - "summon", { 24, 12, 29, 22 }, { 1, 1, 2, 2}, - spell_summon, TAR_IGNORE, POS_STANDING, - NULL, SLOT(40), 50, 12, - "", "!Summon!", "" - }, - - { - "teleport", { 13, 22, 25, 36 }, { 1, 1, 2, 2}, - spell_teleport, TAR_CHAR_SELF, POS_FIGHTING, - NULL, SLOT( 2), 35, 12, - "", "!Teleport!", "" - }, - - { - "ventriloquate", { 1, 53, 2, 53 }, { 1, 1, 2, 2}, - spell_ventriloquate, TAR_IGNORE, POS_STANDING, - NULL, SLOT(41), 5, 12, - "", "!Ventriloquate!", "" - }, - - { - "weaken", { 11, 14, 16, 17 }, { 1, 1, 2, 2}, - spell_weaken, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(68), 20, 12, - "spell", "You feel stronger.", "" - }, - - { - "word of recall", { 32, 28, 40, 30 }, { 1, 1, 2, 2}, - spell_word_of_recall, TAR_CHAR_SELF, POS_RESTING, - NULL, SLOT(42), 5, 12, - "", "!Word of Recall!", "" - }, - -/* - * Dragon breath - */ - { - "acid breath", { 31, 32, 33, 34 }, { 1, 1, 2, 2}, - spell_acid_breath, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(200), 100, 24, - "blast of acid", "!Acid Breath!", "" - }, - - { - "fire breath", { 40, 45, 50, 51 }, { 1, 1, 2, 2}, - spell_fire_breath, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(201), 200, 24, - "blast of flame", "The smoke leaves your eyes.", "" - }, - - { - "frost breath", { 34, 36, 38, 40 }, { 1, 1, 2, 2}, - spell_frost_breath, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(202), 125, 24, - "blast of frost", "!Frost Breath!", "" - }, - - { - "gas breath", { 39, 43, 47, 50 }, { 1, 1, 2, 2}, - spell_gas_breath, TAR_IGNORE, POS_FIGHTING, - NULL, SLOT(203), 175, 24, - "blast of gas", "!Gas Breath!", "" - }, - - { - "lightning breath", { 37, 40, 43, 46 }, { 1, 1, 2, 2}, - spell_lightning_breath, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(204), 150, 24, - "blast of lightning", "!Lightning Breath!", "" - }, - -/* - * Spells for mega1.are from Glop/Erkenbrand. - */ - { - "general purpose", { 53, 53, 53, 53 }, { 0, 0, 0, 0 }, - spell_general_purpose, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(401), 0, 12, - "general purpose ammo", "!General Purpose Ammo!", "" - }, - - { - "high explosive", { 53, 53, 53, 53 }, { 0, 0, 0, 0 }, - spell_high_explosive, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(402), 0, 12, - "high explosive ammo", "!High Explosive Ammo!", "" - }, - - -/* combat and weapons skills */ - - - { - "axe", { 1, 1, 1, 1 }, { 6, 6, 5, 4}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_axe, SLOT( 0), 0, 0, - "", "!Axe!", "" - }, - - { - "dagger", { 1, 1, 1, 1 }, { 2, 3, 2, 2}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_dagger, SLOT( 0), 0, 0, - "", "!Dagger!", "" - }, - - { - "flail", { 1, 1, 1, 1 }, { 6, 3, 6, 4}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_flail, SLOT( 0), 0, 0, - "", "!Flail!", "" - }, - - { - "mace", { 1, 1, 1, 1 }, { 5, 2, 3, 3}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_mace, SLOT( 0), 0, 0, - "", "!Mace!", "" - }, - - { - "polearm", { 1, 1, 1, 1 }, { 6, 6, 6, 4}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_polearm, SLOT( 0), 0, 0, - "", "!Polearm!", "" - }, - - { - "shield block", { 1, 1, 1, 1 }, { 6, 4, 6, 2}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_shield_block, SLOT(0), 0, 0, - "", "!Shield!", "" - }, - - { - "spear", { 1, 1, 1, 1 }, { 4, 4, 4, 3}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_spear, SLOT( 0), 0, 0, - "", "!Spear!", "" - }, - - { - "sword", { 1, 1, 1, 1}, { 5, 6, 3, 2}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_sword, SLOT( 0), 0, 0, - "", "!sword!", "" - }, - - { - "whip", { 1, 1, 1, 1}, { 6, 5, 5, 4}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_whip, SLOT( 0), 0, 0, - "", "!Whip!", "" - }, - - { - "backstab", { 53, 53, 1, 53 }, { 0, 0, 5, 0}, - spell_null, TAR_IGNORE, POS_STANDING, - &gsn_backstab, SLOT( 0), 0, 24, - "backstab", "!Backstab!", "" - }, - - { - "bash", { 53, 53, 53, 1 }, { 0, 0, 0, 4}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_bash, SLOT( 0), 0, 24, - "bash", "!Bash!", "" - }, - - { - "berserk", { 53, 53, 53, 18 }, { 0, 0, 0, 5}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_berserk, SLOT( 0), 0, 24, - "", "You feel your pulse slow down.", "" - }, - - { - "dirt kicking", { 53, 53, 3, 3 }, { 0, 0, 4, 4}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_dirt, SLOT( 0), 0, 24, - "kicked dirt", "You rub the dirt out of your eyes.", "" - }, - - { - "disarm", { 53, 53, 12, 11 }, { 0, 0, 6, 4}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_disarm, SLOT( 0), 0, 24, - "", "!Disarm!", "" - }, - - { - "dodge", { 20, 22, 1, 13 }, { 8, 8, 4, 6}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_dodge, SLOT( 0), 0, 0, - "", "!Dodge!", "" - }, - - { - "enhanced damage", { 45, 30, 25, 1 }, { 10, 9, 5, 3}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_enhanced_damage, SLOT( 0), 0, 0, - "", "!Enhanced Damage!", "" - }, - - { - "envenom", { 53, 53, 10, 53 }, { 0, 0, 4, 0 }, - spell_null, TAR_IGNORE, POS_RESTING, - &gsn_envenom, SLOT(0), 0, 36, - "", "!Envenom!", "" - }, - - { - "hand to hand", { 25, 10, 15, 6 }, { 8, 5, 6, 4}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_hand_to_hand, SLOT( 0), 0, 0, - "", "!Hand to Hand!", "" - }, - - { - "kick", { 53, 12, 14, 8 }, { 0, 4, 6, 3}, - spell_null, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - &gsn_kick, SLOT( 0), 0, 12, - "kick", "!Kick!", "" - }, - - { - "parry", { 22, 20, 13, 1 }, { 8, 8, 6, 4}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_parry, SLOT( 0), 0, 0, - "", "!Parry!", "" - }, - - { - "rescue", { 53, 53, 53, 1 }, { 0, 0, 0, 4}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_rescue, SLOT( 0), 0, 12, - "", "!Rescue!", "" - }, - - { - "trip", { 53, 53, 1, 15 }, { 0, 0, 4, 8}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_trip, SLOT( 0), 0, 24, - "trip", "!Trip!", "" - }, - - { - "second attack", { 30, 24, 12, 5 }, { 10, 8, 5, 3}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_second_attack, SLOT( 0), 0, 0, - "", "!Second Attack!", "" - }, - - { - "third attack", { 53, 53, 24, 12 }, { 0, 0, 10, 4}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_third_attack, SLOT( 0), 0, 0, - "", "!Third Attack!", "" - }, - -/* non-combat skills */ - - { - "fast healing", { 15, 9, 16, 6 }, { 8, 5, 6, 4}, - spell_null, TAR_IGNORE, POS_SLEEPING, - &gsn_fast_healing, SLOT( 0), 0, 0, - "", "!Fast Healing!", "" - }, - - { - "haggle", { 7, 18, 1, 14 }, { 5, 8, 3, 6}, - spell_null, TAR_IGNORE, POS_RESTING, - &gsn_haggle, SLOT( 0), 0, 0, - "", "!Haggle!", "" - }, - - { - "hide", { 53, 53, 1, 12 }, { 0, 0, 4, 6}, - spell_null, TAR_IGNORE, POS_RESTING, - &gsn_hide, SLOT( 0), 0, 12, - "", "!Hide!", "" - }, - - { - "lore", { 10, 10, 6, 20 }, { 6, 6, 4, 8}, - spell_null, TAR_IGNORE, POS_RESTING, - &gsn_lore, SLOT( 0), 0, 36, - "", "!Lore!", "" - }, - - { - "meditation", { 6, 6, 15, 15 }, { 5, 5, 8, 8}, - spell_null, TAR_IGNORE, POS_SLEEPING, - &gsn_meditation, SLOT( 0), 0, 0, - "", "Meditation", "" - }, - - { - "peek", { 8, 21, 1, 14 }, { 5, 7, 3, 6}, - spell_null, TAR_IGNORE, POS_STANDING, - &gsn_peek, SLOT( 0), 0, 0, - "", "!Peek!", "" - }, - - { - "pick lock", { 25, 25, 7, 25 }, { 8, 8, 4, 8}, - spell_null, TAR_IGNORE, POS_STANDING, - &gsn_pick_lock, SLOT( 0), 0, 12, - "", "!Pick!", "" - }, - - { - "sneak", { 53, 53, 4, 10 }, { 0, 0, 4, 6}, - spell_null, TAR_IGNORE, POS_STANDING, - &gsn_sneak, SLOT( 0), 0, 12, - "", "You no longer feel stealthy.", "" - }, - - { - "steal", { 53, 53, 5, 53 }, { 0, 0, 4, 0}, - spell_null, TAR_IGNORE, POS_STANDING, - &gsn_steal, SLOT( 0), 0, 24, - "", "!Steal!", "" - }, - - { - "scrolls", { 1, 1, 1, 1 }, { 2, 3, 5, 8}, - spell_null, TAR_IGNORE, POS_STANDING, - &gsn_scrolls, SLOT( 0), 0, 24, - "", "!Scrolls!", "" - }, - - { - "staves", { 1, 1, 1, 1 }, { 2, 3, 5, 8}, - spell_null, TAR_IGNORE, POS_STANDING, - &gsn_staves, SLOT( 0), 0, 12, - "", "!Staves!", "" - }, - - { - "wands", { 1, 1, 1, 1 }, { 2, 3, 5, 8}, - spell_null, TAR_IGNORE, POS_STANDING, - &gsn_wands, SLOT( 0), 0, 12, - "", "!Wands!", "" - }, - - { - "recall", { 1, 1, 1, 1 }, { 2, 2, 2, 2}, - spell_null, TAR_IGNORE, POS_STANDING, - &gsn_recall, SLOT( 0), 0, 12, - "", "!Recall!", "" - } -}; - -const struct group_type group_table [MAX_GROUP] = -{ - - { - "rom basics", { 0, 0, 0, 0 }, - { "scrolls", "staves", "wands", "recall" } - }, - - { - "mage basics", { 0, -1, -1, -1 }, - { "dagger" } - }, - - { - "cleric basics", { -1, 0, -1, -1 }, - { "mace" } - }, - - { - "thief basics", { -1, -1, 0, -1 }, - { "dagger", "steal" } - }, - - { - "warrior basics", { -1, -1, -1, 0 }, - { "sword", "second attack" } - }, - - { - "mage default", { 40, -1, -1, -1 }, - { "lore", "beguiling", "combat", "detection", "enhancement", "illusion", - "maladictions", "protective", "transportation", "weather" } - }, - - { - "cleric default", { -1, 40, -1, -1 }, - { "flail", "attack", "creation", "curative", "benedictions", - "detection", "healing", "maladictions", "protective", "shield block", - "transportation", "weather" } - }, - - { - "thief default", { -1, -1, 40, -1 }, - { "mace", "sword", "backstab", "disarm", "dodge", "second attack", - "trip", "hide", "peek", "pick lock", "sneak" } - }, - - { - "warrior default", { -1, -1, -1, 40 }, - { "weaponsmaster", "shield block", "bash", "disarm", "enhanced damage", - "parry", "rescue", "third attack" } - }, - - { - "weaponsmaster", { 40, 40, 40, 20 }, - { "axe", "dagger", "flail", "mace", "polearm", "spear", "sword","whip" } - }, - - { - "attack", { -1, 5, -1, 8 }, - { "demonfire", "dispel evil", "dispel good", "earthquake", - "flamestrike", "heat metal", "ray of truth" } - }, - - { - "beguiling", { 4, -1, 6, -1 }, - { "calm", "charm person", "sleep" } - }, - - { - "benedictions", { -1, 4, -1, 8 }, - { "bless", "calm", "frenzy", "holy word", "remove curse" } - }, - - { - "combat", { 6, -1, 10, 9 }, - { "acid blast", "burning hands", "chain lightning", "chill touch", - "colour spray", "fireball", "lightning bolt", "magic missile", - "shocking grasp" } - }, - - { - "creation", { 4, 4, 8, 8 }, - { "continual light", "create food", "create spring", "create water", - "create rose", "floating disc" } - }, - - { - "curative", { -1, 4, -1, 8 }, - { "cure blindness", "cure disease", "cure poison" } - }, - - { - "detection", { 4, 3, 6, -1 }, - { "detect evil", "detect good", "detect hidden", "detect invis", - "detect magic", "detect poison", "farsight", "identify", - "know alignment", "locate object" } - }, - - { - "draconian", { 8, -1, -1, -1 }, - { "acid breath", "fire breath", "frost breath", "gas breath", - "lightning breath" } - }, - - { - "enchantment", { 6, -1, -1, -1 }, - { "enchant armor", "enchant weapon", "fireproof", "recharge" } - }, - - { - "enhancement", { 5, -1, 9, 9 }, - { "giant strength", "haste", "infravision", "refresh" } - }, - - { - "harmful", { -1, 3, -1, 6 }, - { "cause critical", "cause light", "cause serious", "harm" } - }, - - { - "healing", { -1, 3, -1, 6 }, - { "cure critical", "cure light", "cure serious", "heal", - "mass healing", "refresh" } - }, - - { - "illusion", { 4, -1, 7, -1 }, - { "invis", "mass invis", "ventriloquate" } - }, - - { - "maladictions", { 5, 5, 9, 9 }, - { "blindness", "change sex", "curse", "energy drain", "plague", - "poison", "slow", "weaken" } - }, - - { - "protective", { 4, 4, 7, 8 }, - { "armor", "cancellation", "dispel magic", "fireproof", - "protection evil", "protection good", "sanctuary", "shield", - "stone skin" } - }, - - { - "transportation", { 4, 4, 8, 9 }, - { "fly", "gate", "nexus", "pass door", "portal", "summon", "teleport", - "word of recall" } - }, - - { - "weather", { 4, 4, 8, 8 }, - { "call lightning", "control weather", "faerie fire", "faerie fog", - "lightning bolt" } - } - - - -}; diff --git a/Rom24/src/db.c b/Rom24/src/db.c deleted file mode 100644 index 83b9712..0000000 --- a/Rom24/src/db.c +++ /dev/null @@ -1,3372 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#include -#include -#include -#include -#include -#if defined(macintosh) -#include -#else -#include -#include -#include -#endif - -#include "merc.h" -#include "db.h" -#include "recycle.h" -#include "music.h" -#include "lookup.h" - - -#if !defined(macintosh) -extern int _filbuf args( (FILE *) ); -#endif - -#if !defined(OLD_RAND) -#if !defined(linux) -long random(); -#endif -void srandom(unsigned int); -int getpid(); -time_t time(time_t *tloc); -#endif - - -/* externals for counting purposes */ -extern OBJ_DATA *obj_free; -extern CHAR_DATA *char_free; -extern DESCRIPTOR_DATA *descriptor_free; -extern PC_DATA *pcdata_free; -extern AFFECT_DATA *affect_free; - -/* - * Globals. - */ -HELP_DATA * help_first; -HELP_DATA * help_last; - -SHOP_DATA * shop_first; -SHOP_DATA * shop_last; - -NOTE_DATA * note_free; - -char bug_buf [2*MAX_INPUT_LENGTH]; -CHAR_DATA * char_list; -char * help_greeting; -char log_buf [2*MAX_INPUT_LENGTH]; -KILL_DATA kill_table [MAX_LEVEL]; -NOTE_DATA * note_list; -OBJ_DATA * object_list; -TIME_INFO_DATA time_info; -WEATHER_DATA weather_info; - -sh_int gsn_backstab; -sh_int gsn_dodge; -sh_int gsn_envenom; -sh_int gsn_hide; -sh_int gsn_peek; -sh_int gsn_pick_lock; -sh_int gsn_sneak; -sh_int gsn_steal; - -sh_int gsn_disarm; -sh_int gsn_enhanced_damage; -sh_int gsn_kick; -sh_int gsn_parry; -sh_int gsn_rescue; -sh_int gsn_second_attack; -sh_int gsn_third_attack; - -sh_int gsn_blindness; -sh_int gsn_charm_person; -sh_int gsn_curse; -sh_int gsn_invis; -sh_int gsn_mass_invis; -sh_int gsn_poison; -sh_int gsn_plague; -sh_int gsn_sleep; -sh_int gsn_sanctuary; -sh_int gsn_fly; -/* new gsns */ - -sh_int gsn_axe; -sh_int gsn_dagger; -sh_int gsn_flail; -sh_int gsn_mace; -sh_int gsn_polearm; -sh_int gsn_shield_block; -sh_int gsn_spear; -sh_int gsn_sword; -sh_int gsn_whip; - -sh_int gsn_bash; -sh_int gsn_berserk; -sh_int gsn_dirt; -sh_int gsn_hand_to_hand; -sh_int gsn_trip; - -sh_int gsn_fast_healing; -sh_int gsn_haggle; -sh_int gsn_lore; -sh_int gsn_meditation; - -sh_int gsn_scrolls; -sh_int gsn_staves; -sh_int gsn_wands; -sh_int gsn_recall; - - - -/* - * Locals. - */ -MOB_INDEX_DATA * mob_index_hash [MAX_KEY_HASH]; -OBJ_INDEX_DATA * obj_index_hash [MAX_KEY_HASH]; -ROOM_INDEX_DATA * room_index_hash [MAX_KEY_HASH]; -char * string_hash [MAX_KEY_HASH]; - -AREA_DATA * area_first; -AREA_DATA * area_last; - -char * string_space; -char * top_string; -char str_empty [1]; - -int top_affect; -int top_area; -int top_ed; -int top_exit; -int top_help; -int top_mob_index; -int top_obj_index; -int top_reset; -int top_room; -int top_shop; -int mobile_count = 0; -int newmobs = 0; -int newobjs = 0; - - -/* - * Memory management. - * Increase MAX_STRING if you have too. - * Tune the others only if you understand what you're doing. - */ -#define MAX_STRING 1413120 -#define MAX_PERM_BLOCK 131072 -#define MAX_MEM_LIST 11 - -void * rgFreeList [MAX_MEM_LIST]; -const int rgSizeList [MAX_MEM_LIST] = -{ - 16, 32, 64, 128, 256, 1024, 2048, 4096, 8192, 16384, 32768-64 -}; - -int nAllocString; -int sAllocString; -int nAllocPerm; -int sAllocPerm; - - - -/* - * Semi-locals. - */ -bool fBootDb; -FILE * fpArea; -char strArea[MAX_INPUT_LENGTH]; - - - -/* - * Local booting procedures. -*/ -void init_mm args( ( void ) ); -void load_area args( ( FILE *fp ) ); -void load_helps args( ( FILE *fp ) ); -void load_old_mob args( ( FILE *fp ) ); -void load_mobiles args( ( FILE *fp ) ); -void load_old_obj args( ( FILE *fp ) ); -void load_objects args( ( FILE *fp ) ); -void load_resets args( ( FILE *fp ) ); -void load_rooms args( ( FILE *fp ) ); -void load_shops args( ( FILE *fp ) ); -void load_socials args( ( FILE *fp ) ); -void load_specials args( ( FILE *fp ) ); -void load_notes args( ( void ) ); -void load_bans args( ( void ) ); - -void fix_exits args( ( void ) ); - -void reset_area args( ( AREA_DATA * pArea ) ); - -/* - * Big mama top level function. - */ -void boot_db( void ) -{ - - /* - * Init some data space stuff. - */ - { - if ( ( string_space = calloc( 1, MAX_STRING ) ) == NULL ) - { - bug( "Boot_db: can't alloc %d string space.", MAX_STRING ); - exit( 1 ); - } - top_string = string_space; - fBootDb = TRUE; - } - - /* - * Init random number generator. - */ - { - init_mm( ); - } - - /* - * Set time and weather. - */ - { - long lhour, lday, lmonth; - - lhour = (current_time - 650336715) - / (PULSE_TICK / PULSE_PER_SECOND); - time_info.hour = lhour % 24; - lday = lhour / 24; - time_info.day = lday % 35; - lmonth = lday / 35; - time_info.month = lmonth % 17; - time_info.year = lmonth / 17; - - if ( time_info.hour < 5 ) weather_info.sunlight = SUN_DARK; - else if ( time_info.hour < 6 ) weather_info.sunlight = SUN_RISE; - else if ( time_info.hour < 19 ) weather_info.sunlight = SUN_LIGHT; - else if ( time_info.hour < 20 ) weather_info.sunlight = SUN_SET; - else weather_info.sunlight = SUN_DARK; - - weather_info.change = 0; - weather_info.mmhg = 960; - if ( time_info.month >= 7 && time_info.month <=12 ) - weather_info.mmhg += number_range( 1, 50 ); - else - weather_info.mmhg += number_range( 1, 80 ); - - if ( weather_info.mmhg <= 980 ) weather_info.sky = SKY_LIGHTNING; - else if ( weather_info.mmhg <= 1000 ) weather_info.sky = SKY_RAINING; - else if ( weather_info.mmhg <= 1020 ) weather_info.sky = SKY_CLOUDY; - else weather_info.sky = SKY_CLOUDLESS; - - } - - /* - * Assign gsn's for skills which have them. - */ - { - int sn; - - for ( sn = 0; sn < MAX_SKILL; sn++ ) - { - if ( skill_table[sn].pgsn != NULL ) - *skill_table[sn].pgsn = sn; - } - } - - /* - * Read in all the area files. - */ - { - FILE *fpList; - - if ( ( fpList = fopen( AREA_LIST, "r" ) ) == NULL ) - { - perror( AREA_LIST ); - exit( 1 ); - } - - for ( ; ; ) - { - strcpy( strArea, fread_word( fpList ) ); - if ( strArea[0] == '$' ) - break; - - if ( strArea[0] == '-' ) - { - fpArea = stdin; - } - else - { - if ( ( fpArea = fopen( strArea, "r" ) ) == NULL ) - { - perror( strArea ); - exit( 1 ); - } - } - - for ( ; ; ) - { - char *word; - - if ( fread_letter( fpArea ) != '#' ) - { - bug( "Boot_db: # not found.", 0 ); - exit( 1 ); - } - - word = fread_word( fpArea ); - - if ( word[0] == '$' ) break; - else if ( !str_cmp( word, "AREA" ) ) load_area (fpArea); - else if ( !str_cmp( word, "HELPS" ) ) load_helps (fpArea); - else if ( !str_cmp( word, "MOBOLD" ) ) load_old_mob (fpArea); - else if ( !str_cmp( word, "MOBILES" ) ) load_mobiles (fpArea); - else if ( !str_cmp( word, "OBJOLD" ) ) load_old_obj (fpArea); - else if ( !str_cmp( word, "OBJECTS" ) ) load_objects (fpArea); - else if ( !str_cmp( word, "RESETS" ) ) load_resets (fpArea); - else if ( !str_cmp( word, "ROOMS" ) ) load_rooms (fpArea); - else if ( !str_cmp( word, "SHOPS" ) ) load_shops (fpArea); - else if ( !str_cmp( word, "SOCIALS" ) ) load_socials (fpArea); - else if ( !str_cmp( word, "SPECIALS" ) ) load_specials(fpArea); - else - { - bug( "Boot_db: bad section name.", 0 ); - exit( 1 ); - } - } - - if ( fpArea != stdin ) - fclose( fpArea ); - fpArea = NULL; - } - fclose( fpList ); - } - - /* - * Fix up exits. - * Declare db booting over. - * Reset all areas once. - * Load up the songs, notes and ban files. - */ - { - fix_exits( ); - fBootDb = FALSE; - area_update( ); - load_notes( ); - load_bans(); - load_songs(); - } - - return; -} - - - -/* - * Snarf an 'area' header line. - */ -void load_area( FILE *fp ) -{ - AREA_DATA *pArea; - - pArea = alloc_perm( sizeof(*pArea) ); - pArea->reset_first = NULL; - pArea->reset_last = NULL; - pArea->file_name = fread_string(fp); - pArea->name = fread_string( fp ); - pArea->credits = fread_string( fp ); - pArea->min_vnum = fread_number(fp); - pArea->max_vnum = fread_number(fp); - pArea->age = 15; - pArea->nplayer = 0; - pArea->empty = FALSE; - - if ( area_first == NULL ) - area_first = pArea; - if ( area_last != NULL ) - area_last->next = pArea; - area_last = pArea; - pArea->next = NULL; - - top_area++; - return; -} - - - -/* - * Snarf a help section. - */ -void load_helps( FILE *fp ) -{ - HELP_DATA *pHelp; - - for ( ; ; ) - { - pHelp = alloc_perm( sizeof(*pHelp) ); - pHelp->level = fread_number( fp ); - pHelp->keyword = fread_string( fp ); - if ( pHelp->keyword[0] == '$' ) - break; - pHelp->text = fread_string( fp ); - - if ( !str_cmp( pHelp->keyword, "greeting" ) ) - help_greeting = pHelp->text; - - if ( help_first == NULL ) - help_first = pHelp; - if ( help_last != NULL ) - help_last->next = pHelp; - - help_last = pHelp; - pHelp->next = NULL; - top_help++; - } - - return; -} - - - -/* - * Snarf a mob section. old style - */ -void load_old_mob( FILE *fp ) -{ - MOB_INDEX_DATA *pMobIndex; - /* for race updating */ - int race; - char name[MAX_STRING_LENGTH]; - - for ( ; ; ) - { - sh_int vnum; - char letter; - int iHash; - - letter = fread_letter( fp ); - if ( letter != '#' ) - { - bug( "Load_mobiles: # not found.", 0 ); - exit( 1 ); - } - - vnum = fread_number( fp ); - if ( vnum == 0 ) - break; - - fBootDb = FALSE; - if ( get_mob_index( vnum ) != NULL ) - { - bug( "Load_mobiles: vnum %d duplicated.", vnum ); - exit( 1 ); - } - fBootDb = TRUE; - - pMobIndex = alloc_perm( sizeof(*pMobIndex) ); - pMobIndex->vnum = vnum; - pMobIndex->new_format = FALSE; - pMobIndex->player_name = fread_string( fp ); - pMobIndex->short_descr = fread_string( fp ); - pMobIndex->long_descr = fread_string( fp ); - pMobIndex->description = fread_string( fp ); - - pMobIndex->long_descr[0] = UPPER(pMobIndex->long_descr[0]); - pMobIndex->description[0] = UPPER(pMobIndex->description[0]); - - pMobIndex->act = fread_flag( fp ) | ACT_IS_NPC; - pMobIndex->affected_by = fread_flag( fp ); - pMobIndex->pShop = NULL; - pMobIndex->alignment = fread_number( fp ); - letter = fread_letter( fp ); - pMobIndex->level = fread_number( fp ); - - /* - * The unused stuff is for imps who want to use the old-style - * stats-in-files method. - */ - fread_number( fp ); /* Unused */ - fread_number( fp ); /* Unused */ - fread_number( fp ); /* Unused */ - /* 'd' */ fread_letter( fp ); /* Unused */ - fread_number( fp ); /* Unused */ - /* '+' */ fread_letter( fp ); /* Unused */ - fread_number( fp ); /* Unused */ - fread_number( fp ); /* Unused */ - /* 'd' */ fread_letter( fp ); /* Unused */ - fread_number( fp ); /* Unused */ - /* '+' */ fread_letter( fp ); /* Unused */ - fread_number( fp ); /* Unused */ - pMobIndex->wealth = fread_number( fp )/20; - /* xp can't be used! */ fread_number( fp ); /* Unused */ - pMobIndex->start_pos = fread_number( fp ); /* Unused */ - pMobIndex->default_pos = fread_number( fp ); /* Unused */ - - if (pMobIndex->start_pos < POS_SLEEPING) - pMobIndex->start_pos = POS_STANDING; - if (pMobIndex->default_pos < POS_SLEEPING) - pMobIndex->default_pos = POS_STANDING; - - /* - * Back to meaningful values. - */ - pMobIndex->sex = fread_number( fp ); - - /* compute the race BS */ - one_argument(pMobIndex->player_name,name); - - if (name[0] == '\0' || (race = race_lookup(name)) == 0) - { - /* fill in with blanks */ - pMobIndex->race = race_lookup("human"); - pMobIndex->off_flags = OFF_DODGE|OFF_DISARM|OFF_TRIP|ASSIST_VNUM; - pMobIndex->imm_flags = 0; - pMobIndex->res_flags = 0; - pMobIndex->vuln_flags = 0; - pMobIndex->form = FORM_EDIBLE|FORM_SENTIENT|FORM_BIPED|FORM_MAMMAL; - pMobIndex->parts = PART_HEAD|PART_ARMS|PART_LEGS|PART_HEART| - PART_BRAINS|PART_GUTS; - } - else - { - pMobIndex->race = race; - pMobIndex->off_flags = OFF_DODGE|OFF_DISARM|OFF_TRIP|ASSIST_RACE| - race_table[race].off; - pMobIndex->imm_flags = race_table[race].imm; - pMobIndex->res_flags = race_table[race].res; - pMobIndex->vuln_flags = race_table[race].vuln; - pMobIndex->form = race_table[race].form; - pMobIndex->parts = race_table[race].parts; - } - - if ( letter != 'S' ) - { - bug( "Load_mobiles: vnum %d non-S.", vnum ); - exit( 1 ); - } - - iHash = vnum % MAX_KEY_HASH; - pMobIndex->next = mob_index_hash[iHash]; - mob_index_hash[iHash] = pMobIndex; - top_mob_index++; - kill_table[URANGE(0, pMobIndex->level, MAX_LEVEL-1)].number++; - } - - return; -} - -/* - * Snarf an obj section. old style - */ -void load_old_obj( FILE *fp ) -{ - OBJ_INDEX_DATA *pObjIndex; - - for ( ; ; ) - { - sh_int vnum; - char letter; - int iHash; - - letter = fread_letter( fp ); - if ( letter != '#' ) - { - bug( "Load_objects: # not found.", 0 ); - exit( 1 ); - } - - vnum = fread_number( fp ); - if ( vnum == 0 ) - break; - - fBootDb = FALSE; - if ( get_obj_index( vnum ) != NULL ) - { - bug( "Load_objects: vnum %d duplicated.", vnum ); - exit( 1 ); - } - fBootDb = TRUE; - - pObjIndex = alloc_perm( sizeof(*pObjIndex) ); - pObjIndex->vnum = vnum; - pObjIndex->new_format = FALSE; - pObjIndex->reset_num = 0; - pObjIndex->name = fread_string( fp ); - pObjIndex->short_descr = fread_string( fp ); - pObjIndex->description = fread_string( fp ); - /* Action description */ fread_string( fp ); - - pObjIndex->short_descr[0] = LOWER(pObjIndex->short_descr[0]); - pObjIndex->description[0] = UPPER(pObjIndex->description[0]); - pObjIndex->material = str_dup(""); - - pObjIndex->item_type = fread_number( fp ); - pObjIndex->extra_flags = fread_flag( fp ); - pObjIndex->wear_flags = fread_flag( fp ); - pObjIndex->value[0] = fread_number( fp ); - pObjIndex->value[1] = fread_number( fp ); - pObjIndex->value[2] = fread_number( fp ); - pObjIndex->value[3] = fread_number( fp ); - pObjIndex->value[4] = 0; - pObjIndex->level = 0; - pObjIndex->condition = 100; - pObjIndex->weight = fread_number( fp ); - pObjIndex->cost = fread_number( fp ); /* Unused */ - /* Cost per day */ fread_number( fp ); - - - if (pObjIndex->item_type == ITEM_WEAPON) - { - if (is_name("two",pObjIndex->name) - || is_name("two-handed",pObjIndex->name) - || is_name("claymore",pObjIndex->name)) - SET_BIT(pObjIndex->value[4],WEAPON_TWO_HANDS); - } - - for ( ; ; ) - { - char letter; - - letter = fread_letter( fp ); - - if ( letter == 'A' ) - { - AFFECT_DATA *paf; - - paf = alloc_perm( sizeof(*paf) ); - paf->where = TO_OBJECT; - paf->type = -1; - paf->level = 20; /* RT temp fix */ - paf->duration = -1; - paf->location = fread_number( fp ); - paf->modifier = fread_number( fp ); - paf->bitvector = 0; - paf->next = pObjIndex->affected; - pObjIndex->affected = paf; - top_affect++; - } - - else if ( letter == 'E' ) - { - EXTRA_DESCR_DATA *ed; - - ed = alloc_perm( sizeof(*ed) ); - ed->keyword = fread_string( fp ); - ed->description = fread_string( fp ); - ed->next = pObjIndex->extra_descr; - pObjIndex->extra_descr = ed; - top_ed++; - } - - else - { - ungetc( letter, fp ); - break; - } - } - - /* fix armors */ - if (pObjIndex->item_type == ITEM_ARMOR) - { - pObjIndex->value[1] = pObjIndex->value[0]; - pObjIndex->value[2] = pObjIndex->value[1]; - } - - /* - * Translate spell "slot numbers" to internal "skill numbers." - */ - switch ( pObjIndex->item_type ) - { - case ITEM_PILL: - case ITEM_POTION: - case ITEM_SCROLL: - pObjIndex->value[1] = slot_lookup( pObjIndex->value[1] ); - pObjIndex->value[2] = slot_lookup( pObjIndex->value[2] ); - pObjIndex->value[3] = slot_lookup( pObjIndex->value[3] ); - pObjIndex->value[4] = slot_lookup( pObjIndex->value[4] ); - break; - - case ITEM_STAFF: - case ITEM_WAND: - pObjIndex->value[3] = slot_lookup( pObjIndex->value[3] ); - break; - } - - iHash = vnum % MAX_KEY_HASH; - pObjIndex->next = obj_index_hash[iHash]; - obj_index_hash[iHash] = pObjIndex; - top_obj_index++; - } - - return; -} - - - - - -/* - * Snarf a reset section. - */ -void load_resets( FILE *fp ) -{ - RESET_DATA *pReset; - - if ( area_last == NULL ) - { - bug( "Load_resets: no #AREA seen yet.", 0 ); - exit( 1 ); - } - - for ( ; ; ) - { - ROOM_INDEX_DATA *pRoomIndex; - EXIT_DATA *pexit; - char letter; - OBJ_INDEX_DATA *temp_index; - - if ( ( letter = fread_letter( fp ) ) == 'S' ) - break; - - if ( letter == '*' ) - { - fread_to_eol( fp ); - continue; - } - - pReset = alloc_perm( sizeof(*pReset) ); - pReset->command = letter; - /* if_flag */ fread_number( fp ); - pReset->arg1 = fread_number( fp ); - pReset->arg2 = fread_number( fp ); - pReset->arg3 = (letter == 'G' || letter == 'R') - ? 0 : fread_number( fp ); - pReset->arg4 = (letter == 'P' || letter == 'M') - ? fread_number(fp) : 0; - fread_to_eol( fp ); - - /* - * Validate parameters. - * We're calling the index functions for the side effect. - */ - switch ( letter ) - { - default: - bug( "Load_resets: bad command '%c'.", letter ); - exit( 1 ); - break; - - case 'M': - get_mob_index ( pReset->arg1 ); - get_room_index ( pReset->arg3 ); - break; - - case 'O': - temp_index = get_obj_index ( pReset->arg1 ); - temp_index->reset_num++; - get_room_index ( pReset->arg3 ); - break; - - case 'P': - temp_index = get_obj_index ( pReset->arg1 ); - temp_index->reset_num++; - get_obj_index ( pReset->arg3 ); - break; - - case 'G': - case 'E': - temp_index = get_obj_index ( pReset->arg1 ); - temp_index->reset_num++; - break; - - case 'D': - pRoomIndex = get_room_index( pReset->arg1 ); - - if ( pReset->arg2 < 0 - || pReset->arg2 > 5 - || ( pexit = pRoomIndex->exit[pReset->arg2] ) == NULL - || !IS_SET( pexit->exit_info, EX_ISDOOR ) ) - { - bug( "Load_resets: 'D': exit %d not door.", pReset->arg2 ); - exit( 1 ); - } - - if ( pReset->arg3 < 0 || pReset->arg3 > 2 ) - { - bug( "Load_resets: 'D': bad 'locks': %d.", pReset->arg3 ); - exit( 1 ); - } - - break; - - case 'R': - pRoomIndex = get_room_index( pReset->arg1 ); - - if ( pReset->arg2 < 0 || pReset->arg2 > 6 ) - { - bug( "Load_resets: 'R': bad exit %d.", pReset->arg2 ); - exit( 1 ); - } - - break; - } - - if ( area_last->reset_first == NULL ) - area_last->reset_first = pReset; - if ( area_last->reset_last != NULL ) - area_last->reset_last->next = pReset; - - area_last->reset_last = pReset; - pReset->next = NULL; - top_reset++; - } - - return; -} - - - -/* - * Snarf a room section. - */ -void load_rooms( FILE *fp ) -{ - ROOM_INDEX_DATA *pRoomIndex; - - if ( area_last == NULL ) - { - bug( "Load_resets: no #AREA seen yet.", 0 ); - exit( 1 ); - } - - for ( ; ; ) - { - sh_int vnum; - char letter; - int door; - int iHash; - - letter = fread_letter( fp ); - if ( letter != '#' ) - { - bug( "Load_rooms: # not found.", 0 ); - exit( 1 ); - } - - vnum = fread_number( fp ); - if ( vnum == 0 ) - break; - - fBootDb = FALSE; - if ( get_room_index( vnum ) != NULL ) - { - bug( "Load_rooms: vnum %d duplicated.", vnum ); - exit( 1 ); - } - fBootDb = TRUE; - - pRoomIndex = alloc_perm( sizeof(*pRoomIndex) ); - pRoomIndex->owner = str_dup(""); - pRoomIndex->people = NULL; - pRoomIndex->contents = NULL; - pRoomIndex->extra_descr = NULL; - pRoomIndex->area = area_last; - pRoomIndex->vnum = vnum; - pRoomIndex->name = fread_string( fp ); - pRoomIndex->description = fread_string( fp ); - /* Area number */ fread_number( fp ); - pRoomIndex->room_flags = fread_flag( fp ); - /* horrible hack */ - if ( 3000 <= vnum && vnum < 3400) - SET_BIT(pRoomIndex->room_flags,ROOM_LAW); - pRoomIndex->sector_type = fread_number( fp ); - pRoomIndex->light = 0; - for ( door = 0; door <= 5; door++ ) - pRoomIndex->exit[door] = NULL; - - /* defaults */ - pRoomIndex->heal_rate = 100; - pRoomIndex->mana_rate = 100; - - for ( ; ; ) - { - letter = fread_letter( fp ); - - if ( letter == 'S' ) - break; - - if ( letter == 'H') /* healing room */ - pRoomIndex->heal_rate = fread_number(fp); - - else if ( letter == 'M') /* mana room */ - pRoomIndex->mana_rate = fread_number(fp); - - else if ( letter == 'C') /* clan */ - { - if (pRoomIndex->clan) - { - bug("Load_rooms: duplicate clan fields.",0); - exit(1); - } - pRoomIndex->clan = clan_lookup(fread_string(fp)); - } - - - else if ( letter == 'D' ) - { - EXIT_DATA *pexit; - int locks; - - door = fread_number( fp ); - if ( door < 0 || door > 5 ) - { - bug( "Fread_rooms: vnum %d has bad door number.", vnum ); - exit( 1 ); - } - - pexit = alloc_perm( sizeof(*pexit) ); - pexit->description = fread_string( fp ); - pexit->keyword = fread_string( fp ); - pexit->exit_info = 0; - locks = fread_number( fp ); - pexit->key = fread_number( fp ); - pexit->u1.vnum = fread_number( fp ); - - switch ( locks ) - { - case 1: pexit->exit_info = EX_ISDOOR; break; - case 2: pexit->exit_info = EX_ISDOOR | EX_PICKPROOF; break; - case 3: pexit->exit_info = EX_ISDOOR | EX_NOPASS; break; - case 4: pexit->exit_info = EX_ISDOOR|EX_NOPASS|EX_PICKPROOF; - break; - } - - pRoomIndex->exit[door] = pexit; - pRoomIndex->old_exit[door] = pexit; - top_exit++; - } - else if ( letter == 'E' ) - { - EXTRA_DESCR_DATA *ed; - - ed = alloc_perm( sizeof(*ed) ); - ed->keyword = fread_string( fp ); - ed->description = fread_string( fp ); - ed->next = pRoomIndex->extra_descr; - pRoomIndex->extra_descr = ed; - top_ed++; - } - - else if (letter == 'O') - { - if (pRoomIndex->owner[0] != '\0') - { - bug("Load_rooms: duplicate owner.",0); - exit(1); - } - - pRoomIndex->owner = fread_string(fp); - } - - else - { - bug( "Load_rooms: vnum %d has flag not 'DES'.", vnum ); - exit( 1 ); - } - } - - iHash = vnum % MAX_KEY_HASH; - pRoomIndex->next = room_index_hash[iHash]; - room_index_hash[iHash] = pRoomIndex; - top_room++; - } - - return; -} - - - -/* - * Snarf a shop section. - */ -void load_shops( FILE *fp ) -{ - SHOP_DATA *pShop; - - for ( ; ; ) - { - MOB_INDEX_DATA *pMobIndex; - int iTrade; - - pShop = alloc_perm( sizeof(*pShop) ); - pShop->keeper = fread_number( fp ); - if ( pShop->keeper == 0 ) - break; - for ( iTrade = 0; iTrade < MAX_TRADE; iTrade++ ) - pShop->buy_type[iTrade] = fread_number( fp ); - pShop->profit_buy = fread_number( fp ); - pShop->profit_sell = fread_number( fp ); - pShop->open_hour = fread_number( fp ); - pShop->close_hour = fread_number( fp ); - fread_to_eol( fp ); - pMobIndex = get_mob_index( pShop->keeper ); - pMobIndex->pShop = pShop; - - if ( shop_first == NULL ) - shop_first = pShop; - if ( shop_last != NULL ) - shop_last->next = pShop; - - shop_last = pShop; - pShop->next = NULL; - top_shop++; - } - - return; -} - - -/* - * Snarf spec proc declarations. - */ -void load_specials( FILE *fp ) -{ - for ( ; ; ) - { - MOB_INDEX_DATA *pMobIndex; - char letter; - - switch ( letter = fread_letter( fp ) ) - { - default: - bug( "Load_specials: letter '%c' not *MS.", letter ); - exit( 1 ); - - case 'S': - return; - - case '*': - break; - - case 'M': - pMobIndex = get_mob_index ( fread_number ( fp ) ); - pMobIndex->spec_fun = spec_lookup ( fread_word ( fp ) ); - if ( pMobIndex->spec_fun == 0 ) - { - bug( "Load_specials: 'M': vnum %d.", pMobIndex->vnum ); - exit( 1 ); - } - break; - } - - fread_to_eol( fp ); - } -} - - -/* - * Translate all room exits from virtual to real. - * Has to be done after all rooms are read in. - * Check for bad reverse exits. - */ -void fix_exits( void ) -{ - extern const sh_int rev_dir []; - char buf[MAX_STRING_LENGTH]; - ROOM_INDEX_DATA *pRoomIndex; - ROOM_INDEX_DATA *to_room; - EXIT_DATA *pexit; - EXIT_DATA *pexit_rev; - int iHash; - int door; - - for ( iHash = 0; iHash < MAX_KEY_HASH; iHash++ ) - { - for ( pRoomIndex = room_index_hash[iHash]; - pRoomIndex != NULL; - pRoomIndex = pRoomIndex->next ) - { - bool fexit; - - fexit = FALSE; - for ( door = 0; door <= 5; door++ ) - { - if ( ( pexit = pRoomIndex->exit[door] ) != NULL ) - { - if ( pexit->u1.vnum <= 0 - || get_room_index(pexit->u1.vnum) == NULL) - pexit->u1.to_room = NULL; - else - { - fexit = TRUE; - pexit->u1.to_room = get_room_index( pexit->u1.vnum ); - } - } - } - if (!fexit) - SET_BIT(pRoomIndex->room_flags,ROOM_NO_MOB); - } - } - - for ( iHash = 0; iHash < MAX_KEY_HASH; iHash++ ) - { - for ( pRoomIndex = room_index_hash[iHash]; - pRoomIndex != NULL; - pRoomIndex = pRoomIndex->next ) - { - for ( door = 0; door <= 5; door++ ) - { - if ( ( pexit = pRoomIndex->exit[door] ) != NULL - && ( to_room = pexit->u1.to_room ) != NULL - && ( pexit_rev = to_room->exit[rev_dir[door]] ) != NULL - && pexit_rev->u1.to_room != pRoomIndex - && (pRoomIndex->vnum < 1200 || pRoomIndex->vnum > 1299)) - { - sprintf( buf, "Fix_exits: %d:%d -> %d:%d -> %d.", - pRoomIndex->vnum, door, - to_room->vnum, rev_dir[door], - (pexit_rev->u1.to_room == NULL) - ? 0 : pexit_rev->u1.to_room->vnum ); - bug( buf, 0 ); - } - } - } - } - - return; -} - - - -/* - * Repopulate areas periodically. - */ -void area_update( void ) -{ - AREA_DATA *pArea; - char buf[MAX_STRING_LENGTH]; - - for ( pArea = area_first; pArea != NULL; pArea = pArea->next ) - { - - if ( ++pArea->age < 3 ) - continue; - - /* - * Check age and reset. - * Note: Mud School resets every 3 minutes (not 15). - */ - if ( (!pArea->empty && (pArea->nplayer == 0 || pArea->age >= 15)) - || pArea->age >= 31) - { - ROOM_INDEX_DATA *pRoomIndex; - - reset_area( pArea ); - sprintf(buf,"%s has just been reset.",pArea->name); - wiznet(buf,NULL,NULL,WIZ_RESETS,0,0); - - pArea->age = number_range( 0, 3 ); - pRoomIndex = get_room_index( ROOM_VNUM_SCHOOL ); - if ( pRoomIndex != NULL && pArea == pRoomIndex->area ) - pArea->age = 15 - 2; - else if (pArea->nplayer == 0) - pArea->empty = TRUE; - } - } - - return; -} - - - -/* - * Reset one area. - */ -void reset_area( AREA_DATA *pArea ) -{ - RESET_DATA *pReset; - CHAR_DATA *mob; - bool last; - int level; - - mob = NULL; - last = TRUE; - level = 0; - for ( pReset = pArea->reset_first; pReset != NULL; pReset = pReset->next ) - { - ROOM_INDEX_DATA *pRoomIndex; - MOB_INDEX_DATA *pMobIndex; - OBJ_INDEX_DATA *pObjIndex; - OBJ_INDEX_DATA *pObjToIndex; - EXIT_DATA *pexit; - OBJ_DATA *obj; - OBJ_DATA *obj_to; - int count, limit; - - switch ( pReset->command ) - { - default: - bug( "Reset_area: bad command %c.", pReset->command ); - break; - - case 'M': - if ( ( pMobIndex = get_mob_index( pReset->arg1 ) ) == NULL ) - { - bug( "Reset_area: 'M': bad vnum %d.", pReset->arg1 ); - continue; - } - - if ( ( pRoomIndex = get_room_index( pReset->arg3 ) ) == NULL ) - { - bug( "Reset_area: 'R': bad vnum %d.", pReset->arg3 ); - continue; - } - - if ( pMobIndex->count >= pReset->arg2 ) - { - last = FALSE; - break; - } - - count = 0; - for (mob = pRoomIndex->people; mob != NULL; mob = mob->next_in_room) - if (mob->pIndexData == pMobIndex) - { - count++; - if (count >= pReset->arg4) - { - last = FALSE; - break; - } - } - - if (count >= pReset->arg4) - break; - - mob = create_mobile( pMobIndex ); - - /* - * Check for pet shop. - */ - { - ROOM_INDEX_DATA *pRoomIndexPrev; - pRoomIndexPrev = get_room_index( pRoomIndex->vnum - 1 ); - if ( pRoomIndexPrev != NULL - && IS_SET(pRoomIndexPrev->room_flags, ROOM_PET_SHOP) ) - SET_BIT(mob->act, ACT_PET); - } - - /* set area */ - mob->zone = pRoomIndex->area; - - char_to_room( mob, pRoomIndex ); - level = URANGE( 0, mob->level - 2, LEVEL_HERO - 1 ); - last = TRUE; - break; - - case 'O': - if ( ( pObjIndex = get_obj_index( pReset->arg1 ) ) == NULL ) - { - bug( "Reset_area: 'O': bad vnum %d.", pReset->arg1 ); - continue; - } - - if ( ( pRoomIndex = get_room_index( pReset->arg3 ) ) == NULL ) - { - bug( "Reset_area: 'R': bad vnum %d.", pReset->arg3 ); - continue; - } - - if ( pArea->nplayer > 0 - || count_obj_list( pObjIndex, pRoomIndex->contents ) > 0 ) - { - last = FALSE; - break; - } - - obj = create_object( pObjIndex, UMIN(number_fuzzy(level), - LEVEL_HERO - 1) ); - obj->cost = 0; - obj_to_room( obj, pRoomIndex ); - last = TRUE; - break; - - case 'P': - if ( ( pObjIndex = get_obj_index( pReset->arg1 ) ) == NULL ) - { - bug( "Reset_area: 'P': bad vnum %d.", pReset->arg1 ); - continue; - } - - if ( ( pObjToIndex = get_obj_index( pReset->arg3 ) ) == NULL ) - { - bug( "Reset_area: 'P': bad vnum %d.", pReset->arg3 ); - continue; - } - - if (pReset->arg2 > 50) /* old format */ - limit = 6; - else if (pReset->arg2 == -1) /* no limit */ - limit = 999; - else - limit = pReset->arg2; - - if (pArea->nplayer > 0 - || (obj_to = get_obj_type( pObjToIndex ) ) == NULL - || (obj_to->in_room == NULL && !last) - || ( pObjIndex->count >= limit && number_range(0,4) != 0) - || (count = count_obj_list(pObjIndex,obj_to->contains)) - > pReset->arg4 ) - { - last = FALSE; - break; - } - - while (count < pReset->arg4) - { - obj = create_object( pObjIndex, number_fuzzy(obj_to->level) ); - obj_to_obj( obj, obj_to ); - count++; - if (pObjIndex->count >= limit) - break; - } - /* fix object lock state! */ - obj_to->value[1] = obj_to->pIndexData->value[1]; - last = TRUE; - break; - - case 'G': - case 'E': - if ( ( pObjIndex = get_obj_index( pReset->arg1 ) ) == NULL ) - { - bug( "Reset_area: 'E' or 'G': bad vnum %d.", pReset->arg1 ); - continue; - } - - if ( !last ) - break; - - if ( mob == NULL ) - { - bug( "Reset_area: 'E' or 'G': null mob for vnum %d.", - pReset->arg1 ); - last = FALSE; - break; - } - - if ( mob->pIndexData->pShop != NULL ) - { - int olevel = 0,i,j; - - if (!pObjIndex->new_format) - switch ( pObjIndex->item_type ) - { - case ITEM_PILL: - case ITEM_POTION: - case ITEM_SCROLL: - olevel = 53; - for (i = 1; i < 5; i++) - { - if (pObjIndex->value[i] > 0) - { - for (j = 0; j < MAX_CLASS; j++) - { - olevel = UMIN(olevel, - skill_table[pObjIndex->value[i]]. - skill_level[j]); - } - } - } - - olevel = UMAX(0,(olevel * 3 / 4) - 2); - break; - case ITEM_WAND: olevel = number_range( 10, 20 ); break; - case ITEM_STAFF: olevel = number_range( 15, 25 ); break; - case ITEM_ARMOR: olevel = number_range( 5, 15 ); break; - case ITEM_WEAPON: olevel = number_range( 5, 15 ); break; - case ITEM_TREASURE: olevel = number_range( 10, 20 ); break; - } - - obj = create_object( pObjIndex, olevel ); - SET_BIT( obj->extra_flags, ITEM_INVENTORY ); - } - - else - { - if (pReset->arg2 > 50) /* old format */ - limit = 6; - else if (pReset->arg2 == -1) /* no limit */ - limit = 999; - else - limit = pReset->arg2; - - if (pObjIndex->count < limit || number_range(0,4) == 0) - { - obj=create_object(pObjIndex,UMIN(number_fuzzy(level), - LEVEL_HERO - 1)); - /* error message if it is too high */ - if (obj->level > mob->level + 3 - || (obj->item_type == ITEM_WEAPON - && pReset->command == 'E' - && obj->level < mob->level -5 && obj->level < 45)) - fprintf(stderr, - "Err: obj %s (%d) -- %d, mob %s (%d) -- %d\n", - obj->short_descr,obj->pIndexData->vnum,obj->level, - mob->short_descr,mob->pIndexData->vnum,mob->level); - } - else - break; - } - obj_to_char( obj, mob ); - if ( pReset->command == 'E' ) - equip_char( mob, obj, pReset->arg3 ); - last = TRUE; - break; - - case 'D': - if ( ( pRoomIndex = get_room_index( pReset->arg1 ) ) == NULL ) - { - bug( "Reset_area: 'D': bad vnum %d.", pReset->arg1 ); - continue; - } - - if ( ( pexit = pRoomIndex->exit[pReset->arg2] ) == NULL ) - break; - - switch ( pReset->arg3 ) - { - case 0: - REMOVE_BIT( pexit->exit_info, EX_CLOSED ); - REMOVE_BIT( pexit->exit_info, EX_LOCKED ); - break; - - case 1: - SET_BIT( pexit->exit_info, EX_CLOSED ); - REMOVE_BIT( pexit->exit_info, EX_LOCKED ); - break; - - case 2: - SET_BIT( pexit->exit_info, EX_CLOSED ); - SET_BIT( pexit->exit_info, EX_LOCKED ); - break; - } - - last = TRUE; - break; - - case 'R': - if ( ( pRoomIndex = get_room_index( pReset->arg1 ) ) == NULL ) - { - bug( "Reset_area: 'R': bad vnum %d.", pReset->arg1 ); - continue; - } - - { - int d0; - int d1; - - for ( d0 = 0; d0 < pReset->arg2 - 1; d0++ ) - { - d1 = number_range( d0, pReset->arg2-1 ); - pexit = pRoomIndex->exit[d0]; - pRoomIndex->exit[d0] = pRoomIndex->exit[d1]; - pRoomIndex->exit[d1] = pexit; - } - } - break; - } - } - - return; -} - - - -/* - * Create an instance of a mobile. - */ -CHAR_DATA *create_mobile( MOB_INDEX_DATA *pMobIndex ) -{ - CHAR_DATA *mob; - int i; - AFFECT_DATA af; - - mobile_count++; - - if ( pMobIndex == NULL ) - { - bug( "Create_mobile: NULL pMobIndex.", 0 ); - exit( 1 ); - } - - mob = new_char(); - - mob->pIndexData = pMobIndex; - - mob->name = pMobIndex->player_name; - mob->id = get_mob_id(); - mob->short_descr = pMobIndex->short_descr; - mob->long_descr = pMobIndex->long_descr; - mob->description = pMobIndex->description; - mob->spec_fun = pMobIndex->spec_fun; - mob->prompt = NULL; - - if (pMobIndex->wealth == 0) - { - mob->silver = 0; - mob->gold = 0; - } - else - { - long wealth; - - wealth = number_range(pMobIndex->wealth/2, 3 * pMobIndex->wealth/2); - mob->gold = number_range(wealth/200,wealth/100); - mob->silver = wealth - (mob->gold * 100); - } - - if (pMobIndex->new_format) - /* load in new style */ - { - /* read from prototype */ - mob->group = pMobIndex->group; - mob->act = pMobIndex->act; - mob->comm = COMM_NOCHANNELS|COMM_NOSHOUT|COMM_NOTELL; - mob->affected_by = pMobIndex->affected_by; - mob->alignment = pMobIndex->alignment; - mob->level = pMobIndex->level; - mob->hitroll = pMobIndex->hitroll; - mob->damroll = pMobIndex->damage[DICE_BONUS]; - mob->max_hit = dice(pMobIndex->hit[DICE_NUMBER], - pMobIndex->hit[DICE_TYPE]) - + pMobIndex->hit[DICE_BONUS]; - mob->hit = mob->max_hit; - mob->max_mana = dice(pMobIndex->mana[DICE_NUMBER], - pMobIndex->mana[DICE_TYPE]) - + pMobIndex->mana[DICE_BONUS]; - mob->mana = mob->max_mana; - mob->damage[DICE_NUMBER]= pMobIndex->damage[DICE_NUMBER]; - mob->damage[DICE_TYPE] = pMobIndex->damage[DICE_TYPE]; - mob->dam_type = pMobIndex->dam_type; - if (mob->dam_type == 0) - switch(number_range(1,3)) - { - case (1): mob->dam_type = 3; break; /* slash */ - case (2): mob->dam_type = 7; break; /* pound */ - case (3): mob->dam_type = 11; break; /* pierce */ - } - for (i = 0; i < 4; i++) - mob->armor[i] = pMobIndex->ac[i]; - mob->off_flags = pMobIndex->off_flags; - mob->imm_flags = pMobIndex->imm_flags; - mob->res_flags = pMobIndex->res_flags; - mob->vuln_flags = pMobIndex->vuln_flags; - mob->start_pos = pMobIndex->start_pos; - mob->default_pos = pMobIndex->default_pos; - mob->sex = pMobIndex->sex; - if (mob->sex == 3) /* random sex */ - mob->sex = number_range(1,2); - mob->race = pMobIndex->race; - mob->form = pMobIndex->form; - mob->parts = pMobIndex->parts; - mob->size = pMobIndex->size; - mob->material = str_dup(pMobIndex->material); - - /* computed on the spot */ - - for (i = 0; i < MAX_STATS; i ++) - mob->perm_stat[i] = UMIN(25,11 + mob->level/4); - - if (IS_SET(mob->act,ACT_WARRIOR)) - { - mob->perm_stat[STAT_STR] += 3; - mob->perm_stat[STAT_INT] -= 1; - mob->perm_stat[STAT_CON] += 2; - } - - if (IS_SET(mob->act,ACT_THIEF)) - { - mob->perm_stat[STAT_DEX] += 3; - mob->perm_stat[STAT_INT] += 1; - mob->perm_stat[STAT_WIS] -= 1; - } - - if (IS_SET(mob->act,ACT_CLERIC)) - { - mob->perm_stat[STAT_WIS] += 3; - mob->perm_stat[STAT_DEX] -= 1; - mob->perm_stat[STAT_STR] += 1; - } - - if (IS_SET(mob->act,ACT_MAGE)) - { - mob->perm_stat[STAT_INT] += 3; - mob->perm_stat[STAT_STR] -= 1; - mob->perm_stat[STAT_DEX] += 1; - } - - if (IS_SET(mob->off_flags,OFF_FAST)) - mob->perm_stat[STAT_DEX] += 2; - - mob->perm_stat[STAT_STR] += mob->size - SIZE_MEDIUM; - mob->perm_stat[STAT_CON] += (mob->size - SIZE_MEDIUM) / 2; - - /* let's get some spell action */ - if (IS_AFFECTED(mob,AFF_SANCTUARY)) - { - af.where = TO_AFFECTS; - af.type = skill_lookup("sanctuary"); - af.level = mob->level; - af.duration = -1; - af.location = APPLY_NONE; - af.modifier = 0; - af.bitvector = AFF_SANCTUARY; - affect_to_char( mob, &af ); - } - - if (IS_AFFECTED(mob,AFF_HASTE)) - { - af.where = TO_AFFECTS; - af.type = skill_lookup("haste"); - af.level = mob->level; - af.duration = -1; - af.location = APPLY_DEX; - af.modifier = 1 + (mob->level >= 18) + (mob->level >= 25) + - (mob->level >= 32); - af.bitvector = AFF_HASTE; - affect_to_char( mob, &af ); - } - - if (IS_AFFECTED(mob,AFF_PROTECT_EVIL)) - { - af.where = TO_AFFECTS; - af.type = skill_lookup("protection evil"); - af.level = mob->level; - af.duration = -1; - af.location = APPLY_SAVES; - af.modifier = -1; - af.bitvector = AFF_PROTECT_EVIL; - affect_to_char(mob,&af); - } - - if (IS_AFFECTED(mob,AFF_PROTECT_GOOD)) - { - af.where = TO_AFFECTS; - af.type = skill_lookup("protection good"); - af.level = mob->level; - af.duration = -1; - af.location = APPLY_SAVES; - af.modifier = -1; - af.bitvector = AFF_PROTECT_GOOD; - affect_to_char(mob,&af); - } - } - else /* read in old format and convert */ - { - mob->act = pMobIndex->act; - mob->affected_by = pMobIndex->affected_by; - mob->alignment = pMobIndex->alignment; - mob->level = pMobIndex->level; - mob->hitroll = pMobIndex->hitroll; - mob->damroll = 0; - mob->max_hit = mob->level * 8 + number_range( - mob->level * mob->level/4, - mob->level * mob->level); - mob->max_hit *= .9; - mob->hit = mob->max_hit; - mob->max_mana = 100 + dice(mob->level,10); - mob->mana = mob->max_mana; - switch(number_range(1,3)) - { - case (1): mob->dam_type = 3; break; /* slash */ - case (2): mob->dam_type = 7; break; /* pound */ - case (3): mob->dam_type = 11; break; /* pierce */ - } - for (i = 0; i < 3; i++) - mob->armor[i] = interpolate(mob->level,100,-100); - mob->armor[3] = interpolate(mob->level,100,0); - mob->race = pMobIndex->race; - mob->off_flags = pMobIndex->off_flags; - mob->imm_flags = pMobIndex->imm_flags; - mob->res_flags = pMobIndex->res_flags; - mob->vuln_flags = pMobIndex->vuln_flags; - mob->start_pos = pMobIndex->start_pos; - mob->default_pos = pMobIndex->default_pos; - mob->sex = pMobIndex->sex; - mob->form = pMobIndex->form; - mob->parts = pMobIndex->parts; - mob->size = SIZE_MEDIUM; - mob->material = ""; - - for (i = 0; i < MAX_STATS; i ++) - mob->perm_stat[i] = 11 + mob->level/4; - } - - mob->position = mob->start_pos; - - - /* link the mob to the world list */ - mob->next = char_list; - char_list = mob; - pMobIndex->count++; - return mob; -} - -/* duplicate a mobile exactly -- except inventory */ -void clone_mobile(CHAR_DATA *parent, CHAR_DATA *clone) -{ - int i; - AFFECT_DATA *paf; - - if ( parent == NULL || clone == NULL || !IS_NPC(parent)) - return; - - /* start fixing values */ - clone->name = str_dup(parent->name); - clone->version = parent->version; - clone->short_descr = str_dup(parent->short_descr); - clone->long_descr = str_dup(parent->long_descr); - clone->description = str_dup(parent->description); - clone->group = parent->group; - clone->sex = parent->sex; - clone->class = parent->class; - clone->race = parent->race; - clone->level = parent->level; - clone->trust = 0; - clone->timer = parent->timer; - clone->wait = parent->wait; - clone->hit = parent->hit; - clone->max_hit = parent->max_hit; - clone->mana = parent->mana; - clone->max_mana = parent->max_mana; - clone->move = parent->move; - clone->max_move = parent->max_move; - clone->gold = parent->gold; - clone->silver = parent->silver; - clone->exp = parent->exp; - clone->act = parent->act; - clone->comm = parent->comm; - clone->imm_flags = parent->imm_flags; - clone->res_flags = parent->res_flags; - clone->vuln_flags = parent->vuln_flags; - clone->invis_level = parent->invis_level; - clone->affected_by = parent->affected_by; - clone->position = parent->position; - clone->practice = parent->practice; - clone->train = parent->train; - clone->saving_throw = parent->saving_throw; - clone->alignment = parent->alignment; - clone->hitroll = parent->hitroll; - clone->damroll = parent->damroll; - clone->wimpy = parent->wimpy; - clone->form = parent->form; - clone->parts = parent->parts; - clone->size = parent->size; - clone->material = str_dup(parent->material); - clone->off_flags = parent->off_flags; - clone->dam_type = parent->dam_type; - clone->start_pos = parent->start_pos; - clone->default_pos = parent->default_pos; - clone->spec_fun = parent->spec_fun; - - for (i = 0; i < 4; i++) - clone->armor[i] = parent->armor[i]; - - for (i = 0; i < MAX_STATS; i++) - { - clone->perm_stat[i] = parent->perm_stat[i]; - clone->mod_stat[i] = parent->mod_stat[i]; - } - - for (i = 0; i < 3; i++) - clone->damage[i] = parent->damage[i]; - - /* now add the affects */ - for (paf = parent->affected; paf != NULL; paf = paf->next) - affect_to_char(clone,paf); - -} - - - - -/* - * Create an instance of an object. - */ -OBJ_DATA *create_object( OBJ_INDEX_DATA *pObjIndex, int level ) -{ - AFFECT_DATA *paf; - OBJ_DATA *obj; - int i; - - if ( pObjIndex == NULL ) - { - bug( "Create_object: NULL pObjIndex.", 0 ); - exit( 1 ); - } - - obj = new_obj(); - - obj->pIndexData = pObjIndex; - obj->in_room = NULL; - obj->enchanted = FALSE; - - if (pObjIndex->new_format) - obj->level = pObjIndex->level; - else - obj->level = UMAX(0,level); - obj->wear_loc = -1; - - obj->name = pObjIndex->name; - obj->short_descr = pObjIndex->short_descr; - obj->description = pObjIndex->description; - obj->material = str_dup(pObjIndex->material); - obj->item_type = pObjIndex->item_type; - obj->extra_flags = pObjIndex->extra_flags; - obj->wear_flags = pObjIndex->wear_flags; - obj->value[0] = pObjIndex->value[0]; - obj->value[1] = pObjIndex->value[1]; - obj->value[2] = pObjIndex->value[2]; - obj->value[3] = pObjIndex->value[3]; - obj->value[4] = pObjIndex->value[4]; - obj->weight = pObjIndex->weight; - - if (level == -1 || pObjIndex->new_format) - obj->cost = pObjIndex->cost; - else - obj->cost = number_fuzzy( 10 ) - * number_fuzzy( level ) * number_fuzzy( level ); - - /* - * Mess with object properties. - */ - switch ( obj->item_type ) - { - default: - bug( "Read_object: vnum %d bad type.", pObjIndex->vnum ); - break; - - case ITEM_LIGHT: - if (obj->value[2] == 999) - obj->value[2] = -1; - break; - - case ITEM_FURNITURE: - case ITEM_TRASH: - case ITEM_CONTAINER: - case ITEM_DRINK_CON: - case ITEM_KEY: - case ITEM_FOOD: - case ITEM_BOAT: - case ITEM_CORPSE_NPC: - case ITEM_CORPSE_PC: - case ITEM_FOUNTAIN: - case ITEM_MAP: - case ITEM_CLOTHING: - case ITEM_PORTAL: - if (!pObjIndex->new_format) - obj->cost /= 5; - break; - - case ITEM_TREASURE: - case ITEM_WARP_STONE: - case ITEM_ROOM_KEY: - case ITEM_GEM: - case ITEM_JEWELRY: - break; - - case ITEM_JUKEBOX: - for (i = 0; i < 5; i++) - obj->value[i] = -1; - break; - - case ITEM_SCROLL: - if (level != -1 && !pObjIndex->new_format) - obj->value[0] = number_fuzzy( obj->value[0] ); - break; - - case ITEM_WAND: - case ITEM_STAFF: - if (level != -1 && !pObjIndex->new_format) - { - obj->value[0] = number_fuzzy( obj->value[0] ); - obj->value[1] = number_fuzzy( obj->value[1] ); - obj->value[2] = obj->value[1]; - } - if (!pObjIndex->new_format) - obj->cost *= 2; - break; - - case ITEM_WEAPON: - if (level != -1 && !pObjIndex->new_format) - { - obj->value[1] = number_fuzzy( number_fuzzy( 1 * level / 4 + 2 ) ); - obj->value[2] = number_fuzzy( number_fuzzy( 3 * level / 4 + 6 ) ); - } - break; - - case ITEM_ARMOR: - if (level != -1 && !pObjIndex->new_format) - { - obj->value[0] = number_fuzzy( level / 5 + 3 ); - obj->value[1] = number_fuzzy( level / 5 + 3 ); - obj->value[2] = number_fuzzy( level / 5 + 3 ); - } - break; - - case ITEM_POTION: - case ITEM_PILL: - if (level != -1 && !pObjIndex->new_format) - obj->value[0] = number_fuzzy( number_fuzzy( obj->value[0] ) ); - break; - - case ITEM_MONEY: - if (!pObjIndex->new_format) - obj->value[0] = obj->cost; - break; - } - - for (paf = pObjIndex->affected; paf != NULL; paf = paf->next) - if ( paf->location == APPLY_SPELL_AFFECT ) - affect_to_obj(obj,paf); - - obj->next = object_list; - object_list = obj; - pObjIndex->count++; - - return obj; -} - -/* duplicate an object exactly -- except contents */ -void clone_object(OBJ_DATA *parent, OBJ_DATA *clone) -{ - int i; - AFFECT_DATA *paf; - EXTRA_DESCR_DATA *ed,*ed_new; - - if (parent == NULL || clone == NULL) - return; - - /* start fixing the object */ - clone->name = str_dup(parent->name); - clone->short_descr = str_dup(parent->short_descr); - clone->description = str_dup(parent->description); - clone->item_type = parent->item_type; - clone->extra_flags = parent->extra_flags; - clone->wear_flags = parent->wear_flags; - clone->weight = parent->weight; - clone->cost = parent->cost; - clone->level = parent->level; - clone->condition = parent->condition; - clone->material = str_dup(parent->material); - clone->timer = parent->timer; - - for (i = 0; i < 5; i ++) - clone->value[i] = parent->value[i]; - - /* affects */ - clone->enchanted = parent->enchanted; - - for (paf = parent->affected; paf != NULL; paf = paf->next) - affect_to_obj(clone,paf); - - /* extended desc */ - for (ed = parent->extra_descr; ed != NULL; ed = ed->next) - { - ed_new = new_extra_descr(); - ed_new->keyword = str_dup( ed->keyword); - ed_new->description = str_dup( ed->description ); - ed_new->next = clone->extra_descr; - clone->extra_descr = ed_new; - } - -} - - - -/* - * Clear a new character. - */ -void clear_char( CHAR_DATA *ch ) -{ - static CHAR_DATA ch_zero; - int i; - - *ch = ch_zero; - ch->name = &str_empty[0]; - ch->short_descr = &str_empty[0]; - ch->long_descr = &str_empty[0]; - ch->description = &str_empty[0]; - ch->prompt = &str_empty[0]; - ch->logon = current_time; - ch->lines = PAGELEN; - for (i = 0; i < 4; i++) - ch->armor[i] = 100; - ch->position = POS_STANDING; - ch->hit = 20; - ch->max_hit = 20; - ch->mana = 100; - ch->max_mana = 100; - ch->move = 100; - ch->max_move = 100; - ch->on = NULL; - for (i = 0; i < MAX_STATS; i ++) - { - ch->perm_stat[i] = 13; - ch->mod_stat[i] = 0; - } - return; -} - -/* - * Get an extra description from a list. - */ -char *get_extra_descr( const char *name, EXTRA_DESCR_DATA *ed ) -{ - for ( ; ed != NULL; ed = ed->next ) - { - if ( is_name( (char *) name, ed->keyword ) ) - return ed->description; - } - return NULL; -} - - - -/* - * Translates mob virtual number to its mob index struct. - * Hash table lookup. - */ -MOB_INDEX_DATA *get_mob_index( int vnum ) -{ - MOB_INDEX_DATA *pMobIndex; - - for ( pMobIndex = mob_index_hash[vnum % MAX_KEY_HASH]; - pMobIndex != NULL; - pMobIndex = pMobIndex->next ) - { - if ( pMobIndex->vnum == vnum ) - return pMobIndex; - } - - if ( fBootDb ) - { - bug( "Get_mob_index: bad vnum %d.", vnum ); - exit( 1 ); - } - - return NULL; -} - - - -/* - * Translates mob virtual number to its obj index struct. - * Hash table lookup. - */ -OBJ_INDEX_DATA *get_obj_index( int vnum ) -{ - OBJ_INDEX_DATA *pObjIndex; - - for ( pObjIndex = obj_index_hash[vnum % MAX_KEY_HASH]; - pObjIndex != NULL; - pObjIndex = pObjIndex->next ) - { - if ( pObjIndex->vnum == vnum ) - return pObjIndex; - } - - if ( fBootDb ) - { - bug( "Get_obj_index: bad vnum %d.", vnum ); - exit( 1 ); - } - - return NULL; -} - - - -/* - * Translates mob virtual number to its room index struct. - * Hash table lookup. - */ -ROOM_INDEX_DATA *get_room_index( int vnum ) -{ - ROOM_INDEX_DATA *pRoomIndex; - - for ( pRoomIndex = room_index_hash[vnum % MAX_KEY_HASH]; - pRoomIndex != NULL; - pRoomIndex = pRoomIndex->next ) - { - if ( pRoomIndex->vnum == vnum ) - return pRoomIndex; - } - - if ( fBootDb ) - { - bug( "Get_room_index: bad vnum %d.", vnum ); - exit( 1 ); - } - - return NULL; -} - - - -/* - * Read a letter from a file. - */ -char fread_letter( FILE *fp ) -{ - char c; - - do - { - c = getc( fp ); - } - while ( isspace(c) ); - - return c; -} - - - -/* - * Read a number from a file. - */ -int fread_number( FILE *fp ) -{ - int number; - bool sign; - char c; - - do - { - c = getc( fp ); - } - while ( isspace(c) ); - - number = 0; - - sign = FALSE; - if ( c == '+' ) - { - c = getc( fp ); - } - else if ( c == '-' ) - { - sign = TRUE; - c = getc( fp ); - } - - if ( !isdigit(c) ) - { - bug( "Fread_number: bad format.", 0 ); - exit( 1 ); - } - - while ( isdigit(c) ) - { - number = number * 10 + c - '0'; - c = getc( fp ); - } - - if ( sign ) - number = 0 - number; - - if ( c == '|' ) - number += fread_number( fp ); - else if ( c != ' ' ) - ungetc( c, fp ); - - return number; -} - -long fread_flag( FILE *fp) -{ - int number; - char c; - bool negative = FALSE; - - do - { - c = getc(fp); - } - while ( isspace(c)); - - if (c == '-') - { - negative = TRUE; - c = getc(fp); - } - - number = 0; - - if (!isdigit(c)) - { - while (('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z')) - { - number += flag_convert(c); - c = getc(fp); - } - } - - while (isdigit(c)) - { - number = number * 10 + c - '0'; - c = getc(fp); - } - - if (c == '|') - number += fread_flag(fp); - - else if ( c != ' ') - ungetc(c,fp); - - if (negative) - return -1 * number; - - return number; -} - -long flag_convert(char letter ) -{ - long bitsum = 0; - char i; - - if ('A' <= letter && letter <= 'Z') - { - bitsum = 1; - for (i = letter; i > 'A'; i--) - bitsum *= 2; - } - else if ('a' <= letter && letter <= 'z') - { - bitsum = 67108864; /* 2^26 */ - for (i = letter; i > 'a'; i --) - bitsum *= 2; - } - - return bitsum; -} - - - - -/* - * Read and allocate space for a string from a file. - * These strings are read-only and shared. - * Strings are hashed: - * each string prepended with hash pointer to prev string, - * hash code is simply the string length. - * this function takes 40% to 50% of boot-up time. - */ -char *fread_string( FILE *fp ) -{ - char *plast; - char c; - - plast = top_string + sizeof(char *); - if ( plast > &string_space[MAX_STRING - MAX_STRING_LENGTH] ) - { - bug( "Fread_string: MAX_STRING %d exceeded.", MAX_STRING ); - exit( 1 ); - } - - /* - * Skip blanks. - * Read first char. - */ - do - { - c = getc( fp ); - } - while ( isspace(c) ); - - if ( ( *plast++ = c ) == '~' ) - return &str_empty[0]; - - for ( ;; ) - { - /* - * Back off the char type lookup, - * it was too dirty for portability. - * -- Furey - */ - - switch ( *plast = getc(fp) ) - { - default: - plast++; - break; - - case EOF: - /* temp fix */ - bug( "Fread_string: EOF", 0 ); - return NULL; - /* exit( 1 ); */ - break; - - case '\n': - plast++; - *plast++ = '\r'; - break; - - case '\r': - break; - - case '~': - plast++; - { - union - { - char * pc; - char rgc[sizeof(char *)]; - } u1; - int ic; - int iHash; - char *pHash; - char *pHashPrev; - char *pString; - - plast[-1] = '\0'; - iHash = UMIN( MAX_KEY_HASH - 1, plast - 1 - top_string ); - for ( pHash = string_hash[iHash]; pHash; pHash = pHashPrev ) - { - for ( ic = 0; ic < sizeof(char *); ic++ ) - u1.rgc[ic] = pHash[ic]; - pHashPrev = u1.pc; - pHash += sizeof(char *); - - if ( top_string[sizeof(char *)] == pHash[0] - && !strcmp( top_string+sizeof(char *)+1, pHash+1 ) ) - return pHash; - } - - if ( fBootDb ) - { - pString = top_string; - top_string = plast; - u1.pc = string_hash[iHash]; - for ( ic = 0; ic < sizeof(char *); ic++ ) - pString[ic] = u1.rgc[ic]; - string_hash[iHash] = pString; - - nAllocString += 1; - sAllocString += top_string - pString; - return pString + sizeof(char *); - } - else - { - return str_dup( top_string + sizeof(char *) ); - } - } - } - } -} - -char *fread_string_eol( FILE *fp ) -{ - static bool char_special[256-EOF]; - char *plast; - char c; - - if ( char_special[EOF-EOF] != TRUE ) - { - char_special[EOF - EOF] = TRUE; - char_special['\n' - EOF] = TRUE; - char_special['\r' - EOF] = TRUE; - } - - plast = top_string + sizeof(char *); - if ( plast > &string_space[MAX_STRING - MAX_STRING_LENGTH] ) - { - bug( "Fread_string: MAX_STRING %d exceeded.", MAX_STRING ); - exit( 1 ); - } - - /* - * Skip blanks. - * Read first char. - */ - do - { - c = getc( fp ); - } - while ( isspace(c) ); - - if ( ( *plast++ = c ) == '\n') - return &str_empty[0]; - - for ( ;; ) - { - if ( !char_special[ ( *plast++ = getc( fp ) ) - EOF ] ) - continue; - - switch ( plast[-1] ) - { - default: - break; - - case EOF: - bug( "Fread_string_eol EOF", 0 ); - exit( 1 ); - break; - - case '\n': case '\r': - { - union - { - char * pc; - char rgc[sizeof(char *)]; - } u1; - int ic; - int iHash; - char *pHash; - char *pHashPrev; - char *pString; - - plast[-1] = '\0'; - iHash = UMIN( MAX_KEY_HASH - 1, plast - 1 - top_string ); - for ( pHash = string_hash[iHash]; pHash; pHash = pHashPrev ) - { - for ( ic = 0; ic < sizeof(char *); ic++ ) - u1.rgc[ic] = pHash[ic]; - pHashPrev = u1.pc; - pHash += sizeof(char *); - - if ( top_string[sizeof(char *)] == pHash[0] - && !strcmp( top_string+sizeof(char *)+1, pHash+1 ) ) - return pHash; - } - - if ( fBootDb ) - { - pString = top_string; - top_string = plast; - u1.pc = string_hash[iHash]; - for ( ic = 0; ic < sizeof(char *); ic++ ) - pString[ic] = u1.rgc[ic]; - string_hash[iHash] = pString; - - nAllocString += 1; - sAllocString += top_string - pString; - return pString + sizeof(char *); - } - else - { - return str_dup( top_string + sizeof(char *) ); - } - } - } - } -} - - - -/* - * Read to end of line (for comments). - */ -void fread_to_eol( FILE *fp ) -{ - char c; - - do - { - c = getc( fp ); - } - while ( c != '\n' && c != '\r' ); - - do - { - c = getc( fp ); - } - while ( c == '\n' || c == '\r' ); - - ungetc( c, fp ); - return; -} - - - -/* - * Read one word (into static buffer). - */ -char *fread_word( FILE *fp ) -{ - static char word[MAX_INPUT_LENGTH]; - char *pword; - char cEnd; - - do - { - cEnd = getc( fp ); - } - while ( isspace( cEnd ) ); - - if ( cEnd == '\'' || cEnd == '"' ) - { - pword = word; - } - else - { - word[0] = cEnd; - pword = word+1; - cEnd = ' '; - } - - for ( ; pword < word + MAX_INPUT_LENGTH; pword++ ) - { - *pword = getc( fp ); - if ( cEnd == ' ' ? isspace(*pword) : *pword == cEnd ) - { - if ( cEnd == ' ' ) - ungetc( *pword, fp ); - *pword = '\0'; - return word; - } - } - - bug( "Fread_word: word too long.", 0 ); - exit( 1 ); - return NULL; -} - -/* - * Allocate some ordinary memory, - * with the expectation of freeing it someday. - */ -void *alloc_mem( int sMem ) -{ - void *pMem; - int *magic; - int iList; - - sMem += sizeof(*magic); - - for ( iList = 0; iList < MAX_MEM_LIST; iList++ ) - { - if ( sMem <= rgSizeList[iList] ) - break; - } - - if ( iList == MAX_MEM_LIST ) - { - bug( "Alloc_mem: size %d too large.", sMem ); - exit( 1 ); - } - - if ( rgFreeList[iList] == NULL ) - { - pMem = alloc_perm( rgSizeList[iList] ); - } - else - { - pMem = rgFreeList[iList]; - rgFreeList[iList] = * ((void **) rgFreeList[iList]); - } - - magic = (int *) pMem; - *magic = MAGIC_NUM; - pMem += sizeof(*magic); - - return pMem; -} - - - -/* - * Free some memory. - * Recycle it back onto the free list for blocks of that size. - */ -void free_mem( void *pMem, int sMem ) -{ - int iList; - int *magic; - - pMem -= sizeof(*magic); - magic = (int *) pMem; - - if (*magic != MAGIC_NUM) - { - bug("Attempt to recyle invalid memory of size %d.",sMem); - bug((char*) pMem + sizeof(*magic),0); - return; - } - - *magic = 0; - sMem += sizeof(*magic); - - for ( iList = 0; iList < MAX_MEM_LIST; iList++ ) - { - if ( sMem <= rgSizeList[iList] ) - break; - } - - if ( iList == MAX_MEM_LIST ) - { - bug( "Free_mem: size %d too large.", sMem ); - exit( 1 ); - } - - * ((void **) pMem) = rgFreeList[iList]; - rgFreeList[iList] = pMem; - - return; -} - - -/* - * Allocate some permanent memory. - * Permanent memory is never freed, - * pointers into it may be copied safely. - */ -void *alloc_perm( int sMem ) -{ - static char *pMemPerm; - static int iMemPerm; - void *pMem; - - while ( sMem % sizeof(long) != 0 ) - sMem++; - if ( sMem > MAX_PERM_BLOCK ) - { - bug( "Alloc_perm: %d too large.", sMem ); - exit( 1 ); - } - - if ( pMemPerm == NULL || iMemPerm + sMem > MAX_PERM_BLOCK ) - { - iMemPerm = 0; - if ( ( pMemPerm = calloc( 1, MAX_PERM_BLOCK ) ) == NULL ) - { - perror( "Alloc_perm" ); - exit( 1 ); - } - } - - pMem = pMemPerm + iMemPerm; - iMemPerm += sMem; - nAllocPerm += 1; - sAllocPerm += sMem; - return pMem; -} - - - -/* - * Duplicate a string into dynamic memory. - * Fread_strings are read-only and shared. - */ -char *str_dup( const char *str ) -{ - char *str_new; - - if ( str[0] == '\0' ) - return &str_empty[0]; - - if ( str >= string_space && str < top_string ) - return (char *) str; - - str_new = alloc_mem( strlen(str) + 1 ); - strcpy( str_new, str ); - return str_new; -} - - - -/* - * Free a string. - * Null is legal here to simplify callers. - * Read-only shared strings are not touched. - */ -void free_string( char *pstr ) -{ - if ( pstr == NULL - || pstr == &str_empty[0] - || ( pstr >= string_space && pstr < top_string ) ) - return; - - free_mem( pstr, strlen(pstr) + 1 ); - return; -} - - - -void do_areas( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - AREA_DATA *pArea1; - AREA_DATA *pArea2; - int iArea; - int iAreaHalf; - - if (argument[0] != '\0') - { - send_to_char("No argument is used with this command.\n\r",ch); - return; - } - - iAreaHalf = (top_area + 1) / 2; - pArea1 = area_first; - pArea2 = area_first; - for ( iArea = 0; iArea < iAreaHalf; iArea++ ) - pArea2 = pArea2->next; - - for ( iArea = 0; iArea < iAreaHalf; iArea++ ) - { - sprintf( buf, "%-39s%-39s\n\r", - pArea1->credits, (pArea2 != NULL) ? pArea2->credits : "" ); - send_to_char( buf, ch ); - pArea1 = pArea1->next; - if ( pArea2 != NULL ) - pArea2 = pArea2->next; - } - - return; -} - - - -void do_memory( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - - sprintf( buf, "Affects %5d\n\r", top_affect ); send_to_char( buf, ch ); - sprintf( buf, "Areas %5d\n\r", top_area ); send_to_char( buf, ch ); - sprintf( buf, "ExDes %5d\n\r", top_ed ); send_to_char( buf, ch ); - sprintf( buf, "Exits %5d\n\r", top_exit ); send_to_char( buf, ch ); - sprintf( buf, "Helps %5d\n\r", top_help ); send_to_char( buf, ch ); - sprintf( buf, "Socials %5d\n\r", social_count ); send_to_char( buf, ch ); - sprintf( buf, "Mobs %5d(%d new format)\n\r", top_mob_index,newmobs ); - send_to_char( buf, ch ); - sprintf( buf, "(in use)%5d\n\r", mobile_count ); send_to_char( buf, ch ); - sprintf( buf, "Objs %5d(%d new format)\n\r", top_obj_index,newobjs ); - send_to_char( buf, ch ); - sprintf( buf, "Resets %5d\n\r", top_reset ); send_to_char( buf, ch ); - sprintf( buf, "Rooms %5d\n\r", top_room ); send_to_char( buf, ch ); - sprintf( buf, "Shops %5d\n\r", top_shop ); send_to_char( buf, ch ); - - sprintf( buf, "Strings %5d strings of %7d bytes (max %d).\n\r", - nAllocString, sAllocString, MAX_STRING ); - send_to_char( buf, ch ); - - sprintf( buf, "Perms %5d blocks of %7d bytes.\n\r", - nAllocPerm, sAllocPerm ); - send_to_char( buf, ch ); - - return; -} - -void do_dump( CHAR_DATA *ch, char *argument ) -{ - int count,count2,num_pcs,aff_count; - CHAR_DATA *fch; - MOB_INDEX_DATA *pMobIndex; - PC_DATA *pc; - OBJ_DATA *obj; - OBJ_INDEX_DATA *pObjIndex; - ROOM_INDEX_DATA *room; - EXIT_DATA *exit; - DESCRIPTOR_DATA *d; - AFFECT_DATA *af; - FILE *fp; - int vnum,nMatch = 0; - - /* open file */ - fclose(fpReserve); - fp = fopen("mem.dmp","w"); - - /* report use of data structures */ - - num_pcs = 0; - aff_count = 0; - - /* mobile prototypes */ - fprintf(fp,"MobProt %4d (%8zd bytes)\n", - top_mob_index, top_mob_index * (sizeof(*pMobIndex))); - - /* mobs */ - count = 0; count2 = 0; - for (fch = char_list; fch != NULL; fch = fch->next) - { - count++; - if (fch->pcdata != NULL) - num_pcs++; - for (af = fch->affected; af != NULL; af = af->next) - aff_count++; - } - for (fch = char_free; fch != NULL; fch = fch->next) - count2++; - - fprintf(fp,"Mobs %4d (%8zd bytes), %2d free (%zd bytes)\n", - count, count * (sizeof(*fch)), count2, count2 * (sizeof(*fch))); - - /* pcdata */ - count = 0; - for (pc = pcdata_free; pc != NULL; pc = pc->next) - count++; - - fprintf(fp,"Pcdata %4d (%8zd bytes), %2d free (%zd bytes)\n", - num_pcs, num_pcs * (sizeof(*pc)), count, count * (sizeof(*pc))); - - /* descriptors */ - count = 0; count2 = 0; - for (d = descriptor_list; d != NULL; d = d->next) - count++; - for (d= descriptor_free; d != NULL; d = d->next) - count2++; - - fprintf(fp, "Descs %4d (%8zd bytes), %2d free (%zd bytes)\n", - count, count * (sizeof(*d)), count2, count2 * (sizeof(*d))); - - /* object prototypes */ - for ( vnum = 0; nMatch < top_obj_index; vnum++ ) - if ( ( pObjIndex = get_obj_index( vnum ) ) != NULL ) - { - for (af = pObjIndex->affected; af != NULL; af = af->next) - aff_count++; - nMatch++; - } - - fprintf(fp,"ObjProt %4d (%8zd bytes)\n", - top_obj_index, top_obj_index * (sizeof(*pObjIndex))); - - - /* objects */ - count = 0; count2 = 0; - for (obj = object_list; obj != NULL; obj = obj->next) - { - count++; - for (af = obj->affected; af != NULL; af = af->next) - aff_count++; - } - for (obj = obj_free; obj != NULL; obj = obj->next) - count2++; - - fprintf(fp,"Objs %4d (%8zd bytes), %2d free (%zd bytes)\n", - count, count * (sizeof(*obj)), count2, count2 * (sizeof(*obj))); - - /* affects */ - count = 0; - for (af = affect_free; af != NULL; af = af->next) - count++; - - fprintf(fp,"Affects %4d (%8zd bytes), %2d free (%zd bytes)\n", - aff_count, aff_count * (sizeof(*af)), count, count * (sizeof(*af))); - - /* rooms */ - fprintf(fp,"Rooms %4d (%8zd bytes)\n", - top_room, top_room * (sizeof(*room))); - - /* exits */ - fprintf(fp,"Exits %4d (%8zd bytes)\n", - top_exit, top_exit * (sizeof(*exit))); - - fclose(fp); - - /* start printing out mobile data */ - fp = fopen("mob.dmp","w"); - - fprintf(fp,"\nMobile Analysis\n"); - fprintf(fp, "---------------\n"); - nMatch = 0; - for (vnum = 0; nMatch < top_mob_index; vnum++) - if ((pMobIndex = get_mob_index(vnum)) != NULL) - { - nMatch++; - fprintf(fp,"#%-4d %3d active %3d killed %s\n", - pMobIndex->vnum,pMobIndex->count, - pMobIndex->killed,pMobIndex->short_descr); - } - fclose(fp); - - /* start printing out object data */ - fp = fopen("obj.dmp","w"); - - fprintf(fp,"\nObject Analysis\n"); - fprintf(fp, "---------------\n"); - nMatch = 0; - for (vnum = 0; nMatch < top_obj_index; vnum++) - if ((pObjIndex = get_obj_index(vnum)) != NULL) - { - nMatch++; - fprintf(fp,"#%-4d %3d active %3d reset %s\n", - pObjIndex->vnum,pObjIndex->count, - pObjIndex->reset_num,pObjIndex->short_descr); - } - - /* close file */ - fclose(fp); - fpReserve = fopen( NULL_FILE, "r" ); -} - - - -/* - * Stick a little fuzz on a number. - */ -int number_fuzzy( int number ) -{ - switch ( number_bits( 2 ) ) - { - case 0: number -= 1; break; - case 3: number += 1; break; - } - - return UMAX( 1, number ); -} - - - -/* - * Generate a random number. - */ -int number_range( int from, int to ) -{ - int power; - int number; - - if (from == 0 && to == 0) - return 0; - - if ( ( to = to - from + 1 ) <= 1 ) - return from; - - for ( power = 2; power < to; power <<= 1 ) - ; - - while ( ( number = number_mm() & (power -1 ) ) >= to ) - ; - - return from + number; -} - - - -/* - * Generate a percentile roll. - */ -int number_percent( void ) -{ - int percent; - - while ( (percent = number_mm() & (128-1) ) > 99 ) - ; - - return 1 + percent; -} - - - -/* - * Generate a random door. - */ -int number_door( void ) -{ - int door; - - while ( ( door = number_mm() & (8-1) ) > 5) - ; - - return door; -} - -int number_bits( int width ) -{ - return number_mm( ) & ( ( 1 << width ) - 1 ); -} - - - - -/* - * I've gotten too many bad reports on OS-supplied random number generators. - * This is the Mitchell-Moore algorithm from Knuth Volume II. - * Best to leave the constants alone unless you've read Knuth. - * -- Furey - */ - -/* I noticed streaking with this random number generator, so I switched - back to the system srandom call. If this doesn't work for you, - define OLD_RAND to use the old system -- Alander */ - -#if defined (OLD_RAND) -static int rgiState[2+55]; -#endif - -void init_mm( ) -{ -#if defined (OLD_RAND) - int *piState; - int iState; - - piState = &rgiState[2]; - - piState[-2] = 55 - 55; - piState[-1] = 55 - 24; - - piState[0] = ((int) current_time) & ((1 << 30) - 1); - piState[1] = 1; - for ( iState = 2; iState < 55; iState++ ) - { - piState[iState] = (piState[iState-1] + piState[iState-2]) - & ((1 << 30) - 1); - } -#else - srandom(time(NULL)^getpid()); -#endif - return; -} - - - -long number_mm( void ) -{ -#if defined (OLD_RAND) - int *piState; - int iState1; - int iState2; - int iRand; - - piState = &rgiState[2]; - iState1 = piState[-2]; - iState2 = piState[-1]; - iRand = (piState[iState1] + piState[iState2]) - & ((1 << 30) - 1); - piState[iState1] = iRand; - if ( ++iState1 == 55 ) - iState1 = 0; - if ( ++iState2 == 55 ) - iState2 = 0; - piState[-2] = iState1; - piState[-1] = iState2; - return iRand >> 6; -#else - return random() >> 6; -#endif -} - - -/* - * Roll some dice. - */ -int dice( int number, int size ) -{ - int idice; - int sum; - - switch ( size ) - { - case 0: return 0; - case 1: return number; - } - - for ( idice = 0, sum = 0; idice < number; idice++ ) - sum += number_range( 1, size ); - - return sum; -} - - - -/* - * Simple linear interpolation. - */ -int interpolate( int level, int value_00, int value_32 ) -{ - return value_00 + level * (value_32 - value_00) / 32; -} - - - -/* - * Removes the tildes from a string. - * Used for player-entered strings that go into disk files. - */ -void smash_tilde( char *str ) -{ - for ( ; *str != '\0'; str++ ) - { - if ( *str == '~' ) - *str = '-'; - } - - return; -} - - - -/* - * Compare strings, case insensitive. - * Return TRUE if different - * (compatibility with historical functions). - */ -bool str_cmp( const char *astr, const char *bstr ) -{ - if ( astr == NULL ) - { - bug( "Str_cmp: null astr.", 0 ); - return TRUE; - } - - if ( bstr == NULL ) - { - bug( "Str_cmp: null bstr.", 0 ); - return TRUE; - } - - for ( ; *astr || *bstr; astr++, bstr++ ) - { - if ( LOWER(*astr) != LOWER(*bstr) ) - return TRUE; - } - - return FALSE; -} - - - -/* - * Compare strings, case insensitive, for prefix matching. - * Return TRUE if astr not a prefix of bstr - * (compatibility with historical functions). - */ -bool str_prefix( const char *astr, const char *bstr ) -{ - if ( astr == NULL ) - { - bug( "Strn_cmp: null astr.", 0 ); - return TRUE; - } - - if ( bstr == NULL ) - { - bug( "Strn_cmp: null bstr.", 0 ); - return TRUE; - } - - for ( ; *astr; astr++, bstr++ ) - { - if ( LOWER(*astr) != LOWER(*bstr) ) - return TRUE; - } - - return FALSE; -} - - - -/* - * Compare strings, case insensitive, for match anywhere. - * Returns TRUE is astr not part of bstr. - * (compatibility with historical functions). - */ -bool str_infix( const char *astr, const char *bstr ) -{ - int sstr1; - int sstr2; - int ichar; - char c0; - - if ( ( c0 = LOWER(astr[0]) ) == '\0' ) - return FALSE; - - sstr1 = strlen(astr); - sstr2 = strlen(bstr); - - for ( ichar = 0; ichar <= sstr2 - sstr1; ichar++ ) - { - if ( c0 == LOWER(bstr[ichar]) && !str_prefix( astr, bstr + ichar ) ) - return FALSE; - } - - return TRUE; -} - - - -/* - * Compare strings, case insensitive, for suffix matching. - * Return TRUE if astr not a suffix of bstr - * (compatibility with historical functions). - */ -bool str_suffix( const char *astr, const char *bstr ) -{ - int sstr1; - int sstr2; - - sstr1 = strlen(astr); - sstr2 = strlen(bstr); - if ( sstr1 <= sstr2 && !str_cmp( astr, bstr + sstr2 - sstr1 ) ) - return FALSE; - else - return TRUE; -} - - - -/* - * Returns an initial-capped string. - */ -char *capitalize( const char *str ) -{ - static char strcap[MAX_STRING_LENGTH]; - int i; - - for ( i = 0; str[i] != '\0'; i++ ) - strcap[i] = LOWER(str[i]); - strcap[i] = '\0'; - strcap[0] = UPPER(strcap[0]); - return strcap; -} - - -/* - * Append a string to a file. - */ -void append_file( CHAR_DATA *ch, char *file, char *str ) -{ - FILE *fp; - - if ( IS_NPC(ch) || str[0] == '\0' ) - return; - - fclose( fpReserve ); - if ( ( fp = fopen( file, "a" ) ) == NULL ) - { - perror( file ); - send_to_char( "Could not open the file!\n\r", ch ); - } - else - { - fprintf( fp, "[%5d] %s: %s\n", - ch->in_room ? ch->in_room->vnum : 0, ch->name, str ); - fclose( fp ); - } - - fpReserve = fopen( NULL_FILE, "r" ); - return; -} - - - -/* - * Reports a bug. - */ -void bug( const char *str, int param ) -{ - char buf[MAX_STRING_LENGTH]; - - if ( fpArea != NULL ) - { - int iLine; - int iChar; - - if ( fpArea == stdin ) - { - iLine = 0; - } - else - { - iChar = ftell( fpArea ); - fseek( fpArea, 0, 0 ); - for ( iLine = 0; ftell( fpArea ) < iChar; iLine++ ) - { - while ( getc( fpArea ) != '\n' ) - ; - } - fseek( fpArea, iChar, 0 ); - } - - sprintf( buf, "[*****] FILE: %s LINE: %d", strArea, iLine ); - log_string( buf ); -/* RT removed because we don't want bugs shutting the mud - if ( ( fp = fopen( "shutdown.txt", "a" ) ) != NULL ) - { - fprintf( fp, "[*****] %s\n", buf ); - fclose( fp ); - } -*/ - } - - strcpy( buf, "[*****] BUG: " ); - sprintf( buf + strlen(buf), str, param ); - log_string( buf ); -/* RT removed due to bug-file spamming - fclose( fpReserve ); - if ( ( fp = fopen( BUG_FILE, "a" ) ) != NULL ) - { - fprintf( fp, "%s\n", buf ); - fclose( fp ); - } - fpReserve = fopen( NULL_FILE, "r" ); -*/ - - return; -} - - - -/* - * Writes a string to the log. - */ -void log_string( const char *str ) -{ - char *strtime; - - strtime = ctime( ¤t_time ); - strtime[strlen(strtime)-1] = '\0'; - fprintf( stderr, "%s :: %s\n", strtime, str ); - return; -} - - - -/* - * This function is here to aid in debugging. - * If the last expression in a function is another function call, - * gcc likes to generate a JMP instead of a CALL. - * This is called "tail chaining." - * It hoses the debugger call stack for that call. - * So I make this the last call in certain critical functions, - * where I really need the call stack to be right for debugging! - * - * If you don't understand this, then LEAVE IT ALONE. - * Don't remove any calls to tail_chain anywhere. - * - * -- Furey - */ -void tail_chain( void ) -{ - return; -} diff --git a/Rom24/src/db.h b/Rom24/src/db.h deleted file mode 100644 index 48b5824..0000000 --- a/Rom24/src/db.h +++ /dev/null @@ -1,52 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -/* vals from db.c */ -extern bool fBootDb; -extern int newmobs; -extern int newobjs; -extern MOB_INDEX_DATA * mob_index_hash [MAX_KEY_HASH]; -extern OBJ_INDEX_DATA * obj_index_hash [MAX_KEY_HASH]; -extern int top_mob_index; -extern int top_obj_index; -extern int top_affect; -extern int top_ed; -extern AREA_DATA * area_first; - - -/* from db2.c */ -extern int social_count; - -/* conversion from db.h */ -void convert_mob(MOB_INDEX_DATA *mob); -void convert_obj(OBJ_INDEX_DATA *obj); - -/* macro for flag swapping */ -#define GET_UNSET(flag1,flag2) (~(flag1)&((flag1)|(flag2))) - -/* Magic number for memory allocation */ -#define MAGIC_NUM 52571214 diff --git a/Rom24/src/db2.c b/Rom24/src/db2.c deleted file mode 100644 index 89c0929..0000000 --- a/Rom24/src/db2.c +++ /dev/null @@ -1,493 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#include -#include -#include -#include -#include -#if defined(macintosh) -#include -#else -#include -#include -#endif - -#include "merc.h" -#include "db.h" -#include "lookup.h" - - -/* values for db2.c */ -struct social_type social_list [MAX_SOCIALS]; -int social_count; - -/* snarf a socials file */ -void load_socials( FILE *fp) -{ - for ( ; ; ) - { - struct social_type social; - char *temp; - /* clear social */ - social.char_no_arg = NULL; - social.others_no_arg = NULL; - social.char_found = NULL; - social.others_found = NULL; - social.vict_found = NULL; - social.char_not_found = NULL; - social.char_auto = NULL; - social.others_auto = NULL; - - temp = fread_word(fp); - if (!strcmp(temp,"#0")) - return; /* done */ - strcpy(social.name,temp); - fread_to_eol(fp); - - temp = fread_string_eol(fp); - if (!strcmp(temp,"$")) - social.char_no_arg = NULL; - else if (!strcmp(temp,"#")) - { - social_list[social_count] = social; - social_count++; - continue; - } - else - social.char_no_arg = temp; - - temp = fread_string_eol(fp); - if (!strcmp(temp,"$")) - social.others_no_arg = NULL; - - - - - - - - - - - - - - - temp = fread_string_eol(fp); - if (!strcmp(temp,"$")) - social.char_auto = NULL; - else if (!strcmp(temp,"#")) - { - social_list[social_count] = social; - social_count++; - continue; - } - else - social.char_auto = temp; - - temp = fread_string_eol(fp); - if (!strcmp(temp,"$")) - social.others_auto = NULL; - else if (!strcmp(temp,"#")) - { - social_list[social_count] = social; - social_count++; - continue; - } - else - social.others_auto = temp; - - social_list[social_count] = social; - social_count++; - } - return; -} - - - - - - -/* - * Snarf a mob section. new style - */ -void load_mobiles( FILE *fp ) -{ - MOB_INDEX_DATA *pMobIndex; - - for ( ; ; ) - { - sh_int vnum; - char letter; - int iHash; - - letter = fread_letter( fp ); - if ( letter != '#' ) - { - bug( "Load_mobiles: # not found.", 0 ); - exit( 1 ); - } - - vnum = fread_number( fp ); - if ( vnum == 0 ) - break; - - fBootDb = FALSE; - if ( get_mob_index( vnum ) != NULL ) - { - bug( "Load_mobiles: vnum %d duplicated.", vnum ); - exit( 1 ); - } - fBootDb = TRUE; - - pMobIndex = alloc_perm( sizeof(*pMobIndex) ); - pMobIndex->vnum = vnum; - pMobIndex->new_format = TRUE; - newmobs++; - pMobIndex->player_name = fread_string( fp ); - pMobIndex->short_descr = fread_string( fp ); - pMobIndex->long_descr = fread_string( fp ); - pMobIndex->description = fread_string( fp ); - pMobIndex->race = race_lookup(fread_string( fp )); - - pMobIndex->long_descr[0] = UPPER(pMobIndex->long_descr[0]); - pMobIndex->description[0] = UPPER(pMobIndex->description[0]); - - pMobIndex->act = fread_flag( fp ) | ACT_IS_NPC - | race_table[pMobIndex->race].act; - pMobIndex->affected_by = fread_flag( fp ) - | race_table[pMobIndex->race].aff; - pMobIndex->pShop = NULL; - pMobIndex->alignment = fread_number( fp ); - pMobIndex->group = fread_number( fp ); - - pMobIndex->level = fread_number( fp ); - pMobIndex->hitroll = fread_number( fp ); - - /* read hit dice */ - pMobIndex->hit[DICE_NUMBER] = fread_number( fp ); - /* 'd' */ fread_letter( fp ); - pMobIndex->hit[DICE_TYPE] = fread_number( fp ); - /* '+' */ fread_letter( fp ); - pMobIndex->hit[DICE_BONUS] = fread_number( fp ); - - /* read mana dice */ - pMobIndex->mana[DICE_NUMBER] = fread_number( fp ); - fread_letter( fp ); - pMobIndex->mana[DICE_TYPE] = fread_number( fp ); - fread_letter( fp ); - pMobIndex->mana[DICE_BONUS] = fread_number( fp ); - - /* read damage dice */ - pMobIndex->damage[DICE_NUMBER] = fread_number( fp ); - fread_letter( fp ); - pMobIndex->damage[DICE_TYPE] = fread_number( fp ); - fread_letter( fp ); - pMobIndex->damage[DICE_BONUS] = fread_number( fp ); - pMobIndex->dam_type = attack_lookup(fread_word(fp)); - - /* read armor class */ - pMobIndex->ac[AC_PIERCE] = fread_number( fp ) * 10; - pMobIndex->ac[AC_BASH] = fread_number( fp ) * 10; - pMobIndex->ac[AC_SLASH] = fread_number( fp ) * 10; - pMobIndex->ac[AC_EXOTIC] = fread_number( fp ) * 10; - - /* read flags and add in data from the race table */ - pMobIndex->off_flags = fread_flag( fp ) - | race_table[pMobIndex->race].off; - pMobIndex->imm_flags = fread_flag( fp ) - | race_table[pMobIndex->race].imm; - pMobIndex->res_flags = fread_flag( fp ) - | race_table[pMobIndex->race].res; - pMobIndex->vuln_flags = fread_flag( fp ) - | race_table[pMobIndex->race].vuln; - - /* vital statistics */ - pMobIndex->start_pos = position_lookup(fread_word(fp)); - pMobIndex->default_pos = position_lookup(fread_word(fp)); - pMobIndex->sex = sex_lookup(fread_word(fp)); - - pMobIndex->wealth = fread_number( fp ); - - pMobIndex->form = fread_flag( fp ) - | race_table[pMobIndex->race].form; - pMobIndex->parts = fread_flag( fp ) - | race_table[pMobIndex->race].parts; - /* size */ - pMobIndex->size = size_lookup(fread_word(fp)); - pMobIndex->material = str_dup(fread_word( fp )); - - for ( ; ; ) - { - letter = fread_letter( fp ); - - if (letter == 'F') - { - char *word; - long vector; - - word = fread_word(fp); - vector = fread_flag(fp); - - if (!str_prefix(word,"act")) - REMOVE_BIT(pMobIndex->act,vector); - else if (!str_prefix(word,"aff")) - REMOVE_BIT(pMobIndex->affected_by,vector); - else if (!str_prefix(word,"off")) - REMOVE_BIT(pMobIndex->off_flags,vector); - else if (!str_prefix(word,"imm")) - REMOVE_BIT(pMobIndex->imm_flags,vector); - else if (!str_prefix(word,"res")) - REMOVE_BIT(pMobIndex->res_flags,vector); - else if (!str_prefix(word,"vul")) - REMOVE_BIT(pMobIndex->vuln_flags,vector); - else if (!str_prefix(word,"for")) - REMOVE_BIT(pMobIndex->form,vector); - else if (!str_prefix(word,"par")) - REMOVE_BIT(pMobIndex->parts,vector); - else - { - bug("Flag remove: flag not found.",0); - exit(1); - } - } - else - { - ungetc(letter,fp); - break; - } - } - - iHash = vnum % MAX_KEY_HASH; - pMobIndex->next = mob_index_hash[iHash]; - mob_index_hash[iHash] = pMobIndex; - top_mob_index++; - kill_table[URANGE(0, pMobIndex->level, MAX_LEVEL-1)].number++; - } - - return; -} - -/* - * Snarf an obj section. new style - */ -void load_objects( FILE *fp ) -{ - OBJ_INDEX_DATA *pObjIndex; - - for ( ; ; ) - { - sh_int vnum; - char letter; - int iHash; - - letter = fread_letter( fp ); - if ( letter != '#' ) - { - bug( "Load_objects: # not found.", 0 ); - exit( 1 ); - } - - vnum = fread_number( fp ); - if ( vnum == 0 ) - break; - - fBootDb = FALSE; - if ( get_obj_index( vnum ) != NULL ) - { - bug( "Load_objects: vnum %d duplicated.", vnum ); - exit( 1 ); - } - fBootDb = TRUE; - - pObjIndex = alloc_perm( sizeof(*pObjIndex) ); - pObjIndex->vnum = vnum; - pObjIndex->new_format = TRUE; - pObjIndex->reset_num = 0; - newobjs++; - pObjIndex->name = fread_string( fp ); - pObjIndex->short_descr = fread_string( fp ); - pObjIndex->description = fread_string( fp ); - pObjIndex->material = fread_string( fp ); - - pObjIndex->item_type = item_lookup(fread_word( fp )); - pObjIndex->extra_flags = fread_flag( fp ); - pObjIndex->wear_flags = fread_flag( fp ); - switch(pObjIndex->item_type) - { - case ITEM_WEAPON: - pObjIndex->value[0] = weapon_type(fread_word(fp)); - pObjIndex->value[1] = fread_number(fp); - pObjIndex->value[2] = fread_number(fp); - pObjIndex->value[3] = attack_lookup(fread_word(fp)); - pObjIndex->value[4] = fread_flag(fp); - break; - case ITEM_CONTAINER: - pObjIndex->value[0] = fread_number(fp); - pObjIndex->value[1] = fread_flag(fp); - pObjIndex->value[2] = fread_number(fp); - pObjIndex->value[3] = fread_number(fp); - pObjIndex->value[4] = fread_number(fp); - break; - case ITEM_DRINK_CON: - case ITEM_FOUNTAIN: - pObjIndex->value[0] = fread_number(fp); - pObjIndex->value[1] = fread_number(fp); - pObjIndex->value[2] = liq_lookup(fread_word(fp)); - pObjIndex->value[3] = fread_number(fp); - pObjIndex->value[4] = fread_number(fp); - break; - case ITEM_WAND: - case ITEM_STAFF: - pObjIndex->value[0] = fread_number(fp); - pObjIndex->value[1] = fread_number(fp); - pObjIndex->value[2] = fread_number(fp); - pObjIndex->value[3] = skill_lookup(fread_word(fp)); - pObjIndex->value[4] = fread_number(fp); - break; - case ITEM_POTION: - case ITEM_PILL: - case ITEM_SCROLL: - pObjIndex->value[0] = fread_number(fp); - pObjIndex->value[1] = skill_lookup(fread_word(fp)); - pObjIndex->value[2] = skill_lookup(fread_word(fp)); - pObjIndex->value[3] = skill_lookup(fread_word(fp)); - pObjIndex->value[4] = skill_lookup(fread_word(fp)); - break; - default: - pObjIndex->value[0] = fread_flag( fp ); - pObjIndex->value[1] = fread_flag( fp ); - pObjIndex->value[2] = fread_flag( fp ); - pObjIndex->value[3] = fread_flag( fp ); - pObjIndex->value[4] = fread_flag( fp ); - break; - } - pObjIndex->level = fread_number( fp ); - pObjIndex->weight = fread_number( fp ); - pObjIndex->cost = fread_number( fp ); - - /* condition */ - letter = fread_letter( fp ); - switch (letter) - { - case ('P') : pObjIndex->condition = 100; break; - case ('G') : pObjIndex->condition = 90; break; - case ('A') : pObjIndex->condition = 75; break; - case ('W') : pObjIndex->condition = 50; break; - case ('D') : pObjIndex->condition = 25; break; - case ('B') : pObjIndex->condition = 10; break; - case ('R') : pObjIndex->condition = 0; break; - default: pObjIndex->condition = 100; break; - } - - for ( ; ; ) - { - char letter; - - letter = fread_letter( fp ); - - if ( letter == 'A' ) - { - AFFECT_DATA *paf; - - paf = alloc_perm( sizeof(*paf) ); - paf->where = TO_OBJECT; - paf->type = -1; - paf->level = pObjIndex->level; - paf->duration = -1; - paf->location = fread_number( fp ); - paf->modifier = fread_number( fp ); - paf->bitvector = 0; - paf->next = pObjIndex->affected; - pObjIndex->affected = paf; - top_affect++; - } - - else if (letter == 'F') - { - AFFECT_DATA *paf; - - paf = alloc_perm( sizeof(*paf) ); - letter = fread_letter(fp); - switch (letter) - { - case 'A': - paf->where = TO_AFFECTS; - break; - case 'I': - paf->where = TO_IMMUNE; - break; - case 'R': - paf->where = TO_RESIST; - break; - case 'V': - paf->where = TO_VULN; - break; - default: - bug( "Load_objects: Bad where on flag set.", 0 ); - exit( 1 ); - } - paf->type = -1; - paf->level = pObjIndex->level; - paf->duration = -1; - paf->location = fread_number(fp); - paf->modifier = fread_number(fp); - paf->bitvector = fread_flag(fp); - paf->next = pObjIndex->affected; - pObjIndex->affected = paf; - top_affect++; - } - - else if ( letter == 'E' ) - { - EXTRA_DESCR_DATA *ed; - - ed = alloc_perm( sizeof(*ed) ); - ed->keyword = fread_string( fp ); - ed->description = fread_string( fp ); - ed->next = pObjIndex->extra_descr; - pObjIndex->extra_descr = ed; - top_ed++; - } - - else - { - ungetc( letter, fp ); - break; - } - } - - iHash = vnum % MAX_KEY_HASH; - pObjIndex->next = obj_index_hash[iHash]; - obj_index_hash[iHash] = pObjIndex; - top_obj_index++; - } - - return; -} - diff --git a/Rom24/src/effects.c b/Rom24/src/effects.c deleted file mode 100644 index c56fe92..0000000 --- a/Rom24/src/effects.c +++ /dev/null @@ -1,621 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#endif -#include -#include -#include -#include -#include "merc.h" -#include "recycle.h" - -void acid_effect(void *vo, int level, int dam, int target) -{ - if (target == TARGET_ROOM) /* nail objects on the floor */ - { - ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo; - OBJ_DATA *obj, *obj_next; - - for (obj = room->contents; obj != NULL; obj = obj_next) - { - obj_next = obj->next_content; - acid_effect(obj,level,dam,TARGET_OBJ); - } - return; - } - - if (target == TARGET_CHAR) /* do the effect on a victim */ - { - CHAR_DATA *victim = (CHAR_DATA *) vo; - OBJ_DATA *obj, *obj_next; - - /* let's toast some gear */ - for (obj = victim->carrying; obj != NULL; obj = obj_next) - { - obj_next = obj->next_content; - acid_effect(obj,level,dam,TARGET_OBJ); - } - return; - } - - if (target == TARGET_OBJ) /* toast an object */ - { - OBJ_DATA *obj = (OBJ_DATA *) vo; - OBJ_DATA *t_obj,*n_obj; - int chance; - char *msg; - - if (IS_OBJ_STAT(obj,ITEM_BURN_PROOF) - || IS_OBJ_STAT(obj,ITEM_NOPURGE) - || number_range(0,4) == 0) - return; - - chance = level / 4 + dam / 10; - - if (chance > 25) - chance = (chance - 25) / 2 + 25; - if (chance > 50) - chance = (chance - 50) / 2 + 50; - - if (IS_OBJ_STAT(obj,ITEM_BLESS)) - chance -= 5; - - chance -= obj->level * 2; - - switch (obj->item_type) - { - default: - return; - case ITEM_CONTAINER: - case ITEM_CORPSE_PC: - case ITEM_CORPSE_NPC: - msg = "$p fumes and dissolves."; - break; - case ITEM_ARMOR: - msg = "$p is pitted and etched."; - break; - case ITEM_CLOTHING: - msg = "$p is corroded into scrap."; - break; - case ITEM_STAFF: - case ITEM_WAND: - chance -= 10; - msg = "$p corrodes and breaks."; - break; - case ITEM_SCROLL: - chance += 10; - msg = "$p is burned into waste."; - break; - } - - chance = URANGE(5,chance,95); - - if (number_percent() > chance) - return; - - if (obj->carried_by != NULL) - act(msg,obj->carried_by,obj,NULL,TO_ALL); - else if (obj->in_room != NULL && obj->in_room->people != NULL) - act(msg,obj->in_room->people,obj,NULL,TO_ALL); - - if (obj->item_type == ITEM_ARMOR) /* etch it */ - { - AFFECT_DATA *paf; - bool af_found = FALSE; - int i; - - affect_enchant(obj); - - for ( paf = obj->affected; paf != NULL; paf = paf->next) - { - if ( paf->location == APPLY_AC) - { - af_found = TRUE; - paf->type = -1; - paf->modifier += 1; - paf->level = UMAX(paf->level,level); - break; - } - } - - if (!af_found) - /* needs a new affect */ - { - paf = new_affect(); - - paf->type = -1; - paf->level = level; - paf->duration = -1; - paf->location = APPLY_AC; - paf->modifier = 1; - paf->bitvector = 0; - paf->next = obj->affected; - obj->affected = paf; - } - - if (obj->carried_by != NULL && obj->wear_loc != WEAR_NONE) - for (i = 0; i < 4; i++) - obj->carried_by->armor[i] += 1; - return; - } - - /* get rid of the object */ - if (obj->contains) /* dump contents */ - { - for (t_obj = obj->contains; t_obj != NULL; t_obj = n_obj) - { - n_obj = t_obj->next_content; - obj_from_obj(t_obj); - if (obj->in_room != NULL) - obj_to_room(t_obj,obj->in_room); - else if (obj->carried_by != NULL) - obj_to_room(t_obj,obj->carried_by->in_room); - else - { - extract_obj(t_obj); - continue; - } - - acid_effect(t_obj,level/2,dam/2,TARGET_OBJ); - } - } - - extract_obj(obj); - return; - } -} - - -void cold_effect(void *vo, int level, int dam, int target) -{ - if (target == TARGET_ROOM) /* nail objects on the floor */ - { - ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo; - OBJ_DATA *obj, *obj_next; - - for (obj = room->contents; obj != NULL; obj = obj_next) - { - obj_next = obj->next_content; - cold_effect(obj,level,dam,TARGET_OBJ); - } - return; - } - - if (target == TARGET_CHAR) /* whack a character */ - { - CHAR_DATA *victim = (CHAR_DATA *) vo; - OBJ_DATA *obj, *obj_next; - - /* chill touch effect */ - if (!saves_spell(level/4 + dam / 20, victim, DAM_COLD)) - { - AFFECT_DATA af; - - act("$n turns blue and shivers.",victim,NULL,NULL,TO_ROOM); - act("A chill sinks deep into your bones.",victim,NULL,NULL,TO_CHAR); - af.where = TO_AFFECTS; - af.type = skill_lookup("chill touch"); - af.level = level; - af.duration = 6; - af.location = APPLY_STR; - af.modifier = -1; - af.bitvector = 0; - affect_join( victim, &af ); - } - - /* hunger! (warmth sucked out */ - if (!IS_NPC(victim)) - gain_condition(victim,COND_HUNGER,dam/20); - - /* let's toast some gear */ - for (obj = victim->carrying; obj != NULL; obj = obj_next) - { - obj_next = obj->next_content; - cold_effect(obj,level,dam,TARGET_OBJ); - } - return; - } - - if (target == TARGET_OBJ) /* toast an object */ - { - OBJ_DATA *obj = (OBJ_DATA *) vo; - int chance; - char *msg; - - if (IS_OBJ_STAT(obj,ITEM_BURN_PROOF) - || IS_OBJ_STAT(obj,ITEM_NOPURGE) - || number_range(0,4) == 0) - return; - - chance = level / 4 + dam / 10; - - if (chance > 25) - chance = (chance - 25) / 2 + 25; - if (chance > 50) - chance = (chance - 50) / 2 + 50; - - if (IS_OBJ_STAT(obj,ITEM_BLESS)) - chance -= 5; - - chance -= obj->level * 2; - - switch(obj->item_type) - { - default: - return; - case ITEM_POTION: - msg = "$p freezes and shatters!"; - chance += 25; - break; - case ITEM_DRINK_CON: - msg = "$p freezes and shatters!"; - chance += 5; - break; - } - - chance = URANGE(5,chance,95); - - if (number_percent() > chance) - return; - - if (obj->carried_by != NULL) - act(msg,obj->carried_by,obj,NULL,TO_ALL); - else if (obj->in_room != NULL && obj->in_room->people != NULL) - act(msg,obj->in_room->people,obj,NULL,TO_ALL); - - extract_obj(obj); - return; - } -} - - - -void fire_effect(void *vo, int level, int dam, int target) -{ - if (target == TARGET_ROOM) /* nail objects on the floor */ - { - ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo; - OBJ_DATA *obj, *obj_next; - - for (obj = room->contents; obj != NULL; obj = obj_next) - { - obj_next = obj->next_content; - fire_effect(obj,level,dam,TARGET_OBJ); - } - return; - } - - if (target == TARGET_CHAR) /* do the effect on a victim */ - { - CHAR_DATA *victim = (CHAR_DATA *) vo; - OBJ_DATA *obj, *obj_next; - - /* chance of blindness */ - if (!IS_AFFECTED(victim,AFF_BLIND) - && !saves_spell(level / 4 + dam / 20, victim,DAM_FIRE)) - { - AFFECT_DATA af; - act("$n is blinded by smoke!",victim,NULL,NULL,TO_ROOM); - act("Your eyes tear up from smoke...you can't see a thing!", - victim,NULL,NULL,TO_CHAR); - - af.where = TO_AFFECTS; - af.type = skill_lookup("fire breath"); - af.level = level; - af.duration = number_range(0,level/10); - af.location = APPLY_HITROLL; - af.modifier = -4; - af.bitvector = AFF_BLIND; - - affect_to_char(victim,&af); - } - - /* getting thirsty */ - if (!IS_NPC(victim)) - gain_condition(victim,COND_THIRST,dam/20); - - /* let's toast some gear! */ - for (obj = victim->carrying; obj != NULL; obj = obj_next) - { - obj_next = obj->next_content; - - fire_effect(obj,level,dam,TARGET_OBJ); - } - return; - } - - if (target == TARGET_OBJ) /* toast an object */ - { - OBJ_DATA *obj = (OBJ_DATA *) vo; - OBJ_DATA *t_obj,*n_obj; - int chance; - char *msg; - - if (IS_OBJ_STAT(obj,ITEM_BURN_PROOF) - || IS_OBJ_STAT(obj,ITEM_NOPURGE) - || number_range(0,4) == 0) - return; - - chance = level / 4 + dam / 10; - - if (chance > 25) - chance = (chance - 25) / 2 + 25; - if (chance > 50) - chance = (chance - 50) / 2 + 50; - - if (IS_OBJ_STAT(obj,ITEM_BLESS)) - chance -= 5; - chance -= obj->level * 2; - - switch ( obj->item_type ) - { - default: - return; - case ITEM_CONTAINER: - msg = "$p ignites and burns!"; - break; - case ITEM_POTION: - chance += 25; - msg = "$p bubbles and boils!"; - break; - case ITEM_SCROLL: - chance += 50; - msg = "$p crackles and burns!"; - break; - case ITEM_STAFF: - chance += 10; - msg = "$p smokes and chars!"; - break; - case ITEM_WAND: - msg = "$p sparks and sputters!"; - break; - case ITEM_FOOD: - msg = "$p blackens and crisps!"; - break; - case ITEM_PILL: - msg = "$p melts and drips!"; - break; - } - - chance = URANGE(5,chance,95); - - if (number_percent() > chance) - return; - - if (obj->carried_by != NULL) - act( msg, obj->carried_by, obj, NULL, TO_ALL ); - else if (obj->in_room != NULL && obj->in_room->people != NULL) - act(msg,obj->in_room->people,obj,NULL,TO_ALL); - - if (obj->contains) - { - /* dump the contents */ - - for (t_obj = obj->contains; t_obj != NULL; t_obj = n_obj) - { - n_obj = t_obj->next_content; - obj_from_obj(t_obj); - if (obj->in_room != NULL) - obj_to_room(t_obj,obj->in_room); - else if (obj->carried_by != NULL) - obj_to_room(t_obj,obj->carried_by->in_room); - else - { - extract_obj(t_obj); - continue; - } - fire_effect(t_obj,level/2,dam/2,TARGET_OBJ); - } - } - - extract_obj( obj ); - return; - } -} - -void poison_effect(void *vo,int level, int dam, int target) -{ - if (target == TARGET_ROOM) /* nail objects on the floor */ - { - ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo; - OBJ_DATA *obj, *obj_next; - - for (obj = room->contents; obj != NULL; obj = obj_next) - { - obj_next = obj->next_content; - poison_effect(obj,level,dam,TARGET_OBJ); - } - return; - } - - if (target == TARGET_CHAR) /* do the effect on a victim */ - { - CHAR_DATA *victim = (CHAR_DATA *) vo; - OBJ_DATA *obj, *obj_next; - - /* chance of poisoning */ - if (!saves_spell(level / 4 + dam / 20,victim,DAM_POISON)) - { - AFFECT_DATA af; - - send_to_char("You feel poison coursing through your veins.\n\r", - victim); - act("$n looks very ill.",victim,NULL,NULL,TO_ROOM); - - af.where = TO_AFFECTS; - af.type = gsn_poison; - af.level = level; - af.duration = level / 2; - af.location = APPLY_STR; - af.modifier = -1; - af.bitvector = AFF_POISON; - affect_join( victim, &af ); - } - - /* equipment */ - for (obj = victim->carrying; obj != NULL; obj = obj_next) - { - obj_next = obj->next_content; - poison_effect(obj,level,dam,TARGET_OBJ); - } - return; - } - - if (target == TARGET_OBJ) /* do some poisoning */ - { - OBJ_DATA *obj = (OBJ_DATA *) vo; - int chance; - - - if (IS_OBJ_STAT(obj,ITEM_BURN_PROOF) - || IS_OBJ_STAT(obj,ITEM_BLESS) - || number_range(0,4) == 0) - return; - - chance = level / 4 + dam / 10; - if (chance > 25) - chance = (chance - 25) / 2 + 25; - if (chance > 50) - chance = (chance - 50) / 2 + 50; - - chance -= obj->level * 2; - - switch (obj->item_type) - { - default: - return; - case ITEM_FOOD: - break; - case ITEM_DRINK_CON: - if (obj->value[0] == obj->value[1]) - return; - break; - } - - chance = URANGE(5,chance,95); - - if (number_percent() > chance) - return; - - obj->value[3] = 1; - return; - } -} - - -void shock_effect(void *vo,int level, int dam, int target) -{ - if (target == TARGET_ROOM) - { - ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo; - OBJ_DATA *obj, *obj_next; - - for (obj = room->contents; obj != NULL; obj = obj_next) - { - obj_next = obj->next_content; - shock_effect(obj,level,dam,TARGET_OBJ); - } - return; - } - - if (target == TARGET_CHAR) - { - CHAR_DATA *victim = (CHAR_DATA *) vo; - OBJ_DATA *obj, *obj_next; - - /* daze and confused? */ - if (!saves_spell(level/4 + dam/20,victim,DAM_LIGHTNING)) - { - send_to_char("Your muscles stop responding.\n\r",victim); - DAZE_STATE(victim,UMAX(12,level/4 + dam/20)); - } - - /* toast some gear */ - for (obj = victim->carrying; obj != NULL; obj = obj_next) - { - obj_next = obj->next_content; - shock_effect(obj,level,dam,TARGET_OBJ); - } - return; - } - - if (target == TARGET_OBJ) - { - OBJ_DATA *obj = (OBJ_DATA *) vo; - int chance; - char *msg; - - if (IS_OBJ_STAT(obj,ITEM_BURN_PROOF) - || IS_OBJ_STAT(obj,ITEM_NOPURGE) - || number_range(0,4) == 0) - return; - - chance = level / 4 + dam / 10; - - if (chance > 25) - chance = (chance - 25) / 2 + 25; - if (chance > 50) - chance = (chance - 50) /2 + 50; - - if (IS_OBJ_STAT(obj,ITEM_BLESS)) - chance -= 5; - - chance -= obj->level * 2; - - switch(obj->item_type) - { - default: - return; - case ITEM_WAND: - case ITEM_STAFF: - chance += 10; - msg = "$p overloads and explodes!"; - break; - case ITEM_JEWELRY: - chance -= 10; - msg = "$p is fused into a worthless lump."; - } - - chance = URANGE(5,chance,95); - - if (number_percent() > chance) - return; - - if (obj->carried_by != NULL) - act(msg,obj->carried_by,obj,NULL,TO_ALL); - else if (obj->in_room != NULL && obj->in_room->people != NULL) - act(msg,obj->in_room->people,obj,NULL,TO_ALL); - - extract_obj(obj); - return; - } -} - diff --git a/Rom24/src/fight.c b/Rom24/src/fight.c deleted file mode 100644 index b9acac0..0000000 --- a/Rom24/src/fight.c +++ /dev/null @@ -1,3095 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#endif -#include -#include -#include -#include "merc.h" -#include "interp.h" - -/* - * Local functions. - */ -void check_assist args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); -bool check_dodge args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); -void check_killer args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); -bool check_parry args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); -bool check_shield_block args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); -void dam_message args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dam, - int dt, bool immune ) ); -void death_cry args( ( CHAR_DATA *ch ) ); -void group_gain args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); -int xp_compute args( ( CHAR_DATA *gch, CHAR_DATA *victim, - int total_levels ) ); -bool is_safe args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); -void make_corpse args( ( CHAR_DATA *ch ) ); -void one_hit args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dt ) ); -void mob_hit args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dt ) ); -void raw_kill args( ( CHAR_DATA *victim ) ); -void set_fighting args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); -void disarm args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); - - - -/* - * Control the fights going on. - * Called periodically by update_handler. - */ -void violence_update( void ) -{ - CHAR_DATA *ch; - CHAR_DATA *ch_next; - CHAR_DATA *victim; - - for ( ch = char_list; ch != NULL; ch = ch->next ) - { - ch_next = ch->next; - - if ( ( victim = ch->fighting ) == NULL || ch->in_room == NULL ) - continue; - - if ( IS_AWAKE(ch) && ch->in_room == victim->in_room ) - multi_hit( ch, victim, TYPE_UNDEFINED ); - else - stop_fighting( ch, FALSE ); - - if ( ( victim = ch->fighting ) == NULL ) - continue; - - /* - * Fun for the whole family! - */ - check_assist(ch,victim); - } - - return; -} - -/* for auto assisting */ -void check_assist(CHAR_DATA *ch,CHAR_DATA *victim) -{ - CHAR_DATA *rch, *rch_next; - - for (rch = ch->in_room->people; rch != NULL; rch = rch_next) - { - rch_next = rch->next_in_room; - - if (IS_AWAKE(rch) && rch->fighting == NULL) - { - - /* quick check for ASSIST_PLAYER */ - if (!IS_NPC(ch) && IS_NPC(rch) - && IS_SET(rch->off_flags,ASSIST_PLAYERS) - && rch->level + 6 > victim->level) - { - do_function(rch, &do_emote, "screams and attacks!"); - multi_hit(rch,victim,TYPE_UNDEFINED); - continue; - } - - /* PCs next */ - if (!IS_NPC(ch) || IS_AFFECTED(ch,AFF_CHARM)) - { - if ( ( (!IS_NPC(rch) && IS_SET(rch->act,PLR_AUTOASSIST)) - || IS_AFFECTED(rch,AFF_CHARM)) - && is_same_group(ch,rch) - && !is_safe(rch, victim)) - multi_hit (rch,victim,TYPE_UNDEFINED); - - continue; - } - - /* now check the NPC cases */ - - if (IS_NPC(ch) && !IS_AFFECTED(ch,AFF_CHARM)) - - { - if ( (IS_NPC(rch) && IS_SET(rch->off_flags,ASSIST_ALL)) - - || (IS_NPC(rch) && rch->group && rch->group == ch->group) - - || (IS_NPC(rch) && rch->race == ch->race - && IS_SET(rch->off_flags,ASSIST_RACE)) - - || (IS_NPC(rch) && IS_SET(rch->off_flags,ASSIST_ALIGN) - && ((IS_GOOD(rch) && IS_GOOD(ch)) - || (IS_EVIL(rch) && IS_EVIL(ch)) - || (IS_NEUTRAL(rch) && IS_NEUTRAL(ch)))) - - || (rch->pIndexData == ch->pIndexData - && IS_SET(rch->off_flags,ASSIST_VNUM))) - - { - CHAR_DATA *vch; - CHAR_DATA *target; - int number; - - if (number_bits(1) == 0) - continue; - - target = NULL; - number = 0; - for (vch = ch->in_room->people; vch; vch = vch->next) - { - if (can_see(rch,vch) - && is_same_group(vch,victim) - && number_range(0,number) == 0) - { - target = vch; - number++; - } - } - - if (target != NULL) - { - do_function(rch, &do_emote, "screams and attacks!"); - multi_hit(rch,target,TYPE_UNDEFINED); - } - } - } - } - } -} - - -/* - * Do one group of attacks. - */ -void multi_hit( CHAR_DATA *ch, CHAR_DATA *victim, int dt ) -{ - int chance; - - /* decrement the wait */ - if (ch->desc == NULL) - ch->wait = UMAX(0,ch->wait - PULSE_VIOLENCE); - - if (ch->desc == NULL) - ch->daze = UMAX(0,ch->daze - PULSE_VIOLENCE); - - - /* no attacks for stunnies -- just a check */ - if (ch->position < POS_RESTING) - return; - - if (IS_NPC(ch)) - { - mob_hit(ch,victim,dt); - return; - } - - one_hit( ch, victim, dt ); - - if (ch->fighting != victim) - return; - - if (IS_AFFECTED(ch,AFF_HASTE)) - one_hit(ch,victim,dt); - - if ( ch->fighting != victim || dt == gsn_backstab ) - return; - - chance = get_skill(ch,gsn_second_attack)/2; - - if (IS_AFFECTED(ch,AFF_SLOW)) - chance /= 2; - - if ( number_percent( ) < chance ) - { - one_hit( ch, victim, dt ); - check_improve(ch,gsn_second_attack,TRUE,5); - if ( ch->fighting != victim ) - return; - } - - chance = get_skill(ch,gsn_third_attack)/4; - - if (IS_AFFECTED(ch,AFF_SLOW)) - chance = 0;; - - if ( number_percent( ) < chance ) - { - one_hit( ch, victim, dt ); - check_improve(ch,gsn_third_attack,TRUE,6); - if ( ch->fighting != victim ) - return; - } - - return; -} - -/* procedure for all mobile attacks */ -void mob_hit (CHAR_DATA *ch, CHAR_DATA *victim, int dt) -{ - int chance,number; - CHAR_DATA *vch, *vch_next; - - one_hit(ch,victim,dt); - - if (ch->fighting != victim) - return; - - /* Area attack -- BALLS nasty! */ - - if (IS_SET(ch->off_flags,OFF_AREA_ATTACK)) - { - for (vch = ch->in_room->people; vch != NULL; vch = vch_next) - { - vch_next = vch->next; - if ((vch != victim && vch->fighting == ch)) - one_hit(ch,vch,dt); - } - } - - if (IS_AFFECTED(ch,AFF_HASTE) - || (IS_SET(ch->off_flags,OFF_FAST) && !IS_AFFECTED(ch,AFF_SLOW))) - one_hit(ch,victim,dt); - - if (ch->fighting != victim || dt == gsn_backstab) - return; - - chance = get_skill(ch,gsn_second_attack)/2; - - if (IS_AFFECTED(ch,AFF_SLOW) && !IS_SET(ch->off_flags,OFF_FAST)) - chance /= 2; - - if (number_percent() < chance) - { - one_hit(ch,victim,dt); - if (ch->fighting != victim) - return; - } - - chance = get_skill(ch,gsn_third_attack)/4; - - if (IS_AFFECTED(ch,AFF_SLOW) && !IS_SET(ch->off_flags,OFF_FAST)) - chance = 0; - - if (number_percent() < chance) - { - one_hit(ch,victim,dt); - if (ch->fighting != victim) - return; - } - - /* oh boy! Fun stuff! */ - - if (ch->wait > 0) - return; - - number = number_range(0,2); - - if (number == 1 && IS_SET(ch->act,ACT_MAGE)) - { - /* { mob_cast_mage(ch,victim); return; } */ ; - } - - if (number == 2 && IS_SET(ch->act,ACT_CLERIC)) - { - /* { mob_cast_cleric(ch,victim); return; } */ ; - } - - /* now for the skills */ - - number = number_range(0,8); - - switch(number) - { - case (0) : - if (IS_SET(ch->off_flags,OFF_BASH)) - do_function(ch, &do_bash, ""); - break; - - case (1) : - if (IS_SET(ch->off_flags,OFF_BERSERK) && !IS_AFFECTED(ch,AFF_BERSERK)) - do_function(ch, &do_berserk, ""); - break; - - - case (2) : - if (IS_SET(ch->off_flags,OFF_DISARM) - || (get_weapon_sn(ch) != gsn_hand_to_hand - && (IS_SET(ch->act,ACT_WARRIOR) - || IS_SET(ch->act,ACT_THIEF)))) - do_function(ch, &do_disarm, ""); - break; - - case (3) : - if (IS_SET(ch->off_flags,OFF_KICK)) - do_function(ch, &do_kick, ""); - break; - - case (4) : - if (IS_SET(ch->off_flags,OFF_KICK_DIRT)) - do_function(ch, &do_dirt, ""); - break; - - case (5) : - if (IS_SET(ch->off_flags,OFF_TAIL)) - { - /* do_function(ch, &do_tail, "") */ ; - } - break; - - case (6) : - if (IS_SET(ch->off_flags,OFF_TRIP)) - do_function(ch, &do_trip, ""); - break; - - case (7) : - if (IS_SET(ch->off_flags,OFF_CRUSH)) - { - /* do_function(ch, &do_crush, "") */ ; - } - break; - case (8) : - if (IS_SET(ch->off_flags,OFF_BACKSTAB)) - { - do_function(ch, &do_backstab, ""); - } - } -} - - -/* - * Hit one guy once. - */ -void one_hit( CHAR_DATA *ch, CHAR_DATA *victim, int dt ) -{ - OBJ_DATA *wield; - int victim_ac; - int thac0; - int thac0_00; - int thac0_32; - int dam; - int diceroll; - int sn,skill; - int dam_type; - bool result; - - sn = -1; - - - /* just in case */ - if (victim == ch || ch == NULL || victim == NULL) - return; - - /* - * Can't beat a dead char! - * Guard against weird room-leavings. - */ - if ( victim->position == POS_DEAD || ch->in_room != victim->in_room ) - return; - - /* - * Figure out the type of damage message. - */ - wield = get_eq_char( ch, WEAR_WIELD ); - - if ( dt == TYPE_UNDEFINED ) - { - dt = TYPE_HIT; - if ( wield != NULL && wield->item_type == ITEM_WEAPON ) - dt += wield->value[3]; - else - dt += ch->dam_type; - } - - if (dt < TYPE_HIT) - if (wield != NULL) - dam_type = attack_table[wield->value[3]].damage; - else - dam_type = attack_table[ch->dam_type].damage; - else - dam_type = attack_table[dt - TYPE_HIT].damage; - - if (dam_type == -1) - dam_type = DAM_BASH; - - /* get the weapon skill */ - sn = get_weapon_sn(ch); - skill = 20 + get_weapon_skill(ch,sn); - - /* - * Calculate to-hit-armor-class-0 versus armor. - */ - if ( IS_NPC(ch) ) - { - thac0_00 = 20; - thac0_32 = -4; /* as good as a thief */ - if (IS_SET(ch->act,ACT_WARRIOR)) - thac0_32 = -10; - else if (IS_SET(ch->act,ACT_THIEF)) - thac0_32 = -4; - else if (IS_SET(ch->act,ACT_CLERIC)) - thac0_32 = 2; - else if (IS_SET(ch->act,ACT_MAGE)) - thac0_32 = 6; - } - else - { - thac0_00 = class_table[ch->class].thac0_00; - thac0_32 = class_table[ch->class].thac0_32; - } - thac0 = interpolate( ch->level, thac0_00, thac0_32 ); - - if (thac0 < 0) - thac0 = thac0/2; - - if (thac0 < -5) - thac0 = -5 + (thac0 + 5) / 2; - - thac0 -= GET_HITROLL(ch) * skill/100; - thac0 += 5 * (100 - skill) / 100; - - if (dt == gsn_backstab) - thac0 -= 10 * (100 - get_skill(ch,gsn_backstab)); - - switch(dam_type) - { - case(DAM_PIERCE):victim_ac = GET_AC(victim,AC_PIERCE)/10; break; - case(DAM_BASH): victim_ac = GET_AC(victim,AC_BASH)/10; break; - case(DAM_SLASH): victim_ac = GET_AC(victim,AC_SLASH)/10; break; - default: victim_ac = GET_AC(victim,AC_EXOTIC)/10; break; - }; - - if (victim_ac < -15) - victim_ac = (victim_ac + 15) / 5 - 15; - - if ( !can_see( ch, victim ) ) - victim_ac -= 4; - - if ( victim->position < POS_FIGHTING) - victim_ac += 4; - - if (victim->position < POS_RESTING) - victim_ac += 6; - - /* - * The moment of excitement! - */ - while ( ( diceroll = number_bits( 5 ) ) >= 20 ) - ; - - if ( diceroll == 0 - || ( diceroll != 19 && diceroll < thac0 - victim_ac ) ) - { - /* Miss. */ - damage( ch, victim, 0, dt, dam_type, TRUE ); - tail_chain( ); - return; - } - - /* - * Hit. - * Calc damage. - */ - if ( IS_NPC(ch) && (!ch->pIndexData->new_format || wield == NULL)) - if (!ch->pIndexData->new_format) - { - dam = number_range( ch->level / 2, ch->level * 3 / 2 ); - if ( wield != NULL ) - dam += dam / 2; - } - else - dam = dice(ch->damage[DICE_NUMBER],ch->damage[DICE_TYPE]); - - else - { - if (sn != -1) - check_improve(ch,sn,TRUE,5); - if ( wield != NULL ) - { - if (wield->pIndexData->new_format) - dam = dice(wield->value[1],wield->value[2]) * skill/100; - else - dam = number_range( wield->value[1] * skill/100, - wield->value[2] * skill/100); - - if (get_eq_char(ch,WEAR_SHIELD) == NULL) /* no shield = more */ - dam = dam * 11/10; - - /* sharpness! */ - if (IS_WEAPON_STAT(wield,WEAPON_SHARP)) - { - int percent; - - if ((percent = number_percent()) <= (skill / 8)) - dam = 2 * dam + (dam * 2 * percent / 100); - } - } - else - dam = number_range( 1 + 4 * skill/100, 2 * ch->level/3 * skill/100); - } - - /* - * Bonuses. - */ - if ( get_skill(ch,gsn_enhanced_damage) > 0 ) - { - diceroll = number_percent(); - if (diceroll <= get_skill(ch,gsn_enhanced_damage)) - { - check_improve(ch,gsn_enhanced_damage,TRUE,6); - dam += 2 * ( dam * diceroll/300); - } - } - - if ( !IS_AWAKE(victim) ) - dam *= 2; - else if (victim->position < POS_FIGHTING) - dam = dam * 3 / 2; - - if ( dt == gsn_backstab && wield != NULL) - { if ( wield->value[0] != 2 ) - dam *= 2 + (ch->level / 10); - else - dam *= 2 + (ch->level / 8); - } - dam += GET_DAMROLL(ch) * UMIN(100,skill) /100; - - if ( dam <= 0 ) - dam = 1; - - result = damage( ch, victim, dam, dt, dam_type, TRUE ); - - /* but do we have a funky weapon? */ - if (result && wield != NULL) - { - int dam; - - if (ch->fighting == victim && IS_WEAPON_STAT(wield,WEAPON_POISON)) - { - int level; - AFFECT_DATA *poison, af; - - if ((poison = affect_find(wield->affected,gsn_poison)) == NULL) - level = wield->level; - else - level = poison->level; - - if (!saves_spell(level / 2,victim,DAM_POISON)) - { - send_to_char("You feel poison coursing through your veins.", - victim); - act("$n is poisoned by the venom on $p.", - victim,wield,NULL,TO_ROOM); - - af.where = TO_AFFECTS; - af.type = gsn_poison; - af.level = level * 3/4; - af.duration = level / 2; - af.location = APPLY_STR; - af.modifier = -1; - af.bitvector = AFF_POISON; - affect_join( victim, &af ); - } - - /* weaken the poison if it's temporary */ - if (poison != NULL) - { - poison->level = UMAX(0,poison->level - 2); - poison->duration = UMAX(0,poison->duration - 1); - - if (poison->level == 0 || poison->duration == 0) - act("The poison on $p has worn off.",ch,wield,NULL,TO_CHAR); - } - } - - - if (ch->fighting == victim && IS_WEAPON_STAT(wield,WEAPON_VAMPIRIC)) - { - dam = number_range(1, wield->level / 5 + 1); - act("$p draws life from $n.",victim,wield,NULL,TO_ROOM); - act("You feel $p drawing your life away.", - victim,wield,NULL,TO_CHAR); - damage(ch,victim,dam,0,DAM_NEGATIVE,FALSE); - ch->alignment = UMAX(-1000,ch->alignment - 1); - ch->hit += dam/2; - } - - if (ch->fighting == victim && IS_WEAPON_STAT(wield,WEAPON_FLAMING)) - { - dam = number_range(1,wield->level / 4 + 1); - act("$n is burned by $p.",victim,wield,NULL,TO_ROOM); - act("$p sears your flesh.",victim,wield,NULL,TO_CHAR); - fire_effect( (void *) victim,wield->level/2,dam,TARGET_CHAR); - damage(ch,victim,dam,0,DAM_FIRE,FALSE); - } - - if (ch->fighting == victim && IS_WEAPON_STAT(wield,WEAPON_FROST)) - { - dam = number_range(1,wield->level / 6 + 2); - act("$p freezes $n.",victim,wield,NULL,TO_ROOM); - act("The cold touch of $p surrounds you with ice.", - victim,wield,NULL,TO_CHAR); - cold_effect(victim,wield->level/2,dam,TARGET_CHAR); - damage(ch,victim,dam,0,DAM_COLD,FALSE); - } - - if (ch->fighting == victim && IS_WEAPON_STAT(wield,WEAPON_SHOCKING)) - { - dam = number_range(1,wield->level/5 + 2); - act("$n is struck by lightning from $p.",victim,wield,NULL,TO_ROOM); - act("You are shocked by $p.",victim,wield,NULL,TO_CHAR); - shock_effect(victim,wield->level/2,dam,TARGET_CHAR); - damage(ch,victim,dam,0,DAM_LIGHTNING,FALSE); - } - } - tail_chain( ); - return; -} - - -/* - * Inflict damage from a hit. - */ -bool damage(CHAR_DATA *ch,CHAR_DATA *victim,int dam,int dt,int dam_type, - bool show) -{ - OBJ_DATA *corpse; - bool immune; - - if ( victim->position == POS_DEAD ) - return FALSE; - - /* - * Stop up any residual loopholes. - */ - if ( dam > 1200 && dt >= TYPE_HIT) - { - bug( "Damage: %d: more than 1200 points!", dam ); - dam = 1200; - if (!IS_IMMORTAL(ch)) - { - OBJ_DATA *obj; - obj = get_eq_char( ch, WEAR_WIELD ); - send_to_char("You really shouldn't cheat.\n\r",ch); - if (obj != NULL) - extract_obj(obj); - } - - } - - - /* damage reduction */ - if ( dam > 35) - dam = (dam - 35)/2 + 35; - if ( dam > 80) - dam = (dam - 80)/2 + 80; - - - - - if ( victim != ch ) - { - /* - * Certain attacks are forbidden. - * Most other attacks are returned. - */ - if ( is_safe( ch, victim ) ) - return FALSE; - check_killer( ch, victim ); - - if ( victim->position > POS_STUNNED ) - { - if ( victim->fighting == NULL ) - set_fighting( victim, ch ); - if (victim->timer <= 4) - victim->position = POS_FIGHTING; - } - - if ( victim->position > POS_STUNNED ) - { - if ( ch->fighting == NULL ) - set_fighting( ch, victim ); - } - - /* - * More charm stuff. - */ - if ( victim->master == ch ) - stop_follower( victim ); - } - - /* - * Inviso attacks ... not. - */ - if ( IS_AFFECTED(ch, AFF_INVISIBLE) ) - { - affect_strip( ch, gsn_invis ); - affect_strip( ch, gsn_mass_invis ); - REMOVE_BIT( ch->affected_by, AFF_INVISIBLE ); - act( "$n fades into existence.", ch, NULL, NULL, TO_ROOM ); - } - - /* - * Damage modifiers. - */ - - if ( dam > 1 && !IS_NPC(victim) - && victim->pcdata->condition[COND_DRUNK] > 10 ) - dam = 9 * dam / 10; - - if ( dam > 1 && IS_AFFECTED(victim, AFF_SANCTUARY) ) - dam /= 2; - - if ( dam > 1 && ((IS_AFFECTED(victim, AFF_PROTECT_EVIL) && IS_EVIL(ch) ) - || (IS_AFFECTED(victim, AFF_PROTECT_GOOD) && IS_GOOD(ch) ))) - dam -= dam / 4; - - immune = FALSE; - - - /* - * Check for parry, and dodge. - */ - if ( dt >= TYPE_HIT && ch != victim) - { - if ( check_parry( ch, victim ) ) - return FALSE; - if ( check_dodge( ch, victim ) ) - return FALSE; - if ( check_shield_block(ch,victim)) - return FALSE; - - } - - switch(check_immune(victim,dam_type)) - { - case(IS_IMMUNE): - immune = TRUE; - dam = 0; - break; - case(IS_RESISTANT): - dam -= dam/3; - break; - case(IS_VULNERABLE): - dam += dam/2; - break; - } - - if (show) - dam_message( ch, victim, dam, dt, immune ); - - if (dam == 0) - return FALSE; - - /* - * Hurt the victim. - * Inform the victim of his new state. - */ - victim->hit -= dam; - if ( !IS_NPC(victim) - && victim->level >= LEVEL_IMMORTAL - && victim->hit < 1 ) - victim->hit = 1; - update_pos( victim ); - - switch( victim->position ) - { - case POS_MORTAL: - act( "$n is mortally wounded, and will die soon, if not aided.", - victim, NULL, NULL, TO_ROOM ); - send_to_char( - "You are mortally wounded, and will die soon, if not aided.\n\r", - victim ); - break; - - case POS_INCAP: - act( "$n is incapacitated and will slowly die, if not aided.", - victim, NULL, NULL, TO_ROOM ); - send_to_char( - "You are incapacitated and will slowly die, if not aided.\n\r", - victim ); - break; - - case POS_STUNNED: - act( "$n is stunned, but will probably recover.", - victim, NULL, NULL, TO_ROOM ); - send_to_char("You are stunned, but will probably recover.\n\r", - victim ); - break; - - case POS_DEAD: - act( "$n is DEAD!!", victim, 0, 0, TO_ROOM ); - send_to_char( "You have been KILLED!!\n\r\n\r", victim ); - break; - - default: - if ( dam > victim->max_hit / 4 ) - send_to_char( "That really did HURT!\n\r", victim ); - if ( victim->hit < victim->max_hit / 4 ) - send_to_char( "You sure are BLEEDING!\n\r", victim ); - break; - } - - /* - * Sleep spells and extremely wounded folks. - */ - if ( !IS_AWAKE(victim) ) - stop_fighting( victim, FALSE ); - - /* - * Payoff for killing things. - */ - if ( victim->position == POS_DEAD ) - { - group_gain( ch, victim ); - - if ( !IS_NPC(victim) ) - { - sprintf( log_buf, "%s killed by %s at %d", - victim->name, - (IS_NPC(ch) ? ch->short_descr : ch->name), - ch->in_room->vnum ); - log_string( log_buf ); - - /* - * Dying penalty: - * 2/3 way back to previous level. - */ - if ( victim->exp > exp_per_level(victim,victim->pcdata->points) - * victim->level ) - gain_exp( victim, (2 * (exp_per_level(victim,victim->pcdata->points) - * victim->level - victim->exp)/3) + 50 ); - } - - sprintf( log_buf, "%s got toasted by %s at %s [room %d]", - (IS_NPC(victim) ? victim->short_descr : victim->name), - (IS_NPC(ch) ? ch->short_descr : ch->name), - ch->in_room->name, ch->in_room->vnum); - - if (IS_NPC(victim)) - wiznet(log_buf,NULL,NULL,WIZ_MOBDEATHS,0,0); - else - wiznet(log_buf,NULL,NULL,WIZ_DEATHS,0,0); - - raw_kill( victim ); - /* dump the flags */ - if (ch != victim && !IS_NPC(ch) && !is_same_clan(ch,victim)) - { - if (IS_SET(victim->act,PLR_KILLER)) - REMOVE_BIT(victim->act,PLR_KILLER); - else - REMOVE_BIT(victim->act,PLR_THIEF); - } - - /* RT new auto commands */ - - if (!IS_NPC(ch) - && (corpse = get_obj_list(ch,"corpse",ch->in_room->contents)) != NULL - && corpse->item_type == ITEM_CORPSE_NPC && can_see_obj(ch,corpse)) - { - OBJ_DATA *coins; - - corpse = get_obj_list( ch, "corpse", ch->in_room->contents ); - - if ( IS_SET(ch->act, PLR_AUTOLOOT) && - corpse && corpse->contains) /* exists and not empty */ - { - do_function(ch, &do_get, "all corpse"); - } - - if (IS_SET(ch->act,PLR_AUTOGOLD) && - corpse && corpse->contains && /* exists and not empty */ - !IS_SET(ch->act,PLR_AUTOLOOT)) - { - if ((coins = get_obj_list(ch,"gcash",corpse->contains)) - != NULL) - { - do_function(ch, &do_get, "all.gcash corpse"); - } - } - - if (IS_SET(ch->act, PLR_AUTOSAC)) - { - if (IS_SET(ch->act,PLR_AUTOLOOT) && corpse && corpse->contains) - { - return TRUE; /* leave if corpse has treasure */ - } - else - { - do_function(ch, &do_sacrifice, "corpse"); - } - } - } - - return TRUE; - } - - if ( victim == ch ) - return TRUE; - - /* - * Take care of link dead people. - */ - if ( !IS_NPC(victim) && victim->desc == NULL ) - { - if ( number_range( 0, victim->wait ) == 0 ) - { - do_function(victim, &do_recall, "" ); - return TRUE; - } - } - - /* - * Wimp out? - */ - if ( IS_NPC(victim) && dam > 0 && victim->wait < PULSE_VIOLENCE / 2) - { - if ( ( IS_SET(victim->act, ACT_WIMPY) && number_bits( 2 ) == 0 - && victim->hit < victim->max_hit / 5) - || ( IS_AFFECTED(victim, AFF_CHARM) && victim->master != NULL - && victim->master->in_room != victim->in_room ) ) - { - do_function(victim, &do_flee, "" ); - } - } - - if ( !IS_NPC(victim) - && victim->hit > 0 - && victim->hit <= victim->wimpy - && victim->wait < PULSE_VIOLENCE / 2 ) - { - do_function (victim, &do_flee, "" ); - } - - tail_chain( ); - return TRUE; -} - -bool is_safe(CHAR_DATA *ch, CHAR_DATA *victim) -{ - if (victim->in_room == NULL || ch->in_room == NULL) - return TRUE; - - if (victim->fighting == ch || victim == ch) - return FALSE; - - if (IS_IMMORTAL(ch) && ch->level > LEVEL_IMMORTAL) - return FALSE; - - /* killing mobiles */ - if (IS_NPC(victim)) - { - - /* safe room? */ - if (IS_SET(victim->in_room->room_flags,ROOM_SAFE)) - { - send_to_char("Not in this room.\n\r",ch); - return TRUE; - } - - if (victim->pIndexData->pShop != NULL) - { - send_to_char("The shopkeeper wouldn't like that.\n\r",ch); - return TRUE; - } - - /* no killing healers, trainers, etc */ - if (IS_SET(victim->act,ACT_TRAIN) - || IS_SET(victim->act,ACT_PRACTICE) - || IS_SET(victim->act,ACT_IS_HEALER) - || IS_SET(victim->act,ACT_IS_CHANGER)) - { - send_to_char("I don't think Mota would approve.\n\r",ch); - return TRUE; - } - - if (!IS_NPC(ch)) - { - /* no pets */ - if (IS_SET(victim->act,ACT_PET)) - { - act("But $N looks so cute and cuddly...", - ch,NULL,victim,TO_CHAR); - return TRUE; - } - - /* no charmed creatures unless owner */ - if (IS_AFFECTED(victim,AFF_CHARM) && ch != victim->master) - { - send_to_char("You don't own that monster.\n\r",ch); - return TRUE; - } - } - } - /* killing players */ - else - { - /* NPC doing the killing */ - if (IS_NPC(ch)) - { - /* safe room check */ - if (IS_SET(victim->in_room->room_flags,ROOM_SAFE)) - { - send_to_char("Not in this room.\n\r",ch); - return TRUE; - } - - /* charmed mobs and pets cannot attack players while owned */ - if (IS_AFFECTED(ch,AFF_CHARM) && ch->master != NULL - && ch->master->fighting != victim) - { - send_to_char("Players are your friends!\n\r",ch); - return TRUE; - } - } - /* player doing the killing */ - else - { - if (!is_clan(ch)) - { - send_to_char("Join a clan if you want to kill players.\n\r",ch); - return TRUE; - } - - if (IS_SET(victim->act,PLR_KILLER) || IS_SET(victim->act,PLR_THIEF)) - return FALSE; - - if (!is_clan(victim)) - { - send_to_char("They aren't in a clan, leave them alone.\n\r",ch); - return TRUE; - } - - if (ch->level > victim->level + 8) - { - send_to_char("Pick on someone your own size.\n\r",ch); - return TRUE; - } - } - } - return FALSE; -} - -bool is_safe_spell(CHAR_DATA *ch, CHAR_DATA *victim, bool area ) -{ - if (victim->in_room == NULL || ch->in_room == NULL) - return TRUE; - - if (victim == ch && area) - return TRUE; - - if (victim->fighting == ch || victim == ch) - return FALSE; - - if (IS_IMMORTAL(ch) && ch->level > LEVEL_IMMORTAL && !area) - return FALSE; - - /* killing mobiles */ - if (IS_NPC(victim)) - { - /* safe room? */ - if (IS_SET(victim->in_room->room_flags,ROOM_SAFE)) - return TRUE; - - if (victim->pIndexData->pShop != NULL) - return TRUE; - - /* no killing healers, trainers, etc */ - if (IS_SET(victim->act,ACT_TRAIN) - || IS_SET(victim->act,ACT_PRACTICE) - || IS_SET(victim->act,ACT_IS_HEALER) - || IS_SET(victim->act,ACT_IS_CHANGER)) - return TRUE; - - if (!IS_NPC(ch)) - { - /* no pets */ - if (IS_SET(victim->act,ACT_PET)) - return TRUE; - - /* no charmed creatures unless owner */ - if (IS_AFFECTED(victim,AFF_CHARM) && (area || ch != victim->master)) - return TRUE; - - /* legal kill? -- cannot hit mob fighting non-group member */ - if (victim->fighting != NULL && !is_same_group(ch,victim->fighting)) - return TRUE; - } - else - { - /* area effect spells do not hit other mobs */ - if (area && !is_same_group(victim,ch->fighting)) - return TRUE; - } - } - /* killing players */ - else - { - if (area && IS_IMMORTAL(victim) && victim->level > LEVEL_IMMORTAL) - return TRUE; - - /* NPC doing the killing */ - if (IS_NPC(ch)) - { - /* charmed mobs and pets cannot attack players while owned */ - if (IS_AFFECTED(ch,AFF_CHARM) && ch->master != NULL - && ch->master->fighting != victim) - return TRUE; - - /* safe room? */ - if (IS_SET(victim->in_room->room_flags,ROOM_SAFE)) - return TRUE; - - /* legal kill? -- mobs only hit players grouped with opponent*/ - if (ch->fighting != NULL && !is_same_group(ch->fighting,victim)) - return TRUE; - } - - /* player doing the killing */ - else - { - if (!is_clan(ch)) - return TRUE; - - if (IS_SET(victim->act,PLR_KILLER) || IS_SET(victim->act,PLR_THIEF)) - return FALSE; - - if (!is_clan(victim)) - return TRUE; - - if (ch->level > victim->level + 8) - return TRUE; - } - - } - return FALSE; -} -/* - * See if an attack justifies a KILLER flag. - */ -void check_killer( CHAR_DATA *ch, CHAR_DATA *victim ) -{ - char buf[MAX_STRING_LENGTH]; - /* - * Follow charm thread to responsible character. - * Attacking someone's charmed char is hostile! - */ - while ( IS_AFFECTED(victim, AFF_CHARM) && victim->master != NULL ) - victim = victim->master; - - /* - * NPC's are fair game. - * So are killers and thieves. - */ - if ( IS_NPC(victim) - || IS_SET(victim->act, PLR_KILLER) - || IS_SET(victim->act, PLR_THIEF)) - return; - - /* - * Charm-o-rama. - */ - if ( IS_SET(ch->affected_by, AFF_CHARM) ) - { - if ( ch->master == NULL ) - { - char buf[MAX_STRING_LENGTH]; - - sprintf( buf, "Check_killer: %s bad AFF_CHARM", - IS_NPC(ch) ? ch->short_descr : ch->name ); - bug( buf, 0 ); - affect_strip( ch, gsn_charm_person ); - REMOVE_BIT( ch->affected_by, AFF_CHARM ); - return; - } -/* - send_to_char( "*** You are now a KILLER!! ***\n\r", ch->master ); - SET_BIT(ch->master->act, PLR_KILLER); -*/ - - stop_follower( ch ); - return; - } - - /* - * NPC's are cool of course (as long as not charmed). - * Hitting yourself is cool too (bleeding). - * So is being immortal (Alander's idea). - * And current killers stay as they are. - */ - if ( IS_NPC(ch) - || ch == victim - || ch->level >= LEVEL_IMMORTAL - || !is_clan(ch) - || IS_SET(ch->act, PLR_KILLER) - || ch->fighting == victim) - return; - - send_to_char( "*** You are now a KILLER!! ***\n\r", ch ); - SET_BIT(ch->act, PLR_KILLER); - sprintf(buf,"$N is attempting to murder %s",victim->name); - wiznet(buf,ch,NULL,WIZ_FLAGS,0,0); - save_char_obj( ch ); - return; -} - - - -/* - * Check for parry. - */ -bool check_parry( CHAR_DATA *ch, CHAR_DATA *victim ) -{ - int chance; - - if ( !IS_AWAKE(victim) ) - return FALSE; - - chance = get_skill(victim,gsn_parry) / 2; - - if ( get_eq_char( victim, WEAR_WIELD ) == NULL ) - { - if (IS_NPC(victim)) - chance /= 2; - else - return FALSE; - } - - if (!can_see(ch,victim)) - chance /= 2; - - if ( number_percent( ) >= chance + victim->level - ch->level ) - return FALSE; - - act( "You parry $n's attack.", ch, NULL, victim, TO_VICT ); - act( "$N parries your attack.", ch, NULL, victim, TO_CHAR ); - check_improve(victim,gsn_parry,TRUE,6); - return TRUE; -} - -/* - * Check for shield block. - */ -bool check_shield_block( CHAR_DATA *ch, CHAR_DATA *victim ) -{ - int chance; - - if ( !IS_AWAKE(victim) ) - return FALSE; - - - chance = get_skill(victim,gsn_shield_block) / 5 + 3; - - - if ( get_eq_char( victim, WEAR_SHIELD ) == NULL ) - return FALSE; - - if ( number_percent( ) >= chance + victim->level - ch->level ) - return FALSE; - - act( "You block $n's attack with your shield.", ch, NULL, victim, -TO_VICT ); - act( "$N blocks your attack with a shield.", ch, NULL, victim, -TO_CHAR ); - check_improve(victim,gsn_shield_block,TRUE,6); - return TRUE; -} - - -/* - * Check for dodge. - */ -bool check_dodge( CHAR_DATA *ch, CHAR_DATA *victim ) -{ - int chance; - - if ( !IS_AWAKE(victim) ) - return FALSE; - - chance = get_skill(victim,gsn_dodge) / 2; - - if (!can_see(victim,ch)) - chance /= 2; - - if ( number_percent( ) >= chance + victim->level - ch->level ) - return FALSE; - - act( "You dodge $n's attack.", ch, NULL, victim, TO_VICT ); - act( "$N dodges your attack.", ch, NULL, victim, TO_CHAR ); - check_improve(victim,gsn_dodge,TRUE,6); - return TRUE; -} - - - -/* - * Set position of a victim. - */ -void update_pos( CHAR_DATA *victim ) -{ - if ( victim->hit > 0 ) - { - if ( victim->position <= POS_STUNNED ) - victim->position = POS_STANDING; - return; - } - - if ( IS_NPC(victim) && victim->hit < 1 ) - { - victim->position = POS_DEAD; - return; - } - - if ( victim->hit <= -11 ) - { - victim->position = POS_DEAD; - return; - } - - if ( victim->hit <= -6 ) victim->position = POS_MORTAL; - else if ( victim->hit <= -3 ) victim->position = POS_INCAP; - else victim->position = POS_STUNNED; - - return; -} - - - -/* - * Start fights. - */ -void set_fighting( CHAR_DATA *ch, CHAR_DATA *victim ) -{ - if ( ch->fighting != NULL ) - { - bug( "Set_fighting: already fighting", 0 ); - return; - } - - if ( IS_AFFECTED(ch, AFF_SLEEP) ) - affect_strip( ch, gsn_sleep ); - - ch->fighting = victim; - ch->position = POS_FIGHTING; - - return; -} - - - -/* - * Stop fights. - */ -void stop_fighting( CHAR_DATA *ch, bool fBoth ) -{ - CHAR_DATA *fch; - - for ( fch = char_list; fch != NULL; fch = fch->next ) - { - if ( fch == ch || ( fBoth && fch->fighting == ch ) ) - { - fch->fighting = NULL; - fch->position = IS_NPC(fch) ? fch->default_pos : POS_STANDING; - update_pos( fch ); - } - } - - return; -} - - - -/* - * Make a corpse out of a character. - */ -void make_corpse( CHAR_DATA *ch ) -{ - char buf[MAX_STRING_LENGTH]; - OBJ_DATA *corpse; - OBJ_DATA *obj; - OBJ_DATA *obj_next; - char *name; - - if ( IS_NPC(ch) ) - { - name = ch->short_descr; - corpse = create_object(get_obj_index(OBJ_VNUM_CORPSE_NPC), 0); - corpse->timer = number_range( 3, 6 ); - if ( ch->gold > 0 ) - { - obj_to_obj( create_money( ch->gold, ch->silver ), corpse ); - ch->gold = 0; - ch->silver = 0; - } - corpse->cost = 0; - } - else - { - name = ch->name; - corpse = create_object(get_obj_index(OBJ_VNUM_CORPSE_PC), 0); - corpse->timer = number_range( 25, 40 ); - REMOVE_BIT(ch->act,PLR_CANLOOT); - if (!is_clan(ch)) - corpse->owner = str_dup(ch->name); - else - { - corpse->owner = NULL; - if (ch->gold > 1 || ch->silver > 1) - { - obj_to_obj(create_money(ch->gold / 2, ch->silver/2), corpse); - ch->gold -= ch->gold/2; - ch->silver -= ch->silver/2; - } - } - - corpse->cost = 0; - } - - corpse->level = ch->level; - - sprintf( buf, corpse->short_descr, name ); - free_string( corpse->short_descr ); - corpse->short_descr = str_dup( buf ); - - sprintf( buf, corpse->description, name ); - free_string( corpse->description ); - corpse->description = str_dup( buf ); - - for ( obj = ch->carrying; obj != NULL; obj = obj_next ) - { - bool floating = FALSE; - - obj_next = obj->next_content; - if (obj->wear_loc == WEAR_FLOAT) - floating = TRUE; - obj_from_char( obj ); - if (obj->item_type == ITEM_POTION) - obj->timer = number_range(500,1000); - if (obj->item_type == ITEM_SCROLL) - obj->timer = number_range(1000,2500); - if (IS_SET(obj->extra_flags,ITEM_ROT_DEATH) && !floating) - { - obj->timer = number_range(5,10); - REMOVE_BIT(obj->extra_flags,ITEM_ROT_DEATH); - } - REMOVE_BIT(obj->extra_flags,ITEM_VIS_DEATH); - - if ( IS_SET( obj->extra_flags, ITEM_INVENTORY ) ) - extract_obj( obj ); - else if (floating) - { - if (IS_OBJ_STAT(obj,ITEM_ROT_DEATH)) /* get rid of it! */ - { - if (obj->contains != NULL) - { - OBJ_DATA *in, *in_next; - - act("$p evaporates,scattering its contents.", - ch,obj,NULL,TO_ROOM); - for (in = obj->contains; in != NULL; in = in_next) - { - in_next = in->next_content; - obj_from_obj(in); - obj_to_room(in,ch->in_room); - } - } - else - act("$p evaporates.", - ch,obj,NULL,TO_ROOM); - extract_obj(obj); - } - else - { - act("$p falls to the floor.",ch,obj,NULL,TO_ROOM); - obj_to_room(obj,ch->in_room); - } - } - else - obj_to_obj( obj, corpse ); - } - - obj_to_room( corpse, ch->in_room ); - return; -} - - - -/* - * Improved Death_cry contributed by Diavolo. - */ -void death_cry( CHAR_DATA *ch ) -{ - ROOM_INDEX_DATA *was_in_room; - char *msg; - int door; - int vnum; - - vnum = 0; - msg = "You hear $n's death cry."; - - switch ( number_bits(4)) - { - case 0: msg = "$n hits the ground ... DEAD."; break; - case 1: - if (ch->material == 0) - { - msg = "$n splatters blood on your armor."; - break; - } - case 2: - if (IS_SET(ch->parts,PART_GUTS)) - { - msg = "$n spills $s guts all over the floor."; - vnum = OBJ_VNUM_GUTS; - } - break; - case 3: - if (IS_SET(ch->parts,PART_HEAD)) - { - msg = "$n's severed head plops on the ground."; - vnum = OBJ_VNUM_SEVERED_HEAD; - } - break; - case 4: - if (IS_SET(ch->parts,PART_HEART)) - { - msg = "$n's heart is torn from $s chest."; - vnum = OBJ_VNUM_TORN_HEART; - } - break; - case 5: - if (IS_SET(ch->parts,PART_ARMS)) - { - msg = "$n's arm is sliced from $s dead body."; - vnum = OBJ_VNUM_SLICED_ARM; - } - break; - case 6: - if (IS_SET(ch->parts,PART_LEGS)) - { - msg = "$n's leg is sliced from $s dead body."; - vnum = OBJ_VNUM_SLICED_LEG; - } - break; - case 7: - if (IS_SET(ch->parts,PART_BRAINS)) - { - msg = "$n's head is shattered, and $s brains splash all over you."; - vnum = OBJ_VNUM_BRAINS; - } - } - - act( msg, ch, NULL, NULL, TO_ROOM ); - - if ( vnum != 0 ) - { - char buf[MAX_STRING_LENGTH]; - OBJ_DATA *obj; - char *name; - - name = IS_NPC(ch) ? ch->short_descr : ch->name; - obj = create_object( get_obj_index( vnum ), 0 ); - obj->timer = number_range( 4, 7 ); - - sprintf( buf, obj->short_descr, name ); - free_string( obj->short_descr ); - obj->short_descr = str_dup( buf ); - - sprintf( buf, obj->description, name ); - free_string( obj->description ); - obj->description = str_dup( buf ); - - if (obj->item_type == ITEM_FOOD) - { - if (IS_SET(ch->form,FORM_POISON)) - obj->value[3] = 1; - else if (!IS_SET(ch->form,FORM_EDIBLE)) - obj->item_type = ITEM_TRASH; - } - - obj_to_room( obj, ch->in_room ); - } - - if ( IS_NPC(ch) ) - msg = "You hear something's death cry."; - else - msg = "You hear someone's death cry."; - - was_in_room = ch->in_room; - for ( door = 0; door <= 5; door++ ) - { - EXIT_DATA *pexit; - - if ( ( pexit = was_in_room->exit[door] ) != NULL - && pexit->u1.to_room != NULL - && pexit->u1.to_room != was_in_room ) - { - ch->in_room = pexit->u1.to_room; - act( msg, ch, NULL, NULL, TO_ROOM ); - } - } - ch->in_room = was_in_room; - - return; -} - - - -void raw_kill( CHAR_DATA *victim ) -{ - int i; - - stop_fighting( victim, TRUE ); - death_cry( victim ); - make_corpse( victim ); - - if ( IS_NPC(victim) ) - { - victim->pIndexData->killed++; - kill_table[URANGE(0, victim->level, MAX_LEVEL-1)].killed++; - extract_char( victim, TRUE ); - return; - } - - extract_char( victim, FALSE ); - while ( victim->affected ) - affect_remove( victim, victim->affected ); - victim->affected_by = race_table[victim->race].aff; - for (i = 0; i < 4; i++) - victim->armor[i]= 100; - victim->position = POS_RESTING; - victim->hit = UMAX( 1, victim->hit ); - victim->mana = UMAX( 1, victim->mana ); - victim->move = UMAX( 1, victim->move ); -/* save_char_obj( victim ); we're stable enough to not need this :) */ - return; -} - - - -void group_gain( CHAR_DATA *ch, CHAR_DATA *victim ) -{ - char buf[MAX_STRING_LENGTH]; - CHAR_DATA *gch; - CHAR_DATA *lch; - int xp; - int members; - int group_levels; - - /* - * Monsters don't get kill xp's or alignment changes. - * P-killing doesn't help either. - * Dying of mortal wounds or poison doesn't give xp to anyone! - */ - if ( victim == ch ) - return; - - members = 0; - group_levels = 0; - for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room ) - { - if ( is_same_group( gch, ch ) ) - { - members++; - group_levels += IS_NPC(gch) ? gch->level / 2 : gch->level; - } - } - - if ( members == 0 ) - { - bug( "Group_gain: members.", members ); - members = 1; - group_levels = ch->level ; - } - - lch = (ch->leader != NULL) ? ch->leader : ch; - - for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room ) - { - OBJ_DATA *obj; - OBJ_DATA *obj_next; - - if ( !is_same_group( gch, ch ) || IS_NPC(gch)) - continue; - -/* Taken out, add it back if you want it - if ( gch->level - lch->level >= 5 ) - { - send_to_char( "You are too high for this group.\n\r", gch ); - continue; - } - - if ( gch->level - lch->level <= -5 ) - { - send_to_char( "You are too low for this group.\n\r", gch ); - continue; - } -*/ - - xp = xp_compute( gch, victim, group_levels ); - sprintf( buf, "You receive %d experience points.\n\r", xp ); - send_to_char( buf, gch ); - gain_exp( gch, xp ); - - for ( obj = ch->carrying; obj != NULL; obj = obj_next ) - { - obj_next = obj->next_content; - if ( obj->wear_loc == WEAR_NONE ) - continue; - - if ( ( IS_OBJ_STAT(obj, ITEM_ANTI_EVIL) && IS_EVIL(ch) ) - || ( IS_OBJ_STAT(obj, ITEM_ANTI_GOOD) && IS_GOOD(ch) ) - || ( IS_OBJ_STAT(obj, ITEM_ANTI_NEUTRAL) && IS_NEUTRAL(ch) ) ) - { - act( "You are zapped by $p.", ch, obj, NULL, TO_CHAR ); - act( "$n is zapped by $p.", ch, obj, NULL, TO_ROOM ); - obj_from_char( obj ); - obj_to_room( obj, ch->in_room ); - } - } - } - - return; -} - - - -/* - * Compute xp for a kill. - * Also adjust alignment of killer. - * Edit this function to change xp computations. - */ -int xp_compute( CHAR_DATA *gch, CHAR_DATA *victim, int total_levels ) -{ - int xp,base_exp; - int align,level_range; - int change; - int time_per_level; - - level_range = victim->level - gch->level; - - /* compute the base exp */ - switch (level_range) - { - default : base_exp = 0; break; - case -9 : base_exp = 1; break; - case -8 : base_exp = 2; break; - case -7 : base_exp = 5; break; - case -6 : base_exp = 9; break; - case -5 : base_exp = 11; break; - case -4 : base_exp = 22; break; - case -3 : base_exp = 33; break; - case -2 : base_exp = 50; break; - case -1 : base_exp = 66; break; - case 0 : base_exp = 83; break; - case 1 : base_exp = 99; break; - case 2 : base_exp = 121; break; - case 3 : base_exp = 143; break; - case 4 : base_exp = 165; break; - } - - if (level_range > 4) - base_exp = 160 + 20 * (level_range - 4); - - /* do alignment computations */ - - align = victim->alignment - gch->alignment; - - if (IS_SET(victim->act,ACT_NOALIGN)) - { - /* no change */ - } - - else if (align > 500) /* monster is more good than slayer */ - { - change = (align - 500) * base_exp / 500 * gch->level/total_levels; - change = UMAX(1,change); - gch->alignment = UMAX(-1000,gch->alignment - change); - } - - else if (align < -500) /* monster is more evil than slayer */ - { - change = ( -1 * align - 500) * base_exp/500 * gch->level/total_levels; - change = UMAX(1,change); - gch->alignment = UMIN(1000,gch->alignment + change); - } - - else /* improve this someday */ - { - change = gch->alignment * base_exp/500 * gch->level/total_levels; - gch->alignment -= change; - } - - /* calculate exp multiplier */ - if (IS_SET(victim->act,ACT_NOALIGN)) - xp = base_exp; - - else if (gch->alignment > 500) /* for goodie two shoes */ - { - if (victim->alignment < -750) - xp = (base_exp *4)/3; - - else if (victim->alignment < -500) - xp = (base_exp * 5)/4; - - else if (victim->alignment > 750) - xp = base_exp / 4; - - else if (victim->alignment > 500) - xp = base_exp / 2; - - else if (victim->alignment > 250) - xp = (base_exp * 3)/4; - - else - xp = base_exp; - } - - else if (gch->alignment < -500) /* for baddies */ - { - if (victim->alignment > 750) - xp = (base_exp * 5)/4; - - else if (victim->alignment > 500) - xp = (base_exp * 11)/10; - - else if (victim->alignment < -750) - xp = base_exp/2; - - else if (victim->alignment < -500) - xp = (base_exp * 3)/4; - - else if (victim->alignment < -250) - xp = (base_exp * 9)/10; - - else - xp = base_exp; - } - - else if (gch->alignment > 200) /* a little good */ - { - - if (victim->alignment < -500) - xp = (base_exp * 6)/5; - - else if (victim->alignment > 750) - xp = base_exp/2; - - else if (victim->alignment > 0) - xp = (base_exp * 3)/4; - - else - xp = base_exp; - } - - else if (gch->alignment < -200) /* a little bad */ - { - if (victim->alignment > 500) - xp = (base_exp * 6)/5; - - else if (victim->alignment < -750) - xp = base_exp/2; - - else if (victim->alignment < 0) - xp = (base_exp * 3)/4; - - else - xp = base_exp; - } - - else /* neutral */ - { - - if (victim->alignment > 500 || victim->alignment < -500) - xp = (base_exp * 4)/3; - - else if (victim->alignment < 200 && victim->alignment > -200) - xp = base_exp/2; - - else - xp = base_exp; - } - - /* more exp at the low levels */ - if (gch->level < 6) - xp = 10 * xp / (gch->level + 4); - - /* less at high */ - if (gch->level > 35 ) - xp = 15 * xp / (gch->level - 25 ); - - /* reduce for playing time */ - - { - /* compute quarter-hours per level */ - time_per_level = 4 * - (gch->played + (int) (current_time - gch->logon))/3600 - / gch->level; - - time_per_level = URANGE(2,time_per_level,12); - if (gch->level < 15) /* make it a curve */ - time_per_level = UMAX(time_per_level,(15 - gch->level)); - xp = xp * time_per_level / 12; - } - - /* randomize the rewards */ - xp = number_range (xp * 3/4, xp * 5/4); - - /* adjust for grouping */ - xp = xp * gch->level/( UMAX(1,total_levels -1) ); - - return xp; -} - - -void dam_message( CHAR_DATA *ch, CHAR_DATA *victim,int dam,int dt,bool immune ) -{ - char buf1[256], buf2[256], buf3[256]; - const char *vs; - const char *vp; - const char *attack; - char punct; - - if (ch == NULL || victim == NULL) - return; - - if ( dam == 0 ) { vs = "miss"; vp = "misses"; } - else if ( dam <= 4 ) { vs = "scratch"; vp = "scratches"; } - else if ( dam <= 8 ) { vs = "graze"; vp = "grazes"; } - else if ( dam <= 12 ) { vs = "hit"; vp = "hits"; } - else if ( dam <= 16 ) { vs = "injure"; vp = "injures"; } - else if ( dam <= 20 ) { vs = "wound"; vp = "wounds"; } - else if ( dam <= 24 ) { vs = "maul"; vp = "mauls"; } - else if ( dam <= 28 ) { vs = "decimate"; vp = "decimates"; } - else if ( dam <= 32 ) { vs = "devastate"; vp = "devastates"; } - else if ( dam <= 36 ) { vs = "maim"; vp = "maims"; } - else if ( dam <= 40 ) { vs = "MUTILATE"; vp = "MUTILATES"; } - else if ( dam <= 44 ) { vs = "DISEMBOWEL"; vp = "DISEMBOWELS"; } - else if ( dam <= 48 ) { vs = "DISMEMBER"; vp = "DISMEMBERS"; } - else if ( dam <= 52 ) { vs = "MASSACRE"; vp = "MASSACRES"; } - else if ( dam <= 56 ) { vs = "MANGLE"; vp = "MANGLES"; } - else if ( dam <= 60 ) { vs = "*** DEMOLISH ***"; - vp = "*** DEMOLISHES ***"; } - else if ( dam <= 75 ) { vs = "*** DEVASTATE ***"; - vp = "*** DEVASTATES ***"; } - else if ( dam <= 100) { vs = "=== OBLITERATE ==="; - vp = "=== OBLITERATES ==="; } - else if ( dam <= 125) { vs = ">>> ANNIHILATE <<<"; - vp = ">>> ANNIHILATES <<<"; } - else if ( dam <= 150) { vs = "<<< ERADICATE >>>"; - vp = "<<< ERADICATES >>>"; } - else { vs = "do UNSPEAKABLE things to"; - vp = "does UNSPEAKABLE things to"; } - - punct = (dam <= 24) ? '.' : '!'; - - if ( dt == TYPE_HIT ) - { - if (ch == victim) - { - sprintf( buf1, "$n %s $melf%c",vp,punct); - sprintf( buf2, "You %s yourself%c",vs,punct); - } - else - { - sprintf( buf1, "$n %s $N%c", vp, punct ); - sprintf( buf2, "You %s $N%c", vs, punct ); - sprintf( buf3, "$n %s you%c", vp, punct ); - } - } - else - { - if ( dt >= 0 && dt < MAX_SKILL ) - attack = skill_table[dt].noun_damage; - else if ( dt >= TYPE_HIT - && dt < TYPE_HIT + MAX_DAMAGE_MESSAGE) - attack = attack_table[dt - TYPE_HIT].noun; - else - { - bug( "Dam_message: bad dt %d.", dt ); - dt = TYPE_HIT; - attack = attack_table[0].name; - } - - if (immune) - { - if (ch == victim) - { - sprintf(buf1,"$n is unaffected by $s own %s.",attack); - sprintf(buf2,"Luckily, you are immune to that."); - } - else - { - sprintf(buf1,"$N is unaffected by $n's %s!",attack); - sprintf(buf2,"$N is unaffected by your %s!",attack); - sprintf(buf3,"$n's %s is powerless against you.",attack); - } - } - else - { - if (ch == victim) - { - sprintf( buf1, "$n's %s %s $m%c",attack,vp,punct); - sprintf( buf2, "Your %s %s you%c",attack,vp,punct); - } - else - { - sprintf( buf1, "$n's %s %s $N%c", attack, vp, punct ); - sprintf( buf2, "Your %s %s $N%c", attack, vp, punct ); - sprintf( buf3, "$n's %s %s you%c", attack, vp, punct ); - } - } - } - - if (ch == victim) - { - act(buf1,ch,NULL,NULL,TO_ROOM); - act(buf2,ch,NULL,NULL,TO_CHAR); - } - else - { - act( buf1, ch, NULL, victim, TO_NOTVICT ); - act( buf2, ch, NULL, victim, TO_CHAR ); - act( buf3, ch, NULL, victim, TO_VICT ); - } - - return; -} - - - -/* - * Disarm a creature. - * Caller must check for successful attack. - */ -void disarm( CHAR_DATA *ch, CHAR_DATA *victim ) -{ - OBJ_DATA *obj; - - if ( ( obj = get_eq_char( victim, WEAR_WIELD ) ) == NULL ) - return; - - if ( IS_OBJ_STAT(obj,ITEM_NOREMOVE)) - { - act("$S weapon won't budge!",ch,NULL,victim,TO_CHAR); - act("$n tries to disarm you, but your weapon won't budge!", - ch,NULL,victim,TO_VICT); - act("$n tries to disarm $N, but fails.",ch,NULL,victim,TO_NOTVICT); - return; - } - - act( "$n DISARMS you and sends your weapon flying!", - ch, NULL, victim, TO_VICT ); - act( "You disarm $N!", ch, NULL, victim, TO_CHAR ); - act( "$n disarms $N!", ch, NULL, victim, TO_NOTVICT ); - - obj_from_char( obj ); - if ( IS_OBJ_STAT(obj,ITEM_NODROP) || IS_OBJ_STAT(obj,ITEM_INVENTORY) ) - obj_to_char( obj, victim ); - else - { - obj_to_room( obj, victim->in_room ); - if (IS_NPC(victim) && victim->wait == 0 && can_see_obj(victim,obj)) - get_obj(victim,obj,NULL); - } - - return; -} - -void do_berserk( CHAR_DATA *ch, char *argument) -{ - int chance, hp_percent; - - if ((chance = get_skill(ch,gsn_berserk)) == 0 - || (IS_NPC(ch) && !IS_SET(ch->off_flags,OFF_BERSERK)) - || (!IS_NPC(ch) - && ch->level < skill_table[gsn_berserk].skill_level[ch->class])) - { - send_to_char("You turn red in the face, but nothing happens.\n\r",ch); - return; - } - - if (IS_AFFECTED(ch,AFF_BERSERK) || is_affected(ch,gsn_berserk) - || is_affected(ch,skill_lookup("frenzy"))) - { - send_to_char("You get a little madder.\n\r",ch); - return; - } - - if (IS_AFFECTED(ch,AFF_CALM)) - { - send_to_char("You're feeling to mellow to berserk.\n\r",ch); - return; - } - - if (ch->mana < 50) - { - send_to_char("You can't get up enough energy.\n\r",ch); - return; - } - - /* modifiers */ - - /* fighting */ - if (ch->position == POS_FIGHTING) - chance += 10; - - /* damage -- below 50% of hp helps, above hurts */ - hp_percent = 100 * ch->hit/ch->max_hit; - chance += 25 - hp_percent/2; - - if (number_percent() < chance) - { - AFFECT_DATA af; - - WAIT_STATE(ch,PULSE_VIOLENCE); - ch->mana -= 50; - ch->move /= 2; - - /* heal a little damage */ - ch->hit += ch->level * 2; - ch->hit = UMIN(ch->hit,ch->max_hit); - - send_to_char("Your pulse races as you are consumed by rage!\n\r",ch); - act("$n gets a wild look in $s eyes.",ch,NULL,NULL,TO_ROOM); - check_improve(ch,gsn_berserk,TRUE,2); - - af.where = TO_AFFECTS; - af.type = gsn_berserk; - af.level = ch->level; - af.duration = number_fuzzy(ch->level / 8); - af.modifier = UMAX(1,ch->level/5); - af.bitvector = AFF_BERSERK; - - af.location = APPLY_HITROLL; - affect_to_char(ch,&af); - - af.location = APPLY_DAMROLL; - affect_to_char(ch,&af); - - af.modifier = UMAX(10,10 * (ch->level/5)); - af.location = APPLY_AC; - affect_to_char(ch,&af); - } - - else - { - WAIT_STATE(ch,3 * PULSE_VIOLENCE); - ch->mana -= 25; - ch->move /= 2; - - send_to_char("Your pulse speeds up, but nothing happens.\n\r",ch); - check_improve(ch,gsn_berserk,FALSE,2); - } -} - -void do_bash( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - int chance; - - one_argument(argument,arg); - - if ( (chance = get_skill(ch,gsn_bash)) == 0 - || (IS_NPC(ch) && !IS_SET(ch->off_flags,OFF_BASH)) - || (!IS_NPC(ch) - && ch->level < skill_table[gsn_bash].skill_level[ch->class])) - { - send_to_char("Bashing? What's that?\n\r",ch); - return; - } - - if (arg[0] == '\0') - { - victim = ch->fighting; - if (victim == NULL) - { - send_to_char("But you aren't fighting anyone!\n\r",ch); - return; - } - } - - else if ((victim = get_char_room(ch,arg)) == NULL) - { - send_to_char("They aren't here.\n\r",ch); - return; - } - - if (victim->position < POS_FIGHTING) - { - act("You'll have to let $M get back up first.",ch,NULL,victim,TO_CHAR); - return; - } - - if (victim == ch) - { - send_to_char("You try to bash your brains out, but fail.\n\r",ch); - return; - } - - if (is_safe(ch,victim)) - return; - - if ( IS_NPC(victim) && - victim->fighting != NULL && - !is_same_group(ch,victim->fighting)) - { - send_to_char("Kill stealing is not permitted.\n\r",ch); - return; - } - - if (IS_AFFECTED(ch,AFF_CHARM) && ch->master == victim) - { - act("But $N is your friend!",ch,NULL,victim,TO_CHAR); - return; - } - - /* modifiers */ - - /* size and weight */ - chance += ch->carry_weight / 250; - chance -= victim->carry_weight / 200; - - if (ch->size < victim->size) - chance += (ch->size - victim->size) * 15; - else - chance += (ch->size - victim->size) * 10; - - - /* stats */ - chance += get_curr_stat(ch,STAT_STR); - chance -= (get_curr_stat(victim,STAT_DEX) * 4)/3; - chance -= GET_AC(victim,AC_BASH) /25; - /* speed */ - if (IS_SET(ch->off_flags,OFF_FAST) || IS_AFFECTED(ch,AFF_HASTE)) - chance += 10; - if (IS_SET(victim->off_flags,OFF_FAST) || IS_AFFECTED(victim,AFF_HASTE)) - chance -= 30; - - /* level */ - chance += (ch->level - victim->level); - - if (!IS_NPC(victim) - && chance < get_skill(victim,gsn_dodge) ) - { /* - act("$n tries to bash you, but you dodge it.",ch,NULL,victim,TO_VICT); - act("$N dodges your bash, you fall flat on your face.",ch,NULL,victim,TO_CHAR); - WAIT_STATE(ch,skill_table[gsn_bash].beats); - return;*/ - chance -= 3 * (get_skill(victim,gsn_dodge) - chance); - } - - /* now the attack */ - if (number_percent() < chance ) - { - - act("$n sends you sprawling with a powerful bash!", - ch,NULL,victim,TO_VICT); - act("You slam into $N, and send $M flying!",ch,NULL,victim,TO_CHAR); - act("$n sends $N sprawling with a powerful bash.", - ch,NULL,victim,TO_NOTVICT); - check_improve(ch,gsn_bash,TRUE,1); - - DAZE_STATE(victim, 3 * PULSE_VIOLENCE); - WAIT_STATE(ch,skill_table[gsn_bash].beats); - victim->position = POS_RESTING; - damage(ch,victim,number_range(2,2 + 2 * ch->size + chance/20),gsn_bash, - DAM_BASH,FALSE); - - } - else - { - damage(ch,victim,0,gsn_bash,DAM_BASH,FALSE); - act("You fall flat on your face!", - ch,NULL,victim,TO_CHAR); - act("$n falls flat on $s face.", - ch,NULL,victim,TO_NOTVICT); - act("You evade $n's bash, causing $m to fall flat on $s face.", - ch,NULL,victim,TO_VICT); - check_improve(ch,gsn_bash,FALSE,1); - ch->position = POS_RESTING; - WAIT_STATE(ch,skill_table[gsn_bash].beats * 3/2); - } - check_killer(ch,victim); -} - -void do_dirt( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - int chance; - - one_argument(argument,arg); - - if ( (chance = get_skill(ch,gsn_dirt)) == 0 - || (IS_NPC(ch) && !IS_SET(ch->off_flags,OFF_KICK_DIRT)) - || (!IS_NPC(ch) - && ch->level < skill_table[gsn_dirt].skill_level[ch->class])) - { - send_to_char("You get your feet dirty.\n\r",ch); - return; - } - - if (arg[0] == '\0') - { - victim = ch->fighting; - if (victim == NULL) - { - send_to_char("But you aren't in combat!\n\r",ch); - return; - } - } - - else if ((victim = get_char_room(ch,arg)) == NULL) - { - send_to_char("They aren't here.\n\r",ch); - return; - } - - if (IS_AFFECTED(victim,AFF_BLIND)) - { - act("$E's already been blinded.",ch,NULL,victim,TO_CHAR); - return; - } - - if (victim == ch) - { - send_to_char("Very funny.\n\r",ch); - return; - } - - if (is_safe(ch,victim)) - return; - - if (IS_NPC(victim) && - victim->fighting != NULL && - !is_same_group(ch,victim->fighting)) - { - send_to_char("Kill stealing is not permitted.\n\r",ch); - return; - } - - if (IS_AFFECTED(ch,AFF_CHARM) && ch->master == victim) - { - act("But $N is such a good friend!",ch,NULL,victim,TO_CHAR); - return; - } - - /* modifiers */ - - /* dexterity */ - chance += get_curr_stat(ch,STAT_DEX); - chance -= 2 * get_curr_stat(victim,STAT_DEX); - - /* speed */ - if (IS_SET(ch->off_flags,OFF_FAST) || IS_AFFECTED(ch,AFF_HASTE)) - chance += 10; - if (IS_SET(victim->off_flags,OFF_FAST) || IS_AFFECTED(victim,AFF_HASTE)) - chance -= 25; - - /* level */ - chance += (ch->level - victim->level) * 2; - - /* sloppy hack to prevent false zeroes */ - if (chance % 5 == 0) - chance += 1; - - /* terrain */ - - switch(ch->in_room->sector_type) - { - case(SECT_INSIDE): chance -= 20; break; - case(SECT_CITY): chance -= 10; break; - case(SECT_FIELD): chance += 5; break; - case(SECT_FOREST): break; - case(SECT_HILLS): break; - case(SECT_MOUNTAIN): chance -= 10; break; - case(SECT_WATER_SWIM): chance = 0; break; - case(SECT_WATER_NOSWIM): chance = 0; break; - case(SECT_AIR): chance = 0; break; - case(SECT_DESERT): chance += 10; break; - } - - if (chance == 0) - { - send_to_char("There isn't any dirt to kick.\n\r",ch); - return; - } - - /* now the attack */ - if (number_percent() < chance) - { - AFFECT_DATA af; - act("$n is blinded by the dirt in $s eyes!",victim,NULL,NULL,TO_ROOM); - act("$n kicks dirt in your eyes!",ch,NULL,victim,TO_VICT); - damage(ch,victim,number_range(2,5),gsn_dirt,DAM_NONE,FALSE); - send_to_char("You can't see a thing!\n\r",victim); - check_improve(ch,gsn_dirt,TRUE,2); - WAIT_STATE(ch,skill_table[gsn_dirt].beats); - - af.where = TO_AFFECTS; - af.type = gsn_dirt; - af.level = ch->level; - af.duration = 0; - af.location = APPLY_HITROLL; - af.modifier = -4; - af.bitvector = AFF_BLIND; - - affect_to_char(victim,&af); - } - else - { - damage(ch,victim,0,gsn_dirt,DAM_NONE,TRUE); - check_improve(ch,gsn_dirt,FALSE,2); - WAIT_STATE(ch,skill_table[gsn_dirt].beats); - } - check_killer(ch,victim); -} - -void do_trip( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - int chance; - - one_argument(argument,arg); - - if ( (chance = get_skill(ch,gsn_trip)) == 0 - || (IS_NPC(ch) && !IS_SET(ch->off_flags,OFF_TRIP)) - || (!IS_NPC(ch) - && ch->level < skill_table[gsn_trip].skill_level[ch->class])) - { - send_to_char("Tripping? What's that?\n\r",ch); - return; - } - - - if (arg[0] == '\0') - { - victim = ch->fighting; - if (victim == NULL) - { - send_to_char("But you aren't fighting anyone!\n\r",ch); - return; - } - } - - else if ((victim = get_char_room(ch,arg)) == NULL) - { - send_to_char("They aren't here.\n\r",ch); - return; - } - - if (is_safe(ch,victim)) - return; - - if (IS_NPC(victim) && - victim->fighting != NULL && - !is_same_group(ch,victim->fighting)) - { - send_to_char("Kill stealing is not permitted.\n\r",ch); - return; - } - - if (IS_AFFECTED(victim,AFF_FLYING)) - { - act("$S feet aren't on the ground.",ch,NULL,victim,TO_CHAR); - return; - } - - if (victim->position < POS_FIGHTING) - { - act("$N is already down.",ch,NULL,victim,TO_CHAR); - return; - } - - if (victim == ch) - { - send_to_char("You fall flat on your face!\n\r",ch); - WAIT_STATE(ch,2 * skill_table[gsn_trip].beats); - act("$n trips over $s own feet!",ch,NULL,NULL,TO_ROOM); - return; - } - - if (IS_AFFECTED(ch,AFF_CHARM) && ch->master == victim) - { - act("$N is your beloved master.",ch,NULL,victim,TO_CHAR); - return; - } - - /* modifiers */ - - /* size */ - if (ch->size < victim->size) - chance += (ch->size - victim->size) * 10; /* bigger = harder to trip */ - - /* dex */ - chance += get_curr_stat(ch,STAT_DEX); - chance -= get_curr_stat(victim,STAT_DEX) * 3 / 2; - - /* speed */ - if (IS_SET(ch->off_flags,OFF_FAST) || IS_AFFECTED(ch,AFF_HASTE)) - chance += 10; - if (IS_SET(victim->off_flags,OFF_FAST) || IS_AFFECTED(victim,AFF_HASTE)) - chance -= 20; - - /* level */ - chance += (ch->level - victim->level) * 2; - - - /* now the attack */ - if (number_percent() < chance) - { - act("$n trips you and you go down!",ch,NULL,victim,TO_VICT); - act("You trip $N and $N goes down!",ch,NULL,victim,TO_CHAR); - act("$n trips $N, sending $M to the ground.",ch,NULL,victim,TO_NOTVICT); - check_improve(ch,gsn_trip,TRUE,1); - - DAZE_STATE(victim,2 * PULSE_VIOLENCE); - WAIT_STATE(ch,skill_table[gsn_trip].beats); - victim->position = POS_RESTING; - damage(ch,victim,number_range(2, 2 + 2 * victim->size),gsn_trip, - DAM_BASH,TRUE); - } - else - { - damage(ch,victim,0,gsn_trip,DAM_BASH,TRUE); - WAIT_STATE(ch,skill_table[gsn_trip].beats*2/3); - check_improve(ch,gsn_trip,FALSE,1); - } - check_killer(ch,victim); -} - - - -void do_kill( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Kill whom?\n\r", ch ); - return; - } - - if ( ( victim = get_char_room( ch, arg ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } -/* Allow player killing - if ( !IS_NPC(victim) ) - { - if ( !IS_SET(victim->act, PLR_KILLER) - && !IS_SET(victim->act, PLR_THIEF) ) - { - send_to_char( "You must MURDER a player.\n\r", ch ); - return; - } - } -*/ - if ( victim == ch ) - { - send_to_char( "You hit yourself. Ouch!\n\r", ch ); - multi_hit( ch, ch, TYPE_UNDEFINED ); - return; - } - - if ( is_safe( ch, victim ) ) - return; - - if ( victim->fighting != NULL && - !is_same_group(ch,victim->fighting)) - { - send_to_char("Kill stealing is not permitted.\n\r",ch); - return; - } - - if ( IS_AFFECTED(ch, AFF_CHARM) && ch->master == victim ) - { - act( "$N is your beloved master.", ch, NULL, victim, TO_CHAR ); - return; - } - - if ( ch->position == POS_FIGHTING ) - { - send_to_char( "You do the best you can!\n\r", ch ); - return; - } - - WAIT_STATE( ch, 1 * PULSE_VIOLENCE ); - check_killer( ch, victim ); - multi_hit( ch, victim, TYPE_UNDEFINED ); - return; -} - - - -void do_murde( CHAR_DATA *ch, char *argument ) -{ - send_to_char( "If you want to MURDER, spell it out.\n\r", ch ); - return; -} - - - -void do_murder( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Murder whom?\n\r", ch ); - return; - } - - if (IS_AFFECTED(ch,AFF_CHARM) || (IS_NPC(ch) && IS_SET(ch->act,ACT_PET))) - return; - - if ( ( victim = get_char_room( ch, arg ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - - if ( victim == ch ) - { - send_to_char( "Suicide is a mortal sin.\n\r", ch ); - return; - } - - if ( is_safe( ch, victim ) ) - return; - - if (IS_NPC(victim) && - victim->fighting != NULL && - !is_same_group(ch,victim->fighting)) - { - send_to_char("Kill stealing is not permitted.\n\r",ch); - return; - } - - if ( IS_AFFECTED(ch, AFF_CHARM) && ch->master == victim ) - { - act( "$N is your beloved master.", ch, NULL, victim, TO_CHAR ); - return; - } - - if ( ch->position == POS_FIGHTING ) - { - send_to_char( "You do the best you can!\n\r", ch ); - return; - } - - WAIT_STATE( ch, 1 * PULSE_VIOLENCE ); - if (IS_NPC(ch)) - sprintf(buf, "Help! I am being attacked by %s!",ch->short_descr); - else - sprintf( buf, "Help! I am being attacked by %s!", ch->name ); - do_function(victim, &do_yell, buf ); - check_killer( ch, victim ); - multi_hit( ch, victim, TYPE_UNDEFINED ); - return; -} - - - -void do_backstab( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - OBJ_DATA *obj; - - one_argument( argument, arg ); - - if (arg[0] == '\0') - { - send_to_char("Backstab whom?\n\r",ch); - return; - } - - if (ch->fighting != NULL) - { - send_to_char("You're facing the wrong end.\n\r",ch); - return; - } - - else if ((victim = get_char_room(ch,arg)) == NULL) - { - send_to_char("They aren't here.\n\r",ch); - return; - } - - if ( victim == ch ) - { - send_to_char( "How can you sneak up on yourself?\n\r", ch ); - return; - } - - if ( is_safe( ch, victim ) ) - return; - - if (IS_NPC(victim) && - victim->fighting != NULL && - !is_same_group(ch,victim->fighting)) - { - send_to_char("Kill stealing is not permitted.\n\r",ch); - return; - } - - if ( ( obj = get_eq_char( ch, WEAR_WIELD ) ) == NULL) - { - send_to_char( "You need to wield a weapon to backstab.\n\r", ch ); - return; - } - - if ( victim->hit < victim->max_hit / 3) - { - act( "$N is hurt and suspicious ... you can't sneak up.", - ch, NULL, victim, TO_CHAR ); - return; - } - - check_killer( ch, victim ); - WAIT_STATE( ch, skill_table[gsn_backstab].beats ); - if ( number_percent( ) < get_skill(ch,gsn_backstab) - || ( get_skill(ch,gsn_backstab) >= 2 && !IS_AWAKE(victim) ) ) - { - check_improve(ch,gsn_backstab,TRUE,1); - multi_hit( ch, victim, gsn_backstab ); - } - else - { - check_improve(ch,gsn_backstab,FALSE,1); - damage( ch, victim, 0, gsn_backstab,DAM_NONE,TRUE); - } - - return; -} - - - -void do_flee( CHAR_DATA *ch, char *argument ) -{ - ROOM_INDEX_DATA *was_in; - ROOM_INDEX_DATA *now_in; - CHAR_DATA *victim; - int attempt; - - if ( ( victim = ch->fighting ) == NULL ) - { - if ( ch->position == POS_FIGHTING ) - ch->position = POS_STANDING; - send_to_char( "You aren't fighting anyone.\n\r", ch ); - return; - } - - was_in = ch->in_room; - for ( attempt = 0; attempt < 6; attempt++ ) - { - EXIT_DATA *pexit; - int door; - - door = number_door( ); - if ( ( pexit = was_in->exit[door] ) == 0 - || pexit->u1.to_room == NULL - || IS_SET(pexit->exit_info, EX_CLOSED) - || number_range(0,ch->daze) != 0 - || ( IS_NPC(ch) - && IS_SET(pexit->u1.to_room->room_flags, ROOM_NO_MOB) ) ) - continue; - - move_char( ch, door, FALSE ); - if ( ( now_in = ch->in_room ) == was_in ) - continue; - - ch->in_room = was_in; - act( "$n has fled!", ch, NULL, NULL, TO_ROOM ); - ch->in_room = now_in; - - if ( !IS_NPC(ch) ) - { - send_to_char( "You flee from combat!\n\r", ch ); - if( (ch->class == 2) - && (number_percent() < 3*(ch->level/2) ) ) - send_to_char( "You snuck away safely.\n\r", ch); - else - { - send_to_char( "You lost 10 exp.\n\r", ch); - gain_exp( ch, -10 ); - } - } - - stop_fighting( ch, TRUE ); - return; - } - - send_to_char( "PANIC! You couldn't escape!\n\r", ch ); - return; -} - - - -void do_rescue( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - CHAR_DATA *fch; - - one_argument( argument, arg ); - if ( arg[0] == '\0' ) - { - send_to_char( "Rescue whom?\n\r", ch ); - return; - } - - if ( ( victim = get_char_room( ch, arg ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - - if ( victim == ch ) - { - send_to_char( "What about fleeing instead?\n\r", ch ); - return; - } - - if ( !IS_NPC(ch) && IS_NPC(victim) ) - { - send_to_char( "Doesn't need your help!\n\r", ch ); - return; - } - - if ( ch->fighting == victim ) - { - send_to_char( "Too late.\n\r", ch ); - return; - } - - if ( ( fch = victim->fighting ) == NULL ) - { - send_to_char( "That person is not fighting right now.\n\r", ch ); - return; - } - - if ( IS_NPC(fch) && !is_same_group(ch,victim)) - { - send_to_char("Kill stealing is not permitted.\n\r",ch); - return; - } - - WAIT_STATE( ch, skill_table[gsn_rescue].beats ); - if ( number_percent( ) > get_skill(ch,gsn_rescue)) - { - send_to_char( "You fail the rescue.\n\r", ch ); - check_improve(ch,gsn_rescue,FALSE,1); - return; - } - - act( "You rescue $N!", ch, NULL, victim, TO_CHAR ); - act( "$n rescues you!", ch, NULL, victim, TO_VICT ); - act( "$n rescues $N!", ch, NULL, victim, TO_NOTVICT ); - check_improve(ch,gsn_rescue,TRUE,1); - - stop_fighting( fch, FALSE ); - stop_fighting( victim, FALSE ); - - check_killer( ch, fch ); - set_fighting( ch, fch ); - set_fighting( fch, ch ); - return; -} - - - -void do_kick( CHAR_DATA *ch, char *argument ) -{ - CHAR_DATA *victim; - - if ( !IS_NPC(ch) - && ch->level < skill_table[gsn_kick].skill_level[ch->class] ) - { - send_to_char( - "You better leave the martial arts to fighters.\n\r", ch ); - return; - } - - if (IS_NPC(ch) && !IS_SET(ch->off_flags,OFF_KICK)) - return; - - if ( ( victim = ch->fighting ) == NULL ) - { - send_to_char( "You aren't fighting anyone.\n\r", ch ); - return; - } - - WAIT_STATE( ch, skill_table[gsn_kick].beats ); - if ( get_skill(ch,gsn_kick) > number_percent()) - { - damage(ch,victim,number_range( 1, ch->level ), gsn_kick,DAM_BASH,TRUE); - check_improve(ch,gsn_kick,TRUE,1); - } - else - { - damage( ch, victim, 0, gsn_kick,DAM_BASH,TRUE); - check_improve(ch,gsn_kick,FALSE,1); - } - check_killer(ch,victim); - return; -} - - - - -void do_disarm( CHAR_DATA *ch, char *argument ) -{ - CHAR_DATA *victim; - OBJ_DATA *obj; - int chance,hth,ch_weapon,vict_weapon,ch_vict_weapon; - - hth = 0; - - if ((chance = get_skill(ch,gsn_disarm)) == 0) - { - send_to_char( "You don't know how to disarm opponents.\n\r", ch ); - return; - } - - if ( get_eq_char( ch, WEAR_WIELD ) == NULL - && ((hth = get_skill(ch,gsn_hand_to_hand)) == 0 - || (IS_NPC(ch) && !IS_SET(ch->off_flags,OFF_DISARM)))) - { - send_to_char( "You must wield a weapon to disarm.\n\r", ch ); - return; - } - - if ( ( victim = ch->fighting ) == NULL ) - { - send_to_char( "You aren't fighting anyone.\n\r", ch ); - return; - } - - if ( ( obj = get_eq_char( victim, WEAR_WIELD ) ) == NULL ) - { - send_to_char( "Your opponent is not wielding a weapon.\n\r", ch ); - return; - } - - /* find weapon skills */ - ch_weapon = get_weapon_skill(ch,get_weapon_sn(ch)); - vict_weapon = get_weapon_skill(victim,get_weapon_sn(victim)); - ch_vict_weapon = get_weapon_skill(ch,get_weapon_sn(victim)); - - /* modifiers */ - - /* skill */ - if ( get_eq_char(ch,WEAR_WIELD) == NULL) - chance = chance * hth/150; - else - chance = chance * ch_weapon/100; - - chance += (ch_vict_weapon/2 - vict_weapon) / 2; - - /* dex vs. strength */ - chance += get_curr_stat(ch,STAT_DEX); - chance -= 2 * get_curr_stat(victim,STAT_STR); - - /* level */ - chance += (ch->level - victim->level) * 2; - - /* and now the attack */ - if (number_percent() < chance) - { - WAIT_STATE( ch, skill_table[gsn_disarm].beats ); - disarm( ch, victim ); - check_improve(ch,gsn_disarm,TRUE,1); - } - else - { - WAIT_STATE(ch,skill_table[gsn_disarm].beats); - act("You fail to disarm $N.",ch,NULL,victim,TO_CHAR); - act("$n tries to disarm you, but fails.",ch,NULL,victim,TO_VICT); - act("$n tries to disarm $N, but fails.",ch,NULL,victim,TO_NOTVICT); - check_improve(ch,gsn_disarm,FALSE,1); - } - check_killer(ch,victim); - return; -} - - - -void do_sla( CHAR_DATA *ch, char *argument ) -{ - send_to_char( "If you want to SLAY, spell it out.\n\r", ch ); - return; -} - - - -void do_slay( CHAR_DATA *ch, char *argument ) -{ - CHAR_DATA *victim; - char arg[MAX_INPUT_LENGTH]; - - one_argument( argument, arg ); - if ( arg[0] == '\0' ) - { - send_to_char( "Slay whom?\n\r", ch ); - return; - } - - if ( ( victim = get_char_room( ch, arg ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - - if ( ch == victim ) - { - send_to_char( "Suicide is a mortal sin.\n\r", ch ); - return; - } - - if ( !IS_NPC(victim) && victim->level >= get_trust(ch) ) - { - send_to_char( "You failed.\n\r", ch ); - return; - } - - act( "You slay $M in cold blood!", ch, NULL, victim, TO_CHAR ); - act( "$n slays you in cold blood!", ch, NULL, victim, TO_VICT ); - act( "$n slays $N in cold blood!", ch, NULL, victim, TO_NOTVICT ); - raw_kill( victim ); - return; -} diff --git a/Rom24/src/flags.c b/Rom24/src/flags.c deleted file mode 100644 index 068000d..0000000 --- a/Rom24/src/flags.c +++ /dev/null @@ -1,249 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#include -#else -#include -#include -#endif -#include -#include -#include -#include "merc.h" -#include "tables.h" - -int flag_lookup args( ( const char *name, const struct flag_type *flag_table) ); - -void do_flag(CHAR_DATA *ch, char *argument) -{ - char arg1[MAX_INPUT_LENGTH],arg2[MAX_INPUT_LENGTH],arg3[MAX_INPUT_LENGTH]; - char word[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - long *flag, old = 0, new = 0, marked = 0, pos; - char type; - const struct flag_type *flag_table; - - argument = one_argument(argument,arg1); - argument = one_argument(argument,arg2); - argument = one_argument(argument,arg3); - - type = argument[0]; - - if (type == '=' || type == '-' || type == '+') - argument = one_argument(argument,word); - - if (arg1[0] == '\0') - { - send_to_char("Syntax:\n\r",ch); - send_to_char(" flag mob \n\r",ch); - send_to_char(" flag char \n\r",ch); - send_to_char(" mob flags: act,aff,off,imm,res,vuln,form,part\n\r",ch); - send_to_char(" char flags: plr,comm,aff,imm,res,vuln,\n\r",ch); - send_to_char(" +: add flag, -: remove flag, = set equal to\n\r",ch); - send_to_char(" otherwise flag toggles the flags listed.\n\r",ch); - return; - } - - if (arg2[0] == '\0') - { - send_to_char("What do you wish to set flags on?\n\r",ch); - return; - } - - if (arg3[0] == '\0') - { - send_to_char("You need to specify a flag to set.\n\r",ch); - return; - } - - if (argument[0] == '\0') - { - send_to_char("Which flags do you wish to change?\n\r",ch); - return; - } - - if (!str_prefix(arg1,"mob") || !str_prefix(arg1,"char")) - { - victim = get_char_world(ch,arg2); - if (victim == NULL) - { - send_to_char("You can't find them.\n\r",ch); - return; - } - - /* select a flag to set */ - if (!str_prefix(arg3,"act")) - { - if (!IS_NPC(victim)) - { - send_to_char("Use plr for PCs.\n\r",ch); - return; - } - - flag = &victim->act; - flag_table = act_flags; - } - - else if (!str_prefix(arg3,"plr")) - { - if (IS_NPC(victim)) - { - send_to_char("Use act for NPCs.\n\r",ch); - return; - } - - flag = &victim->act; - flag_table = plr_flags; - } - - else if (!str_prefix(arg3,"aff")) - { - flag = &victim->affected_by; - flag_table = affect_flags; - } - - else if (!str_prefix(arg3,"immunity")) - { - flag = &victim->imm_flags; - flag_table = imm_flags; - } - - else if (!str_prefix(arg3,"resist")) - { - flag = &victim->res_flags; - flag_table = imm_flags; - } - - else if (!str_prefix(arg3,"vuln")) - { - flag = &victim->vuln_flags; - flag_table = imm_flags; - } - - else if (!str_prefix(arg3,"form")) - { - if (!IS_NPC(victim)) - { - send_to_char("Form can't be set on PCs.\n\r",ch); - return; - } - - flag = &victim->form; - flag_table = form_flags; - } - - else if (!str_prefix(arg3,"parts")) - { - if (!IS_NPC(victim)) - { - send_to_char("Parts can't be set on PCs.\n\r",ch); - return; - } - - flag = &victim->parts; - flag_table = part_flags; - } - - else if (!str_prefix(arg3,"comm")) - { - if (IS_NPC(victim)) - { - send_to_char("Comm can't be set on NPCs.\n\r",ch); - return; - } - - flag = &victim->comm; - flag_table = comm_flags; - } - - else - { - send_to_char("That's not an acceptable flag.\n\r",ch); - return; - } - - old = *flag; - victim->zone = NULL; - - if (type != '=') - new = old; - - /* mark the words */ - for (; ;) - { - argument = one_argument(argument,word); - - if (word[0] == '\0') - break; - - pos = flag_lookup(word,flag_table); - if (pos == 0) - { - send_to_char("That flag doesn't exist!\n\r",ch); - return; - } - else - SET_BIT(marked,pos); - } - - for (pos = 0; flag_table[pos].name != NULL; pos++) - { - if (!flag_table[pos].settable && IS_SET(old,flag_table[pos].bit)) - { - SET_BIT(new,flag_table[pos].bit); - continue; - } - - if (IS_SET(marked,flag_table[pos].bit)) - { - switch(type) - { - case '=': - case '+': - SET_BIT(new,flag_table[pos].bit); - break; - case '-': - REMOVE_BIT(new,flag_table[pos].bit); - break; - default: - if (IS_SET(new,flag_table[pos].bit)) - REMOVE_BIT(new,flag_table[pos].bit); - else - SET_BIT(new,flag_table[pos].bit); - } - } - } - *flag = new; - return; - } -} - - - - diff --git a/Rom24/src/handler.c b/Rom24/src/handler.c deleted file mode 100644 index cdc7b18..0000000 --- a/Rom24/src/handler.c +++ /dev/null @@ -1,2912 +0,0 @@ -/**************************************************************************r - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#endif -#include -#include -#include -#include -#include "merc.h" -#include "interp.h" -#include "magic.h" -#include "recycle.h" -#include "tables.h" - -/* - * Local functions. - */ -void affect_modify args( ( CHAR_DATA *ch, AFFECT_DATA *paf, bool fAdd ) ); - - -/* friend stuff -- for NPC's mostly */ -bool is_friend(CHAR_DATA *ch,CHAR_DATA *victim) -{ - if (is_same_group(ch,victim)) - return TRUE; - - - if (!IS_NPC(ch)) - return FALSE; - - if (!IS_NPC(victim)) - { - if (IS_SET(ch->off_flags,ASSIST_PLAYERS)) - return TRUE; - else - return FALSE; - } - - if (IS_AFFECTED(ch,AFF_CHARM)) - return FALSE; - - if (IS_SET(ch->off_flags,ASSIST_ALL)) - return TRUE; - - if (ch->group && ch->group == victim->group) - return TRUE; - - if (IS_SET(ch->off_flags,ASSIST_VNUM) - && ch->pIndexData == victim->pIndexData) - return TRUE; - - if (IS_SET(ch->off_flags,ASSIST_RACE) && ch->race == victim->race) - return TRUE; - - if (IS_SET(ch->off_flags,ASSIST_ALIGN) - && !IS_SET(ch->act,ACT_NOALIGN) && !IS_SET(victim->act,ACT_NOALIGN) - && ((IS_GOOD(ch) && IS_GOOD(victim)) - || (IS_EVIL(ch) && IS_EVIL(victim)) - || (IS_NEUTRAL(ch) && IS_NEUTRAL(victim)))) - return TRUE; - - return FALSE; -} - -/* returns number of people on an object */ -int count_users(OBJ_DATA *obj) -{ - CHAR_DATA *fch; - int count = 0; - - if (obj->in_room == NULL) - return 0; - - for (fch = obj->in_room->people; fch != NULL; fch = fch->next_in_room) - if (fch->on == obj) - count++; - - return count; -} - -/* returns material number */ -int material_lookup (const char *name) -{ - return 0; -} - -/* returns race number */ -int race_lookup (const char *name) -{ - int race; - - for ( race = 0; race_table[race].name != NULL; race++) - { - if (LOWER(name[0]) == LOWER(race_table[race].name[0]) - && !str_prefix( name,race_table[race].name)) - return race; - } - - return 0; -} - -int liq_lookup (const char *name) -{ - int liq; - - for ( liq = 0; liq_table[liq].liq_name != NULL; liq++) - { - if (LOWER(name[0]) == LOWER(liq_table[liq].liq_name[0]) - && !str_prefix(name,liq_table[liq].liq_name)) - return liq; - } - - return -1; -} - -int weapon_lookup (const char *name) -{ - int type; - - for (type = 0; weapon_table[type].name != NULL; type++) - { - if (LOWER(name[0]) == LOWER(weapon_table[type].name[0]) - && !str_prefix(name,weapon_table[type].name)) - return type; - } - - return -1; -} - -int weapon_type (const char *name) -{ - int type; - - for (type = 0; weapon_table[type].name != NULL; type++) - { - if (LOWER(name[0]) == LOWER(weapon_table[type].name[0]) - && !str_prefix(name,weapon_table[type].name)) - return weapon_table[type].type; - } - - return WEAPON_EXOTIC; -} - - -int item_lookup(const char *name) -{ - int type; - - for (type = 0; item_table[type].name != NULL; type++) - { - if (LOWER(name[0]) == LOWER(item_table[type].name[0]) - && !str_prefix(name,item_table[type].name)) - return item_table[type].type; - } - - return -1; -} - -char *item_name(int item_type) -{ - int type; - - for (type = 0; item_table[type].name != NULL; type++) - if (item_type == item_table[type].type) - return item_table[type].name; - return "none"; -} - -char *weapon_name( int weapon_type) -{ - int type; - - for (type = 0; weapon_table[type].name != NULL; type++) - if (weapon_type == weapon_table[type].type) - return weapon_table[type].name; - return "exotic"; -} - -int attack_lookup (const char *name) -{ - int att; - - for ( att = 0; attack_table[att].name != NULL; att++) - { - if (LOWER(name[0]) == LOWER(attack_table[att].name[0]) - && !str_prefix(name,attack_table[att].name)) - return att; - } - - return 0; -} - -/* returns a flag for wiznet */ -long wiznet_lookup (const char *name) -{ - int flag; - - for (flag = 0; wiznet_table[flag].name != NULL; flag++) - { - if (LOWER(name[0]) == LOWER(wiznet_table[flag].name[0]) - && !str_prefix(name,wiznet_table[flag].name)) - return flag; - } - - return -1; -} - -/* returns class number */ -int class_lookup (const char *name) -{ - int class; - - for ( class = 0; class < MAX_CLASS; class++) - { - if (LOWER(name[0]) == LOWER(class_table[class].name[0]) - && !str_prefix( name,class_table[class].name)) - return class; - } - - return -1; -} - -/* for immunity, vulnerabiltiy, and resistant - the 'globals' (magic and weapons) may be overriden - three other cases -- wood, silver, and iron -- are checked in fight.c */ - -int check_immune(CHAR_DATA *ch, int dam_type) -{ - int immune, def; - int bit; - - immune = -1; - def = IS_NORMAL; - - if (dam_type == DAM_NONE) - return immune; - - if (dam_type <= 3) - { - if (IS_SET(ch->imm_flags,IMM_WEAPON)) - def = IS_IMMUNE; - else if (IS_SET(ch->res_flags,RES_WEAPON)) - def = IS_RESISTANT; - else if (IS_SET(ch->vuln_flags,VULN_WEAPON)) - def = IS_VULNERABLE; - } - else /* magical attack */ - { - if (IS_SET(ch->imm_flags,IMM_MAGIC)) - def = IS_IMMUNE; - else if (IS_SET(ch->res_flags,RES_MAGIC)) - def = IS_RESISTANT; - else if (IS_SET(ch->vuln_flags,VULN_MAGIC)) - def = IS_VULNERABLE; - } - - /* set bits to check -- VULN etc. must ALL be the same or this will fail */ - switch (dam_type) - { - case(DAM_BASH): bit = IMM_BASH; break; - case(DAM_PIERCE): bit = IMM_PIERCE; break; - case(DAM_SLASH): bit = IMM_SLASH; break; - case(DAM_FIRE): bit = IMM_FIRE; break; - case(DAM_COLD): bit = IMM_COLD; break; - case(DAM_LIGHTNING): bit = IMM_LIGHTNING; break; - case(DAM_ACID): bit = IMM_ACID; break; - case(DAM_POISON): bit = IMM_POISON; break; - case(DAM_NEGATIVE): bit = IMM_NEGATIVE; break; - case(DAM_HOLY): bit = IMM_HOLY; break; - case(DAM_ENERGY): bit = IMM_ENERGY; break; - case(DAM_MENTAL): bit = IMM_MENTAL; break; - case(DAM_DISEASE): bit = IMM_DISEASE; break; - case(DAM_DROWNING): bit = IMM_DROWNING; break; - case(DAM_LIGHT): bit = IMM_LIGHT; break; - case(DAM_CHARM): bit = IMM_CHARM; break; - case(DAM_SOUND): bit = IMM_SOUND; break; - default: return def; - } - - if (IS_SET(ch->imm_flags,bit)) - immune = IS_IMMUNE; - else if (IS_SET(ch->res_flags,bit) && immune != IS_IMMUNE) - immune = IS_RESISTANT; - else if (IS_SET(ch->vuln_flags,bit)) - { - if (immune == IS_IMMUNE) - immune = IS_RESISTANT; - else if (immune == IS_RESISTANT) - immune = IS_NORMAL; - else - immune = IS_VULNERABLE; - } - - if (immune == -1) - return def; - else - return immune; -} - -bool is_clan(CHAR_DATA *ch) -{ - return ch->clan; -} - -bool is_same_clan(CHAR_DATA *ch, CHAR_DATA *victim) -{ - if (clan_table[ch->clan].independent) - return FALSE; - else - return (ch->clan == victim->clan); -} - -/* checks mob format */ -bool is_old_mob(CHAR_DATA *ch) -{ - if (ch->pIndexData == NULL) - return FALSE; - else if (ch->pIndexData->new_format) - return FALSE; - return TRUE; -} - -/* for returning skill information */ -int get_skill(CHAR_DATA *ch, int sn) -{ - int skill; - - if (sn == -1) /* shorthand for level based skills */ - { - skill = ch->level * 5 / 2; - } - - else if (sn < -1 || sn > MAX_SKILL) - { - bug("Bad sn %d in get_skill.",sn); - skill = 0; - } - - else if (!IS_NPC(ch)) - { - if (ch->level < skill_table[sn].skill_level[ch->class]) - skill = 0; - else - skill = ch->pcdata->learned[sn]; - } - - else /* mobiles */ - { - - - if (skill_table[sn].spell_fun != spell_null) - skill = 40 + 2 * ch->level; - - else if (sn == gsn_sneak || sn == gsn_hide) - skill = ch->level * 2 + 20; - - else if ((sn == gsn_dodge && IS_SET(ch->off_flags,OFF_DODGE)) - || (sn == gsn_parry && IS_SET(ch->off_flags,OFF_PARRY))) - skill = ch->level * 2; - - else if (sn == gsn_shield_block) - skill = 10 + 2 * ch->level; - - else if (sn == gsn_second_attack - && (IS_SET(ch->act,ACT_WARRIOR) || IS_SET(ch->act,ACT_THIEF))) - skill = 10 + 3 * ch->level; - - else if (sn == gsn_third_attack && IS_SET(ch->act,ACT_WARRIOR)) - skill = 4 * ch->level - 40; - - else if (sn == gsn_hand_to_hand) - skill = 40 + 2 * ch->level; - - else if (sn == gsn_trip && IS_SET(ch->off_flags,OFF_TRIP)) - skill = 10 + 3 * ch->level; - - else if (sn == gsn_bash && IS_SET(ch->off_flags,OFF_BASH)) - skill = 10 + 3 * ch->level; - - else if (sn == gsn_disarm - && (IS_SET(ch->off_flags,OFF_DISARM) - || IS_SET(ch->act,ACT_WARRIOR) - || IS_SET(ch->act,ACT_THIEF))) - skill = 20 + 3 * ch->level; - - else if (sn == gsn_berserk && IS_SET(ch->off_flags,OFF_BERSERK)) - skill = 3 * ch->level; - - else if (sn == gsn_kick) - skill = 10 + 3 * ch->level; - - else if (sn == gsn_backstab && IS_SET(ch->act,ACT_THIEF)) - skill = 20 + 2 * ch->level; - - else if (sn == gsn_rescue) - skill = 40 + ch->level; - - else if (sn == gsn_recall) - skill = 40 + ch->level; - - else if (sn == gsn_sword - || sn == gsn_dagger - || sn == gsn_spear - || sn == gsn_mace - || sn == gsn_axe - || sn == gsn_flail - || sn == gsn_whip - || sn == gsn_polearm) - skill = 40 + 5 * ch->level / 2; - - else - skill = 0; - } - - if (ch->daze > 0) - { - if (skill_table[sn].spell_fun != spell_null) - skill /= 2; - else - skill = 2 * skill / 3; - } - - if ( !IS_NPC(ch) && ch->pcdata->condition[COND_DRUNK] > 10 ) - skill = 9 * skill / 10; - - return URANGE(0,skill,100); -} - -/* for returning weapon information */ -int get_weapon_sn(CHAR_DATA *ch) -{ - OBJ_DATA *wield; - int sn; - - wield = get_eq_char( ch, WEAR_WIELD ); - if (wield == NULL || wield->item_type != ITEM_WEAPON) - sn = gsn_hand_to_hand; - else switch (wield->value[0]) - { - default : sn = -1; break; - case(WEAPON_SWORD): sn = gsn_sword; break; - case(WEAPON_DAGGER): sn = gsn_dagger; break; - case(WEAPON_SPEAR): sn = gsn_spear; break; - case(WEAPON_MACE): sn = gsn_mace; break; - case(WEAPON_AXE): sn = gsn_axe; break; - case(WEAPON_FLAIL): sn = gsn_flail; break; - case(WEAPON_WHIP): sn = gsn_whip; break; - case(WEAPON_POLEARM): sn = gsn_polearm; break; - } - return sn; -} - -int get_weapon_skill(CHAR_DATA *ch, int sn) -{ - int skill; - - /* -1 is exotic */ - if (IS_NPC(ch)) - { - if (sn == -1) - skill = 3 * ch->level; - else if (sn == gsn_hand_to_hand) - skill = 40 + 2 * ch->level; - else - skill = 40 + 5 * ch->level / 2; - } - - else - { - if (sn == -1) - skill = 3 * ch->level; - else - skill = ch->pcdata->learned[sn]; - } - - return URANGE(0,skill,100); -} - - -/* used to de-screw characters */ -void reset_char(CHAR_DATA *ch) -{ - int loc,mod,stat; - OBJ_DATA *obj; - AFFECT_DATA *af; - int i; - - if (IS_NPC(ch)) - return; - - if (ch->pcdata->perm_hit == 0 - || ch->pcdata->perm_mana == 0 - || ch->pcdata->perm_move == 0 - || ch->pcdata->last_level == 0) - { - /* do a FULL reset */ - for (loc = 0; loc < MAX_WEAR; loc++) - { - obj = get_eq_char(ch,loc); - if (obj == NULL) - continue; - if (!obj->enchanted) - for ( af = obj->pIndexData->affected; af != NULL; af = af->next ) - { - mod = af->modifier; - switch(af->location) - { - case APPLY_SEX: ch->sex -= mod; - if (ch->sex < 0 || ch->sex >2) - ch->sex = IS_NPC(ch) ? - 0 : - ch->pcdata->true_sex; - break; - case APPLY_MANA: ch->max_mana -= mod; break; - case APPLY_HIT: ch->max_hit -= mod; break; - case APPLY_MOVE: ch->max_move -= mod; break; - } - } - - for ( af = obj->affected; af != NULL; af = af->next ) - { - mod = af->modifier; - switch(af->location) - { - case APPLY_SEX: ch->sex -= mod; break; - case APPLY_MANA: ch->max_mana -= mod; break; - case APPLY_HIT: ch->max_hit -= mod; break; - case APPLY_MOVE: ch->max_move -= mod; break; - } - } - } - /* now reset the permanent stats */ - ch->pcdata->perm_hit = ch->max_hit; - ch->pcdata->perm_mana = ch->max_mana; - ch->pcdata->perm_move = ch->max_move; - ch->pcdata->last_level = ch->played/3600; - if (ch->pcdata->true_sex < 0 || ch->pcdata->true_sex > 2) - { if (ch->sex > 0 && ch->sex < 3) - ch->pcdata->true_sex = ch->sex; - else - ch->pcdata->true_sex = 0; - } - - } - - /* now restore the character to his/her true condition */ - for (stat = 0; stat < MAX_STATS; stat++) - ch->mod_stat[stat] = 0; - - if (ch->pcdata->true_sex < 0 || ch->pcdata->true_sex > 2) - ch->pcdata->true_sex = 0; - ch->sex = ch->pcdata->true_sex; - ch->max_hit = ch->pcdata->perm_hit; - ch->max_mana = ch->pcdata->perm_mana; - ch->max_move = ch->pcdata->perm_move; - - for (i = 0; i < 4; i++) - ch->armor[i] = 100; - - ch->hitroll = 0; - ch->damroll = 0; - ch->saving_throw = 0; - - /* now start adding back the effects */ - for (loc = 0; loc < MAX_WEAR; loc++) - { - obj = get_eq_char(ch,loc); - if (obj == NULL) - continue; - for (i = 0; i < 4; i++) - ch->armor[i] -= apply_ac( obj, loc, i ); - - if (!obj->enchanted) - for ( af = obj->pIndexData->affected; af != NULL; af = af->next ) - { - mod = af->modifier; - switch(af->location) - { - case APPLY_STR: ch->mod_stat[STAT_STR] += mod; break; - case APPLY_DEX: ch->mod_stat[STAT_DEX] += mod; break; - case APPLY_INT: ch->mod_stat[STAT_INT] += mod; break; - case APPLY_WIS: ch->mod_stat[STAT_WIS] += mod; break; - case APPLY_CON: ch->mod_stat[STAT_CON] += mod; break; - - case APPLY_SEX: ch->sex += mod; break; - case APPLY_MANA: ch->max_mana += mod; break; - case APPLY_HIT: ch->max_hit += mod; break; - case APPLY_MOVE: ch->max_move += mod; break; - - case APPLY_AC: - for (i = 0; i < 4; i ++) - ch->armor[i] += mod; - break; - case APPLY_HITROLL: ch->hitroll += mod; break; - case APPLY_DAMROLL: ch->damroll += mod; break; - - case APPLY_SAVES: ch->saving_throw += mod; break; - case APPLY_SAVING_ROD: ch->saving_throw += mod; break; - case APPLY_SAVING_PETRI: ch->saving_throw += mod; break; - case APPLY_SAVING_BREATH: ch->saving_throw += mod; break; - case APPLY_SAVING_SPELL: ch->saving_throw += mod; break; - } - } - - for ( af = obj->affected; af != NULL; af = af->next ) - { - mod = af->modifier; - switch(af->location) - { - case APPLY_STR: ch->mod_stat[STAT_STR] += mod; break; - case APPLY_DEX: ch->mod_stat[STAT_DEX] += mod; break; - case APPLY_INT: ch->mod_stat[STAT_INT] += mod; break; - case APPLY_WIS: ch->mod_stat[STAT_WIS] += mod; break; - case APPLY_CON: ch->mod_stat[STAT_CON] += mod; break; - - case APPLY_SEX: ch->sex += mod; break; - case APPLY_MANA: ch->max_mana += mod; break; - case APPLY_HIT: ch->max_hit += mod; break; - case APPLY_MOVE: ch->max_move += mod; break; - - case APPLY_AC: - for (i = 0; i < 4; i ++) - ch->armor[i] += mod; - break; - case APPLY_HITROLL: ch->hitroll += mod; break; - case APPLY_DAMROLL: ch->damroll += mod; break; - - case APPLY_SAVES: ch->saving_throw += mod; break; - case APPLY_SAVING_ROD: ch->saving_throw += mod; break; - case APPLY_SAVING_PETRI: ch->saving_throw += mod; break; - case APPLY_SAVING_BREATH: ch->saving_throw += mod; break; - case APPLY_SAVING_SPELL: ch->saving_throw += mod; break; - } - } - } - - /* now add back spell effects */ - for (af = ch->affected; af != NULL; af = af->next) - { - mod = af->modifier; - switch(af->location) - { - case APPLY_STR: ch->mod_stat[STAT_STR] += mod; break; - case APPLY_DEX: ch->mod_stat[STAT_DEX] += mod; break; - case APPLY_INT: ch->mod_stat[STAT_INT] += mod; break; - case APPLY_WIS: ch->mod_stat[STAT_WIS] += mod; break; - case APPLY_CON: ch->mod_stat[STAT_CON] += mod; break; - - case APPLY_SEX: ch->sex += mod; break; - case APPLY_MANA: ch->max_mana += mod; break; - case APPLY_HIT: ch->max_hit += mod; break; - case APPLY_MOVE: ch->max_move += mod; break; - - case APPLY_AC: - for (i = 0; i < 4; i ++) - ch->armor[i] += mod; - break; - case APPLY_HITROLL: ch->hitroll += mod; break; - case APPLY_DAMROLL: ch->damroll += mod; break; - - case APPLY_SAVES: ch->saving_throw += mod; break; - case APPLY_SAVING_ROD: ch->saving_throw += mod; break; - case APPLY_SAVING_PETRI: ch->saving_throw += mod; break; - case APPLY_SAVING_BREATH: ch->saving_throw += mod; break; - case APPLY_SAVING_SPELL: ch->saving_throw += mod; break; - } - } - - /* make sure sex is RIGHT!!!! */ - if (ch->sex < 0 || ch->sex > 2) - ch->sex = ch->pcdata->true_sex; -} - - -/* - * Retrieve a character's trusted level for permission checking. - */ -int get_trust( CHAR_DATA *ch ) -{ - if ( ch->desc != NULL && ch->desc->original != NULL ) - ch = ch->desc->original; - - if (ch->trust) - return ch->trust; - - if ( IS_NPC(ch) && ch->level >= LEVEL_HERO ) - return LEVEL_HERO - 1; - else - return ch->level; -} - - -/* - * Retrieve a character's age. - */ -int get_age( CHAR_DATA *ch ) -{ - return 17 + ( ch->played + (int) (current_time - ch->logon) ) / 72000; -} - -/* command for retrieving stats */ -int get_curr_stat( CHAR_DATA *ch, int stat ) -{ - int max; - - if (IS_NPC(ch) || ch->level > LEVEL_IMMORTAL) - max = 25; - - else - { - max = pc_race_table[ch->race].max_stats[stat] + 4; - - if (class_table[ch->class].attr_prime == stat) - max += 2; - - if ( ch->race == race_lookup("human")) - max += 1; - - max = UMIN(max,25); - } - - return URANGE(3,ch->perm_stat[stat] + ch->mod_stat[stat], max); -} - -/* command for returning max training score */ -int get_max_train( CHAR_DATA *ch, int stat ) -{ - int max; - - if (IS_NPC(ch) || ch->level > LEVEL_IMMORTAL) - return 25; - - max = pc_race_table[ch->race].max_stats[stat]; - if (class_table[ch->class].attr_prime == stat) - { if (ch->race == race_lookup("human")) - max += 3; - else - max += 2; - } - - return UMIN(max,25); -} - - -/* - * Retrieve a character's carry capacity. - */ -int can_carry_n( CHAR_DATA *ch ) -{ - if ( !IS_NPC(ch) && ch->level >= LEVEL_IMMORTAL ) - return 1000; - - if ( IS_NPC(ch) && IS_SET(ch->act, ACT_PET) ) - return 0; - - return MAX_WEAR + 2 * get_curr_stat(ch,STAT_DEX) + ch->level; -} - - - -/* - * Retrieve a character's carry capacity. - */ -int can_carry_w( CHAR_DATA *ch ) -{ - if ( !IS_NPC(ch) && ch->level >= LEVEL_IMMORTAL ) - return 10000000; - - if ( IS_NPC(ch) && IS_SET(ch->act, ACT_PET) ) - return 0; - - return str_app[get_curr_stat(ch,STAT_STR)].carry * 10 + ch->level * 25; -} - - - -/* - * See if a string is one of the names of an object. - */ - -bool is_name ( char *str, char *namelist ) -{ - char name[MAX_INPUT_LENGTH], part[MAX_INPUT_LENGTH]; - char *list, *string; - - /* fix crash on NULL namelist */ - if (namelist == NULL || namelist[0] == '\0') - return FALSE; - - /* fixed to prevent is_name on "" returning TRUE */ - if (str[0] == '\0') - return FALSE; - - string = str; - /* we need ALL parts of string to match part of namelist */ - for ( ; ; ) /* start parsing string */ - { - str = one_argument(str,part); - - if (part[0] == '\0' ) - return TRUE; - - /* check to see if this is part of namelist */ - list = namelist; - for ( ; ; ) /* start parsing namelist */ - { - list = one_argument(list,name); - if (name[0] == '\0') /* this name was not found */ - return FALSE; - - if (!str_prefix(string,name)) - return TRUE; /* full pattern match */ - - if (!str_prefix(part,name)) - break; - } - } -} - -bool is_exact_name(char *str, char *namelist ) -{ - char name[MAX_INPUT_LENGTH]; - - if (namelist == NULL) - return FALSE; - - for ( ; ; ) - { - namelist = one_argument( namelist, name ); - if ( name[0] == '\0' ) - return FALSE; - if ( !str_cmp( str, name ) ) - return TRUE; - } -} - -/* enchanted stuff for eq */ -void affect_enchant(OBJ_DATA *obj) -{ - /* okay, move all the old flags into new vectors if we have to */ - if (!obj->enchanted) - { - AFFECT_DATA *paf, *af_new; - obj->enchanted = TRUE; - - for (paf = obj->pIndexData->affected; - paf != NULL; paf = paf->next) - { - af_new = new_affect(); - - af_new->next = obj->affected; - obj->affected = af_new; - - af_new->where = paf->where; - af_new->type = UMAX(0,paf->type); - af_new->level = paf->level; - af_new->duration = paf->duration; - af_new->location = paf->location; - af_new->modifier = paf->modifier; - af_new->bitvector = paf->bitvector; - } - } -} - - -/* - * Apply or remove an affect to a character. - */ -void affect_modify( CHAR_DATA *ch, AFFECT_DATA *paf, bool fAdd ) -{ - OBJ_DATA *wield; - int mod,i; - - mod = paf->modifier; - - if ( fAdd ) - { - switch (paf->where) - { - case TO_AFFECTS: - SET_BIT(ch->affected_by, paf->bitvector); - break; - case TO_IMMUNE: - SET_BIT(ch->imm_flags,paf->bitvector); - break; - case TO_RESIST: - SET_BIT(ch->res_flags,paf->bitvector); - break; - case TO_VULN: - SET_BIT(ch->vuln_flags,paf->bitvector); - break; - } - } - else - { - switch (paf->where) - { - case TO_AFFECTS: - REMOVE_BIT(ch->affected_by, paf->bitvector); - break; - case TO_IMMUNE: - REMOVE_BIT(ch->imm_flags,paf->bitvector); - break; - case TO_RESIST: - REMOVE_BIT(ch->res_flags,paf->bitvector); - break; - case TO_VULN: - REMOVE_BIT(ch->vuln_flags,paf->bitvector); - break; - } - mod = 0 - mod; - } - - switch ( paf->location ) - { - default: - bug( "Affect_modify: unknown location %d.", paf->location ); - return; - - case APPLY_NONE: break; - case APPLY_STR: ch->mod_stat[STAT_STR] += mod; break; - case APPLY_DEX: ch->mod_stat[STAT_DEX] += mod; break; - case APPLY_INT: ch->mod_stat[STAT_INT] += mod; break; - case APPLY_WIS: ch->mod_stat[STAT_WIS] += mod; break; - case APPLY_CON: ch->mod_stat[STAT_CON] += mod; break; - case APPLY_SEX: ch->sex += mod; break; - case APPLY_CLASS: break; - case APPLY_LEVEL: break; - case APPLY_AGE: break; - case APPLY_HEIGHT: break; - case APPLY_WEIGHT: break; - case APPLY_MANA: ch->max_mana += mod; break; - case APPLY_HIT: ch->max_hit += mod; break; - case APPLY_MOVE: ch->max_move += mod; break; - case APPLY_GOLD: break; - case APPLY_EXP: break; - case APPLY_AC: - for (i = 0; i < 4; i ++) - ch->armor[i] += mod; - break; - case APPLY_HITROLL: ch->hitroll += mod; break; - case APPLY_DAMROLL: ch->damroll += mod; break; - case APPLY_SAVES: ch->saving_throw += mod; break; - case APPLY_SAVING_ROD: ch->saving_throw += mod; break; - case APPLY_SAVING_PETRI: ch->saving_throw += mod; break; - case APPLY_SAVING_BREATH: ch->saving_throw += mod; break; - case APPLY_SAVING_SPELL: ch->saving_throw += mod; break; - case APPLY_SPELL_AFFECT: break; - } - - /* - * Check for weapon wielding. - * Guard against recursion (for weapons with affects). - */ - if ( !IS_NPC(ch) && ( wield = get_eq_char( ch, WEAR_WIELD ) ) != NULL - && get_obj_weight(wield) > (str_app[get_curr_stat(ch,STAT_STR)].wield*10)) - { - static int depth; - - if ( depth == 0 ) - { - depth++; - act( "You drop $p.", ch, wield, NULL, TO_CHAR ); - act( "$n drops $p.", ch, wield, NULL, TO_ROOM ); - obj_from_char( wield ); - obj_to_room( wield, ch->in_room ); - depth--; - } - } - - return; -} - - -/* find an effect in an affect list */ -AFFECT_DATA *affect_find(AFFECT_DATA *paf, int sn) -{ - AFFECT_DATA *paf_find; - - for ( paf_find = paf; paf_find != NULL; paf_find = paf_find->next ) - { - if ( paf_find->type == sn ) - return paf_find; - } - - return NULL; -} - -/* fix object affects when removing one */ -void affect_check(CHAR_DATA *ch,int where,int vector) -{ - AFFECT_DATA *paf; - OBJ_DATA *obj; - - if (where == TO_OBJECT || where == TO_WEAPON || vector == 0) - return; - - for (paf = ch->affected; paf != NULL; paf = paf->next) - if (paf->where == where && paf->bitvector == vector) - { - switch (where) - { - case TO_AFFECTS: - SET_BIT(ch->affected_by,vector); - break; - case TO_IMMUNE: - SET_BIT(ch->imm_flags,vector); - break; - case TO_RESIST: - SET_BIT(ch->res_flags,vector); - break; - case TO_VULN: - SET_BIT(ch->vuln_flags,vector); - break; - } - return; - } - - for (obj = ch->carrying; obj != NULL; obj = obj->next_content) - { - if (obj->wear_loc == -1) - continue; - - for (paf = obj->affected; paf != NULL; paf = paf->next) - if (paf->where == where && paf->bitvector == vector) - { - switch (where) - { - case TO_AFFECTS: - SET_BIT(ch->affected_by,vector); - break; - case TO_IMMUNE: - SET_BIT(ch->imm_flags,vector); - break; - case TO_RESIST: - SET_BIT(ch->res_flags,vector); - break; - case TO_VULN: - SET_BIT(ch->vuln_flags,vector); - - } - return; - } - - if (obj->enchanted) - continue; - - for (paf = obj->pIndexData->affected; paf != NULL; paf = paf->next) - if (paf->where == where && paf->bitvector == vector) - { - switch (where) - { - case TO_AFFECTS: - SET_BIT(ch->affected_by,vector); - break; - case TO_IMMUNE: - SET_BIT(ch->imm_flags,vector); - break; - case TO_RESIST: - SET_BIT(ch->res_flags,vector); - break; - case TO_VULN: - SET_BIT(ch->vuln_flags,vector); - break; - } - return; - } - } -} - -/* - * Give an affect to a char. - */ -void affect_to_char( CHAR_DATA *ch, AFFECT_DATA *paf ) -{ - AFFECT_DATA *paf_new; - - paf_new = new_affect(); - - *paf_new = *paf; - - VALIDATE(paf); /* in case we missed it when we set up paf */ - paf_new->next = ch->affected; - ch->affected = paf_new; - - affect_modify( ch, paf_new, TRUE ); - return; -} - -/* give an affect to an object */ -void affect_to_obj(OBJ_DATA *obj, AFFECT_DATA *paf) -{ - AFFECT_DATA *paf_new; - - paf_new = new_affect(); - - *paf_new = *paf; - - VALIDATE(paf); /* in case we missed it when we set up paf */ - paf_new->next = obj->affected; - obj->affected = paf_new; - - /* apply any affect vectors to the object's extra_flags */ - if (paf->bitvector) - switch (paf->where) - { - case TO_OBJECT: - SET_BIT(obj->extra_flags,paf->bitvector); - break; - case TO_WEAPON: - if (obj->item_type == ITEM_WEAPON) - SET_BIT(obj->value[4],paf->bitvector); - break; - } - - - return; -} - - - -/* - * Remove an affect from a char. - */ -void affect_remove( CHAR_DATA *ch, AFFECT_DATA *paf ) -{ - int where; - int vector; - - if ( ch->affected == NULL ) - { - bug( "Affect_remove: no affect.", 0 ); - return; - } - - affect_modify( ch, paf, FALSE ); - where = paf->where; - vector = paf->bitvector; - - if ( paf == ch->affected ) - { - ch->affected = paf->next; - } - else - { - AFFECT_DATA *prev; - - for ( prev = ch->affected; prev != NULL; prev = prev->next ) - { - if ( prev->next == paf ) - { - prev->next = paf->next; - break; - } - } - - if ( prev == NULL ) - { - bug( "Affect_remove: cannot find paf.", 0 ); - return; - } - } - - free_affect(paf); - - affect_check(ch,where,vector); - return; -} - -void affect_remove_obj( OBJ_DATA *obj, AFFECT_DATA *paf) -{ - int where, vector; - if ( obj->affected == NULL ) - { - bug( "Affect_remove_object: no affect.", 0 ); - return; - } - - if (obj->carried_by != NULL && obj->wear_loc != -1) - affect_modify( obj->carried_by, paf, FALSE ); - - where = paf->where; - vector = paf->bitvector; - - /* remove flags from the object if needed */ - if (paf->bitvector) - switch( paf->where) - { - case TO_OBJECT: - REMOVE_BIT(obj->extra_flags,paf->bitvector); - break; - case TO_WEAPON: - if (obj->item_type == ITEM_WEAPON) - REMOVE_BIT(obj->value[4],paf->bitvector); - break; - } - - if ( paf == obj->affected ) - { - obj->affected = paf->next; - } - else - { - AFFECT_DATA *prev; - - for ( prev = obj->affected; prev != NULL; prev = prev->next ) - { - if ( prev->next == paf ) - { - prev->next = paf->next; - break; - } - } - - if ( prev == NULL ) - { - bug( "Affect_remove_object: cannot find paf.", 0 ); - return; - } - } - - free_affect(paf); - - if (obj->carried_by != NULL && obj->wear_loc != -1) - affect_check(obj->carried_by,where,vector); - return; -} - - - -/* - * Strip all affects of a given sn. - */ -void affect_strip( CHAR_DATA *ch, int sn ) -{ - AFFECT_DATA *paf; - AFFECT_DATA *paf_next; - - for ( paf = ch->affected; paf != NULL; paf = paf_next ) - { - paf_next = paf->next; - if ( paf->type == sn ) - affect_remove( ch, paf ); - } - - return; -} - - - -/* - * Return true if a char is affected by a spell. - */ -bool is_affected( CHAR_DATA *ch, int sn ) -{ - AFFECT_DATA *paf; - - for ( paf = ch->affected; paf != NULL; paf = paf->next ) - { - if ( paf->type == sn ) - return TRUE; - } - - return FALSE; -} - - - -/* - * Add or enhance an affect. - */ -void affect_join( CHAR_DATA *ch, AFFECT_DATA *paf ) -{ - AFFECT_DATA *paf_old; - bool found; - - found = FALSE; - for ( paf_old = ch->affected; paf_old != NULL; paf_old = paf_old->next ) - { - if ( paf_old->type == paf->type ) - { - paf->level = (paf->level += paf_old->level) / 2; - paf->duration += paf_old->duration; - paf->modifier += paf_old->modifier; - affect_remove( ch, paf_old ); - break; - } - } - - affect_to_char( ch, paf ); - return; -} - - - -/* - * Move a char out of a room. - */ -void char_from_room( CHAR_DATA *ch ) -{ - OBJ_DATA *obj; - - if ( ch->in_room == NULL ) - { - bug( "Char_from_room: NULL.", 0 ); - return; - } - - if ( !IS_NPC(ch) ) - --ch->in_room->area->nplayer; - - if ( ( obj = get_eq_char( ch, WEAR_LIGHT ) ) != NULL - && obj->item_type == ITEM_LIGHT - && obj->value[2] != 0 - && ch->in_room->light > 0 ) - --ch->in_room->light; - - if ( ch == ch->in_room->people ) - { - ch->in_room->people = ch->next_in_room; - } - else - { - CHAR_DATA *prev; - - for ( prev = ch->in_room->people; prev; prev = prev->next_in_room ) - { - if ( prev->next_in_room == ch ) - { - prev->next_in_room = ch->next_in_room; - break; - } - } - - if ( prev == NULL ) - bug( "Char_from_room: ch not found.", 0 ); - } - - ch->in_room = NULL; - ch->next_in_room = NULL; - ch->on = NULL; /* sanity check! */ - return; -} - - - -/* - * Move a char into a room. - */ -void char_to_room( CHAR_DATA *ch, ROOM_INDEX_DATA *pRoomIndex ) -{ - OBJ_DATA *obj; - - if ( pRoomIndex == NULL ) - { - ROOM_INDEX_DATA *room; - - bug( "Char_to_room: NULL.", 0 ); - - if ((room = get_room_index(ROOM_VNUM_TEMPLE)) != NULL) - char_to_room(ch,room); - - return; - } - - ch->in_room = pRoomIndex; - ch->next_in_room = pRoomIndex->people; - pRoomIndex->people = ch; - - if ( !IS_NPC(ch) ) - { - if (ch->in_room->area->empty) - { - ch->in_room->area->empty = FALSE; - ch->in_room->area->age = 0; - } - ++ch->in_room->area->nplayer; - } - - if ( ( obj = get_eq_char( ch, WEAR_LIGHT ) ) != NULL - && obj->item_type == ITEM_LIGHT - && obj->value[2] != 0 ) - ++ch->in_room->light; - - if (IS_AFFECTED(ch,AFF_PLAGUE)) - { - AFFECT_DATA *af, plague; - CHAR_DATA *vch; - - for ( af = ch->affected; af != NULL; af = af->next ) - { - if (af->type == gsn_plague) - break; - } - - if (af == NULL) - { - REMOVE_BIT(ch->affected_by,AFF_PLAGUE); - return; - } - - if (af->level == 1) - return; - - plague.where = TO_AFFECTS; - plague.type = gsn_plague; - plague.level = af->level - 1; - plague.duration = number_range(1,2 * plague.level); - plague.location = APPLY_STR; - plague.modifier = -5; - plague.bitvector = AFF_PLAGUE; - - for ( vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room) - { - if (!saves_spell(plague.level - 2,vch,DAM_DISEASE) - && !IS_IMMORTAL(vch) && - !IS_AFFECTED(vch,AFF_PLAGUE) && number_bits(6) == 0) - { - send_to_char("You feel hot and feverish.\n\r",vch); - act("$n shivers and looks very ill.",vch,NULL,NULL,TO_ROOM); - affect_join(vch,&plague); - } - } - } - - - return; -} - - - -/* - * Give an obj to a char. - */ -void obj_to_char( OBJ_DATA *obj, CHAR_DATA *ch ) -{ - obj->next_content = ch->carrying; - ch->carrying = obj; - obj->carried_by = ch; - obj->in_room = NULL; - obj->in_obj = NULL; - ch->carry_number += get_obj_number( obj ); - ch->carry_weight += get_obj_weight( obj ); -} - - - -/* - * Take an obj from its character. - */ -void obj_from_char( OBJ_DATA *obj ) -{ - CHAR_DATA *ch; - - if ( ( ch = obj->carried_by ) == NULL ) - { - bug( "Obj_from_char: null ch.", 0 ); - return; - } - - if ( obj->wear_loc != WEAR_NONE ) - unequip_char( ch, obj ); - - if ( ch->carrying == obj ) - { - ch->carrying = obj->next_content; - } - else - { - OBJ_DATA *prev; - - for ( prev = ch->carrying; prev != NULL; prev = prev->next_content ) - { - if ( prev->next_content == obj ) - { - prev->next_content = obj->next_content; - break; - } - } - - if ( prev == NULL ) - bug( "Obj_from_char: obj not in list.", 0 ); - } - - obj->carried_by = NULL; - obj->next_content = NULL; - ch->carry_number -= get_obj_number( obj ); - ch->carry_weight -= get_obj_weight( obj ); - return; -} - - - -/* - * Find the ac value of an obj, including position effect. - */ -int apply_ac( OBJ_DATA *obj, int iWear, int type ) -{ - if ( obj->item_type != ITEM_ARMOR ) - return 0; - - switch ( iWear ) - { - case WEAR_BODY: return 3 * obj->value[type]; - case WEAR_HEAD: return 2 * obj->value[type]; - case WEAR_LEGS: return 2 * obj->value[type]; - case WEAR_FEET: return obj->value[type]; - case WEAR_HANDS: return obj->value[type]; - case WEAR_ARMS: return obj->value[type]; - case WEAR_SHIELD: return obj->value[type]; - case WEAR_NECK_1: return obj->value[type]; - case WEAR_NECK_2: return obj->value[type]; - case WEAR_ABOUT: return 2 * obj->value[type]; - case WEAR_WAIST: return obj->value[type]; - case WEAR_WRIST_L: return obj->value[type]; - case WEAR_WRIST_R: return obj->value[type]; - case WEAR_HOLD: return obj->value[type]; - } - - return 0; -} - - - -/* - * Find a piece of eq on a character. - */ -OBJ_DATA *get_eq_char( CHAR_DATA *ch, int iWear ) -{ - OBJ_DATA *obj; - - if (ch == NULL) - return NULL; - - for ( obj = ch->carrying; obj != NULL; obj = obj->next_content ) - { - if ( obj->wear_loc == iWear ) - return obj; - } - - return NULL; -} - - - -/* - * Equip a char with an obj. - */ -void equip_char( CHAR_DATA *ch, OBJ_DATA *obj, int iWear ) -{ - AFFECT_DATA *paf; - int i; - - if ( get_eq_char( ch, iWear ) != NULL ) - { - bug( "Equip_char: already equipped (%d).", iWear ); - return; - } - - if ( ( IS_OBJ_STAT(obj, ITEM_ANTI_EVIL) && IS_EVIL(ch) ) - || ( IS_OBJ_STAT(obj, ITEM_ANTI_GOOD) && IS_GOOD(ch) ) - || ( IS_OBJ_STAT(obj, ITEM_ANTI_NEUTRAL) && IS_NEUTRAL(ch) ) ) - { - /* - * Thanks to Morgenes for the bug fix here! - */ - act( "You are zapped by $p and drop it.", ch, obj, NULL, TO_CHAR ); - act( "$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM ); - obj_from_char( obj ); - obj_to_room( obj, ch->in_room ); - return; - } - - for (i = 0; i < 4; i++) - ch->armor[i] -= apply_ac( obj, iWear,i ); - obj->wear_loc = iWear; - - if (!obj->enchanted) - for ( paf = obj->pIndexData->affected; paf != NULL; paf = paf->next ) - if ( paf->location != APPLY_SPELL_AFFECT ) - affect_modify( ch, paf, TRUE ); - for ( paf = obj->affected; paf != NULL; paf = paf->next ) - if ( paf->location == APPLY_SPELL_AFFECT ) - affect_to_char ( ch, paf ); - else - affect_modify( ch, paf, TRUE ); - - if ( obj->item_type == ITEM_LIGHT - && obj->value[2] != 0 - && ch->in_room != NULL ) - ++ch->in_room->light; - - return; -} - - - -/* - * Unequip a char with an obj. - */ -void unequip_char( CHAR_DATA *ch, OBJ_DATA *obj ) -{ - AFFECT_DATA *paf = NULL; - AFFECT_DATA *lpaf = NULL; - AFFECT_DATA *lpaf_next = NULL; - int i; - - if ( obj->wear_loc == WEAR_NONE ) - { - bug( "Unequip_char: already unequipped.", 0 ); - return; - } - - for (i = 0; i < 4; i++) - ch->armor[i] += apply_ac( obj, obj->wear_loc,i ); - obj->wear_loc = -1; - - if (!obj->enchanted) - for ( paf = obj->pIndexData->affected; paf != NULL; paf = paf->next ) - if ( paf->location == APPLY_SPELL_AFFECT ) - { - for ( lpaf = ch->affected; lpaf != NULL; lpaf = lpaf_next ) - { - lpaf_next = lpaf->next; - if ((lpaf->type == paf->type) && - (lpaf->level == paf->level) && - (lpaf->location == APPLY_SPELL_AFFECT)) - { - affect_remove( ch, lpaf ); - lpaf_next = NULL; - } - } - } - else - { - affect_modify( ch, paf, FALSE ); - affect_check(ch,paf->where,paf->bitvector); - } - - for ( paf = obj->affected; paf != NULL; paf = paf->next ) - if ( paf->location == APPLY_SPELL_AFFECT ) - { - bug ( "Norm-Apply: %d", 0 ); - for ( lpaf = ch->affected; lpaf != NULL; lpaf = lpaf_next ) - { - lpaf_next = lpaf->next; - if ((lpaf->type == paf->type) && - (lpaf->level == paf->level) && - (lpaf->location == APPLY_SPELL_AFFECT)) - { - bug ( "location = %d", lpaf->location ); - bug ( "type = %d", lpaf->type ); - affect_remove( ch, lpaf ); - lpaf_next = NULL; - } - } - } - else - { - affect_modify( ch, paf, FALSE ); - affect_check(ch,paf->where,paf->bitvector); - } - - if ( obj->item_type == ITEM_LIGHT - && obj->value[2] != 0 - && ch->in_room != NULL - && ch->in_room->light > 0 ) - --ch->in_room->light; - - return; -} - - - -/* - * Count occurrences of an obj in a list. - */ -int count_obj_list( OBJ_INDEX_DATA *pObjIndex, OBJ_DATA *list ) -{ - OBJ_DATA *obj; - int nMatch; - - nMatch = 0; - for ( obj = list; obj != NULL; obj = obj->next_content ) - { - if ( obj->pIndexData == pObjIndex ) - nMatch++; - } - - return nMatch; -} - - - -/* - * Move an obj out of a room. - */ -void obj_from_room( OBJ_DATA *obj ) -{ - ROOM_INDEX_DATA *in_room; - CHAR_DATA *ch; - - if ( ( in_room = obj->in_room ) == NULL ) - { - bug( "obj_from_room: NULL.", 0 ); - return; - } - - for (ch = in_room->people; ch != NULL; ch = ch->next_in_room) - if (ch->on == obj) - ch->on = NULL; - - if ( obj == in_room->contents ) - { - in_room->contents = obj->next_content; - } - else - { - OBJ_DATA *prev; - - for ( prev = in_room->contents; prev; prev = prev->next_content ) - { - if ( prev->next_content == obj ) - { - prev->next_content = obj->next_content; - break; - } - } - - if ( prev == NULL ) - { - bug( "Obj_from_room: obj not found.", 0 ); - return; - } - } - - obj->in_room = NULL; - obj->next_content = NULL; - return; -} - - - -/* - * Move an obj into a room. - */ -void obj_to_room( OBJ_DATA *obj, ROOM_INDEX_DATA *pRoomIndex ) -{ - obj->next_content = pRoomIndex->contents; - pRoomIndex->contents = obj; - obj->in_room = pRoomIndex; - obj->carried_by = NULL; - obj->in_obj = NULL; - return; -} - - - -/* - * Move an object into an object. - */ -void obj_to_obj( OBJ_DATA *obj, OBJ_DATA *obj_to ) -{ - obj->next_content = obj_to->contains; - obj_to->contains = obj; - obj->in_obj = obj_to; - obj->in_room = NULL; - obj->carried_by = NULL; - if (obj_to->pIndexData->vnum == OBJ_VNUM_PIT) - obj->cost = 0; - - for ( ; obj_to != NULL; obj_to = obj_to->in_obj ) - { - if ( obj_to->carried_by != NULL ) - { - obj_to->carried_by->carry_number += get_obj_number( obj ); - obj_to->carried_by->carry_weight += get_obj_weight( obj ) - * WEIGHT_MULT(obj_to) / 100; - } - } - - return; -} - - - -/* - * Move an object out of an object. - */ -void obj_from_obj( OBJ_DATA *obj ) -{ - OBJ_DATA *obj_from; - - if ( ( obj_from = obj->in_obj ) == NULL ) - { - bug( "Obj_from_obj: null obj_from.", 0 ); - return; - } - - if ( obj == obj_from->contains ) - { - obj_from->contains = obj->next_content; - } - else - { - OBJ_DATA *prev; - - for ( prev = obj_from->contains; prev; prev = prev->next_content ) - { - if ( prev->next_content == obj ) - { - prev->next_content = obj->next_content; - break; - } - } - - if ( prev == NULL ) - { - bug( "Obj_from_obj: obj not found.", 0 ); - return; - } - } - - obj->next_content = NULL; - obj->in_obj = NULL; - - for ( ; obj_from != NULL; obj_from = obj_from->in_obj ) - { - if ( obj_from->carried_by != NULL ) - { - obj_from->carried_by->carry_number -= get_obj_number( obj ); - obj_from->carried_by->carry_weight -= get_obj_weight( obj ) - * WEIGHT_MULT(obj_from) / 100; - } - } - - return; -} - - - -/* - * Extract an obj from the world. - */ -void extract_obj( OBJ_DATA *obj ) -{ - OBJ_DATA *obj_content; - OBJ_DATA *obj_next; - - if ( obj->in_room != NULL ) - obj_from_room( obj ); - else if ( obj->carried_by != NULL ) - obj_from_char( obj ); - else if ( obj->in_obj != NULL ) - obj_from_obj( obj ); - - for ( obj_content = obj->contains; obj_content; obj_content = obj_next ) - { - obj_next = obj_content->next_content; - extract_obj( obj_content ); - } - - if ( object_list == obj ) - { - object_list = obj->next; - } - else - { - OBJ_DATA *prev; - - for ( prev = object_list; prev != NULL; prev = prev->next ) - { - if ( prev->next == obj ) - { - prev->next = obj->next; - break; - } - } - - if ( prev == NULL ) - { - bug( "Extract_obj: obj %d not found.", obj->pIndexData->vnum ); - return; - } - } - - --obj->pIndexData->count; - free_obj(obj); - return; -} - - - -/* - * Extract a char from the world. - */ -void extract_char( CHAR_DATA *ch, bool fPull ) -{ - CHAR_DATA *wch; - OBJ_DATA *obj; - OBJ_DATA *obj_next; - - /* doesn't seem to be necessary - if ( ch->in_room == NULL ) - { - bug( "Extract_char: NULL.", 0 ); - return; - } - */ - - nuke_pets(ch); - ch->pet = NULL; /* just in case */ - - if ( fPull ) - - die_follower( ch ); - - stop_fighting( ch, TRUE ); - - for ( obj = ch->carrying; obj != NULL; obj = obj_next ) - { - obj_next = obj->next_content; - extract_obj( obj ); - } - - if (ch->in_room != NULL) - char_from_room( ch ); - - /* Death room is set in the clan tabe now */ - if ( !fPull ) - { - char_to_room(ch,get_room_index(clan_table[ch->clan].hall)); - return; - } - - if ( IS_NPC(ch) ) - --ch->pIndexData->count; - - if ( ch->desc != NULL && ch->desc->original != NULL ) - { - do_function(ch, &do_return, "" ); - ch->desc = NULL; - } - - for ( wch = char_list; wch != NULL; wch = wch->next ) - { - if ( wch->reply == ch ) - wch->reply = NULL; - } - - if ( ch == char_list ) - { - char_list = ch->next; - } - else - { - CHAR_DATA *prev; - - for ( prev = char_list; prev != NULL; prev = prev->next ) - { - if ( prev->next == ch ) - { - prev->next = ch->next; - break; - } - } - - if ( prev == NULL ) - { - bug( "Extract_char: char not found.", 0 ); - return; - } - } - - if ( ch->desc != NULL ) - ch->desc->character = NULL; - free_char( ch ); - return; -} - - - -/* - * Find a char in the room. - */ -CHAR_DATA *get_char_room( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *rch; - int number; - int count; - - number = number_argument( argument, arg ); - count = 0; - if ( !str_cmp( arg, "self" ) ) - return ch; - for ( rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room ) - { - if ( !can_see( ch, rch ) || !is_name( arg, rch->name ) ) - continue; - if ( ++count == number ) - return rch; - } - - return NULL; -} - - - - -/* - * Find a char in the world. - */ -CHAR_DATA *get_char_world( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *wch; - int number; - int count; - - if ( ( wch = get_char_room( ch, argument ) ) != NULL ) - return wch; - - number = number_argument( argument, arg ); - count = 0; - for ( wch = char_list; wch != NULL ; wch = wch->next ) - { - if ( wch->in_room == NULL || !can_see( ch, wch ) - || !is_name( arg, wch->name ) ) - continue; - if ( ++count == number ) - return wch; - } - - return NULL; -} - - - -/* - * Find some object with a given index data. - * Used by area-reset 'P' command. - */ -OBJ_DATA *get_obj_type( OBJ_INDEX_DATA *pObjIndex ) -{ - OBJ_DATA *obj; - - for ( obj = object_list; obj != NULL; obj = obj->next ) - { - if ( obj->pIndexData == pObjIndex ) - return obj; - } - - return NULL; -} - - -/* - * Find an obj in a list. - */ -OBJ_DATA *get_obj_list( CHAR_DATA *ch, char *argument, OBJ_DATA *list ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - int number; - int count; - - number = number_argument( argument, arg ); - count = 0; - for ( obj = list; obj != NULL; obj = obj->next_content ) - { - if ( can_see_obj( ch, obj ) && is_name( arg, obj->name ) ) - { - if ( ++count == number ) - return obj; - } - } - - return NULL; -} - - - -/* - * Find an obj in player's inventory. - */ -OBJ_DATA *get_obj_carry( CHAR_DATA *ch, char *argument, CHAR_DATA *viewer ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - int number; - int count; - - number = number_argument( argument, arg ); - count = 0; - for ( obj = ch->carrying; obj != NULL; obj = obj->next_content ) - { - if ( obj->wear_loc == WEAR_NONE - && (can_see_obj( viewer, obj ) ) - && is_name( arg, obj->name ) ) - { - if ( ++count == number ) - return obj; - } - } - - return NULL; -} - - - -/* - * Find an obj in player's equipment. - */ -OBJ_DATA *get_obj_wear( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - int number; - int count; - - number = number_argument( argument, arg ); - count = 0; - for ( obj = ch->carrying; obj != NULL; obj = obj->next_content ) - { - if ( obj->wear_loc != WEAR_NONE - && can_see_obj( ch, obj ) - && is_name( arg, obj->name ) ) - { - if ( ++count == number ) - return obj; - } - } - - return NULL; -} - - - -/* - * Find an obj in the room or in inventory. - */ -OBJ_DATA *get_obj_here( CHAR_DATA *ch, char *argument ) -{ - OBJ_DATA *obj; - - obj = get_obj_list( ch, argument, ch->in_room->contents ); - if ( obj != NULL ) - return obj; - - if ( ( obj = get_obj_carry( ch, argument, ch ) ) != NULL ) - return obj; - - if ( ( obj = get_obj_wear( ch, argument ) ) != NULL ) - return obj; - - return NULL; -} - - - -/* - * Find an obj in the world. - */ -OBJ_DATA *get_obj_world( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - int number; - int count; - - if ( ( obj = get_obj_here( ch, argument ) ) != NULL ) - return obj; - - number = number_argument( argument, arg ); - count = 0; - for ( obj = object_list; obj != NULL; obj = obj->next ) - { - if ( can_see_obj( ch, obj ) && is_name( arg, obj->name ) ) - { - if ( ++count == number ) - return obj; - } - } - - return NULL; -} - -/* deduct cost from a character */ - -void deduct_cost(CHAR_DATA *ch, int cost) -{ - int silver = 0, gold = 0; - - silver = UMIN(ch->silver,cost); - - if (silver < cost) - { - gold = ((cost - silver + 99) / 100); - silver = cost - 100 * gold; - } - - ch->gold -= gold; - ch->silver -= silver; - - if (ch->gold < 0) - { - bug("deduct costs: gold %d < 0",ch->gold); - ch->gold = 0; - } - if (ch->silver < 0) - { - bug("deduct costs: silver %d < 0",ch->silver); - ch->silver = 0; - } -} -/* - * Create a 'money' obj. - */ -OBJ_DATA *create_money( int gold, int silver ) -{ - char buf[MAX_STRING_LENGTH]; - OBJ_DATA *obj; - - if ( gold < 0 || silver < 0 || (gold == 0 && silver == 0) ) - { - bug( "Create_money: zero or negative money.",UMIN(gold,silver)); - gold = UMAX(1,gold); - silver = UMAX(1,silver); - } - - if (gold == 0 && silver == 1) - { - obj = create_object( get_obj_index( OBJ_VNUM_SILVER_ONE ), 0 ); - } - else if (gold == 1 && silver == 0) - { - obj = create_object( get_obj_index( OBJ_VNUM_GOLD_ONE), 0 ); - } - else if (silver == 0) - { - obj = create_object( get_obj_index( OBJ_VNUM_GOLD_SOME ), 0 ); - sprintf( buf, obj->short_descr, gold ); - free_string( obj->short_descr ); - obj->short_descr = str_dup( buf ); - obj->value[1] = gold; - obj->cost = gold; - obj->weight = gold/5; - } - else if (gold == 0) - { - obj = create_object( get_obj_index( OBJ_VNUM_SILVER_SOME ), 0 ); - sprintf( buf, obj->short_descr, silver ); - free_string( obj->short_descr ); - obj->short_descr = str_dup( buf ); - obj->value[0] = silver; - obj->cost = silver; - obj->weight = silver/20; - } - - else - { - obj = create_object( get_obj_index( OBJ_VNUM_COINS ), 0 ); - sprintf( buf, obj->short_descr, silver, gold ); - free_string( obj->short_descr ); - obj->short_descr = str_dup( buf ); - obj->value[0] = silver; - obj->value[1] = gold; - obj->cost = 100 * gold + silver; - obj->weight = gold / 5 + silver / 20; - } - - return obj; -} - - - -/* - * Return # of objects which an object counts as. - * Thanks to Tony Chamberlain for the correct recursive code here. - */ -int get_obj_number( OBJ_DATA *obj ) -{ - int number; - - if (obj->item_type == ITEM_CONTAINER || obj->item_type == ITEM_MONEY - || obj->item_type == ITEM_GEM || obj->item_type == ITEM_JEWELRY) - number = 0; - else - number = 1; - - for ( obj = obj->contains; obj != NULL; obj = obj->next_content ) - number += get_obj_number( obj ); - - return number; -} - - -/* - * Return weight of an object, including weight of contents. - */ -int get_obj_weight( OBJ_DATA *obj ) -{ - int weight; - OBJ_DATA *tobj; - - weight = obj->weight; - for ( tobj = obj->contains; tobj != NULL; tobj = tobj->next_content ) - weight += get_obj_weight( tobj ) * WEIGHT_MULT(obj) / 100; - - return weight; -} - -int get_true_weight(OBJ_DATA *obj) -{ - int weight; - - weight = obj->weight; - for ( obj = obj->contains; obj != NULL; obj = obj->next_content ) - weight += get_obj_weight( obj ); - - return weight; -} - -/* - * True if room is dark. - */ -bool room_is_dark( ROOM_INDEX_DATA *pRoomIndex ) -{ - if ( pRoomIndex->light > 0 ) - return FALSE; - - if ( IS_SET(pRoomIndex->room_flags, ROOM_DARK) ) - return TRUE; - - if ( pRoomIndex->sector_type == SECT_INSIDE - || pRoomIndex->sector_type == SECT_CITY ) - return FALSE; - - if ( weather_info.sunlight == SUN_SET - || weather_info.sunlight == SUN_DARK ) - return TRUE; - - return FALSE; -} - - -bool is_room_owner(CHAR_DATA *ch, ROOM_INDEX_DATA *room) -{ - if (room->owner == NULL || room->owner[0] == '\0') - return FALSE; - - return is_name(ch->name,room->owner); -} - -/* - * True if room is private. - */ -bool room_is_private( ROOM_INDEX_DATA *pRoomIndex ) -{ - CHAR_DATA *rch; - int count; - - - if (pRoomIndex->owner != NULL && pRoomIndex->owner[0] != '\0') - return TRUE; - - count = 0; - for ( rch = pRoomIndex->people; rch != NULL; rch = rch->next_in_room ) - count++; - - if ( IS_SET(pRoomIndex->room_flags, ROOM_PRIVATE) && count >= 2 ) - return TRUE; - - if ( IS_SET(pRoomIndex->room_flags, ROOM_SOLITARY) && count >= 1 ) - return TRUE; - - if ( IS_SET(pRoomIndex->room_flags, ROOM_IMP_ONLY) ) - return TRUE; - - return FALSE; -} - -/* visibility on a room -- for entering and exits */ -bool can_see_room( CHAR_DATA *ch, ROOM_INDEX_DATA *pRoomIndex ) -{ - if (IS_SET(pRoomIndex->room_flags, ROOM_IMP_ONLY) - && get_trust(ch) < MAX_LEVEL) - return FALSE; - - if (IS_SET(pRoomIndex->room_flags, ROOM_GODS_ONLY) - && !IS_IMMORTAL(ch)) - return FALSE; - - if (IS_SET(pRoomIndex->room_flags, ROOM_HEROES_ONLY) - && !IS_IMMORTAL(ch)) - return FALSE; - - if (IS_SET(pRoomIndex->room_flags,ROOM_NEWBIES_ONLY) - && ch->level > 5 && !IS_IMMORTAL(ch)) - return FALSE; - - if (!IS_IMMORTAL(ch) && pRoomIndex->clan && ch->clan != pRoomIndex->clan) - return FALSE; - - return TRUE; -} - - - -/* - * True if char can see victim. - */ -bool can_see( CHAR_DATA *ch, CHAR_DATA *victim ) -{ -/* RT changed so that WIZ_INVIS has levels */ - if ( ch == victim ) - return TRUE; - - if ( get_trust(ch) < victim->invis_level) - return FALSE; - - - if (get_trust(ch) < victim->incog_level && ch->in_room != victim->in_room) - return FALSE; - - if ( (!IS_NPC(ch) && IS_SET(ch->act, PLR_HOLYLIGHT)) - || (IS_NPC(ch) && IS_IMMORTAL(ch))) - return TRUE; - - if ( IS_AFFECTED(ch, AFF_BLIND) ) - return FALSE; - - if ( room_is_dark( ch->in_room ) && !IS_AFFECTED(ch, AFF_INFRARED) ) - return FALSE; - - if ( IS_AFFECTED(victim, AFF_INVISIBLE) - && !IS_AFFECTED(ch, AFF_DETECT_INVIS) ) - return FALSE; - - /* sneaking */ - if ( IS_AFFECTED(victim, AFF_SNEAK) - && !IS_AFFECTED(ch,AFF_DETECT_HIDDEN) - && victim->fighting == NULL) - { - int chance; - chance = get_skill(victim,gsn_sneak); - chance += get_curr_stat(victim,STAT_DEX) * 3/2; - chance -= get_curr_stat(ch,STAT_INT) * 2; - chance -= ch->level - victim->level * 3/2; - - if (number_percent() < chance) - return FALSE; - } - - if ( IS_AFFECTED(victim, AFF_HIDE) - && !IS_AFFECTED(ch, AFF_DETECT_HIDDEN) - && victim->fighting == NULL) - return FALSE; - - return TRUE; -} - - - -/* - * True if char can see obj. - */ -bool can_see_obj( CHAR_DATA *ch, OBJ_DATA *obj ) -{ - if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_HOLYLIGHT) ) - return TRUE; - - if ( IS_SET(obj->extra_flags,ITEM_VIS_DEATH)) - return FALSE; - - if ( IS_AFFECTED( ch, AFF_BLIND ) && obj->item_type != ITEM_POTION) - return FALSE; - - if ( obj->item_type == ITEM_LIGHT && obj->value[2] != 0 ) - return TRUE; - - if ( IS_SET(obj->extra_flags, ITEM_INVIS) - && !IS_AFFECTED(ch, AFF_DETECT_INVIS) ) - return FALSE; - - if ( IS_OBJ_STAT(obj,ITEM_GLOW)) - return TRUE; - - if ( room_is_dark( ch->in_room ) && !IS_AFFECTED(ch, AFF_DARK_VISION) ) - return FALSE; - - return TRUE; -} - - - -/* - * True if char can drop obj. - */ -bool can_drop_obj( CHAR_DATA *ch, OBJ_DATA *obj ) -{ - if ( !IS_SET(obj->extra_flags, ITEM_NODROP) ) - return TRUE; - - if ( !IS_NPC(ch) && ch->level >= LEVEL_IMMORTAL ) - return TRUE; - - return FALSE; -} - - -/* - * Return ascii name of an affect location. - */ -char *affect_loc_name( int location ) -{ - switch ( location ) - { - case APPLY_NONE: return "none"; - case APPLY_STR: return "strength"; - case APPLY_DEX: return "dexterity"; - case APPLY_INT: return "intelligence"; - case APPLY_WIS: return "wisdom"; - case APPLY_CON: return "constitution"; - case APPLY_SEX: return "sex"; - case APPLY_CLASS: return "class"; - case APPLY_LEVEL: return "level"; - case APPLY_AGE: return "age"; - case APPLY_MANA: return "mana"; - case APPLY_HIT: return "hp"; - case APPLY_MOVE: return "moves"; - case APPLY_GOLD: return "gold"; - case APPLY_EXP: return "experience"; - case APPLY_AC: return "armor class"; - case APPLY_HITROLL: return "hit roll"; - case APPLY_DAMROLL: return "damage roll"; - case APPLY_SAVES: return "saves"; - case APPLY_SAVING_ROD: return "save vs rod"; - case APPLY_SAVING_PETRI: return "save vs petrification"; - case APPLY_SAVING_BREATH: return "save vs breath"; - case APPLY_SAVING_SPELL: return "save vs spell"; - case APPLY_SPELL_AFFECT: return "none"; - } - - bug( "Affect_location_name: unknown location %d.", location ); - return "(unknown)"; -} - - - -/* - * Return ascii name of an affect bit vector. - */ -char *affect_bit_name( int vector ) -{ - static char buf[512]; - - buf[0] = '\0'; - if ( vector & AFF_BLIND ) strcat( buf, " blind" ); - if ( vector & AFF_INVISIBLE ) strcat( buf, " invisible" ); - if ( vector & AFF_DETECT_EVIL ) strcat( buf, " detect_evil" ); - if ( vector & AFF_DETECT_GOOD ) strcat( buf, " detect_good" ); - if ( vector & AFF_DETECT_INVIS ) strcat( buf, " detect_invis" ); - if ( vector & AFF_DETECT_MAGIC ) strcat( buf, " detect_magic" ); - if ( vector & AFF_DETECT_HIDDEN ) strcat( buf, " detect_hidden" ); - if ( vector & AFF_SANCTUARY ) strcat( buf, " sanctuary" ); - if ( vector & AFF_FAERIE_FIRE ) strcat( buf, " faerie_fire" ); - if ( vector & AFF_INFRARED ) strcat( buf, " infrared" ); - if ( vector & AFF_CURSE ) strcat( buf, " curse" ); - if ( vector & AFF_POISON ) strcat( buf, " poison" ); - if ( vector & AFF_PROTECT_EVIL ) strcat( buf, " prot_evil" ); - if ( vector & AFF_PROTECT_GOOD ) strcat( buf, " prot_good" ); - if ( vector & AFF_SLEEP ) strcat( buf, " sleep" ); - if ( vector & AFF_SNEAK ) strcat( buf, " sneak" ); - if ( vector & AFF_HIDE ) strcat( buf, " hide" ); - if ( vector & AFF_CHARM ) strcat( buf, " charm" ); - if ( vector & AFF_FLYING ) strcat( buf, " flying" ); - if ( vector & AFF_PASS_DOOR ) strcat( buf, " pass_door" ); - if ( vector & AFF_BERSERK ) strcat( buf, " berserk" ); - if ( vector & AFF_CALM ) strcat( buf, " calm" ); - if ( vector & AFF_HASTE ) strcat( buf, " haste" ); - if ( vector & AFF_SLOW ) strcat( buf, " slow" ); - if ( vector & AFF_PLAGUE ) strcat( buf, " plague" ); - if ( vector & AFF_DARK_VISION ) strcat( buf, " dark_vision" ); - return ( buf[0] != '\0' ) ? buf+1 : "none"; -} - - - -/* - * Return ascii name of extra flags vector. - */ -char *extra_bit_name( int extra_flags ) -{ - static char buf[512]; - - buf[0] = '\0'; - if ( extra_flags & ITEM_GLOW ) strcat( buf, " glow" ); - if ( extra_flags & ITEM_HUM ) strcat( buf, " hum" ); - if ( extra_flags & ITEM_DARK ) strcat( buf, " dark" ); - if ( extra_flags & ITEM_LOCK ) strcat( buf, " lock" ); - if ( extra_flags & ITEM_EVIL ) strcat( buf, " evil" ); - if ( extra_flags & ITEM_INVIS ) strcat( buf, " invis" ); - if ( extra_flags & ITEM_MAGIC ) strcat( buf, " magic" ); - if ( extra_flags & ITEM_NODROP ) strcat( buf, " nodrop" ); - if ( extra_flags & ITEM_BLESS ) strcat( buf, " bless" ); - if ( extra_flags & ITEM_ANTI_GOOD ) strcat( buf, " anti-good" ); - if ( extra_flags & ITEM_ANTI_EVIL ) strcat( buf, " anti-evil" ); - if ( extra_flags & ITEM_ANTI_NEUTRAL ) strcat( buf, " anti-neutral" ); - if ( extra_flags & ITEM_NOREMOVE ) strcat( buf, " noremove" ); - if ( extra_flags & ITEM_INVENTORY ) strcat( buf, " inventory" ); - if ( extra_flags & ITEM_NOPURGE ) strcat( buf, " nopurge" ); - if ( extra_flags & ITEM_VIS_DEATH ) strcat( buf, " vis_death" ); - if ( extra_flags & ITEM_ROT_DEATH ) strcat( buf, " rot_death" ); - if ( extra_flags & ITEM_NOLOCATE ) strcat( buf, " no_locate" ); - if ( extra_flags & ITEM_SELL_EXTRACT ) strcat( buf, " sell_extract" ); - if ( extra_flags & ITEM_BURN_PROOF ) strcat( buf, " burn_proof" ); - if ( extra_flags & ITEM_NOUNCURSE ) strcat( buf, " no_uncurse" ); - return ( buf[0] != '\0' ) ? buf+1 : "none"; -} - -/* return ascii name of an act vector */ -char *act_bit_name( int act_flags ) -{ - static char buf[512]; - - buf[0] = '\0'; - - if (IS_SET(act_flags,ACT_IS_NPC)) - { - strcat(buf," npc"); - if (act_flags & ACT_SENTINEL ) strcat(buf, " sentinel"); - if (act_flags & ACT_SCAVENGER ) strcat(buf, " scavenger"); - if (act_flags & ACT_AGGRESSIVE ) strcat(buf, " aggressive"); - if (act_flags & ACT_STAY_AREA ) strcat(buf, " stay_area"); - if (act_flags & ACT_WIMPY ) strcat(buf, " wimpy"); - if (act_flags & ACT_PET ) strcat(buf, " pet"); - if (act_flags & ACT_TRAIN ) strcat(buf, " train"); - if (act_flags & ACT_PRACTICE ) strcat(buf, " practice"); - if (act_flags & ACT_UNDEAD ) strcat(buf, " undead"); - if (act_flags & ACT_CLERIC ) strcat(buf, " cleric"); - if (act_flags & ACT_MAGE ) strcat(buf, " mage"); - if (act_flags & ACT_THIEF ) strcat(buf, " thief"); - if (act_flags & ACT_WARRIOR ) strcat(buf, " warrior"); - if (act_flags & ACT_NOALIGN ) strcat(buf, " no_align"); - if (act_flags & ACT_NOPURGE ) strcat(buf, " no_purge"); - if (act_flags & ACT_IS_HEALER ) strcat(buf, " healer"); - if (act_flags & ACT_IS_CHANGER ) strcat(buf, " changer"); - if (act_flags & ACT_GAIN ) strcat(buf, " skill_train"); - if (act_flags & ACT_UPDATE_ALWAYS) strcat(buf," update_always"); - } - else - { - strcat(buf," player"); - if (act_flags & PLR_AUTOASSIST ) strcat(buf, " autoassist"); - if (act_flags & PLR_AUTOEXIT ) strcat(buf, " autoexit"); - if (act_flags & PLR_AUTOLOOT ) strcat(buf, " autoloot"); - if (act_flags & PLR_AUTOSAC ) strcat(buf, " autosac"); - if (act_flags & PLR_AUTOGOLD ) strcat(buf, " autogold"); - if (act_flags & PLR_AUTOSPLIT ) strcat(buf, " autosplit"); - if (act_flags & PLR_HOLYLIGHT ) strcat(buf, " holy_light"); - if (act_flags & PLR_CANLOOT ) strcat(buf, " loot_corpse"); - if (act_flags & PLR_NOSUMMON ) strcat(buf, " no_summon"); - if (act_flags & PLR_NOFOLLOW ) strcat(buf, " no_follow"); - if (act_flags & PLR_FREEZE ) strcat(buf, " frozen"); - if (act_flags & PLR_THIEF ) strcat(buf, " thief"); - if (act_flags & PLR_KILLER ) strcat(buf, " killer"); - } - return ( buf[0] != '\0' ) ? buf+1 : "none"; -} - -char *comm_bit_name(int comm_flags) -{ - static char buf[512]; - - buf[0] = '\0'; - - if (comm_flags & COMM_QUIET ) strcat(buf, " quiet"); - if (comm_flags & COMM_DEAF ) strcat(buf, " deaf"); - if (comm_flags & COMM_NOWIZ ) strcat(buf, " no_wiz"); - if (comm_flags & COMM_NOAUCTION ) strcat(buf, " no_auction"); - if (comm_flags & COMM_NOGOSSIP ) strcat(buf, " no_gossip"); - if (comm_flags & COMM_NOQUESTION ) strcat(buf, " no_question"); - if (comm_flags & COMM_NOMUSIC ) strcat(buf, " no_music"); - if (comm_flags & COMM_NOQUOTE ) strcat(buf, " no_quote"); - if (comm_flags & COMM_COMPACT ) strcat(buf, " compact"); - if (comm_flags & COMM_BRIEF ) strcat(buf, " brief"); - if (comm_flags & COMM_PROMPT ) strcat(buf, " prompt"); - if (comm_flags & COMM_COMBINE ) strcat(buf, " combine"); - if (comm_flags & COMM_NOEMOTE ) strcat(buf, " no_emote"); - if (comm_flags & COMM_NOSHOUT ) strcat(buf, " no_shout"); - if (comm_flags & COMM_NOTELL ) strcat(buf, " no_tell"); - if (comm_flags & COMM_NOCHANNELS ) strcat(buf, " no_channels"); - - - return ( buf[0] != '\0' ) ? buf+1 : "none"; -} - -char *imm_bit_name(int imm_flags) -{ - static char buf[512]; - - buf[0] = '\0'; - - if (imm_flags & IMM_SUMMON ) strcat(buf, " summon"); - if (imm_flags & IMM_CHARM ) strcat(buf, " charm"); - if (imm_flags & IMM_MAGIC ) strcat(buf, " magic"); - if (imm_flags & IMM_WEAPON ) strcat(buf, " weapon"); - if (imm_flags & IMM_BASH ) strcat(buf, " blunt"); - if (imm_flags & IMM_PIERCE ) strcat(buf, " piercing"); - if (imm_flags & IMM_SLASH ) strcat(buf, " slashing"); - if (imm_flags & IMM_FIRE ) strcat(buf, " fire"); - if (imm_flags & IMM_COLD ) strcat(buf, " cold"); - if (imm_flags & IMM_LIGHTNING ) strcat(buf, " lightning"); - if (imm_flags & IMM_ACID ) strcat(buf, " acid"); - if (imm_flags & IMM_POISON ) strcat(buf, " poison"); - if (imm_flags & IMM_NEGATIVE ) strcat(buf, " negative"); - if (imm_flags & IMM_HOLY ) strcat(buf, " holy"); - if (imm_flags & IMM_ENERGY ) strcat(buf, " energy"); - if (imm_flags & IMM_MENTAL ) strcat(buf, " mental"); - if (imm_flags & IMM_DISEASE ) strcat(buf, " disease"); - if (imm_flags & IMM_DROWNING ) strcat(buf, " drowning"); - if (imm_flags & IMM_LIGHT ) strcat(buf, " light"); - if (imm_flags & VULN_IRON ) strcat(buf, " iron"); - if (imm_flags & VULN_WOOD ) strcat(buf, " wood"); - if (imm_flags & VULN_SILVER ) strcat(buf, " silver"); - - return ( buf[0] != '\0' ) ? buf+1 : "none"; -} - -char *wear_bit_name(int wear_flags) -{ - static char buf[512]; - - buf [0] = '\0'; - if (wear_flags & ITEM_TAKE ) strcat(buf, " take"); - if (wear_flags & ITEM_WEAR_FINGER ) strcat(buf, " finger"); - if (wear_flags & ITEM_WEAR_NECK ) strcat(buf, " neck"); - if (wear_flags & ITEM_WEAR_BODY ) strcat(buf, " torso"); - if (wear_flags & ITEM_WEAR_HEAD ) strcat(buf, " head"); - if (wear_flags & ITEM_WEAR_LEGS ) strcat(buf, " legs"); - if (wear_flags & ITEM_WEAR_FEET ) strcat(buf, " feet"); - if (wear_flags & ITEM_WEAR_HANDS ) strcat(buf, " hands"); - if (wear_flags & ITEM_WEAR_ARMS ) strcat(buf, " arms"); - if (wear_flags & ITEM_WEAR_SHIELD ) strcat(buf, " shield"); - if (wear_flags & ITEM_WEAR_ABOUT ) strcat(buf, " body"); - if (wear_flags & ITEM_WEAR_WAIST ) strcat(buf, " waist"); - if (wear_flags & ITEM_WEAR_WRIST ) strcat(buf, " wrist"); - if (wear_flags & ITEM_WIELD ) strcat(buf, " wield"); - if (wear_flags & ITEM_HOLD ) strcat(buf, " hold"); - if (wear_flags & ITEM_NO_SAC ) strcat(buf, " nosac"); - if (wear_flags & ITEM_WEAR_FLOAT ) strcat(buf, " float"); - - return ( buf[0] != '\0' ) ? buf+1 : "none"; -} - -char *form_bit_name(int form_flags) -{ - static char buf[512]; - - buf[0] = '\0'; - if (form_flags & FORM_POISON ) strcat(buf, " poison"); - else if (form_flags & FORM_EDIBLE ) strcat(buf, " edible"); - if (form_flags & FORM_MAGICAL ) strcat(buf, " magical"); - if (form_flags & FORM_INSTANT_DECAY ) strcat(buf, " instant_rot"); - if (form_flags & FORM_OTHER ) strcat(buf, " other"); - if (form_flags & FORM_ANIMAL ) strcat(buf, " animal"); - if (form_flags & FORM_SENTIENT ) strcat(buf, " sentient"); - if (form_flags & FORM_UNDEAD ) strcat(buf, " undead"); - if (form_flags & FORM_CONSTRUCT ) strcat(buf, " construct"); - if (form_flags & FORM_MIST ) strcat(buf, " mist"); - if (form_flags & FORM_INTANGIBLE ) strcat(buf, " intangible"); - if (form_flags & FORM_BIPED ) strcat(buf, " biped"); - if (form_flags & FORM_CENTAUR ) strcat(buf, " centaur"); - if (form_flags & FORM_INSECT ) strcat(buf, " insect"); - if (form_flags & FORM_SPIDER ) strcat(buf, " spider"); - if (form_flags & FORM_CRUSTACEAN ) strcat(buf, " crustacean"); - if (form_flags & FORM_WORM ) strcat(buf, " worm"); - if (form_flags & FORM_BLOB ) strcat(buf, " blob"); - if (form_flags & FORM_MAMMAL ) strcat(buf, " mammal"); - if (form_flags & FORM_BIRD ) strcat(buf, " bird"); - if (form_flags & FORM_REPTILE ) strcat(buf, " reptile"); - if (form_flags & FORM_SNAKE ) strcat(buf, " snake"); - if (form_flags & FORM_DRAGON ) strcat(buf, " dragon"); - if (form_flags & FORM_AMPHIBIAN ) strcat(buf, " amphibian"); - if (form_flags & FORM_FISH ) strcat(buf, " fish"); - if (form_flags & FORM_COLD_BLOOD ) strcat(buf, " cold_blooded"); - - return ( buf[0] != '\0' ) ? buf+1 : "none"; -} - -char *part_bit_name(int part_flags) -{ - static char buf[512]; - - buf[0] = '\0'; - if (part_flags & PART_HEAD ) strcat(buf, " head"); - if (part_flags & PART_ARMS ) strcat(buf, " arms"); - if (part_flags & PART_LEGS ) strcat(buf, " legs"); - if (part_flags & PART_HEART ) strcat(buf, " heart"); - if (part_flags & PART_BRAINS ) strcat(buf, " brains"); - if (part_flags & PART_GUTS ) strcat(buf, " guts"); - if (part_flags & PART_HANDS ) strcat(buf, " hands"); - if (part_flags & PART_FEET ) strcat(buf, " feet"); - if (part_flags & PART_FINGERS ) strcat(buf, " fingers"); - if (part_flags & PART_EAR ) strcat(buf, " ears"); - if (part_flags & PART_EYE ) strcat(buf, " eyes"); - if (part_flags & PART_LONG_TONGUE ) strcat(buf, " long_tongue"); - if (part_flags & PART_EYESTALKS ) strcat(buf, " eyestalks"); - if (part_flags & PART_TENTACLES ) strcat(buf, " tentacles"); - if (part_flags & PART_FINS ) strcat(buf, " fins"); - if (part_flags & PART_WINGS ) strcat(buf, " wings"); - if (part_flags & PART_TAIL ) strcat(buf, " tail"); - if (part_flags & PART_CLAWS ) strcat(buf, " claws"); - if (part_flags & PART_FANGS ) strcat(buf, " fangs"); - if (part_flags & PART_HORNS ) strcat(buf, " horns"); - if (part_flags & PART_SCALES ) strcat(buf, " scales"); - - return ( buf[0] != '\0' ) ? buf+1 : "none"; -} - -char *weapon_bit_name(int weapon_flags) -{ - static char buf[512]; - - buf[0] = '\0'; - if (weapon_flags & WEAPON_FLAMING ) strcat(buf, " flaming"); - if (weapon_flags & WEAPON_FROST ) strcat(buf, " frost"); - if (weapon_flags & WEAPON_VAMPIRIC ) strcat(buf, " vampiric"); - if (weapon_flags & WEAPON_SHARP ) strcat(buf, " sharp"); - if (weapon_flags & WEAPON_VORPAL ) strcat(buf, " vorpal"); - if (weapon_flags & WEAPON_TWO_HANDS ) strcat(buf, " two-handed"); - if (weapon_flags & WEAPON_SHOCKING ) strcat(buf, " shocking"); - if (weapon_flags & WEAPON_POISON ) strcat(buf, " poison"); - - return ( buf[0] != '\0' ) ? buf+1 : "none"; -} - -char *cont_bit_name( int cont_flags) -{ - static char buf[512]; - - buf[0] = '\0'; - - if (cont_flags & CONT_CLOSEABLE ) strcat(buf, " closable"); - if (cont_flags & CONT_PICKPROOF ) strcat(buf, " pickproof"); - if (cont_flags & CONT_CLOSED ) strcat(buf, " closed"); - if (cont_flags & CONT_LOCKED ) strcat(buf, " locked"); - - return (buf[0] != '\0' ) ? buf+1 : "none"; -} - - -char *off_bit_name(int off_flags) -{ - static char buf[512]; - - buf[0] = '\0'; - - if (off_flags & OFF_AREA_ATTACK ) strcat(buf, " area attack"); - if (off_flags & OFF_BACKSTAB ) strcat(buf, " backstab"); - if (off_flags & OFF_BASH ) strcat(buf, " bash"); - if (off_flags & OFF_BERSERK ) strcat(buf, " berserk"); - if (off_flags & OFF_DISARM ) strcat(buf, " disarm"); - if (off_flags & OFF_DODGE ) strcat(buf, " dodge"); - if (off_flags & OFF_FADE ) strcat(buf, " fade"); - if (off_flags & OFF_FAST ) strcat(buf, " fast"); - if (off_flags & OFF_KICK ) strcat(buf, " kick"); - if (off_flags & OFF_KICK_DIRT ) strcat(buf, " kick_dirt"); - if (off_flags & OFF_PARRY ) strcat(buf, " parry"); - if (off_flags & OFF_RESCUE ) strcat(buf, " rescue"); - if (off_flags & OFF_TAIL ) strcat(buf, " tail"); - if (off_flags & OFF_TRIP ) strcat(buf, " trip"); - if (off_flags & OFF_CRUSH ) strcat(buf, " crush"); - if (off_flags & ASSIST_ALL ) strcat(buf, " assist_all"); - if (off_flags & ASSIST_ALIGN ) strcat(buf, " assist_align"); - if (off_flags & ASSIST_RACE ) strcat(buf, " assist_race"); - if (off_flags & ASSIST_PLAYERS ) strcat(buf, " assist_players"); - if (off_flags & ASSIST_GUARD ) strcat(buf, " assist_guard"); - if (off_flags & ASSIST_VNUM ) strcat(buf, " assist_vnum"); - - return ( buf[0] != '\0' ) ? buf+1 : "none"; -} diff --git a/Rom24/src/healer.c b/Rom24/src/healer.c deleted file mode 100644 index 916e21d..0000000 --- a/Rom24/src/healer.c +++ /dev/null @@ -1,196 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#include -#else -#include -#include -#endif -#include -#include -#include -#include "merc.h" -#include "magic.h" - -void do_heal(CHAR_DATA *ch, char *argument) -{ - CHAR_DATA *mob; - char arg[MAX_INPUT_LENGTH]; - int cost,sn; - SPELL_FUN *spell; - char *words; - - /* check for healer */ - for ( mob = ch->in_room->people; mob; mob = mob->next_in_room ) - { - if ( IS_NPC(mob) && IS_SET(mob->act, ACT_IS_HEALER) ) - break; - } - - if ( mob == NULL ) - { - send_to_char( "You can't do that here.\n\r", ch ); - return; - } - - one_argument(argument,arg); - - if (arg[0] == '\0') - { - /* display price list */ - act("$N says 'I offer the following spells:'",ch,NULL,mob,TO_CHAR); - send_to_char(" light: cure light wounds 10 gold\n\r",ch); - send_to_char(" serious: cure serious wounds 15 gold\n\r",ch); - send_to_char(" critic: cure critical wounds 25 gold\n\r",ch); - send_to_char(" heal: healing spell 50 gold\n\r",ch); - send_to_char(" blind: cure blindness 20 gold\n\r",ch); - send_to_char(" disease: cure disease 15 gold\n\r",ch); - send_to_char(" poison: cure poison 25 gold\n\r",ch); - send_to_char(" uncurse: remove curse 50 gold\n\r",ch); - send_to_char(" refresh: restore movement 5 gold\n\r",ch); - send_to_char(" mana: restore mana 10 gold\n\r",ch); - send_to_char(" Type heal to be healed.\n\r",ch); - return; - } - - if (!str_prefix(arg,"light")) - { - spell = spell_cure_light; - sn = skill_lookup("cure light"); - words = "judicandus dies"; - cost = 1000; - } - - else if (!str_prefix(arg,"serious")) - { - spell = spell_cure_serious; - sn = skill_lookup("cure serious"); - words = "judicandus gzfuajg"; - cost = 1600; - } - - else if (!str_prefix(arg,"critical")) - { - spell = spell_cure_critical; - sn = skill_lookup("cure critical"); - words = "judicandus qfuhuqar"; - cost = 2500; - } - - else if (!str_prefix(arg,"heal")) - { - spell = spell_heal; - sn = skill_lookup("heal"); - words = "pzar"; - cost = 5000; - } - - else if (!str_prefix(arg,"blindness")) - { - spell = spell_cure_blindness; - sn = skill_lookup("cure blindness"); - words = "judicandus noselacri"; - cost = 2000; - } - - else if (!str_prefix(arg,"disease")) - { - spell = spell_cure_disease; - sn = skill_lookup("cure disease"); - words = "judicandus eugzagz"; - cost = 1500; - } - - else if (!str_prefix(arg,"poison")) - { - spell = spell_cure_poison; - sn = skill_lookup("cure poison"); - words = "judicandus sausabru"; - cost = 2500; - } - - else if (!str_prefix(arg,"uncurse") || !str_prefix(arg,"curse")) - { - spell = spell_remove_curse; - sn = skill_lookup("remove curse"); - words = "candussido judifgz"; - cost = 5000; - } - - else if (!str_prefix(arg,"mana") || !str_prefix(arg,"energize")) - { - spell = NULL; - sn = -1; - words = "energizer"; - cost = 1000; - } - - - else if (!str_prefix(arg,"refresh") || !str_prefix(arg,"moves")) - { - spell = spell_refresh; - sn = skill_lookup("refresh"); - words = "candusima"; - cost = 500; - } - - else - { - act("$N says 'Type 'heal' for a list of spells.'", - ch,NULL,mob,TO_CHAR); - return; - } - - if (cost > (ch->gold * 100 + ch->silver)) - { - act("$N says 'You do not have enough gold for my services.'", - ch,NULL,mob,TO_CHAR); - return; - } - - WAIT_STATE(ch,PULSE_VIOLENCE); - - deduct_cost(ch,cost); - mob->gold += cost / 100; - mob->silver += cost % 100; - act("$n utters the words '$T'.",mob,NULL,words,TO_ROOM); - - if (spell == NULL) /* restore mana trap...kinda hackish */ - { - ch->mana += dice(2,8) + mob->level / 3; - ch->mana = UMIN(ch->mana,ch->max_mana); - send_to_char("A warm glow passes through you.\n\r",ch); - return; - } - - if (sn == -1) - return; - - spell(sn,mob->level,mob,ch,TARGET_CHAR); -} diff --git a/Rom24/src/interp.c b/Rom24/src/interp.c deleted file mode 100644 index 61b295c..0000000 --- a/Rom24/src/interp.c +++ /dev/null @@ -1,796 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#endif -#include -#include -#include -#include -#include -#include "merc.h" -#include "interp.h" - - -bool check_social args( ( CHAR_DATA *ch, char *command, - char *argument ) ); - -/* - * Command logging types. - */ -#define LOG_NORMAL 0 -#define LOG_ALWAYS 1 -#define LOG_NEVER 2 - - - -/* - * Log-all switch. - */ -bool fLogAll = FALSE; - - - -/* - * Command table. - */ -const struct cmd_type cmd_table [] = -{ - /* - * Common movement commands. - */ - { "north", do_north, POS_STANDING, 0, LOG_NEVER, 0 }, - { "east", do_east, POS_STANDING, 0, LOG_NEVER, 0 }, - { "south", do_south, POS_STANDING, 0, LOG_NEVER, 0 }, - { "west", do_west, POS_STANDING, 0, LOG_NEVER, 0 }, - { "up", do_up, POS_STANDING, 0, LOG_NEVER, 0 }, - { "down", do_down, POS_STANDING, 0, LOG_NEVER, 0 }, - - /* - * Common other commands. - * Placed here so one and two letter abbreviations work. - */ - { "at", do_at, POS_DEAD, L6, LOG_NORMAL, 1 }, - { "cast", do_cast, POS_FIGHTING, 0, LOG_NORMAL, 1 }, - { "auction", do_auction, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "buy", do_buy, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "channels", do_channels, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "exits", do_exits, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "get", do_get, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "goto", do_goto, POS_DEAD, L8, LOG_NORMAL, 1 }, - { "group", do_group, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "guild", do_guild, POS_DEAD, L4, LOG_ALWAYS, 1 }, - { "hit", do_kill, POS_FIGHTING, 0, LOG_NORMAL, 0 }, - { "inventory", do_inventory, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "kill", do_kill, POS_FIGHTING, 0, LOG_NORMAL, 1 }, - { "look", do_look, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "clan", do_clantalk, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "music", do_music, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "order", do_order, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "practice", do_practice, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "rest", do_rest, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "sit", do_sit, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "sockets", do_sockets, POS_DEAD, L4, LOG_NORMAL, 1 }, - { "stand", do_stand, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "tell", do_tell, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "unlock", do_unlock, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "wield", do_wear, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "wizhelp", do_wizhelp, POS_DEAD, IM, LOG_NORMAL, 1 }, - - /* - * Informational commands. - */ - { "affects", do_affects, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "areas", do_areas, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "bug", do_bug, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "changes", do_changes, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "commands", do_commands, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "compare", do_compare, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "consider", do_consider, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "count", do_count, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "credits", do_credits, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "equipment", do_equipment, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "examine", do_examine, POS_RESTING, 0, LOG_NORMAL, 1 }, -/* { "groups", do_groups, POS_SLEEPING, 0, LOG_NORMAL, 1 }, */ - { "help", do_help, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "idea", do_idea, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "info", do_groups, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "motd", do_motd, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "news", do_news, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "read", do_read, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "report", do_report, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "rules", do_rules, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "score", do_score, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "skills", do_skills, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "socials", do_socials, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "show", do_show, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "spells", do_spells, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "story", do_story, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "time", do_time, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "typo", do_typo, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "weather", do_weather, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "who", do_who, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "whois", do_whois, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "wizlist", do_wizlist, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "worth", do_worth, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - - /* - * Configuration commands. - */ - { "alia", do_alia, POS_DEAD, 0, LOG_NORMAL, 0 }, - { "alias", do_alias, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "autolist", do_autolist, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "autoassist", do_autoassist, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "autoexit", do_autoexit, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "autogold", do_autogold, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "autoloot", do_autoloot, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "autosac", do_autosac, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "autosplit", do_autosplit, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "brief", do_brief, POS_DEAD, 0, LOG_NORMAL, 1 }, -/* { "channels", do_channels, POS_DEAD, 0, LOG_NORMAL, 1 }, */ - { "combine", do_combine, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "compact", do_compact, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "description", do_description, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "delet", do_delet, POS_DEAD, 0, LOG_ALWAYS, 0 }, - { "delete", do_delete, POS_STANDING, 0, LOG_ALWAYS, 1 }, - { "nofollow", do_nofollow, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "noloot", do_noloot, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "nosummon", do_nosummon, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "outfit", do_outfit, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "password", do_password, POS_DEAD, 0, LOG_NEVER, 1 }, - { "prompt", do_prompt, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "scroll", do_scroll, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "title", do_title, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "unalias", do_unalias, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "wimpy", do_wimpy, POS_DEAD, 0, LOG_NORMAL, 1 }, - - /* - * Communication commands. - */ - { "afk", do_afk, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "answer", do_answer, POS_SLEEPING, 0, LOG_NORMAL, 1 }, -/* { "auction", do_auction, POS_SLEEPING, 0, LOG_NORMAL, 1 }, */ - { "deaf", do_deaf, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "emote", do_emote, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "pmote", do_pmote, POS_RESTING, 0, LOG_NORMAL, 1 }, - { ".", do_gossip, POS_SLEEPING, 0, LOG_NORMAL, 0 }, - { "gossip", do_gossip, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { ",", do_emote, POS_RESTING, 0, LOG_NORMAL, 0 }, - { "grats", do_grats, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "gtell", do_gtell, POS_DEAD, 0, LOG_NORMAL, 1 }, - { ";", do_gtell, POS_DEAD, 0, LOG_NORMAL, 0 }, -/* { "music", do_music, POS_SLEEPING, 0, LOG_NORMAL, 1 }, */ - { "note", do_note, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "pose", do_pose, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "question", do_question, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "quote", do_quote, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "quiet", do_quiet, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "reply", do_reply, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "replay", do_replay, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "say", do_say, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "'", do_say, POS_RESTING, 0, LOG_NORMAL, 0 }, - { "shout", do_shout, POS_RESTING, 3, LOG_NORMAL, 1 }, - { "unread", do_unread, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "yell", do_yell, POS_RESTING, 0, LOG_NORMAL, 1 }, - - /* - * Object manipulation commands. - */ - { "brandish", do_brandish, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "close", do_close, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "drink", do_drink, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "drop", do_drop, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "eat", do_eat, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "envenom", do_envenom, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "fill", do_fill, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "give", do_give, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "heal", do_heal, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "hold", do_wear, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "list", do_list, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "lock", do_lock, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "open", do_open, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "pick", do_pick, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "pour", do_pour, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "put", do_put, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "quaff", do_quaff, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "recite", do_recite, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "remove", do_remove, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "sell", do_sell, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "take", do_get, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "sacrifice", do_sacrifice, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "junk", do_sacrifice, POS_RESTING, 0, LOG_NORMAL, 0 }, - { "tap", do_sacrifice, POS_RESTING, 0, LOG_NORMAL, 0 }, -/* { "unlock", do_unlock, POS_RESTING, 0, LOG_NORMAL, 1 }, */ - { "value", do_value, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "wear", do_wear, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "zap", do_zap, POS_RESTING, 0, LOG_NORMAL, 1 }, - - /* - * Combat commands. - */ - { "backstab", do_backstab, POS_FIGHTING, 0, LOG_NORMAL, 1 }, - { "bash", do_bash, POS_FIGHTING, 0, LOG_NORMAL, 1 }, - { "bs", do_backstab, POS_FIGHTING, 0, LOG_NORMAL, 0 }, - { "berserk", do_berserk, POS_FIGHTING, 0, LOG_NORMAL, 1 }, - { "dirt", do_dirt, POS_FIGHTING, 0, LOG_NORMAL, 1 }, - { "disarm", do_disarm, POS_FIGHTING, 0, LOG_NORMAL, 1 }, - { "flee", do_flee, POS_FIGHTING, 0, LOG_NORMAL, 1 }, - { "kick", do_kick, POS_FIGHTING, 0, LOG_NORMAL, 1 }, - { "murde", do_murde, POS_FIGHTING, 0, LOG_NORMAL, 0 }, - { "murder", do_murder, POS_FIGHTING, 5, LOG_ALWAYS, 1 }, - { "rescue", do_rescue, POS_FIGHTING, 0, LOG_NORMAL, 0 }, - { "trip", do_trip, POS_FIGHTING, 0, LOG_NORMAL, 1 }, - - /* - * Miscellaneous commands. - */ - { "enter", do_enter, POS_STANDING, 0, LOG_NORMAL, 1 }, - { "follow", do_follow, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "gain", do_gain, POS_STANDING, 0, LOG_NORMAL, 1 }, - { "go", do_enter, POS_STANDING, 0, LOG_NORMAL, 0 }, -/* { "group", do_group, POS_SLEEPING, 0, LOG_NORMAL, 1 }, */ - { "groups", do_groups, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "hide", do_hide, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "play", do_play, POS_RESTING, 0, LOG_NORMAL, 1 }, -/* { "practice", do_practice, POS_SLEEPING, 0, LOG_NORMAL, 1 }, */ - { "qui", do_qui, POS_DEAD, 0, LOG_NORMAL, 0 }, - { "quit", do_quit, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "recall", do_recall, POS_FIGHTING, 0, LOG_NORMAL, 1 }, - { "/", do_recall, POS_FIGHTING, 0, LOG_NORMAL, 0 }, - { "rent", do_rent, POS_DEAD, 0, LOG_NORMAL, 0 }, - { "save", do_save, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "sleep", do_sleep, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "sneak", do_sneak, POS_STANDING, 0, LOG_NORMAL, 1 }, - { "split", do_split, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "steal", do_steal, POS_STANDING, 0, LOG_NORMAL, 1 }, - { "train", do_train, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "visible", do_visible, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "wake", do_wake, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "where", do_where, POS_RESTING, 0, LOG_NORMAL, 1 }, - - - - /* - * Immortal commands. - */ - { "advance", do_advance, POS_DEAD, ML, LOG_ALWAYS, 1 }, - { "dump", do_dump, POS_DEAD, ML, LOG_ALWAYS, 0 }, - { "trust", do_trust, POS_DEAD, ML, LOG_ALWAYS, 1 }, - { "violate", do_violate, POS_DEAD, ML, LOG_ALWAYS, 1 }, - - { "allow", do_allow, POS_DEAD, L2, LOG_ALWAYS, 1 }, - { "ban", do_ban, POS_DEAD, L2, LOG_ALWAYS, 1 }, - { "deny", do_deny, POS_DEAD, L1, LOG_ALWAYS, 1 }, - { "disconnect", do_disconnect, POS_DEAD, L3, LOG_ALWAYS, 1 }, - { "flag", do_flag, POS_DEAD, L4, LOG_ALWAYS, 1 }, - { "freeze", do_freeze, POS_DEAD, L4, LOG_ALWAYS, 1 }, - { "permban", do_permban, POS_DEAD, L1, LOG_ALWAYS, 1 }, - { "protect", do_protect, POS_DEAD, L1, LOG_ALWAYS, 1 }, - { "reboo", do_reboo, POS_DEAD, L1, LOG_NORMAL, 0 }, - { "reboot", do_reboot, POS_DEAD, L1, LOG_ALWAYS, 1 }, - { "set", do_set, POS_DEAD, L2, LOG_ALWAYS, 1 }, - { "shutdow", do_shutdow, POS_DEAD, L1, LOG_NORMAL, 0 }, - { "shutdown", do_shutdown, POS_DEAD, L1, LOG_ALWAYS, 1 }, -/* { "sockets", do_sockets, POS_DEAD, L4, LOG_NORMAL, 1 }, */ - { "wizlock", do_wizlock, POS_DEAD, L2, LOG_ALWAYS, 1 }, - - { "force", do_force, POS_DEAD, L7, LOG_ALWAYS, 1 }, - { "load", do_load, POS_DEAD, L4, LOG_ALWAYS, 1 }, - { "newlock", do_newlock, POS_DEAD, L4, LOG_ALWAYS, 1 }, - { "nochannels", do_nochannels, POS_DEAD, L5, LOG_ALWAYS, 1 }, - { "noemote", do_noemote, POS_DEAD, L5, LOG_ALWAYS, 1 }, - { "noshout", do_noshout, POS_DEAD, L5, LOG_ALWAYS, 1 }, - { "notell", do_notell, POS_DEAD, L5, LOG_ALWAYS, 1 }, - { "pecho", do_pecho, POS_DEAD, L4, LOG_ALWAYS, 1 }, - { "pardon", do_pardon, POS_DEAD, L3, LOG_ALWAYS, 1 }, - { "purge", do_purge, POS_DEAD, L4, LOG_ALWAYS, 1 }, - { "restore", do_restore, POS_DEAD, L4, LOG_ALWAYS, 1 }, - { "sla", do_sla, POS_DEAD, L3, LOG_NORMAL, 0 }, - { "slay", do_slay, POS_DEAD, L3, LOG_ALWAYS, 1 }, - { "teleport", do_transfer, POS_DEAD, L5, LOG_ALWAYS, 1 }, - { "transfer", do_transfer, POS_DEAD, L5, LOG_ALWAYS, 1 }, - -/* { "at", do_at, POS_DEAD, L6, LOG_NORMAL, 1 }, */ - { "poofin", do_bamfin, POS_DEAD, L8, LOG_NORMAL, 1 }, - { "poofout", do_bamfout, POS_DEAD, L8, LOG_NORMAL, 1 }, - { "gecho", do_echo, POS_DEAD, L4, LOG_ALWAYS, 1 }, -/* { "goto", do_goto, POS_DEAD, L8, LOG_NORMAL, 1 }, */ - { "holylight", do_holylight, POS_DEAD, IM, LOG_NORMAL, 1 }, - { "incognito", do_incognito, POS_DEAD, IM, LOG_NORMAL, 1 }, - { "invis", do_invis, POS_DEAD, IM, LOG_NORMAL, 0 }, - { "log", do_log, POS_DEAD, L1, LOG_ALWAYS, 1 }, - { "memory", do_memory, POS_DEAD, IM, LOG_NORMAL, 1 }, - { "mwhere", do_mwhere, POS_DEAD, IM, LOG_NORMAL, 1 }, - { "owhere", do_owhere, POS_DEAD, IM, LOG_NORMAL, 1 }, - { "peace", do_peace, POS_DEAD, L5, LOG_NORMAL, 1 }, - { "penalty", do_penalty, POS_DEAD, L7, LOG_NORMAL, 1 }, - { "echo", do_recho, POS_DEAD, L6, LOG_ALWAYS, 1 }, - { "return", do_return, POS_DEAD, L6, LOG_NORMAL, 1 }, - { "snoop", do_snoop, POS_DEAD, L5, LOG_ALWAYS, 1 }, - { "stat", do_stat, POS_DEAD, IM, LOG_NORMAL, 1 }, - { "string", do_string, POS_DEAD, L5, LOG_ALWAYS, 1 }, - { "switch", do_switch, POS_DEAD, L6, LOG_ALWAYS, 1 }, - { "wizinvis", do_invis, POS_DEAD, IM, LOG_NORMAL, 1 }, - { "vnum", do_vnum, POS_DEAD, L4, LOG_NORMAL, 1 }, - { "zecho", do_zecho, POS_DEAD, L4, LOG_ALWAYS, 1 }, - - { "clone", do_clone, POS_DEAD, L5, LOG_ALWAYS, 1 }, - - { "wiznet", do_wiznet, POS_DEAD, IM, LOG_NORMAL, 1 }, - { "immtalk", do_immtalk, POS_DEAD, IM, LOG_NORMAL, 1 }, - { "imotd", do_imotd, POS_DEAD, IM, LOG_NORMAL, 1 }, - { ":", do_immtalk, POS_DEAD, IM, LOG_NORMAL, 0 }, - { "smote", do_smote, POS_DEAD, IM, LOG_NORMAL, 1 }, - { "prefi", do_prefi, POS_DEAD, IM, LOG_NORMAL, 0 }, - { "prefix", do_prefix, POS_DEAD, IM, LOG_NORMAL, 1 }, - - /* - * End of list. - */ - { "", 0, POS_DEAD, 0, LOG_NORMAL, 0 } -}; - - - - -/* - * The main entry point for executing commands. - * Can be recursively called from 'at', 'order', 'force'. - */ -void interpret( CHAR_DATA *ch, char *argument ) -{ - char command[MAX_INPUT_LENGTH]; - char logline[MAX_INPUT_LENGTH]; - int cmd; - int trust; - bool found; - - /* - * Strip leading spaces. - */ - while ( isspace(*argument) ) - argument++; - if ( argument[0] == '\0' ) - return; - - /* - * No hiding. - */ - REMOVE_BIT( ch->affected_by, AFF_HIDE ); - - /* - * Implement freeze command. - */ - if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_FREEZE) ) - { - send_to_char( "You're totally frozen!\n\r", ch ); - return; - } - - /* - * Grab the command word. - * Special parsing so ' can be a command, - * also no spaces needed after punctuation. - */ - strcpy( logline, argument ); - if ( !isalpha(argument[0]) && !isdigit(argument[0]) ) - { - command[0] = argument[0]; - command[1] = '\0'; - argument++; - while ( isspace(*argument) ) - argument++; - } - else - { - argument = one_argument( argument, command ); - } - - /* - * Look for command in command table. - */ - found = FALSE; - trust = get_trust( ch ); - for ( cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++ ) - { - if ( command[0] == cmd_table[cmd].name[0] - && !str_prefix( command, cmd_table[cmd].name ) - && cmd_table[cmd].level <= trust ) - { - found = TRUE; - break; - } - } - - /* - * Log and snoop. - */ - if ( cmd_table[cmd].log == LOG_NEVER ) - strcpy( logline, "" ); - - if ( ( !IS_NPC(ch) && IS_SET(ch->act, PLR_LOG) ) - || fLogAll - || cmd_table[cmd].log == LOG_ALWAYS ) - { - sprintf( log_buf, "Log %s: %s", ch->name, logline ); - wiznet(log_buf,ch,NULL,WIZ_SECURE,0,get_trust(ch)); - log_string( log_buf ); - } - - if ( ch->desc != NULL && ch->desc->snoop_by != NULL ) - { - write_to_buffer( ch->desc->snoop_by, "% ", 2 ); - write_to_buffer( ch->desc->snoop_by, logline, 0 ); - write_to_buffer( ch->desc->snoop_by, "\n\r", 2 ); - } - - if ( !found ) - { - /* - * Look for command in socials table. - */ - if ( !check_social( ch, command, argument ) ) - send_to_char( "Huh?\n\r", ch ); - return; - } - - /* - * Character not in position for command? - */ - if ( ch->position < cmd_table[cmd].position ) - { - switch( ch->position ) - { - case POS_DEAD: - send_to_char( "Lie still; you are DEAD.\n\r", ch ); - break; - - case POS_MORTAL: - case POS_INCAP: - send_to_char( "You are hurt far too bad for that.\n\r", ch ); - break; - - case POS_STUNNED: - send_to_char( "You are too stunned to do that.\n\r", ch ); - break; - - case POS_SLEEPING: - send_to_char( "In your dreams, or what?\n\r", ch ); - break; - - case POS_RESTING: - send_to_char( "Nah... You feel too relaxed...\n\r", ch); - break; - - case POS_SITTING: - send_to_char( "Better stand up first.\n\r",ch); - break; - - case POS_FIGHTING: - send_to_char( "No way! You are still fighting!\n\r", ch); - break; - - } - return; - } - - /* - * Dispatch the command. - */ - (*cmd_table[cmd].do_fun) ( ch, argument ); - - tail_chain( ); - return; -} - -/* function to keep argument safe in all commands -- no static strings */ -void do_function (CHAR_DATA *ch, DO_FUN *do_fun, char *argument) -{ - char *command_string; - - /* copy the string */ - command_string = str_dup(argument); - - /* dispatch the command */ - (*do_fun) (ch, command_string); - - /* free the string */ - free_string(command_string); -} - -bool check_social( CHAR_DATA *ch, char *command, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - int cmd; - bool found; - - found = FALSE; - for ( cmd = 0; social_table[cmd].name[0] != '\0'; cmd++ ) - { - if ( command[0] == social_table[cmd].name[0] - && !str_prefix( command, social_table[cmd].name ) ) - { - found = TRUE; - break; - } - } - - if ( !found ) - return FALSE; - - if ( !IS_NPC(ch) && IS_SET(ch->comm, COMM_NOEMOTE) ) - { - send_to_char( "You are anti-social!\n\r", ch ); - return TRUE; - } - - switch ( ch->position ) - { - case POS_DEAD: - send_to_char( "Lie still; you are DEAD.\n\r", ch ); - return TRUE; - - case POS_INCAP: - case POS_MORTAL: - send_to_char( "You are hurt far too bad for that.\n\r", ch ); - return TRUE; - - case POS_STUNNED: - send_to_char( "You are too stunned to do that.\n\r", ch ); - return TRUE; - - case POS_SLEEPING: - /* - * I just know this is the path to a 12" 'if' statement. :( - * But two players asked for it already! -- Furey - */ - if ( !str_cmp( social_table[cmd].name, "snore" ) ) - break; - send_to_char( "In your dreams, or what?\n\r", ch ); - return TRUE; - - } - - one_argument( argument, arg ); - victim = NULL; - if ( arg[0] == '\0' ) - { - act( social_table[cmd].others_no_arg, ch, NULL, victim, TO_ROOM ); - act( social_table[cmd].char_no_arg, ch, NULL, victim, TO_CHAR ); - } - else if ( ( victim = get_char_room( ch, arg ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - } - else if ( victim == ch ) - { - act( social_table[cmd].others_auto, ch, NULL, victim, TO_ROOM ); - act( social_table[cmd].char_auto, ch, NULL, victim, TO_CHAR ); - } - else - { - act( social_table[cmd].others_found, ch, NULL, victim, TO_NOTVICT ); - act( social_table[cmd].char_found, ch, NULL, victim, TO_CHAR ); - act( social_table[cmd].vict_found, ch, NULL, victim, TO_VICT ); - - if ( !IS_NPC(ch) && IS_NPC(victim) - && !IS_AFFECTED(victim, AFF_CHARM) - && IS_AWAKE(victim) - && victim->desc == NULL) - { - switch ( number_bits( 4 ) ) - { - case 0: - - case 1: case 2: case 3: case 4: - case 5: case 6: case 7: case 8: - act( social_table[cmd].others_found, - victim, NULL, ch, TO_NOTVICT ); - act( social_table[cmd].char_found, - victim, NULL, ch, TO_CHAR ); - act( social_table[cmd].vict_found, - victim, NULL, ch, TO_VICT ); - break; - - case 9: case 10: case 11: case 12: - act( "$n slaps $N.", victim, NULL, ch, TO_NOTVICT ); - act( "You slap $N.", victim, NULL, ch, TO_CHAR ); - act( "$n slaps you.", victim, NULL, ch, TO_VICT ); - break; - } - } - } - - return TRUE; -} - - - -/* - * Return true if an argument is completely numeric. - */ -bool is_number ( char *arg ) -{ - - if ( *arg == '\0' ) - return FALSE; - - if ( *arg == '+' || *arg == '-' ) - arg++; - - for ( ; *arg != '\0'; arg++ ) - { - if ( !isdigit( *arg ) ) - return FALSE; - } - - return TRUE; -} - - - -/* - * Given a string like 14.foo, return 14 and 'foo' - */ -int number_argument( char *argument, char *arg ) -{ - char *pdot; - int number; - - for ( pdot = argument; *pdot != '\0'; pdot++ ) - { - if ( *pdot == '.' ) - { - *pdot = '\0'; - number = atoi( argument ); - *pdot = '.'; - strcpy( arg, pdot+1 ); - return number; - } - } - - strcpy( arg, argument ); - return 1; -} - -/* - * Given a string like 14*foo, return 14 and 'foo' -*/ -int mult_argument(char *argument, char *arg) -{ - char *pdot; - int number; - - for ( pdot = argument; *pdot != '\0'; pdot++ ) - { - if ( *pdot == '*' ) - { - *pdot = '\0'; - number = atoi( argument ); - *pdot = '*'; - strcpy( arg, pdot+1 ); - return number; - } - } - - strcpy( arg, argument ); - return 1; -} - - - -/* - * Pick off one argument from a string and return the rest. - * Understands quotes. - */ -char *one_argument( char *argument, char *arg_first ) -{ - char cEnd; - - while ( isspace(*argument) ) - argument++; - - cEnd = ' '; - if ( *argument == '\'' || *argument == '"' ) - cEnd = *argument++; - - while ( *argument != '\0' ) - { - if ( *argument == cEnd ) - { - argument++; - break; - } - *arg_first = LOWER(*argument); - arg_first++; - argument++; - } - *arg_first = '\0'; - - while ( isspace(*argument) ) - argument++; - - return argument; -} - -/* - * Contributed by Alander. - */ -void do_commands( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - int cmd; - int col; - - col = 0; - for ( cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++ ) - { - if ( cmd_table[cmd].level < LEVEL_HERO - && cmd_table[cmd].level <= get_trust( ch ) - && cmd_table[cmd].show) - { - sprintf( buf, "%-12s", cmd_table[cmd].name ); - send_to_char( buf, ch ); - if ( ++col % 6 == 0 ) - send_to_char( "\n\r", ch ); - } - } - - if ( col % 6 != 0 ) - send_to_char( "\n\r", ch ); - return; -} - -void do_wizhelp( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - int cmd; - int col; - - col = 0; - for ( cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++ ) - { - if ( cmd_table[cmd].level >= LEVEL_HERO - && cmd_table[cmd].level <= get_trust( ch ) - && cmd_table[cmd].show) - { - sprintf( buf, "%-12s", cmd_table[cmd].name ); - send_to_char( buf, ch ); - if ( ++col % 6 == 0 ) - send_to_char( "\n\r", ch ); - } - } - - if ( col % 6 != 0 ) - send_to_char( "\n\r", ch ); - return; -} - diff --git a/Rom24/src/interp.h b/Rom24/src/interp.h deleted file mode 100644 index f731669..0000000 --- a/Rom24/src/interp.h +++ /dev/null @@ -1,298 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -/* this is a listing of all the commands and command related data */ - -/* wrapper function for safe command execution */ -void do_function args((CHAR_DATA *ch, DO_FUN *do_fun, char *argument)); - -/* for command types */ -#define ML MAX_LEVEL /* implementor */ -#define L1 MAX_LEVEL - 1 /* creator */ -#define L2 MAX_LEVEL - 2 /* supreme being */ -#define L3 MAX_LEVEL - 3 /* deity */ -#define L4 MAX_LEVEL - 4 /* god */ -#define L5 MAX_LEVEL - 5 /* immortal */ -#define L6 MAX_LEVEL - 6 /* demigod */ -#define L7 MAX_LEVEL - 7 /* angel */ -#define L8 MAX_LEVEL - 8 /* avatar */ -#define IM LEVEL_IMMORTAL /* avatar */ -#define HE LEVEL_HERO /* hero */ - -#define COM_INGORE 1 - - -/* - * Structure for a command in the command lookup table. - */ -struct cmd_type -{ - char * const name; - DO_FUN * do_fun; - sh_int position; - sh_int level; - sh_int log; - sh_int show; -}; - -/* the command table itself */ -extern const struct cmd_type cmd_table []; - -/* - * Command functions. - * Defined in act_*.c (mostly). - */ -DECLARE_DO_FUN( do_advance ); -DECLARE_DO_FUN( do_affects ); -DECLARE_DO_FUN( do_afk ); -DECLARE_DO_FUN( do_alia ); -DECLARE_DO_FUN( do_alias ); -DECLARE_DO_FUN( do_allow ); -DECLARE_DO_FUN( do_answer ); -DECLARE_DO_FUN( do_areas ); -DECLARE_DO_FUN( do_at ); -DECLARE_DO_FUN( do_auction ); -DECLARE_DO_FUN( do_autoassist ); -DECLARE_DO_FUN( do_autoexit ); -DECLARE_DO_FUN( do_autogold ); -DECLARE_DO_FUN( do_autolist ); -DECLARE_DO_FUN( do_autoloot ); -DECLARE_DO_FUN( do_autosac ); -DECLARE_DO_FUN( do_autosplit ); -DECLARE_DO_FUN( do_backstab ); -DECLARE_DO_FUN( do_bamfin ); -DECLARE_DO_FUN( do_bamfout ); -DECLARE_DO_FUN( do_ban ); -DECLARE_DO_FUN( do_bash ); -DECLARE_DO_FUN( do_berserk ); -DECLARE_DO_FUN( do_brandish ); -DECLARE_DO_FUN( do_brief ); -DECLARE_DO_FUN( do_bug ); -DECLARE_DO_FUN( do_buy ); -DECLARE_DO_FUN( do_cast ); -DECLARE_DO_FUN( do_changes ); -DECLARE_DO_FUN( do_channels ); -DECLARE_DO_FUN( do_clone ); -DECLARE_DO_FUN( do_close ); -DECLARE_DO_FUN( do_commands ); -DECLARE_DO_FUN( do_combine ); -DECLARE_DO_FUN( do_compact ); -DECLARE_DO_FUN( do_compare ); -DECLARE_DO_FUN( do_consider ); -DECLARE_DO_FUN( do_count ); -DECLARE_DO_FUN( do_credits ); -DECLARE_DO_FUN( do_deaf ); -DECLARE_DO_FUN( do_delet ); -DECLARE_DO_FUN( do_delete ); -DECLARE_DO_FUN( do_deny ); -DECLARE_DO_FUN( do_description ); -DECLARE_DO_FUN( do_dirt ); -DECLARE_DO_FUN( do_disarm ); -DECLARE_DO_FUN( do_disconnect ); -DECLARE_DO_FUN( do_down ); -DECLARE_DO_FUN( do_drink ); -DECLARE_DO_FUN( do_drop ); -DECLARE_DO_FUN( do_dump ); -DECLARE_DO_FUN( do_east ); -DECLARE_DO_FUN( do_eat ); -DECLARE_DO_FUN( do_echo ); -DECLARE_DO_FUN( do_emote ); -DECLARE_DO_FUN( do_enter ); -DECLARE_DO_FUN( do_envenom ); -DECLARE_DO_FUN( do_equipment ); -DECLARE_DO_FUN( do_examine ); -DECLARE_DO_FUN( do_exits ); -DECLARE_DO_FUN( do_fill ); -DECLARE_DO_FUN( do_flag ); -DECLARE_DO_FUN( do_flee ); -DECLARE_DO_FUN( do_follow ); -DECLARE_DO_FUN( do_force ); -DECLARE_DO_FUN( do_freeze ); -DECLARE_DO_FUN( do_gain ); -DECLARE_DO_FUN( do_get ); -DECLARE_DO_FUN( do_give ); -DECLARE_DO_FUN( do_gossip ); -DECLARE_DO_FUN( do_goto ); -DECLARE_DO_FUN( do_grats ); -DECLARE_DO_FUN( do_group ); -DECLARE_DO_FUN( do_groups ); -DECLARE_DO_FUN( do_gtell ); -DECLARE_DO_FUN( do_guild ); -DECLARE_DO_FUN( do_heal ); -DECLARE_DO_FUN( do_help ); -DECLARE_DO_FUN( do_hide ); -DECLARE_DO_FUN( do_holylight ); -DECLARE_DO_FUN( do_idea ); -DECLARE_DO_FUN( do_immtalk ); -DECLARE_DO_FUN( do_incognito ); -DECLARE_DO_FUN( do_clantalk ); -DECLARE_DO_FUN( do_imotd ); -DECLARE_DO_FUN( do_inventory ); -DECLARE_DO_FUN( do_invis ); -DECLARE_DO_FUN( do_kick ); -DECLARE_DO_FUN( do_kill ); -DECLARE_DO_FUN( do_list ); -DECLARE_DO_FUN( do_load ); -DECLARE_DO_FUN( do_lock ); -DECLARE_DO_FUN( do_log ); -DECLARE_DO_FUN( do_look ); -DECLARE_DO_FUN( do_memory ); -DECLARE_DO_FUN( do_mfind ); -DECLARE_DO_FUN( do_mload ); -DECLARE_DO_FUN( do_mset ); -DECLARE_DO_FUN( do_mstat ); -DECLARE_DO_FUN( do_mwhere ); -DECLARE_DO_FUN( do_motd ); -DECLARE_DO_FUN( do_murde ); -DECLARE_DO_FUN( do_murder ); -DECLARE_DO_FUN( do_music ); -DECLARE_DO_FUN( do_newlock ); -DECLARE_DO_FUN( do_news ); -DECLARE_DO_FUN( do_nochannels ); -DECLARE_DO_FUN( do_noemote ); -DECLARE_DO_FUN( do_nofollow ); -DECLARE_DO_FUN( do_noloot ); -DECLARE_DO_FUN( do_north ); -DECLARE_DO_FUN( do_noshout ); -DECLARE_DO_FUN( do_nosummon ); -DECLARE_DO_FUN( do_note ); -DECLARE_DO_FUN( do_notell ); -DECLARE_DO_FUN( do_ofind ); -DECLARE_DO_FUN( do_oload ); -DECLARE_DO_FUN( do_open ); -DECLARE_DO_FUN( do_order ); -DECLARE_DO_FUN( do_oset ); -DECLARE_DO_FUN( do_ostat ); -DECLARE_DO_FUN( do_outfit ); -DECLARE_DO_FUN( do_owhere ); -DECLARE_DO_FUN( do_pardon ); -DECLARE_DO_FUN( do_password ); -DECLARE_DO_FUN( do_peace ); -DECLARE_DO_FUN( do_pecho ); -DECLARE_DO_FUN( do_penalty ); -DECLARE_DO_FUN( do_permban ); -DECLARE_DO_FUN( do_pick ); -DECLARE_DO_FUN( do_play ); -DECLARE_DO_FUN( do_pmote ); -DECLARE_DO_FUN( do_pose ); -DECLARE_DO_FUN( do_pour ); -DECLARE_DO_FUN( do_practice ); -DECLARE_DO_FUN( do_prefi ); -DECLARE_DO_FUN( do_prefix ); -DECLARE_DO_FUN( do_prompt ); -DECLARE_DO_FUN( do_protect ); -DECLARE_DO_FUN( do_purge ); -DECLARE_DO_FUN( do_put ); -DECLARE_DO_FUN( do_quaff ); -DECLARE_DO_FUN( do_question ); -DECLARE_DO_FUN( do_qui ); -DECLARE_DO_FUN( do_quiet ); -DECLARE_DO_FUN( do_quit ); -DECLARE_DO_FUN( do_quote ); -DECLARE_DO_FUN( do_read ); -DECLARE_DO_FUN( do_reboo ); -DECLARE_DO_FUN( do_reboot ); -DECLARE_DO_FUN( do_recall ); -DECLARE_DO_FUN( do_recho ); -DECLARE_DO_FUN( do_recite ); -DECLARE_DO_FUN( do_remove ); -DECLARE_DO_FUN( do_rent ); -DECLARE_DO_FUN( do_replay ); -DECLARE_DO_FUN( do_reply ); -DECLARE_DO_FUN( do_report ); -DECLARE_DO_FUN( do_rescue ); -DECLARE_DO_FUN( do_rest ); -DECLARE_DO_FUN( do_restore ); -DECLARE_DO_FUN( do_return ); -DECLARE_DO_FUN( do_rset ); -DECLARE_DO_FUN( do_rstat ); -DECLARE_DO_FUN( do_rules ); -DECLARE_DO_FUN( do_sacrifice ); -DECLARE_DO_FUN( do_save ); -DECLARE_DO_FUN( do_say ); -DECLARE_DO_FUN( do_scan ); -DECLARE_DO_FUN( do_score ); -DECLARE_DO_FUN( do_scroll ); -DECLARE_DO_FUN( do_sell ); -DECLARE_DO_FUN( do_set ); -DECLARE_DO_FUN( do_shout ); -DECLARE_DO_FUN( do_show ); -DECLARE_DO_FUN( do_shutdow ); -DECLARE_DO_FUN( do_shutdown ); -DECLARE_DO_FUN( do_sit ); -DECLARE_DO_FUN( do_skills ); -DECLARE_DO_FUN( do_sla ); -DECLARE_DO_FUN( do_slay ); -DECLARE_DO_FUN( do_sleep ); -DECLARE_DO_FUN( do_slookup ); -DECLARE_DO_FUN( do_smote ); -DECLARE_DO_FUN( do_sneak ); -DECLARE_DO_FUN( do_snoop ); -DECLARE_DO_FUN( do_socials ); -DECLARE_DO_FUN( do_south ); -DECLARE_DO_FUN( do_sockets ); -DECLARE_DO_FUN( do_spells ); -DECLARE_DO_FUN( do_split ); -DECLARE_DO_FUN( do_sset ); -DECLARE_DO_FUN( do_stand ); -DECLARE_DO_FUN( do_stat ); -DECLARE_DO_FUN( do_steal ); -DECLARE_DO_FUN( do_story ); -DECLARE_DO_FUN( do_string ); -DECLARE_DO_FUN( do_switch ); -DECLARE_DO_FUN( do_tell ); -DECLARE_DO_FUN( do_time ); -DECLARE_DO_FUN( do_title ); -DECLARE_DO_FUN( do_train ); -DECLARE_DO_FUN( do_transfer ); -DECLARE_DO_FUN( do_trip ); -DECLARE_DO_FUN( do_trust ); -DECLARE_DO_FUN( do_typo ); -DECLARE_DO_FUN( do_unalias ); -DECLARE_DO_FUN( do_unlock ); -DECLARE_DO_FUN( do_unread ); -DECLARE_DO_FUN( do_up ); -DECLARE_DO_FUN( do_value ); -DECLARE_DO_FUN( do_visible ); -DECLARE_DO_FUN( do_violate ); -DECLARE_DO_FUN( do_vnum ); -DECLARE_DO_FUN( do_wake ); -DECLARE_DO_FUN( do_wear ); -DECLARE_DO_FUN( do_weather ); -DECLARE_DO_FUN( do_west ); -DECLARE_DO_FUN( do_where ); -DECLARE_DO_FUN( do_who ); -DECLARE_DO_FUN( do_whois ); -DECLARE_DO_FUN( do_wimpy ); -DECLARE_DO_FUN( do_wizhelp ); -DECLARE_DO_FUN( do_wizlock ); -DECLARE_DO_FUN( do_wizlist ); -DECLARE_DO_FUN( do_wiznet ); -DECLARE_DO_FUN( do_worth ); -DECLARE_DO_FUN( do_yell ); -DECLARE_DO_FUN( do_zap ); -DECLARE_DO_FUN( do_zecho ); diff --git a/Rom24/src/lookup.c b/Rom24/src/lookup.c deleted file mode 100644 index 512b964..0000000 --- a/Rom24/src/lookup.c +++ /dev/null @@ -1,106 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#endif -#include -#include -#include "merc.h" -#include "tables.h" - -int flag_lookup (const char *name, const struct flag_type *flag_table) -{ - int flag; - - for (flag = 0; flag_table[flag].name != NULL; flag++) - { - if (LOWER(name[0]) == LOWER(flag_table[flag].name[0]) - && !str_prefix(name,flag_table[flag].name)) - return flag_table[flag].bit; - } - - return 0; -} - -int clan_lookup(const char *name) -{ - int clan; - - for (clan = 0; clan < MAX_CLAN; clan++) - { - if (LOWER(name[0]) == LOWER(clan_table[clan].name[0]) - && !str_prefix(name,clan_table[clan].name)) - return clan; - } - - return 0; -} - -int position_lookup (const char *name) -{ - int pos; - - for (pos = 0; position_table[pos].name != NULL; pos++) - { - if (LOWER(name[0]) == LOWER(position_table[pos].name[0]) - && !str_prefix(name,position_table[pos].name)) - return pos; - } - - return -1; -} - -int sex_lookup (const char *name) -{ - int sex; - - for (sex = 0; sex_table[sex].name != NULL; sex++) - { - if (LOWER(name[0]) == LOWER(sex_table[sex].name[0]) - && !str_prefix(name,sex_table[sex].name)) - return sex; - } - - return -1; -} - -int size_lookup (const char *name) -{ - int size; - - for ( size = 0; size_table[size].name != NULL; size++) - { - if (LOWER(name[0]) == LOWER(size_table[size].name[0]) - && !str_prefix( name,size_table[size].name)) - return size; - } - - return -1; -} diff --git a/Rom24/src/lookup.h b/Rom24/src/lookup.h deleted file mode 100644 index bf43303..0000000 --- a/Rom24/src/lookup.h +++ /dev/null @@ -1,32 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - - -int clan_lookup args( (const char *name) ); -int position_lookup args( (const char *name) ); -int sex_lookup args( (const char *name) ); -int size_lookup args( (const char *name) ); diff --git a/Rom24/src/magic.c b/Rom24/src/magic.c deleted file mode 100644 index f8bfae6..0000000 --- a/Rom24/src/magic.c +++ /dev/null @@ -1,4699 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#endif -#include -#include -#include -#include -#include "merc.h" -#include "interp.h" -#include "magic.h" -#include "recycle.h" - -/* - * Local functions. - */ -void say_spell args( ( CHAR_DATA *ch, int sn ) ); - -/* imported functions */ -bool remove_obj args( ( CHAR_DATA *ch, int iWear, bool fReplace ) ); -void wear_obj args( ( CHAR_DATA *ch, OBJ_DATA *obj, bool fReplace ) ); - - - -/* - * Lookup a skill by name. - */ -int skill_lookup( const char *name ) -{ - int sn; - - for ( sn = 0; sn < MAX_SKILL; sn++ ) - { - if ( skill_table[sn].name == NULL ) - break; - if ( LOWER(name[0]) == LOWER(skill_table[sn].name[0]) - && !str_prefix( name, skill_table[sn].name ) ) - return sn; - } - - return -1; -} - -int find_spell( CHAR_DATA *ch, const char *name ) -{ - /* finds a spell the character can cast if possible */ - int sn, found = -1; - - if (IS_NPC(ch)) - return skill_lookup(name); - - for ( sn = 0; sn < MAX_SKILL; sn++ ) - { - if (skill_table[sn].name == NULL) - break; - if (LOWER(name[0]) == LOWER(skill_table[sn].name[0]) - && !str_prefix(name,skill_table[sn].name)) - { - if ( found == -1) - found = sn; - if (ch->level >= skill_table[sn].skill_level[ch->class] - && ch->pcdata->learned[sn] > 0) - return sn; - } - } - return found; -} - - - -/* - * Lookup a skill by slot number. - * Used for object loading. - */ -int slot_lookup( int slot ) -{ - extern bool fBootDb; - int sn; - - if ( slot <= 0 ) - return -1; - - for ( sn = 0; sn < MAX_SKILL; sn++ ) - { - if ( slot == skill_table[sn].slot ) - return sn; - } - - if ( fBootDb ) - { - bug( "Slot_lookup: bad slot %d.", slot ); - abort( ); - } - - return -1; -} - - - -/* - * Utter mystical words for an sn. - */ -void say_spell( CHAR_DATA *ch, int sn ) -{ - char buf [MAX_STRING_LENGTH]; - char buf2 [MAX_STRING_LENGTH]; - CHAR_DATA *rch; - char *pName; - int iSyl; - int length; - - struct syl_type - { - char * old; - char * new; - }; - - static const struct syl_type syl_table[] = - { - { " ", " " }, - { "ar", "abra" }, - { "au", "kada" }, - { "bless", "fido" }, - { "blind", "nose" }, - { "bur", "mosa" }, - { "cu", "judi" }, - { "de", "oculo" }, - { "en", "unso" }, - { "light", "dies" }, - { "lo", "hi" }, - { "mor", "zak" }, - { "move", "sido" }, - { "ness", "lacri" }, - { "ning", "illa" }, - { "per", "duda" }, - { "ra", "gru" }, - { "fresh", "ima" }, - { "re", "candus" }, - { "son", "sabru" }, - { "tect", "infra" }, - { "tri", "cula" }, - { "ven", "nofo" }, - { "a", "a" }, { "b", "b" }, { "c", "q" }, { "d", "e" }, - { "e", "z" }, { "f", "y" }, { "g", "o" }, { "h", "p" }, - { "i", "u" }, { "j", "y" }, { "k", "t" }, { "l", "r" }, - { "m", "w" }, { "n", "i" }, { "o", "a" }, { "p", "s" }, - { "q", "d" }, { "r", "f" }, { "s", "g" }, { "t", "h" }, - { "u", "j" }, { "v", "z" }, { "w", "x" }, { "x", "n" }, - { "y", "l" }, { "z", "k" }, - { "", "" } - }; - - buf[0] = '\0'; - for ( pName = skill_table[sn].name; *pName != '\0'; pName += length ) - { - for ( iSyl = 0; (length = strlen(syl_table[iSyl].old)) != 0; iSyl++ ) - { - if ( !str_prefix( syl_table[iSyl].old, pName ) ) - { - strcat( buf, syl_table[iSyl].new ); - break; - } - } - - if ( length == 0 ) - length = 1; - } - - sprintf( buf2, "$n utters the words, '%s'.", buf ); - sprintf( buf, "$n utters the words, '%s'.", skill_table[sn].name ); - - for ( rch = ch->in_room->people; rch; rch = rch->next_in_room ) - { - if ( rch != ch ) - act((!IS_NPC(rch) && ch->class==rch->class) ? buf : buf2, - ch, NULL, rch, TO_VICT ); - } - - return; -} - - - -/* - * Compute a saving throw. - * Negative apply's make saving throw better. - */ -bool saves_spell( int level, CHAR_DATA *victim, int dam_type ) -{ - int save; - - save = 50 + ( victim->level - level) * 5 - victim->saving_throw * 2; - if (IS_AFFECTED(victim,AFF_BERSERK)) - save += victim->level/2; - - switch(check_immune(victim,dam_type)) - { - case IS_IMMUNE: return TRUE; - case IS_RESISTANT: save += 2; break; - case IS_VULNERABLE: save -= 2; break; - } - - if (!IS_NPC(victim) && class_table[victim->class].fMana) - save = 9 * save / 10; - save = URANGE( 5, save, 95 ); - return number_percent( ) < save; -} - -/* RT save for dispels */ - -bool saves_dispel( int dis_level, int spell_level, int duration) -{ - int save; - - if (duration == -1) - spell_level += 5; - /* very hard to dispel permanent effects */ - - save = 50 + (spell_level - dis_level) * 5; - save = URANGE( 5, save, 95 ); - return number_percent( ) < save; -} - -/* co-routine for dispel magic and cancellation */ - -bool check_dispel( int dis_level, CHAR_DATA *victim, int sn) -{ - AFFECT_DATA *af; - - if (is_affected(victim, sn)) - { - for ( af = victim->affected; af != NULL; af = af->next ) - { - if ( af->type == sn ) - { - if (!saves_dispel(dis_level,af->level,af->duration)) - { - affect_strip(victim,sn); - if ( skill_table[sn].msg_off ) - { - send_to_char( skill_table[sn].msg_off, victim ); - send_to_char( "\n\r", victim ); - } - return TRUE; - } - else - af->level--; - } - } - } - return FALSE; -} - -/* for finding mana costs -- temporary version */ -int mana_cost (CHAR_DATA *ch, int min_mana, int level) -{ - if (ch->level + 2 == level) - return 1000; - return UMAX(min_mana,(100/(2 + ch->level - level))); -} - - - -/* - * The kludgy global is for spells who want more stuff from command line. - */ -char *target_name; - -void do_cast( CHAR_DATA *ch, char *argument ) -{ - char arg1[MAX_INPUT_LENGTH]; - char arg2[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - OBJ_DATA *obj; - void *vo; - int mana; - int sn; - int target; - - /* - * Switched NPC's can cast spells, but others can't. - */ - if ( IS_NPC(ch) && ch->desc == NULL) - return; - - target_name = one_argument( argument, arg1 ); - one_argument( target_name, arg2 ); - - if ( arg1[0] == '\0' ) - { - send_to_char( "Cast which what where?\n\r", ch ); - return; - } - - if ((sn = find_spell(ch,arg1)) < 1 - || skill_table[sn].spell_fun == spell_null - || (!IS_NPC(ch) && (ch->level < skill_table[sn].skill_level[ch->class] - || ch->pcdata->learned[sn] == 0))) - { - send_to_char( "You don't know any spells of that name.\n\r", ch ); - return; - } - - if ( ch->position < skill_table[sn].minimum_position ) - { - send_to_char( "You can't concentrate enough.\n\r", ch ); - return; - } - - if (ch->level + 2 == skill_table[sn].skill_level[ch->class]) - mana = 50; - else - mana = UMAX( - skill_table[sn].min_mana, - 100 / ( 2 + ch->level - skill_table[sn].skill_level[ch->class] ) ); - - /* - * Locate targets. - */ - victim = NULL; - obj = NULL; - vo = NULL; - target = TARGET_NONE; - - switch ( skill_table[sn].target ) - { - default: - bug( "Do_cast: bad target for sn %d.", sn ); - return; - - case TAR_IGNORE: - break; - - case TAR_CHAR_OFFENSIVE: - if ( arg2[0] == '\0' ) - { - if ( ( victim = ch->fighting ) == NULL ) - { - send_to_char( "Cast the spell on whom?\n\r", ch ); - return; - } - } - else - { - if ( ( victim = get_char_room( ch, target_name ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - } -/* - if ( ch == victim ) - { - send_to_char( "You can't do that to yourself.\n\r", ch ); - return; - } -*/ - - - if ( !IS_NPC(ch) ) - { - - if (is_safe(ch,victim) && victim != ch) - { - send_to_char("Not on that target.\n\r",ch); - return; - } - check_killer(ch,victim); - } - - if ( IS_AFFECTED(ch, AFF_CHARM) && ch->master == victim ) - { - send_to_char( "You can't do that on your own follower.\n\r", - ch ); - return; - } - - vo = (void *) victim; - target = TARGET_CHAR; - break; - - case TAR_CHAR_DEFENSIVE: - if ( arg2[0] == '\0' ) - { - victim = ch; - } - else - { - if ( ( victim = get_char_room( ch, target_name ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - } - - vo = (void *) victim; - target = TARGET_CHAR; - break; - - case TAR_CHAR_SELF: - if ( arg2[0] != '\0' && !is_name( target_name, ch->name ) ) - { - send_to_char( "You cannot cast this spell on another.\n\r", ch ); - return; - } - - vo = (void *) ch; - target = TARGET_CHAR; - break; - - case TAR_OBJ_INV: - if ( arg2[0] == '\0' ) - { - send_to_char( "What should the spell be cast upon?\n\r", ch ); - return; - } - - if ( ( obj = get_obj_carry( ch, target_name, ch ) ) == NULL ) - { - send_to_char( "You are not carrying that.\n\r", ch ); - return; - } - - vo = (void *) obj; - target = TARGET_OBJ; - break; - - case TAR_OBJ_CHAR_OFF: - if (arg2[0] == '\0') - { - if ((victim = ch->fighting) == NULL) - { - send_to_char("Cast the spell on whom or what?\n\r",ch); - return; - } - - target = TARGET_CHAR; - } - else if ((victim = get_char_room(ch,target_name)) != NULL) - { - target = TARGET_CHAR; - } - - if (target == TARGET_CHAR) /* check the sanity of the attack */ - { - if(is_safe_spell(ch,victim,FALSE) && victim != ch) - { - send_to_char("Not on that target.\n\r",ch); - return; - } - - if ( IS_AFFECTED(ch, AFF_CHARM) && ch->master == victim ) - { - send_to_char( "You can't do that on your own follower.\n\r", - ch ); - return; - } - - if (!IS_NPC(ch)) - check_killer(ch,victim); - - vo = (void *) victim; - } - else if ((obj = get_obj_here(ch,target_name)) != NULL) - { - vo = (void *) obj; - target = TARGET_OBJ; - } - else - { - send_to_char("You don't see that here.\n\r",ch); - return; - } - break; - - case TAR_OBJ_CHAR_DEF: - if (arg2[0] == '\0') - { - vo = (void *) ch; - target = TARGET_CHAR; - } - else if ((victim = get_char_room(ch,target_name)) != NULL) - { - vo = (void *) victim; - target = TARGET_CHAR; - } - else if ((obj = get_obj_carry(ch,target_name,ch)) != NULL) - { - vo = (void *) obj; - target = TARGET_OBJ; - } - else - { - send_to_char("You don't see that here.\n\r",ch); - return; - } - break; - } - - if ( !IS_NPC(ch) && ch->mana < mana ) - { - send_to_char( "You don't have enough mana.\n\r", ch ); - return; - } - - if ( str_cmp( skill_table[sn].name, "ventriloquate" ) ) - say_spell( ch, sn ); - - WAIT_STATE( ch, skill_table[sn].beats ); - - if ( number_percent( ) > get_skill(ch,sn) ) - { - send_to_char( "You lost your concentration.\n\r", ch ); - check_improve(ch,sn,FALSE,1); - ch->mana -= mana / 2; - } - else - { - ch->mana -= mana; - if (IS_NPC(ch) || class_table[ch->class].fMana) - /* class has spells */ - (*skill_table[sn].spell_fun) ( sn, ch->level, ch, vo,target); - else - (*skill_table[sn].spell_fun) (sn, 3 * ch->level/4, ch, vo,target); - check_improve(ch,sn,TRUE,1); - } - - if ((skill_table[sn].target == TAR_CHAR_OFFENSIVE - || (skill_table[sn].target == TAR_OBJ_CHAR_OFF && target == TARGET_CHAR)) - && victim != ch - && victim->master != ch) - { - CHAR_DATA *vch; - CHAR_DATA *vch_next; - - for ( vch = ch->in_room->people; vch; vch = vch_next ) - { - vch_next = vch->next_in_room; - if ( victim == vch && victim->fighting == NULL ) - { check_killer(victim,ch); - multi_hit( victim, ch, TYPE_UNDEFINED ); - break; - } - } - } - - return; -} - - - -/* - * Cast spells at targets using a magical object. - */ -void obj_cast_spell( int sn, int level, CHAR_DATA *ch, CHAR_DATA *victim, OBJ_DATA *obj ) -{ - void *vo; - int target = TARGET_NONE; - - if ( sn <= 0 ) - return; - - if ( sn >= MAX_SKILL || skill_table[sn].spell_fun == 0 ) - { - bug( "Obj_cast_spell: bad sn %d.", sn ); - return; - } - - switch ( skill_table[sn].target ) - { - default: - bug( "Obj_cast_spell: bad target for sn %d.", sn ); - return; - - case TAR_IGNORE: - vo = NULL; - break; - - case TAR_CHAR_OFFENSIVE: - if ( victim == NULL ) - victim = ch->fighting; - if ( victim == NULL ) - { - send_to_char( "You can't do that.\n\r", ch ); - return; - } - if (is_safe(ch,victim) && ch != victim) - { - send_to_char("Something isn't right...\n\r",ch); - return; - } - vo = (void *) victim; - target = TARGET_CHAR; - break; - - case TAR_CHAR_DEFENSIVE: - case TAR_CHAR_SELF: - if ( victim == NULL ) - victim = ch; - vo = (void *) victim; - target = TARGET_CHAR; - break; - - case TAR_OBJ_INV: - if ( obj == NULL ) - { - send_to_char( "You can't do that.\n\r", ch ); - return; - } - vo = (void *) obj; - target = TARGET_OBJ; - break; - - case TAR_OBJ_CHAR_OFF: - if ( victim == NULL && obj == NULL) - { if (ch->fighting != NULL) - victim = ch->fighting; - else - { - send_to_char("You can't do that.\n\r",ch); - return; - } - } - if (victim != NULL) - { - if (is_safe_spell(ch,victim,FALSE) && ch != victim) - { - send_to_char("Somehting isn't right...\n\r",ch); - return; - } - - vo = (void *) victim; - target = TARGET_CHAR; - } - else - { - vo = (void *) obj; - target = TARGET_OBJ; - } - break; - - - case TAR_OBJ_CHAR_DEF: - if (victim == NULL && obj == NULL) - { - vo = (void *) ch; - target = TARGET_CHAR; - } - else if (victim != NULL) - { - vo = (void *) victim; - target = TARGET_CHAR; - } - else - { - vo = (void *) obj; - target = TARGET_OBJ; - } - - break; - } - - target_name = ""; - (*skill_table[sn].spell_fun) ( sn, level, ch, vo,target); - - - - if ( (skill_table[sn].target == TAR_CHAR_OFFENSIVE - || (skill_table[sn].target == TAR_OBJ_CHAR_OFF && target == TARGET_CHAR)) - && victim != ch - && victim->master != ch ) - { - CHAR_DATA *vch; - CHAR_DATA *vch_next; - - for ( vch = ch->in_room->people; vch; vch = vch_next ) - { - vch_next = vch->next_in_room; - if ( victim == vch && victim->fighting == NULL ) - { - check_killer(victim,ch); - multi_hit( victim, ch, TYPE_UNDEFINED ); - break; - } - } - } - - return; -} - - - -/* - * Spell functions. - */ -void spell_acid_blast( int sn, int level, CHAR_DATA *ch, void *vo, int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int dam; - - dam = dice( level, 12 ); - if ( saves_spell( level, victim, DAM_ACID ) ) - dam /= 2; - damage( ch, victim, dam, sn, DAM_ACID, TRUE); - return; -} - - - -void spell_armor( int sn, int level, CHAR_DATA *ch, void *vo, int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( is_affected( victim, sn ) ) - { - if (victim == ch) - send_to_char("You are already armored.\n\r",ch); - else - act("$N is already armored.",ch,NULL,victim,TO_CHAR); - return; - } - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = 24; - af.modifier = -20; - af.location = APPLY_AC; - af.bitvector = 0; - affect_to_char( victim, &af ); - send_to_char( "You feel someone protecting you.\n\r", victim ); - if ( ch != victim ) - act("$N is protected by your magic.",ch,NULL,victim,TO_CHAR); - return; -} - - - -void spell_bless( int sn, int level, CHAR_DATA *ch, void *vo, int target) -{ - CHAR_DATA *victim; - OBJ_DATA *obj; - AFFECT_DATA af; - - /* deal with the object case first */ - if (target == TARGET_OBJ) - { - obj = (OBJ_DATA *) vo; - if (IS_OBJ_STAT(obj,ITEM_BLESS)) - { - act("$p is already blessed.",ch,obj,NULL,TO_CHAR); - return; - } - - if (IS_OBJ_STAT(obj,ITEM_EVIL)) - { - AFFECT_DATA *paf; - - paf = affect_find(obj->affected,gsn_curse); - if (!saves_dispel(level,paf != NULL ? paf->level : obj->level,0)) - { - if (paf != NULL) - affect_remove_obj(obj,paf); - act("$p glows a pale blue.",ch,obj,NULL,TO_ALL); - REMOVE_BIT(obj->extra_flags,ITEM_EVIL); - return; - } - else - { - act("The evil of $p is too powerful for you to overcome.", - ch,obj,NULL,TO_CHAR); - return; - } - } - - af.where = TO_OBJECT; - af.type = sn; - af.level = level; - af.duration = 6 + level; - af.location = APPLY_SAVES; - af.modifier = -1; - af.bitvector = ITEM_BLESS; - affect_to_obj(obj,&af); - - act("$p glows with a holy aura.",ch,obj,NULL,TO_ALL); - - if (obj->wear_loc != WEAR_NONE) - ch->saving_throw -= 1; - return; - } - - /* character target */ - victim = (CHAR_DATA *) vo; - - - if ( victim->position == POS_FIGHTING || is_affected( victim, sn ) ) - { - if (victim == ch) - send_to_char("You are already blessed.\n\r",ch); - else - act("$N already has divine favor.",ch,NULL,victim,TO_CHAR); - return; - } - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = 6+level; - af.location = APPLY_HITROLL; - af.modifier = level / 8; - af.bitvector = 0; - affect_to_char( victim, &af ); - - af.location = APPLY_SAVING_SPELL; - af.modifier = 0 - level / 8; - affect_to_char( victim, &af ); - send_to_char( "You feel righteous.\n\r", victim ); - if ( ch != victim ) - act("You grant $N the favor of your god.",ch,NULL,victim,TO_CHAR); - return; -} - - - -void spell_blindness( int sn, int level, CHAR_DATA *ch, void *vo, int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( IS_AFFECTED(victim, AFF_BLIND) || saves_spell(level,victim,DAM_OTHER)) - return; - - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.location = APPLY_HITROLL; - af.modifier = -4; - af.duration = 1+level; - af.bitvector = AFF_BLIND; - affect_to_char( victim, &af ); - send_to_char( "You are blinded!\n\r", victim ); - act("$n appears to be blinded.",victim,NULL,NULL,TO_ROOM); - return; -} - - - -void spell_burning_hands(int sn,int level, CHAR_DATA *ch, void *vo, int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - static const sh_int dam_each[] = - { - 0, - 0, 0, 0, 0, 14, 17, 20, 23, 26, 29, - 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, - 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, - 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, - 44, 44, 45, 45, 46, 46, 47, 47, 48, 48 - }; - int dam; - - level = UMIN(level, sizeof(dam_each)/sizeof(dam_each[0]) - 1); - level = UMAX(0, level); - dam = number_range( dam_each[level] / 2, dam_each[level] * 2 ); - if ( saves_spell( level, victim,DAM_FIRE) ) - dam /= 2; - damage( ch, victim, dam, sn, DAM_FIRE,TRUE); - return; -} - - - -void spell_call_lightning( int sn, int level,CHAR_DATA *ch,void *vo,int target) -{ - CHAR_DATA *vch; - CHAR_DATA *vch_next; - int dam; - - if ( !IS_OUTSIDE(ch) ) - { - send_to_char( "You must be out of doors.\n\r", ch ); - return; - } - - if ( weather_info.sky < SKY_RAINING ) - { - send_to_char( "You need bad weather.\n\r", ch ); - return; - } - - dam = dice(level/2, 8); - - send_to_char( "Mota's lightning strikes your foes!\n\r", ch ); - act( "$n calls Mota's lightning to strike $s foes!", - ch, NULL, NULL, TO_ROOM ); - - for ( vch = char_list; vch != NULL; vch = vch_next ) - { - vch_next = vch->next; - if ( vch->in_room == NULL ) - continue; - if ( vch->in_room == ch->in_room ) - { - if ( vch != ch && ( IS_NPC(ch) ? !IS_NPC(vch) : IS_NPC(vch) ) ) - damage( ch, vch, saves_spell( level,vch,DAM_LIGHTNING) - ? dam / 2 : dam, sn,DAM_LIGHTNING,TRUE); - continue; - } - - if ( vch->in_room->area == ch->in_room->area - && IS_OUTSIDE(vch) - && IS_AWAKE(vch) ) - send_to_char( "Lightning flashes in the sky.\n\r", vch ); - } - - return; -} - -/* RT calm spell stops all fighting in the room */ - -void spell_calm( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *vch; - int mlevel = 0; - int count = 0; - int high_level = 0; - int chance; - AFFECT_DATA af; - - /* get sum of all mobile levels in the room */ - for (vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room) - { - if (vch->position == POS_FIGHTING) - { - count++; - if (IS_NPC(vch)) - mlevel += vch->level; - else - mlevel += vch->level/2; - high_level = UMAX(high_level,vch->level); - } - } - - /* compute chance of stopping combat */ - chance = 4 * level - high_level + 2 * count; - - if (IS_IMMORTAL(ch)) /* always works */ - mlevel = 0; - - if (number_range(0, chance) >= mlevel) /* hard to stop large fights */ - { - for (vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room) - { - if (IS_NPC(vch) && (IS_SET(vch->imm_flags,IMM_MAGIC) || - IS_SET(vch->act,ACT_UNDEAD))) - return; - - if (IS_AFFECTED(vch,AFF_CALM) || IS_AFFECTED(vch,AFF_BERSERK) - || is_affected(vch,skill_lookup("frenzy"))) - return; - - send_to_char("A wave of calm passes over you.\n\r",vch); - - if (vch->fighting || vch->position == POS_FIGHTING) - stop_fighting(vch,FALSE); - - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level/4; - af.location = APPLY_HITROLL; - if (!IS_NPC(vch)) - af.modifier = -5; - else - af.modifier = -2; - af.bitvector = AFF_CALM; - affect_to_char(vch,&af); - - af.location = APPLY_DAMROLL; - affect_to_char(vch,&af); - } - } -} - -void spell_cancellation( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - bool found = FALSE; - - level += 2; - - if ((!IS_NPC(ch) && IS_NPC(victim) && - !(IS_AFFECTED(ch, AFF_CHARM) && ch->master == victim) ) || - (IS_NPC(ch) && !IS_NPC(victim)) ) - { - send_to_char("You failed, try dispel magic.\n\r",ch); - return; - } - - /* unlike dispel magic, the victim gets NO save */ - - /* begin running through the spells */ - - if (check_dispel(level,victim,skill_lookup("armor"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("bless"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("blindness"))) - { - found = TRUE; - act("$n is no longer blinded.",victim,NULL,NULL,TO_ROOM); - } - - if (check_dispel(level,victim,skill_lookup("calm"))) - { - found = TRUE; - act("$n no longer looks so peaceful...",victim,NULL,NULL,TO_ROOM); - } - - if (check_dispel(level,victim,skill_lookup("change sex"))) - { - found = TRUE; - act("$n looks more like $mself again.",victim,NULL,NULL,TO_ROOM); - } - - if (check_dispel(level,victim,skill_lookup("charm person"))) - { - found = TRUE; - act("$n regains $s free will.",victim,NULL,NULL,TO_ROOM); - } - - if (check_dispel(level,victim,skill_lookup("chill touch"))) - { - found = TRUE; - act("$n looks warmer.",victim,NULL,NULL,TO_ROOM); - } - - if (check_dispel(level,victim,skill_lookup("curse"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("detect evil"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("detect good"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("detect hidden"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("detect invis"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("detect magic"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("faerie fire"))) - { - act("$n's outline fades.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("fly"))) - { - act("$n falls to the ground!",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("frenzy"))) - { - act("$n no longer looks so wild.",victim,NULL,NULL,TO_ROOM);; - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("giant strength"))) - { - act("$n no longer looks so mighty.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("haste"))) - { - act("$n is no longer moving so quickly.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("infravision"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("invis"))) - { - act("$n fades into existance.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("mass invis"))) - { - act("$n fades into existance.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("pass door"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("protection evil"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("protection good"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("sanctuary"))) - { - act("The white aura around $n's body vanishes.", - victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("shield"))) - { - act("The shield protecting $n vanishes.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("sleep"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("slow"))) - { - act("$n is no longer moving so slowly.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("stone skin"))) - { - act("$n's skin regains its normal texture.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("weaken"))) - { - act("$n looks stronger.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (found) - send_to_char("Ok.\n\r",ch); - else - send_to_char("Spell failed.\n\r",ch); -} - -void spell_cause_light( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - damage( ch, (CHAR_DATA *) vo, dice(1, 8) + level / 3, sn,DAM_HARM,TRUE); - return; -} - - - -void spell_cause_critical(int sn,int level,CHAR_DATA *ch,void *vo,int target) -{ - damage( ch, (CHAR_DATA *) vo, dice(3, 8) + level - 6, sn,DAM_HARM,TRUE); - return; -} - - - -void spell_cause_serious(int sn,int level,CHAR_DATA *ch,void *vo,int target) -{ - damage( ch, (CHAR_DATA *) vo, dice(2, 8) + level / 2, sn,DAM_HARM,TRUE); - return; -} - -void spell_chain_lightning(int sn,int level,CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - CHAR_DATA *tmp_vict,*last_vict,*next_vict; - bool found; - int dam; - - /* first strike */ - - act("A lightning bolt leaps from $n's hand and arcs to $N.", - ch,NULL,victim,TO_ROOM); - act("A lightning bolt leaps from your hand and arcs to $N.", - ch,NULL,victim,TO_CHAR); - act("A lightning bolt leaps from $n's hand and hits you!", - ch,NULL,victim,TO_VICT); - - dam = dice(level,6); - if (saves_spell(level,victim,DAM_LIGHTNING)) - dam /= 3; - damage(ch,victim,dam,sn,DAM_LIGHTNING,TRUE); - last_vict = victim; - level -= 4; /* decrement damage */ - - /* new targets */ - while (level > 0) - { - found = FALSE; - for (tmp_vict = ch->in_room->people; - tmp_vict != NULL; - tmp_vict = next_vict) - { - next_vict = tmp_vict->next_in_room; - if (!is_safe_spell(ch,tmp_vict,TRUE) && tmp_vict != last_vict) - { - found = TRUE; - last_vict = tmp_vict; - act("The bolt arcs to $n!",tmp_vict,NULL,NULL,TO_ROOM); - act("The bolt hits you!",tmp_vict,NULL,NULL,TO_CHAR); - dam = dice(level,6); - if (saves_spell(level,tmp_vict,DAM_LIGHTNING)) - dam /= 3; - damage(ch,tmp_vict,dam,sn,DAM_LIGHTNING,TRUE); - level -= 4; /* decrement damage */ - } - } /* end target searching loop */ - - if (!found) /* no target found, hit the caster */ - { - if (ch == NULL) - return; - - if (last_vict == ch) /* no double hits */ - { - act("The bolt seems to have fizzled out.",ch,NULL,NULL,TO_ROOM); - act("The bolt grounds out through your body.", - ch,NULL,NULL,TO_CHAR); - return; - } - - last_vict = ch; - act("The bolt arcs to $n...whoops!",ch,NULL,NULL,TO_ROOM); - send_to_char("You are struck by your own lightning!\n\r",ch); - dam = dice(level,6); - if (saves_spell(level,ch,DAM_LIGHTNING)) - dam /= 3; - damage(ch,ch,dam,sn,DAM_LIGHTNING,TRUE); - level -= 4; /* decrement damage */ - if (ch == NULL) - return; - } - /* now go back and find more targets */ - } -} - - -void spell_change_sex( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( is_affected( victim, sn )) - { - if (victim == ch) - send_to_char("You've already been changed.\n\r",ch); - else - act("$N has already had $s(?) sex changed.",ch,NULL,victim,TO_CHAR); - return; - } - if (saves_spell(level , victim,DAM_OTHER)) - return; - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = 2 * level; - af.location = APPLY_SEX; - do - { - af.modifier = number_range( 0, 2 ) - victim->sex; - } - while ( af.modifier == 0 ); - af.bitvector = 0; - affect_to_char( victim, &af ); - send_to_char( "You feel different.\n\r", victim ); - act("$n doesn't look like $mself anymore...",victim,NULL,NULL,TO_ROOM); - return; -} - - - -void spell_charm_person( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if (is_safe(ch,victim)) return; - - if ( victim == ch ) - { - send_to_char( "You like yourself even better!\n\r", ch ); - return; - } - - if ( IS_AFFECTED(victim, AFF_CHARM) - || IS_AFFECTED(ch, AFF_CHARM) - || level < victim->level - || IS_SET(victim->imm_flags,IMM_CHARM) - || saves_spell( level, victim,DAM_CHARM) ) - return; - - - if (IS_SET(victim->in_room->room_flags,ROOM_LAW)) - { - send_to_char( - "The mayor does not allow charming in the city limits.\n\r",ch); - return; - } - - if ( victim->master ) - stop_follower( victim ); - add_follower( victim, ch ); - victim->leader = ch; - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = number_fuzzy( level / 4 ); - af.location = 0; - af.modifier = 0; - af.bitvector = AFF_CHARM; - affect_to_char( victim, &af ); - act( "Isn't $n just so nice?", ch, NULL, victim, TO_VICT ); - if ( ch != victim ) - act("$N looks at you with adoring eyes.",ch,NULL,victim,TO_CHAR); - return; -} - - - -void spell_chill_touch( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - static const sh_int dam_each[] = - { - 0, - 0, 0, 6, 7, 8, 9, 12, 13, 13, 13, - 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, - 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, - 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, - 24, 24, 24, 25, 25, 25, 26, 26, 26, 27 - }; - AFFECT_DATA af; - int dam; - - level = UMIN(level, sizeof(dam_each)/sizeof(dam_each[0]) - 1); - level = UMAX(0, level); - dam = number_range( dam_each[level] / 2, dam_each[level] * 2 ); - if ( !saves_spell( level, victim,DAM_COLD ) ) - { - act("$n turns blue and shivers.",victim,NULL,NULL,TO_ROOM); - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = 6; - af.location = APPLY_STR; - af.modifier = -1; - af.bitvector = 0; - affect_join( victim, &af ); - } - else - { - dam /= 2; - } - - damage( ch, victim, dam, sn, DAM_COLD,TRUE ); - return; -} - - - -void spell_colour_spray( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - static const sh_int dam_each[] = - { - 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 30, 35, 40, 45, 50, 55, 55, 55, 56, 57, - 58, 58, 59, 60, 61, 61, 62, 63, 64, 64, - 65, 66, 67, 67, 68, 69, 70, 70, 71, 72, - 73, 73, 74, 75, 76, 76, 77, 78, 79, 79 - }; - int dam; - - level = UMIN(level, sizeof(dam_each)/sizeof(dam_each[0]) - 1); - level = UMAX(0, level); - dam = number_range( dam_each[level] / 2, dam_each[level] * 2 ); - if ( saves_spell( level, victim,DAM_LIGHT) ) - dam /= 2; - else - spell_blindness(skill_lookup("blindness"), - level/2,ch,(void *) victim,TARGET_CHAR); - - damage( ch, victim, dam, sn, DAM_LIGHT,TRUE ); - return; -} - - - -void spell_continual_light(int sn,int level,CHAR_DATA *ch,void *vo,int target) -{ - OBJ_DATA *light; - - if (target_name[0] != '\0') /* do a glow on some object */ - { - light = get_obj_carry(ch,target_name,ch); - - if (light == NULL) - { - send_to_char("You don't see that here.\n\r",ch); - return; - } - - if (IS_OBJ_STAT(light,ITEM_GLOW)) - { - act("$p is already glowing.",ch,light,NULL,TO_CHAR); - return; - } - - SET_BIT(light->extra_flags,ITEM_GLOW); - act("$p glows with a white light.",ch,light,NULL,TO_ALL); - return; - } - - light = create_object( get_obj_index( OBJ_VNUM_LIGHT_BALL ), 0 ); - obj_to_room( light, ch->in_room ); - act( "$n twiddles $s thumbs and $p appears.", ch, light, NULL, TO_ROOM ); - act( "You twiddle your thumbs and $p appears.", ch, light, NULL, TO_CHAR ); - return; -} - - - -void spell_control_weather(int sn,int level,CHAR_DATA *ch,void *vo,int target) -{ - if ( !str_cmp( target_name, "better" ) ) - weather_info.change += dice( level / 3, 4 ); - else if ( !str_cmp( target_name, "worse" ) ) - weather_info.change -= dice( level / 3, 4 ); - else - send_to_char ("Do you want it to get better or worse?\n\r", ch ); - - send_to_char( "Ok.\n\r", ch ); - return; -} - - - -void spell_create_food( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - OBJ_DATA *mushroom; - - mushroom = create_object( get_obj_index( OBJ_VNUM_MUSHROOM ), 0 ); - mushroom->value[0] = level / 2; - mushroom->value[1] = level; - obj_to_room( mushroom, ch->in_room ); - act( "$p suddenly appears.", ch, mushroom, NULL, TO_ROOM ); - act( "$p suddenly appears.", ch, mushroom, NULL, TO_CHAR ); - return; -} - -void spell_create_rose( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - OBJ_DATA *rose; - rose = create_object(get_obj_index(OBJ_VNUM_ROSE), 0); - act("$n has created a beautiful red rose.",ch,rose,NULL,TO_ROOM); - send_to_char("You create a beautiful red rose.\n\r",ch); - obj_to_char(rose,ch); - return; -} - -void spell_create_spring(int sn,int level,CHAR_DATA *ch,void *vo,int target) -{ - OBJ_DATA *spring; - - spring = create_object( get_obj_index( OBJ_VNUM_SPRING ), 0 ); - spring->timer = level; - obj_to_room( spring, ch->in_room ); - act( "$p flows from the ground.", ch, spring, NULL, TO_ROOM ); - act( "$p flows from the ground.", ch, spring, NULL, TO_CHAR ); - return; -} - - - -void spell_create_water( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - OBJ_DATA *obj = (OBJ_DATA *) vo; - int water; - - if ( obj->item_type != ITEM_DRINK_CON ) - { - send_to_char( "It is unable to hold water.\n\r", ch ); - return; - } - - if ( obj->value[2] != LIQ_WATER && obj->value[1] != 0 ) - { - send_to_char( "It contains some other liquid.\n\r", ch ); - return; - } - - water = UMIN( - level * (weather_info.sky >= SKY_RAINING ? 4 : 2), - obj->value[0] - obj->value[1] - ); - - if ( water > 0 ) - { - obj->value[2] = LIQ_WATER; - obj->value[1] += water; - if ( !is_name( "water", obj->name ) ) - { - char buf[MAX_STRING_LENGTH]; - - sprintf( buf, "%s water", obj->name ); - free_string( obj->name ); - obj->name = str_dup( buf ); - } - act( "$p is filled.", ch, obj, NULL, TO_CHAR ); - } - - return; -} - - - -void spell_cure_blindness(int sn,int level,CHAR_DATA *ch,void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - - if ( !is_affected( victim, gsn_blindness ) ) - { - if (victim == ch) - send_to_char("You aren't blind.\n\r",ch); - else - act("$N doesn't appear to be blinded.",ch,NULL,victim,TO_CHAR); - return; - } - - if (check_dispel(level,victim,gsn_blindness)) - { - send_to_char( "Your vision returns!\n\r", victim ); - act("$n is no longer blinded.",victim,NULL,NULL,TO_ROOM); - } - else - send_to_char("Spell failed.\n\r",ch); -} - - - -void spell_cure_critical( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int heal; - - heal = dice(3, 8) + level - 6; - victim->hit = UMIN( victim->hit + heal, victim->max_hit ); - update_pos( victim ); - send_to_char( "You feel better!\n\r", victim ); - if ( ch != victim ) - send_to_char( "Ok.\n\r", ch ); - return; -} - -/* RT added to cure plague */ -void spell_cure_disease( int sn, int level, CHAR_DATA *ch,void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - - if ( !is_affected( victim, gsn_plague ) ) - { - if (victim == ch) - send_to_char("You aren't ill.\n\r",ch); - else - act("$N doesn't appear to be diseased.",ch,NULL,victim,TO_CHAR); - return; - } - - if (check_dispel(level,victim,gsn_plague)) - { - send_to_char("Your sores vanish.\n\r",victim); - act("$n looks relieved as $s sores vanish.",victim,NULL,NULL,TO_ROOM); - } - else - send_to_char("Spell failed.\n\r",ch); -} - - - -void spell_cure_light( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int heal; - - heal = dice(1, 8) + level / 3; - victim->hit = UMIN( victim->hit + heal, victim->max_hit ); - update_pos( victim ); - send_to_char( "You feel better!\n\r", victim ); - if ( ch != victim ) - send_to_char( "Ok.\n\r", ch ); - return; -} - - - -void spell_cure_poison( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - - if ( !is_affected( victim, gsn_poison ) ) - { - if (victim == ch) - send_to_char("You aren't poisoned.\n\r",ch); - else - act("$N doesn't appear to be poisoned.",ch,NULL,victim,TO_CHAR); - return; - } - - if (check_dispel(level,victim,gsn_poison)) - { - send_to_char("A warm feeling runs through your body.\n\r",victim); - act("$n looks much better.",victim,NULL,NULL,TO_ROOM); - } - else - send_to_char("Spell failed.\n\r",ch); -} - -void spell_cure_serious( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int heal; - - heal = dice(2, 8) + level /2 ; - victim->hit = UMIN( victim->hit + heal, victim->max_hit ); - update_pos( victim ); - send_to_char( "You feel better!\n\r", victim ); - if ( ch != victim ) - send_to_char( "Ok.\n\r", ch ); - return; -} - - - -void spell_curse( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim; - OBJ_DATA *obj; - AFFECT_DATA af; - - /* deal with the object case first */ - if (target == TARGET_OBJ) - { - obj = (OBJ_DATA *) vo; - if (IS_OBJ_STAT(obj,ITEM_EVIL)) - { - act("$p is already filled with evil.",ch,obj,NULL,TO_CHAR); - return; - } - - if (IS_OBJ_STAT(obj,ITEM_BLESS)) - { - AFFECT_DATA *paf; - - paf = affect_find(obj->affected,skill_lookup("bless")); - if (!saves_dispel(level,paf != NULL ? paf->level : obj->level,0)) - { - if (paf != NULL) - affect_remove_obj(obj,paf); - act("$p glows with a red aura.",ch,obj,NULL,TO_ALL); - REMOVE_BIT(obj->extra_flags,ITEM_BLESS); - return; - } - else - { - act("The holy aura of $p is too powerful for you to overcome.", - ch,obj,NULL,TO_CHAR); - return; - } - } - - af.where = TO_OBJECT; - af.type = sn; - af.level = level; - af.duration = 2 * level; - af.location = APPLY_SAVES; - af.modifier = +1; - af.bitvector = ITEM_EVIL; - affect_to_obj(obj,&af); - - act("$p glows with a malevolent aura.",ch,obj,NULL,TO_ALL); - - if (obj->wear_loc != WEAR_NONE) - ch->saving_throw += 1; - return; - } - - /* character curses */ - victim = (CHAR_DATA *) vo; - - if (IS_AFFECTED(victim,AFF_CURSE) || saves_spell(level,victim,DAM_NEGATIVE)) - return; - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = 2*level; - af.location = APPLY_HITROLL; - af.modifier = -1 * (level / 8); - af.bitvector = AFF_CURSE; - affect_to_char( victim, &af ); - - af.location = APPLY_SAVING_SPELL; - af.modifier = level / 8; - affect_to_char( victim, &af ); - - send_to_char( "You feel unclean.\n\r", victim ); - if ( ch != victim ) - act("$N looks very uncomfortable.",ch,NULL,victim,TO_CHAR); - return; -} - -/* RT replacement demonfire spell */ - -void spell_demonfire(int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int dam; - - if ( !IS_NPC(ch) && !IS_EVIL(ch) ) - { - victim = ch; - send_to_char("The demons turn upon you!\n\r",ch); - } - - ch->alignment = UMAX(-1000, ch->alignment - 50); - - if (victim != ch) - { - act("$n calls forth the demons of Hell upon $N!", - ch,NULL,victim,TO_ROOM); - act("$n has assailed you with the demons of Hell!", - ch,NULL,victim,TO_VICT); - send_to_char("You conjure forth the demons of hell!\n\r",ch); - } - dam = dice( level, 10 ); - if ( saves_spell( level, victim,DAM_NEGATIVE) ) - dam /= 2; - damage( ch, victim, dam, sn, DAM_NEGATIVE ,TRUE); - spell_curse(gsn_curse, 3 * level / 4, ch, (void *) victim,TARGET_CHAR); -} - -void spell_detect_evil( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( IS_AFFECTED(victim, AFF_DETECT_EVIL) ) - { - if (victim == ch) - send_to_char("You can already sense evil.\n\r",ch); - else - act("$N can already detect evil.",ch,NULL,victim,TO_CHAR); - return; - } - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level; - af.modifier = 0; - af.location = APPLY_NONE; - af.bitvector = AFF_DETECT_EVIL; - affect_to_char( victim, &af ); - send_to_char( "Your eyes tingle.\n\r", victim ); - if ( ch != victim ) - send_to_char( "Ok.\n\r", ch ); - return; -} - - -void spell_detect_good( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( IS_AFFECTED(victim, AFF_DETECT_GOOD) ) - { - if (victim == ch) - send_to_char("You can already sense good.\n\r",ch); - else - act("$N can already detect good.",ch,NULL,victim,TO_CHAR); - return; - } - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level; - af.modifier = 0; - af.location = APPLY_NONE; - af.bitvector = AFF_DETECT_GOOD; - affect_to_char( victim, &af ); - send_to_char( "Your eyes tingle.\n\r", victim ); - if ( ch != victim ) - send_to_char( "Ok.\n\r", ch ); - return; -} - - - -void spell_detect_hidden(int sn,int level,CHAR_DATA *ch,void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( IS_AFFECTED(victim, AFF_DETECT_HIDDEN) ) - { - if (victim == ch) - send_to_char("You are already as alert as you can be. \n\r",ch); - else - act("$N can already sense hidden lifeforms.",ch,NULL,victim,TO_CHAR); - return; - } - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level; - af.location = APPLY_NONE; - af.modifier = 0; - af.bitvector = AFF_DETECT_HIDDEN; - affect_to_char( victim, &af ); - send_to_char( "Your awareness improves.\n\r", victim ); - if ( ch != victim ) - send_to_char( "Ok.\n\r", ch ); - return; -} - - - -void spell_detect_invis( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( IS_AFFECTED(victim, AFF_DETECT_INVIS) ) - { - if (victim == ch) - send_to_char("You can already see invisible.\n\r",ch); - else - act("$N can already see invisible things.",ch,NULL,victim,TO_CHAR); - return; - } - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level; - af.modifier = 0; - af.location = APPLY_NONE; - af.bitvector = AFF_DETECT_INVIS; - affect_to_char( victim, &af ); - send_to_char( "Your eyes tingle.\n\r", victim ); - if ( ch != victim ) - send_to_char( "Ok.\n\r", ch ); - return; -} - - - -void spell_detect_magic( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( IS_AFFECTED(victim, AFF_DETECT_MAGIC) ) - { - if (victim == ch) - send_to_char("You can already sense magical auras.\n\r",ch); - else - act("$N can already detect magic.",ch,NULL,victim,TO_CHAR); - return; - } - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level; - af.modifier = 0; - af.location = APPLY_NONE; - af.bitvector = AFF_DETECT_MAGIC; - affect_to_char( victim, &af ); - send_to_char( "Your eyes tingle.\n\r", victim ); - if ( ch != victim ) - send_to_char( "Ok.\n\r", ch ); - return; -} - - - -void spell_detect_poison( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - OBJ_DATA *obj = (OBJ_DATA *) vo; - - if ( obj->item_type == ITEM_DRINK_CON || obj->item_type == ITEM_FOOD ) - { - if ( obj->value[3] != 0 ) - send_to_char( "You smell poisonous fumes.\n\r", ch ); - else - send_to_char( "It looks delicious.\n\r", ch ); - } - else - { - send_to_char( "It doesn't look poisoned.\n\r", ch ); - } - - return; -} - - - -void spell_dispel_evil( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int dam; - - if ( !IS_NPC(ch) && IS_EVIL(ch) ) - victim = ch; - - if ( IS_GOOD(victim) ) - { - act( "Mota protects $N.", ch, NULL, victim, TO_ROOM ); - return; - } - - if ( IS_NEUTRAL(victim) ) - { - act( "$N does not seem to be affected.", ch, NULL, victim, TO_CHAR ); - return; - } - - if (victim->hit > (ch->level * 4)) - dam = dice( level, 4 ); - else - dam = UMAX(victim->hit, dice(level,4)); - if ( saves_spell( level, victim,DAM_HOLY) ) - dam /= 2; - damage( ch, victim, dam, sn, DAM_HOLY ,TRUE); - return; -} - - -void spell_dispel_good( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int dam; - - if ( !IS_NPC(ch) && IS_GOOD(ch) ) - victim = ch; - - if ( IS_EVIL(victim) ) - { - act( "$N is protected by $S evil.", ch, NULL, victim, TO_ROOM ); - return; - } - - if ( IS_NEUTRAL(victim) ) - { - act( "$N does not seem to be affected.", ch, NULL, victim, TO_CHAR ); - return; - } - - if (victim->hit > (ch->level * 4)) - dam = dice( level, 4 ); - else - dam = UMAX(victim->hit, dice(level,4)); - if ( saves_spell( level, victim,DAM_NEGATIVE) ) - dam /= 2; - damage( ch, victim, dam, sn, DAM_NEGATIVE ,TRUE); - return; -} - - -/* modified for enhanced use */ - -void spell_dispel_magic( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - bool found = FALSE; - - if (saves_spell(level, victim,DAM_OTHER)) - { - send_to_char( "You feel a brief tingling sensation.\n\r",victim); - send_to_char( "You failed.\n\r", ch); - return; - } - - /* begin running through the spells */ - - if (check_dispel(level,victim,skill_lookup("armor"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("bless"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("blindness"))) - { - found = TRUE; - act("$n is no longer blinded.",victim,NULL,NULL,TO_ROOM); - } - - if (check_dispel(level,victim,skill_lookup("calm"))) - { - found = TRUE; - act("$n no longer looks so peaceful...",victim,NULL,NULL,TO_ROOM); - } - - if (check_dispel(level,victim,skill_lookup("change sex"))) - { - found = TRUE; - act("$n looks more like $mself again.",victim,NULL,NULL,TO_ROOM); - } - - if (check_dispel(level,victim,skill_lookup("charm person"))) - { - found = TRUE; - act("$n regains $s free will.",victim,NULL,NULL,TO_ROOM); - } - - if (check_dispel(level,victim,skill_lookup("chill touch"))) - { - found = TRUE; - act("$n looks warmer.",victim,NULL,NULL,TO_ROOM); - } - - if (check_dispel(level,victim,skill_lookup("curse"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("detect evil"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("detect good"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("detect hidden"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("detect invis"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("detect magic"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("faerie fire"))) - { - act("$n's outline fades.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("fly"))) - { - act("$n falls to the ground!",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("frenzy"))) - { - act("$n no longer looks so wild.",victim,NULL,NULL,TO_ROOM);; - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("giant strength"))) - { - act("$n no longer looks so mighty.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("haste"))) - { - act("$n is no longer moving so quickly.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("infravision"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("invis"))) - { - act("$n fades into existance.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("mass invis"))) - { - act("$n fades into existance.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("pass door"))) - found = TRUE; - - - if (check_dispel(level,victim,skill_lookup("protection evil"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("protection good"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("sanctuary"))) - { - act("The white aura around $n's body vanishes.", - victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (IS_AFFECTED(victim,AFF_SANCTUARY) - && !saves_dispel(level, victim->level,-1) - && !is_affected(victim,skill_lookup("sanctuary"))) - { - REMOVE_BIT(victim->affected_by,AFF_SANCTUARY); - act("The white aura around $n's body vanishes.", - victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("shield"))) - { - act("The shield protecting $n vanishes.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("sleep"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("slow"))) - { - act("$n is no longer moving so slowly.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("stone skin"))) - { - act("$n's skin regains its normal texture.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("weaken"))) - { - act("$n looks stronger.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (found) - send_to_char("Ok.\n\r",ch); - else - send_to_char("Spell failed.\n\r",ch); - return; -} - -void spell_earthquake( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *vch; - CHAR_DATA *vch_next; - - send_to_char( "The earth trembles beneath your feet!\n\r", ch ); - act( "$n makes the earth tremble and shiver.", ch, NULL, NULL, TO_ROOM ); - - for ( vch = char_list; vch != NULL; vch = vch_next ) - { - vch_next = vch->next; - if ( vch->in_room == NULL ) - continue; - if ( vch->in_room == ch->in_room ) - { - if ( vch != ch && !is_safe_spell(ch,vch,TRUE)) - { if (IS_AFFECTED(vch,AFF_FLYING)) - damage(ch,vch,0,sn,DAM_BASH,TRUE); - else - damage( ch,vch,level + dice(2, 8), sn, DAM_BASH,TRUE); - } - continue; - } - - if ( vch->in_room->area == ch->in_room->area ) - send_to_char( "The earth trembles and shivers.\n\r", vch ); - } - - return; -} - -void spell_enchant_armor( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - OBJ_DATA *obj = (OBJ_DATA *) vo; - AFFECT_DATA *paf; - int result, fail; - int ac_bonus, added; - bool ac_found = FALSE; - - if (obj->item_type != ITEM_ARMOR) - { - send_to_char("That isn't an armor.\n\r",ch); - return; - } - - if (obj->wear_loc != -1) - { - send_to_char("The item must be carried to be enchanted.\n\r",ch); - return; - } - - /* this means they have no bonus */ - ac_bonus = 0; - fail = 25; /* base 25% chance of failure */ - - /* find the bonuses */ - - if (!obj->enchanted) - for ( paf = obj->pIndexData->affected; paf != NULL; paf = paf->next ) - { - if ( paf->location == APPLY_AC ) - { - ac_bonus = paf->modifier; - ac_found = TRUE; - fail += 5 * (ac_bonus * ac_bonus); - } - - else /* things get a little harder */ - fail += 20; - } - - for ( paf = obj->affected; paf != NULL; paf = paf->next ) - { - if ( paf->location == APPLY_AC ) - { - ac_bonus = paf->modifier; - ac_found = TRUE; - fail += 5 * (ac_bonus * ac_bonus); - } - - else /* things get a little harder */ - fail += 20; - } - - /* apply other modifiers */ - fail -= level; - - if (IS_OBJ_STAT(obj,ITEM_BLESS)) - fail -= 15; - if (IS_OBJ_STAT(obj,ITEM_GLOW)) - fail -= 5; - - fail = URANGE(5,fail,85); - - result = number_percent(); - - /* the moment of truth */ - if (result < (fail / 5)) /* item destroyed */ - { - act("$p flares blindingly... and evaporates!",ch,obj,NULL,TO_CHAR); - act("$p flares blindingly... and evaporates!",ch,obj,NULL,TO_ROOM); - extract_obj(obj); - return; - } - - if (result < (fail / 3)) /* item disenchanted */ - { - AFFECT_DATA *paf_next; - - act("$p glows brightly, then fades...oops.",ch,obj,NULL,TO_CHAR); - act("$p glows brightly, then fades.",ch,obj,NULL,TO_ROOM); - obj->enchanted = TRUE; - - /* remove all affects */ - for (paf = obj->affected; paf != NULL; paf = paf_next) - { - paf_next = paf->next; - free_affect(paf); - } - obj->affected = NULL; - - /* clear all flags */ - obj->extra_flags = 0; - return; - } - - if ( result <= fail ) /* failed, no bad result */ - { - send_to_char("Nothing seemed to happen.\n\r",ch); - return; - } - - /* okay, move all the old flags into new vectors if we have to */ - if (!obj->enchanted) - { - AFFECT_DATA *af_new; - obj->enchanted = TRUE; - - for (paf = obj->pIndexData->affected; paf != NULL; paf = paf->next) - { - af_new = new_affect(); - - af_new->next = obj->affected; - obj->affected = af_new; - - af_new->where = paf->where; - af_new->type = UMAX(0,paf->type); - af_new->level = paf->level; - af_new->duration = paf->duration; - af_new->location = paf->location; - af_new->modifier = paf->modifier; - af_new->bitvector = paf->bitvector; - } - } - - if (result <= (90 - level/5)) /* success! */ - { - act("$p shimmers with a gold aura.",ch,obj,NULL,TO_CHAR); - act("$p shimmers with a gold aura.",ch,obj,NULL,TO_ROOM); - SET_BIT(obj->extra_flags, ITEM_MAGIC); - added = -1; - } - - else /* exceptional enchant */ - { - act("$p glows a brillant gold!",ch,obj,NULL,TO_CHAR); - act("$p glows a brillant gold!",ch,obj,NULL,TO_ROOM); - SET_BIT(obj->extra_flags,ITEM_MAGIC); - SET_BIT(obj->extra_flags,ITEM_GLOW); - added = -2; - } - - /* now add the enchantments */ - - if (obj->level < LEVEL_HERO) - obj->level = UMIN(LEVEL_HERO - 1,obj->level + 1); - - if (ac_found) - { - for ( paf = obj->affected; paf != NULL; paf = paf->next) - { - if ( paf->location == APPLY_AC) - { - paf->type = sn; - paf->modifier += added; - paf->level = UMAX(paf->level,level); - } - } - } - else /* add a new affect */ - { - paf = new_affect(); - - paf->where = TO_OBJECT; - paf->type = sn; - paf->level = level; - paf->duration = -1; - paf->location = APPLY_AC; - paf->modifier = added; - paf->bitvector = 0; - paf->next = obj->affected; - obj->affected = paf; - } - -} - - - - -void spell_enchant_weapon(int sn,int level,CHAR_DATA *ch, void *vo,int target) -{ - OBJ_DATA *obj = (OBJ_DATA *) vo; - AFFECT_DATA *paf; - int result, fail; - int hit_bonus, dam_bonus, added; - bool hit_found = FALSE, dam_found = FALSE; - - if (obj->item_type != ITEM_WEAPON) - { - send_to_char("That isn't a weapon.\n\r",ch); - return; - } - - if (obj->wear_loc != -1) - { - send_to_char("The item must be carried to be enchanted.\n\r",ch); - return; - } - - /* this means they have no bonus */ - hit_bonus = 0; - dam_bonus = 0; - fail = 25; /* base 25% chance of failure */ - - /* find the bonuses */ - - if (!obj->enchanted) - for ( paf = obj->pIndexData->affected; paf != NULL; paf = paf->next ) - { - if ( paf->location == APPLY_HITROLL ) - { - hit_bonus = paf->modifier; - hit_found = TRUE; - fail += 2 * (hit_bonus * hit_bonus); - } - - else if (paf->location == APPLY_DAMROLL ) - { - dam_bonus = paf->modifier; - dam_found = TRUE; - fail += 2 * (dam_bonus * dam_bonus); - } - - else /* things get a little harder */ - fail += 25; - } - - for ( paf = obj->affected; paf != NULL; paf = paf->next ) - { - if ( paf->location == APPLY_HITROLL ) - { - hit_bonus = paf->modifier; - hit_found = TRUE; - fail += 2 * (hit_bonus * hit_bonus); - } - - else if (paf->location == APPLY_DAMROLL ) - { - dam_bonus = paf->modifier; - dam_found = TRUE; - fail += 2 * (dam_bonus * dam_bonus); - } - - else /* things get a little harder */ - fail += 25; - } - - /* apply other modifiers */ - fail -= 3 * level/2; - - if (IS_OBJ_STAT(obj,ITEM_BLESS)) - fail -= 15; - if (IS_OBJ_STAT(obj,ITEM_GLOW)) - fail -= 5; - - fail = URANGE(5,fail,95); - - result = number_percent(); - - /* the moment of truth */ - if (result < (fail / 5)) /* item destroyed */ - { - act("$p shivers violently and explodes!",ch,obj,NULL,TO_CHAR); - act("$p shivers violently and explodeds!",ch,obj,NULL,TO_ROOM); - extract_obj(obj); - return; - } - - if (result < (fail / 2)) /* item disenchanted */ - { - AFFECT_DATA *paf_next; - - act("$p glows brightly, then fades...oops.",ch,obj,NULL,TO_CHAR); - act("$p glows brightly, then fades.",ch,obj,NULL,TO_ROOM); - obj->enchanted = TRUE; - - /* remove all affects */ - for (paf = obj->affected; paf != NULL; paf = paf_next) - { - paf_next = paf->next; - free_affect(paf); - } - obj->affected = NULL; - - /* clear all flags */ - obj->extra_flags = 0; - return; - } - - if ( result <= fail ) /* failed, no bad result */ - { - send_to_char("Nothing seemed to happen.\n\r",ch); - return; - } - - /* okay, move all the old flags into new vectors if we have to */ - if (!obj->enchanted) - { - AFFECT_DATA *af_new; - obj->enchanted = TRUE; - - for (paf = obj->pIndexData->affected; paf != NULL; paf = paf->next) - { - af_new = new_affect(); - - af_new->next = obj->affected; - obj->affected = af_new; - - af_new->where = paf->where; - af_new->type = UMAX(0,paf->type); - af_new->level = paf->level; - af_new->duration = paf->duration; - af_new->location = paf->location; - af_new->modifier = paf->modifier; - af_new->bitvector = paf->bitvector; - } - } - - if (result <= (100 - level/5)) /* success! */ - { - act("$p glows blue.",ch,obj,NULL,TO_CHAR); - act("$p glows blue.",ch,obj,NULL,TO_ROOM); - SET_BIT(obj->extra_flags, ITEM_MAGIC); - added = 1; - } - - else /* exceptional enchant */ - { - act("$p glows a brillant blue!",ch,obj,NULL,TO_CHAR); - act("$p glows a brillant blue!",ch,obj,NULL,TO_ROOM); - SET_BIT(obj->extra_flags,ITEM_MAGIC); - SET_BIT(obj->extra_flags,ITEM_GLOW); - added = 2; - } - - /* now add the enchantments */ - - if (obj->level < LEVEL_HERO - 1) - obj->level = UMIN(LEVEL_HERO - 1,obj->level + 1); - - if (dam_found) - { - for ( paf = obj->affected; paf != NULL; paf = paf->next) - { - if ( paf->location == APPLY_DAMROLL) - { - paf->type = sn; - paf->modifier += added; - paf->level = UMAX(paf->level,level); - if (paf->modifier > 4) - SET_BIT(obj->extra_flags,ITEM_HUM); - } - } - } - else /* add a new affect */ - { - paf = new_affect(); - - paf->where = TO_OBJECT; - paf->type = sn; - paf->level = level; - paf->duration = -1; - paf->location = APPLY_DAMROLL; - paf->modifier = added; - paf->bitvector = 0; - paf->next = obj->affected; - obj->affected = paf; - } - - if (hit_found) - { - for ( paf = obj->affected; paf != NULL; paf = paf->next) - { - if ( paf->location == APPLY_HITROLL) - { - paf->type = sn; - paf->modifier += added; - paf->level = UMAX(paf->level,level); - if (paf->modifier > 4) - SET_BIT(obj->extra_flags,ITEM_HUM); - } - } - } - else /* add a new affect */ - { - paf = new_affect(); - - paf->type = sn; - paf->level = level; - paf->duration = -1; - paf->location = APPLY_HITROLL; - paf->modifier = added; - paf->bitvector = 0; - paf->next = obj->affected; - obj->affected = paf; - } - -} - - - -/* - * Drain XP, MANA, HP. - * Caster gains HP. - */ -void spell_energy_drain( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int dam; - - if (victim != ch) - ch->alignment = UMAX(-1000, ch->alignment - 50); - - if ( saves_spell( level, victim,DAM_NEGATIVE) ) - { - send_to_char("You feel a momentary chill.\n\r",victim); - return; - } - - - if ( victim->level <= 2 ) - { - dam = ch->hit + 1; - } - else - { - gain_exp( victim, 0 - number_range( level/2, 3 * level / 2 ) ); - victim->mana /= 2; - victim->move /= 2; - dam = dice(1, level); - ch->hit += dam; - } - - send_to_char("You feel your life slipping away!\n\r",victim); - send_to_char("Wow....what a rush!\n\r",ch); - damage( ch, victim, dam, sn, DAM_NEGATIVE ,TRUE); - - return; -} - - - -void spell_fireball( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - static const sh_int dam_each[] = - { - 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 30, 35, 40, 45, 50, 55, - 60, 65, 70, 75, 80, 82, 84, 86, 88, 90, - 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, - 112, 114, 116, 118, 120, 122, 124, 126, 128, 130 - }; - int dam; - - level = UMIN(level, sizeof(dam_each)/sizeof(dam_each[0]) - 1); - level = UMAX(0, level); - dam = number_range( dam_each[level] / 2, dam_each[level] * 2 ); - if ( saves_spell( level, victim, DAM_FIRE) ) - dam /= 2; - damage( ch, victim, dam, sn, DAM_FIRE ,TRUE); - return; -} - - -void spell_fireproof(int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - OBJ_DATA *obj = (OBJ_DATA *) vo; - AFFECT_DATA af; - - if (IS_OBJ_STAT(obj,ITEM_BURN_PROOF)) - { - act("$p is already protected from burning.",ch,obj,NULL,TO_CHAR); - return; - } - - af.where = TO_OBJECT; - af.type = sn; - af.level = level; - af.duration = number_fuzzy(level / 4); - af.location = APPLY_NONE; - af.modifier = 0; - af.bitvector = ITEM_BURN_PROOF; - - affect_to_obj(obj,&af); - - act("You protect $p from fire.",ch,obj,NULL,TO_CHAR); - act("$p is surrounded by a protective aura.",ch,obj,NULL,TO_ROOM); -} - - - -void spell_flamestrike( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int dam; - - dam = dice(6 + level / 2, 8); - if ( saves_spell( level, victim,DAM_FIRE) ) - dam /= 2; - damage( ch, victim, dam, sn, DAM_FIRE ,TRUE); - return; -} - - - -void spell_faerie_fire( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( IS_AFFECTED(victim, AFF_FAERIE_FIRE) ) - return; - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level; - af.location = APPLY_AC; - af.modifier = 2 * level; - af.bitvector = AFF_FAERIE_FIRE; - affect_to_char( victim, &af ); - send_to_char( "You are surrounded by a pink outline.\n\r", victim ); - act( "$n is surrounded by a pink outline.", victim, NULL, NULL, TO_ROOM ); - return; -} - - - -void spell_faerie_fog( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *ich; - - act( "$n conjures a cloud of purple smoke.", ch, NULL, NULL, TO_ROOM ); - send_to_char( "You conjure a cloud of purple smoke.\n\r", ch ); - - for ( ich = ch->in_room->people; ich != NULL; ich = ich->next_in_room ) - { - if (ich->invis_level > 0) - continue; - - if ( ich == ch || saves_spell( level, ich,DAM_OTHER) ) - continue; - - affect_strip ( ich, gsn_invis ); - affect_strip ( ich, gsn_mass_invis ); - affect_strip ( ich, gsn_sneak ); - REMOVE_BIT ( ich->affected_by, AFF_HIDE ); - REMOVE_BIT ( ich->affected_by, AFF_INVISIBLE ); - REMOVE_BIT ( ich->affected_by, AFF_SNEAK ); - act( "$n is revealed!", ich, NULL, NULL, TO_ROOM ); - send_to_char( "You are revealed!\n\r", ich ); - } - - return; -} - -void spell_floating_disc( int sn, int level,CHAR_DATA *ch,void *vo,int target ) -{ - OBJ_DATA *disc, *floating; - - floating = get_eq_char(ch,WEAR_FLOAT); - if (floating != NULL && IS_OBJ_STAT(floating,ITEM_NOREMOVE)) - { - act("You can't remove $p.",ch,floating,NULL,TO_CHAR); - return; - } - - disc = create_object(get_obj_index(OBJ_VNUM_DISC), 0); - disc->value[0] = ch->level * 10; /* 10 pounds per level capacity */ - disc->value[3] = ch->level * 5; /* 5 pounds per level max per item */ - disc->timer = ch->level * 2 - number_range(0,level / 2); - - act("$n has created a floating black disc.",ch,NULL,NULL,TO_ROOM); - send_to_char("You create a floating disc.\n\r",ch); - obj_to_char(disc,ch); - wear_obj(ch,disc,TRUE); - return; -} - - -void spell_fly( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( IS_AFFECTED(victim, AFF_FLYING) ) - { - if (victim == ch) - send_to_char("You are already airborne.\n\r",ch); - else - act("$N doesn't need your help to fly.",ch,NULL,victim,TO_CHAR); - return; - } - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level + 3; - af.location = 0; - af.modifier = 0; - af.bitvector = AFF_FLYING; - affect_to_char( victim, &af ); - send_to_char( "Your feet rise off the ground.\n\r", victim ); - act( "$n's feet rise off the ground.", victim, NULL, NULL, TO_ROOM ); - return; -} - -/* RT clerical berserking spell */ - -void spell_frenzy(int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if (is_affected(victim,sn) || IS_AFFECTED(victim,AFF_BERSERK)) - { - if (victim == ch) - send_to_char("You are already in a frenzy.\n\r",ch); - else - act("$N is already in a frenzy.",ch,NULL,victim,TO_CHAR); - return; - } - - if (is_affected(victim,skill_lookup("calm"))) - { - if (victim == ch) - send_to_char("Why don't you just relax for a while?\n\r",ch); - else - act("$N doesn't look like $e wants to fight anymore.", - ch,NULL,victim,TO_CHAR); - return; - } - - if ((IS_GOOD(ch) && !IS_GOOD(victim)) || - (IS_NEUTRAL(ch) && !IS_NEUTRAL(victim)) || - (IS_EVIL(ch) && !IS_EVIL(victim)) - ) - { - act("Your god doesn't seem to like $N",ch,NULL,victim,TO_CHAR); - return; - } - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level / 3; - af.modifier = level / 6; - af.bitvector = 0; - - af.location = APPLY_HITROLL; - affect_to_char(victim,&af); - - af.location = APPLY_DAMROLL; - affect_to_char(victim,&af); - - af.modifier = 10 * (level / 12); - af.location = APPLY_AC; - affect_to_char(victim,&af); - - send_to_char("You are filled with holy wrath!\n\r",victim); - act("$n gets a wild look in $s eyes!",victim,NULL,NULL,TO_ROOM); -} - -/* RT ROM-style gate */ - -void spell_gate( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim; - bool gate_pet; - - if ( ( victim = get_char_world( ch, target_name ) ) == NULL - || victim == ch - || victim->in_room == NULL - || !can_see_room(ch,victim->in_room) - || IS_SET(victim->in_room->room_flags, ROOM_SAFE) - || IS_SET(victim->in_room->room_flags, ROOM_PRIVATE) - || IS_SET(victim->in_room->room_flags, ROOM_SOLITARY) - || IS_SET(victim->in_room->room_flags, ROOM_NO_RECALL) - || IS_SET(ch->in_room->room_flags, ROOM_NO_RECALL) - || victim->level >= level + 3 - || (is_clan(victim) && !is_same_clan(ch,victim)) - || (!IS_NPC(victim) && victim->level >= LEVEL_HERO) /* NOT trust */ - || (IS_NPC(victim) && IS_SET(victim->imm_flags,IMM_SUMMON)) - || (IS_NPC(victim) && saves_spell( level, victim,DAM_OTHER) ) ) - { - send_to_char( "You failed.\n\r", ch ); - return; - } - if (ch->pet != NULL && ch->in_room == ch->pet->in_room) - gate_pet = TRUE; - else - gate_pet = FALSE; - - act("$n steps through a gate and vanishes.",ch,NULL,NULL,TO_ROOM); - send_to_char("You step through a gate and vanish.\n\r",ch); - char_from_room(ch); - char_to_room(ch,victim->in_room); - - act("$n has arrived through a gate.",ch,NULL,NULL,TO_ROOM); - do_function(ch, &do_look, "auto"); - - if (gate_pet) - { - act("$n steps through a gate and vanishes.",ch->pet,NULL,NULL,TO_ROOM); - send_to_char("You step through a gate and vanish.\n\r",ch->pet); - char_from_room(ch->pet); - char_to_room(ch->pet,victim->in_room); - act("$n has arrived through a gate.",ch->pet,NULL,NULL,TO_ROOM); - do_function(ch->pet, &do_look, "auto"); - } -} - - - -void spell_giant_strength(int sn,int level,CHAR_DATA *ch,void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( is_affected( victim, sn ) ) - { - if (victim == ch) - send_to_char("You are already as strong as you can get!\n\r",ch); - else - act("$N can't get any stronger.",ch,NULL,victim,TO_CHAR); - return; - } - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level; - af.location = APPLY_STR; - af.modifier = 1 + (level >= 18) + (level >= 25) + (level >= 32); - af.bitvector = 0; - affect_to_char( victim, &af ); - send_to_char( "Your muscles surge with heightened power!\n\r", victim ); - act("$n's muscles surge with heightened power.",victim,NULL,NULL,TO_ROOM); - return; -} - - - -void spell_harm( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int dam; - - dam = UMAX( 20, victim->hit - dice(1,4) ); - if ( saves_spell( level, victim,DAM_HARM) ) - dam = UMIN( 50, dam / 2 ); - dam = UMIN( 100, dam ); - damage( ch, victim, dam, sn, DAM_HARM ,TRUE); - return; -} - -/* RT haste spell */ - -void spell_haste( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( is_affected( victim, sn ) || IS_AFFECTED(victim,AFF_HASTE) - || IS_SET(victim->off_flags,OFF_FAST)) - { - if (victim == ch) - send_to_char("You can't move any faster!\n\r",ch); - else - act("$N is already moving as fast as $E can.", - ch,NULL,victim,TO_CHAR); - return; - } - - if (IS_AFFECTED(victim,AFF_SLOW)) - { - if (!check_dispel(level,victim,skill_lookup("slow"))) - { - if (victim != ch) - send_to_char("Spell failed.\n\r",ch); - send_to_char("You feel momentarily faster.\n\r",victim); - return; - } - act("$n is moving less slowly.",victim,NULL,NULL,TO_ROOM); - return; - } - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - if (victim == ch) - af.duration = level/2; - else - af.duration = level/4; - af.location = APPLY_DEX; - af.modifier = 1 + (level >= 18) + (level >= 25) + (level >= 32); - af.bitvector = AFF_HASTE; - affect_to_char( victim, &af ); - send_to_char( "You feel yourself moving more quickly.\n\r", victim ); - act("$n is moving more quickly.",victim,NULL,NULL,TO_ROOM); - if ( ch != victim ) - send_to_char( "Ok.\n\r", ch ); - return; -} - - - -void spell_heal( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - victim->hit = UMIN( victim->hit + 100, victim->max_hit ); - update_pos( victim ); - send_to_char( "A warm feeling fills your body.\n\r", victim ); - if ( ch != victim ) - send_to_char( "Ok.\n\r", ch ); - return; -} - -void spell_heat_metal( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - OBJ_DATA *obj_lose, *obj_next; - int dam = 0; - bool fail = TRUE; - - if (!saves_spell(level + 2,victim,DAM_FIRE) - && !IS_SET(victim->imm_flags,IMM_FIRE)) - { - for ( obj_lose = victim->carrying; - obj_lose != NULL; - obj_lose = obj_next) - { - obj_next = obj_lose->next_content; - if ( number_range(1,2 * level) > obj_lose->level - && !saves_spell(level,victim,DAM_FIRE) - && !IS_OBJ_STAT(obj_lose,ITEM_NONMETAL) - && !IS_OBJ_STAT(obj_lose,ITEM_BURN_PROOF)) - { - switch ( obj_lose->item_type ) - { - case ITEM_ARMOR: - if (obj_lose->wear_loc != -1) /* remove the item */ - { - if (can_drop_obj(victim,obj_lose) - && (obj_lose->weight / 10) < - number_range(1,2 * get_curr_stat(victim,STAT_DEX)) - && remove_obj( victim, obj_lose->wear_loc, TRUE )) - { - act("$n yelps and throws $p to the ground!", - victim,obj_lose,NULL,TO_ROOM); - act("You remove and drop $p before it burns you.", - victim,obj_lose,NULL,TO_CHAR); - dam += (number_range(1,obj_lose->level) / 3); - obj_from_char(obj_lose); - obj_to_room(obj_lose, victim->in_room); - fail = FALSE; - } - else /* stuck on the body! ouch! */ - { - act("Your skin is seared by $p!", - victim,obj_lose,NULL,TO_CHAR); - dam += (number_range(1,obj_lose->level)); - fail = FALSE; - } - - } - else /* drop it if we can */ - { - if (can_drop_obj(victim,obj_lose)) - { - act("$n yelps and throws $p to the ground!", - victim,obj_lose,NULL,TO_ROOM); - act("You and drop $p before it burns you.", - victim,obj_lose,NULL,TO_CHAR); - dam += (number_range(1,obj_lose->level) / 6); - obj_from_char(obj_lose); - obj_to_room(obj_lose, victim->in_room); - fail = FALSE; - } - else /* cannot drop */ - { - act("Your skin is seared by $p!", - victim,obj_lose,NULL,TO_CHAR); - dam += (number_range(1,obj_lose->level) / 2); - fail = FALSE; - } - } - break; - case ITEM_WEAPON: - if (obj_lose->wear_loc != -1) /* try to drop it */ - { - if (IS_WEAPON_STAT(obj_lose,WEAPON_FLAMING)) - continue; - - if (can_drop_obj(victim,obj_lose) - && remove_obj(victim,obj_lose->wear_loc,TRUE)) - { - act("$n is burned by $p, and throws it to the ground.", - victim,obj_lose,NULL,TO_ROOM); - send_to_char( - "You throw your red-hot weapon to the ground!\n\r", - victim); - dam += 1; - obj_from_char(obj_lose); - obj_to_room(obj_lose,victim->in_room); - fail = FALSE; - } - else /* YOWCH! */ - { - send_to_char("Your weapon sears your flesh!\n\r", - victim); - dam += number_range(1,obj_lose->level); - fail = FALSE; - } - } - else /* drop it if we can */ - { - if (can_drop_obj(victim,obj_lose)) - { - act("$n throws a burning hot $p to the ground!", - victim,obj_lose,NULL,TO_ROOM); - act("You and drop $p before it burns you.", - victim,obj_lose,NULL,TO_CHAR); - dam += (number_range(1,obj_lose->level) / 6); - obj_from_char(obj_lose); - obj_to_room(obj_lose, victim->in_room); - fail = FALSE; - } - else /* cannot drop */ - { - act("Your skin is seared by $p!", - victim,obj_lose,NULL,TO_CHAR); - dam += (number_range(1,obj_lose->level) / 2); - fail = FALSE; - } - } - break; - } - } - } - } - if (fail) - { - send_to_char("Your spell had no effect.\n\r", ch); - send_to_char("You feel momentarily warmer.\n\r",victim); - } - else /* damage! */ - { - if (saves_spell(level,victim,DAM_FIRE)) - dam = 2 * dam / 3; - damage(ch,victim,dam,sn,DAM_FIRE,TRUE); - } -} - -/* RT really nasty high-level attack spell */ -void spell_holy_word(int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *vch; - CHAR_DATA *vch_next; - int dam; - int bless_num, curse_num, frenzy_num; - - bless_num = skill_lookup("bless"); - curse_num = skill_lookup("curse"); - frenzy_num = skill_lookup("frenzy"); - - act("$n utters a word of divine power!",ch,NULL,NULL,TO_ROOM); - send_to_char("You utter a word of divine power.\n\r",ch); - - for ( vch = ch->in_room->people; vch != NULL; vch = vch_next ) - { - vch_next = vch->next_in_room; - - if ((IS_GOOD(ch) && IS_GOOD(vch)) || - (IS_EVIL(ch) && IS_EVIL(vch)) || - (IS_NEUTRAL(ch) && IS_NEUTRAL(vch)) ) - { - send_to_char("You feel full more powerful.\n\r",vch); - spell_frenzy(frenzy_num,level,ch,(void *) vch,TARGET_CHAR); - spell_bless(bless_num,level,ch,(void *) vch,TARGET_CHAR); - } - - else if ((IS_GOOD(ch) && IS_EVIL(vch)) || - (IS_EVIL(ch) && IS_GOOD(vch)) ) - { - if (!is_safe_spell(ch,vch,TRUE)) - { - spell_curse(curse_num,level,ch,(void *) vch,TARGET_CHAR); - send_to_char("You are struck down!\n\r",vch); - dam = dice(level,6); - damage(ch,vch,dam,sn,DAM_ENERGY,TRUE); - } - } - - else if (IS_NEUTRAL(ch)) - { - if (!is_safe_spell(ch,vch,TRUE)) - { - spell_curse(curse_num,level/2,ch,(void *) vch,TARGET_CHAR); - send_to_char("You are struck down!\n\r",vch); - dam = dice(level,4); - damage(ch,vch,dam,sn,DAM_ENERGY,TRUE); - } - } - } - - send_to_char("You feel drained.\n\r",ch); - ch->move = 0; - ch->hit /= 2; -} - -void spell_identify( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - OBJ_DATA *obj = (OBJ_DATA *) vo; - char buf[MAX_STRING_LENGTH]; - AFFECT_DATA *paf; - - sprintf( buf, - "Object '%s' is type %s, extra flags %s.\n\rWeight is %d, value is %d, level is %d.\n\r", - - obj->name, - item_name(obj->item_type), - extra_bit_name( obj->extra_flags ), - obj->weight / 10, - obj->cost, - obj->level - ); - send_to_char( buf, ch ); - - switch ( obj->item_type ) - { - case ITEM_SCROLL: - case ITEM_POTION: - case ITEM_PILL: - sprintf( buf, "Level %d spells of:", obj->value[0] ); - send_to_char( buf, ch ); - - if ( obj->value[1] >= 0 && obj->value[1] < MAX_SKILL ) - { - send_to_char( " '", ch ); - send_to_char( skill_table[obj->value[1]].name, ch ); - send_to_char( "'", ch ); - } - - if ( obj->value[2] >= 0 && obj->value[2] < MAX_SKILL ) - { - send_to_char( " '", ch ); - send_to_char( skill_table[obj->value[2]].name, ch ); - send_to_char( "'", ch ); - } - - if ( obj->value[3] >= 0 && obj->value[3] < MAX_SKILL ) - { - send_to_char( " '", ch ); - send_to_char( skill_table[obj->value[3]].name, ch ); - send_to_char( "'", ch ); - } - - if (obj->value[4] >= 0 && obj->value[4] < MAX_SKILL) - { - send_to_char(" '",ch); - send_to_char(skill_table[obj->value[4]].name,ch); - send_to_char("'",ch); - } - - send_to_char( ".\n\r", ch ); - break; - - case ITEM_WAND: - case ITEM_STAFF: - sprintf( buf, "Has %d charges of level %d", - obj->value[2], obj->value[0] ); - send_to_char( buf, ch ); - - if ( obj->value[3] >= 0 && obj->value[3] < MAX_SKILL ) - { - send_to_char( " '", ch ); - send_to_char( skill_table[obj->value[3]].name, ch ); - send_to_char( "'", ch ); - } - - send_to_char( ".\n\r", ch ); - break; - - case ITEM_DRINK_CON: - sprintf(buf,"It holds %s-colored %s.\n\r", - liq_table[obj->value[2]].liq_color, - liq_table[obj->value[2]].liq_name); - send_to_char(buf,ch); - break; - - case ITEM_CONTAINER: - sprintf(buf,"Capacity: %d# Maximum weight: %d# flags: %s\n\r", - obj->value[0], obj->value[3], cont_bit_name(obj->value[1])); - send_to_char(buf,ch); - if (obj->value[4] != 100) - { - sprintf(buf,"Weight multiplier: %d%%\n\r", - obj->value[4]); - send_to_char(buf,ch); - } - 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/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) - sprintf(buf,"Damage is %dd%d (average %d).\n\r", - obj->value[1],obj->value[2], - (1 + obj->value[2]) * obj->value[1] / 2); - else - sprintf( buf, "Damage is %d to %d (average %d).\n\r", - obj->value[1], obj->value[2], - ( obj->value[1] + obj->value[2] ) / 2 ); - send_to_char( buf, ch ); - if (obj->value[4]) /* weapon flags */ - { - sprintf(buf,"Weapons flags: %s\n\r",weapon_bit_name(obj->value[4])); - send_to_char(buf,ch); - } - break; - - case ITEM_ARMOR: - sprintf( buf, - "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] ); - send_to_char( buf, ch ); - break; - } - - if (!obj->enchanted) - for ( paf = obj->pIndexData->affected; paf != NULL; paf = paf->next ) - { - if ( paf->location != APPLY_NONE && paf->modifier != 0 ) - { - sprintf( buf, "Affects %s by %d.\n\r", - affect_loc_name( paf->location ), paf->modifier ); - send_to_char(buf,ch); - if (paf->bitvector) - { - switch(paf->where) - { - case TO_AFFECTS: - sprintf(buf,"Adds %s affect.\n", - affect_bit_name(paf->bitvector)); - break; - case TO_OBJECT: - sprintf(buf,"Adds %s object flag.\n", - extra_bit_name(paf->bitvector)); - break; - case TO_IMMUNE: - sprintf(buf,"Adds immunity to %s.\n", - imm_bit_name(paf->bitvector)); - break; - case TO_RESIST: - sprintf(buf,"Adds resistance to %s.\n\r", - imm_bit_name(paf->bitvector)); - break; - case TO_VULN: - sprintf(buf,"Adds vulnerability to %s.\n\r", - imm_bit_name(paf->bitvector)); - break; - default: - sprintf(buf,"Unknown bit %d: %d\n\r", - paf->where,paf->bitvector); - break; - } - send_to_char( buf, ch ); - } - } - } - - for ( paf = obj->affected; paf != NULL; paf = paf->next ) - { - if ( paf->location != APPLY_NONE && paf->modifier != 0 ) - { - sprintf( buf, "Affects %s by %d", - affect_loc_name( paf->location ), paf->modifier ); - send_to_char( buf, ch ); - if ( paf->duration > -1) - sprintf(buf,", %d hours.\n\r",paf->duration); - else - sprintf(buf,".\n\r"); - send_to_char(buf,ch); - if (paf->bitvector) - { - switch(paf->where) - { - case TO_AFFECTS: - sprintf(buf,"Adds %s affect.\n", - affect_bit_name(paf->bitvector)); - break; - case TO_OBJECT: - sprintf(buf,"Adds %s object flag.\n", - extra_bit_name(paf->bitvector)); - break; - case TO_WEAPON: - sprintf(buf,"Adds %s weapon flags.\n", - weapon_bit_name(paf->bitvector)); - break; - case TO_IMMUNE: - sprintf(buf,"Adds immunity to %s.\n", - imm_bit_name(paf->bitvector)); - break; - case TO_RESIST: - sprintf(buf,"Adds resistance to %s.\n\r", - imm_bit_name(paf->bitvector)); - break; - case TO_VULN: - sprintf(buf,"Adds vulnerability to %s.\n\r", - imm_bit_name(paf->bitvector)); - break; - default: - sprintf(buf,"Unknown bit %d: %d\n\r", - paf->where,paf->bitvector); - break; - } - send_to_char(buf,ch); - } - } - } - - return; -} - - - -void spell_infravision( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( IS_AFFECTED(victim, AFF_INFRARED) ) - { - if (victim == ch) - send_to_char("You can already see in the dark.\n\r",ch); - else - act("$N already has infravision.\n\r",ch,NULL,victim,TO_CHAR); - return; - } - act( "$n's eyes glow red.\n\r", ch, NULL, NULL, TO_ROOM ); - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = 2 * level; - af.location = APPLY_NONE; - af.modifier = 0; - af.bitvector = AFF_INFRARED; - affect_to_char( victim, &af ); - send_to_char( "Your eyes glow red.\n\r", victim ); - return; -} - - - -void spell_invis( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim; - OBJ_DATA *obj; - AFFECT_DATA af; - - /* object invisibility */ - if (target == TARGET_OBJ) - { - obj = (OBJ_DATA *) vo; - - if (IS_OBJ_STAT(obj,ITEM_INVIS)) - { - act("$p is already invisible.",ch,obj,NULL,TO_CHAR); - return; - } - - af.where = TO_OBJECT; - af.type = sn; - af.level = level; - af.duration = level + 12; - af.location = APPLY_NONE; - af.modifier = 0; - af.bitvector = ITEM_INVIS; - affect_to_obj(obj,&af); - - act("$p fades out of sight.",ch,obj,NULL,TO_ALL); - return; - } - - /* character invisibility */ - victim = (CHAR_DATA *) vo; - - if ( IS_AFFECTED(victim, AFF_INVISIBLE) ) - return; - - act( "$n fades out of existence.", victim, NULL, NULL, TO_ROOM ); - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level + 12; - af.location = APPLY_NONE; - af.modifier = 0; - af.bitvector = AFF_INVISIBLE; - affect_to_char( victim, &af ); - send_to_char( "You fade out of existence.\n\r", victim ); - return; -} - - - -void spell_know_alignment(int sn,int level,CHAR_DATA *ch,void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - char *msg; - int ap; - - ap = victim->alignment; - - if ( ap > 700 ) msg = "$N has a pure and good aura."; - else if ( ap > 350 ) msg = "$N is of excellent moral character."; - else if ( ap > 100 ) msg = "$N is often kind and thoughtful."; - else if ( ap > -100 ) msg = "$N doesn't have a firm moral commitment."; - else if ( ap > -350 ) msg = "$N lies to $S friends."; - else if ( ap > -700 ) msg = "$N is a black-hearted murderer."; - else msg = "$N is the embodiment of pure evil!."; - - act( msg, ch, NULL, victim, TO_CHAR ); - return; -} - - - -void spell_lightning_bolt(int sn,int level,CHAR_DATA *ch,void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - static const sh_int dam_each[] = - { - 0, - 0, 0, 0, 0, 0, 0, 0, 0, 25, 28, - 31, 34, 37, 40, 40, 41, 42, 42, 43, 44, - 44, 45, 46, 46, 47, 48, 48, 49, 50, 50, - 51, 52, 52, 53, 54, 54, 55, 56, 56, 57, - 58, 58, 59, 60, 60, 61, 62, 62, 63, 64 - }; - int dam; - - level = UMIN(level, sizeof(dam_each)/sizeof(dam_each[0]) - 1); - level = UMAX(0, level); - dam = number_range( dam_each[level] / 2, dam_each[level] * 2 ); - if ( saves_spell( level, victim,DAM_LIGHTNING) ) - dam /= 2; - damage( ch, victim, dam, sn, DAM_LIGHTNING ,TRUE); - return; -} - - - -void spell_locate_object( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - char buf[MAX_INPUT_LENGTH]; - BUFFER *buffer; - OBJ_DATA *obj; - OBJ_DATA *in_obj; - bool found; - int number = 0, max_found; - - found = FALSE; - number = 0; - max_found = IS_IMMORTAL(ch) ? 200 : 2 * level; - - buffer = new_buf(); - - for ( obj = object_list; obj != NULL; obj = obj->next ) - { - if ( !can_see_obj( ch, obj ) || !is_name( target_name, obj->name ) - || IS_OBJ_STAT(obj,ITEM_NOLOCATE) || number_percent() > 2 * level - || ch->level < obj->level) - continue; - - 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)) - { - sprintf( buf, "one is carried by %s\n\r", - PERS(in_obj->carried_by, ch) ); - } - else - { - if (IS_IMMORTAL(ch) && in_obj->in_room != NULL) - sprintf( buf, "one is in %s [Room %d]\n\r", - in_obj->in_room->name, in_obj->in_room->vnum); - else - sprintf( buf, "one is in %s\n\r", - in_obj->in_room == NULL - ? "somewhere" : in_obj->in_room->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); - - return; -} - - - -void spell_magic_missile( int sn, int level, CHAR_DATA *ch,void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - static const sh_int dam_each[] = - { - 0, - 3, 3, 4, 4, 5, 6, 6, 6, 6, 6, - 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, - 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, - 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, - 13, 13, 13, 13, 13, 14, 14, 14, 14, 14 - }; - int dam; - - level = UMIN(level, sizeof(dam_each)/sizeof(dam_each[0]) - 1); - level = UMAX(0, level); - dam = number_range( dam_each[level] / 2, dam_each[level] * 2 ); - if ( saves_spell( level, victim,DAM_ENERGY) ) - dam /= 2; - damage( ch, victim, dam, sn, DAM_ENERGY ,TRUE); - return; -} - -void spell_mass_healing(int sn, int level, CHAR_DATA *ch, void *vo, int target) -{ - CHAR_DATA *gch; - int heal_num, refresh_num; - - heal_num = skill_lookup("heal"); - refresh_num = skill_lookup("refresh"); - - for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room ) - { - if ((IS_NPC(ch) && IS_NPC(gch)) || - (!IS_NPC(ch) && !IS_NPC(gch))) - { - spell_heal(heal_num,level,ch,(void *) gch,TARGET_CHAR); - spell_refresh(refresh_num,level,ch,(void *) gch,TARGET_CHAR); - } - } -} - - -void spell_mass_invis( int sn, int level, CHAR_DATA *ch, void *vo, int target ) -{ - AFFECT_DATA af; - CHAR_DATA *gch; - - for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room ) - { - if ( !is_same_group( gch, ch ) || IS_AFFECTED(gch, AFF_INVISIBLE) ) - continue; - act( "$n slowly fades out of existence.", gch, NULL, NULL, TO_ROOM ); - send_to_char( "You slowly fade out of existence.\n\r", gch ); - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level/2; - af.duration = 24; - af.location = APPLY_NONE; - af.modifier = 0; - af.bitvector = AFF_INVISIBLE; - affect_to_char( gch, &af ); - } - send_to_char( "Ok.\n\r", ch ); - - return; -} - - - -void spell_null( int sn, int level, CHAR_DATA *ch, void *vo, int target ) -{ - send_to_char( "That's not a spell!\n\r", ch ); - return; -} - - - -void spell_pass_door( int sn, int level, CHAR_DATA *ch, void *vo, int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( IS_AFFECTED(victim, AFF_PASS_DOOR) ) - { - if (victim == ch) - send_to_char("You are already out of phase.\n\r",ch); - else - act("$N is already shifted out of phase.",ch,NULL,victim,TO_CHAR); - return; - } - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = number_fuzzy( level / 4 ); - af.location = APPLY_NONE; - af.modifier = 0; - af.bitvector = AFF_PASS_DOOR; - affect_to_char( victim, &af ); - act( "$n turns translucent.", victim, NULL, NULL, TO_ROOM ); - send_to_char( "You turn translucent.\n\r", victim ); - return; -} - -/* RT plague spell, very nasty */ - -void spell_plague( int sn, int level, CHAR_DATA *ch, void *vo, int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if (saves_spell(level,victim,DAM_DISEASE) || - (IS_NPC(victim) && IS_SET(victim->act,ACT_UNDEAD))) - { - if (ch == victim) - send_to_char("You feel momentarily ill, but it passes.\n\r",ch); - else - act("$N seems to be unaffected.",ch,NULL,victim,TO_CHAR); - return; - } - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level * 3/4; - af.duration = level; - af.location = APPLY_STR; - af.modifier = -5; - af.bitvector = AFF_PLAGUE; - affect_join(victim,&af); - - send_to_char - ("You scream in agony as plague sores erupt from your skin.\n\r",victim); - act("$n screams in agony as plague sores erupt from $s skin.", - victim,NULL,NULL,TO_ROOM); -} - -void spell_poison( int sn, int level, CHAR_DATA *ch, void *vo, int target ) -{ - CHAR_DATA *victim; - OBJ_DATA *obj; - AFFECT_DATA af; - - - if (target == TARGET_OBJ) - { - obj = (OBJ_DATA *) vo; - - if (obj->item_type == ITEM_FOOD || obj->item_type == ITEM_DRINK_CON) - { - if (IS_OBJ_STAT(obj,ITEM_BLESS) || IS_OBJ_STAT(obj,ITEM_BURN_PROOF)) - { - act("Your spell fails to corrupt $p.",ch,obj,NULL,TO_CHAR); - return; - } - obj->value[3] = 1; - act("$p is infused with poisonous vapors.",ch,obj,NULL,TO_ALL); - return; - } - - if (obj->item_type == ITEM_WEAPON) - { - if (IS_WEAPON_STAT(obj,WEAPON_FLAMING) - || IS_WEAPON_STAT(obj,WEAPON_FROST) - || IS_WEAPON_STAT(obj,WEAPON_VAMPIRIC) - || IS_WEAPON_STAT(obj,WEAPON_SHARP) - || IS_WEAPON_STAT(obj,WEAPON_VORPAL) - || IS_WEAPON_STAT(obj,WEAPON_SHOCKING) - || IS_OBJ_STAT(obj,ITEM_BLESS) || IS_OBJ_STAT(obj,ITEM_BURN_PROOF)) - { - act("You can't seem to envenom $p.",ch,obj,NULL,TO_CHAR); - return; - } - - if (IS_WEAPON_STAT(obj,WEAPON_POISON)) - { - act("$p is already envenomed.",ch,obj,NULL,TO_CHAR); - return; - } - - af.where = TO_WEAPON; - af.type = sn; - af.level = level / 2; - af.duration = level/8; - af.location = 0; - af.modifier = 0; - af.bitvector = WEAPON_POISON; - affect_to_obj(obj,&af); - - act("$p is coated with deadly venom.",ch,obj,NULL,TO_ALL); - return; - } - - act("You can't poison $p.",ch,obj,NULL,TO_CHAR); - return; - } - - victim = (CHAR_DATA *) vo; - - if ( saves_spell( level, victim,DAM_POISON) ) - { - act("$n turns slightly green, but it passes.",victim,NULL,NULL,TO_ROOM); - send_to_char("You feel momentarily ill, but it passes.\n\r",victim); - return; - } - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level; - af.location = APPLY_STR; - af.modifier = -2; - af.bitvector = AFF_POISON; - affect_join( victim, &af ); - send_to_char( "You feel very sick.\n\r", victim ); - act("$n looks very ill.",victim,NULL,NULL,TO_ROOM); - return; -} - - - -void spell_protection_evil(int sn,int level,CHAR_DATA *ch,void *vo, int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( IS_AFFECTED(victim, AFF_PROTECT_EVIL) - || IS_AFFECTED(victim, AFF_PROTECT_GOOD)) - { - if (victim == ch) - send_to_char("You are already protected.\n\r",ch); - else - act("$N is already protected.",ch,NULL,victim,TO_CHAR); - return; - } - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = 24; - af.location = APPLY_SAVING_SPELL; - af.modifier = -1; - af.bitvector = AFF_PROTECT_EVIL; - affect_to_char( victim, &af ); - send_to_char( "You feel holy and pure.\n\r", victim ); - if ( ch != victim ) - act("$N is protected from evil.",ch,NULL,victim,TO_CHAR); - return; -} - -void spell_protection_good(int sn,int level,CHAR_DATA *ch,void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( IS_AFFECTED(victim, AFF_PROTECT_GOOD) - || IS_AFFECTED(victim, AFF_PROTECT_EVIL)) - { - if (victim == ch) - send_to_char("You are already protected.\n\r",ch); - else - act("$N is already protected.",ch,NULL,victim,TO_CHAR); - return; - } - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = 24; - af.location = APPLY_SAVING_SPELL; - af.modifier = -1; - af.bitvector = AFF_PROTECT_GOOD; - affect_to_char( victim, &af ); - send_to_char( "You feel aligned with darkness.\n\r", victim ); - if ( ch != victim ) - act("$N is protected from good.",ch,NULL,victim,TO_CHAR); - return; -} - - -void spell_ray_of_truth (int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int dam, align; - - if (IS_EVIL(ch) ) - { - victim = ch; - send_to_char("The energy explodes inside you!\n\r",ch); - } - - if (victim != ch) - { - act("$n raises $s hand, and a blinding ray of light shoots forth!", - ch,NULL,NULL,TO_ROOM); - send_to_char( - "You raise your hand and a blinding ray of light shoots forth!\n\r", - ch); - } - - if (IS_GOOD(victim)) - { - act("$n seems unharmed by the light.",victim,NULL,victim,TO_ROOM); - send_to_char("The light seems powerless to affect you.\n\r",victim); - return; - } - - dam = dice( level, 10 ); - if ( saves_spell( level, victim,DAM_HOLY) ) - dam /= 2; - - align = victim->alignment; - align -= 350; - - if (align < -1000) - align = -1000 + (align + 1000) / 3; - - dam = (dam * align * align) / 1000000; - - damage( ch, victim, dam, sn, DAM_HOLY ,TRUE); - spell_blindness(gsn_blindness, - 3 * level / 4, ch, (void *) victim,TARGET_CHAR); -} - - -void spell_recharge( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - OBJ_DATA *obj = (OBJ_DATA *) vo; - int chance, percent; - - if (obj->item_type != ITEM_WAND && obj->item_type != ITEM_STAFF) - { - send_to_char("That item does not carry charges.\n\r",ch); - return; - } - - if (obj->value[3] >= 3 * level / 2) - { - send_to_char("Your skills are not great enough for that.\n\r",ch); - return; - } - - if (obj->value[1] == 0) - { - send_to_char("That item has already been recharged once.\n\r",ch); - return; - } - - chance = 40 + 2 * level; - - chance -= obj->value[3]; /* harder to do high-level spells */ - chance -= (obj->value[1] - obj->value[2]) * - (obj->value[1] - obj->value[2]); - - chance = UMAX(level/2,chance); - - percent = number_percent(); - - if (percent < chance / 2) - { - act("$p glows softly.",ch,obj,NULL,TO_CHAR); - act("$p glows softly.",ch,obj,NULL,TO_ROOM); - obj->value[2] = UMAX(obj->value[1],obj->value[2]); - obj->value[1] = 0; - return; - } - - else if (percent <= chance) - { - int chargeback,chargemax; - - act("$p glows softly.",ch,obj,NULL,TO_CHAR); - act("$p glows softly.",ch,obj,NULL,TO_CHAR); - - chargemax = obj->value[1] - obj->value[2]; - - if (chargemax > 0) - chargeback = UMAX(1,chargemax * percent / 100); - else - chargeback = 0; - - obj->value[2] += chargeback; - obj->value[1] = 0; - return; - } - - else if (percent <= UMIN(95, 3 * chance / 2)) - { - send_to_char("Nothing seems to happen.\n\r",ch); - if (obj->value[1] > 1) - obj->value[1]--; - return; - } - - else /* whoops! */ - { - act("$p glows brightly and explodes!",ch,obj,NULL,TO_CHAR); - act("$p glows brightly and explodes!",ch,obj,NULL,TO_ROOM); - extract_obj(obj); - } -} - -void spell_refresh( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - victim->move = UMIN( victim->move + level, victim->max_move ); - if (victim->max_move == victim->move) - send_to_char("You feel fully refreshed!\n\r",victim); - else - send_to_char( "You feel less tired.\n\r", victim ); - if ( ch != victim ) - send_to_char( "Ok.\n\r", ch ); - return; -} - -void spell_remove_curse( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim; - OBJ_DATA *obj; - bool found = FALSE; - - /* do object cases first */ - if (target == TARGET_OBJ) - { - obj = (OBJ_DATA *) vo; - - if (IS_OBJ_STAT(obj,ITEM_NODROP) || IS_OBJ_STAT(obj,ITEM_NOREMOVE)) - { - if (!IS_OBJ_STAT(obj,ITEM_NOUNCURSE) - && !saves_dispel(level + 2,obj->level,0)) - { - REMOVE_BIT(obj->extra_flags,ITEM_NODROP); - REMOVE_BIT(obj->extra_flags,ITEM_NOREMOVE); - act("$p glows blue.",ch,obj,NULL,TO_ALL); - return; - } - - act("The curse on $p is beyond your power.",ch,obj,NULL,TO_CHAR); - return; - } - act("There doesn't seem to be a curse on $p.",ch,obj,NULL,TO_CHAR); - return; - } - - /* characters */ - victim = (CHAR_DATA *) vo; - - if (check_dispel(level,victim,gsn_curse)) - { - send_to_char("You feel better.\n\r",victim); - act("$n looks more relaxed.",victim,NULL,NULL,TO_ROOM); - } - - for (obj = victim->carrying; (obj != NULL && !found); obj = obj->next_content) - { - if ((IS_OBJ_STAT(obj,ITEM_NODROP) || IS_OBJ_STAT(obj,ITEM_NOREMOVE)) - && !IS_OBJ_STAT(obj,ITEM_NOUNCURSE)) - { /* attempt to remove curse */ - if (!saves_dispel(level,obj->level,0)) - { - found = TRUE; - REMOVE_BIT(obj->extra_flags,ITEM_NODROP); - REMOVE_BIT(obj->extra_flags,ITEM_NOREMOVE); - act("Your $p glows blue.",victim,obj,NULL,TO_CHAR); - act("$n's $p glows blue.",victim,obj,NULL,TO_ROOM); - } - } - } -} - -void spell_sanctuary( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( IS_AFFECTED(victim, AFF_SANCTUARY) ) - { - if (victim == ch) - send_to_char("You are already in sanctuary.\n\r",ch); - else - act("$N is already in sanctuary.",ch,NULL,victim,TO_CHAR); - return; - } - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level / 6; - af.location = APPLY_NONE; - af.modifier = 0; - af.bitvector = AFF_SANCTUARY; - affect_to_char( victim, &af ); - act( "$n is surrounded by a white aura.", victim, NULL, NULL, TO_ROOM ); - send_to_char( "You are surrounded by a white aura.\n\r", victim ); - return; -} - - - -void spell_shield( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( is_affected( victim, sn ) ) - { - if (victim == ch) - send_to_char("You are already shielded from harm.\n\r",ch); - else - act("$N is already protected by a shield.",ch,NULL,victim,TO_CHAR); - return; - } - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = 8 + level; - af.location = APPLY_AC; - af.modifier = -20; - af.bitvector = 0; - affect_to_char( victim, &af ); - act( "$n is surrounded by a force shield.", victim, NULL, NULL, TO_ROOM ); - send_to_char( "You are surrounded by a force shield.\n\r", victim ); - return; -} - - - -void spell_shocking_grasp(int sn,int level,CHAR_DATA *ch,void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - static const int dam_each[] = - { - 0, - 0, 0, 0, 0, 0, 0, 20, 25, 29, 33, - 36, 39, 39, 39, 40, 40, 41, 41, 42, 42, - 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, - 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, - 53, 53, 54, 54, 55, 55, 56, 56, 57, 57 - }; - int dam; - - level = UMIN(level, sizeof(dam_each)/sizeof(dam_each[0]) - 1); - level = UMAX(0, level); - dam = number_range( dam_each[level] / 2, dam_each[level] * 2 ); - if ( saves_spell( level, victim,DAM_LIGHTNING) ) - dam /= 2; - damage( ch, victim, dam, sn, DAM_LIGHTNING ,TRUE); - return; -} - - - -void spell_sleep( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( IS_AFFECTED(victim, AFF_SLEEP) - || (IS_NPC(victim) && IS_SET(victim->act,ACT_UNDEAD)) - || (level + 2) < victim->level - || saves_spell( level-4, victim,DAM_CHARM) ) - return; - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = 4 + level; - af.location = APPLY_NONE; - af.modifier = 0; - af.bitvector = AFF_SLEEP; - affect_join( victim, &af ); - - if ( IS_AWAKE(victim) ) - { - send_to_char( "You feel very sleepy ..... zzzzzz.\n\r", victim ); - act( "$n goes to sleep.", victim, NULL, NULL, TO_ROOM ); - victim->position = POS_SLEEPING; - } - return; -} - -void spell_slow( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( is_affected( victim, sn ) || IS_AFFECTED(victim,AFF_SLOW)) - { - if (victim == ch) - send_to_char("You can't move any slower!\n\r",ch); - else - act("$N can't get any slower than that.", - ch,NULL,victim,TO_CHAR); - return; - } - - if (saves_spell(level,victim,DAM_OTHER) - || IS_SET(victim->imm_flags,IMM_MAGIC)) - { - if (victim != ch) - send_to_char("Nothing seemed to happen.\n\r",ch); - send_to_char("You feel momentarily lethargic.\n\r",victim); - return; - } - - if (IS_AFFECTED(victim,AFF_HASTE)) - { - if (!check_dispel(level,victim,skill_lookup("haste"))) - { - if (victim != ch) - send_to_char("Spell failed.\n\r",ch); - send_to_char("You feel momentarily slower.\n\r",victim); - return; - } - - act("$n is moving less quickly.",victim,NULL,NULL,TO_ROOM); - return; - } - - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level/2; - af.location = APPLY_DEX; - af.modifier = -1 - (level >= 18) - (level >= 25) - (level >= 32); - af.bitvector = AFF_SLOW; - affect_to_char( victim, &af ); - send_to_char( "You feel yourself slowing d o w n...\n\r", victim ); - act("$n starts to move in slow motion.",victim,NULL,NULL,TO_ROOM); - return; -} - - - - -void spell_stone_skin( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( is_affected( ch, sn ) ) - { - if (victim == ch) - send_to_char("Your skin is already as hard as a rock.\n\r",ch); - else - act("$N is already as hard as can be.",ch,NULL,victim,TO_CHAR); - return; - } - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level; - af.location = APPLY_AC; - af.modifier = -40; - af.bitvector = 0; - affect_to_char( victim, &af ); - act( "$n's skin turns to stone.", victim, NULL, NULL, TO_ROOM ); - send_to_char( "Your skin turns to stone.\n\r", victim ); - return; -} - - - -void spell_summon( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim; - - if ( ( victim = get_char_world( ch, target_name ) ) == NULL - || victim == ch - || victim->in_room == NULL - || IS_SET(ch->in_room->room_flags, ROOM_SAFE) - || IS_SET(victim->in_room->room_flags, ROOM_SAFE) - || IS_SET(victim->in_room->room_flags, ROOM_PRIVATE) - || IS_SET(victim->in_room->room_flags, ROOM_SOLITARY) - || IS_SET(victim->in_room->room_flags, ROOM_NO_RECALL) - || (IS_NPC(victim) && IS_SET(victim->act,ACT_AGGRESSIVE)) - || victim->level >= level + 3 - || (!IS_NPC(victim) && victim->level >= LEVEL_IMMORTAL) - || victim->fighting != NULL - || (IS_NPC(victim) && IS_SET(victim->imm_flags,IMM_SUMMON)) - || (IS_NPC(victim) && victim->pIndexData->pShop != NULL) - || (!IS_NPC(victim) && IS_SET(victim->act,PLR_NOSUMMON)) - || (IS_NPC(victim) && saves_spell( level, victim,DAM_OTHER)) ) - - { - send_to_char( "You failed.\n\r", ch ); - return; - } - - act( "$n disappears suddenly.", victim, NULL, NULL, TO_ROOM ); - char_from_room( victim ); - char_to_room( victim, ch->in_room ); - act( "$n arrives suddenly.", victim, NULL, NULL, TO_ROOM ); - act( "$n has summoned you!", ch, NULL, victim, TO_VICT ); - do_function(victim, &do_look, "auto" ); - return; -} - - - -void spell_teleport( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - ROOM_INDEX_DATA *pRoomIndex; - - if ( victim->in_room == NULL - || IS_SET(victim->in_room->room_flags, ROOM_NO_RECALL) - || ( victim != ch && IS_SET(victim->imm_flags,IMM_SUMMON)) - || ( !IS_NPC(ch) && victim->fighting != NULL ) - || ( victim != ch - && ( saves_spell( level - 5, victim,DAM_OTHER)))) - { - send_to_char( "You failed.\n\r", ch ); - return; - } - - pRoomIndex = get_random_room(victim); - - if (victim != ch) - send_to_char("You have been teleported!\n\r",victim); - - act( "$n vanishes!", victim, NULL, NULL, TO_ROOM ); - char_from_room( victim ); - char_to_room( victim, pRoomIndex ); - act( "$n slowly fades into existence.", victim, NULL, NULL, TO_ROOM ); - do_function(victim, &do_look, "auto" ); - return; -} - - - -void spell_ventriloquate( int sn, int level, CHAR_DATA *ch,void *vo,int target) -{ - char buf1[MAX_STRING_LENGTH]; - char buf2[MAX_STRING_LENGTH]; - char speaker[MAX_INPUT_LENGTH]; - CHAR_DATA *vch; - - target_name = one_argument( target_name, speaker ); - - sprintf( buf1, "%s says '%s'.\n\r", speaker, target_name ); - sprintf( buf2, "Someone makes %s say '%s'.\n\r", speaker, target_name ); - buf1[0] = UPPER(buf1[0]); - - for ( vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room ) - { - if (!is_exact_name( speaker, vch->name) && IS_AWAKE(vch)) - send_to_char( saves_spell(level,vch,DAM_OTHER) ? buf2 : buf1, vch ); - } - - return; -} - - - -void spell_weaken( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( is_affected( victim, sn ) || saves_spell( level, victim,DAM_OTHER) ) - return; - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level / 2; - af.location = APPLY_STR; - af.modifier = -1 * (level / 5); - af.bitvector = AFF_WEAKEN; - affect_to_char( victim, &af ); - send_to_char( "You feel your strength slip away.\n\r", victim ); - act("$n looks tired and weak.",victim,NULL,NULL,TO_ROOM); - return; -} - - - -/* RT recall spell is back */ - -void spell_word_of_recall( int sn, int level, CHAR_DATA *ch,void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - ROOM_INDEX_DATA *location; - - if (IS_NPC(victim)) - return; - - if ((location = get_room_index( ROOM_VNUM_TEMPLE)) == NULL) - { - send_to_char("You are completely lost.\n\r",victim); - return; - } - - if (IS_SET(victim->in_room->room_flags,ROOM_NO_RECALL) || - IS_AFFECTED(victim,AFF_CURSE)) - { - send_to_char("Spell failed.\n\r",victim); - return; - } - - if (victim->fighting != NULL) - stop_fighting(victim,TRUE); - - ch->move /= 2; - act("$n disappears.",victim,NULL,NULL,TO_ROOM); - char_from_room(victim); - char_to_room(victim,location); - act("$n appears in the room.",victim,NULL,NULL,TO_ROOM); - do_function(victim, &do_look, "auto"); -} - -/* - * NPC spells. - */ -void spell_acid_breath( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int dam,hp_dam,dice_dam,hpch; - - act("$n spits acid at $N.",ch,NULL,victim,TO_NOTVICT); - act("$n spits a stream of corrosive acid at you.",ch,NULL,victim,TO_VICT); - act("You spit acid at $N.",ch,NULL,victim,TO_CHAR); - - hpch = UMAX(12,ch->hit); - hp_dam = number_range(hpch/11 + 1, hpch/6); - dice_dam = dice(level,16); - - dam = UMAX(hp_dam + dice_dam/10,dice_dam + hp_dam/10); - - if (saves_spell(level,victim,DAM_ACID)) - { - acid_effect(victim,level/2,dam/4,TARGET_CHAR); - damage(ch,victim,dam/2,sn,DAM_ACID,TRUE); - } - else - { - acid_effect(victim,level,dam,TARGET_CHAR); - damage(ch,victim,dam,sn,DAM_ACID,TRUE); - } -} - - - -void spell_fire_breath( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - CHAR_DATA *vch, *vch_next; - int dam,hp_dam,dice_dam; - int hpch; - - act("$n breathes forth a cone of fire.",ch,NULL,victim,TO_NOTVICT); - act("$n breathes a cone of hot fire over you!",ch,NULL,victim,TO_VICT); - act("You breath forth a cone of fire.",ch,NULL,NULL,TO_CHAR); - - hpch = UMAX( 10, ch->hit ); - hp_dam = number_range( hpch/9+1, hpch/5 ); - dice_dam = dice(level,20); - - dam = UMAX(hp_dam + dice_dam /10, dice_dam + hp_dam / 10); - fire_effect(victim->in_room,level,dam/2,TARGET_ROOM); - - for (vch = victim->in_room->people; vch != NULL; vch = vch_next) - { - vch_next = vch->next_in_room; - - if (is_safe_spell(ch,vch,TRUE) - || (IS_NPC(vch) && IS_NPC(ch) - && (ch->fighting != vch || vch->fighting != ch))) - continue; - - if (vch == victim) /* full damage */ - { - if (saves_spell(level,vch,DAM_FIRE)) - { - fire_effect(vch,level/2,dam/4,TARGET_CHAR); - damage(ch,vch,dam/2,sn,DAM_FIRE,TRUE); - } - else - { - fire_effect(vch,level,dam,TARGET_CHAR); - damage(ch,vch,dam,sn,DAM_FIRE,TRUE); - } - } - else /* partial damage */ - { - if (saves_spell(level - 2,vch,DAM_FIRE)) - { - fire_effect(vch,level/4,dam/8,TARGET_CHAR); - damage(ch,vch,dam/4,sn,DAM_FIRE,TRUE); - } - else - { - fire_effect(vch,level/2,dam/4,TARGET_CHAR); - damage(ch,vch,dam/2,sn,DAM_FIRE,TRUE); - } - } - } -} - -void spell_frost_breath( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - CHAR_DATA *vch, *vch_next; - int dam,hp_dam,dice_dam, hpch; - - act("$n breathes out a freezing cone of frost!",ch,NULL,victim,TO_NOTVICT); - act("$n breathes a freezing cone of frost over you!", - ch,NULL,victim,TO_VICT); - act("You breath out a cone of frost.",ch,NULL,NULL,TO_CHAR); - - hpch = UMAX(12,ch->hit); - hp_dam = number_range(hpch/11 + 1, hpch/6); - dice_dam = dice(level,16); - - dam = UMAX(hp_dam + dice_dam/10,dice_dam + hp_dam/10); - cold_effect(victim->in_room,level,dam/2,TARGET_ROOM); - - for (vch = victim->in_room->people; vch != NULL; vch = vch_next) - { - vch_next = vch->next_in_room; - - if (is_safe_spell(ch,vch,TRUE) - || (IS_NPC(vch) && IS_NPC(ch) - && (ch->fighting != vch || vch->fighting != ch))) - continue; - - if (vch == victim) /* full damage */ - { - if (saves_spell(level,vch,DAM_COLD)) - { - cold_effect(vch,level/2,dam/4,TARGET_CHAR); - damage(ch,vch,dam/2,sn,DAM_COLD,TRUE); - } - else - { - cold_effect(vch,level,dam,TARGET_CHAR); - damage(ch,vch,dam,sn,DAM_COLD,TRUE); - } - } - else - { - if (saves_spell(level - 2,vch,DAM_COLD)) - { - cold_effect(vch,level/4,dam/8,TARGET_CHAR); - damage(ch,vch,dam/4,sn,DAM_COLD,TRUE); - } - else - { - cold_effect(vch,level/2,dam/4,TARGET_CHAR); - damage(ch,vch,dam/2,sn,DAM_COLD,TRUE); - } - } - } -} - - -void spell_gas_breath( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *vch; - CHAR_DATA *vch_next; - int dam,hp_dam,dice_dam,hpch; - - act("$n breathes out a cloud of poisonous gas!",ch,NULL,NULL,TO_ROOM); - act("You breath out a cloud of poisonous gas.",ch,NULL,NULL,TO_CHAR); - - hpch = UMAX(16,ch->hit); - hp_dam = number_range(hpch/15+1,8); - dice_dam = dice(level,12); - - dam = UMAX(hp_dam + dice_dam/10,dice_dam + hp_dam/10); - poison_effect(ch->in_room,level,dam,TARGET_ROOM); - - for (vch = ch->in_room->people; vch != NULL; vch = vch_next) - { - vch_next = vch->next_in_room; - - if (is_safe_spell(ch,vch,TRUE) - || (IS_NPC(ch) && IS_NPC(vch) - && (ch->fighting == vch || vch->fighting == ch))) - continue; - - if (saves_spell(level,vch,DAM_POISON)) - { - poison_effect(vch,level/2,dam/4,TARGET_CHAR); - damage(ch,vch,dam/2,sn,DAM_POISON,TRUE); - } - else - { - poison_effect(vch,level,dam,TARGET_CHAR); - damage(ch,vch,dam,sn,DAM_POISON,TRUE); - } - } -} - -void spell_lightning_breath(int sn,int level,CHAR_DATA *ch,void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int dam,hp_dam,dice_dam,hpch; - - act("$n breathes a bolt of lightning at $N.",ch,NULL,victim,TO_NOTVICT); - act("$n breathes a bolt of lightning at you!",ch,NULL,victim,TO_VICT); - act("You breathe a bolt of lightning at $N.",ch,NULL,victim,TO_CHAR); - - hpch = UMAX(10,ch->hit); - hp_dam = number_range(hpch/9+1,hpch/5); - dice_dam = dice(level,20); - - dam = UMAX(hp_dam + dice_dam/10,dice_dam + hp_dam/10); - - if (saves_spell(level,victim,DAM_LIGHTNING)) - { - shock_effect(victim,level/2,dam/4,TARGET_CHAR); - damage(ch,victim,dam/2,sn,DAM_LIGHTNING,TRUE); - } - else - { - shock_effect(victim,level,dam,TARGET_CHAR); - damage(ch,victim,dam,sn,DAM_LIGHTNING,TRUE); - } -} - -/* - * Spells for mega1.are from Glop/Erkenbrand. - */ -void spell_general_purpose(int sn,int level,CHAR_DATA *ch,void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int dam; - - dam = number_range( 25, 100 ); - if ( saves_spell( level, victim, DAM_PIERCE) ) - dam /= 2; - damage( ch, victim, dam, sn, DAM_PIERCE ,TRUE); - return; -} - -void spell_high_explosive(int sn,int level,CHAR_DATA *ch,void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int dam; - - dam = number_range( 30, 120 ); - if ( saves_spell( level, victim, DAM_PIERCE) ) - dam /= 2; - damage( ch, victim, dam, sn, DAM_PIERCE ,TRUE); - return; -} diff --git a/Rom24/src/magic.h b/Rom24/src/magic.h deleted file mode 100644 index 240e310..0000000 --- a/Rom24/src/magic.h +++ /dev/null @@ -1,130 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - - -/* - * Spell functions. - * Defined in magic.c. - */ -DECLARE_SPELL_FUN( spell_null ); -DECLARE_SPELL_FUN( spell_acid_blast ); -DECLARE_SPELL_FUN( spell_armor ); -DECLARE_SPELL_FUN( spell_bless ); -DECLARE_SPELL_FUN( spell_blindness ); -DECLARE_SPELL_FUN( spell_burning_hands ); -DECLARE_SPELL_FUN( spell_call_lightning ); -DECLARE_SPELL_FUN( spell_calm ); -DECLARE_SPELL_FUN( spell_cancellation ); -DECLARE_SPELL_FUN( spell_cause_critical ); -DECLARE_SPELL_FUN( spell_cause_light ); -DECLARE_SPELL_FUN( spell_cause_serious ); -DECLARE_SPELL_FUN( spell_change_sex ); -DECLARE_SPELL_FUN( spell_chain_lightning ); -DECLARE_SPELL_FUN( spell_charm_person ); -DECLARE_SPELL_FUN( spell_chill_touch ); -DECLARE_SPELL_FUN( spell_colour_spray ); -DECLARE_SPELL_FUN( spell_continual_light ); -DECLARE_SPELL_FUN( spell_control_weather ); -DECLARE_SPELL_FUN( spell_create_food ); -DECLARE_SPELL_FUN( spell_create_rose ); -DECLARE_SPELL_FUN( spell_create_spring ); -DECLARE_SPELL_FUN( spell_create_water ); -DECLARE_SPELL_FUN( spell_cure_blindness ); -DECLARE_SPELL_FUN( spell_cure_critical ); -DECLARE_SPELL_FUN( spell_cure_disease ); -DECLARE_SPELL_FUN( spell_cure_light ); -DECLARE_SPELL_FUN( spell_cure_poison ); -DECLARE_SPELL_FUN( spell_cure_serious ); -DECLARE_SPELL_FUN( spell_curse ); -DECLARE_SPELL_FUN( spell_demonfire ); -DECLARE_SPELL_FUN( spell_detect_evil ); -DECLARE_SPELL_FUN( spell_detect_good ); -DECLARE_SPELL_FUN( spell_detect_hidden ); -DECLARE_SPELL_FUN( spell_detect_invis ); -DECLARE_SPELL_FUN( spell_detect_magic ); -DECLARE_SPELL_FUN( spell_detect_poison ); -DECLARE_SPELL_FUN( spell_dispel_evil ); -DECLARE_SPELL_FUN( spell_dispel_good ); -DECLARE_SPELL_FUN( spell_dispel_magic ); -DECLARE_SPELL_FUN( spell_earthquake ); -DECLARE_SPELL_FUN( spell_enchant_armor ); -DECLARE_SPELL_FUN( spell_enchant_weapon ); -DECLARE_SPELL_FUN( spell_energy_drain ); -DECLARE_SPELL_FUN( spell_faerie_fire ); -DECLARE_SPELL_FUN( spell_faerie_fog ); -DECLARE_SPELL_FUN( spell_farsight ); -DECLARE_SPELL_FUN( spell_fireball ); -DECLARE_SPELL_FUN( spell_fireproof ); -DECLARE_SPELL_FUN( spell_flamestrike ); -DECLARE_SPELL_FUN( spell_floating_disc ); -DECLARE_SPELL_FUN( spell_fly ); -DECLARE_SPELL_FUN( spell_frenzy ); -DECLARE_SPELL_FUN( spell_gate ); -DECLARE_SPELL_FUN( spell_giant_strength ); -DECLARE_SPELL_FUN( spell_harm ); -DECLARE_SPELL_FUN( spell_haste ); -DECLARE_SPELL_FUN( spell_heal ); -DECLARE_SPELL_FUN( spell_heat_metal ); -DECLARE_SPELL_FUN( spell_holy_word ); -DECLARE_SPELL_FUN( spell_identify ); -DECLARE_SPELL_FUN( spell_infravision ); -DECLARE_SPELL_FUN( spell_invis ); -DECLARE_SPELL_FUN( spell_know_alignment ); -DECLARE_SPELL_FUN( spell_lightning_bolt ); -DECLARE_SPELL_FUN( spell_locate_object ); -DECLARE_SPELL_FUN( spell_magic_missile ); -DECLARE_SPELL_FUN( spell_mass_healing ); -DECLARE_SPELL_FUN( spell_mass_invis ); -DECLARE_SPELL_FUN( spell_nexus ); -DECLARE_SPELL_FUN( spell_pass_door ); -DECLARE_SPELL_FUN( spell_plague ); -DECLARE_SPELL_FUN( spell_poison ); -DECLARE_SPELL_FUN( spell_portal ); -DECLARE_SPELL_FUN( spell_protection_evil ); -DECLARE_SPELL_FUN( spell_protection_good ); -DECLARE_SPELL_FUN( spell_ray_of_truth ); -DECLARE_SPELL_FUN( spell_recharge ); -DECLARE_SPELL_FUN( spell_refresh ); -DECLARE_SPELL_FUN( spell_remove_curse ); -DECLARE_SPELL_FUN( spell_sanctuary ); -DECLARE_SPELL_FUN( spell_shocking_grasp ); -DECLARE_SPELL_FUN( spell_shield ); -DECLARE_SPELL_FUN( spell_sleep ); -DECLARE_SPELL_FUN( spell_slow ); -DECLARE_SPELL_FUN( spell_stone_skin ); -DECLARE_SPELL_FUN( spell_summon ); -DECLARE_SPELL_FUN( spell_teleport ); -DECLARE_SPELL_FUN( spell_ventriloquate ); -DECLARE_SPELL_FUN( spell_weaken ); -DECLARE_SPELL_FUN( spell_word_of_recall ); -DECLARE_SPELL_FUN( spell_acid_breath ); -DECLARE_SPELL_FUN( spell_fire_breath ); -DECLARE_SPELL_FUN( spell_frost_breath ); -DECLARE_SPELL_FUN( spell_gas_breath ); -DECLARE_SPELL_FUN( spell_lightning_breath ); -DECLARE_SPELL_FUN( spell_general_purpose ); -DECLARE_SPELL_FUN( spell_high_explosive ); diff --git a/Rom24/src/magic2.c b/Rom24/src/magic2.c deleted file mode 100644 index caa9722..0000000 --- a/Rom24/src/magic2.c +++ /dev/null @@ -1,174 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#endif -#include -#include -#include -#include -#include "merc.h" -#include "interp.h" -#include "magic.h" - - -extern char *target_name; - -void spell_farsight( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - if (IS_AFFECTED(ch,AFF_BLIND)) - { - send_to_char("Maybe it would help if you could see?\n\r",ch); - return; - } - - do_function(ch, &do_scan, target_name); -} - - -void spell_portal( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim; - OBJ_DATA *portal, *stone; - - if ( ( victim = get_char_world( ch, target_name ) ) == NULL - || victim == ch - || victim->in_room == NULL - || !can_see_room(ch,victim->in_room) - || IS_SET(victim->in_room->room_flags, ROOM_SAFE) - || IS_SET(victim->in_room->room_flags, ROOM_PRIVATE) - || IS_SET(victim->in_room->room_flags, ROOM_SOLITARY) - || IS_SET(victim->in_room->room_flags, ROOM_NO_RECALL) - || IS_SET(ch->in_room->room_flags, ROOM_NO_RECALL) - || victim->level >= level + 3 - || (!IS_NPC(victim) && victim->level >= LEVEL_HERO) /* NOT trust */ - || (IS_NPC(victim) && IS_SET(victim->imm_flags,IMM_SUMMON)) - || (IS_NPC(victim) && saves_spell( level, victim,DAM_NONE) ) - || (is_clan(victim) && !is_same_clan(ch,victim))) - { - send_to_char( "You failed.\n\r", ch ); - return; - } - - stone = get_eq_char(ch,WEAR_HOLD); - if (!IS_IMMORTAL(ch) - && (stone == NULL || stone->item_type != ITEM_WARP_STONE)) - { - send_to_char("You lack the proper component for this spell.\n\r",ch); - return; - } - - if (stone != NULL && stone->item_type == ITEM_WARP_STONE) - { - act("You draw upon the power of $p.",ch,stone,NULL,TO_CHAR); - act("It flares brightly and vanishes!",ch,stone,NULL,TO_CHAR); - extract_obj(stone); - } - - portal = create_object(get_obj_index(OBJ_VNUM_PORTAL),0); - portal->timer = 2 + level / 25; - portal->value[3] = victim->in_room->vnum; - - obj_to_room(portal,ch->in_room); - - act("$p rises up from the ground.",ch,portal,NULL,TO_ROOM); - act("$p rises up before you.",ch,portal,NULL,TO_CHAR); -} - -void spell_nexus( int sn, int level, CHAR_DATA *ch, void *vo, int target) -{ - CHAR_DATA *victim; - OBJ_DATA *portal, *stone; - ROOM_INDEX_DATA *to_room, *from_room; - - from_room = ch->in_room; - - if ( ( victim = get_char_world( ch, target_name ) ) == NULL - || victim == ch - || (to_room = victim->in_room) == NULL - || !can_see_room(ch,to_room) || !can_see_room(ch,from_room) - || IS_SET(to_room->room_flags, ROOM_SAFE) - || IS_SET(from_room->room_flags,ROOM_SAFE) - || IS_SET(to_room->room_flags, ROOM_PRIVATE) - || IS_SET(to_room->room_flags, ROOM_SOLITARY) - || IS_SET(to_room->room_flags, ROOM_NO_RECALL) - || IS_SET(from_room->room_flags,ROOM_NO_RECALL) - || victim->level >= level + 3 - || (!IS_NPC(victim) && victim->level >= LEVEL_HERO) /* NOT trust */ - || (IS_NPC(victim) && IS_SET(victim->imm_flags,IMM_SUMMON)) - || (IS_NPC(victim) && saves_spell( level, victim,DAM_NONE) ) - || (is_clan(victim) && !is_same_clan(ch,victim))) - { - send_to_char( "You failed.\n\r", ch ); - return; - } - - stone = get_eq_char(ch,WEAR_HOLD); - if (!IS_IMMORTAL(ch) - && (stone == NULL || stone->item_type != ITEM_WARP_STONE)) - { - send_to_char("You lack the proper component for this spell.\n\r",ch); - return; - } - - if (stone != NULL && stone->item_type == ITEM_WARP_STONE) - { - act("You draw upon the power of $p.",ch,stone,NULL,TO_CHAR); - act("It flares brightly and vanishes!",ch,stone,NULL,TO_CHAR); - extract_obj(stone); - } - - /* portal one */ - portal = create_object(get_obj_index(OBJ_VNUM_PORTAL),0); - portal->timer = 1 + level / 10; - portal->value[3] = to_room->vnum; - - obj_to_room(portal,from_room); - - act("$p rises up from the ground.",ch,portal,NULL,TO_ROOM); - act("$p rises up before you.",ch,portal,NULL,TO_CHAR); - - /* no second portal if rooms are the same */ - if (to_room == from_room) - return; - - /* portal two */ - portal = create_object(get_obj_index(OBJ_VNUM_PORTAL),0); - portal->timer = 1 + level/10; - portal->value[3] = from_room->vnum; - - obj_to_room(portal,to_room); - - if (to_room->people != NULL) - { - act("$p rises up from the ground.",to_room->people,portal,NULL,TO_ROOM); - act("$p rises up from the ground.",to_room->people,portal,NULL,TO_CHAR); - } -} diff --git a/Rom24/src/merc.h b/Rom24/src/merc.h deleted file mode 100644 index b4ed230..0000000 --- a/Rom24/src/merc.h +++ /dev/null @@ -1,2322 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - - -/* - * Accommodate old non-Ansi compilers. - */ -#if defined(TRADITIONAL) -#define const -#define args( list ) ( ) -#define DECLARE_DO_FUN( fun ) void fun( ) -#define DECLARE_SPEC_FUN( fun ) bool fun( ) -#define DECLARE_SPELL_FUN( fun ) void fun( ) -#else -#define args( list ) list -#define DECLARE_DO_FUN( fun ) DO_FUN fun -#define DECLARE_SPEC_FUN( fun ) SPEC_FUN fun -#define DECLARE_SPELL_FUN( fun ) SPELL_FUN fun -#endif - - -/* - * Short scalar types. - * Diavolo reports AIX compiler has bugs with short types. - */ -#if !defined(FALSE) -#define FALSE 0 -#endif - -#if !defined(TRUE) -#define TRUE 1 -#endif - -#if defined(_AIX) -#if !defined(const) -#define const -#endif -typedef int sh_int; -typedef int bool; -#define unix -#else -typedef short int sh_int; -typedef unsigned char bool; -#endif - - - -/* - * Structure types. - */ -typedef struct affect_data AFFECT_DATA; -typedef struct area_data AREA_DATA; -typedef struct ban_data BAN_DATA; -typedef struct buf_type BUFFER; -typedef struct char_data CHAR_DATA; -typedef struct descriptor_data DESCRIPTOR_DATA; -typedef struct exit_data EXIT_DATA; -typedef struct extra_descr_data EXTRA_DESCR_DATA; -typedef struct help_data HELP_DATA; -typedef struct kill_data KILL_DATA; -typedef struct mem_data MEM_DATA; -typedef struct mob_index_data MOB_INDEX_DATA; -typedef struct note_data NOTE_DATA; -typedef struct obj_data OBJ_DATA; -typedef struct obj_index_data OBJ_INDEX_DATA; -typedef struct pc_data PC_DATA; -typedef struct gen_data GEN_DATA; -typedef struct reset_data RESET_DATA; -typedef struct room_index_data ROOM_INDEX_DATA; -typedef struct shop_data SHOP_DATA; -typedef struct time_info_data TIME_INFO_DATA; -typedef struct weather_data WEATHER_DATA; - - - -/* - * Function types. - */ -typedef void DO_FUN args( ( CHAR_DATA *ch, char *argument ) ); -typedef bool SPEC_FUN args( ( CHAR_DATA *ch ) ); -typedef void SPELL_FUN args( ( int sn, int level, CHAR_DATA *ch, void *vo, - int target ) ); - - - -/* - * String and memory management parameters. - */ -#define MAX_KEY_HASH 1024 -#define MAX_STRING_LENGTH 4608 -#define MAX_INPUT_LENGTH 256 -#define PAGELEN 22 - - - -/* - * Game parameters. - * Increase the max'es if you add more of something. - * Adjust the pulse numbers to suit yourself. - */ -#define MAX_SOCIALS 256 -#define MAX_SKILL 150 -#define MAX_GROUP 30 -#define MAX_IN_GROUP 15 -#define MAX_ALIAS 5 -#define MAX_CLASS 4 -#define MAX_PC_RACE 5 -#define MAX_CLAN 3 -#define MAX_DAMAGE_MESSAGE 41 -#define MAX_LEVEL 60 -#define LEVEL_HERO (MAX_LEVEL - 9) -#define LEVEL_IMMORTAL (MAX_LEVEL - 8) - -#define PULSE_PER_SECOND 4 -#define PULSE_VIOLENCE ( 3 * PULSE_PER_SECOND) -#define PULSE_MOBILE ( 4 * PULSE_PER_SECOND) -#define PULSE_MUSIC ( 6 * PULSE_PER_SECOND) -#define PULSE_TICK (60 * PULSE_PER_SECOND) -#define PULSE_AREA (120 * PULSE_PER_SECOND) - -#define IMPLEMENTOR MAX_LEVEL -#define CREATOR (MAX_LEVEL - 1) -#define SUPREME (MAX_LEVEL - 2) -#define DEITY (MAX_LEVEL - 3) -#define GOD (MAX_LEVEL - 4) -#define IMMORTAL (MAX_LEVEL - 5) -#define DEMI (MAX_LEVEL - 6) -#define ANGEL (MAX_LEVEL - 7) -#define AVATAR (MAX_LEVEL - 8) -#define HERO LEVEL_HERO - - - -/* - * Site ban structure. - */ - -#define BAN_SUFFIX A -#define BAN_PREFIX B -#define BAN_NEWBIES C -#define BAN_ALL D -#define BAN_PERMIT E -#define BAN_PERMANENT F - -struct ban_data -{ - BAN_DATA * next; - bool valid; - sh_int ban_flags; - sh_int level; - char * name; -}; - -struct buf_type -{ - BUFFER * next; - bool valid; - sh_int state; /* error state of the buffer */ - sh_int size; /* size in k */ - char * string; /* buffer's string */ -}; - - - -/* - * Time and weather stuff. - */ -#define SUN_DARK 0 -#define SUN_RISE 1 -#define SUN_LIGHT 2 -#define SUN_SET 3 - -#define SKY_CLOUDLESS 0 -#define SKY_CLOUDY 1 -#define SKY_RAINING 2 -#define SKY_LIGHTNING 3 - -struct time_info_data -{ - int hour; - int day; - int month; - int year; -}; - -struct weather_data -{ - int mmhg; - int change; - int sky; - int sunlight; -}; - - - -/* - * Connected state for a channel. - */ -#define CON_PLAYING 0 -#define CON_GET_NAME 1 -#define CON_GET_OLD_PASSWORD 2 -#define CON_CONFIRM_NEW_NAME 3 -#define CON_GET_NEW_PASSWORD 4 -#define CON_CONFIRM_NEW_PASSWORD 5 -#define CON_GET_NEW_RACE 6 -#define CON_GET_NEW_SEX 7 -#define CON_GET_NEW_CLASS 8 -#define CON_GET_ALIGNMENT 9 -#define CON_DEFAULT_CHOICE 10 -#define CON_GEN_GROUPS 11 -#define CON_PICK_WEAPON 12 -#define CON_READ_IMOTD 13 -#define CON_READ_MOTD 14 -#define CON_BREAK_CONNECT 15 - - - -/* - * Descriptor (channel) structure. - */ -struct descriptor_data -{ - DESCRIPTOR_DATA * next; - DESCRIPTOR_DATA * snoop_by; - CHAR_DATA * character; - CHAR_DATA * original; - bool valid; - char * host; - sh_int descriptor; - sh_int connected; - bool fcommand; - char inbuf [4 * MAX_INPUT_LENGTH]; - char incomm [MAX_INPUT_LENGTH]; - char inlast [MAX_INPUT_LENGTH]; - int repeat; - char * outbuf; - int outsize; - int outtop; - char * showstr_head; - char * showstr_point; -}; - - - -/* - * Attribute bonus structures. - */ -struct str_app_type -{ - sh_int tohit; - sh_int todam; - sh_int carry; - sh_int wield; -}; - -struct int_app_type -{ - sh_int learn; -}; - -struct wis_app_type -{ - sh_int practice; -}; - -struct dex_app_type -{ - sh_int defensive; -}; - -struct con_app_type -{ - sh_int hitp; - sh_int shock; -}; - - - -/* - * TO types for act. - */ -#define TO_ROOM 0 -#define TO_NOTVICT 1 -#define TO_VICT 2 -#define TO_CHAR 3 -#define TO_ALL 4 - - - -/* - * Help table types. - */ -struct help_data -{ - HELP_DATA * next; - sh_int level; - char * keyword; - char * text; -}; - - - -/* - * Shop types. - */ -#define MAX_TRADE 5 - -struct shop_data -{ - SHOP_DATA * next; /* Next shop in list */ - sh_int keeper; /* Vnum of shop keeper mob */ - sh_int buy_type [MAX_TRADE]; /* Item types shop will buy */ - sh_int profit_buy; /* Cost multiplier for buying */ - sh_int profit_sell; /* Cost multiplier for selling */ - sh_int open_hour; /* First opening hour */ - sh_int close_hour; /* First closing hour */ -}; - - - -/* - * Per-class stuff. - */ - -#define MAX_GUILD 2 -#define MAX_STATS 5 -#define STAT_STR 0 -#define STAT_INT 1 -#define STAT_WIS 2 -#define STAT_DEX 3 -#define STAT_CON 4 - -struct class_type -{ - char * name; /* the full name of the class */ - char who_name [4]; /* Three-letter name for 'who' */ - sh_int attr_prime; /* Prime attribute */ - sh_int weapon; /* First weapon */ - sh_int guild[MAX_GUILD]; /* Vnum of guild rooms */ - sh_int skill_adept; /* Maximum skill level */ - sh_int thac0_00; /* Thac0 for level 0 */ - sh_int thac0_32; /* Thac0 for level 32 */ - sh_int hp_min; /* Min hp gained on leveling */ - sh_int hp_max; /* Max hp gained on leveling */ - bool fMana; /* Class gains mana on level */ - char * base_group; /* base skills gained */ - char * default_group; /* default skills gained */ -}; - -struct item_type -{ - int type; - char * name; -}; - -struct weapon_type -{ - char * name; - sh_int vnum; - sh_int type; - sh_int *gsn; -}; - -struct wiznet_type -{ - char * name; - long flag; - int level; -}; - -struct attack_type -{ - char * name; /* name */ - char * noun; /* message */ - int damage; /* damage class */ -}; - -struct race_type -{ - char * name; /* call name of the race */ - bool pc_race; /* can be chosen by pcs */ - long act; /* act bits for the race */ - long aff; /* aff bits for the race */ - long off; /* off bits for the race */ - long imm; /* imm bits for the race */ - long res; /* res bits for the race */ - long vuln; /* vuln bits for the race */ - long form; /* default form flag for the race */ - long parts; /* default parts for the race */ -}; - - -struct pc_race_type /* additional data for pc races */ -{ - char * name; /* MUST be in race_type */ - char who_name[6]; - sh_int points; /* cost in points of the race */ - sh_int class_mult[MAX_CLASS]; /* exp multiplier for class, * 100 */ - char * skills[5]; /* bonus skills for the race */ - sh_int stats[MAX_STATS]; /* starting stats */ - sh_int max_stats[MAX_STATS]; /* maximum stats */ - sh_int size; /* aff bits for the race */ -}; - - -struct spec_type -{ - char * name; /* special function name */ - SPEC_FUN * function; /* the function */ -}; - - - -/* - * Data structure for notes. - */ - -#define NOTE_NOTE 0 -#define NOTE_IDEA 1 -#define NOTE_PENALTY 2 -#define NOTE_NEWS 3 -#define NOTE_CHANGES 4 -struct note_data -{ - NOTE_DATA * next; - bool valid; - sh_int type; - char * sender; - char * date; - char * to_list; - char * subject; - char * text; - time_t date_stamp; -}; - - - -/* - * An affect. - */ -struct affect_data -{ - AFFECT_DATA * next; - bool valid; - sh_int where; - sh_int type; - sh_int level; - sh_int duration; - sh_int location; - sh_int modifier; - int bitvector; -}; - -/* where definitions */ -#define TO_AFFECTS 0 -#define TO_OBJECT 1 -#define TO_IMMUNE 2 -#define TO_RESIST 3 -#define TO_VULN 4 -#define TO_WEAPON 5 - - -/* - * A kill structure (indexed by level). - */ -struct kill_data -{ - sh_int number; - sh_int killed; -}; - - - -/*************************************************************************** - * * - * VALUES OF INTEREST TO AREA BUILDERS * - * (Start of section ... start here) * - * * - ***************************************************************************/ - -/* - * Well known mob virtual numbers. - * Defined in #MOBILES. - */ -#define MOB_VNUM_FIDO 3090 -#define MOB_VNUM_CITYGUARD 3060 -#define MOB_VNUM_VAMPIRE 3404 - -#define MOB_VNUM_PATROLMAN 2106 -#define GROUP_VNUM_TROLLS 2100 -#define GROUP_VNUM_OGRES 2101 - - -/* RT ASCII conversions -- used so we can have letters in this file */ - -#define A 1 -#define B 2 -#define C 4 -#define D 8 -#define E 16 -#define F 32 -#define G 64 -#define H 128 - -#define I 256 -#define J 512 -#define K 1024 -#define L 2048 -#define M 4096 -#define N 8192 -#define O 16384 -#define P 32768 - -#define Q 65536 -#define R 131072 -#define S 262144 -#define T 524288 -#define U 1048576 -#define V 2097152 -#define W 4194304 -#define X 8388608 - -#define Y 16777216 -#define Z 33554432 -#define aa 67108864 /* doubled due to conflicts */ -#define bb 134217728 -#define cc 268435456 -#define dd 536870912 -#define ee 1073741824 - -/* - * ACT bits for mobs. - * Used in #MOBILES. - */ -#define ACT_IS_NPC (A) /* Auto set for mobs */ -#define ACT_SENTINEL (B) /* Stays in one room */ -#define ACT_SCAVENGER (C) /* Picks up objects */ -#define ACT_AGGRESSIVE (F) /* Attacks PC's */ -#define ACT_STAY_AREA (G) /* Won't leave area */ -#define ACT_WIMPY (H) -#define ACT_PET (I) /* Auto set for pets */ -#define ACT_TRAIN (J) /* Can train PC's */ -#define ACT_PRACTICE (K) /* Can practice PC's */ -#define ACT_UNDEAD (O) -#define ACT_CLERIC (Q) -#define ACT_MAGE (R) -#define ACT_THIEF (S) -#define ACT_WARRIOR (T) -#define ACT_NOALIGN (U) -#define ACT_NOPURGE (V) -#define ACT_OUTDOORS (W) -#define ACT_INDOORS (Y) -#define ACT_IS_HEALER (aa) -#define ACT_GAIN (bb) -#define ACT_UPDATE_ALWAYS (cc) -#define ACT_IS_CHANGER (dd) - -/* damage classes */ -#define DAM_NONE 0 -#define DAM_BASH 1 -#define DAM_PIERCE 2 -#define DAM_SLASH 3 -#define DAM_FIRE 4 -#define DAM_COLD 5 -#define DAM_LIGHTNING 6 -#define DAM_ACID 7 -#define DAM_POISON 8 -#define DAM_NEGATIVE 9 -#define DAM_HOLY 10 -#define DAM_ENERGY 11 -#define DAM_MENTAL 12 -#define DAM_DISEASE 13 -#define DAM_DROWNING 14 -#define DAM_LIGHT 15 -#define DAM_OTHER 16 -#define DAM_HARM 17 -#define DAM_CHARM 18 -#define DAM_SOUND 19 - -/* OFF bits for mobiles */ -#define OFF_AREA_ATTACK (A) -#define OFF_BACKSTAB (B) -#define OFF_BASH (C) -#define OFF_BERSERK (D) -#define OFF_DISARM (E) -#define OFF_DODGE (F) -#define OFF_FADE (G) -#define OFF_FAST (H) -#define OFF_KICK (I) -#define OFF_KICK_DIRT (J) -#define OFF_PARRY (K) -#define OFF_RESCUE (L) -#define OFF_TAIL (M) -#define OFF_TRIP (N) -#define OFF_CRUSH (O) -#define ASSIST_ALL (P) -#define ASSIST_ALIGN (Q) -#define ASSIST_RACE (R) -#define ASSIST_PLAYERS (S) -#define ASSIST_GUARD (T) -#define ASSIST_VNUM (U) - -/* return values for check_imm */ -#define IS_NORMAL 0 -#define IS_IMMUNE 1 -#define IS_RESISTANT 2 -#define IS_VULNERABLE 3 - -/* IMM bits for mobs */ -#define IMM_SUMMON (A) -#define IMM_CHARM (B) -#define IMM_MAGIC (C) -#define IMM_WEAPON (D) -#define IMM_BASH (E) -#define IMM_PIERCE (F) -#define IMM_SLASH (G) -#define IMM_FIRE (H) -#define IMM_COLD (I) -#define IMM_LIGHTNING (J) -#define IMM_ACID (K) -#define IMM_POISON (L) -#define IMM_NEGATIVE (M) -#define IMM_HOLY (N) -#define IMM_ENERGY (O) -#define IMM_MENTAL (P) -#define IMM_DISEASE (Q) -#define IMM_DROWNING (R) -#define IMM_LIGHT (S) -#define IMM_SOUND (T) -#define IMM_WOOD (X) -#define IMM_SILVER (Y) -#define IMM_IRON (Z) - -/* RES bits for mobs */ -#define RES_SUMMON (A) -#define RES_CHARM (B) -#define RES_MAGIC (C) -#define RES_WEAPON (D) -#define RES_BASH (E) -#define RES_PIERCE (F) -#define RES_SLASH (G) -#define RES_FIRE (H) -#define RES_COLD (I) -#define RES_LIGHTNING (J) -#define RES_ACID (K) -#define RES_POISON (L) -#define RES_NEGATIVE (M) -#define RES_HOLY (N) -#define RES_ENERGY (O) -#define RES_MENTAL (P) -#define RES_DISEASE (Q) -#define RES_DROWNING (R) -#define RES_LIGHT (S) -#define RES_SOUND (T) -#define RES_WOOD (X) -#define RES_SILVER (Y) -#define RES_IRON (Z) - -/* VULN bits for mobs */ -#define VULN_SUMMON (A) -#define VULN_CHARM (B) -#define VULN_MAGIC (C) -#define VULN_WEAPON (D) -#define VULN_BASH (E) -#define VULN_PIERCE (F) -#define VULN_SLASH (G) -#define VULN_FIRE (H) -#define VULN_COLD (I) -#define VULN_LIGHTNING (J) -#define VULN_ACID (K) -#define VULN_POISON (L) -#define VULN_NEGATIVE (M) -#define VULN_HOLY (N) -#define VULN_ENERGY (O) -#define VULN_MENTAL (P) -#define VULN_DISEASE (Q) -#define VULN_DROWNING (R) -#define VULN_LIGHT (S) -#define VULN_SOUND (T) -#define VULN_WOOD (X) -#define VULN_SILVER (Y) -#define VULN_IRON (Z) - -/* body form */ -#define FORM_EDIBLE (A) -#define FORM_POISON (B) -#define FORM_MAGICAL (C) -#define FORM_INSTANT_DECAY (D) -#define FORM_OTHER (E) /* defined by material bit */ - -/* actual form */ -#define FORM_ANIMAL (G) -#define FORM_SENTIENT (H) -#define FORM_UNDEAD (I) -#define FORM_CONSTRUCT (J) -#define FORM_MIST (K) -#define FORM_INTANGIBLE (L) - -#define FORM_BIPED (M) -#define FORM_CENTAUR (N) -#define FORM_INSECT (O) -#define FORM_SPIDER (P) -#define FORM_CRUSTACEAN (Q) -#define FORM_WORM (R) -#define FORM_BLOB (S) - -#define FORM_MAMMAL (V) -#define FORM_BIRD (W) -#define FORM_REPTILE (X) -#define FORM_SNAKE (Y) -#define FORM_DRAGON (Z) -#define FORM_AMPHIBIAN (aa) -#define FORM_FISH (bb) -#define FORM_COLD_BLOOD (cc) - -/* body parts */ -#define PART_HEAD (A) -#define PART_ARMS (B) -#define PART_LEGS (C) -#define PART_HEART (D) -#define PART_BRAINS (E) -#define PART_GUTS (F) -#define PART_HANDS (G) -#define PART_FEET (H) -#define PART_FINGERS (I) -#define PART_EAR (J) -#define PART_EYE (K) -#define PART_LONG_TONGUE (L) -#define PART_EYESTALKS (M) -#define PART_TENTACLES (N) -#define PART_FINS (O) -#define PART_WINGS (P) -#define PART_TAIL (Q) -/* for combat */ -#define PART_CLAWS (U) -#define PART_FANGS (V) -#define PART_HORNS (W) -#define PART_SCALES (X) -#define PART_TUSKS (Y) - - -/* - * Bits for 'affected_by'. - * Used in #MOBILES. - */ -#define AFF_BLIND (A) -#define AFF_INVISIBLE (B) -#define AFF_DETECT_EVIL (C) -#define AFF_DETECT_INVIS (D) -#define AFF_DETECT_MAGIC (E) -#define AFF_DETECT_HIDDEN (F) -#define AFF_DETECT_GOOD (G) -#define AFF_SANCTUARY (H) -#define AFF_FAERIE_FIRE (I) -#define AFF_INFRARED (J) -#define AFF_CURSE (K) -#define AFF_UNUSED_FLAG (L) /* unused */ -#define AFF_POISON (M) -#define AFF_PROTECT_EVIL (N) -#define AFF_PROTECT_GOOD (O) -#define AFF_SNEAK (P) -#define AFF_HIDE (Q) -#define AFF_SLEEP (R) -#define AFF_CHARM (S) -#define AFF_FLYING (T) -#define AFF_PASS_DOOR (U) -#define AFF_HASTE (V) -#define AFF_CALM (W) -#define AFF_PLAGUE (X) -#define AFF_WEAKEN (Y) -#define AFF_DARK_VISION (Z) -#define AFF_BERSERK (aa) -#define AFF_SWIM (bb) -#define AFF_REGENERATION (cc) -#define AFF_SLOW (dd) - - - - -/* - * Sex. - * Used in #MOBILES. - */ -#define SEX_NEUTRAL 0 -#define SEX_MALE 1 -#define SEX_FEMALE 2 - -/* AC types */ -#define AC_PIERCE 0 -#define AC_BASH 1 -#define AC_SLASH 2 -#define AC_EXOTIC 3 - -/* dice */ -#define DICE_NUMBER 0 -#define DICE_TYPE 1 -#define DICE_BONUS 2 - -/* size */ -#define SIZE_TINY 0 -#define SIZE_SMALL 1 -#define SIZE_MEDIUM 2 -#define SIZE_LARGE 3 -#define SIZE_HUGE 4 -#define SIZE_GIANT 5 - - - -/* - * Well known object virtual numbers. - * Defined in #OBJECTS. - */ -#define OBJ_VNUM_SILVER_ONE 1 -#define OBJ_VNUM_GOLD_ONE 2 -#define OBJ_VNUM_GOLD_SOME 3 -#define OBJ_VNUM_SILVER_SOME 4 -#define OBJ_VNUM_COINS 5 - -#define OBJ_VNUM_CORPSE_NPC 10 -#define OBJ_VNUM_CORPSE_PC 11 -#define OBJ_VNUM_SEVERED_HEAD 12 -#define OBJ_VNUM_TORN_HEART 13 -#define OBJ_VNUM_SLICED_ARM 14 -#define OBJ_VNUM_SLICED_LEG 15 -#define OBJ_VNUM_GUTS 16 -#define OBJ_VNUM_BRAINS 17 - -#define OBJ_VNUM_MUSHROOM 20 -#define OBJ_VNUM_LIGHT_BALL 21 -#define OBJ_VNUM_SPRING 22 -#define OBJ_VNUM_DISC 23 -#define OBJ_VNUM_PORTAL 25 - -#define OBJ_VNUM_ROSE 1001 - -#define OBJ_VNUM_PIT 3010 - -#define OBJ_VNUM_SCHOOL_MACE 3700 -#define OBJ_VNUM_SCHOOL_DAGGER 3701 -#define OBJ_VNUM_SCHOOL_SWORD 3702 -#define OBJ_VNUM_SCHOOL_SPEAR 3717 -#define OBJ_VNUM_SCHOOL_STAFF 3718 -#define OBJ_VNUM_SCHOOL_AXE 3719 -#define OBJ_VNUM_SCHOOL_FLAIL 3720 -#define OBJ_VNUM_SCHOOL_WHIP 3721 -#define OBJ_VNUM_SCHOOL_POLEARM 3722 - -#define OBJ_VNUM_SCHOOL_VEST 3703 -#define OBJ_VNUM_SCHOOL_SHIELD 3704 -#define OBJ_VNUM_SCHOOL_BANNER 3716 -#define OBJ_VNUM_MAP 3162 - -#define OBJ_VNUM_WHISTLE 2116 - - - -/* - * Item types. - * Used in #OBJECTS. - */ -#define ITEM_LIGHT 1 -#define ITEM_SCROLL 2 -#define ITEM_WAND 3 -#define ITEM_STAFF 4 -#define ITEM_WEAPON 5 -#define ITEM_TREASURE 8 -#define ITEM_ARMOR 9 -#define ITEM_POTION 10 -#define ITEM_CLOTHING 11 -#define ITEM_FURNITURE 12 -#define ITEM_TRASH 13 -#define ITEM_CONTAINER 15 -#define ITEM_DRINK_CON 17 -#define ITEM_KEY 18 -#define ITEM_FOOD 19 -#define ITEM_MONEY 20 -#define ITEM_BOAT 22 -#define ITEM_CORPSE_NPC 23 -#define ITEM_CORPSE_PC 24 -#define ITEM_FOUNTAIN 25 -#define ITEM_PILL 26 -#define ITEM_PROTECT 27 -#define ITEM_MAP 28 -#define ITEM_PORTAL 29 -#define ITEM_WARP_STONE 30 -#define ITEM_ROOM_KEY 31 -#define ITEM_GEM 32 -#define ITEM_JEWELRY 33 -#define ITEM_JUKEBOX 34 - - - -/* - * Extra flags. - * Used in #OBJECTS. - */ -#define ITEM_GLOW (A) -#define ITEM_HUM (B) -#define ITEM_DARK (C) -#define ITEM_LOCK (D) -#define ITEM_EVIL (E) -#define ITEM_INVIS (F) -#define ITEM_MAGIC (G) -#define ITEM_NODROP (H) -#define ITEM_BLESS (I) -#define ITEM_ANTI_GOOD (J) -#define ITEM_ANTI_EVIL (K) -#define ITEM_ANTI_NEUTRAL (L) -#define ITEM_NOREMOVE (M) -#define ITEM_INVENTORY (N) -#define ITEM_NOPURGE (O) -#define ITEM_ROT_DEATH (P) -#define ITEM_VIS_DEATH (Q) -#define ITEM_NONMETAL (S) -#define ITEM_NOLOCATE (T) -#define ITEM_MELT_DROP (U) -#define ITEM_HAD_TIMER (V) -#define ITEM_SELL_EXTRACT (W) -#define ITEM_BURN_PROOF (Y) -#define ITEM_NOUNCURSE (Z) - - -/* - * Wear flags. - * Used in #OBJECTS. - */ -#define ITEM_TAKE (A) -#define ITEM_WEAR_FINGER (B) -#define ITEM_WEAR_NECK (C) -#define ITEM_WEAR_BODY (D) -#define ITEM_WEAR_HEAD (E) -#define ITEM_WEAR_LEGS (F) -#define ITEM_WEAR_FEET (G) -#define ITEM_WEAR_HANDS (H) -#define ITEM_WEAR_ARMS (I) -#define ITEM_WEAR_SHIELD (J) -#define ITEM_WEAR_ABOUT (K) -#define ITEM_WEAR_WAIST (L) -#define ITEM_WEAR_WRIST (M) -#define ITEM_WIELD (N) -#define ITEM_HOLD (O) -#define ITEM_NO_SAC (P) -#define ITEM_WEAR_FLOAT (Q) - -/* weapon class */ -#define WEAPON_EXOTIC 0 -#define WEAPON_SWORD 1 -#define WEAPON_DAGGER 2 -#define WEAPON_SPEAR 3 -#define WEAPON_MACE 4 -#define WEAPON_AXE 5 -#define WEAPON_FLAIL 6 -#define WEAPON_WHIP 7 -#define WEAPON_POLEARM 8 - -/* weapon types */ -#define WEAPON_FLAMING (A) -#define WEAPON_FROST (B) -#define WEAPON_VAMPIRIC (C) -#define WEAPON_SHARP (D) -#define WEAPON_VORPAL (E) -#define WEAPON_TWO_HANDS (F) -#define WEAPON_SHOCKING (G) -#define WEAPON_POISON (H) - -/* gate flags */ -#define GATE_NORMAL_EXIT (A) -#define GATE_NOCURSE (B) -#define GATE_GOWITH (C) -#define GATE_BUGGY (D) -#define GATE_RANDOM (E) - -/* furniture flags */ -#define STAND_AT (A) -#define STAND_ON (B) -#define STAND_IN (C) -#define SIT_AT (D) -#define SIT_ON (E) -#define SIT_IN (F) -#define REST_AT (G) -#define REST_ON (H) -#define REST_IN (I) -#define SLEEP_AT (J) -#define SLEEP_ON (K) -#define SLEEP_IN (L) -#define PUT_AT (M) -#define PUT_ON (N) -#define PUT_IN (O) -#define PUT_INSIDE (P) - - - - -/* - * Apply types (for affects). - * Used in #OBJECTS. - */ -#define APPLY_NONE 0 -#define APPLY_STR 1 -#define APPLY_DEX 2 -#define APPLY_INT 3 -#define APPLY_WIS 4 -#define APPLY_CON 5 -#define APPLY_SEX 6 -#define APPLY_CLASS 7 -#define APPLY_LEVEL 8 -#define APPLY_AGE 9 -#define APPLY_HEIGHT 10 -#define APPLY_WEIGHT 11 -#define APPLY_MANA 12 -#define APPLY_HIT 13 -#define APPLY_MOVE 14 -#define APPLY_GOLD 15 -#define APPLY_EXP 16 -#define APPLY_AC 17 -#define APPLY_HITROLL 18 -#define APPLY_DAMROLL 19 -#define APPLY_SAVES 20 -#define APPLY_SAVING_PARA 20 -#define APPLY_SAVING_ROD 21 -#define APPLY_SAVING_PETRI 22 -#define APPLY_SAVING_BREATH 23 -#define APPLY_SAVING_SPELL 24 -#define APPLY_SPELL_AFFECT 25 - -/* - * Values for containers (value[1]). - * Used in #OBJECTS. - */ -#define CONT_CLOSEABLE 1 -#define CONT_PICKPROOF 2 -#define CONT_CLOSED 4 -#define CONT_LOCKED 8 -#define CONT_PUT_ON 16 - - - -/* - * Well known room virtual numbers. - * Defined in #ROOMS. - */ -#define ROOM_VNUM_LIMBO 2 -#define ROOM_VNUM_CHAT 1200 -#define ROOM_VNUM_TEMPLE 3001 -#define ROOM_VNUM_ALTAR 3054 -#define ROOM_VNUM_SCHOOL 3700 -#define ROOM_VNUM_BALANCE 4500 -#define ROOM_VNUM_CIRCLE 4400 -#define ROOM_VNUM_DEMISE 4201 -#define ROOM_VNUM_HONOR 4300 - - - -/* - * Room flags. - * Used in #ROOMS. - */ -#define ROOM_DARK (A) -#define ROOM_NO_MOB (C) -#define ROOM_INDOORS (D) - -#define ROOM_PRIVATE (J) -#define ROOM_SAFE (K) -#define ROOM_SOLITARY (L) -#define ROOM_PET_SHOP (M) -#define ROOM_NO_RECALL (N) -#define ROOM_IMP_ONLY (O) -#define ROOM_GODS_ONLY (P) -#define ROOM_HEROES_ONLY (Q) -#define ROOM_NEWBIES_ONLY (R) -#define ROOM_LAW (S) -#define ROOM_NOWHERE (T) - - - -/* - * Directions. - * Used in #ROOMS. - */ -#define DIR_NORTH 0 -#define DIR_EAST 1 -#define DIR_SOUTH 2 -#define DIR_WEST 3 -#define DIR_UP 4 -#define DIR_DOWN 5 - - - -/* - * Exit flags. - * Used in #ROOMS. - */ -#define EX_ISDOOR (A) -#define EX_CLOSED (B) -#define EX_LOCKED (C) -#define EX_PICKPROOF (F) -#define EX_NOPASS (G) -#define EX_EASY (H) -#define EX_HARD (I) -#define EX_INFURIATING (J) -#define EX_NOCLOSE (K) -#define EX_NOLOCK (L) - - - -/* - * Sector types. - * Used in #ROOMS. - */ -#define SECT_INSIDE 0 -#define SECT_CITY 1 -#define SECT_FIELD 2 -#define SECT_FOREST 3 -#define SECT_HILLS 4 -#define SECT_MOUNTAIN 5 -#define SECT_WATER_SWIM 6 -#define SECT_WATER_NOSWIM 7 -#define SECT_UNUSED 8 -#define SECT_AIR 9 -#define SECT_DESERT 10 -#define SECT_MAX 11 - - - -/* - * Equpiment wear locations. - * Used in #RESETS. - */ -#define WEAR_NONE -1 -#define WEAR_LIGHT 0 -#define WEAR_FINGER_L 1 -#define WEAR_FINGER_R 2 -#define WEAR_NECK_1 3 -#define WEAR_NECK_2 4 -#define WEAR_BODY 5 -#define WEAR_HEAD 6 -#define WEAR_LEGS 7 -#define WEAR_FEET 8 -#define WEAR_HANDS 9 -#define WEAR_ARMS 10 -#define WEAR_SHIELD 11 -#define WEAR_ABOUT 12 -#define WEAR_WAIST 13 -#define WEAR_WRIST_L 14 -#define WEAR_WRIST_R 15 -#define WEAR_WIELD 16 -#define WEAR_HOLD 17 -#define WEAR_FLOAT 18 -#define MAX_WEAR 19 - - - -/*************************************************************************** - * * - * VALUES OF INTEREST TO AREA BUILDERS * - * (End of this section ... stop here) * - * * - ***************************************************************************/ - -/* - * Conditions. - */ -#define COND_DRUNK 0 -#define COND_FULL 1 -#define COND_THIRST 2 -#define COND_HUNGER 3 - - - -/* - * Positions. - */ -#define POS_DEAD 0 -#define POS_MORTAL 1 -#define POS_INCAP 2 -#define POS_STUNNED 3 -#define POS_SLEEPING 4 -#define POS_RESTING 5 -#define POS_SITTING 6 -#define POS_FIGHTING 7 -#define POS_STANDING 8 - - - -/* - * ACT bits for players. - */ -#define PLR_IS_NPC (A) /* Don't EVER set. */ - -/* RT auto flags */ -#define PLR_AUTOASSIST (C) -#define PLR_AUTOEXIT (D) -#define PLR_AUTOLOOT (E) -#define PLR_AUTOSAC (F) -#define PLR_AUTOGOLD (G) -#define PLR_AUTOSPLIT (H) - -/* RT personal flags */ -#define PLR_HOLYLIGHT (N) -#define PLR_CANLOOT (P) -#define PLR_NOSUMMON (Q) -#define PLR_NOFOLLOW (R) -/* 2 bits reserved, S-T */ - -/* penalty flags */ -#define PLR_PERMIT (U) -#define PLR_LOG (W) -#define PLR_DENY (X) -#define PLR_FREEZE (Y) -#define PLR_THIEF (Z) -#define PLR_KILLER (aa) - - -/* RT comm flags -- may be used on both mobs and chars */ -#define COMM_QUIET (A) -#define COMM_DEAF (B) -#define COMM_NOWIZ (C) -#define COMM_NOAUCTION (D) -#define COMM_NOGOSSIP (E) -#define COMM_NOQUESTION (F) -#define COMM_NOMUSIC (G) -#define COMM_NOCLAN (H) -#define COMM_NOQUOTE (I) -#define COMM_SHOUTSOFF (J) - -/* display flags */ -#define COMM_COMPACT (L) -#define COMM_BRIEF (M) -#define COMM_PROMPT (N) -#define COMM_COMBINE (O) -#define COMM_TELNET_GA (P) -#define COMM_SHOW_AFFECTS (Q) -#define COMM_NOGRATS (R) - -/* penalties */ -#define COMM_NOEMOTE (T) -#define COMM_NOSHOUT (U) -#define COMM_NOTELL (V) -#define COMM_NOCHANNELS (W) -#define COMM_SNOOP_PROOF (Y) -#define COMM_AFK (Z) - -/* WIZnet flags */ -#define WIZ_ON (A) -#define WIZ_TICKS (B) -#define WIZ_LOGINS (C) -#define WIZ_SITES (D) -#define WIZ_LINKS (E) -#define WIZ_DEATHS (F) -#define WIZ_RESETS (G) -#define WIZ_MOBDEATHS (H) -#define WIZ_FLAGS (I) -#define WIZ_PENALTIES (J) -#define WIZ_SACCING (K) -#define WIZ_LEVELS (L) -#define WIZ_SECURE (M) -#define WIZ_SWITCHES (N) -#define WIZ_SNOOPS (O) -#define WIZ_RESTORE (P) -#define WIZ_LOAD (Q) -#define WIZ_NEWBIE (R) -#define WIZ_PREFIX (S) -#define WIZ_SPAM (T) - -/* - * Prototype for a mob. - * This is the in-memory version of #MOBILES. - */ -struct mob_index_data -{ - MOB_INDEX_DATA * next; - SPEC_FUN * spec_fun; - SHOP_DATA * pShop; - sh_int vnum; - sh_int group; - bool new_format; - sh_int count; - sh_int killed; - char * player_name; - char * short_descr; - char * long_descr; - char * description; - long act; - long affected_by; - sh_int alignment; - sh_int level; - sh_int hitroll; - sh_int hit[3]; - sh_int mana[3]; - sh_int damage[3]; - sh_int ac[4]; - sh_int dam_type; - long off_flags; - long imm_flags; - long res_flags; - long vuln_flags; - sh_int start_pos; - sh_int default_pos; - sh_int sex; - sh_int race; - long wealth; - long form; - long parts; - sh_int size; - char * material; -}; - - - -/* memory settings */ -#define MEM_CUSTOMER A -#define MEM_SELLER B -#define MEM_HOSTILE C -#define MEM_AFRAID D - -/* memory for mobs */ -struct mem_data -{ - MEM_DATA *next; - bool valid; - int id; - int reaction; - time_t when; -}; - - -/* - * One character (PC or NPC). - */ -struct char_data -{ - CHAR_DATA * next; - CHAR_DATA * next_in_room; - CHAR_DATA * master; - CHAR_DATA * leader; - CHAR_DATA * fighting; - CHAR_DATA * reply; - CHAR_DATA * pet; - MEM_DATA * memory; - SPEC_FUN * spec_fun; - MOB_INDEX_DATA * pIndexData; - DESCRIPTOR_DATA * desc; - AFFECT_DATA * affected; - NOTE_DATA * pnote; - OBJ_DATA * carrying; - OBJ_DATA * on; - ROOM_INDEX_DATA * in_room; - ROOM_INDEX_DATA * was_in_room; - AREA_DATA * zone; - PC_DATA * pcdata; - GEN_DATA * gen_data; - bool valid; - char * name; - long id; - sh_int version; - char * short_descr; - char * long_descr; - char * description; - char * prompt; - char * prefix; - sh_int group; - sh_int clan; - sh_int sex; - sh_int class; - sh_int race; - sh_int level; - sh_int trust; - int played; - int lines; /* for the pager */ - time_t logon; - sh_int timer; - sh_int wait; - sh_int daze; - sh_int hit; - sh_int max_hit; - sh_int mana; - sh_int max_mana; - sh_int move; - sh_int max_move; - long gold; - long silver; - int exp; - long act; - long comm; /* RT added to pad the vector */ - long wiznet; /* wiz stuff */ - long imm_flags; - long res_flags; - long vuln_flags; - sh_int invis_level; - sh_int incog_level; - long affected_by; - sh_int position; - sh_int practice; - sh_int train; - sh_int carry_weight; - sh_int carry_number; - sh_int saving_throw; - sh_int alignment; - sh_int hitroll; - sh_int damroll; - sh_int armor[4]; - sh_int wimpy; - /* stats */ - sh_int perm_stat[MAX_STATS]; - sh_int mod_stat[MAX_STATS]; - /* parts stuff */ - long form; - long parts; - sh_int size; - char* material; - /* mobile stuff */ - long off_flags; - sh_int damage[3]; - sh_int dam_type; - sh_int start_pos; - sh_int default_pos; -}; - - - -/* - * Data which only PC's have. - */ -struct pc_data -{ - PC_DATA * next; - BUFFER * buffer; - bool valid; - char * pwd; - char * bamfin; - char * bamfout; - char * title; - time_t last_note; - time_t last_idea; - time_t last_penalty; - time_t last_news; - time_t last_changes; - sh_int perm_hit; - sh_int perm_mana; - sh_int perm_move; - sh_int true_sex; - int last_level; - sh_int condition [4]; - sh_int learned [MAX_SKILL]; - bool group_known [MAX_GROUP]; - sh_int points; - bool confirm_delete; - char * alias[MAX_ALIAS]; - char * alias_sub[MAX_ALIAS]; -}; - -/* Data for generating characters -- only used during generation */ -struct gen_data -{ - GEN_DATA *next; - bool valid; - bool skill_chosen[MAX_SKILL]; - bool group_chosen[MAX_GROUP]; - int points_chosen; -}; - - - -/* - * Liquids. - */ -#define LIQ_WATER 0 - -struct liq_type -{ - char * liq_name; - char * liq_color; - sh_int liq_affect[5]; -}; - - - -/* - * Extra description data for a room or object. - */ -struct extra_descr_data -{ - EXTRA_DESCR_DATA *next; /* Next in list */ - bool valid; - char *keyword; /* Keyword in look/examine */ - char *description; /* What to see */ -}; - - - -/* - * Prototype for an object. - */ -struct obj_index_data -{ - OBJ_INDEX_DATA * next; - EXTRA_DESCR_DATA * extra_descr; - AFFECT_DATA * affected; - bool new_format; - char * name; - char * short_descr; - char * description; - sh_int vnum; - sh_int reset_num; - char * material; - sh_int item_type; - int extra_flags; - int wear_flags; - sh_int level; - sh_int condition; - sh_int count; - sh_int weight; - int cost; - int value[5]; -}; - - - -/* - * One object. - */ -struct obj_data -{ - OBJ_DATA * next; - OBJ_DATA * next_content; - OBJ_DATA * contains; - OBJ_DATA * in_obj; - OBJ_DATA * on; - CHAR_DATA * carried_by; - EXTRA_DESCR_DATA * extra_descr; - AFFECT_DATA * affected; - OBJ_INDEX_DATA * pIndexData; - ROOM_INDEX_DATA * in_room; - bool valid; - bool enchanted; - char * owner; - char * name; - char * short_descr; - char * description; - sh_int item_type; - int extra_flags; - int wear_flags; - sh_int wear_loc; - sh_int weight; - int cost; - sh_int level; - sh_int condition; - char * material; - sh_int timer; - int value [5]; -}; - - - -/* - * Exit data. - */ -struct exit_data -{ - union - { - ROOM_INDEX_DATA * to_room; - sh_int vnum; - } u1; - sh_int exit_info; - sh_int key; - char * keyword; - char * description; -}; - - - -/* - * Reset commands: - * '*': comment - * 'M': read a mobile - * 'O': read an object - * 'P': put object in object - * 'G': give object to mobile - * 'E': equip object to mobile - * 'D': set state of door - * 'R': randomize room exits - * 'S': stop (end of list) - */ - -/* - * Area-reset definition. - */ -struct reset_data -{ - RESET_DATA * next; - char command; - sh_int arg1; - sh_int arg2; - sh_int arg3; - sh_int arg4; -}; - - - -/* - * Area definition. - */ -struct area_data -{ - AREA_DATA * next; - RESET_DATA * reset_first; - RESET_DATA * reset_last; - char * file_name; - char * name; - char * credits; - sh_int age; - sh_int nplayer; - sh_int low_range; - sh_int high_range; - sh_int min_vnum; - sh_int max_vnum; - bool empty; -}; - - - -/* - * Room type. - */ -struct room_index_data -{ - ROOM_INDEX_DATA * next; - CHAR_DATA * people; - OBJ_DATA * contents; - EXTRA_DESCR_DATA * extra_descr; - AREA_DATA * area; - EXIT_DATA * exit [6]; - EXIT_DATA * old_exit[6]; - char * name; - char * description; - char * owner; - sh_int vnum; - int room_flags; - sh_int light; - sh_int sector_type; - sh_int heal_rate; - sh_int mana_rate; - sh_int clan; -}; - - - -/* - * Types of attacks. - * Must be non-overlapping with spell/skill types, - * but may be arbitrary beyond that. - */ -#define TYPE_UNDEFINED -1 -#define TYPE_HIT 1000 - - - -/* - * Target types. - */ -#define TAR_IGNORE 0 -#define TAR_CHAR_OFFENSIVE 1 -#define TAR_CHAR_DEFENSIVE 2 -#define TAR_CHAR_SELF 3 -#define TAR_OBJ_INV 4 -#define TAR_OBJ_CHAR_DEF 5 -#define TAR_OBJ_CHAR_OFF 6 - -#define TARGET_CHAR 0 -#define TARGET_OBJ 1 -#define TARGET_ROOM 2 -#define TARGET_NONE 3 - - - -/* - * Skills include spells as a particular case. - */ -struct skill_type -{ - char * name; /* Name of skill */ - sh_int skill_level[MAX_CLASS]; /* Level needed by class */ - sh_int rating[MAX_CLASS]; /* How hard it is to learn */ - SPELL_FUN * spell_fun; /* Spell pointer (for spells) */ - sh_int target; /* Legal targets */ - sh_int minimum_position; /* Position for caster / user */ - sh_int * pgsn; /* Pointer to associated gsn */ - sh_int slot; /* Slot for #OBJECT loading */ - sh_int min_mana; /* Minimum mana used */ - sh_int beats; /* Waiting time after use */ - char * noun_damage; /* Damage message */ - char * msg_off; /* Wear off message */ - char * msg_obj; /* Wear off message for obects */ -}; - -struct group_type -{ - char * name; - sh_int rating[MAX_CLASS]; - char * spells[MAX_IN_GROUP]; -}; - - - -/* - * These are skill_lookup return values for common skills and spells. - */ -extern sh_int gsn_backstab; -extern sh_int gsn_dodge; -extern sh_int gsn_envenom; -extern sh_int gsn_hide; -extern sh_int gsn_peek; -extern sh_int gsn_pick_lock; -extern sh_int gsn_sneak; -extern sh_int gsn_steal; - -extern sh_int gsn_disarm; -extern sh_int gsn_enhanced_damage; -extern sh_int gsn_kick; -extern sh_int gsn_parry; -extern sh_int gsn_rescue; -extern sh_int gsn_second_attack; -extern sh_int gsn_third_attack; - -extern sh_int gsn_blindness; -extern sh_int gsn_charm_person; -extern sh_int gsn_curse; -extern sh_int gsn_invis; -extern sh_int gsn_mass_invis; -extern sh_int gsn_plague; -extern sh_int gsn_poison; -extern sh_int gsn_sleep; -extern sh_int gsn_fly; -extern sh_int gsn_sanctuary; - -/* new gsns */ -extern sh_int gsn_axe; -extern sh_int gsn_dagger; -extern sh_int gsn_flail; -extern sh_int gsn_mace; -extern sh_int gsn_polearm; -extern sh_int gsn_shield_block; -extern sh_int gsn_spear; -extern sh_int gsn_sword; -extern sh_int gsn_whip; - -extern sh_int gsn_bash; -extern sh_int gsn_berserk; -extern sh_int gsn_dirt; -extern sh_int gsn_hand_to_hand; -extern sh_int gsn_trip; - -extern sh_int gsn_fast_healing; -extern sh_int gsn_haggle; -extern sh_int gsn_lore; -extern sh_int gsn_meditation; - -extern sh_int gsn_scrolls; -extern sh_int gsn_staves; -extern sh_int gsn_wands; -extern sh_int gsn_recall; - - - -/* - * Utility macros. - */ -#define IS_VALID(data) ((data) != NULL && (data)->valid) -#define VALIDATE(data) ((data)->valid = TRUE) -#define INVALIDATE(data) ((data)->valid = FALSE) -#define UMIN(a, b) ((a) < (b) ? (a) : (b)) -#define UMAX(a, b) ((a) > (b) ? (a) : (b)) -#define URANGE(a, b, c) ((b) < (a) ? (a) : ((b) > (c) ? (c) : (b))) -#define LOWER(c) ((c) >= 'A' && (c) <= 'Z' ? (c)+'a'-'A' : (c)) -#define UPPER(c) ((c) >= 'a' && (c) <= 'z' ? (c)+'A'-'a' : (c)) -#define IS_SET(flag, bit) ((flag) & (bit)) -#define SET_BIT(var, bit) ((var) |= (bit)) -#define REMOVE_BIT(var, bit) ((var) &= ~(bit)) - - - -/* - * Character macros. - */ -#define IS_NPC(ch) (IS_SET((ch)->act, ACT_IS_NPC)) -#define IS_IMMORTAL(ch) (get_trust(ch) >= LEVEL_IMMORTAL) -#define IS_HERO(ch) (get_trust(ch) >= LEVEL_HERO) -#define IS_TRUSTED(ch,level) (get_trust((ch)) >= (level)) -#define IS_AFFECTED(ch, sn) (IS_SET((ch)->affected_by, (sn))) - -#define GET_AGE(ch) ((int) (17 + ((ch)->played \ - + current_time - (ch)->logon )/72000)) - -#define IS_GOOD(ch) (ch->alignment >= 350) -#define IS_EVIL(ch) (ch->alignment <= -350) -#define IS_NEUTRAL(ch) (!IS_GOOD(ch) && !IS_EVIL(ch)) - -#define IS_AWAKE(ch) (ch->position > POS_SLEEPING) -#define GET_AC(ch,type) ((ch)->armor[type] \ - + ( IS_AWAKE(ch) \ - ? dex_app[get_curr_stat(ch,STAT_DEX)].defensive : 0 )) -#define GET_HITROLL(ch) \ - ((ch)->hitroll+str_app[get_curr_stat(ch,STAT_STR)].tohit) -#define GET_DAMROLL(ch) \ - ((ch)->damroll+str_app[get_curr_stat(ch,STAT_STR)].todam) - -#define IS_OUTSIDE(ch) (!IS_SET( \ - (ch)->in_room->room_flags, \ - ROOM_INDOORS)) - -#define WAIT_STATE(ch, npulse) ((ch)->wait = UMAX((ch)->wait, (npulse))) -#define DAZE_STATE(ch, npulse) ((ch)->daze = UMAX((ch)->daze, (npulse))) -#define get_carry_weight(ch) ((ch)->carry_weight + (ch)->silver/10 + \ - (ch)->gold * 2 / 5) - -#define act(format,ch,arg1,arg2,type)\ - act_new((format),(ch),(arg1),(arg2),(type),POS_RESTING) - -/* - * Object macros. - */ -#define CAN_WEAR(obj, part) (IS_SET((obj)->wear_flags, (part))) -#define IS_OBJ_STAT(obj, stat) (IS_SET((obj)->extra_flags, (stat))) -#define IS_WEAPON_STAT(obj,stat)(IS_SET((obj)->value[4],(stat))) -#define WEIGHT_MULT(obj) ((obj)->item_type == ITEM_CONTAINER ? \ - (obj)->value[4] : 100) - - - -/* - * Description macros. - */ -#define PERS(ch, looker) ( can_see( looker, (ch) ) ? \ - ( IS_NPC(ch) ? (ch)->short_descr \ - : (ch)->name ) : "someone" ) - -/* - * Structure for a social in the socials table. - */ -struct social_type -{ - char name[20]; - char * char_no_arg; - char * others_no_arg; - char * char_found; - char * others_found; - char * vict_found; - char * char_not_found; - char * char_auto; - char * others_auto; -}; - - - -/* - * Global constants. - */ -extern const struct str_app_type str_app [26]; -extern const struct int_app_type int_app [26]; -extern const struct wis_app_type wis_app [26]; -extern const struct dex_app_type dex_app [26]; -extern const struct con_app_type con_app [26]; - -extern const struct class_type class_table [MAX_CLASS]; -extern const struct weapon_type weapon_table []; -extern const struct item_type item_table []; -extern const struct wiznet_type wiznet_table []; -extern const struct attack_type attack_table []; -extern const struct race_type race_table []; -extern const struct pc_race_type pc_race_table []; -extern const struct spec_type spec_table []; -extern const struct liq_type liq_table []; -extern const struct skill_type skill_table [MAX_SKILL]; -extern const struct group_type group_table [MAX_GROUP]; -extern struct social_type social_table [MAX_SOCIALS]; -extern char * const title_table [MAX_CLASS] - [MAX_LEVEL+1] - [2]; - - - -/* - * Global variables. - */ -extern HELP_DATA * help_first; -extern SHOP_DATA * shop_first; - -extern CHAR_DATA * char_list; -extern DESCRIPTOR_DATA * descriptor_list; -extern OBJ_DATA * object_list; - -extern char bug_buf []; -extern time_t current_time; -extern bool fLogAll; -extern FILE * fpReserve; -extern KILL_DATA kill_table []; -extern char log_buf []; -extern TIME_INFO_DATA time_info; -extern WEATHER_DATA weather_info; - -/* - * OS-dependent declarations. - * These are all very standard library functions, - * but some systems have incomplete or non-ansi header files. - */ -#if defined(_AIX) -char * crypt args( ( const char *key, const char *salt ) ); -#endif - -#if defined(apollo) -int atoi args( ( const char *string ) ); -void * calloc args( ( unsigned nelem, size_t size ) ); -char * crypt args( ( const char *key, const char *salt ) ); -#endif - -#if defined(hpux) -char * crypt args( ( const char *key, const char *salt ) ); -#endif - -#if defined(linux) -char * crypt args( ( const char *key, const char *salt ) ); -#endif - -#if defined(macintosh) -#define NOCRYPT -#if defined(unix) -#undef unix -#endif -#endif - -#if defined(MIPS_OS) -char * crypt args( ( const char *key, const char *salt ) ); -#endif - -#if defined(MSDOS) -#define NOCRYPT -#if defined(unix) -#undef unix -#endif -#endif - -#if defined(NeXT) -char * crypt args( ( const char *key, const char *salt ) ); -#endif - -#if defined(sequent) -char * crypt args( ( const char *key, const char *salt ) ); -int fclose args( ( FILE *stream ) ); -int fprintf args( ( FILE *stream, const char *format, ... ) ); -int fread args( ( void *ptr, int size, int n, FILE *stream ) ); -int fseek args( ( FILE *stream, long offset, int ptrname ) ); -void perror args( ( const char *s ) ); -int ungetc args( ( int c, FILE *stream ) ); -#endif - -#if defined(sun) -char * crypt args( ( const char *key, const char *salt ) ); -int fclose args( ( FILE *stream ) ); -int fprintf args( ( FILE *stream, const char *format, ... ) ); -#if defined(SYSV) -siz_t fread args( ( void *ptr, size_t size, size_t n, - FILE *stream) ); -#elif !defined(__SVR4) -int fread args( ( void *ptr, int size, int n, FILE *stream ) ); -#endif -int fseek args( ( FILE *stream, long offset, int ptrname ) ); -void perror args( ( const char *s ) ); -int ungetc args( ( int c, FILE *stream ) ); -#endif - -#if defined(ultrix) -char * crypt args( ( const char *key, const char *salt ) ); -#endif - - - -/* - * The crypt(3) function is not available on some operating systems. - * In particular, the U.S. Government prohibits its export from the - * United States to foreign countries. - * Turn on NOCRYPT to keep passwords in plain text. - */ -#if defined(NOCRYPT) -#define crypt(s1, s2) (s1) -#endif - - - -/* - * Data files used by the server. - * - * AREA_LIST contains a list of areas to boot. - * All files are read in completely at bootup. - * Most output files (bug, idea, typo, shutdown) are append-only. - * - * The NULL_FILE is held open so that we have a stream handle in reserve, - * so players can go ahead and telnet to all the other descriptors. - * Then we close it whenever we need to open a file (e.g. a save file). - */ -#if defined(macintosh) -#define PLAYER_DIR "" /* Player files */ -#define TEMP_FILE "romtmp" -#define NULL_FILE "proto.are" /* To reserve one stream */ -#endif - -#if defined(MSDOS) -#define PLAYER_DIR "" /* Player files */ -#define TEMP_FILE "romtmp" -#define NULL_FILE "nul" /* To reserve one stream */ -#endif - -#if defined(unix) -#define PLAYER_DIR "../player/" /* Player files */ -#define GOD_DIR "../gods/" /* list of gods */ -#define TEMP_FILE "../player/romtmp" -#define NULL_FILE "/dev/null" /* To reserve one stream */ -#endif - -#define AREA_LIST "area.lst" /* List of areas*/ -#define BUG_FILE "bugs.txt" /* For 'bug' and bug()*/ -#define TYPO_FILE "typos.txt" /* For 'typo'*/ -#define NOTE_FILE "notes.not"/* For 'notes'*/ -#define IDEA_FILE "ideas.not" -#define PENALTY_FILE "penal.not" -#define NEWS_FILE "news.not" -#define CHANGES_FILE "chang.not" -#define SHUTDOWN_FILE "shutdown.txt"/* For 'shutdown'*/ -#define BAN_FILE "ban.txt" -#define MUSIC_FILE "music.txt" - - - -/* - * Our function prototypes. - * One big lump ... this is every function in Merc. - */ -#define CD CHAR_DATA -#define MID MOB_INDEX_DATA -#define OD OBJ_DATA -#define OID OBJ_INDEX_DATA -#define RID ROOM_INDEX_DATA -#define SF SPEC_FUN -#define AD AFFECT_DATA - -/* act_comm.c */ -void check_sex args( ( CHAR_DATA *ch) ); -void add_follower args( ( CHAR_DATA *ch, CHAR_DATA *master ) ); -void stop_follower args( ( CHAR_DATA *ch ) ); -void nuke_pets args( ( CHAR_DATA *ch ) ); -void die_follower args( ( CHAR_DATA *ch ) ); -bool is_same_group args( ( CHAR_DATA *ach, CHAR_DATA *bch ) ); - -/* act_enter.c */ -RID *get_random_room args ( (CHAR_DATA *ch) ); - -/* act_info.c */ -void set_title args( ( CHAR_DATA *ch, char *title ) ); - -/* act_move.c */ -void move_char args( ( CHAR_DATA *ch, int door, bool follow ) ); - -/* act_obj.c */ -bool can_loot args( (CHAR_DATA *ch, OBJ_DATA *obj) ); -void get_obj args( ( CHAR_DATA *ch, OBJ_DATA *obj, - OBJ_DATA *container ) ); - -/* act_wiz.c */ -void wiznet args( (char *string, CHAR_DATA *ch, OBJ_DATA *obj, - long flag, long flag_skip, int min_level ) ); -/* alias.c */ -void substitute_alias args( (DESCRIPTOR_DATA *d, char *input) ); - -/* ban.c */ -bool check_ban args( ( char *site, int type) ); - - -/* comm.c */ -void show_string args( ( struct descriptor_data *d, char *input) ); -void close_socket args( ( DESCRIPTOR_DATA *dclose ) ); -void write_to_buffer args( ( DESCRIPTOR_DATA *d, const char *txt, - int length ) ); -void send_to_char args( ( const char *txt, CHAR_DATA *ch ) ); -void page_to_char args( ( const char *txt, CHAR_DATA *ch ) ); -void act args( ( const char *format, CHAR_DATA *ch, - const void *arg1, const void *arg2, int type ) ); -void act_new args( ( const char *format, CHAR_DATA *ch, - const void *arg1, const void *arg2, int type, - int min_pos) ); - -/* db.c */ -char * print_flags args( ( int flag )); -void boot_db args( ( void ) ); -void area_update args( ( void ) ); -CD * create_mobile args( ( MOB_INDEX_DATA *pMobIndex ) ); -void clone_mobile args( ( CHAR_DATA *parent, CHAR_DATA *clone) ); -OD * create_object args( ( OBJ_INDEX_DATA *pObjIndex, int level ) ); -void clone_object args( ( OBJ_DATA *parent, OBJ_DATA *clone ) ); -void clear_char args( ( CHAR_DATA *ch ) ); -char * get_extra_descr args( ( const char *name, EXTRA_DESCR_DATA *ed ) ); -MID * get_mob_index args( ( int vnum ) ); -OID * get_obj_index args( ( int vnum ) ); -RID * get_room_index args( ( int vnum ) ); -char fread_letter args( ( FILE *fp ) ); -int fread_number args( ( FILE *fp ) ); -long fread_flag args( ( FILE *fp ) ); -char * fread_string args( ( FILE *fp ) ); -char * fread_string_eol args(( FILE *fp ) ); -void fread_to_eol args( ( FILE *fp ) ); -char * fread_word args( ( FILE *fp ) ); -long flag_convert args( ( char letter) ); -void * alloc_mem args( ( int sMem ) ); -void * alloc_perm args( ( int sMem ) ); -void free_mem args( ( void *pMem, int sMem ) ); -char * str_dup args( ( const char *str ) ); -void free_string args( ( char *pstr ) ); -int number_fuzzy args( ( int number ) ); -int number_range args( ( int from, int to ) ); -int number_percent args( ( void ) ); -int number_door args( ( void ) ); -int number_bits args( ( int width ) ); -long number_mm args( ( void ) ); -int dice args( ( int number, int size ) ); -int interpolate args( ( int level, int value_00, int value_32 ) ); -void smash_tilde args( ( char *str ) ); -bool str_cmp args( ( const char *astr, const char *bstr ) ); -bool str_prefix args( ( const char *astr, const char *bstr ) ); -bool str_infix args( ( const char *astr, const char *bstr ) ); -bool str_suffix args( ( const char *astr, const char *bstr ) ); -char * capitalize args( ( const char *str ) ); -void append_file args( ( CHAR_DATA *ch, char *file, char *str ) ); -void bug args( ( const char *str, int param ) ); -void log_string args( ( const char *str ) ); -void tail_chain args( ( void ) ); - -/* effect.c */ -void acid_effect args( (void *vo, int level, int dam, int target) ); -void cold_effect args( (void *vo, int level, int dam, int target) ); -void fire_effect args( (void *vo, int level, int dam, int target) ); -void poison_effect args( (void *vo, int level, int dam, int target) ); -void shock_effect args( (void *vo, int level, int dam, int target) ); - - -/* fight.c */ -bool is_safe args( (CHAR_DATA *ch, CHAR_DATA *victim ) ); -bool is_safe_spell args( (CHAR_DATA *ch, CHAR_DATA *victim, bool area ) ); -void violence_update args( ( void ) ); -void multi_hit args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dt ) ); -bool damage args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dam, - int dt, int class, bool show ) ); -bool damage_old args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dam, - int dt, int class, bool show ) ); -void update_pos args( ( CHAR_DATA *victim ) ); -void stop_fighting args( ( CHAR_DATA *ch, bool fBoth ) ); -void check_killer args( ( CHAR_DATA *ch, CHAR_DATA *victim) ); - -/* handler.c */ -AD *affect_find args( (AFFECT_DATA *paf, int sn)); -void affect_check args( (CHAR_DATA *ch, int where, int vector) ); -int count_users args( (OBJ_DATA *obj) ); -void deduct_cost args( (CHAR_DATA *ch, int cost) ); -void affect_enchant args( (OBJ_DATA *obj) ); -int check_immune args( (CHAR_DATA *ch, int dam_type) ); -int liq_lookup args( ( const char *name) ); -int material_lookup args( ( const char *name) ); -int weapon_lookup args( ( const char *name) ); -int weapon_type args( ( const char *name) ); -char *weapon_name args( ( int weapon_Type) ); -int item_lookup args( ( const char *name) ); -char *item_name args( ( int item_type) ); -int attack_lookup args( ( const char *name) ); -int race_lookup args( ( const char *name) ); -long wiznet_lookup args( ( const char *name) ); -int class_lookup args( ( const char *name) ); -bool is_clan args( (CHAR_DATA *ch) ); -bool is_same_clan args( (CHAR_DATA *ch, CHAR_DATA *victim)); -bool is_old_mob args ( (CHAR_DATA *ch) ); -int get_skill args( ( CHAR_DATA *ch, int sn ) ); -int get_weapon_sn args( ( CHAR_DATA *ch ) ); -int get_weapon_skill args(( CHAR_DATA *ch, int sn ) ); -int get_age args( ( CHAR_DATA *ch ) ); -void reset_char args( ( CHAR_DATA *ch ) ); -int get_trust args( ( CHAR_DATA *ch ) ); -int get_curr_stat args( ( CHAR_DATA *ch, int stat ) ); -int get_max_train args( ( CHAR_DATA *ch, int stat ) ); -int can_carry_n args( ( CHAR_DATA *ch ) ); -int can_carry_w args( ( CHAR_DATA *ch ) ); -bool is_name args( ( char *str, char *namelist ) ); -bool is_exact_name args( ( char *str, char *namelist ) ); -void affect_to_char args( ( CHAR_DATA *ch, AFFECT_DATA *paf ) ); -void affect_to_obj args( ( OBJ_DATA *obj, AFFECT_DATA *paf ) ); -void affect_remove args( ( CHAR_DATA *ch, AFFECT_DATA *paf ) ); -void affect_remove_obj args( (OBJ_DATA *obj, AFFECT_DATA *paf ) ); -void affect_strip args( ( CHAR_DATA *ch, int sn ) ); -bool is_affected args( ( CHAR_DATA *ch, int sn ) ); -void affect_join args( ( CHAR_DATA *ch, AFFECT_DATA *paf ) ); -void char_from_room args( ( CHAR_DATA *ch ) ); -void char_to_room args( ( CHAR_DATA *ch, ROOM_INDEX_DATA *pRoomIndex ) ); -void obj_to_char args( ( OBJ_DATA *obj, CHAR_DATA *ch ) ); -void obj_from_char args( ( OBJ_DATA *obj ) ); -int apply_ac args( ( OBJ_DATA *obj, int iWear, int type ) ); -OD * get_eq_char args( ( CHAR_DATA *ch, int iWear ) ); -void equip_char args( ( CHAR_DATA *ch, OBJ_DATA *obj, int iWear ) ); -void unequip_char args( ( CHAR_DATA *ch, OBJ_DATA *obj ) ); -int count_obj_list args( ( OBJ_INDEX_DATA *obj, OBJ_DATA *list ) ); -void obj_from_room args( ( OBJ_DATA *obj ) ); -void obj_to_room args( ( OBJ_DATA *obj, ROOM_INDEX_DATA *pRoomIndex ) ); -void obj_to_obj args( ( OBJ_DATA *obj, OBJ_DATA *obj_to ) ); -void obj_from_obj args( ( OBJ_DATA *obj ) ); -void extract_obj args( ( OBJ_DATA *obj ) ); -void extract_char args( ( CHAR_DATA *ch, bool fPull ) ); -CD * get_char_room args( ( CHAR_DATA *ch, char *argument ) ); -CD * get_char_world args( ( CHAR_DATA *ch, char *argument ) ); -OD * get_obj_type args( ( OBJ_INDEX_DATA *pObjIndexData ) ); -OD * get_obj_list args( ( CHAR_DATA *ch, char *argument, - OBJ_DATA *list ) ); -OD * get_obj_carry args( ( CHAR_DATA *ch, char *argument, - CHAR_DATA *viewer ) ); -OD * get_obj_wear args( ( CHAR_DATA *ch, char *argument ) ); -OD * get_obj_here args( ( CHAR_DATA *ch, char *argument ) ); -OD * get_obj_world args( ( CHAR_DATA *ch, char *argument ) ); -OD * create_money args( ( int gold, int silver ) ); -int get_obj_number args( ( OBJ_DATA *obj ) ); -int get_obj_weight args( ( OBJ_DATA *obj ) ); -int get_true_weight args( ( OBJ_DATA *obj ) ); -bool room_is_dark args( ( ROOM_INDEX_DATA *pRoomIndex ) ); -bool is_room_owner args( ( CHAR_DATA *ch, ROOM_INDEX_DATA *room) ); -bool room_is_private args( ( ROOM_INDEX_DATA *pRoomIndex ) ); -bool can_see args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); -bool can_see_obj args( ( CHAR_DATA *ch, OBJ_DATA *obj ) ); -bool can_see_room args( ( CHAR_DATA *ch, ROOM_INDEX_DATA *pRoomIndex) ); -bool can_drop_obj args( ( CHAR_DATA *ch, OBJ_DATA *obj ) ); -char * affect_loc_name args( ( int location ) ); -char * affect_bit_name args( ( int vector ) ); -char * extra_bit_name args( ( int extra_flags ) ); -char * wear_bit_name args( ( int wear_flags ) ); -char * act_bit_name args( ( int act_flags ) ); -char * off_bit_name args( ( int off_flags ) ); -char * imm_bit_name args( ( int imm_flags ) ); -char * form_bit_name args( ( int form_flags ) ); -char * part_bit_name args( ( int part_flags ) ); -char * weapon_bit_name args( ( int weapon_flags ) ); -char * comm_bit_name args( ( int comm_flags ) ); -char * cont_bit_name args( ( int cont_flags) ); - - -/* interp.c */ -void interpret args( ( CHAR_DATA *ch, char *argument ) ); -bool is_number args( ( char *arg ) ); -int number_argument args( ( char *argument, char *arg ) ); -int mult_argument args( ( char *argument, char *arg) ); -char * one_argument args( ( char *argument, char *arg_first ) ); - -/* magic.c */ -int find_spell args( ( CHAR_DATA *ch, const char *name) ); -int mana_cost (CHAR_DATA *ch, int min_mana, int level); -int skill_lookup args( ( const char *name ) ); -int slot_lookup args( ( int slot ) ); -bool saves_spell args( ( int level, CHAR_DATA *victim, int dam_type ) ); -void obj_cast_spell args( ( int sn, int level, CHAR_DATA *ch, - CHAR_DATA *victim, OBJ_DATA *obj ) ); -/* save.c */ -void save_char_obj args( ( CHAR_DATA *ch ) ); -bool load_char_obj args( ( DESCRIPTOR_DATA *d, char *name ) ); - -/* skills.c */ -bool parse_gen_groups args( ( CHAR_DATA *ch,char *argument ) ); -void list_group_costs args( ( CHAR_DATA *ch ) ); -void list_group_known args( ( CHAR_DATA *ch ) ); -int exp_per_level args( ( CHAR_DATA *ch, int points ) ); -void check_improve args( ( CHAR_DATA *ch, int sn, bool success, - int multiplier ) ); -int group_lookup args( (const char *name) ); -void gn_add args( ( CHAR_DATA *ch, int gn) ); -void gn_remove args( ( CHAR_DATA *ch, int gn) ); -void group_add args( ( CHAR_DATA *ch, const char *name, bool deduct) ); -void group_remove args( ( CHAR_DATA *ch, const char *name) ); - -/* special.c */ -SF * spec_lookup args( ( const char *name ) ); -char * spec_name args( ( SPEC_FUN *function ) ); - -/* teleport.c */ -RID * room_by_name args( ( char *target, int level, bool error) ); - -/* update.c */ -void advance_level args( ( CHAR_DATA *ch, bool hide ) ); -void gain_exp args( ( CHAR_DATA *ch, int gain ) ); -void gain_condition args( ( CHAR_DATA *ch, int iCond, int value ) ); -void update_handler args( ( void ) ); - -#undef CD -#undef MID -#undef OD -#undef OID -#undef RID -#undef SF -#undef AD diff --git a/Rom24/src/music.c b/Rom24/src/music.c deleted file mode 100644 index 5883daa..0000000 --- a/Rom24/src/music.c +++ /dev/null @@ -1,350 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#include -#endif -#include -#include -#include -#include -#include "merc.h" -#include "music.h" -#include "recycle.h" - -int channel_songs[MAX_GLOBAL + 1]; -struct song_data song_table[MAX_SONGS]; - -void song_update(void) -{ - OBJ_DATA *obj; - CHAR_DATA *victim; - ROOM_INDEX_DATA *room; - DESCRIPTOR_DATA *d; - char buf[MAX_STRING_LENGTH]; - char *line; - int i; - - /* do the global song, if any */ - if (channel_songs[1] >= MAX_SONGS) - channel_songs[1] = -1; - - if (channel_songs[1] > -1) - { - if (channel_songs[0] >= MAX_LINES - || channel_songs[0] >= song_table[channel_songs[1]].lines) - { - channel_songs[0] = -1; - - /* advance songs */ - for (i = 1; i < MAX_GLOBAL; i++) - channel_songs[i] = channel_songs[i+1]; - channel_songs[MAX_GLOBAL] = -1; - } - else - { - if (channel_songs[0] < 0) - { - sprintf(buf,"Music: %s, %s", - song_table[channel_songs[1]].group, - song_table[channel_songs[1]].name); - channel_songs[0] = 0; - } - else - { - sprintf(buf,"Music: '%s'", - song_table[channel_songs[1]].lyrics[channel_songs[0]]); - channel_songs[0]++; - } - - for (d = descriptor_list; d != NULL; d = d->next) - { - victim = d->original ? d->original : d->character; - - if ( d->connected == CON_PLAYING && - !IS_SET(victim->comm,COMM_NOMUSIC) && - !IS_SET(victim->comm,COMM_QUIET) ) - act_new("$t",d->character,buf,NULL,TO_CHAR,POS_SLEEPING); - } - } - } - - for (obj = object_list; obj != NULL; obj = obj->next) - { - if (obj->item_type != ITEM_JUKEBOX || obj->value[1] < 0) - continue; - - if (obj->value[1] >= MAX_SONGS) - { - obj->value[1] = -1; - continue; - } - - /* find which room to play in */ - - if ((room = obj->in_room) == NULL) - { - if (obj->carried_by == NULL) - continue; - else - if ((room = obj->carried_by->in_room) == NULL) - continue; - } - - if (obj->value[0] < 0) - { - sprintf(buf,"$p starts playing %s, %s.", - song_table[obj->value[1]].group,song_table[obj->value[1]].name); - if (room->people != NULL) - act(buf,room->people,obj,NULL,TO_ALL); - obj->value[0] = 0; - continue; - } - else - { - if (obj->value[0] >= MAX_LINES - || obj->value[0] >= song_table[obj->value[1]].lines) - { - - obj->value[0] = -1; - - /* scroll songs forward */ - obj->value[1] = obj->value[2]; - obj->value[2] = obj->value[3]; - obj->value[3] = obj->value[4]; - obj->value[4] = -1; - continue; - } - - line = song_table[obj->value[1]].lyrics[obj->value[0]]; - obj->value[0]++; - } - - sprintf(buf,"$p bops: '%s'",line); - if (room->people != NULL) - act(buf,room->people,obj,NULL,TO_ALL); - } -} - - - -void load_songs(void) -{ - FILE *fp; - int count = 0, lines, i; - char letter; - - /* reset global */ - for (i = 0; i <= MAX_GLOBAL; i++) - channel_songs[i] = -1; - - if ((fp = fopen(MUSIC_FILE,"r")) == NULL) - { - bug("Couldn't open music file, no songs available.",0); - fclose(fp); - return; - } - - for (count = 0; count < MAX_SONGS; count++) - { - letter = fread_letter(fp); - if (letter == '#') - { - if (count < MAX_SONGS) - song_table[count].name = NULL; - fclose(fp); - return; - } - else - ungetc(letter,fp); - - song_table[count].group = fread_string(fp); - song_table[count].name = fread_string(fp); - - /* read lyrics */ - lines = 0; - - for ( ; ;) - { - letter = fread_letter(fp); - - if (letter == '~') - { - song_table[count].lines = lines; - break; - } - else - ungetc(letter,fp); - - if (lines >= MAX_LINES) - { - bug("Too many lines in a song -- limit is %d.",MAX_LINES); - break; - } - - song_table[count].lyrics[lines] = fread_string_eol(fp); - lines++; - } - } -} - -void do_play(CHAR_DATA *ch, char *argument) -{ - OBJ_DATA *juke; - char *str,arg[MAX_INPUT_LENGTH]; - int song,i; - bool global = FALSE; - - str = one_argument(argument,arg); - - for (juke = ch->in_room->contents; juke != NULL; juke = juke->next_content) - if (juke->item_type == ITEM_JUKEBOX && can_see_obj(ch,juke)) - break; - - if (argument[0] == '\0') - { - send_to_char("Play what?\n\r",ch); - return; - } - - if (juke == NULL) - { - send_to_char("You see nothing to play.\n\r",ch); - return; - } - - if (!str_cmp(arg,"list")) - { - BUFFER *buffer; - char buf[MAX_STRING_LENGTH]; - int col = 0; - bool artist = FALSE, match = FALSE; - - buffer = new_buf(); - argument = str; - argument = one_argument(argument,arg); - - if (!str_cmp(arg,"artist")) - artist = TRUE; - - if (argument[0] != '\0') - match = TRUE; - - sprintf(buf,"%s has the following songs available:\n\r", - juke->short_descr); - add_buf(buffer,capitalize(buf)); - - for (i = 0; i < MAX_SONGS; i++) - { - if (song_table[i].name == NULL) - break; - - if (artist && (!match - || !str_prefix(argument,song_table[i].group))) - sprintf(buf,"%-39s %-39s\n\r", - song_table[i].group,song_table[i].name); - else if (!artist && (!match - || !str_prefix(argument,song_table[i].name))) - sprintf(buf,"%-35s ",song_table[i].name); - else - continue; - add_buf(buffer,buf); - if (!artist && ++col % 2 == 0) - add_buf(buffer,"\n\r"); - } - if (!artist && col % 2 != 0) - add_buf(buffer,"\n\r"); - - page_to_char(buf_string(buffer),ch); - free_buf(buffer); - return; - } - - if (!str_cmp(arg,"loud")) - { - argument = str; - global = TRUE; - } - - if (argument[0] == '\0') - { - send_to_char("Play what?\n\r",ch); - return; - } - - if ((global && channel_songs[MAX_GLOBAL] > -1) - || (!global && juke->value[4] > -1)) - { - send_to_char("The jukebox is full up right now.\n\r",ch); - return; - } - - for (song = 0; song < MAX_SONGS; song++) - { - if (song_table[song].name == NULL) - { - send_to_char("That song isn't available.\n\r",ch); - return; - } - if (!str_prefix(argument,song_table[song].name)) - break; - } - - if (song >= MAX_SONGS) - { - send_to_char("That song isn't available.\n\r",ch); - return; - } - - send_to_char("Coming right up.\n\r",ch); - - if (global) - { - for (i = 1; i <= MAX_GLOBAL; i++) - if (channel_songs[i] < 0) - { - if (i == 1) - channel_songs[0] = -1; - channel_songs[i] = song; - return; - } - } - else - { - for (i = 1; i < 5; i++) - if (juke->value[i] < 0) - { - if (i == 1) - juke->value[0] = -1; - juke->value[i] = song; - return; - } - } -} diff --git a/Rom24/src/music.h b/Rom24/src/music.h deleted file mode 100644 index 15bc0e1..0000000 --- a/Rom24/src/music.h +++ /dev/null @@ -1,43 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#define MAX_SONGS 20 -#define MAX_LINES 100 /* this boils down to about 1k per song */ -#define MAX_GLOBAL 10 /* max songs the global jukebox can hold */ - -struct song_data -{ - char *group; - char *name; - char *lyrics[MAX_LINES]; - int lines; -}; - -extern struct song_data song_table[MAX_SONGS]; - -void song_update args( (void) ); -void load_songs args( (void) ); diff --git a/Rom24/src/note.c b/Rom24/src/note.c deleted file mode 100644 index ae5ebc5..0000000 --- a/Rom24/src/note.c +++ /dev/null @@ -1,960 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#include -#endif -#include -#include -#include -#include -#include -#include "merc.h" -#include "recycle.h" -#include "tables.h" - -/* globals from db.c for load_notes */ -#if !defined(macintosh) -extern int _filbuf args( (FILE *) ); -#endif -extern FILE * fpArea; -extern char strArea[MAX_INPUT_LENGTH]; - -/* local procedures */ -void load_thread(char *name, NOTE_DATA **list, int type, time_t free_time); -void parse_note(CHAR_DATA *ch, char *argument, int type); -bool hide_note(CHAR_DATA *ch, NOTE_DATA *pnote); - -NOTE_DATA *note_list; -NOTE_DATA *idea_list; -NOTE_DATA *penalty_list; -NOTE_DATA *news_list; -NOTE_DATA *changes_list; - -int count_spool(CHAR_DATA *ch, NOTE_DATA *spool) -{ - int count = 0; - NOTE_DATA *pnote; - - for (pnote = spool; pnote != NULL; pnote = pnote->next) - if (!hide_note(ch,pnote)) - count++; - - return count; -} - -void do_unread(CHAR_DATA *ch) -{ - char buf[MAX_STRING_LENGTH]; - int count; - bool found = FALSE; - - if (IS_NPC(ch)) - return; - - if ((count = count_spool(ch,news_list)) > 0) - { - found = TRUE; - sprintf(buf,"There %s %d new news article%s waiting.\n\r", - count > 1 ? "are" : "is",count, count > 1 ? "s" : ""); - send_to_char(buf,ch); - } - if ((count = count_spool(ch,changes_list)) > 0) - { - found = TRUE; - sprintf(buf,"There %s %d change%s waiting to be read.\n\r", - count > 1 ? "are" : "is", count, count > 1 ? "s" : ""); - send_to_char(buf,ch); - } - if ((count = count_spool(ch,note_list)) > 0) - { - found = TRUE; - sprintf(buf,"You have %d new note%s waiting.\n\r", - count, count > 1 ? "s" : ""); - send_to_char(buf,ch); - } - if ((count = count_spool(ch,idea_list)) > 0) - { - found = TRUE; - sprintf(buf,"You have %d unread idea%s to peruse.\n\r", - count, count > 1 ? "s" : ""); - send_to_char(buf,ch); - } - if (IS_TRUSTED(ch,ANGEL) && (count = count_spool(ch,penalty_list)) > 0) - { - found = TRUE; - sprintf(buf,"%d %s been added.\n\r", - count, count > 1 ? "penalties have" : "penalty has"); - send_to_char(buf,ch); - } - - if (!found) - send_to_char("You have no unread notes.\n\r",ch); -} - -void do_note(CHAR_DATA *ch,char *argument) -{ - parse_note(ch,argument,NOTE_NOTE); -} - -void do_idea(CHAR_DATA *ch,char *argument) -{ - parse_note(ch,argument,NOTE_IDEA); -} - -void do_penalty(CHAR_DATA *ch,char *argument) -{ - parse_note(ch,argument,NOTE_PENALTY); -} - -void do_news(CHAR_DATA *ch,char *argument) -{ - parse_note(ch,argument,NOTE_NEWS); -} - -void do_changes(CHAR_DATA *ch,char *argument) -{ - parse_note(ch,argument,NOTE_CHANGES); -} - -void save_notes(int type) -{ - FILE *fp; - char *name; - NOTE_DATA *pnote; - - switch (type) - { - default: - return; - case NOTE_NOTE: - name = NOTE_FILE; - pnote = note_list; - break; - case NOTE_IDEA: - name = IDEA_FILE; - pnote = idea_list; - break; - case NOTE_PENALTY: - name = PENALTY_FILE; - pnote = penalty_list; - break; - case NOTE_NEWS: - name = NEWS_FILE; - pnote = news_list; - break; - case NOTE_CHANGES: - name = CHANGES_FILE; - pnote = changes_list; - break; - } - - fclose( fpReserve ); - if ( ( fp = fopen( name, "w" ) ) == NULL ) - { - perror( name ); - } - else - { - for ( ; pnote != NULL; pnote = pnote->next ) - { - fprintf( fp, "Sender %s~\n", pnote->sender); - fprintf( fp, "Date %s~\n", pnote->date); - fprintf( fp, "Stamp %ld\n", pnote->date_stamp); - fprintf( fp, "To %s~\n", pnote->to_list); - fprintf( fp, "Subject %s~\n", pnote->subject); - fprintf( fp, "Text\n%s~\n", pnote->text); - } - fclose( fp ); - fpReserve = fopen( NULL_FILE, "r" ); - return; - } -} -void load_notes(void) -{ - load_thread(NOTE_FILE,¬e_list, NOTE_NOTE, 14*24*60*60); - load_thread(IDEA_FILE,&idea_list, NOTE_IDEA, 28*24*60*60); - load_thread(PENALTY_FILE,&penalty_list, NOTE_PENALTY, 0); - load_thread(NEWS_FILE,&news_list, NOTE_NEWS, 0); - load_thread(CHANGES_FILE,&changes_list,NOTE_CHANGES, 0); -} - -void load_thread(char *name, NOTE_DATA **list, int type, time_t free_time) -{ - FILE *fp; - NOTE_DATA *pnotelast; - - if ( ( fp = fopen( name, "r" ) ) == NULL ) - return; - - pnotelast = NULL; - for ( ; ; ) - { - NOTE_DATA *pnote; - char letter; - - do - { - letter = getc( fp ); - if ( feof(fp) ) - { - fclose( fp ); - return; - } - } - while ( isspace(letter) ); - ungetc( letter, fp ); - - pnote = alloc_perm( sizeof(*pnote) ); - - if ( str_cmp( fread_word( fp ), "sender" ) ) - break; - pnote->sender = fread_string( fp ); - - if ( str_cmp( fread_word( fp ), "date" ) ) - break; - pnote->date = fread_string( fp ); - - if ( str_cmp( fread_word( fp ), "stamp" ) ) - break; - pnote->date_stamp = fread_number(fp); - - if ( str_cmp( fread_word( fp ), "to" ) ) - break; - pnote->to_list = fread_string( fp ); - - if ( str_cmp( fread_word( fp ), "subject" ) ) - break; - pnote->subject = fread_string( fp ); - - if ( str_cmp( fread_word( fp ), "text" ) ) - break; - pnote->text = fread_string( fp ); - - if (free_time && pnote->date_stamp < current_time - free_time) - { - free_note(pnote); - continue; - } - - pnote->type = type; - - if (*list == NULL) - *list = pnote; - else - pnotelast->next = pnote; - - pnotelast = pnote; - } - - strcpy( strArea, NOTE_FILE ); - fpArea = fp; - bug( "Load_notes: bad key word.", 0 ); - exit( 1 ); - return; -} - -void append_note(NOTE_DATA *pnote) -{ - FILE *fp; - char *name; - NOTE_DATA **list; - NOTE_DATA *last; - - switch(pnote->type) - { - default: - return; - case NOTE_NOTE: - name = NOTE_FILE; - list = ¬e_list; - break; - case NOTE_IDEA: - name = IDEA_FILE; - list = &idea_list; - break; - case NOTE_PENALTY: - name = PENALTY_FILE; - list = &penalty_list; - break; - case NOTE_NEWS: - name = NEWS_FILE; - list = &news_list; - break; - case NOTE_CHANGES: - name = CHANGES_FILE; - list = &changes_list; - break; - } - - if (*list == NULL) - *list = pnote; - else - { - for ( last = *list; last->next != NULL; last = last->next); - last->next = pnote; - } - - fclose(fpReserve); - if ( ( fp = fopen(name, "a" ) ) == NULL ) - { - perror(name); - } - else - { - fprintf( fp, "Sender %s~\n", pnote->sender); - fprintf( fp, "Date %s~\n", pnote->date); - fprintf( fp, "Stamp %ld\n", pnote->date_stamp); - fprintf( fp, "To %s~\n", pnote->to_list); - fprintf( fp, "Subject %s~\n", pnote->subject); - fprintf( fp, "Text\n%s~\n", pnote->text); - fclose( fp ); - } - fpReserve = fopen( NULL_FILE, "r" ); -} - -bool is_note_to( CHAR_DATA *ch, NOTE_DATA *pnote ) -{ - if ( !str_cmp( ch->name, pnote->sender ) ) - return TRUE; - - if ( is_exact_name( "all", pnote->to_list ) ) - return TRUE; - - if ( IS_IMMORTAL(ch) && is_exact_name( "immortal", pnote->to_list ) ) - return TRUE; - - if (ch->clan && is_exact_name(clan_table[ch->clan].name,pnote->to_list)) - return TRUE; - - if (is_exact_name( ch->name, pnote->to_list ) ) - return TRUE; - - return FALSE; -} - - - -void note_attach( CHAR_DATA *ch, int type ) -{ - NOTE_DATA *pnote; - - if ( ch->pnote != NULL ) - return; - - pnote = new_note(); - - pnote->next = NULL; - pnote->sender = str_dup( ch->name ); - pnote->date = str_dup( "" ); - pnote->to_list = str_dup( "" ); - pnote->subject = str_dup( "" ); - pnote->text = str_dup( "" ); - pnote->type = type; - ch->pnote = pnote; - return; -} - - - -void note_remove( CHAR_DATA *ch, NOTE_DATA *pnote, bool delete) -{ - char to_new[MAX_INPUT_LENGTH]; - char to_one[MAX_INPUT_LENGTH]; - NOTE_DATA *prev; - NOTE_DATA **list; - char *to_list; - - if (!delete) - { - /* make a new list */ - to_new[0] = '\0'; - to_list = pnote->to_list; - while ( *to_list != '\0' ) - { - to_list = one_argument( to_list, to_one ); - if ( to_one[0] != '\0' && str_cmp( ch->name, to_one ) ) - { - strcat( to_new, " " ); - strcat( to_new, to_one ); - } - } - /* Just a simple recipient removal? */ - if ( str_cmp( ch->name, pnote->sender ) && to_new[0] != '\0' ) - { - free_string( pnote->to_list ); - pnote->to_list = str_dup( to_new + 1 ); - return; - } - } - /* nuke the whole note */ - - switch(pnote->type) - { - default: - return; - case NOTE_NOTE: - list = ¬e_list; - break; - case NOTE_IDEA: - list = &idea_list; - break; - case NOTE_PENALTY: - list = &penalty_list; - break; - case NOTE_NEWS: - list = &news_list; - break; - case NOTE_CHANGES: - list = &changes_list; - break; - } - - /* - * Remove note from linked list. - */ - if ( pnote == *list ) - { - *list = pnote->next; - } - else - { - for ( prev = *list; prev != NULL; prev = prev->next ) - { - if ( prev->next == pnote ) - break; - } - - if ( prev == NULL ) - { - bug( "Note_remove: pnote not found.", 0 ); - return; - } - - prev->next = pnote->next; - } - - save_notes(pnote->type); - free_note(pnote); - return; -} - -bool hide_note (CHAR_DATA *ch, NOTE_DATA *pnote) -{ - time_t last_read; - - if (IS_NPC(ch)) - return TRUE; - - switch (pnote->type) - { - default: - return TRUE; - case NOTE_NOTE: - last_read = ch->pcdata->last_note; - break; - case NOTE_IDEA: - last_read = ch->pcdata->last_idea; - break; - case NOTE_PENALTY: - last_read = ch->pcdata->last_penalty; - break; - case NOTE_NEWS: - last_read = ch->pcdata->last_news; - break; - case NOTE_CHANGES: - last_read = ch->pcdata->last_changes; - break; - } - - if (pnote->date_stamp <= last_read) - return TRUE; - - if (!str_cmp(ch->name,pnote->sender)) - return TRUE; - - if (!is_note_to(ch,pnote)) - return TRUE; - - return FALSE; -} - -void update_read(CHAR_DATA *ch, NOTE_DATA *pnote) -{ - time_t stamp; - - if (IS_NPC(ch)) - return; - - stamp = pnote->date_stamp; - - switch (pnote->type) - { - default: - return; - case NOTE_NOTE: - ch->pcdata->last_note = UMAX(ch->pcdata->last_note,stamp); - break; - case NOTE_IDEA: - ch->pcdata->last_idea = UMAX(ch->pcdata->last_idea,stamp); - break; - case NOTE_PENALTY: - ch->pcdata->last_penalty = UMAX(ch->pcdata->last_penalty,stamp); - break; - case NOTE_NEWS: - ch->pcdata->last_news = UMAX(ch->pcdata->last_news,stamp); - break; - case NOTE_CHANGES: - ch->pcdata->last_changes = UMAX(ch->pcdata->last_changes,stamp); - break; - } -} - -void parse_note( CHAR_DATA *ch, char *argument, int type ) -{ - BUFFER *buffer; - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - NOTE_DATA *pnote; - NOTE_DATA **list; - char *list_name; - int vnum; - int anum; - - if ( IS_NPC(ch) ) - return; - - switch(type) - { - default: - return; - case NOTE_NOTE: - list = ¬e_list; - list_name = "notes"; - break; - case NOTE_IDEA: - list = &idea_list; - list_name = "ideas"; - break; - case NOTE_PENALTY: - list = &penalty_list; - list_name = "penalties"; - break; - case NOTE_NEWS: - list = &news_list; - list_name = "news"; - break; - case NOTE_CHANGES: - list = &changes_list; - list_name = "changes"; - break; - } - - argument = one_argument( argument, arg ); - smash_tilde( argument ); - - if ( arg[0] == '\0' || !str_prefix( arg, "read" ) ) - { - bool fAll; - - if ( !str_cmp( argument, "all" ) ) - { - fAll = TRUE; - anum = 0; - } - - else if ( argument[0] == '\0' || !str_prefix(argument, "next")) - /* read next unread note */ - { - vnum = 0; - for ( pnote = *list; pnote != NULL; pnote = pnote->next) - { - if (!hide_note(ch,pnote)) - { - sprintf( buf, "[%3d] %s: %s\n\r%s\n\rTo: %s\n\r", - vnum, - pnote->sender, - pnote->subject, - pnote->date, - pnote->to_list); - send_to_char( buf, ch ); - page_to_char( pnote->text, ch ); - update_read(ch,pnote); - return; - } - else if (is_note_to(ch,pnote)) - vnum++; - } - sprintf(buf,"You have no unread %s.\n\r",list_name); - send_to_char(buf,ch); - return; - } - - else if ( is_number( argument ) ) - { - fAll = FALSE; - anum = atoi( argument ); - } - else - { - send_to_char( "Read which number?\n\r", ch ); - return; - } - - vnum = 0; - for ( pnote = *list; pnote != NULL; pnote = pnote->next ) - { - if ( is_note_to( ch, pnote ) && ( vnum++ == anum || fAll ) ) - { - sprintf( buf, "[%3d] %s: %s\n\r%s\n\rTo: %s\n\r", - vnum - 1, - pnote->sender, - pnote->subject, - pnote->date, - pnote->to_list - ); - send_to_char( buf, ch ); - page_to_char( pnote->text, ch ); - update_read(ch,pnote); - return; - } - } - - sprintf(buf,"There aren't that many %s.\n\r",list_name); - send_to_char(buf,ch); - return; - } - - if ( !str_prefix( arg, "list" ) ) - { - vnum = 0; - for ( pnote = *list; pnote != NULL; pnote = pnote->next ) - { - if ( is_note_to( ch, pnote ) ) - { - sprintf( buf, "[%3d%s] %s: %s\n\r", - vnum, hide_note(ch,pnote) ? " " : "N", - pnote->sender, pnote->subject ); - send_to_char( buf, ch ); - vnum++; - } - } - if (!vnum) - { - switch(type) - { - case NOTE_NOTE: - send_to_char("There are no notes for you.\n\r",ch); - break; - case NOTE_IDEA: - send_to_char("There are no ideas for you.\n\r",ch); - break; - case NOTE_PENALTY: - send_to_char("There are no penalties for you.\n\r",ch); - break; - case NOTE_NEWS: - send_to_char("There is no news for you.\n\r",ch); - break; - case NOTE_CHANGES: - send_to_char("There are no changes for you.\n\r",ch); - break; - } - } - return; - } - - if ( !str_prefix( arg, "remove" ) ) - { - if ( !is_number( argument ) ) - { - send_to_char( "Note remove which number?\n\r", ch ); - return; - } - - anum = atoi( argument ); - vnum = 0; - for ( pnote = *list; pnote != NULL; pnote = pnote->next ) - { - if ( is_note_to( ch, pnote ) && vnum++ == anum ) - { - note_remove( ch, pnote, FALSE ); - send_to_char( "Ok.\n\r", ch ); - return; - } - } - - sprintf(buf,"There aren't that many %s.",list_name); - send_to_char(buf,ch); - return; - } - - if ( !str_prefix( arg, "delete" ) && get_trust(ch) >= MAX_LEVEL - 1) - { - if ( !is_number( argument ) ) - { - send_to_char( "Note delete which number?\n\r", ch ); - return; - } - - anum = atoi( argument ); - vnum = 0; - for ( pnote = *list; pnote != NULL; pnote = pnote->next ) - { - if ( is_note_to( ch, pnote ) && vnum++ == anum ) - { - note_remove( ch, pnote,TRUE ); - send_to_char( "Ok.\n\r", ch ); - return; - } - } - - sprintf(buf,"There aren't that many %s.",list_name); - send_to_char(buf,ch); - return; - } - - if (!str_prefix(arg,"catchup")) - { - switch(type) - { - case NOTE_NOTE: - ch->pcdata->last_note = current_time; - break; - case NOTE_IDEA: - ch->pcdata->last_idea = current_time; - break; - case NOTE_PENALTY: - ch->pcdata->last_penalty = current_time; - break; - case NOTE_NEWS: - ch->pcdata->last_news = current_time; - break; - case NOTE_CHANGES: - ch->pcdata->last_changes = current_time; - break; - } - return; - } - - /* below this point only certain people can edit notes */ - if ((type == NOTE_NEWS && !IS_TRUSTED(ch,ANGEL)) - || (type == NOTE_CHANGES && !IS_TRUSTED(ch,CREATOR))) - { - sprintf(buf,"You aren't high enough level to write %s.",list_name); - send_to_char(buf,ch); - return; - } - - if ( !str_cmp( arg, "+" ) ) - { - note_attach( ch,type ); - if (ch->pnote->type != type) - { - send_to_char( - "You already have a different note in progress.\n\r",ch); - return; - } - - if (strlen(ch->pnote->text)+strlen(argument) >= 4096) - { - send_to_char( "Note too long.\n\r", ch ); - return; - } - - buffer = new_buf(); - - add_buf(buffer,ch->pnote->text); - add_buf(buffer,argument); - add_buf(buffer,"\n\r"); - free_string( ch->pnote->text ); - ch->pnote->text = str_dup( buf_string(buffer) ); - free_buf(buffer); - send_to_char( "Ok.\n\r", ch ); - return; - } - - if (!str_cmp(arg,"-")) - { - int len; - bool found = FALSE; - - note_attach(ch,type); - if (ch->pnote->type != type) - { - send_to_char( - "You already have a different note in progress.\n\r",ch); - return; - } - - if (ch->pnote->text == NULL || ch->pnote->text[0] == '\0') - { - send_to_char("No lines left to remove.\n\r",ch); - return; - } - - strcpy(buf,ch->pnote->text); - - for (len = strlen(buf); len > 0; len--) - { - if (buf[len] == '\r') - { - if (!found) /* back it up */ - { - if (len > 0) - len--; - found = TRUE; - } - else /* found the second one */ - { - buf[len + 1] = '\0'; - free_string(ch->pnote->text); - ch->pnote->text = str_dup(buf); - return; - } - } - } - buf[0] = '\0'; - free_string(ch->pnote->text); - ch->pnote->text = str_dup(buf); - return; - } - - if ( !str_prefix( arg, "subject" ) ) - { - note_attach( ch,type ); - if (ch->pnote->type != type) - { - send_to_char( - "You already have a different note in progress.\n\r",ch); - return; - } - - free_string( ch->pnote->subject ); - ch->pnote->subject = str_dup( argument ); - send_to_char( "Ok.\n\r", ch ); - return; - } - - if ( !str_prefix( arg, "to" ) ) - { - note_attach( ch,type ); - if (ch->pnote->type != type) - { - send_to_char( - "You already have a different note in progress.\n\r",ch); - return; - } - free_string( ch->pnote->to_list ); - ch->pnote->to_list = str_dup( argument ); - send_to_char( "Ok.\n\r", ch ); - return; - } - - if ( !str_prefix( arg, "clear" ) ) - { - if ( ch->pnote != NULL ) - { - free_note(ch->pnote); - ch->pnote = NULL; - } - - send_to_char( "Ok.\n\r", ch ); - return; - } - - if ( !str_prefix( arg, "show" ) ) - { - if ( ch->pnote == NULL ) - { - send_to_char( "You have no note in progress.\n\r", ch ); - return; - } - - if (ch->pnote->type != type) - { - send_to_char("You aren't working on that kind of note.\n\r",ch); - return; - } - - sprintf( buf, "%s: %s\n\rTo: %s\n\r", - ch->pnote->sender, - ch->pnote->subject, - ch->pnote->to_list - ); - send_to_char( buf, ch ); - send_to_char( ch->pnote->text, ch ); - return; - } - - if ( !str_prefix( arg, "post" ) || !str_prefix(arg, "send")) - { - char *strtime; - - if ( ch->pnote == NULL ) - { - send_to_char( "You have no note in progress.\n\r", ch ); - return; - } - - if (ch->pnote->type != type) - { - send_to_char("You aren't working on that kind of note.\n\r",ch); - return; - } - - if (!str_cmp(ch->pnote->to_list,"")) - { - send_to_char( - "You need to provide a recipient (name, all, or immortal).\n\r", - ch); - return; - } - - if (!str_cmp(ch->pnote->subject,"")) - { - send_to_char("You need to provide a subject.\n\r",ch); - return; - } - - ch->pnote->next = NULL; - strtime = ctime( ¤t_time ); - strtime[strlen(strtime)-1] = '\0'; - ch->pnote->date = str_dup( strtime ); - ch->pnote->date_stamp = current_time; - - append_note(ch->pnote); - ch->pnote = NULL; - return; - } - - send_to_char( "You can't do that.\n\r", ch ); - return; -} - diff --git a/Rom24/src/recycle.c b/Rom24/src/recycle.c deleted file mode 100644 index 8239101..0000000 --- a/Rom24/src/recycle.c +++ /dev/null @@ -1,652 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#include -#else -#include -#include -#endif -#include -#include -#include -#include "merc.h" -#include "recycle.h" - -/* stuff for recyling notes */ -NOTE_DATA *note_free; - -NOTE_DATA *new_note() -{ - NOTE_DATA *note; - - if (note_free == NULL) - note = alloc_perm(sizeof(*note)); - else - { - note = note_free; - note_free = note_free->next; - } - VALIDATE(note); - return note; -} - -void free_note(NOTE_DATA *note) -{ - if (!IS_VALID(note)) - return; - - free_string( note->text ); - free_string( note->subject ); - free_string( note->to_list ); - free_string( note->date ); - free_string( note->sender ); - INVALIDATE(note); - - note->next = note_free; - note_free = note; -} - - -/* stuff for recycling ban structures */ -BAN_DATA *ban_free; - -BAN_DATA *new_ban(void) -{ - static BAN_DATA ban_zero; - BAN_DATA *ban; - - if (ban_free == NULL) - ban = alloc_perm(sizeof(*ban)); - else - { - ban = ban_free; - ban_free = ban_free->next; - } - - *ban = ban_zero; - VALIDATE(ban); - ban->name = &str_empty[0]; - return ban; -} - -void free_ban(BAN_DATA *ban) -{ - if (!IS_VALID(ban)) - return; - - free_string(ban->name); - INVALIDATE(ban); - - ban->next = ban_free; - ban_free = ban; -} - -/* stuff for recycling descriptors */ -DESCRIPTOR_DATA *descriptor_free; - -DESCRIPTOR_DATA *new_descriptor(void) -{ - static DESCRIPTOR_DATA d_zero; - DESCRIPTOR_DATA *d; - - if (descriptor_free == NULL) - d = alloc_perm(sizeof(*d)); - else - { - d = descriptor_free; - descriptor_free = descriptor_free->next; - } - - *d = d_zero; - VALIDATE(d); - return d; -} - -void free_descriptor(DESCRIPTOR_DATA *d) -{ - if (!IS_VALID(d)) - return; - - free_string( d->host ); - free_mem( d->outbuf, d->outsize ); - INVALIDATE(d); - d->next = descriptor_free; - descriptor_free = d; -} - -/* stuff for recycling gen_data */ -GEN_DATA *gen_data_free; - -GEN_DATA *new_gen_data(void) -{ - static GEN_DATA gen_zero; - GEN_DATA *gen; - - if (gen_data_free == NULL) - gen = alloc_perm(sizeof(*gen)); - else - { - gen = gen_data_free; - gen_data_free = gen_data_free->next; - } - *gen = gen_zero; - VALIDATE(gen); - return gen; -} - -void free_gen_data(GEN_DATA *gen) -{ - if (!IS_VALID(gen)) - return; - - INVALIDATE(gen); - - gen->next = gen_data_free; - gen_data_free = gen; -} - -/* stuff for recycling extended descs */ -EXTRA_DESCR_DATA *extra_descr_free; - -EXTRA_DESCR_DATA *new_extra_descr(void) -{ - EXTRA_DESCR_DATA *ed; - - if (extra_descr_free == NULL) - ed = alloc_perm(sizeof(*ed)); - else - { - ed = extra_descr_free; - extra_descr_free = extra_descr_free->next; - } - - ed->keyword = &str_empty[0]; - ed->description = &str_empty[0]; - VALIDATE(ed); - return ed; -} - -void free_extra_descr(EXTRA_DESCR_DATA *ed) -{ - if (!IS_VALID(ed)) - return; - - free_string(ed->keyword); - free_string(ed->description); - INVALIDATE(ed); - - ed->next = extra_descr_free; - extra_descr_free = ed; -} - - -/* stuff for recycling affects */ -AFFECT_DATA *affect_free; - -AFFECT_DATA *new_affect(void) -{ - static AFFECT_DATA af_zero; - AFFECT_DATA *af; - - if (affect_free == NULL) - af = alloc_perm(sizeof(*af)); - else - { - af = affect_free; - affect_free = affect_free->next; - } - - *af = af_zero; - - - VALIDATE(af); - return af; -} - -void free_affect(AFFECT_DATA *af) -{ - if (!IS_VALID(af)) - return; - - INVALIDATE(af); - af->next = affect_free; - affect_free = af; -} - -/* stuff for recycling objects */ -OBJ_DATA *obj_free; - -OBJ_DATA *new_obj(void) -{ - static OBJ_DATA obj_zero; - OBJ_DATA *obj; - - if (obj_free == NULL) - obj = alloc_perm(sizeof(*obj)); - else - { - obj = obj_free; - obj_free = obj_free->next; - } - *obj = obj_zero; - VALIDATE(obj); - - return obj; -} - -void free_obj(OBJ_DATA *obj) -{ - AFFECT_DATA *paf, *paf_next; - EXTRA_DESCR_DATA *ed, *ed_next; - - if (!IS_VALID(obj)) - return; - - for (paf = obj->affected; paf != NULL; paf = paf_next) - { - paf_next = paf->next; - free_affect(paf); - } - obj->affected = NULL; - - for (ed = obj->extra_descr; ed != NULL; ed = ed_next ) - { - ed_next = ed->next; - free_extra_descr(ed); - } - obj->extra_descr = NULL; - - free_string( obj->name ); - free_string( obj->description ); - free_string( obj->short_descr ); - free_string( obj->owner ); - INVALIDATE(obj); - - obj->next = obj_free; - obj_free = obj; -} - - -/* stuff for recyling characters */ -CHAR_DATA *char_free; - -CHAR_DATA *new_char (void) -{ - static CHAR_DATA ch_zero; - CHAR_DATA *ch; - int i; - - if (char_free == NULL) - ch = alloc_perm(sizeof(*ch)); - else - { - ch = char_free; - char_free = char_free->next; - } - - *ch = ch_zero; - VALIDATE(ch); - ch->name = &str_empty[0]; - ch->short_descr = &str_empty[0]; - ch->long_descr = &str_empty[0]; - ch->description = &str_empty[0]; - ch->prompt = &str_empty[0]; - ch->prefix = &str_empty[0]; - ch->logon = current_time; - ch->lines = PAGELEN; - for (i = 0; i < 4; i++) - ch->armor[i] = 100; - ch->position = POS_STANDING; - ch->hit = 20; - ch->max_hit = 20; - ch->mana = 100; - ch->max_mana = 100; - ch->move = 100; - ch->max_move = 100; - for (i = 0; i < MAX_STATS; i ++) - { - ch->perm_stat[i] = 13; - ch->mod_stat[i] = 0; - } - - return ch; -} - - -void free_char (CHAR_DATA *ch) -{ - OBJ_DATA *obj; - OBJ_DATA *obj_next; - AFFECT_DATA *paf; - AFFECT_DATA *paf_next; - - if (!IS_VALID(ch)) - return; - - if (IS_NPC(ch)) - mobile_count--; - - for (obj = ch->carrying; obj != NULL; obj = obj_next) - { - obj_next = obj->next_content; - extract_obj(obj); - } - - for (paf = ch->affected; paf != NULL; paf = paf_next) - { - paf_next = paf->next; - affect_remove(ch,paf); - } - - free_string(ch->name); - free_string(ch->short_descr); - free_string(ch->long_descr); - free_string(ch->description); - free_string(ch->prompt); - free_string(ch->prefix); - free_note (ch->pnote); - free_pcdata(ch->pcdata); - - ch->next = char_free; - char_free = ch; - - INVALIDATE(ch); - return; -} - -PC_DATA *pcdata_free; - -PC_DATA *new_pcdata(void) -{ - int alias; - - static PC_DATA pcdata_zero; - PC_DATA *pcdata; - - if (pcdata_free == NULL) - pcdata = alloc_perm(sizeof(*pcdata)); - else - { - pcdata = pcdata_free; - pcdata_free = pcdata_free->next; - } - - *pcdata = pcdata_zero; - - for (alias = 0; alias < MAX_ALIAS; alias++) - { - pcdata->alias[alias] = NULL; - pcdata->alias_sub[alias] = NULL; - } - - pcdata->buffer = new_buf(); - - VALIDATE(pcdata); - return pcdata; -} - - -void free_pcdata(PC_DATA *pcdata) -{ - int alias; - - if (!IS_VALID(pcdata)) - return; - - free_string(pcdata->pwd); - free_string(pcdata->bamfin); - free_string(pcdata->bamfout); - free_string(pcdata->title); - free_buf(pcdata->buffer); - - for (alias = 0; alias < MAX_ALIAS; alias++) - { - free_string(pcdata->alias[alias]); - free_string(pcdata->alias_sub[alias]); - } - INVALIDATE(pcdata); - pcdata->next = pcdata_free; - pcdata_free = pcdata; - - return; -} - - - - -/* stuff for setting ids */ -long last_pc_id; -long last_mob_id; - -long get_pc_id(void) -{ - int val; - - val = (current_time <= last_pc_id) ? last_pc_id + 1 : current_time; - last_pc_id = val; - return val; -} - -long get_mob_id(void) -{ - last_mob_id++; - return last_mob_id; -} - -MEM_DATA *mem_data_free; - -/* procedures and constants needed for buffering */ - -BUFFER *buf_free; - -MEM_DATA *new_mem_data(void) -{ - MEM_DATA *memory; - - if (mem_data_free == NULL) - memory = alloc_mem(sizeof(*memory)); - else - { - memory = mem_data_free; - mem_data_free = mem_data_free->next; - } - - memory->next = NULL; - memory->id = 0; - memory->reaction = 0; - memory->when = 0; - VALIDATE(memory); - - return memory; -} - -void free_mem_data(MEM_DATA *memory) -{ - if (!IS_VALID(memory)) - return; - - memory->next = mem_data_free; - mem_data_free = memory; - INVALIDATE(memory); -} - - - -/* buffer sizes */ -const int buf_size[MAX_BUF_LIST] = -{ - 16,32,64,128,256,1024,2048,4096,8192,16384 -}; - -/* local procedure for finding the next acceptable size */ -/* -1 indicates out-of-boundary error */ -int get_size (int val) -{ - int i; - - for (i = 0; i < MAX_BUF_LIST; i++) - if (buf_size[i] >= val) - { - return buf_size[i]; - } - - return -1; -} - -BUFFER *new_buf() -{ - BUFFER *buffer; - - if (buf_free == NULL) - buffer = alloc_perm(sizeof(*buffer)); - else - { - buffer = buf_free; - buf_free = buf_free->next; - } - - buffer->next = NULL; - buffer->state = BUFFER_SAFE; - buffer->size = get_size(BASE_BUF); - - buffer->string = alloc_mem(buffer->size); - buffer->string[0] = '\0'; - VALIDATE(buffer); - - return buffer; -} - -BUFFER *new_buf_size(int size) -{ - BUFFER *buffer; - - if (buf_free == NULL) - buffer = alloc_perm(sizeof(*buffer)); - else - { - buffer = buf_free; - buf_free = buf_free->next; - } - - buffer->next = NULL; - buffer->state = BUFFER_SAFE; - buffer->size = get_size(size); - if (buffer->size == -1) - { - bug("new_buf: buffer size %d too large.",size); - exit(1); - } - buffer->string = alloc_mem(buffer->size); - buffer->string[0] = '\0'; - VALIDATE(buffer); - - return buffer; -} - - -void free_buf(BUFFER *buffer) -{ - if (!IS_VALID(buffer)) - return; - - free_mem(buffer->string,buffer->size); - buffer->string = NULL; - buffer->size = 0; - buffer->state = BUFFER_FREED; - INVALIDATE(buffer); - - buffer->next = buf_free; - buf_free = buffer; -} - - -bool add_buf(BUFFER *buffer, char *string) -{ - int len; - char *oldstr; - int oldsize; - - oldstr = buffer->string; - oldsize = buffer->size; - - if (buffer->state == BUFFER_OVERFLOW) /* don't waste time on bad strings! */ - return FALSE; - - len = strlen(buffer->string) + strlen(string) + 1; - - while (len >= buffer->size) /* increase the buffer size */ - { - buffer->size = get_size(buffer->size + 1); - { - if (buffer->size == -1) /* overflow */ - { - buffer->size = oldsize; - buffer->state = BUFFER_OVERFLOW; - bug("buffer overflow past size %d",buffer->size); - return FALSE; - } - } - } - - if (buffer->size != oldsize) - { - buffer->string = alloc_mem(buffer->size); - - strcpy(buffer->string,oldstr); - free_mem(oldstr,oldsize); - } - - strcat(buffer->string,string); - return TRUE; -} - - -void clear_buf(BUFFER *buffer) -{ - buffer->string[0] = '\0'; - buffer->state = BUFFER_SAFE; -} - - -char *buf_string(BUFFER *buffer) -{ - return buffer->string; -} - - - - - - - - - - - - diff --git a/Rom24/src/recycle.h b/Rom24/src/recycle.h deleted file mode 100644 index 873b4b1..0000000 --- a/Rom24/src/recycle.h +++ /dev/null @@ -1,112 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -/* externs */ -extern char str_empty[1]; -extern int mobile_count; - -/* stuff for providing a crash-proof buffer */ - -#define MAX_BUF 16384 -#define MAX_BUF_LIST 10 -#define BASE_BUF 1024 - -/* valid states */ -#define BUFFER_SAFE 0 -#define BUFFER_OVERFLOW 1 -#define BUFFER_FREED 2 - -/* note recycling */ -#define ND NOTE_DATA -ND *new_note args( (void) ); -void free_note args( (NOTE_DATA *note) ); -#undef ND - -/* ban data recycling */ -#define BD BAN_DATA -BD *new_ban args( (void) ); -void free_ban args( (BAN_DATA *ban) ); -#undef BD - -/* descriptor recycling */ -#define DD DESCRIPTOR_DATA -DD *new_descriptor args( (void) ); -void free_descriptor args( (DESCRIPTOR_DATA *d) ); -#undef DD - -/* char gen data recycling */ -#define GD GEN_DATA -GD *new_gen_data args( (void) ); -void free_gen_data args( (GEN_DATA * gen) ); -#undef GD - -/* extra descr recycling */ -#define ED EXTRA_DESCR_DATA -ED *new_extra_descr args( (void) ); -void free_extra_descr args( (EXTRA_DESCR_DATA *ed) ); -#undef ED - -/* affect recycling */ -#define AD AFFECT_DATA -AD *new_affect args( (void) ); -void free_affect args( (AFFECT_DATA *af) ); -#undef AD - -/* object recycling */ -#define OD OBJ_DATA -OD *new_obj args( (void) ); -void free_obj args( (OBJ_DATA *obj) ); -#undef OD - -/* character recyling */ -#define CD CHAR_DATA -#define PD PC_DATA -CD *new_char args( (void) ); -void free_char args( (CHAR_DATA *ch) ); -PD *new_pcdata args( (void) ); -void free_pcdata args( (PC_DATA *pcdata) ); -#undef PD -#undef CD - - -/* mob id and memory procedures */ -#define MD MEM_DATA -long get_pc_id args( (void) ); -long get_mob_id args( (void) ); -MD *new_mem_data args( (void) ); -void free_mem_data args( ( MEM_DATA *memory) ); -MD *find_memory args( (MEM_DATA *memory, long id) ); -#undef MD - -/* buffer procedures */ - -BUFFER *new_buf args( (void) ); -BUFFER *new_buf_size args( (int size) ); -void free_buf args( (BUFFER *buffer) ); -bool add_buf args( (BUFFER *buffer, char *string) ); -void clear_buf args( (BUFFER *buffer) ); -char *buf_string args( (BUFFER *buffer) ); diff --git a/Rom24/src/save.c b/Rom24/src/save.c deleted file mode 100644 index 9f9a60c..0000000 --- a/Rom24/src/save.c +++ /dev/null @@ -1,1665 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#endif -#include -#include -#include -#include -#include -#include -#include "merc.h" -#include "recycle.h" -#include "lookup.h" -#include "tables.h" - -#if !defined(macintosh) -extern int _filbuf args( (FILE *) ); -#endif - - -int rename(const char *oldfname, const char *newfname); - -char *print_flags(int flag) -{ - int count, pos = 0; - static char buf[52]; - - - for (count = 0; count < 32; count++) - { - if (IS_SET(flag,1<desc != NULL && ch->desc->original != NULL ) - ch = ch->desc->original; - -#if defined(unix) - /* create god log */ - if (IS_IMMORTAL(ch) || ch->level >= LEVEL_IMMORTAL) - { - fclose(fpReserve); - sprintf(strsave, "%s%s",GOD_DIR, capitalize(ch->name)); - if ((fp = fopen(strsave,"w")) == NULL) - { - bug("Save_char_obj: fopen",0); - perror(strsave); - } - - fprintf(fp,"Lev %2d Trust %2d %s%s\n", - ch->level, get_trust(ch), ch->name, ch->pcdata->title); - fclose( fp ); - fpReserve = fopen( NULL_FILE, "r" ); - } -#endif - - fclose( fpReserve ); - sprintf( strsave, "%s%s", PLAYER_DIR, capitalize( ch->name ) ); - if ( ( fp = fopen( TEMP_FILE, "w" ) ) == NULL ) - { - bug( "Save_char_obj: fopen", 0 ); - perror( strsave ); - } - else - { - fwrite_char( ch, fp ); - if ( ch->carrying != NULL ) - fwrite_obj( ch, ch->carrying, fp, 0 ); - /* save the pets */ - if (ch->pet != NULL && ch->pet->in_room == ch->in_room) - fwrite_pet(ch->pet,fp); - fprintf( fp, "#END\n" ); - } - fclose( fp ); - rename(TEMP_FILE,strsave); - fpReserve = fopen( NULL_FILE, "r" ); - return; -} - - - -/* - * Write the char. - */ -void fwrite_char( CHAR_DATA *ch, FILE *fp ) -{ - AFFECT_DATA *paf; - int sn, gn, pos; - - fprintf( fp, "#%s\n", IS_NPC(ch) ? "MOB" : "PLAYER" ); - - fprintf( fp, "Name %s~\n", ch->name ); - fprintf( fp, "Id %ld\n", ch->id ); - fprintf( fp, "LogO %ld\n", current_time ); - fprintf( fp, "Vers %d\n", 5 ); - if (ch->short_descr[0] != '\0') - fprintf( fp, "ShD %s~\n", ch->short_descr ); - if( ch->long_descr[0] != '\0') - fprintf( fp, "LnD %s~\n", ch->long_descr ); - if (ch->description[0] != '\0') - fprintf( fp, "Desc %s~\n", ch->description ); - if (ch->prompt != NULL || !str_cmp(ch->prompt,"<%hhp %mm %vmv> ")) - fprintf( fp, "Prom %s~\n", ch->prompt ); - fprintf( fp, "Race %s~\n", pc_race_table[ch->race].name ); - if (ch->clan) - fprintf( fp, "Clan %s~\n",clan_table[ch->clan].name); - fprintf( fp, "Sex %d\n", ch->sex ); - fprintf( fp, "Cla %d\n", ch->class ); - fprintf( fp, "Levl %d\n", ch->level ); - if (ch->trust != 0) - fprintf( fp, "Tru %d\n", ch->trust ); - fprintf( fp, "Plyd %d\n", - ch->played + (int) (current_time - ch->logon) ); - fprintf( fp, "Not %ld %ld %ld %ld %ld\n", - ch->pcdata->last_note,ch->pcdata->last_idea,ch->pcdata->last_penalty, - ch->pcdata->last_news,ch->pcdata->last_changes ); - fprintf( fp, "Scro %d\n", ch->lines ); - fprintf( fp, "Room %d\n", - ( ch->in_room == get_room_index( ROOM_VNUM_LIMBO ) - && ch->was_in_room != NULL ) - ? ch->was_in_room->vnum - : ch->in_room == NULL ? 3001 : ch->in_room->vnum ); - - fprintf( fp, "HMV %d %d %d %d %d %d\n", - ch->hit, ch->max_hit, ch->mana, ch->max_mana, ch->move, ch->max_move ); - if (ch->gold > 0) - fprintf( fp, "Gold %ld\n", ch->gold ); - else - fprintf( fp, "Gold %d\n", 0 ); - if (ch->silver > 0) - fprintf( fp, "Silv %ld\n",ch->silver ); - else - fprintf( fp, "Silv %d\n",0 ); - fprintf( fp, "Exp %d\n", ch->exp ); - if (ch->act != 0) - fprintf( fp, "Act %s\n", print_flags(ch->act)); - if (ch->affected_by != 0) - fprintf( fp, "AfBy %s\n", print_flags(ch->affected_by)); - fprintf( fp, "Comm %s\n", print_flags(ch->comm)); - if (ch->wiznet) - fprintf( fp, "Wizn %s\n", print_flags(ch->wiznet)); - if (ch->invis_level) - fprintf( fp, "Invi %d\n", ch->invis_level ); - if (ch->incog_level) - fprintf(fp,"Inco %d\n",ch->incog_level); - fprintf( fp, "Pos %d\n", - ch->position == POS_FIGHTING ? POS_STANDING : ch->position ); - if (ch->practice != 0) - fprintf( fp, "Prac %d\n", ch->practice ); - if (ch->train != 0) - fprintf( fp, "Trai %d\n", ch->train ); - if (ch->saving_throw != 0) - fprintf( fp, "Save %d\n", ch->saving_throw); - fprintf( fp, "Alig %d\n", ch->alignment ); - if (ch->hitroll != 0) - fprintf( fp, "Hit %d\n", ch->hitroll ); - if (ch->damroll != 0) - fprintf( fp, "Dam %d\n", ch->damroll ); - fprintf( fp, "ACs %d %d %d %d\n", - ch->armor[0],ch->armor[1],ch->armor[2],ch->armor[3]); - if (ch->wimpy !=0 ) - fprintf( fp, "Wimp %d\n", ch->wimpy ); - fprintf( fp, "Attr %d %d %d %d %d\n", - ch->perm_stat[STAT_STR], - ch->perm_stat[STAT_INT], - ch->perm_stat[STAT_WIS], - ch->perm_stat[STAT_DEX], - ch->perm_stat[STAT_CON] ); - - fprintf (fp, "AMod %d %d %d %d %d\n", - ch->mod_stat[STAT_STR], - ch->mod_stat[STAT_INT], - ch->mod_stat[STAT_WIS], - ch->mod_stat[STAT_DEX], - ch->mod_stat[STAT_CON] ); - - if ( IS_NPC(ch) ) - { - fprintf( fp, "Vnum %d\n", ch->pIndexData->vnum ); - } - else - { - fprintf( fp, "Pass %s~\n", ch->pcdata->pwd ); - if (ch->pcdata->bamfin[0] != '\0') - fprintf( fp, "Bin %s~\n", ch->pcdata->bamfin); - if (ch->pcdata->bamfout[0] != '\0') - fprintf( fp, "Bout %s~\n", ch->pcdata->bamfout); - fprintf( fp, "Titl %s~\n", ch->pcdata->title ); - fprintf( fp, "Pnts %d\n", ch->pcdata->points ); - fprintf( fp, "TSex %d\n", ch->pcdata->true_sex ); - fprintf( fp, "LLev %d\n", ch->pcdata->last_level ); - fprintf( fp, "HMVP %d %d %d\n", ch->pcdata->perm_hit, - ch->pcdata->perm_mana, - ch->pcdata->perm_move); - fprintf( fp, "Cnd %d %d %d %d\n", - ch->pcdata->condition[0], - ch->pcdata->condition[1], - ch->pcdata->condition[2], - ch->pcdata->condition[3] ); - - /* write alias */ - for (pos = 0; pos < MAX_ALIAS; pos++) - { - if (ch->pcdata->alias[pos] == NULL - || ch->pcdata->alias_sub[pos] == NULL) - break; - - fprintf(fp,"Alias %s %s~\n",ch->pcdata->alias[pos], - ch->pcdata->alias_sub[pos]); - } - - for ( sn = 0; sn < MAX_SKILL; sn++ ) - { - if ( skill_table[sn].name != NULL && ch->pcdata->learned[sn] > 0 ) - { - fprintf( fp, "Sk %d '%s'\n", - ch->pcdata->learned[sn], skill_table[sn].name ); - } - } - - for ( gn = 0; gn < MAX_GROUP; gn++ ) - { - if ( group_table[gn].name != NULL && ch->pcdata->group_known[gn]) - { - fprintf( fp, "Gr '%s'\n",group_table[gn].name); - } - } - } - - for ( paf = ch->affected; paf != NULL; paf = paf->next ) - { - if (paf->type < 0 || paf->type>= MAX_SKILL) - continue; - - fprintf( fp, "Affc '%s' %3d %3d %3d %3d %3d %10d\n", - skill_table[paf->type].name, - paf->where, - paf->level, - paf->duration, - paf->modifier, - paf->location, - paf->bitvector - ); - } - - fprintf( fp, "End\n\n" ); - return; -} - -/* write a pet */ -void fwrite_pet( CHAR_DATA *pet, FILE *fp) -{ - AFFECT_DATA *paf; - - fprintf(fp,"#PET\n"); - - fprintf(fp,"Vnum %d\n",pet->pIndexData->vnum); - - fprintf(fp,"Name %s~\n", pet->name); - fprintf(fp,"LogO %ld\n", current_time); - if (pet->short_descr != pet->pIndexData->short_descr) - fprintf(fp,"ShD %s~\n", pet->short_descr); - if (pet->long_descr != pet->pIndexData->long_descr) - fprintf(fp,"LnD %s~\n", pet->long_descr); - if (pet->description != pet->pIndexData->description) - fprintf(fp,"Desc %s~\n", pet->description); - if (pet->race != pet->pIndexData->race) - fprintf(fp,"Race %s~\n", race_table[pet->race].name); - if (pet->clan) - fprintf( fp, "Clan %s~\n",clan_table[pet->clan].name); - fprintf(fp,"Sex %d\n", pet->sex); - if (pet->level != pet->pIndexData->level) - fprintf(fp,"Levl %d\n", pet->level); - fprintf(fp, "HMV %d %d %d %d %d %d\n", - pet->hit, pet->max_hit, pet->mana, pet->max_mana, pet->move, pet->max_move); - if (pet->gold > 0) - fprintf(fp,"Gold %ld\n",pet->gold); - if (pet->silver > 0) - fprintf(fp,"Silv %ld\n",pet->silver); - if (pet->exp > 0) - fprintf(fp, "Exp %d\n", pet->exp); - if (pet->act != pet->pIndexData->act) - fprintf(fp, "Act %s\n", print_flags(pet->act)); - if (pet->affected_by != pet->pIndexData->affected_by) - fprintf(fp, "AfBy %s\n", print_flags(pet->affected_by)); - if (pet->comm != 0) - fprintf(fp, "Comm %s\n", print_flags(pet->comm)); - fprintf(fp,"Pos %d\n", pet->position = POS_FIGHTING ? POS_STANDING : pet->position); - if (pet->saving_throw != 0) - fprintf(fp, "Save %d\n", pet->saving_throw); - if (pet->alignment != pet->pIndexData->alignment) - fprintf(fp, "Alig %d\n", pet->alignment); - if (pet->hitroll != pet->pIndexData->hitroll) - fprintf(fp, "Hit %d\n", pet->hitroll); - if (pet->damroll != pet->pIndexData->damage[DICE_BONUS]) - fprintf(fp, "Dam %d\n", pet->damroll); - fprintf(fp, "ACs %d %d %d %d\n", - pet->armor[0],pet->armor[1],pet->armor[2],pet->armor[3]); - fprintf(fp, "Attr %d %d %d %d %d\n", - pet->perm_stat[STAT_STR], pet->perm_stat[STAT_INT], - pet->perm_stat[STAT_WIS], pet->perm_stat[STAT_DEX], - pet->perm_stat[STAT_CON]); - fprintf(fp, "AMod %d %d %d %d %d\n", - pet->mod_stat[STAT_STR], pet->mod_stat[STAT_INT], - pet->mod_stat[STAT_WIS], pet->mod_stat[STAT_DEX], - pet->mod_stat[STAT_CON]); - - for ( paf = pet->affected; paf != NULL; paf = paf->next ) - { - if (paf->type < 0 || paf->type >= MAX_SKILL) - continue; - - fprintf(fp, "Affc '%s' %3d %3d %3d %3d %3d %10d\n", - skill_table[paf->type].name, - paf->where, paf->level, paf->duration, paf->modifier,paf->location, - paf->bitvector); - } - - fprintf(fp,"End\n"); - return; -} - -/* - * Write an object and its contents. - */ -void fwrite_obj( CHAR_DATA *ch, OBJ_DATA *obj, FILE *fp, int iNest ) -{ - EXTRA_DESCR_DATA *ed; - AFFECT_DATA *paf; - - /* - * Slick recursion to write lists backwards, - * so loading them will load in forwards order. - */ - if ( obj->next_content != NULL ) - fwrite_obj( ch, obj->next_content, fp, iNest ); - - /* - * Castrate storage characters. - */ - if ( (ch->level < obj->level - 2 && obj->item_type != ITEM_CONTAINER) - || obj->item_type == ITEM_KEY - || (obj->item_type == ITEM_MAP && !obj->value[0])) - return; - - fprintf( fp, "#O\n" ); - fprintf( fp, "Vnum %d\n", obj->pIndexData->vnum ); - if (!obj->pIndexData->new_format) - fprintf( fp, "Oldstyle\n"); - if (obj->enchanted) - fprintf( fp,"Enchanted\n"); - fprintf( fp, "Nest %d\n", iNest ); - - /* these data are only used if they do not match the defaults */ - - if ( obj->name != obj->pIndexData->name) - fprintf( fp, "Name %s~\n", obj->name ); - if ( obj->short_descr != obj->pIndexData->short_descr) - fprintf( fp, "ShD %s~\n", obj->short_descr ); - if ( obj->description != obj->pIndexData->description) - fprintf( fp, "Desc %s~\n", obj->description ); - if ( obj->extra_flags != obj->pIndexData->extra_flags) - fprintf( fp, "ExtF %d\n", obj->extra_flags ); - if ( obj->wear_flags != obj->pIndexData->wear_flags) - fprintf( fp, "WeaF %d\n", obj->wear_flags ); - if ( obj->item_type != obj->pIndexData->item_type) - fprintf( fp, "Ityp %d\n", obj->item_type ); - if ( obj->weight != obj->pIndexData->weight) - fprintf( fp, "Wt %d\n", obj->weight ); - if ( obj->condition != obj->pIndexData->condition) - fprintf( fp, "Cond %d\n", obj->condition ); - - /* variable data */ - - fprintf( fp, "Wear %d\n", obj->wear_loc ); - if (obj->level != obj->pIndexData->level) - fprintf( fp, "Lev %d\n", obj->level ); - if (obj->timer != 0) - fprintf( fp, "Time %d\n", obj->timer ); - fprintf( fp, "Cost %d\n", obj->cost ); - if (obj->value[0] != obj->pIndexData->value[0] - || obj->value[1] != obj->pIndexData->value[1] - || obj->value[2] != obj->pIndexData->value[2] - || obj->value[3] != obj->pIndexData->value[3] - || obj->value[4] != obj->pIndexData->value[4]) - fprintf( fp, "Val %d %d %d %d %d\n", - obj->value[0], obj->value[1], obj->value[2], obj->value[3], - obj->value[4] ); - - switch ( obj->item_type ) - { - case ITEM_POTION: - case ITEM_SCROLL: - case ITEM_PILL: - if ( obj->value[1] > 0 ) - { - fprintf( fp, "Spell 1 '%s'\n", - skill_table[obj->value[1]].name ); - } - - if ( obj->value[2] > 0 ) - { - fprintf( fp, "Spell 2 '%s'\n", - skill_table[obj->value[2]].name ); - } - - if ( obj->value[3] > 0 ) - { - fprintf( fp, "Spell 3 '%s'\n", - skill_table[obj->value[3]].name ); - } - - break; - - case ITEM_STAFF: - case ITEM_WAND: - if ( obj->value[3] > 0 ) - { - fprintf( fp, "Spell 3 '%s'\n", - skill_table[obj->value[3]].name ); - } - - break; - } - - for ( paf = obj->affected; paf != NULL; paf = paf->next ) - { - if (paf->type < 0 || paf->type >= MAX_SKILL) - continue; - fprintf( fp, "Affc '%s' %3d %3d %3d %3d %3d %10d\n", - skill_table[paf->type].name, - paf->where, - paf->level, - paf->duration, - paf->modifier, - paf->location, - paf->bitvector - ); - } - - for ( ed = obj->extra_descr; ed != NULL; ed = ed->next ) - { - fprintf( fp, "ExDe %s~ %s~\n", - ed->keyword, ed->description ); - } - - fprintf( fp, "End\n\n" ); - - if ( obj->contains != NULL ) - fwrite_obj( ch, obj->contains, fp, iNest + 1 ); - - return; -} - - - -/* - * Load a char and inventory into a new ch structure. - */ -bool load_char_obj( DESCRIPTOR_DATA *d, char *name ) -{ - char strsave[MAX_INPUT_LENGTH]; - char buf[100]; - CHAR_DATA *ch; - FILE *fp; - bool found; - int stat; - - ch = new_char(); - ch->pcdata = new_pcdata(); - - d->character = ch; - ch->desc = d; - ch->name = str_dup( name ); - ch->id = get_pc_id(); - ch->race = race_lookup("human"); - ch->act = PLR_NOSUMMON; - ch->comm = COMM_COMBINE - | COMM_PROMPT; - ch->prompt = str_dup("<%hhp %mm %vmv> "); - ch->pcdata->confirm_delete = FALSE; - ch->pcdata->pwd = str_dup( "" ); - ch->pcdata->bamfin = str_dup( "" ); - ch->pcdata->bamfout = str_dup( "" ); - ch->pcdata->title = str_dup( "" ); - for (stat =0; stat < MAX_STATS; stat++) - ch->perm_stat[stat] = 13; - ch->pcdata->condition[COND_THIRST] = 48; - ch->pcdata->condition[COND_FULL] = 48; - ch->pcdata->condition[COND_HUNGER] = 48; - - found = FALSE; - fclose( fpReserve ); - - #if defined(unix) - /* decompress if .gz file exists */ - sprintf( strsave, "%s%s%s", PLAYER_DIR, capitalize(name),".gz"); - if ( ( fp = fopen( strsave, "r" ) ) != NULL ) - { - fclose(fp); - sprintf(buf,"gzip -dfq %s",strsave); - system(buf); - } - #endif - - sprintf( strsave, "%s%s", PLAYER_DIR, capitalize( name ) ); - if ( ( fp = fopen( strsave, "r" ) ) != NULL ) - { - int iNest; - - for ( iNest = 0; iNest < MAX_NEST; iNest++ ) - rgObjNest[iNest] = NULL; - - found = TRUE; - for ( ; ; ) - { - char letter; - char *word; - - letter = fread_letter( fp ); - if ( letter == '*' ) - { - fread_to_eol( fp ); - continue; - } - - if ( letter != '#' ) - { - bug( "Load_char_obj: # not found.", 0 ); - break; - } - - word = fread_word( fp ); - if ( !str_cmp( word, "PLAYER" ) ) fread_char ( ch, fp ); - else if ( !str_cmp( word, "OBJECT" ) ) fread_obj ( ch, fp ); - else if ( !str_cmp( word, "O" ) ) fread_obj ( ch, fp ); - else if ( !str_cmp( word, "PET" ) ) fread_pet ( ch, fp ); - else if ( !str_cmp( word, "END" ) ) break; - else - { - bug( "Load_char_obj: bad section.", 0 ); - break; - } - } - fclose( fp ); - } - - fpReserve = fopen( NULL_FILE, "r" ); - - - /* initialize race */ - if (found) - { - int i; - - if (ch->race == 0) - ch->race = race_lookup("human"); - - ch->size = pc_race_table[ch->race].size; - ch->dam_type = 17; /*punch */ - - for (i = 0; i < 5; i++) - { - if (pc_race_table[ch->race].skills[i] == NULL) - break; - group_add(ch,pc_race_table[ch->race].skills[i],FALSE); - } - ch->affected_by = ch->affected_by|race_table[ch->race].aff; - ch->imm_flags = ch->imm_flags | race_table[ch->race].imm; - ch->res_flags = ch->res_flags | race_table[ch->race].res; - ch->vuln_flags = ch->vuln_flags | race_table[ch->race].vuln; - ch->form = race_table[ch->race].form; - ch->parts = race_table[ch->race].parts; - } - - - /* RT initialize skills */ - - if (found && ch->version < 2) /* need to add the new skills */ - { - group_add(ch,"rom basics",FALSE); - group_add(ch,class_table[ch->class].base_group,FALSE); - group_add(ch,class_table[ch->class].default_group,TRUE); - ch->pcdata->learned[gsn_recall] = 50; - } - - /* fix levels */ - if (found && ch->version < 3 && (ch->level > 35 || ch->trust > 35)) - { - switch (ch->level) - { - case(40) : ch->level = 60; break; /* imp -> imp */ - case(39) : ch->level = 58; break; /* god -> supreme */ - case(38) : ch->level = 56; break; /* deity -> god */ - case(37) : ch->level = 53; break; /* angel -> demigod */ - } - - switch (ch->trust) - { - case(40) : ch->trust = 60; break; /* imp -> imp */ - case(39) : ch->trust = 58; break; /* god -> supreme */ - case(38) : ch->trust = 56; break; /* deity -> god */ - case(37) : ch->trust = 53; break; /* angel -> demigod */ - case(36) : ch->trust = 51; break; /* hero -> hero */ - } - } - - /* ream gold */ - if (found && ch->version < 4) - { - ch->gold /= 100; - } - return found; -} - - - -/* - * Read in a char. - */ - -#if defined(KEY) -#undef KEY -#endif - -#define KEY( literal, field, value ) \ - if ( !str_cmp( word, literal ) ) \ - { \ - field = value; \ - fMatch = TRUE; \ - break; \ - } - -/* provided to free strings */ -#if defined(KEYS) -#undef KEYS -#endif - -#define KEYS( literal, field, value ) \ - if ( !str_cmp( word, literal ) ) \ - { \ - free_string(field); \ - field = value; \ - fMatch = TRUE; \ - break; \ - } - -void fread_char( CHAR_DATA *ch, FILE *fp ) -{ - char buf[MAX_STRING_LENGTH]; - char *word; - bool fMatch; - int count = 0; - int lastlogoff = current_time; - int percent; - - sprintf(buf,"Loading %s.",ch->name); - log_string(buf); - - for ( ; ; ) - { - word = feof( fp ) ? "End" : fread_word( fp ); - fMatch = FALSE; - - switch ( UPPER(word[0]) ) - { - case '*': - fMatch = TRUE; - fread_to_eol( fp ); - break; - - case 'A': - KEY( "Act", ch->act, fread_flag( fp ) ); - KEY( "AffectedBy", ch->affected_by, fread_flag( fp ) ); - KEY( "AfBy", ch->affected_by, fread_flag( fp ) ); - KEY( "Alignment", ch->alignment, fread_number( fp ) ); - KEY( "Alig", ch->alignment, fread_number( fp ) ); - - if (!str_cmp( word, "Alia")) - { - if (count >= MAX_ALIAS) - { - fread_to_eol(fp); - fMatch = TRUE; - break; - } - - ch->pcdata->alias[count] = str_dup(fread_word(fp)); - ch->pcdata->alias_sub[count] = str_dup(fread_word(fp)); - count++; - fMatch = TRUE; - break; - } - - if (!str_cmp( word, "Alias")) - { - if (count >= MAX_ALIAS) - { - fread_to_eol(fp); - fMatch = TRUE; - break; - } - - ch->pcdata->alias[count] = str_dup(fread_word(fp)); - ch->pcdata->alias_sub[count] = fread_string(fp); - count++; - fMatch = TRUE; - break; - } - - if (!str_cmp( word, "AC") || !str_cmp(word,"Armor")) - { - fread_to_eol(fp); - fMatch = TRUE; - break; - } - - if (!str_cmp(word,"ACs")) - { - int i; - - for (i = 0; i < 4; i++) - ch->armor[i] = fread_number(fp); - fMatch = TRUE; - break; - } - - if (!str_cmp(word, "AffD")) - { - AFFECT_DATA *paf; - int sn; - - paf = new_affect(); - - sn = skill_lookup(fread_word(fp)); - if (sn < 0) - bug("Fread_char: unknown skill.",0); - else - paf->type = sn; - - paf->level = fread_number( fp ); - paf->duration = fread_number( fp ); - paf->modifier = fread_number( fp ); - paf->location = fread_number( fp ); - paf->bitvector = fread_number( fp ); - paf->next = ch->affected; - ch->affected = paf; - fMatch = TRUE; - break; - } - - if (!str_cmp(word, "Affc")) - { - AFFECT_DATA *paf; - int sn; - - paf = new_affect(); - - sn = skill_lookup(fread_word(fp)); - if (sn < 0) - bug("Fread_char: unknown skill.",0); - else - paf->type = sn; - - paf->where = fread_number(fp); - paf->level = fread_number( fp ); - paf->duration = fread_number( fp ); - paf->modifier = fread_number( fp ); - paf->location = fread_number( fp ); - paf->bitvector = fread_number( fp ); - paf->next = ch->affected; - ch->affected = paf; - fMatch = TRUE; - break; - } - - if ( !str_cmp( word, "AttrMod" ) || !str_cmp(word,"AMod")) - { - int stat; - for (stat = 0; stat < MAX_STATS; stat ++) - ch->mod_stat[stat] = fread_number(fp); - fMatch = TRUE; - break; - } - - if ( !str_cmp( word, "AttrPerm" ) || !str_cmp(word,"Attr")) - { - int stat; - - for (stat = 0; stat < MAX_STATS; stat++) - ch->perm_stat[stat] = fread_number(fp); - fMatch = TRUE; - break; - } - break; - - case 'B': - KEY( "Bamfin", ch->pcdata->bamfin, fread_string( fp ) ); - KEY( "Bamfout", ch->pcdata->bamfout, fread_string( fp ) ); - KEY( "Bin", ch->pcdata->bamfin, fread_string( fp ) ); - KEY( "Bout", ch->pcdata->bamfout, fread_string( fp ) ); - break; - - case 'C': - KEY( "Class", ch->class, fread_number( fp ) ); - KEY( "Cla", ch->class, fread_number( fp ) ); - KEY( "Clan", ch->clan, clan_lookup(fread_string(fp))); - - if ( !str_cmp( word, "Condition" ) || !str_cmp(word,"Cond")) - { - ch->pcdata->condition[0] = fread_number( fp ); - ch->pcdata->condition[1] = fread_number( fp ); - ch->pcdata->condition[2] = fread_number( fp ); - fMatch = TRUE; - break; - } - if (!str_cmp(word,"Cnd")) - { - ch->pcdata->condition[0] = fread_number( fp ); - ch->pcdata->condition[1] = fread_number( fp ); - ch->pcdata->condition[2] = fread_number( fp ); - ch->pcdata->condition[3] = fread_number( fp ); - fMatch = TRUE; - break; - } - KEY("Comm", ch->comm, fread_flag( fp ) ); - - break; - - case 'D': - KEY( "Damroll", ch->damroll, fread_number( fp ) ); - KEY( "Dam", ch->damroll, fread_number( fp ) ); - KEY( "Description", ch->description, fread_string( fp ) ); - KEY( "Desc", ch->description, fread_string( fp ) ); - break; - - case 'E': - if ( !str_cmp( word, "End" ) ) - { - /* adjust hp mana move up -- here for speed's sake */ - percent = (current_time - lastlogoff) * 25 / ( 2 * 60 * 60); - - percent = UMIN(percent,100); - - if (percent > 0 && !IS_AFFECTED(ch,AFF_POISON) - && !IS_AFFECTED(ch,AFF_PLAGUE)) - { - ch->hit += (ch->max_hit - ch->hit) * percent / 100; - ch->mana += (ch->max_mana - ch->mana) * percent / 100; - ch->move += (ch->max_move - ch->move)* percent / 100; - } - return; - } - KEY( "Exp", ch->exp, fread_number( fp ) ); - break; - - case 'G': - KEY( "Gold", ch->gold, fread_number( fp ) ); - if ( !str_cmp( word, "Group" ) || !str_cmp(word,"Gr")) - { - int gn; - char *temp; - - temp = fread_word( fp ) ; - gn = group_lookup(temp); - /* gn = group_lookup( fread_word( fp ) ); */ - if ( gn < 0 ) - { - fprintf(stderr,"%s",temp); - bug( "Fread_char: unknown group. ", 0 ); - } - else - gn_add(ch,gn); - fMatch = TRUE; - } - break; - - case 'H': - KEY( "Hitroll", ch->hitroll, fread_number( fp ) ); - KEY( "Hit", ch->hitroll, fread_number( fp ) ); - - if ( !str_cmp( word, "HpManaMove" ) || !str_cmp(word,"HMV")) - { - ch->hit = fread_number( fp ); - ch->max_hit = fread_number( fp ); - ch->mana = fread_number( fp ); - ch->max_mana = fread_number( fp ); - ch->move = fread_number( fp ); - ch->max_move = fread_number( fp ); - fMatch = TRUE; - break; - } - - if ( !str_cmp( word, "HpManaMovePerm" ) || !str_cmp(word,"HMVP")) - { - ch->pcdata->perm_hit = fread_number( fp ); - ch->pcdata->perm_mana = fread_number( fp ); - ch->pcdata->perm_move = fread_number( fp ); - fMatch = TRUE; - break; - } - - break; - - case 'I': - KEY( "Id", ch->id, fread_number( fp ) ); - KEY( "InvisLevel", ch->invis_level, fread_number( fp ) ); - KEY( "Inco", ch->incog_level, fread_number( fp ) ); - KEY( "Invi", ch->invis_level, fread_number( fp ) ); - break; - - case 'L': - KEY( "LastLevel", ch->pcdata->last_level, fread_number( fp ) ); - KEY( "LLev", ch->pcdata->last_level, fread_number( fp ) ); - KEY( "Level", ch->level, fread_number( fp ) ); - KEY( "Lev", ch->level, fread_number( fp ) ); - KEY( "Levl", ch->level, fread_number( fp ) ); - KEY( "LogO", lastlogoff, fread_number( fp ) ); - KEY( "LongDescr", ch->long_descr, fread_string( fp ) ); - KEY( "LnD", ch->long_descr, fread_string( fp ) ); - break; - - case 'N': - KEYS( "Name", ch->name, fread_string( fp ) ); - KEY( "Note", ch->pcdata->last_note, fread_number( fp ) ); - if (!str_cmp(word,"Not")) - { - ch->pcdata->last_note = fread_number(fp); - ch->pcdata->last_idea = fread_number(fp); - ch->pcdata->last_penalty = fread_number(fp); - ch->pcdata->last_news = fread_number(fp); - ch->pcdata->last_changes = fread_number(fp); - fMatch = TRUE; - break; - } - break; - - case 'P': - KEY( "Password", ch->pcdata->pwd, fread_string( fp ) ); - KEY( "Pass", ch->pcdata->pwd, fread_string( fp ) ); - KEY( "Played", ch->played, fread_number( fp ) ); - KEY( "Plyd", ch->played, fread_number( fp ) ); - KEY( "Points", ch->pcdata->points, fread_number( fp ) ); - KEY( "Pnts", ch->pcdata->points, fread_number( fp ) ); - KEY( "Position", ch->position, fread_number( fp ) ); - KEY( "Pos", ch->position, fread_number( fp ) ); - KEY( "Practice", ch->practice, fread_number( fp ) ); - KEY( "Prac", ch->practice, fread_number( fp ) ); - KEYS( "Prompt", ch->prompt, fread_string( fp ) ); - KEY( "Prom", ch->prompt, fread_string( fp ) ); - break; - - case 'R': - KEY( "Race", ch->race, - race_lookup(fread_string( fp )) ); - - if ( !str_cmp( word, "Room" ) ) - { - ch->in_room = get_room_index( fread_number( fp ) ); - if ( ch->in_room == NULL ) - ch->in_room = get_room_index( ROOM_VNUM_LIMBO ); - fMatch = TRUE; - break; - } - - break; - - case 'S': - KEY( "SavingThrow", ch->saving_throw, fread_number( fp ) ); - KEY( "Save", ch->saving_throw, fread_number( fp ) ); - KEY( "Scro", ch->lines, fread_number( fp ) ); - KEY( "Sex", ch->sex, fread_number( fp ) ); - KEY( "ShortDescr", ch->short_descr, fread_string( fp ) ); - KEY( "ShD", ch->short_descr, fread_string( fp ) ); - KEY( "Silv", ch->silver, fread_number( fp ) ); - - - if ( !str_cmp( word, "Skill" ) || !str_cmp(word,"Sk")) - { - int sn; - int value; - char *temp; - - value = fread_number( fp ); - temp = fread_word( fp ) ; - sn = skill_lookup(temp); - /* sn = skill_lookup( fread_word( fp ) ); */ - if ( sn < 0 ) - { - fprintf(stderr,"%s",temp); - bug( "Fread_char: unknown skill. ", 0 ); - } - else - ch->pcdata->learned[sn] = value; - fMatch = TRUE; - } - - break; - - case 'T': - KEY( "TrueSex", ch->pcdata->true_sex, fread_number( fp ) ); - KEY( "TSex", ch->pcdata->true_sex, fread_number( fp ) ); - KEY( "Trai", ch->train, fread_number( fp ) ); - KEY( "Trust", ch->trust, fread_number( fp ) ); - KEY( "Tru", ch->trust, fread_number( fp ) ); - - if ( !str_cmp( word, "Title" ) || !str_cmp( word, "Titl")) - { - ch->pcdata->title = fread_string( fp ); - if (ch->pcdata->title[0] != '.' && ch->pcdata->title[0] != ',' - && ch->pcdata->title[0] != '!' && ch->pcdata->title[0] != '?') - { - sprintf( buf, " %s", ch->pcdata->title ); - free_string( ch->pcdata->title ); - ch->pcdata->title = str_dup( buf ); - } - fMatch = TRUE; - break; - } - - break; - - case 'V': - KEY( "Version", ch->version, fread_number ( fp ) ); - KEY( "Vers", ch->version, fread_number ( fp ) ); - if ( !str_cmp( word, "Vnum" ) ) - { - ch->pIndexData = get_mob_index( fread_number( fp ) ); - fMatch = TRUE; - break; - } - break; - - case 'W': - KEY( "Wimpy", ch->wimpy, fread_number( fp ) ); - KEY( "Wimp", ch->wimpy, fread_number( fp ) ); - KEY( "Wizn", ch->wiznet, fread_flag( fp ) ); - break; - } - - if ( !fMatch ) - { - bug( "Fread_char: no match.", 0 ); - fread_to_eol( fp ); - } - } -} - -/* load a pet from the forgotten reaches */ -void fread_pet( CHAR_DATA *ch, FILE *fp ) -{ - char *word; - CHAR_DATA *pet; - bool fMatch; - int lastlogoff = current_time; - int percent; - - /* first entry had BETTER be the vnum or we barf */ - word = feof(fp) ? "END" : fread_word(fp); - if (!str_cmp(word,"Vnum")) - { - int vnum; - - vnum = fread_number(fp); - if (get_mob_index(vnum) == NULL) - { - bug("Fread_pet: bad vnum %d.",vnum); - pet = create_mobile(get_mob_index(MOB_VNUM_FIDO)); - } - else - pet = create_mobile(get_mob_index(vnum)); - } - else - { - bug("Fread_pet: no vnum in file.",0); - pet = create_mobile(get_mob_index(MOB_VNUM_FIDO)); - } - - for ( ; ; ) - { - word = feof(fp) ? "END" : fread_word(fp); - fMatch = FALSE; - - switch (UPPER(word[0])) - { - case '*': - fMatch = TRUE; - fread_to_eol(fp); - break; - - case 'A': - KEY( "Act", pet->act, fread_flag(fp)); - KEY( "AfBy", pet->affected_by, fread_flag(fp)); - KEY( "Alig", pet->alignment, fread_number(fp)); - - if (!str_cmp(word,"ACs")) - { - int i; - - for (i = 0; i < 4; i++) - pet->armor[i] = fread_number(fp); - fMatch = TRUE; - break; - } - - if (!str_cmp(word,"AffD")) - { - AFFECT_DATA *paf; - int sn; - - paf = new_affect(); - - sn = skill_lookup(fread_word(fp)); - if (sn < 0) - bug("Fread_char: unknown skill.",0); - else - paf->type = sn; - - paf->level = fread_number(fp); - paf->duration = fread_number(fp); - paf->modifier = fread_number(fp); - paf->location = fread_number(fp); - paf->bitvector = fread_number(fp); - paf->next = pet->affected; - pet->affected = paf; - fMatch = TRUE; - break; - } - - if (!str_cmp(word,"Affc")) - { - AFFECT_DATA *paf; - int sn; - - paf = new_affect(); - - sn = skill_lookup(fread_word(fp)); - if (sn < 0) - bug("Fread_char: unknown skill.",0); - else - paf->type = sn; - - paf->where = fread_number(fp); - paf->level = fread_number(fp); - paf->duration = fread_number(fp); - paf->modifier = fread_number(fp); - paf->location = fread_number(fp); - paf->bitvector = fread_number(fp); - paf->next = pet->affected; - pet->affected = paf; - fMatch = TRUE; - break; - } - - if (!str_cmp(word,"AMod")) - { - int stat; - - for (stat = 0; stat < MAX_STATS; stat++) - pet->mod_stat[stat] = fread_number(fp); - fMatch = TRUE; - break; - } - - if (!str_cmp(word,"Attr")) - { - int stat; - - for (stat = 0; stat < MAX_STATS; stat++) - pet->perm_stat[stat] = fread_number(fp); - fMatch = TRUE; - break; - } - break; - - case 'C': - KEY( "Clan", pet->clan, clan_lookup(fread_string(fp))); - KEY( "Comm", pet->comm, fread_flag(fp)); - break; - - case 'D': - KEY( "Dam", pet->damroll, fread_number(fp)); - KEY( "Desc", pet->description, fread_string(fp)); - break; - - case 'E': - if (!str_cmp(word,"End")) - { - pet->leader = ch; - pet->master = ch; - ch->pet = pet; - /* adjust hp mana move up -- here for speed's sake */ - percent = (current_time - lastlogoff) * 25 / ( 2 * 60 * 60); - - if (percent > 0 && !IS_AFFECTED(ch,AFF_POISON) - && !IS_AFFECTED(ch,AFF_PLAGUE)) - { - percent = UMIN(percent,100); - pet->hit += (pet->max_hit - pet->hit) * percent / 100; - pet->mana += (pet->max_mana - pet->mana) * percent / 100; - pet->move += (pet->max_move - pet->move)* percent / 100; - } - return; - } - KEY( "Exp", pet->exp, fread_number(fp)); - break; - - case 'G': - KEY( "Gold", pet->gold, fread_number(fp)); - break; - - case 'H': - KEY( "Hit", pet->hitroll, fread_number(fp)); - - if (!str_cmp(word,"HMV")) - { - pet->hit = fread_number(fp); - pet->max_hit = fread_number(fp); - pet->mana = fread_number(fp); - pet->max_mana = fread_number(fp); - pet->move = fread_number(fp); - pet->max_move = fread_number(fp); - fMatch = TRUE; - break; - } - break; - - case 'L': - KEY( "Levl", pet->level, fread_number(fp)); - KEY( "LnD", pet->long_descr, fread_string(fp)); - KEY( "LogO", lastlogoff, fread_number(fp)); - break; - - case 'N': - KEY( "Name", pet->name, fread_string(fp)); - break; - - case 'P': - KEY( "Pos", pet->position, fread_number(fp)); - break; - - case 'R': - KEY( "Race", pet->race, race_lookup(fread_string(fp))); - break; - - case 'S' : - KEY( "Save", pet->saving_throw, fread_number(fp)); - KEY( "Sex", pet->sex, fread_number(fp)); - KEY( "ShD", pet->short_descr, fread_string(fp)); - KEY( "Silv", pet->silver, fread_number( fp ) ); - break; - - if ( !fMatch ) - { - bug("Fread_pet: no match.",0); - fread_to_eol(fp); - } - - } - } -} - - - -void fread_obj( CHAR_DATA *ch, FILE *fp ) -{ - OBJ_DATA *obj; - char *word; - int iNest; - bool fMatch; - bool fNest; - bool fVnum; - bool first; - bool new_format; /* to prevent errors */ - bool make_new; /* update object */ - - fVnum = FALSE; - obj = NULL; - first = TRUE; /* used to counter fp offset */ - new_format = FALSE; - make_new = FALSE; - - word = feof( fp ) ? "End" : fread_word( fp ); - if (!str_cmp(word,"Vnum" )) - { - int vnum; - first = FALSE; /* fp will be in right place */ - - vnum = fread_number( fp ); - if ( get_obj_index( vnum ) == NULL ) - { - bug( "Fread_obj: bad vnum %d.", vnum ); - } - else - { - obj = create_object(get_obj_index(vnum),-1); - new_format = TRUE; - } - - } - - if (obj == NULL) /* either not found or old style */ - { - obj = new_obj(); - obj->name = str_dup( "" ); - obj->short_descr = str_dup( "" ); - obj->description = str_dup( "" ); - } - - fNest = FALSE; - fVnum = TRUE; - iNest = 0; - - for ( ; ; ) - { - if (first) - first = FALSE; - else - word = feof( fp ) ? "End" : fread_word( fp ); - fMatch = FALSE; - - switch ( UPPER(word[0]) ) - { - case '*': - fMatch = TRUE; - fread_to_eol( fp ); - break; - - case 'A': - if (!str_cmp(word,"AffD")) - { - AFFECT_DATA *paf; - int sn; - - paf = new_affect(); - - sn = skill_lookup(fread_word(fp)); - if (sn < 0) - bug("Fread_obj: unknown skill.",0); - else - paf->type = sn; - - paf->level = fread_number( fp ); - paf->duration = fread_number( fp ); - paf->modifier = fread_number( fp ); - paf->location = fread_number( fp ); - paf->bitvector = fread_number( fp ); - paf->next = obj->affected; - obj->affected = paf; - fMatch = TRUE; - break; - } - if (!str_cmp(word,"Affc")) - { - AFFECT_DATA *paf; - int sn; - - paf = new_affect(); - - sn = skill_lookup(fread_word(fp)); - if (sn < 0) - bug("Fread_obj: unknown skill.",0); - else - paf->type = sn; - - paf->where = fread_number( fp ); - paf->level = fread_number( fp ); - paf->duration = fread_number( fp ); - paf->modifier = fread_number( fp ); - paf->location = fread_number( fp ); - paf->bitvector = fread_number( fp ); - paf->next = obj->affected; - obj->affected = paf; - fMatch = TRUE; - break; - } - break; - - case 'C': - KEY( "Cond", obj->condition, fread_number( fp ) ); - KEY( "Cost", obj->cost, fread_number( fp ) ); - break; - - case 'D': - KEY( "Description", obj->description, fread_string( fp ) ); - KEY( "Desc", obj->description, fread_string( fp ) ); - break; - - case 'E': - - if ( !str_cmp( word, "Enchanted")) - { - obj->enchanted = TRUE; - fMatch = TRUE; - break; - } - - KEY( "ExtraFlags", obj->extra_flags, fread_number( fp ) ); - KEY( "ExtF", obj->extra_flags, fread_number( fp ) ); - - if ( !str_cmp( word, "ExtraDescr" ) || !str_cmp(word,"ExDe")) - { - EXTRA_DESCR_DATA *ed; - - ed = new_extra_descr(); - - ed->keyword = fread_string( fp ); - ed->description = fread_string( fp ); - ed->next = obj->extra_descr; - obj->extra_descr = ed; - fMatch = TRUE; - } - - if ( !str_cmp( word, "End" ) ) - { - if ( !fNest || !fVnum || obj->pIndexData == NULL) - { - bug( "Fread_obj: incomplete object.", 0 ); - free_obj(obj); - return; - } - else - { - if (!new_format) - { - obj->next = object_list; - object_list = obj; - obj->pIndexData->count++; - } - - if (!obj->pIndexData->new_format - && obj->item_type == ITEM_ARMOR - && obj->value[1] == 0) - { - obj->value[1] = obj->value[0]; - obj->value[2] = obj->value[0]; - } - if (make_new) - { - int wear; - - wear = obj->wear_loc; - extract_obj(obj); - - obj = create_object(obj->pIndexData,0); - obj->wear_loc = wear; - } - if ( iNest == 0 || rgObjNest[iNest] == NULL ) - obj_to_char( obj, ch ); - else - obj_to_obj( obj, rgObjNest[iNest-1] ); - return; - } - } - break; - - case 'I': - KEY( "ItemType", obj->item_type, fread_number( fp ) ); - KEY( "Ityp", obj->item_type, fread_number( fp ) ); - break; - - case 'L': - KEY( "Level", obj->level, fread_number( fp ) ); - KEY( "Lev", obj->level, fread_number( fp ) ); - break; - - case 'N': - KEY( "Name", obj->name, fread_string( fp ) ); - - if ( !str_cmp( word, "Nest" ) ) - { - iNest = fread_number( fp ); - if ( iNest < 0 || iNest >= MAX_NEST ) - { - bug( "Fread_obj: bad nest %d.", iNest ); - } - else - { - rgObjNest[iNest] = obj; - fNest = TRUE; - } - fMatch = TRUE; - } - break; - - case 'O': - if ( !str_cmp( word,"Oldstyle" ) ) - { - if (obj->pIndexData != NULL && obj->pIndexData->new_format) - make_new = TRUE; - fMatch = TRUE; - } - break; - - - case 'S': - KEY( "ShortDescr", obj->short_descr, fread_string( fp ) ); - KEY( "ShD", obj->short_descr, fread_string( fp ) ); - - if ( !str_cmp( word, "Spell" ) ) - { - int iValue; - int sn; - - iValue = fread_number( fp ); - sn = skill_lookup( fread_word( fp ) ); - if ( iValue < 0 || iValue > 3 ) - { - bug( "Fread_obj: bad iValue %d.", iValue ); - } - else if ( sn < 0 ) - { - bug( "Fread_obj: unknown skill.", 0 ); - } - else - { - obj->value[iValue] = sn; - } - fMatch = TRUE; - break; - } - - break; - - case 'T': - KEY( "Timer", obj->timer, fread_number( fp ) ); - KEY( "Time", obj->timer, fread_number( fp ) ); - break; - - case 'V': - if ( !str_cmp( word, "Values" ) || !str_cmp(word,"Vals")) - { - obj->value[0] = fread_number( fp ); - obj->value[1] = fread_number( fp ); - obj->value[2] = fread_number( fp ); - obj->value[3] = fread_number( fp ); - if (obj->item_type == ITEM_WEAPON && obj->value[0] == 0) - obj->value[0] = obj->pIndexData->value[0]; - fMatch = TRUE; - break; - } - - if ( !str_cmp( word, "Val" ) ) - { - obj->value[0] = fread_number( fp ); - obj->value[1] = fread_number( fp ); - obj->value[2] = fread_number( fp ); - obj->value[3] = fread_number( fp ); - obj->value[4] = fread_number( fp ); - fMatch = TRUE; - break; - } - - if ( !str_cmp( word, "Vnum" ) ) - { - int vnum; - - vnum = fread_number( fp ); - if ( ( obj->pIndexData = get_obj_index( vnum ) ) == NULL ) - bug( "Fread_obj: bad vnum %d.", vnum ); - else - fVnum = TRUE; - fMatch = TRUE; - break; - } - break; - - case 'W': - KEY( "WearFlags", obj->wear_flags, fread_number( fp ) ); - KEY( "WeaF", obj->wear_flags, fread_number( fp ) ); - KEY( "WearLoc", obj->wear_loc, fread_number( fp ) ); - KEY( "Wear", obj->wear_loc, fread_number( fp ) ); - KEY( "Weight", obj->weight, fread_number( fp ) ); - KEY( "Wt", obj->weight, fread_number( fp ) ); - break; - - } - - if ( !fMatch ) - { - bug( "Fread_obj: no match.", 0 ); - fread_to_eol( fp ); - } - } -} diff --git a/Rom24/src/scan.c b/Rom24/src/scan.c deleted file mode 100644 index 0ab17a5..0000000 --- a/Rom24/src/scan.c +++ /dev/null @@ -1,127 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#endif -#include -#include -#include -#include -#include "merc.h" - -char *const distance[4]= -{ -"right here.", "nearby to the %s.", "not far %s.", "off in the distance %s." -}; - -void scan_list args((ROOM_INDEX_DATA *scan_room, CHAR_DATA *ch, - sh_int depth, sh_int door)); -void scan_char args((CHAR_DATA *victim, CHAR_DATA *ch, - sh_int depth, sh_int door)); -void do_scan(CHAR_DATA *ch, char *argument) -{ - extern char *const dir_name[]; - char arg1[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH]; - ROOM_INDEX_DATA *scan_room; - EXIT_DATA *pExit; - sh_int door, depth; - - argument = one_argument(argument, arg1); - - if (arg1[0] == '\0') - { - act("$n looks all around.", ch, NULL, NULL, TO_ROOM); - send_to_char("Looking around you see:\n\r", ch); - scan_list(ch->in_room, ch, 0, -1); - - for (door=0;door<6;door++) - { - if ((pExit = ch ->in_room->exit[door]) != NULL) - scan_list(pExit->u1.to_room, ch, 1, door); - } - return; - } - else if (!str_cmp(arg1, "n") || !str_cmp(arg1, "north")) door = 0; - else if (!str_cmp(arg1, "e") || !str_cmp(arg1, "east")) door = 1; - else if (!str_cmp(arg1, "s") || !str_cmp(arg1, "south")) door = 2; - else if (!str_cmp(arg1, "w") || !str_cmp(arg1, "west")) door = 3; - else if (!str_cmp(arg1, "u") || !str_cmp(arg1, "up" )) door = 4; - else if (!str_cmp(arg1, "d") || !str_cmp(arg1, "down")) door = 5; - else { send_to_char("Which way do you want to scan?\n\r", ch); return; } - - act("You peer intently $T.", ch, NULL, dir_name[door], TO_CHAR); - act("$n peers intently $T.", ch, NULL, dir_name[door], TO_ROOM); - sprintf(buf, "Looking %s you see:\n\r", dir_name[door]); - - scan_room = ch->in_room; - - for (depth = 1; depth < 4; depth++) - { - if ((pExit = scan_room->exit[door]) != NULL) - { - scan_room = pExit->u1.to_room; - scan_list(pExit->u1.to_room, ch, depth, door); - } - } - return; -} - -void scan_list(ROOM_INDEX_DATA *scan_room, CHAR_DATA *ch, sh_int depth, - sh_int door) -{ - CHAR_DATA *rch; - - if (scan_room == NULL) return; - for (rch=scan_room->people; rch != NULL; rch=rch->next_in_room) - { - if (rch == ch) continue; - if (!IS_NPC(rch) && rch->invis_level > get_trust(ch)) continue; - if (can_see(ch, rch)) scan_char(rch, ch, depth, door); - } - return; -} - -void scan_char(CHAR_DATA *victim, CHAR_DATA *ch, sh_int depth, sh_int door) -{ - extern char *const dir_name[]; - extern char *const distance[]; - char buf[MAX_INPUT_LENGTH], buf2[MAX_INPUT_LENGTH]; - - buf[0] = '\0'; - - strcat(buf, PERS(victim, ch)); - strcat(buf, ", "); - sprintf(buf2, distance[depth], dir_name[door]); - strcat(buf, buf2); - strcat(buf, "\n\r"); - - send_to_char(buf, ch); - return; -} diff --git a/Rom24/src/skills.c b/Rom24/src/skills.c deleted file mode 100644 index 37fe86a..0000000 --- a/Rom24/src/skills.c +++ /dev/null @@ -1,1069 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#include -#else -#include -#include -#endif -#include -#include -#include -#include "merc.h" -#include "interp.h" -#include "magic.h" -#include "recycle.h" - -/* used to get new skills */ -void do_gain(CHAR_DATA *ch, char *argument) -{ - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *trainer; - int gn = 0, sn = 0; - - if (IS_NPC(ch)) - return; - - /* find a trainer */ - for ( trainer = ch->in_room->people; - trainer != NULL; - trainer = trainer->next_in_room) - if (IS_NPC(trainer) && IS_SET(trainer->act,ACT_GAIN)) - break; - - if (trainer == NULL || !can_see(ch,trainer)) - { - send_to_char("You can't do that here.\n\r",ch); - return; - } - - one_argument(argument,arg); - - if (arg[0] == '\0') - { - do_function(trainer, &do_say, "Pardon me?"); - return; - } - - if (!str_prefix(arg,"list")) - { - int col; - - col = 0; - - sprintf(buf, "%-18s %-5s %-18s %-5s %-18s %-5s\n\r", - "group","cost","group","cost","group","cost"); - send_to_char(buf,ch); - - for (gn = 0; gn < MAX_GROUP; gn++) - { - if (group_table[gn].name == NULL) - break; - - if (!ch->pcdata->group_known[gn] - && group_table[gn].rating[ch->class] > 0) - { - sprintf(buf,"%-18s %-5d ", - group_table[gn].name,group_table[gn].rating[ch->class]); - send_to_char(buf,ch); - if (++col % 3 == 0) - send_to_char("\n\r",ch); - } - } - if (col % 3 != 0) - send_to_char("\n\r",ch); - - send_to_char("\n\r",ch); - - col = 0; - - sprintf(buf, "%-18s %-5s %-18s %-5s %-18s %-5s\n\r", - "skill","cost","skill","cost","skill","cost"); - send_to_char(buf,ch); - - for (sn = 0; sn < MAX_SKILL; sn++) - { - if (skill_table[sn].name == NULL) - break; - - if (!ch->pcdata->learned[sn] - && skill_table[sn].rating[ch->class] > 0 - && skill_table[sn].spell_fun == spell_null) - { - sprintf(buf,"%-18s %-5d ", - skill_table[sn].name,skill_table[sn].rating[ch->class]); - send_to_char(buf,ch); - if (++col % 3 == 0) - send_to_char("\n\r",ch); - } - } - if (col % 3 != 0) - send_to_char("\n\r",ch); - return; - } - - if (!str_prefix(arg,"convert")) - { - if (ch->practice < 10) - { - act("$N tells you 'You are not yet ready.'", - ch,NULL,trainer,TO_CHAR); - return; - } - - act("$N helps you apply your practice to training", - ch,NULL,trainer,TO_CHAR); - ch->practice -= 10; - ch->train +=1 ; - return; - } - - if (!str_prefix(arg,"points")) - { - if (ch->train < 2) - { - act("$N tells you 'You are not yet ready.'", - ch,NULL,trainer,TO_CHAR); - return; - } - - if (ch->pcdata->points <= 40) - { - act("$N tells you 'There would be no point in that.'", - ch,NULL,trainer,TO_CHAR); - return; - } - - act("$N trains you, and you feel more at ease with your skills.", - ch,NULL,trainer,TO_CHAR); - - ch->train -= 2; - ch->pcdata->points -= 1; - ch->exp = exp_per_level(ch,ch->pcdata->points) * ch->level; - return; - } - - /* else add a group/skill */ - - gn = group_lookup(argument); - if (gn > 0) - { - if (ch->pcdata->group_known[gn]) - { - act("$N tells you 'You already know that group!'", - ch,NULL,trainer,TO_CHAR); - return; - } - - if (group_table[gn].rating[ch->class] <= 0) - { - act("$N tells you 'That group is beyond your powers.'", - ch,NULL,trainer,TO_CHAR); - return; - } - - if (ch->train < group_table[gn].rating[ch->class]) - { - act("$N tells you 'You are not yet ready for that group.'", - ch,NULL,trainer,TO_CHAR); - return; - } - - /* add the group */ - gn_add(ch,gn); - act("$N trains you in the art of $t", - ch,group_table[gn].name,trainer,TO_CHAR); - ch->train -= group_table[gn].rating[ch->class]; - return; - } - - sn = skill_lookup(argument); - if (sn > -1) - { - if (skill_table[sn].spell_fun != spell_null) - { - act("$N tells you 'You must learn the full group.'", - ch,NULL,trainer,TO_CHAR); - return; - } - - - if (ch->pcdata->learned[sn]) - { - act("$N tells you 'You already know that skill!'", - ch,NULL,trainer,TO_CHAR); - return; - } - - if (skill_table[sn].rating[ch->class] <= 0) - { - act("$N tells you 'That skill is beyond your powers.'", - ch,NULL,trainer,TO_CHAR); - return; - } - - if (ch->train < skill_table[sn].rating[ch->class]) - { - act("$N tells you 'You are not yet ready for that skill.'", - ch,NULL,trainer,TO_CHAR); - return; - } - - /* add the skill */ - ch->pcdata->learned[sn] = 1; - act("$N trains you in the art of $t", - ch,skill_table[sn].name,trainer,TO_CHAR); - ch->train -= skill_table[sn].rating[ch->class]; - return; - } - - act("$N tells you 'I do not understand...'",ch,NULL,trainer,TO_CHAR); -} - - - - -/* RT spells and skills show the players spells (or skills) */ - -void do_spells(CHAR_DATA *ch, char *argument) -{ - BUFFER *buffer; - char arg[MAX_INPUT_LENGTH]; - char spell_list[LEVEL_HERO + 1][MAX_STRING_LENGTH]; - char spell_columns[LEVEL_HERO + 1]; - int sn, level, min_lev = 1, max_lev = LEVEL_HERO, mana; - bool fAll = FALSE, found = FALSE; - char buf[MAX_STRING_LENGTH]; - - if (IS_NPC(ch)) - return; - - if (argument[0] != '\0') - { - fAll = TRUE; - - if (str_prefix(argument,"all")) - { - argument = one_argument(argument,arg); - if (!is_number(arg)) - { - send_to_char("Arguments must be numerical or all.\n\r",ch); - return; - } - max_lev = atoi(arg); - - if (max_lev < 1 || max_lev > LEVEL_HERO) - { - sprintf(buf,"Levels must be between 1 and %d.\n\r",LEVEL_HERO); - send_to_char(buf,ch); - return; - } - - if (argument[0] != '\0') - { - argument = one_argument(argument,arg); - if (!is_number(arg)) - { - send_to_char("Arguments must be numerical or all.\n\r",ch); - return; - } - min_lev = max_lev; - max_lev = atoi(arg); - - if (max_lev < 1 || max_lev > LEVEL_HERO) - { - sprintf(buf, - "Levels must be between 1 and %d.\n\r",LEVEL_HERO); - send_to_char(buf,ch); - return; - } - - if (min_lev > max_lev) - { - send_to_char("That would be silly.\n\r",ch); - return; - } - } - } - } - - - /* initialize data */ - for (level = 0; level < LEVEL_HERO + 1; level++) - { - spell_columns[level] = 0; - spell_list[level][0] = '\0'; - } - - for (sn = 0; sn < MAX_SKILL; sn++) - { - if (skill_table[sn].name == NULL ) - break; - - if ((level = skill_table[sn].skill_level[ch->class]) < LEVEL_HERO + 1 - && (fAll || level <= ch->level) - && level >= min_lev && level <= max_lev - && skill_table[sn].spell_fun != spell_null - && ch->pcdata->learned[sn] > 0) - { - found = TRUE; - level = skill_table[sn].skill_level[ch->class]; - if (ch->level < level) - sprintf(buf,"%-18s n/a ", skill_table[sn].name); - else - { - mana = UMAX(skill_table[sn].min_mana, - 100/(2 + ch->level - level)); - sprintf(buf,"%-18s %3d mana ",skill_table[sn].name,mana); - } - - if (spell_list[level][0] == '\0') - sprintf(spell_list[level],"\n\rLevel %2d: %s",level,buf); - else /* append */ - { - if ( ++spell_columns[level] % 2 == 0) - strcat(spell_list[level],"\n\r "); - strcat(spell_list[level],buf); - } - } - } - - /* return results */ - - if (!found) - { - send_to_char("No spells found.\n\r",ch); - return; - } - - buffer = new_buf(); - for (level = 0; level < LEVEL_HERO + 1; level++) - if (spell_list[level][0] != '\0') - add_buf(buffer,spell_list[level]); - add_buf(buffer,"\n\r"); - page_to_char(buf_string(buffer),ch); - free_buf(buffer); -} - -void do_skills(CHAR_DATA *ch, char *argument) -{ - BUFFER *buffer; - char arg[MAX_INPUT_LENGTH]; - char skill_list[LEVEL_HERO + 1][MAX_STRING_LENGTH]; - char skill_columns[LEVEL_HERO + 1]; - int sn, level, min_lev = 1, max_lev = LEVEL_HERO; - bool fAll = FALSE, found = FALSE; - char buf[MAX_STRING_LENGTH]; - - if (IS_NPC(ch)) - return; - - if (argument[0] != '\0') - { - fAll = TRUE; - - if (str_prefix(argument,"all")) - { - argument = one_argument(argument,arg); - if (!is_number(arg)) - { - send_to_char("Arguments must be numerical or all.\n\r",ch); - return; - } - max_lev = atoi(arg); - - if (max_lev < 1 || max_lev > LEVEL_HERO) - { - sprintf(buf,"Levels must be between 1 and %d.\n\r",LEVEL_HERO); - send_to_char(buf,ch); - return; - } - - if (argument[0] != '\0') - { - argument = one_argument(argument,arg); - if (!is_number(arg)) - { - send_to_char("Arguments must be numerical or all.\n\r",ch); - return; - } - min_lev = max_lev; - max_lev = atoi(arg); - - if (max_lev < 1 || max_lev > LEVEL_HERO) - { - sprintf(buf, - "Levels must be between 1 and %d.\n\r",LEVEL_HERO); - send_to_char(buf,ch); - return; - } - - if (min_lev > max_lev) - { - send_to_char("That would be silly.\n\r",ch); - return; - } - } - } - } - - - /* initialize data */ - for (level = 0; level < LEVEL_HERO + 1; level++) - { - skill_columns[level] = 0; - skill_list[level][0] = '\0'; - } - - for (sn = 0; sn < MAX_SKILL; sn++) - { - if (skill_table[sn].name == NULL ) - break; - - if ((level = skill_table[sn].skill_level[ch->class]) < LEVEL_HERO + 1 - && (fAll || level <= ch->level) - && level >= min_lev && level <= max_lev - && skill_table[sn].spell_fun == spell_null - && ch->pcdata->learned[sn] > 0) - { - found = TRUE; - level = skill_table[sn].skill_level[ch->class]; - if (ch->level < level) - sprintf(buf,"%-18s n/a ", skill_table[sn].name); - else - sprintf(buf,"%-18s %3d%% ",skill_table[sn].name, - ch->pcdata->learned[sn]); - - if (skill_list[level][0] == '\0') - sprintf(skill_list[level],"\n\rLevel %2d: %s",level,buf); - else /* append */ - { - if ( ++skill_columns[level] % 2 == 0) - strcat(skill_list[level],"\n\r "); - strcat(skill_list[level],buf); - } - } - } - - /* return results */ - - if (!found) - { - send_to_char("No skills found.\n\r",ch); - return; - } - - buffer = new_buf(); - for (level = 0; level < LEVEL_HERO + 1; level++) - if (skill_list[level][0] != '\0') - add_buf(buffer,skill_list[level]); - add_buf(buffer,"\n\r"); - page_to_char(buf_string(buffer),ch); - free_buf(buffer); -} - -/* shows skills, groups and costs (only if not bought) */ -void list_group_costs(CHAR_DATA *ch) -{ - char buf[100]; - int gn,sn,col; - - if (IS_NPC(ch)) - return; - - col = 0; - - sprintf(buf,"%-18s %-5s %-18s %-5s %-18s %-5s\n\r","group","cp","group","cp","group","cp"); - send_to_char(buf,ch); - - for (gn = 0; gn < MAX_GROUP; gn++) - { - if (group_table[gn].name == NULL) - break; - - if (!ch->gen_data->group_chosen[gn] - && !ch->pcdata->group_known[gn] - && group_table[gn].rating[ch->class] > 0) - { - sprintf(buf,"%-18s %-5d ",group_table[gn].name, - group_table[gn].rating[ch->class]); - send_to_char(buf,ch); - if (++col % 3 == 0) - send_to_char("\n\r",ch); - } - } - if ( col % 3 != 0 ) - send_to_char( "\n\r", ch ); - send_to_char("\n\r",ch); - - col = 0; - - sprintf(buf,"%-18s %-5s %-18s %-5s %-18s %-5s\n\r","skill","cp","skill","cp","skill","cp"); - send_to_char(buf,ch); - - for (sn = 0; sn < MAX_SKILL; sn++) - { - if (skill_table[sn].name == NULL) - break; - - if (!ch->gen_data->skill_chosen[sn] - && ch->pcdata->learned[sn] == 0 - && skill_table[sn].spell_fun == spell_null - && skill_table[sn].rating[ch->class] > 0) - { - sprintf(buf,"%-18s %-5d ",skill_table[sn].name, - skill_table[sn].rating[ch->class]); - send_to_char(buf,ch); - if (++col % 3 == 0) - send_to_char("\n\r",ch); - } - } - if ( col % 3 != 0 ) - send_to_char( "\n\r", ch ); - send_to_char("\n\r",ch); - - sprintf(buf,"Creation points: %d\n\r",ch->pcdata->points); - send_to_char(buf,ch); - sprintf(buf,"Experience per level: %d\n\r", - exp_per_level(ch,ch->gen_data->points_chosen)); - send_to_char(buf,ch); - return; -} - - -void list_group_chosen(CHAR_DATA *ch) -{ - char buf[100]; - int gn,sn,col; - - if (IS_NPC(ch)) - return; - - col = 0; - - sprintf(buf,"%-18s %-5s %-18s %-5s %-18s %-5s","group","cp","group","cp","group","cp\n\r"); - send_to_char(buf,ch); - - for (gn = 0; gn < MAX_GROUP; gn++) - { - if (group_table[gn].name == NULL) - break; - - if (ch->gen_data->group_chosen[gn] - && group_table[gn].rating[ch->class] > 0) - { - sprintf(buf,"%-18s %-5d ",group_table[gn].name, - group_table[gn].rating[ch->class]); - send_to_char(buf,ch); - if (++col % 3 == 0) - send_to_char("\n\r",ch); - } - } - if ( col % 3 != 0 ) - send_to_char( "\n\r", ch ); - send_to_char("\n\r",ch); - - col = 0; - - sprintf(buf,"%-18s %-5s %-18s %-5s %-18s %-5s","skill","cp","skill","cp","skill","cp\n\r"); - send_to_char(buf,ch); - - for (sn = 0; sn < MAX_SKILL; sn++) - { - if (skill_table[sn].name == NULL) - break; - - if (ch->gen_data->skill_chosen[sn] - && skill_table[sn].rating[ch->class] > 0) - { - sprintf(buf,"%-18s %-5d ",skill_table[sn].name, - skill_table[sn].rating[ch->class]); - send_to_char(buf,ch); - if (++col % 3 == 0) - send_to_char("\n\r",ch); - } - } - if ( col % 3 != 0 ) - send_to_char( "\n\r", ch ); - send_to_char("\n\r",ch); - - sprintf(buf,"Creation points: %d\n\r",ch->gen_data->points_chosen); - send_to_char(buf,ch); - sprintf(buf,"Experience per level: %d\n\r", - exp_per_level(ch,ch->gen_data->points_chosen)); - send_to_char(buf,ch); - return; -} - -int exp_per_level(CHAR_DATA *ch, int points) -{ - int expl,inc; - - if (IS_NPC(ch)) - return 1000; - - expl = 1000; - inc = 500; - - if (points < 40) - return 1000 * (pc_race_table[ch->race].class_mult[ch->class] ? - pc_race_table[ch->race].class_mult[ch->class]/100 : 1); - - /* processing */ - points -= 40; - - while (points > 9) - { - expl += inc; - points -= 10; - if (points > 9) - { - expl += inc; - inc *= 2; - points -= 10; - } - } - - expl += points * inc / 10; - - return expl * pc_race_table[ch->race].class_mult[ch->class]/100; -} - -/* this procedure handles the input parsing for the skill generator */ -bool parse_gen_groups(CHAR_DATA *ch,char *argument) -{ - char arg[MAX_INPUT_LENGTH]; - char buf[100]; - int gn,sn,i; - - if (argument[0] == '\0') - return FALSE; - - argument = one_argument(argument,arg); - - if (!str_prefix(arg,"help")) - { - if (argument[0] == '\0') - { - do_function(ch, &do_help, "group help"); - return TRUE; - } - - do_function(ch, &do_help, argument); - return TRUE; - } - - if (!str_prefix(arg,"add")) - { - if (argument[0] == '\0') - { - send_to_char("You must provide a skill name.\n\r",ch); - return TRUE; - } - - gn = group_lookup(argument); - if (gn != -1) - { - if (ch->gen_data->group_chosen[gn] - || ch->pcdata->group_known[gn]) - { - send_to_char("You already know that group!\n\r",ch); - return TRUE; - } - - if (group_table[gn].rating[ch->class] < 1) - { - send_to_char("That group is not available.\n\r",ch); - return TRUE; - } - - /* Close security hole */ - if (ch->gen_data->points_chosen + group_table[gn].rating[ch->class] - > 300) - { - send_to_char( - "You cannot take more than 300 creation points.\n\r", ch); - return TRUE; - } - - sprintf(buf,"%s group added\n\r",group_table[gn].name); - send_to_char(buf,ch); - ch->gen_data->group_chosen[gn] = TRUE; - ch->gen_data->points_chosen += group_table[gn].rating[ch->class]; - gn_add(ch,gn); - ch->pcdata->points += group_table[gn].rating[ch->class]; - return TRUE; - } - - sn = skill_lookup(argument); - if (sn != -1) - { - if (ch->gen_data->skill_chosen[sn] - || ch->pcdata->learned[sn] > 0) - { - send_to_char("You already know that skill!\n\r",ch); - return TRUE; - } - - if (skill_table[sn].rating[ch->class] < 1 - || skill_table[sn].spell_fun != spell_null) - { - send_to_char("That skill is not available.\n\r",ch); - return TRUE; - } - - /* Close security hole */ - if (ch->gen_data->points_chosen + skill_table[sn].rating[ch->class] - > 300) - { - send_to_char( - "You cannot take more than 300 creation points.\n\r", ch); - return TRUE; - } - sprintf(buf, "%s skill added\n\r",skill_table[sn].name); - send_to_char(buf,ch); - ch->gen_data->skill_chosen[sn] = TRUE; - ch->gen_data->points_chosen += skill_table[sn].rating[ch->class]; - ch->pcdata->learned[sn] = 1; - ch->pcdata->points += skill_table[sn].rating[ch->class]; - return TRUE; - } - - send_to_char("No skills or groups by that name...\n\r",ch); - return TRUE; - } - - if (!strcmp(arg,"drop")) - { - if (argument[0] == '\0') - { - send_to_char("You must provide a skill to drop.\n\r",ch); - return TRUE; - } - - gn = group_lookup(argument); - if (gn != -1 && ch->gen_data->group_chosen[gn]) - { - send_to_char("Group dropped.\n\r",ch); - ch->gen_data->group_chosen[gn] = FALSE; - ch->gen_data->points_chosen -= group_table[gn].rating[ch->class]; - gn_remove(ch,gn); - for (i = 0; i < MAX_GROUP; i++) - { - if (ch->gen_data->group_chosen[gn]) - gn_add(ch,gn); - } - ch->pcdata->points -= group_table[gn].rating[ch->class]; - return TRUE; - } - - sn = skill_lookup(argument); - if (sn != -1 && ch->gen_data->skill_chosen[sn]) - { - send_to_char("Skill dropped.\n\r",ch); - ch->gen_data->skill_chosen[sn] = FALSE; - ch->gen_data->points_chosen -= skill_table[sn].rating[ch->class]; - ch->pcdata->learned[sn] = 0; - ch->pcdata->points -= skill_table[sn].rating[ch->class]; - return TRUE; - } - - send_to_char("You haven't bought any such skill or group.\n\r",ch); - return TRUE; - } - - if (!str_prefix(arg,"premise")) - { - do_function(ch, &do_help, "premise"); - return TRUE; - } - - if (!str_prefix(arg,"list")) - { - list_group_costs(ch); - return TRUE; - } - - if (!str_prefix(arg,"learned")) - { - list_group_chosen(ch); - return TRUE; - } - - if (!str_prefix(arg,"info")) - { - do_function(ch, &do_groups, argument); - return TRUE; - } - - return FALSE; -} - - - - - - -/* shows all groups, or the sub-members of a group */ -void do_groups(CHAR_DATA *ch, char *argument) -{ - char buf[100]; - int gn,sn,col; - - if (IS_NPC(ch)) - return; - - col = 0; - - if (argument[0] == '\0') - { /* show all groups */ - - for (gn = 0; gn < MAX_GROUP; gn++) - { - if (group_table[gn].name == NULL) - break; - if (ch->pcdata->group_known[gn]) - { - sprintf(buf,"%-20s ",group_table[gn].name); - send_to_char(buf,ch); - if (++col % 3 == 0) - send_to_char("\n\r",ch); - } - } - if ( col % 3 != 0 ) - send_to_char( "\n\r", ch ); - sprintf(buf,"Creation points: %d\n\r",ch->pcdata->points); - send_to_char(buf,ch); - return; - } - - if (!str_cmp(argument,"all")) /* show all groups */ - { - for (gn = 0; gn < MAX_GROUP; gn++) - { - if (group_table[gn].name == NULL) - break; - sprintf(buf,"%-20s ",group_table[gn].name); - send_to_char(buf,ch); - if (++col % 3 == 0) - send_to_char("\n\r",ch); - } - if ( col % 3 != 0 ) - send_to_char( "\n\r", ch ); - return; - } - - - /* show the sub-members of a group */ - gn = group_lookup(argument); - if (gn == -1) - { - send_to_char("No group of that name exist.\n\r",ch); - send_to_char( - "Type 'groups all' or 'info all' for a full listing.\n\r",ch); - return; - } - - for (sn = 0; sn < MAX_IN_GROUP; sn++) - { - if (group_table[gn].spells[sn] == NULL) - break; - sprintf(buf,"%-20s ",group_table[gn].spells[sn]); - send_to_char(buf,ch); - if (++col % 3 == 0) - send_to_char("\n\r",ch); - } - if ( col % 3 != 0 ) - send_to_char( "\n\r", ch ); -} - -/* checks for skill improvement */ -void check_improve( CHAR_DATA *ch, int sn, bool success, int multiplier ) -{ - int chance; - char buf[100]; - - if (IS_NPC(ch)) - return; - - if (ch->level < skill_table[sn].skill_level[ch->class] - || skill_table[sn].rating[ch->class] == 0 - || ch->pcdata->learned[sn] == 0 - || ch->pcdata->learned[sn] == 100) - return; /* skill is not known */ - - /* check to see if the character has a chance to learn */ - chance = 10 * int_app[get_curr_stat(ch,STAT_INT)].learn; - chance /= ( multiplier - * skill_table[sn].rating[ch->class] - * 4); - chance += ch->level; - - if (number_range(1,1000) > chance) - return; - - /* now that the character has a CHANCE to learn, see if they really have */ - - if (success) - { - chance = URANGE(5,100 - ch->pcdata->learned[sn], 95); - if (number_percent() < chance) - { - sprintf(buf,"You have become better at %s!\n\r", - skill_table[sn].name); - send_to_char(buf,ch); - ch->pcdata->learned[sn]++; - gain_exp(ch,2 * skill_table[sn].rating[ch->class]); - } - } - - else - { - chance = URANGE(5,ch->pcdata->learned[sn]/2,30); - if (number_percent() < chance) - { - sprintf(buf, - "You learn from your mistakes, and your %s skill improves.\n\r", - skill_table[sn].name); - send_to_char(buf,ch); - ch->pcdata->learned[sn] += number_range(1,3); - ch->pcdata->learned[sn] = UMIN(ch->pcdata->learned[sn],100); - gain_exp(ch,2 * skill_table[sn].rating[ch->class]); - } - } -} - -/* returns a group index number given the name */ -int group_lookup( const char *name ) -{ - int gn; - - for ( gn = 0; gn < MAX_GROUP; gn++ ) - { - if ( group_table[gn].name == NULL ) - break; - if ( LOWER(name[0]) == LOWER(group_table[gn].name[0]) - && !str_prefix( name, group_table[gn].name ) ) - return gn; - } - - return -1; -} - -/* recursively adds a group given its number -- uses group_add */ -void gn_add( CHAR_DATA *ch, int gn) -{ - int i; - - ch->pcdata->group_known[gn] = TRUE; - for ( i = 0; i < MAX_IN_GROUP; i++) - { - if (group_table[gn].spells[i] == NULL) - break; - group_add(ch,group_table[gn].spells[i],FALSE); - } -} - -/* recusively removes a group given its number -- uses group_remove */ -void gn_remove( CHAR_DATA *ch, int gn) -{ - int i; - - ch->pcdata->group_known[gn] = FALSE; - - for ( i = 0; i < MAX_IN_GROUP; i ++) - { - if (group_table[gn].spells[i] == NULL) - break; - group_remove(ch,group_table[gn].spells[i]); - } -} - -/* use for processing a skill or group for addition */ -void group_add( CHAR_DATA *ch, const char *name, bool deduct) -{ - int sn,gn; - - if (IS_NPC(ch)) /* NPCs do not have skills */ - return; - - sn = skill_lookup(name); - - if (sn != -1) - { - if (ch->pcdata->learned[sn] == 0) /* i.e. not known */ - { - ch->pcdata->learned[sn] = 1; - if (deduct) - ch->pcdata->points += skill_table[sn].rating[ch->class]; - } - return; - } - - /* now check groups */ - - gn = group_lookup(name); - - if (gn != -1) - { - if (ch->pcdata->group_known[gn] == FALSE) - { - ch->pcdata->group_known[gn] = TRUE; - if (deduct) - ch->pcdata->points += group_table[gn].rating[ch->class]; - } - gn_add(ch,gn); /* make sure all skills in the group are known */ - } -} - -/* used for processing a skill or group for deletion -- no points back! */ - -void group_remove(CHAR_DATA *ch, const char *name) -{ - int sn, gn; - - sn = skill_lookup(name); - - if (sn != -1) - { - ch->pcdata->learned[sn] = 0; - return; - } - - /* now check groups */ - - gn = group_lookup(name); - - if (gn != -1 && ch->pcdata->group_known[gn] == TRUE) - { - ch->pcdata->group_known[gn] = FALSE; - gn_remove(ch,gn); /* be sure to call gn_add on all remaining groups */ - } -} diff --git a/Rom24/src/special.c b/Rom24/src/special.c deleted file mode 100644 index c067408..0000000 --- a/Rom24/src/special.c +++ /dev/null @@ -1,1042 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#include -#else -#include -#endif -#include -#include -#include -#include -#include "merc.h" -#include "interp.h" -#include "magic.h" - -/* - * The following special functions are available for mobiles. - */ -DECLARE_SPEC_FUN( spec_breath_any ); -DECLARE_SPEC_FUN( spec_breath_acid ); -DECLARE_SPEC_FUN( spec_breath_fire ); -DECLARE_SPEC_FUN( spec_breath_frost ); -DECLARE_SPEC_FUN( spec_breath_gas ); -DECLARE_SPEC_FUN( spec_breath_lightning ); -DECLARE_SPEC_FUN( spec_cast_adept ); -DECLARE_SPEC_FUN( spec_cast_cleric ); -DECLARE_SPEC_FUN( spec_cast_judge ); -DECLARE_SPEC_FUN( spec_cast_mage ); -DECLARE_SPEC_FUN( spec_cast_undead ); -DECLARE_SPEC_FUN( spec_executioner ); -DECLARE_SPEC_FUN( spec_fido ); -DECLARE_SPEC_FUN( spec_guard ); -DECLARE_SPEC_FUN( spec_janitor ); -DECLARE_SPEC_FUN( spec_mayor ); -DECLARE_SPEC_FUN( spec_poison ); -DECLARE_SPEC_FUN( spec_thief ); -DECLARE_SPEC_FUN( spec_nasty ); -DECLARE_SPEC_FUN( spec_troll_member ); -DECLARE_SPEC_FUN( spec_ogre_member ); -DECLARE_SPEC_FUN( spec_patrolman ); - -/* the function table */ -const struct spec_type spec_table[] = -{ - { "spec_breath_any", spec_breath_any }, - { "spec_breath_acid", spec_breath_acid }, - { "spec_breath_fire", spec_breath_fire }, - { "spec_breath_frost", spec_breath_frost }, - { "spec_breath_gas", spec_breath_gas }, - { "spec_breath_lightning", spec_breath_lightning }, - { "spec_cast_adept", spec_cast_adept }, - { "spec_cast_cleric", spec_cast_cleric }, - { "spec_cast_judge", spec_cast_judge }, - { "spec_cast_mage", spec_cast_mage }, - { "spec_cast_undead", spec_cast_undead }, - { "spec_executioner", spec_executioner }, - { "spec_fido", spec_fido }, - { "spec_guard", spec_guard }, - { "spec_janitor", spec_janitor }, - { "spec_mayor", spec_mayor }, - { "spec_poison", spec_poison }, - { "spec_thief", spec_thief }, - { "spec_nasty", spec_nasty }, - { "spec_troll_member", spec_troll_member }, - { "spec_ogre_member", spec_ogre_member }, - { "spec_patrolman", spec_patrolman }, - { NULL, NULL } -}; - -/* - * Given a name, return the appropriate spec fun. - */ -SPEC_FUN *spec_lookup( const char *name ) -{ - int i; - - for ( i = 0; spec_table[i].name != NULL; i++) - { - if (LOWER(name[0]) == LOWER(spec_table[i].name[0]) - && !str_prefix( name,spec_table[i].name)) - return spec_table[i].function; - } - - return 0; -} - -char *spec_name( SPEC_FUN *function) -{ - int i; - - for (i = 0; spec_table[i].function != NULL; i++) - { - if (function == spec_table[i].function) - return spec_table[i].name; - } - - return NULL; -} - -bool spec_troll_member( CHAR_DATA *ch) -{ - CHAR_DATA *vch, *victim = NULL; - int count = 0; - char *message; - - if (!IS_AWAKE(ch) || IS_AFFECTED(ch,AFF_CALM) || ch->in_room == NULL - || IS_AFFECTED(ch,AFF_CHARM) || ch->fighting != NULL) - return FALSE; - - /* find an ogre to beat up */ - for (vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room) - { - if (!IS_NPC(vch) || ch == vch) - continue; - - if (vch->pIndexData->vnum == MOB_VNUM_PATROLMAN) - return FALSE; - - if (vch->pIndexData->group == GROUP_VNUM_OGRES - && ch->level > vch->level - 2 && !is_safe(ch,vch)) - { - if (number_range(0,count) == 0) - victim = vch; - - count++; - } - } - - if (victim == NULL) - return FALSE; - - /* say something, then raise hell */ - switch (number_range(0,6)) - { - default: message = NULL; break; - case 0: message = "$n yells 'I've been looking for you, punk!'"; - break; - case 1: message = "With a scream of rage, $n attacks $N."; - break; - case 2: message = - "$n says 'What's slimy Ogre trash like you doing around here?'"; - break; - case 3: message = "$n cracks his knuckles and says 'Do ya feel lucky?'"; - break; - case 4: message = "$n says 'There's no cops to save you this time!'"; - break; - case 5: message = "$n says 'Time to join your brother, spud.'"; - break; - case 6: message = "$n says 'Let's rock.'"; - break; - } - - if (message != NULL) - act(message,ch,NULL,victim,TO_ALL); - multi_hit( ch, victim, TYPE_UNDEFINED ); - return TRUE; -} - -bool spec_ogre_member( CHAR_DATA *ch) -{ - CHAR_DATA *vch, *victim = NULL; - int count = 0; - char *message; - - if (!IS_AWAKE(ch) || IS_AFFECTED(ch,AFF_CALM) || ch->in_room == NULL - || IS_AFFECTED(ch,AFF_CHARM) || ch->fighting != NULL) - return FALSE; - - /* find an troll to beat up */ - for (vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room) - { - if (!IS_NPC(vch) || ch == vch) - continue; - - if (vch->pIndexData->vnum == MOB_VNUM_PATROLMAN) - return FALSE; - - if (vch->pIndexData->group == GROUP_VNUM_TROLLS - && ch->level > vch->level - 2 && !is_safe(ch,vch)) - { - if (number_range(0,count) == 0) - victim = vch; - - count++; - } - } - - if (victim == NULL) - return FALSE; - - /* say something, then raise hell */ - switch (number_range(0,6)) - { - default: message = NULL; break; - case 0: message = "$n yells 'I've been looking for you, punk!'"; - break; - case 1: message = "With a scream of rage, $n attacks $N.'"; - break; - case 2: message = - "$n says 'What's Troll filth like you doing around here?'"; - break; - case 3: message = "$n cracks his knuckles and says 'Do ya feel lucky?'"; - break; - case 4: message = "$n says 'There's no cops to save you this time!'"; - break; - case 5: message = "$n says 'Time to join your brother, spud.'"; - break; - case 6: message = "$n says 'Let's rock.'"; - break; - } - - if (message != NULL) - act(message,ch,NULL,victim,TO_ALL); - multi_hit( ch, victim, TYPE_UNDEFINED ); - return TRUE; -} - -bool spec_patrolman(CHAR_DATA *ch) -{ - CHAR_DATA *vch,*victim = NULL; - OBJ_DATA *obj; - char *message; - int count = 0; - - if (!IS_AWAKE(ch) || IS_AFFECTED(ch,AFF_CALM) || ch->in_room == NULL - || IS_AFFECTED(ch,AFF_CHARM) || ch->fighting != NULL) - return FALSE; - - /* look for a fight in the room */ - for (vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room) - { - if (vch == ch) - continue; - - if (vch->fighting != NULL) /* break it up! */ - { - if (number_range(0,count) == 0) - victim = (vch->level > vch->fighting->level) - ? vch : vch->fighting; - count++; - } - } - - if (victim == NULL || (IS_NPC(victim) && victim->spec_fun == ch->spec_fun)) - return FALSE; - - if (((obj = get_eq_char(ch,WEAR_NECK_1)) != NULL - && obj->pIndexData->vnum == OBJ_VNUM_WHISTLE) - || ((obj = get_eq_char(ch,WEAR_NECK_2)) != NULL - && obj->pIndexData->vnum == OBJ_VNUM_WHISTLE)) - { - act("You blow down hard on $p.",ch,obj,NULL,TO_CHAR); - act("$n blows on $p, ***WHEEEEEEEEEEEET***",ch,obj,NULL,TO_ROOM); - - for ( vch = char_list; vch != NULL; vch = vch->next ) - { - if ( vch->in_room == NULL ) - continue; - - if (vch->in_room != ch->in_room - && vch->in_room->area == ch->in_room->area) - send_to_char( "You hear a shrill whistling sound.\n\r", vch ); - } - } - - switch (number_range(0,6)) - { - default: message = NULL; break; - case 0: message = "$n yells 'All roit! All roit! break it up!'"; - break; - case 1: message = - "$n says 'Society's to blame, but what's a bloke to do?'"; - break; - case 2: message = - "$n mumbles 'bloody kids will be the death of us all.'"; - break; - case 3: message = "$n shouts 'Stop that! Stop that!' and attacks."; - break; - case 4: message = "$n pulls out his billy and goes to work."; - break; - case 5: message = - "$n sighs in resignation and proceeds to break up the fight."; - break; - case 6: message = "$n says 'Settle down, you hooligans!'"; - break; - } - - if (message != NULL) - act(message,ch,NULL,NULL,TO_ALL); - - multi_hit(ch,victim,TYPE_UNDEFINED); - - return TRUE; -} - - -bool spec_nasty( CHAR_DATA *ch ) -{ - CHAR_DATA *victim, *v_next; - long gold; - - if (!IS_AWAKE(ch)) { - return FALSE; - } - - if (ch->position != POS_FIGHTING) { - for ( victim = ch->in_room->people; victim != NULL; victim = v_next) - { - v_next = victim->next_in_room; - if (!IS_NPC(victim) - && (victim->level > ch->level) - && (victim->level < ch->level + 10)) - { - do_function(ch, &do_backstab, victim->name); - if (ch->position != POS_FIGHTING) - { - do_function(ch, &do_murder, victim->name); - } - - /* should steal some coins right away? :) */ - return TRUE; - } - } - return FALSE; /* No one to attack */ - } - - /* okay, we must be fighting.... steal some coins and flee */ - if ( (victim = ch->fighting) == NULL) - return FALSE; /* let's be paranoid.... */ - - switch ( number_bits(2) ) - { - case 0: act( "$n rips apart your coin purse, spilling your gold!", - ch, NULL, victim, TO_VICT); - act( "You slash apart $N's coin purse and gather his gold.", - ch, NULL, victim, TO_CHAR); - act( "$N's coin purse is ripped apart!", - ch, NULL, victim, TO_NOTVICT); - gold = victim->gold / 10; /* steal 10% of his gold */ - victim->gold -= gold; - ch->gold += gold; - return TRUE; - - case 1: do_function(ch, &do_flee, ""); - return TRUE; - - default: return FALSE; - } -} - -/* - * Core procedure for dragons. - */ -bool dragon( CHAR_DATA *ch, char *spell_name ) -{ - CHAR_DATA *victim; - CHAR_DATA *v_next; - int sn; - - if ( ch->position != POS_FIGHTING ) - return FALSE; - - for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) - { - v_next = victim->next_in_room; - if ( victim->fighting == ch && number_bits( 3 ) == 0 ) - break; - } - - if ( victim == NULL ) - return FALSE; - - if ( ( sn = skill_lookup( spell_name ) ) < 0 ) - return FALSE; - (*skill_table[sn].spell_fun) ( sn, ch->level, ch, victim, TARGET_CHAR); - return TRUE; -} - - - -/* - * Special procedures for mobiles. - */ -bool spec_breath_any( CHAR_DATA *ch ) -{ - if ( ch->position != POS_FIGHTING ) - return FALSE; - - switch ( number_bits( 3 ) ) - { - case 0: return spec_breath_fire ( ch ); - case 1: - case 2: return spec_breath_lightning ( ch ); - case 3: return spec_breath_gas ( ch ); - case 4: return spec_breath_acid ( ch ); - case 5: - case 6: - case 7: return spec_breath_frost ( ch ); - } - - return FALSE; -} - - - -bool spec_breath_acid( CHAR_DATA *ch ) -{ - return dragon( ch, "acid breath" ); -} - - - -bool spec_breath_fire( CHAR_DATA *ch ) -{ - return dragon( ch, "fire breath" ); -} - - - -bool spec_breath_frost( CHAR_DATA *ch ) -{ - return dragon( ch, "frost breath" ); -} - - - -bool spec_breath_gas( CHAR_DATA *ch ) -{ - int sn; - - if ( ch->position != POS_FIGHTING ) - return FALSE; - - if ( ( sn = skill_lookup( "gas breath" ) ) < 0 ) - return FALSE; - (*skill_table[sn].spell_fun) ( sn, ch->level, ch, NULL,TARGET_CHAR); - return TRUE; -} - - - -bool spec_breath_lightning( CHAR_DATA *ch ) -{ - return dragon( ch, "lightning breath" ); -} - - - -bool spec_cast_adept( CHAR_DATA *ch ) -{ - CHAR_DATA *victim; - CHAR_DATA *v_next; - - if ( !IS_AWAKE(ch) ) - return FALSE; - - for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) - { - v_next = victim->next_in_room; - if ( victim != ch && can_see( ch, victim ) && number_bits( 1 ) == 0 - && !IS_NPC(victim) && victim->level < 11) - break; - } - - if ( victim == NULL ) - return FALSE; - - switch ( number_bits( 4 ) ) - { - case 0: - act( "$n utters the word 'abrazak'.", ch, NULL, NULL, TO_ROOM ); - spell_armor( skill_lookup( "armor" ), ch->level,ch,victim,TARGET_CHAR); - return TRUE; - - case 1: - act( "$n utters the word 'fido'.", ch, NULL, NULL, TO_ROOM ); - spell_bless( skill_lookup( "bless" ), ch->level,ch,victim,TARGET_CHAR); - return TRUE; - - case 2: - act("$n utters the words 'judicandus noselacri'.",ch,NULL,NULL,TO_ROOM); - spell_cure_blindness( skill_lookup( "cure blindness" ), - ch->level, ch, victim,TARGET_CHAR); - return TRUE; - - case 3: - act("$n utters the words 'judicandus dies'.", ch,NULL, NULL, TO_ROOM ); - spell_cure_light( skill_lookup( "cure light" ), - ch->level, ch, victim,TARGET_CHAR); - return TRUE; - - case 4: - act( "$n utters the words 'judicandus sausabru'.",ch,NULL,NULL,TO_ROOM); - spell_cure_poison( skill_lookup( "cure poison" ), - ch->level, ch, victim,TARGET_CHAR); - return TRUE; - - case 5: - act("$n utters the word 'candusima'.", ch, NULL, NULL, TO_ROOM ); - spell_refresh( skill_lookup("refresh"),ch->level,ch,victim,TARGET_CHAR); - return TRUE; - - case 6: - act("$n utters the words 'judicandus eugzagz'.",ch,NULL,NULL,TO_ROOM); - spell_cure_disease(skill_lookup("cure disease"), - ch->level,ch,victim,TARGET_CHAR); - } - - return FALSE; -} - - - -bool spec_cast_cleric( CHAR_DATA *ch ) -{ - CHAR_DATA *victim; - CHAR_DATA *v_next; - char *spell; - int sn; - - if ( ch->position != POS_FIGHTING ) - return FALSE; - - for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) - { - v_next = victim->next_in_room; - if ( victim->fighting == ch && number_bits( 2 ) == 0 ) - break; - } - - if ( victim == NULL ) - return FALSE; - - for ( ;; ) - { - int min_level; - - switch ( number_bits( 4 ) ) - { - case 0: min_level = 0; spell = "blindness"; break; - case 1: min_level = 3; spell = "cause serious"; break; - case 2: min_level = 7; spell = "earthquake"; break; - case 3: min_level = 9; spell = "cause critical"; break; - case 4: min_level = 10; spell = "dispel evil"; break; - case 5: min_level = 12; spell = "curse"; break; - case 6: min_level = 12; spell = "change sex"; break; - case 7: min_level = 13; spell = "flamestrike"; break; - case 8: - case 9: - case 10: min_level = 15; spell = "harm"; break; - case 11: min_level = 15; spell = "plague"; break; - default: min_level = 16; spell = "dispel magic"; break; - } - - if ( ch->level >= min_level ) - break; - } - - if ( ( sn = skill_lookup( spell ) ) < 0 ) - return FALSE; - (*skill_table[sn].spell_fun) ( sn, ch->level, ch, victim,TARGET_CHAR); - return TRUE; -} - -bool spec_cast_judge( CHAR_DATA *ch ) -{ - CHAR_DATA *victim; - CHAR_DATA *v_next; - char *spell; - int sn; - - if ( ch->position != POS_FIGHTING ) - return FALSE; - - for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) - { - v_next = victim->next_in_room; - if ( victim->fighting == ch && number_bits( 2 ) == 0 ) - break; - } - - if ( victim == NULL ) - return FALSE; - - spell = "high explosive"; - if ( ( sn = skill_lookup( spell ) ) < 0 ) - return FALSE; - (*skill_table[sn].spell_fun) ( sn, ch->level, ch, victim,TARGET_CHAR); - return TRUE; -} - - - -bool spec_cast_mage( CHAR_DATA *ch ) -{ - CHAR_DATA *victim; - CHAR_DATA *v_next; - char *spell; - int sn; - - if ( ch->position != POS_FIGHTING ) - return FALSE; - - for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) - { - v_next = victim->next_in_room; - if ( victim->fighting == ch && number_bits( 2 ) == 0 ) - break; - } - - if ( victim == NULL ) - return FALSE; - - for ( ;; ) - { - int min_level; - - switch ( number_bits( 4 ) ) - { - case 0: min_level = 0; spell = "blindness"; break; - case 1: min_level = 3; spell = "chill touch"; break; - case 2: min_level = 7; spell = "weaken"; break; - case 3: min_level = 8; spell = "teleport"; break; - case 4: min_level = 11; spell = "colour spray"; break; - case 5: min_level = 12; spell = "change sex"; break; - case 6: min_level = 13; spell = "energy drain"; break; - case 7: - case 8: - case 9: min_level = 15; spell = "fireball"; break; - case 10: min_level = 20; spell = "plague"; break; - default: min_level = 20; spell = "acid blast"; break; - } - - if ( ch->level >= min_level ) - break; - } - - if ( ( sn = skill_lookup( spell ) ) < 0 ) - return FALSE; - (*skill_table[sn].spell_fun) ( sn, ch->level, ch, victim,TARGET_CHAR); - return TRUE; -} - - - -bool spec_cast_undead( CHAR_DATA *ch ) -{ - CHAR_DATA *victim; - CHAR_DATA *v_next; - char *spell; - int sn; - - if ( ch->position != POS_FIGHTING ) - return FALSE; - - for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) - { - v_next = victim->next_in_room; - if ( victim->fighting == ch && number_bits( 2 ) == 0 ) - break; - } - - if ( victim == NULL ) - return FALSE; - - for ( ;; ) - { - int min_level; - - switch ( number_bits( 4 ) ) - { - case 0: min_level = 0; spell = "curse"; break; - case 1: min_level = 3; spell = "weaken"; break; - case 2: min_level = 6; spell = "chill touch"; break; - case 3: min_level = 9; spell = "blindness"; break; - case 4: min_level = 12; spell = "poison"; break; - case 5: min_level = 15; spell = "energy drain"; break; - case 6: min_level = 18; spell = "harm"; break; - case 7: min_level = 21; spell = "teleport"; break; - case 8: min_level = 20; spell = "plague"; break; - default: min_level = 18; spell = "harm"; break; - } - - if ( ch->level >= min_level ) - break; - } - - if ( ( sn = skill_lookup( spell ) ) < 0 ) - return FALSE; - (*skill_table[sn].spell_fun) ( sn, ch->level, ch, victim,TARGET_CHAR); - return TRUE; -} - - -bool spec_executioner( CHAR_DATA *ch ) -{ - char buf[MAX_STRING_LENGTH]; - CHAR_DATA *victim; - CHAR_DATA *v_next; - char *crime; - - if ( !IS_AWAKE(ch) || ch->fighting != NULL ) - return FALSE; - - crime = ""; - for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) - { - v_next = victim->next_in_room; - - if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_KILLER) - && can_see(ch,victim)) - { crime = "KILLER"; break; } - - if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_THIEF) - && can_see(ch,victim)) - { crime = "THIEF"; break; } - } - - if ( victim == NULL ) - return FALSE; - - sprintf( buf, "%s is a %s! PROTECT THE INNOCENT! MORE BLOOOOD!!!", - victim->name, crime ); - REMOVE_BIT(ch->comm,COMM_NOSHOUT); - do_function(ch, &do_yell, buf ); - multi_hit( ch, victim, TYPE_UNDEFINED ); - return TRUE; -} - - - -bool spec_fido( CHAR_DATA *ch ) -{ - OBJ_DATA *corpse; - OBJ_DATA *c_next; - OBJ_DATA *obj; - OBJ_DATA *obj_next; - - if ( !IS_AWAKE(ch) ) - return FALSE; - - for ( corpse = ch->in_room->contents; corpse != NULL; corpse = c_next ) - { - c_next = corpse->next_content; - if ( corpse->item_type != ITEM_CORPSE_NPC ) - continue; - - act( "$n savagely devours a corpse.", ch, NULL, NULL, TO_ROOM ); - for ( obj = corpse->contains; obj; obj = obj_next ) - { - obj_next = obj->next_content; - obj_from_obj( obj ); - obj_to_room( obj, ch->in_room ); - } - extract_obj( corpse ); - return TRUE; - } - - return FALSE; -} - - - -bool spec_guard( CHAR_DATA *ch ) -{ - char buf[MAX_STRING_LENGTH]; - CHAR_DATA *victim; - CHAR_DATA *v_next; - CHAR_DATA *ech; - char *crime; - int max_evil; - - if ( !IS_AWAKE(ch) || ch->fighting != NULL ) - return FALSE; - - max_evil = 300; - ech = NULL; - crime = ""; - - for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) - { - v_next = victim->next_in_room; - - if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_KILLER) - && can_see(ch,victim)) - { crime = "KILLER"; break; } - - if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_THIEF) - && can_see(ch,victim)) - { crime = "THIEF"; break; } - - if ( victim->fighting != NULL - && victim->fighting != ch - && victim->alignment < max_evil ) - { - max_evil = victim->alignment; - ech = victim; - } - } - - if ( victim != NULL ) - { - sprintf( buf, "%s is a %s! PROTECT THE INNOCENT!! BANZAI!!", - victim->name, crime ); - REMOVE_BIT(ch->comm,COMM_NOSHOUT); - do_function(ch, &do_yell, buf ); - multi_hit( ch, victim, TYPE_UNDEFINED ); - return TRUE; - } - - if ( ech != NULL ) - { - act( "$n screams 'PROTECT THE INNOCENT!! BANZAI!!", - ch, NULL, NULL, TO_ROOM ); - multi_hit( ch, ech, TYPE_UNDEFINED ); - return TRUE; - } - - return FALSE; -} - - - -bool spec_janitor( CHAR_DATA *ch ) -{ - OBJ_DATA *trash; - OBJ_DATA *trash_next; - - if ( !IS_AWAKE(ch) ) - return FALSE; - - for ( trash = ch->in_room->contents; trash != NULL; trash = trash_next ) - { - trash_next = trash->next_content; - if ( !IS_SET( trash->wear_flags, ITEM_TAKE ) || !can_loot(ch,trash)) - continue; - if ( trash->item_type == ITEM_DRINK_CON - || trash->item_type == ITEM_TRASH - || trash->cost < 10 ) - { - act( "$n picks up some trash.", ch, NULL, NULL, TO_ROOM ); - obj_from_room( trash ); - obj_to_char( trash, ch ); - return TRUE; - } - } - - return FALSE; -} - - - -bool spec_mayor( CHAR_DATA *ch ) -{ - static const char open_path[] = - "W3a3003b33000c111d0d111Oe333333Oe22c222112212111a1S."; - - static const char close_path[] = - "W3a3003b33000c111d0d111CE333333CE22c222112212111a1S."; - - static const char *path; - static int pos; - static bool move; - - if ( !move ) - { - if ( time_info.hour == 6 ) - { - path = open_path; - move = TRUE; - pos = 0; - } - - if ( time_info.hour == 20 ) - { - path = close_path; - move = TRUE; - pos = 0; - } - } - - if ( ch->fighting != NULL ) - return spec_cast_mage( ch ); - if ( !move || ch->position < POS_SLEEPING ) - return FALSE; - - switch ( path[pos] ) - { - case '0': - case '1': - case '2': - case '3': - move_char( ch, path[pos] - '0', FALSE ); - break; - - case 'W': - ch->position = POS_STANDING; - act( "$n awakens and groans loudly.", ch, NULL, NULL, TO_ROOM ); - break; - - case 'S': - ch->position = POS_SLEEPING; - act( "$n lies down and falls asleep.", ch, NULL, NULL, TO_ROOM ); - break; - - case 'a': - act( "$n says 'Hello Honey!'", ch, NULL, NULL, TO_ROOM ); - break; - - case 'b': - act( "$n says 'What a view! I must do something about that dump!'", - ch, NULL, NULL, TO_ROOM ); - break; - - case 'c': - act( "$n says 'Vandals! Youngsters have no respect for anything!'", - ch, NULL, NULL, TO_ROOM ); - break; - - case 'd': - act( "$n says 'Good day, citizens!'", ch, NULL, NULL, TO_ROOM ); - break; - - case 'e': - act( "$n says 'I hereby declare the city of Midgaard open!'", - ch, NULL, NULL, TO_ROOM ); - break; - - case 'E': - act( "$n says 'I hereby declare the city of Midgaard closed!'", - ch, NULL, NULL, TO_ROOM ); - break; - - case 'O': -/* do_function(ch, &do_unlock, "gate" ); */ - do_function(ch, &do_open, "gate" ); - break; - - case 'C': - do_function(ch, &do_close, "gate" ); -/* do_function(ch, &do_lock, "gate" ); */ - break; - - case '.' : - move = FALSE; - break; - } - - pos++; - return FALSE; -} - - - -bool spec_poison( CHAR_DATA *ch ) -{ - CHAR_DATA *victim; - - if ( ch->position != POS_FIGHTING - || ( victim = ch->fighting ) == NULL - || number_percent( ) > 2 * ch->level ) - return FALSE; - - act( "You bite $N!", ch, NULL, victim, TO_CHAR ); - act( "$n bites $N!", ch, NULL, victim, TO_NOTVICT ); - act( "$n bites you!", ch, NULL, victim, TO_VICT ); - spell_poison( gsn_poison, ch->level, ch, victim,TARGET_CHAR); - return TRUE; -} - - - -bool spec_thief( CHAR_DATA *ch ) -{ - CHAR_DATA *victim; - CHAR_DATA *v_next; - long gold,silver; - - if ( ch->position != POS_STANDING ) - return FALSE; - - for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) - { - v_next = victim->next_in_room; - - if ( IS_NPC(victim) - || victim->level >= LEVEL_IMMORTAL - || number_bits( 5 ) != 0 - || !can_see(ch,victim)) - continue; - - if ( IS_AWAKE(victim) && number_range( 0, ch->level ) == 0 ) - { - act( "You discover $n's hands in your wallet!", - ch, NULL, victim, TO_VICT ); - act( "$N discovers $n's hands in $S wallet!", - ch, NULL, victim, TO_NOTVICT ); - return TRUE; - } - else - { - gold = victim->gold * UMIN(number_range(1,20),ch->level / 2) / 100; - gold = UMIN(gold, ch->level * ch->level * 10 ); - ch->gold += gold; - victim->gold -= gold; - silver = victim->silver * UMIN(number_range(1,20),ch->level/2)/100; - silver = UMIN(silver,ch->level*ch->level * 25); - ch->silver += silver; - victim->silver -= silver; - return TRUE; - } - } - - return FALSE; -} - diff --git a/Rom24/src/tables.c b/Rom24/src/tables.c deleted file mode 100644 index aa2f326..0000000 --- a/Rom24/src/tables.c +++ /dev/null @@ -1,322 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#endif -#include -#include -#include "merc.h" -#include "tables.h" - -/* for clans */ -const struct clan_type clan_table[MAX_CLAN] = -{ - /* name, who entry, death-transfer room, independent */ - /* independent should be FALSE if is a real clan */ - { "", "", ROOM_VNUM_ALTAR, TRUE }, - { "loner", "[ Loner ] ", ROOM_VNUM_ALTAR, TRUE }, - { "rom", "[ ROM ] ", ROOM_VNUM_ALTAR, FALSE } -}; - -/* for position */ -const struct position_type position_table[] = -{ - { "dead", "dead" }, - { "mortally wounded", "mort" }, - { "incapacitated", "incap" }, - { "stunned", "stun" }, - { "sleeping", "sleep" }, - { "resting", "rest" }, - { "sitting", "sit" }, - { "fighting", "fight" }, - { "standing", "stand" }, - { NULL, NULL } -}; - -/* for sex */ -const struct sex_type sex_table[] = -{ - { "none" }, - { "male" }, - { "female" }, - { "either" }, - { NULL } -}; - -/* for sizes */ -const struct size_type size_table[] = -{ - { "tiny" }, - { "small" }, - { "medium" }, - { "large" }, - { "huge", }, - { "giant" }, - { NULL } -}; - -/* various flag tables */ -const struct flag_type act_flags[] = -{ - { "npc", A, FALSE }, - { "sentinel", B, TRUE }, - { "scavenger", C, TRUE }, - { "aggressive", F, TRUE }, - { "stay_area", G, TRUE }, - { "wimpy", H, TRUE }, - { "pet", I, TRUE }, - { "train", J, TRUE }, - { "practice", K, TRUE }, - { "undead", O, TRUE }, - { "cleric", Q, TRUE }, - { "mage", R, TRUE }, - { "thief", S, TRUE }, - { "warrior", T, TRUE }, - { "noalign", U, TRUE }, - { "nopurge", V, TRUE }, - { "outdoors", W, TRUE }, - { "indoors", Y, TRUE }, - { "healer", aa, TRUE }, - { "gain", bb, TRUE }, - { "update_always", cc, TRUE }, - { "changer", dd, TRUE }, - { NULL, 0, FALSE } -}; - -const struct flag_type plr_flags[] = -{ - { "npc", A, FALSE }, - { "autoassist", C, FALSE }, - { "autoexit", D, FALSE }, - { "autoloot", E, FALSE }, - { "autosac", F, FALSE }, - { "autogold", G, FALSE }, - { "autosplit", H, FALSE }, - { "holylight", N, FALSE }, - { "can_loot", P, FALSE }, - { "nosummon", Q, FALSE }, - { "nofollow", R, FALSE }, - { "permit", U, TRUE }, - { "log", W, FALSE }, - { "deny", X, FALSE }, - { "freeze", Y, FALSE }, - { "thief", Z, FALSE }, - { "killer", aa, FALSE }, - { NULL, 0, 0 } -}; - -const struct flag_type affect_flags[] = -{ - { "blind", A, TRUE }, - { "invisible", B, TRUE }, - { "detect_evil", C, TRUE }, - { "detect_invis", D, TRUE }, - { "detect_magic", E, TRUE }, - { "detect_hidden", F, TRUE }, - { "detect_good", G, TRUE }, - { "sanctuary", H, TRUE }, - { "faerie_fire", I, TRUE }, - { "infrared", J, TRUE }, - { "curse", K, TRUE }, - { "poison", M, TRUE }, - { "protect_evil", N, TRUE }, - { "protect_good", O, TRUE }, - { "sneak", P, TRUE }, - { "hide", Q, TRUE }, - { "sleep", R, TRUE }, - { "charm", S, TRUE }, - { "flying", T, TRUE }, - { "pass_door", U, TRUE }, - { "haste", V, TRUE }, - { "calm", W, TRUE }, - { "plague", X, TRUE }, - { "weaken", Y, TRUE }, - { "dark_vision", Z, TRUE }, - { "berserk", aa, TRUE }, - { "swim", bb, TRUE }, - { "regeneration", cc, TRUE }, - { "slow", dd, TRUE }, - { NULL, 0, 0 } -}; - -const struct flag_type off_flags[] = -{ - { "area_attack", A, TRUE }, - { "backstab", B, TRUE }, - { "bash", C, TRUE }, - { "berserk", D, TRUE }, - { "disarm", E, TRUE }, - { "dodge", F, TRUE }, - { "fade", G, TRUE }, - { "fast", H, TRUE }, - { "kick", I, TRUE }, - { "dirt_kick", J, TRUE }, - { "parry", K, TRUE }, - { "rescue", L, TRUE }, - { "tail", M, TRUE }, - { "trip", N, TRUE }, - { "crush", O, TRUE }, - { "assist_all", P, TRUE }, - { "assist_align", Q, TRUE }, - { "assist_race", R, TRUE }, - { "assist_players", S, TRUE }, - { "assist_guard", T, TRUE }, - { "assist_vnum", U, TRUE }, - { NULL, 0, 0 } -}; - -const struct flag_type imm_flags[] = -{ - { "summon", A, TRUE }, - { "charm", B, TRUE }, - { "magic", C, TRUE }, - { "weapon", D, TRUE }, - { "bash", E, TRUE }, - { "pierce", F, TRUE }, - { "slash", G, TRUE }, - { "fire", H, TRUE }, - { "cold", I, TRUE }, - { "lightning", J, TRUE }, - { "acid", K, TRUE }, - { "poison", L, TRUE }, - { "negative", M, TRUE }, - { "holy", N, TRUE }, - { "energy", O, TRUE }, - { "mental", P, TRUE }, - { "disease", Q, TRUE }, - { "drowning", R, TRUE }, - { "light", S, TRUE }, - { "sound", T, TRUE }, - { "wood", X, TRUE }, - { "silver", Y, TRUE }, - { "iron", Z, TRUE }, - { NULL, 0, 0 } -}; - -const struct flag_type form_flags[] = -{ - { "edible", FORM_EDIBLE, TRUE }, - { "poison", FORM_POISON, TRUE }, - { "magical", FORM_MAGICAL, TRUE }, - { "instant_decay", FORM_INSTANT_DECAY, TRUE }, - { "other", FORM_OTHER, TRUE }, - { "animal", FORM_ANIMAL, TRUE }, - { "sentient", FORM_SENTIENT, TRUE }, - { "undead", FORM_UNDEAD, TRUE }, - { "construct", FORM_CONSTRUCT, TRUE }, - { "mist", FORM_MIST, TRUE }, - { "intangible", FORM_INTANGIBLE, TRUE }, - { "biped", FORM_BIPED, TRUE }, - { "centaur", FORM_CENTAUR, TRUE }, - { "insect", FORM_INSECT, TRUE }, - { "spider", FORM_SPIDER, TRUE }, - { "crustacean", FORM_CRUSTACEAN, TRUE }, - { "worm", FORM_WORM, TRUE }, - { "blob", FORM_BLOB, TRUE }, - { "mammal", FORM_MAMMAL, TRUE }, - { "bird", FORM_BIRD, TRUE }, - { "reptile", FORM_REPTILE, TRUE }, - { "snake", FORM_SNAKE, TRUE }, - { "dragon", FORM_DRAGON, TRUE }, - { "amphibian", FORM_AMPHIBIAN, TRUE }, - { "fish", FORM_FISH , TRUE }, - { "cold_blood", FORM_COLD_BLOOD, TRUE }, - { NULL, 0, 0 } -}; - -const struct flag_type part_flags[] = -{ - { "head", PART_HEAD, TRUE }, - { "arms", PART_ARMS, TRUE }, - { "legs", PART_LEGS, TRUE }, - { "heart", PART_HEART, TRUE }, - { "brains", PART_BRAINS, TRUE }, - { "guts", PART_GUTS, TRUE }, - { "hands", PART_HANDS, TRUE }, - { "feet", PART_FEET, TRUE }, - { "fingers", PART_FINGERS, TRUE }, - { "ear", PART_EAR, TRUE }, - { "eye", PART_EYE, TRUE }, - { "long_tongue", PART_LONG_TONGUE, TRUE }, - { "eyestalks", PART_EYESTALKS, TRUE }, - { "tentacles", PART_TENTACLES, TRUE }, - { "fins", PART_FINS, TRUE }, - { "wings", PART_WINGS, TRUE }, - { "tail", PART_TAIL, TRUE }, - { "claws", PART_CLAWS, TRUE }, - { "fangs", PART_FANGS, TRUE }, - { "horns", PART_HORNS, TRUE }, - { "scales", PART_SCALES, TRUE }, - { "tusks", PART_TUSKS, TRUE }, - { NULL, 0, 0 } -}; - -const struct flag_type comm_flags[] = -{ - { "quiet", COMM_QUIET, TRUE }, - { "deaf", COMM_DEAF, TRUE }, - { "nowiz", COMM_NOWIZ, TRUE }, - { "noclangossip", COMM_NOAUCTION, TRUE }, - { "nogossip", COMM_NOGOSSIP, TRUE }, - { "noquestion", COMM_NOQUESTION, TRUE }, - { "nomusic", COMM_NOMUSIC, TRUE }, - { "noclan", COMM_NOCLAN, TRUE }, - { "noquote", COMM_NOQUOTE, TRUE }, - { "shoutsoff", COMM_SHOUTSOFF, TRUE }, - { "compact", COMM_COMPACT, TRUE }, - { "brief", COMM_BRIEF, TRUE }, - { "prompt", COMM_PROMPT, TRUE }, - { "combine", COMM_COMBINE, TRUE }, - { "telnet_ga", COMM_TELNET_GA, TRUE }, - { "show_affects", COMM_SHOW_AFFECTS, TRUE }, - { "nograts", COMM_NOGRATS, TRUE }, - { "noemote", COMM_NOEMOTE, FALSE }, - { "noshout", COMM_NOSHOUT, FALSE }, - { "notell", COMM_NOTELL, FALSE }, - { "nochannels", COMM_NOCHANNELS, FALSE }, - { "snoop_proof", COMM_SNOOP_PROOF, FALSE }, - { "afk", COMM_AFK, TRUE }, - { NULL, 0, 0 } -}; - - - - - - - - - - - - - - - diff --git a/Rom24/src/tables.h b/Rom24/src/tables.h deleted file mode 100644 index acddf6c..0000000 --- a/Rom24/src/tables.h +++ /dev/null @@ -1,81 +0,0 @@ -/*************************************************************************** - * 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-1998 Russ Taylor * -* ROM has been brought to you by the ROM consortium * -* Russ Taylor (rtaylor@efn.org) * -* Russ Taylor (rtaylor@hypercube.org) * -* Gabrielle Taylor (gtaylor@hypercube.org) * -* By using this code, you have agreed to follow the terms of the * -* ROM license, in the file Rom24/doc/rom.license * -***************************************************************************/ - -struct flag_type -{ - char *name; - int bit; - bool settable; -}; - -struct clan_type -{ - char *name; - char *who_name; - sh_int hall; - bool independent; /* true for loners */ -}; - -struct position_type -{ - char *name; - char *short_name; -}; - -struct sex_type -{ - char *name; -}; - -struct size_type -{ - char *name; -}; - -/* game tables */ -extern const struct clan_type clan_table[MAX_CLAN]; -extern const struct position_type position_table[]; -extern const struct sex_type sex_table[]; -extern const struct size_type size_table[]; - -/* flag tables */ -extern const struct flag_type act_flags[]; -extern const struct flag_type plr_flags[]; -extern const struct flag_type affect_flags[]; -extern const struct flag_type off_flags[]; -extern const struct flag_type imm_flags[]; -extern const struct flag_type form_flags[]; -extern const struct flag_type part_flags[]; -extern const struct flag_type comm_flags[]; -extern const struct flag_type extra_flags[]; -extern const struct flag_type wear_flags[]; -extern const struct flag_type weapon_flags[]; -extern const struct flag_type container_flags[]; -extern const struct flag_type portal_flags[]; -extern const struct flag_type room_flags[]; -extern const struct flag_type exit_flags[]; - diff --git a/Rom24/src/telnet.h b/Rom24/src/telnet.h deleted file mode 100644 index 94a7330..0000000 --- a/Rom24/src/telnet.h +++ /dev/null @@ -1,87 +0,0 @@ -/* @(#)telnet.h 1.7 88/08/19 SMI; from UCB 5.1 5/30/85 */ -/* - * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -/* - * Definitions for the TELNET protocol. - */ - -#ifndef _arpa_telnet_h -#define _arpa_telnet_h - -#define IAC 255 /* interpret as command: */ -#define DONT 254 /* you are not to use option */ -#define DO 253 /* please, you use option */ -#define WONT 252 /* I won't use option */ -#define WILL 251 /* I will use option */ -#define SB 250 /* interpret as subnegotiation */ -#define GA 249 /* you may reverse the line */ -#define EL 248 /* erase the current line */ -#define EC 247 /* erase the current character */ -#define AYT 246 /* are you there */ -#define AO 245 /* abort output--but let prog finish */ -#define IP 244 /* interrupt process--permanently */ -#define BREAK 243 /* break */ -#define DM 242 /* data mark--for connect. cleaning */ -#define NOP 241 /* nop */ -#define SE 240 /* end sub negotiation */ -#define EOR 239 /* end of record (transparent mode) */ - -#define SYNCH 242 /* for telfunc calls */ - -#ifdef TELCMDS -char *telcmds[] = { - "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", - "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", -}; -#endif - -/* telnet options */ -#define TELOPT_BINARY 0 /* 8-bit data path */ -#define TELOPT_ECHO 1 /* echo */ -#define TELOPT_RCP 2 /* prepare to reconnect */ -#define TELOPT_SGA 3 /* suppress go ahead */ -#define TELOPT_NAMS 4 /* approximate message size */ -#define TELOPT_STATUS 5 /* give status */ -#define TELOPT_TM 6 /* timing mark */ -#define TELOPT_RCTE 7 /* remote controlled transmission and echo */ -#define TELOPT_NAOL 8 /* negotiate about output line width */ -#define TELOPT_NAOP 9 /* negotiate about output page size */ -#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */ -#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */ -#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */ -#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */ -#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */ -#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */ -#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */ -#define TELOPT_XASCII 17 /* extended ascic character set */ -#define TELOPT_LOGOUT 18 /* force logout */ -#define TELOPT_BM 19 /* byte macro */ -#define TELOPT_DET 20 /* data entry terminal */ -#define TELOPT_SUPDUP 21 /* supdup protocol */ -#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */ -#define TELOPT_SNDLOC 23 /* send location */ -#define TELOPT_TTYPE 24 /* terminal type */ -#define TELOPT_EOR 25 /* end or record */ -#define TELOPT_EXOPL 255 /* extended-options-list */ - -#ifdef TELOPTS -#define NTELOPTS (1+TELOPT_EOR) -char *telopts[NTELOPTS] = { - "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", - "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP", - "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", - "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", - "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT", - "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", -}; -#endif - -/* sub-option qualifiers */ -#define TELQUAL_IS 0 /* option is... */ -#define TELQUAL_SEND 1 /* send option */ - -#endif /*!_arpa_telnet_h*/ diff --git a/Rom24/src/update.c b/Rom24/src/update.c deleted file mode 100644 index c17d348..0000000 --- a/Rom24/src/update.c +++ /dev/null @@ -1,1127 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#endif -#include -#include -#include -#include "merc.h" -#include "interp.h" -#include "music.h" - -/* - * Local functions. - */ -int hit_gain args( ( CHAR_DATA *ch ) ); -int mana_gain args( ( CHAR_DATA *ch ) ); -int move_gain args( ( CHAR_DATA *ch ) ); -void mobile_update args( ( void ) ); -void weather_update args( ( void ) ); -void char_update args( ( void ) ); -void obj_update args( ( void ) ); -void aggr_update args( ( void ) ); - -/* used for saving */ - -int save_number = 0; - - - -/* - * Advancement stuff. - */ -void advance_level( CHAR_DATA *ch, bool hide ) -{ - char buf[MAX_STRING_LENGTH]; - int add_hp; - int add_mana; - int add_move; - int add_prac; - - ch->pcdata->last_level = - ( ch->played + (int) (current_time - ch->logon) ) / 3600; - - sprintf( buf, "the %s", - title_table [ch->class] [ch->level] [ch->sex == SEX_FEMALE ? 1 : 0] ); - set_title( ch, buf ); - - add_hp = con_app[get_curr_stat(ch,STAT_CON)].hitp + number_range( - class_table[ch->class].hp_min, - class_table[ch->class].hp_max ); - add_mana = number_range(2,(2*get_curr_stat(ch,STAT_INT) - + get_curr_stat(ch,STAT_WIS))/5); - if (!class_table[ch->class].fMana) - add_mana /= 2; - add_move = number_range( 1, (get_curr_stat(ch,STAT_CON) - + get_curr_stat(ch,STAT_DEX))/6 ); - add_prac = wis_app[get_curr_stat(ch,STAT_WIS)].practice; - - add_hp = add_hp * 9/10; - add_mana = add_mana * 9/10; - add_move = add_move * 9/10; - - add_hp = UMAX( 2, add_hp ); - add_mana = UMAX( 2, add_mana ); - add_move = UMAX( 6, add_move ); - - ch->max_hit += add_hp; - ch->max_mana += add_mana; - ch->max_move += add_move; - ch->practice += add_prac; - ch->train += 1; - - ch->pcdata->perm_hit += add_hp; - ch->pcdata->perm_mana += add_mana; - ch->pcdata->perm_move += add_move; - - if (!hide) - { - sprintf(buf, - "You gain %d hit point%s, %d mana, %d move, and %d practice%s.\n\r", - add_hp, add_hp == 1 ? "" : "s", add_mana, add_move, - add_prac, add_prac == 1 ? "" : "s"); - send_to_char( buf, ch ); - } - return; -} - - - -void gain_exp( CHAR_DATA *ch, int gain ) -{ - char buf[MAX_STRING_LENGTH]; - - if ( IS_NPC(ch) || ch->level >= LEVEL_HERO ) - return; - - ch->exp = UMAX( exp_per_level(ch,ch->pcdata->points), ch->exp + gain ); - while ( ch->level < LEVEL_HERO && ch->exp >= - exp_per_level(ch,ch->pcdata->points) * (ch->level+1) ) - { - send_to_char( "You raise a level!! ", ch ); - ch->level += 1; - sprintf(buf,"%s gained level %d",ch->name,ch->level); - log_string(buf); - sprintf(buf,"$N has attained level %d!",ch->level); - wiznet(buf,ch,NULL,WIZ_LEVELS,0,0); - advance_level(ch,FALSE); - save_char_obj(ch); - } - - return; -} - - - -/* - * Regeneration stuff. - */ -int hit_gain( CHAR_DATA *ch ) -{ - int gain; - int number; - - if (ch->in_room == NULL) - return 0; - - if ( IS_NPC(ch) ) - { - gain = 5 + ch->level; - if (IS_AFFECTED(ch,AFF_REGENERATION)) - gain *= 2; - - switch(ch->position) - { - default : gain /= 2; break; - case POS_SLEEPING: gain = 3 * gain/2; break; - case POS_RESTING: break; - case POS_FIGHTING: gain /= 3; break; - } - - - } - else - { - gain = UMAX(3,get_curr_stat(ch,STAT_CON) - 3 + ch->level/2); - gain += class_table[ch->class].hp_max - 10; - number = number_percent(); - if (number < get_skill(ch,gsn_fast_healing)) - { - gain += number * gain / 100; - if (ch->hit < ch->max_hit) - check_improve(ch,gsn_fast_healing,TRUE,8); - } - - switch ( ch->position ) - { - default: gain /= 4; break; - case POS_SLEEPING: break; - case POS_RESTING: gain /= 2; break; - case POS_FIGHTING: gain /= 6; break; - } - - if ( ch->pcdata->condition[COND_HUNGER] == 0 ) - gain /= 2; - - if ( ch->pcdata->condition[COND_THIRST] == 0 ) - gain /= 2; - - } - - gain = gain * ch->in_room->heal_rate / 100; - - if (ch->on != NULL && ch->on->item_type == ITEM_FURNITURE) - gain = gain * ch->on->value[3] / 100; - - if ( IS_AFFECTED(ch, AFF_POISON) ) - gain /= 4; - - if (IS_AFFECTED(ch, AFF_PLAGUE)) - gain /= 8; - - if (IS_AFFECTED(ch,AFF_HASTE) || IS_AFFECTED(ch,AFF_SLOW)) - gain /=2 ; - - return UMIN(gain, ch->max_hit - ch->hit); -} - - - -int mana_gain( CHAR_DATA *ch ) -{ - int gain; - int number; - - if (ch->in_room == NULL) - return 0; - - if ( IS_NPC(ch) ) - { - gain = 5 + ch->level; - switch (ch->position) - { - default: gain /= 2; break; - case POS_SLEEPING: gain = 3 * gain/2; break; - case POS_RESTING: break; - case POS_FIGHTING: gain /= 3; break; - } - } - else - { - gain = (get_curr_stat(ch,STAT_WIS) - + get_curr_stat(ch,STAT_INT) + ch->level) / 2; - number = number_percent(); - if (number < get_skill(ch,gsn_meditation)) - { - gain += number * gain / 100; - if (ch->mana < ch->max_mana) - check_improve(ch,gsn_meditation,TRUE,8); - } - if (!class_table[ch->class].fMana) - gain /= 2; - - switch ( ch->position ) - { - default: gain /= 4; break; - case POS_SLEEPING: break; - case POS_RESTING: gain /= 2; break; - case POS_FIGHTING: gain /= 6; break; - } - - if ( ch->pcdata->condition[COND_HUNGER] == 0 ) - gain /= 2; - - if ( ch->pcdata->condition[COND_THIRST] == 0 ) - gain /= 2; - - } - - gain = gain * ch->in_room->mana_rate / 100; - - if (ch->on != NULL && ch->on->item_type == ITEM_FURNITURE) - gain = gain * ch->on->value[4] / 100; - - if ( IS_AFFECTED( ch, AFF_POISON ) ) - gain /= 4; - - if (IS_AFFECTED(ch, AFF_PLAGUE)) - gain /= 8; - - if (IS_AFFECTED(ch,AFF_HASTE) || IS_AFFECTED(ch,AFF_SLOW)) - gain /=2 ; - - return UMIN(gain, ch->max_mana - ch->mana); -} - - - -int move_gain( CHAR_DATA *ch ) -{ - int gain; - - if (ch->in_room == NULL) - return 0; - - if ( IS_NPC(ch) ) - { - gain = ch->level; - } - else - { - gain = UMAX( 15, ch->level ); - - switch ( ch->position ) - { - case POS_SLEEPING: gain += get_curr_stat(ch,STAT_DEX); break; - case POS_RESTING: gain += get_curr_stat(ch,STAT_DEX) / 2; break; - } - - if ( ch->pcdata->condition[COND_HUNGER] == 0 ) - gain /= 2; - - if ( ch->pcdata->condition[COND_THIRST] == 0 ) - gain /= 2; - } - - gain = gain * ch->in_room->heal_rate/100; - - if (ch->on != NULL && ch->on->item_type == ITEM_FURNITURE) - gain = gain * ch->on->value[3] / 100; - - if ( IS_AFFECTED(ch, AFF_POISON) ) - gain /= 4; - - if (IS_AFFECTED(ch, AFF_PLAGUE)) - gain /= 8; - - if (IS_AFFECTED(ch,AFF_HASTE) || IS_AFFECTED(ch,AFF_SLOW)) - gain /=2 ; - - return UMIN(gain, ch->max_move - ch->move); -} - - - -void gain_condition( CHAR_DATA *ch, int iCond, int value ) -{ - int condition; - - if ( value == 0 || IS_NPC(ch) || ch->level >= LEVEL_IMMORTAL) - return; - - condition = ch->pcdata->condition[iCond]; - if (condition == -1) - return; - ch->pcdata->condition[iCond] = URANGE( 0, condition + value, 48 ); - - if ( ch->pcdata->condition[iCond] == 0 ) - { - switch ( iCond ) - { - case COND_HUNGER: - send_to_char( "You are hungry.\n\r", ch ); - break; - - case COND_THIRST: - send_to_char( "You are thirsty.\n\r", ch ); - break; - - case COND_DRUNK: - if ( condition != 0 ) - send_to_char( "You are sober.\n\r", ch ); - break; - } - } - - return; -} - - - -/* - * Mob autonomous action. - * This function takes 25% to 35% of ALL Merc cpu time. - * -- Furey - */ -void mobile_update( void ) -{ - CHAR_DATA *ch; - CHAR_DATA *ch_next; - EXIT_DATA *pexit; - int door; - - /* Examine all mobs. */ - for ( ch = char_list; ch != NULL; ch = ch_next ) - { - ch_next = ch->next; - - if ( !IS_NPC(ch) || ch->in_room == NULL || IS_AFFECTED(ch,AFF_CHARM)) - continue; - - if (ch->in_room->area->empty && !IS_SET(ch->act,ACT_UPDATE_ALWAYS)) - continue; - - /* Examine call for special procedure */ - if ( ch->spec_fun != 0 ) - { - if ( (*ch->spec_fun) ( ch ) ) - continue; - } - - if (ch->pIndexData->pShop != NULL) /* give him some gold */ - if ((ch->gold * 100 + ch->silver) < ch->pIndexData->wealth) - { - ch->gold += ch->pIndexData->wealth * number_range(1,20)/5000000; - ch->silver += ch->pIndexData->wealth * number_range(1,20)/50000; - } - - - /* That's all for sleeping / busy monster, and empty zones */ - if ( ch->position != POS_STANDING ) - continue; - - /* Scavenge */ - if ( IS_SET(ch->act, ACT_SCAVENGER) - && ch->in_room->contents != NULL - && number_bits( 6 ) == 0 ) - { - OBJ_DATA *obj; - OBJ_DATA *obj_best; - int max; - - max = 1; - obj_best = 0; - for ( obj = ch->in_room->contents; obj; obj = obj->next_content ) - { - if ( CAN_WEAR(obj, ITEM_TAKE) && can_loot(ch, obj) - && obj->cost > max && obj->cost > 0) - { - obj_best = obj; - max = obj->cost; - } - } - - if ( obj_best ) - { - obj_from_room( obj_best ); - obj_to_char( obj_best, ch ); - act( "$n gets $p.", ch, obj_best, NULL, TO_ROOM ); - } - } - - /* Wander */ - if ( !IS_SET(ch->act, ACT_SENTINEL) - && number_bits(3) == 0 - && ( door = number_bits( 5 ) ) <= 5 - && ( pexit = ch->in_room->exit[door] ) != NULL - && pexit->u1.to_room != NULL - && !IS_SET(pexit->exit_info, EX_CLOSED) - && !IS_SET(pexit->u1.to_room->room_flags, ROOM_NO_MOB) - && ( !IS_SET(ch->act, ACT_STAY_AREA) - || pexit->u1.to_room->area == ch->in_room->area ) - && ( !IS_SET(ch->act, ACT_OUTDOORS) - || !IS_SET(pexit->u1.to_room->room_flags,ROOM_INDOORS)) - && ( !IS_SET(ch->act, ACT_INDOORS) - || IS_SET(pexit->u1.to_room->room_flags,ROOM_INDOORS))) - { - move_char( ch, door, FALSE ); - } - } - - return; -} - - - -/* - * Update the weather. - */ -void weather_update( void ) -{ - char buf[MAX_STRING_LENGTH]; - DESCRIPTOR_DATA *d; - int diff; - - buf[0] = '\0'; - - switch ( ++time_info.hour ) - { - case 5: - weather_info.sunlight = SUN_LIGHT; - strcat( buf, "The day has begun.\n\r" ); - break; - - case 6: - weather_info.sunlight = SUN_RISE; - strcat( buf, "The sun rises in the east.\n\r" ); - break; - - case 19: - weather_info.sunlight = SUN_SET; - strcat( buf, "The sun slowly disappears in the west.\n\r" ); - break; - - case 20: - weather_info.sunlight = SUN_DARK; - strcat( buf, "The night has begun.\n\r" ); - break; - - case 24: - time_info.hour = 0; - time_info.day++; - break; - } - - if ( time_info.day >= 35 ) - { - time_info.day = 0; - time_info.month++; - } - - if ( time_info.month >= 17 ) - { - time_info.month = 0; - time_info.year++; - } - - /* - * Weather change. - */ - if ( time_info.month >= 9 && time_info.month <= 16 ) - diff = weather_info.mmhg > 985 ? -2 : 2; - else - diff = weather_info.mmhg > 1015 ? -2 : 2; - - weather_info.change += diff * dice(1, 4) + dice(2, 6) - dice(2, 6); - weather_info.change = UMAX(weather_info.change, -12); - weather_info.change = UMIN(weather_info.change, 12); - - weather_info.mmhg += weather_info.change; - weather_info.mmhg = UMAX(weather_info.mmhg, 960); - weather_info.mmhg = UMIN(weather_info.mmhg, 1040); - - switch ( weather_info.sky ) - { - default: - bug( "Weather_update: bad sky %d.", weather_info.sky ); - weather_info.sky = SKY_CLOUDLESS; - break; - - case SKY_CLOUDLESS: - if ( weather_info.mmhg < 990 - || ( weather_info.mmhg < 1010 && number_bits( 2 ) == 0 ) ) - { - strcat( buf, "The sky is getting cloudy.\n\r" ); - weather_info.sky = SKY_CLOUDY; - } - break; - - case SKY_CLOUDY: - if ( weather_info.mmhg < 970 - || ( weather_info.mmhg < 990 && number_bits( 2 ) == 0 ) ) - { - strcat( buf, "It starts to rain.\n\r" ); - weather_info.sky = SKY_RAINING; - } - - if ( weather_info.mmhg > 1030 && number_bits( 2 ) == 0 ) - { - strcat( buf, "The clouds disappear.\n\r" ); - weather_info.sky = SKY_CLOUDLESS; - } - break; - - case SKY_RAINING: - if ( weather_info.mmhg < 970 && number_bits( 2 ) == 0 ) - { - strcat( buf, "Lightning flashes in the sky.\n\r" ); - weather_info.sky = SKY_LIGHTNING; - } - - if ( weather_info.mmhg > 1030 - || ( weather_info.mmhg > 1010 && number_bits( 2 ) == 0 ) ) - { - strcat( buf, "The rain stopped.\n\r" ); - weather_info.sky = SKY_CLOUDY; - } - break; - - case SKY_LIGHTNING: - if ( weather_info.mmhg > 1010 - || ( weather_info.mmhg > 990 && number_bits( 2 ) == 0 ) ) - { - strcat( buf, "The lightning has stopped.\n\r" ); - weather_info.sky = SKY_RAINING; - break; - } - break; - } - - if ( buf[0] != '\0' ) - { - for ( d = descriptor_list; d != NULL; d = d->next ) - { - if ( d->connected == CON_PLAYING - && IS_OUTSIDE(d->character) - && IS_AWAKE(d->character) ) - send_to_char( buf, d->character ); - } - } - - return; -} - - - -/* - * Update all chars, including mobs. -*/ -void char_update( void ) -{ - CHAR_DATA *ch; - CHAR_DATA *ch_next; - CHAR_DATA *ch_quit; - - ch_quit = NULL; - - /* update save counter */ - save_number++; - - if (save_number > 29) - save_number = 0; - - for ( ch = char_list; ch != NULL; ch = ch_next ) - { - AFFECT_DATA *paf; - AFFECT_DATA *paf_next; - - ch_next = ch->next; - - if ( ch->timer > 30 ) - ch_quit = ch; - - if ( ch->position >= POS_STUNNED ) - { - /* check to see if we need to go home */ - if (IS_NPC(ch) && ch->zone != NULL && ch->zone != ch->in_room->area - && ch->desc == NULL && ch->fighting == NULL - && !IS_AFFECTED(ch,AFF_CHARM) && number_percent() < 5) - { - act("$n wanders on home.",ch,NULL,NULL,TO_ROOM); - extract_char(ch,TRUE); - continue; - } - - if ( ch->hit < ch->max_hit ) - ch->hit += hit_gain(ch); - else - ch->hit = ch->max_hit; - - if ( ch->mana < ch->max_mana ) - ch->mana += mana_gain(ch); - else - ch->mana = ch->max_mana; - - if ( ch->move < ch->max_move ) - ch->move += move_gain(ch); - else - ch->move = ch->max_move; - } - - if ( ch->position == POS_STUNNED ) - update_pos( ch ); - - if ( !IS_NPC(ch) && ch->level < LEVEL_IMMORTAL ) - { - OBJ_DATA *obj; - - if ( ( obj = get_eq_char( ch, WEAR_LIGHT ) ) != NULL - && obj->item_type == ITEM_LIGHT - && obj->value[2] > 0 ) - { - if ( --obj->value[2] == 0 && ch->in_room != NULL ) - { - --ch->in_room->light; - act( "$p goes out.", ch, obj, NULL, TO_ROOM ); - act( "$p flickers and goes out.", ch, obj, NULL, TO_CHAR ); - extract_obj( obj ); - } - else if ( obj->value[2] <= 5 && ch->in_room != NULL) - act("$p flickers.",ch,obj,NULL,TO_CHAR); - } - - if (IS_IMMORTAL(ch)) - ch->timer = 0; - - if ( ++ch->timer >= 12 ) - { - if ( ch->was_in_room == NULL && ch->in_room != NULL ) - { - ch->was_in_room = ch->in_room; - if ( ch->fighting != NULL ) - stop_fighting( ch, TRUE ); - act( "$n disappears into the void.", - ch, NULL, NULL, TO_ROOM ); - send_to_char( "You disappear into the void.\n\r", ch ); - if (ch->level > 1) - save_char_obj( ch ); - char_from_room( ch ); - char_to_room( ch, get_room_index( ROOM_VNUM_LIMBO ) ); - } - } - - gain_condition( ch, COND_DRUNK, -1 ); - gain_condition( ch, COND_FULL, ch->size > SIZE_MEDIUM ? -4 : -2 ); - gain_condition( ch, COND_THIRST, -1 ); - gain_condition( ch, COND_HUNGER, ch->size > SIZE_MEDIUM ? -2 : -1); - } - - for ( paf = ch->affected; paf != NULL; paf = paf_next ) - { - paf_next = paf->next; - if ( paf->duration > 0 ) - { - paf->duration--; - if (number_range(0,4) == 0 && paf->level > 0) - paf->level--; /* spell strength fades with time */ - } - else if ( paf->duration < 0 ) - ; - else - { - if ( paf_next == NULL - || paf_next->type != paf->type - || paf_next->duration > 0 ) - { - if ( paf->type > 0 && skill_table[paf->type].msg_off ) - { - send_to_char( skill_table[paf->type].msg_off, ch ); - send_to_char( "\n\r", ch ); - } - } - - affect_remove( ch, paf ); - } - } - - /* - * Careful with the damages here, - * MUST NOT refer to ch after damage taken, - * as it may be lethal damage (on NPC). - */ - - if (is_affected(ch, gsn_plague) && ch != NULL) - { - AFFECT_DATA *af, plague; - CHAR_DATA *vch; - int dam; - - if (ch->in_room == NULL) - continue; - - act("$n writhes in agony as plague sores erupt from $s skin.", - ch,NULL,NULL,TO_ROOM); - send_to_char("You writhe in agony from the plague.\n\r",ch); - for ( af = ch->affected; af != NULL; af = af->next ) - { - if (af->type == gsn_plague) - break; - } - - if (af == NULL) - { - REMOVE_BIT(ch->affected_by,AFF_PLAGUE); - continue; - } - - if (af->level == 1) - continue; - - plague.where = TO_AFFECTS; - plague.type = gsn_plague; - plague.level = af->level - 1; - plague.duration = number_range(1,2 * plague.level); - plague.location = APPLY_STR; - plague.modifier = -5; - plague.bitvector = AFF_PLAGUE; - - for ( vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room) - { - if (!saves_spell(plague.level - 2,vch,DAM_DISEASE) - && !IS_IMMORTAL(vch) - && !IS_AFFECTED(vch,AFF_PLAGUE) && number_bits(4) == 0) - { - send_to_char("You feel hot and feverish.\n\r",vch); - act("$n shivers and looks very ill.",vch,NULL,NULL,TO_ROOM); - affect_join(vch,&plague); - } - } - - dam = UMIN(ch->level,af->level/5+1); - ch->mana -= dam; - ch->move -= dam; - damage( ch, ch, dam, gsn_plague,DAM_DISEASE,FALSE); - } - else if ( IS_AFFECTED(ch, AFF_POISON) && ch != NULL - && !IS_AFFECTED(ch,AFF_SLOW)) - - { - AFFECT_DATA *poison; - - poison = affect_find(ch->affected,gsn_poison); - - if (poison != NULL) - { - act( "$n shivers and suffers.", ch, NULL, NULL, TO_ROOM ); - send_to_char( "You shiver and suffer.\n\r", ch ); - damage(ch,ch,poison->level/10 + 1,gsn_poison, - DAM_POISON,FALSE); - } - } - - else if ( ch->position == POS_INCAP && number_range(0,1) == 0) - { - damage( ch, ch, 1, TYPE_UNDEFINED, DAM_NONE,FALSE); - } - else if ( ch->position == POS_MORTAL ) - { - damage( ch, ch, 1, TYPE_UNDEFINED, DAM_NONE,FALSE); - } - } - - /* - * Autosave and autoquit. - * Check that these chars still exist. - */ - for ( ch = char_list; ch != NULL; ch = ch_next ) - { - ch_next = ch->next; - - if (ch->desc != NULL && ch->desc->descriptor % 30 == save_number) - { - save_char_obj(ch); - } - - if (ch == ch_quit) - { - do_function(ch, &do_quit, "" ); - } - } - - return; -} - - - - -/* - * Update all objs. - * This function is performance sensitive. - */ -void obj_update( void ) -{ - OBJ_DATA *obj; - OBJ_DATA *obj_next; - AFFECT_DATA *paf, *paf_next; - - for ( obj = object_list; obj != NULL; obj = obj_next ) - { - CHAR_DATA *rch; - char *message; - - obj_next = obj->next; - - /* go through affects and decrement */ - for ( paf = obj->affected; paf != NULL; paf = paf_next ) - { - paf_next = paf->next; - if ( paf->duration > 0 ) - { - paf->duration--; - if (number_range(0,4) == 0 && paf->level > 0) - paf->level--; /* spell strength fades with time */ - } - else if ( paf->duration < 0 ) - ; - else - { - if ( paf_next == NULL - || paf_next->type != paf->type - || paf_next->duration > 0 ) - { - if ( paf->type > 0 && skill_table[paf->type].msg_obj ) - { - if (obj->carried_by != NULL) - { - rch = obj->carried_by; - act(skill_table[paf->type].msg_obj, - rch,obj,NULL,TO_CHAR); - } - if (obj->in_room != NULL - && obj->in_room->people != NULL) - { - rch = obj->in_room->people; - act(skill_table[paf->type].msg_obj, - rch,obj,NULL,TO_ALL); - } - } - } - - affect_remove_obj( obj, paf ); - } - } - - - if ( obj->timer <= 0 || --obj->timer > 0 ) - continue; - - switch ( obj->item_type ) - { - default: message = "$p crumbles into dust."; break; - case ITEM_FOUNTAIN: message = "$p dries up."; break; - case ITEM_CORPSE_NPC: message = "$p decays into dust."; break; - case ITEM_CORPSE_PC: message = "$p decays into dust."; break; - case ITEM_FOOD: message = "$p decomposes."; break; - case ITEM_POTION: message = "$p has evaporated from disuse."; - break; - case ITEM_PORTAL: message = "$p fades out of existence."; break; - case ITEM_CONTAINER: - if (CAN_WEAR(obj,ITEM_WEAR_FLOAT)) - if (obj->contains) - message = - "$p flickers and vanishes, spilling its contents on the floor."; - else - message = "$p flickers and vanishes."; - else - message = "$p crumbles into dust."; - break; - } - - if ( obj->carried_by != NULL ) - { - if (IS_NPC(obj->carried_by) - && obj->carried_by->pIndexData->pShop != NULL) - obj->carried_by->silver += obj->cost/5; - else - { - act( message, obj->carried_by, obj, NULL, TO_CHAR ); - if ( obj->wear_loc == WEAR_FLOAT) - act(message,obj->carried_by,obj,NULL,TO_ROOM); - } - } - else if ( obj->in_room != NULL - && ( rch = obj->in_room->people ) != NULL ) - { - if (! (obj->in_obj && obj->in_obj->pIndexData->vnum == OBJ_VNUM_PIT - && !CAN_WEAR(obj->in_obj,ITEM_TAKE))) - { - act( message, rch, obj, NULL, TO_ROOM ); - act( message, rch, obj, NULL, TO_CHAR ); - } - } - - if ((obj->item_type == ITEM_CORPSE_PC || obj->wear_loc == WEAR_FLOAT) - && obj->contains) - { /* save the contents */ - OBJ_DATA *t_obj, *next_obj; - - for (t_obj = obj->contains; t_obj != NULL; t_obj = next_obj) - { - next_obj = t_obj->next_content; - obj_from_obj(t_obj); - - if (obj->in_obj) /* in another object */ - obj_to_obj(t_obj,obj->in_obj); - - else if (obj->carried_by) /* carried */ - if (obj->wear_loc == WEAR_FLOAT) - if (obj->carried_by->in_room == NULL) - extract_obj(t_obj); - else - obj_to_room(t_obj,obj->carried_by->in_room); - else - obj_to_char(t_obj,obj->carried_by); - - else if (obj->in_room == NULL) /* destroy it */ - extract_obj(t_obj); - - else /* to a room */ - obj_to_room(t_obj,obj->in_room); - } - } - - extract_obj( obj ); - } - - return; -} - - - -/* - * Aggress. - * - * for each mortal PC - * for each mob in room - * aggress on some random PC - * - * This function takes 25% to 35% of ALL Merc cpu time. - * Unfortunately, checking on each PC move is too tricky, - * because we don't the mob to just attack the first PC - * who leads the party into the room. - * - * -- Furey - */ -void aggr_update( void ) -{ - CHAR_DATA *wch; - CHAR_DATA *wch_next; - CHAR_DATA *ch; - CHAR_DATA *ch_next; - CHAR_DATA *vch; - CHAR_DATA *vch_next; - CHAR_DATA *victim; - - for ( wch = char_list; wch != NULL; wch = wch_next ) - { - wch_next = wch->next; - if ( IS_NPC(wch) - || wch->level >= LEVEL_IMMORTAL - || wch->in_room == NULL - || wch->in_room->area->empty) - continue; - - for ( ch = wch->in_room->people; ch != NULL; ch = ch_next ) - { - int count; - - ch_next = ch->next_in_room; - - if ( !IS_NPC(ch) - || !IS_SET(ch->act, ACT_AGGRESSIVE) - || IS_SET(ch->in_room->room_flags,ROOM_SAFE) - || IS_AFFECTED(ch,AFF_CALM) - || ch->fighting != NULL - || IS_AFFECTED(ch, AFF_CHARM) - || !IS_AWAKE(ch) - || ( IS_SET(ch->act, ACT_WIMPY) && IS_AWAKE(wch) ) - || !can_see( ch, wch ) - || number_bits(1) == 0) - continue; - - /* - * Ok we have a 'wch' player character and a 'ch' npc aggressor. - * Now make the aggressor fight a RANDOM pc victim in the room, - * giving each 'vch' an equal chance of selection. - */ - count = 0; - victim = NULL; - for ( vch = wch->in_room->people; vch != NULL; vch = vch_next ) - { - vch_next = vch->next_in_room; - - if ( !IS_NPC(vch) - && vch->level < LEVEL_IMMORTAL - && ch->level >= vch->level - 5 - && ( !IS_SET(ch->act, ACT_WIMPY) || !IS_AWAKE(vch) ) - && can_see( ch, vch ) ) - { - if ( number_range( 0, count ) == 0 ) - victim = vch; - count++; - } - } - - if ( victim == NULL ) - continue; - - multi_hit( ch, victim, TYPE_UNDEFINED ); - } - } - - return; -} - - - -/* - * Handle all kinds of updates. - * Called once per pulse from game loop. - * Random times to defeat tick-timing clients and players. - */ - -void update_handler( void ) -{ - static int pulse_area; - static int pulse_mobile; - static int pulse_violence; - static int pulse_point; - static int pulse_music; - - if ( --pulse_area <= 0 ) - { - pulse_area = PULSE_AREA; - /* number_range( PULSE_AREA / 2, 3 * PULSE_AREA / 2 ); */ - area_update ( ); - } - - if ( --pulse_music <= 0 ) - { - pulse_music = PULSE_MUSIC; - song_update(); - } - - if ( --pulse_mobile <= 0 ) - { - pulse_mobile = PULSE_MOBILE; - mobile_update ( ); - } - - if ( --pulse_violence <= 0 ) - { - pulse_violence = PULSE_VIOLENCE; - violence_update ( ); - } - - if ( --pulse_point <= 0 ) - { - wiznet("TICK!",NULL,NULL,WIZ_TICKS,0,0); - pulse_point = PULSE_TICK; -/* number_range( PULSE_TICK / 2, 3 * PULSE_TICK / 2 ); */ - weather_update ( ); - char_update ( ); - obj_update ( ); - } - - aggr_update( ); - tail_chain( ); - return; -} From 16aca383ea6287e46e35cc1598a6469f80f8e265 Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Wed, 2 Sep 2020 22:40:42 -0600 Subject: [PATCH 03/40] Fixes for gitignore and nanny --- .gitignore | 4 +++- Rom24/pysrc/nanny.py | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index ffe41e4..801ad13 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,6 @@ __pycache__/ *.sln *.suo .idea/ -venv/ \ No newline at end of file +venv/ +data/ +instance_tracker.txt \ No newline at end of file diff --git a/Rom24/pysrc/nanny.py b/Rom24/pysrc/nanny.py index e5d26ea..4ece865 100644 --- a/Rom24/pysrc/nanny.py +++ b/Rom24/pysrc/nanny.py @@ -80,17 +80,17 @@ def check_parse_name(name): bad_names = ['All', 'Auto', 'Immortal', 'Self', 'Someone', 'Something', 'The', 'You', 'Loner', 'Alander'] if name in bad_names: return False - + if len(name) < 2: return False if len(name) > 12: return False - + if not name.isalpha(): return False checked = [licheck(c) for c in name] - + if True not in checked: return False return True @@ -181,7 +181,7 @@ def con_get_new_password(self): pwdnew = argument ch_dummy.pwd = pwdnew - + ch_dummy.send("Please retype password: ") ch_dummy.desc.password_mode_on() self.set_connected(con_confirm_new_password) @@ -210,7 +210,7 @@ def con_confirm_new_password(self): ch.send("The following races are available:\n ") for race in const.pc_race_table: ch.send("%s " % const.race_table[race].name) - + ch.send("\nWhat is your race (help for more information)? ") self.set_connected(con_get_new_race) @@ -237,7 +237,7 @@ def con_get_new_race(self): ch.send("%s " % const.race_table[race].name) ch.send("\nWhat is your race? (help for more information) ") return - + ch.race = const.race_table[race.name] ch_selections['race'] = race.name #initialize stats */ @@ -261,7 +261,7 @@ def con_get_new_race(self): ch.send("What is your sex (M/F)? ") self.set_connected(con_get_new_sex) return - + def con_get_new_sex(self): argument = self.get_command()[:1].lower() @@ -351,7 +351,7 @@ def con_default_choice(self): elif argument == 'n': ch.group_add(ch.guild.default_group, True) ch.send("Please pick a weapon from the following choices:\n") - + for k, weapon in const.weapon_table.items(): if weapon.gsn in ch.learned: ch.send("%s " % weapon.name) @@ -402,7 +402,7 @@ def con_gen_groups(self): del ch.gen_data ch.gen_data = None ch.send("Please pick a weapon from the following choices:\n") - + for w, weapon in const.weapon_table.items(): if weapon.gsn in ch.learned and ch.learned[weapon.gsn] > 0: ch.send("%s " % weapon.name) @@ -541,7 +541,7 @@ def con_read_imotd(self): ch = self.character ch.do_help("motd") self.set_connected(con_read_motd) - + def con_read_motd(self): ch = self.character @@ -575,7 +575,7 @@ def con_read_motd(self): ch.do_help("newbie info") #TODO: create a player manifest that we can use/check, instead of needing to walk the dir. - player_files = list(sys_utils.flatten([x[2] for x in os.walk(settings.PLAYER_DIR)])) + player_files = os.listdir(settings.PLAYER_DIR) if len(player_files) < 1: for iLevel in range(ch.level, merc.MAX_LEVEL): ch.level += 1 From 3ee29b46c3a971824df1af3ed13b1a1e59e9089e Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Wed, 2 Sep 2020 23:00:58 -0600 Subject: [PATCH 04/40] Revert "Removing source C stuff" This reverts commit 8d5a8a629b4573d343efc125c824619e803c087f. --- Rom24/src/Makefile | 22 + Rom24/src/Makefile.linux | 19 + Rom24/src/Makefile.normal | 18 + Rom24/src/Makefile.solaris | 19 + Rom24/src/act_comm.c | 1999 +++++++++++++++ Rom24/src/act_enter.c | 214 ++ Rom24/src/act_info.c | 2755 +++++++++++++++++++++ Rom24/src/act_move.c | 1640 +++++++++++++ Rom24/src/act_obj.c | 2989 +++++++++++++++++++++++ Rom24/src/act_wiz.c | 4378 +++++++++++++++++++++++++++++++++ Rom24/src/alias.c | 273 +++ Rom24/src/ban.c | 309 +++ Rom24/src/comm.c | 2572 ++++++++++++++++++++ Rom24/src/const.c | 2125 ++++++++++++++++ Rom24/src/db.c | 3372 ++++++++++++++++++++++++++ Rom24/src/db.h | 52 + Rom24/src/db2.c | 493 ++++ Rom24/src/effects.c | 621 +++++ Rom24/src/fight.c | 3095 ++++++++++++++++++++++++ Rom24/src/flags.c | 249 ++ Rom24/src/handler.c | 2912 ++++++++++++++++++++++ Rom24/src/healer.c | 196 ++ Rom24/src/interp.c | 796 ++++++ Rom24/src/interp.h | 298 +++ Rom24/src/lookup.c | 106 + Rom24/src/lookup.h | 32 + Rom24/src/magic.c | 4699 ++++++++++++++++++++++++++++++++++++ Rom24/src/magic.h | 130 + Rom24/src/magic2.c | 174 ++ Rom24/src/merc.h | 2322 ++++++++++++++++++ Rom24/src/music.c | 350 +++ Rom24/src/music.h | 43 + Rom24/src/note.c | 960 ++++++++ Rom24/src/recycle.c | 652 +++++ Rom24/src/recycle.h | 112 + Rom24/src/save.c | 1665 +++++++++++++ Rom24/src/scan.c | 127 + Rom24/src/skills.c | 1069 ++++++++ Rom24/src/special.c | 1042 ++++++++ Rom24/src/tables.c | 322 +++ Rom24/src/tables.h | 81 + Rom24/src/telnet.h | 87 + Rom24/src/update.c | 1127 +++++++++ 43 files changed, 46516 insertions(+) create mode 100644 Rom24/src/Makefile create mode 100644 Rom24/src/Makefile.linux create mode 100644 Rom24/src/Makefile.normal create mode 100644 Rom24/src/Makefile.solaris create mode 100644 Rom24/src/act_comm.c create mode 100644 Rom24/src/act_enter.c create mode 100644 Rom24/src/act_info.c create mode 100644 Rom24/src/act_move.c create mode 100644 Rom24/src/act_obj.c create mode 100644 Rom24/src/act_wiz.c create mode 100644 Rom24/src/alias.c create mode 100644 Rom24/src/ban.c create mode 100644 Rom24/src/comm.c create mode 100644 Rom24/src/const.c create mode 100644 Rom24/src/db.c create mode 100644 Rom24/src/db.h create mode 100644 Rom24/src/db2.c create mode 100644 Rom24/src/effects.c create mode 100644 Rom24/src/fight.c create mode 100644 Rom24/src/flags.c create mode 100644 Rom24/src/handler.c create mode 100644 Rom24/src/healer.c create mode 100644 Rom24/src/interp.c create mode 100644 Rom24/src/interp.h create mode 100644 Rom24/src/lookup.c create mode 100644 Rom24/src/lookup.h create mode 100644 Rom24/src/magic.c create mode 100644 Rom24/src/magic.h create mode 100644 Rom24/src/magic2.c create mode 100644 Rom24/src/merc.h create mode 100644 Rom24/src/music.c create mode 100644 Rom24/src/music.h create mode 100644 Rom24/src/note.c create mode 100644 Rom24/src/recycle.c create mode 100644 Rom24/src/recycle.h create mode 100644 Rom24/src/save.c create mode 100644 Rom24/src/scan.c create mode 100644 Rom24/src/skills.c create mode 100644 Rom24/src/special.c create mode 100644 Rom24/src/tables.c create mode 100644 Rom24/src/tables.h create mode 100644 Rom24/src/telnet.h create mode 100644 Rom24/src/update.c diff --git a/Rom24/src/Makefile b/Rom24/src/Makefile new file mode 100644 index 0000000..8728499 --- /dev/null +++ b/Rom24/src/Makefile @@ -0,0 +1,22 @@ +CC = gcc +PROF = -O -g +NOCRYPT = +C_FLAGS = -Wall $(PROF) $(NOCRYPT) +L_FLAGS = $(PROF) + +O_FILES = act_comm.o act_enter.o act_info.o act_move.o act_obj.o act_wiz.o \ + alias.o ban.o comm.o const.o db.o db2.o effects.o fight.o flags.o \ + handler.o healer.o interp.o note.o lookup.o magic.o magic2.o \ + music.o recycle.o save.o scan.o skills.o special.o tables.o \ + update.o -lcrypt + +rom: $(O_FILES) + rm -f rom + $(CC) $(L_FLAGS) -o rom $(O_FILES) + +.c.o: merc.h + $(CC) -c $(C_FLAGS) $< + +clean: + @rm -f *.o + make diff --git a/Rom24/src/Makefile.linux b/Rom24/src/Makefile.linux new file mode 100644 index 0000000..cf44f87 --- /dev/null +++ b/Rom24/src/Makefile.linux @@ -0,0 +1,19 @@ +CC = gcc +PROF = -O -g +NOCRYPT = +C_FLAGS = -Wall $(PROF) $(NOCRYPT) +L_FLAGS = $(PROF) +LIBS = -lcrypt + +O_FILES = act_comm.o act_enter.o act_info.o act_move.o act_obj.o act_wiz.o \ + alias.o ban.o comm.o const.o db.o db2.o effects.o fight.o flags.o \ + handler.o healer.o interp.o note.o lookup.o magic.o magic2.o \ + music.o recycle.o save.o scan.o skills.o special.o tables.o \ + update.o + +rom: $(O_FILES) + rm -f rom + $(CC) $(L_FLAGS) -o rom $(O_FILES) $(LIBS) + +.c.o: merc.h + $(CC) -c $(C_FLAGS) $< diff --git a/Rom24/src/Makefile.normal b/Rom24/src/Makefile.normal new file mode 100644 index 0000000..efcc512 --- /dev/null +++ b/Rom24/src/Makefile.normal @@ -0,0 +1,18 @@ +CC = gcc +PROF = -O -g +NOCRYPT = +C_FLAGS = -Wall $(PROF) $(NOCRYPT) +L_FLAGS = $(PROF) + +O_FILES = act_comm.o act_enter.o act_info.o act_move.o act_obj.o act_wiz.o \ + alias.o ban.o comm.o const.o db.o db2.o effects.o fight.o flags.o \ + handler.o healer.o interp.o note.o lookup.o magic.o magic2.o \ + music.o recycle.o save.o scan.o skills.o special.o tables.o \ + update.o + +rom: $(O_FILES) + rm -f rom + $(CC) $(L_FLAGS) -o rom $(O_FILES) + +.c.o: merc.h + $(CC) -c $(C_FLAGS) $< diff --git a/Rom24/src/Makefile.solaris b/Rom24/src/Makefile.solaris new file mode 100644 index 0000000..5d0038c --- /dev/null +++ b/Rom24/src/Makefile.solaris @@ -0,0 +1,19 @@ +CC = gcc +PROF = -O -g +NOCRYPT = +C_FLAGS = -Wall $(PROF) $(NOCRYPT) +L_FLAGS = $(PROF) +LIBS = -lsocket -lresolv -lnsl + +O_FILES = act_comm.o act_enter.o act_info.o act_move.o act_obj.o act_wiz.o \ + alias.o ban.o comm.o const.o db.o db2.o effects.o fight.o flags.o \ + handler.o healer.o interp.o note.o lookup.o magic.o magic2.o \ + music.o recycle.o save.o scan.o skills.o special.o tables.o \ + update.o + +rom: $(O_FILES) + rm -f rom + $(CC) $(L_FLAGS) -o rom $(O_FILES) $(LIBS) + +.c.o: merc.h + $(CC) -c $(C_FLAGS) $< diff --git a/Rom24/src/act_comm.c b/Rom24/src/act_comm.c new file mode 100644 index 0000000..a11bf11 --- /dev/null +++ b/Rom24/src/act_comm.c @@ -0,0 +1,1999 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +#if defined(macintosh) +#include +#else +#include +#include +#endif +#include +#include +#include +#include +#include +#include "merc.h" +#include "interp.h" +#include "recycle.h" +#include "tables.h" + +/* RT code to delete yourself */ + +void do_delet( CHAR_DATA *ch, char *argument) +{ + send_to_char("You must type the full command to delete yourself.\n\r",ch); +} + +void do_delete( CHAR_DATA *ch, char *argument) +{ + char strsave[MAX_INPUT_LENGTH]; + + if (IS_NPC(ch)) + return; + + if (ch->pcdata->confirm_delete) + { + if (argument[0] != '\0') + { + send_to_char("Delete status removed.\n\r",ch); + ch->pcdata->confirm_delete = FALSE; + return; + } + else + { + sprintf( strsave, "%s%s", PLAYER_DIR, capitalize( ch->name ) ); + wiznet("$N turns $Mself into line noise.",ch,NULL,0,0,0); + stop_fighting(ch,TRUE); + do_function(ch, &do_quit, ""); + unlink(strsave); + return; + } + } + + if (argument[0] != '\0') + { + send_to_char("Just type delete. No argument.\n\r",ch); + return; + } + + send_to_char("Type delete again to confirm this command.\n\r",ch); + send_to_char("WARNING: this command is irreversible.\n\r",ch); + send_to_char("Typing delete with an argument will undo delete status.\n\r", + ch); + ch->pcdata->confirm_delete = TRUE; + wiznet("$N is contemplating deletion.",ch,NULL,0,0,get_trust(ch)); +} + + +/* RT code to display channel status */ + +void do_channels( CHAR_DATA *ch, char *argument) +{ + char buf[MAX_STRING_LENGTH]; + + /* lists all channels and their status */ + send_to_char(" channel status\n\r",ch); + send_to_char("---------------------\n\r",ch); + + send_to_char("gossip ",ch); + if (!IS_SET(ch->comm,COMM_NOGOSSIP)) + send_to_char("ON\n\r",ch); + else + send_to_char("OFF\n\r",ch); + + send_to_char("auction ",ch); + if (!IS_SET(ch->comm,COMM_NOAUCTION)) + send_to_char("ON\n\r",ch); + else + send_to_char("OFF\n\r",ch); + + send_to_char("music ",ch); + if (!IS_SET(ch->comm,COMM_NOMUSIC)) + send_to_char("ON\n\r",ch); + else + send_to_char("OFF\n\r",ch); + + send_to_char("Q/A ",ch); + if (!IS_SET(ch->comm,COMM_NOQUESTION)) + send_to_char("ON\n\r",ch); + else + send_to_char("OFF\n\r",ch); + + send_to_char("Quote ",ch); + if (!IS_SET(ch->comm,COMM_NOQUOTE)) + send_to_char("ON\n\r",ch); + else + send_to_char("OFF\n\r",ch); + + send_to_char("grats ",ch); + if (!IS_SET(ch->comm,COMM_NOGRATS)) + send_to_char("ON\n\r",ch); + else + send_to_char("OFF\n\r",ch); + + if (IS_IMMORTAL(ch)) + { + send_to_char("god channel ",ch); + if(!IS_SET(ch->comm,COMM_NOWIZ)) + send_to_char("ON\n\r",ch); + else + send_to_char("OFF\n\r",ch); + } + + send_to_char("shouts ",ch); + if (!IS_SET(ch->comm,COMM_SHOUTSOFF)) + send_to_char("ON\n\r",ch); + else + send_to_char("OFF\n\r",ch); + + send_to_char("tells ",ch); + if (!IS_SET(ch->comm,COMM_DEAF)) + send_to_char("ON\n\r",ch); + else + send_to_char("OFF\n\r",ch); + + send_to_char("quiet mode ",ch); + if (IS_SET(ch->comm,COMM_QUIET)) + send_to_char("ON\n\r",ch); + else + send_to_char("OFF\n\r",ch); + + if (IS_SET(ch->comm,COMM_AFK)) + send_to_char("You are AFK.\n\r",ch); + + if (IS_SET(ch->comm,COMM_SNOOP_PROOF)) + send_to_char("You are immune to snooping.\n\r",ch); + + if (ch->lines != PAGELEN) + { + if (ch->lines) + { + sprintf(buf,"You display %d lines of scroll.\n\r",ch->lines+2); + send_to_char(buf,ch); + } + else + send_to_char("Scroll buffering is off.\n\r",ch); + } + + if (ch->prompt != NULL) + { + sprintf(buf,"Your current prompt is: %s\n\r",ch->prompt); + send_to_char(buf,ch); + } + + if (IS_SET(ch->comm,COMM_NOSHOUT)) + send_to_char("You cannot shout.\n\r",ch); + + if (IS_SET(ch->comm,COMM_NOTELL)) + send_to_char("You cannot use tell.\n\r",ch); + + if (IS_SET(ch->comm,COMM_NOCHANNELS)) + send_to_char("You cannot use channels.\n\r",ch); + + if (IS_SET(ch->comm,COMM_NOEMOTE)) + send_to_char("You cannot show emotions.\n\r",ch); + +} + +/* RT deaf blocks out all shouts */ + +void do_deaf( CHAR_DATA *ch, char *argument) +{ + + if (IS_SET(ch->comm,COMM_DEAF)) + { + send_to_char("You can now hear tells again.\n\r",ch); + REMOVE_BIT(ch->comm,COMM_DEAF); + } + else + { + send_to_char("From now on, you won't hear tells.\n\r",ch); + SET_BIT(ch->comm,COMM_DEAF); + } +} + +/* RT quiet blocks out all communication */ + +void do_quiet ( CHAR_DATA *ch, char * argument) +{ + if (IS_SET(ch->comm,COMM_QUIET)) + { + send_to_char("Quiet mode removed.\n\r",ch); + REMOVE_BIT(ch->comm,COMM_QUIET); + } + else + { + send_to_char("From now on, you will only hear says and emotes.\n\r",ch); + SET_BIT(ch->comm,COMM_QUIET); + } +} + +/* afk command */ + +void do_afk ( CHAR_DATA *ch, char * argument) +{ + if (IS_SET(ch->comm,COMM_AFK)) + { + send_to_char("AFK mode removed. Type 'replay' to see tells.\n\r",ch); + REMOVE_BIT(ch->comm,COMM_AFK); + } + else + { + send_to_char("You are now in AFK mode.\n\r",ch); + SET_BIT(ch->comm,COMM_AFK); + } +} + +void do_replay (CHAR_DATA *ch, char *argument) +{ + if (IS_NPC(ch)) + { + send_to_char("You can't replay.\n\r",ch); + return; + } + + if (buf_string(ch->pcdata->buffer)[0] == '\0') + { + send_to_char("You have no tells to replay.\n\r",ch); + return; + } + + page_to_char(buf_string(ch->pcdata->buffer),ch); + clear_buf(ch->pcdata->buffer); +} + +/* RT auction rewritten in ROM style */ +void do_auction( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + DESCRIPTOR_DATA *d; + + if (argument[0] == '\0' ) + { + if (IS_SET(ch->comm,COMM_NOAUCTION)) + { + send_to_char("Auction channel is now ON.\n\r",ch); + REMOVE_BIT(ch->comm,COMM_NOAUCTION); + } + else + { + send_to_char("Auction channel is now OFF.\n\r",ch); + SET_BIT(ch->comm,COMM_NOAUCTION); + } + } + else /* auction message sent, turn auction on if it is off */ + { + if (IS_SET(ch->comm,COMM_QUIET)) + { + send_to_char("You must turn off quiet mode first.\n\r",ch); + return; + } + + if (IS_SET(ch->comm,COMM_NOCHANNELS)) + { + send_to_char("The gods have revoked your channel priviliges.\n\r",ch); + return; + } + + REMOVE_BIT(ch->comm,COMM_NOAUCTION); + } + + sprintf( buf, "You auction '%s'\n\r", argument ); + send_to_char( buf, ch ); + for ( d = descriptor_list; d != NULL; d = d->next ) + { + CHAR_DATA *victim; + + victim = d->original ? d->original : d->character; + + if ( d->connected == CON_PLAYING && + d->character != ch && + !IS_SET(victim->comm,COMM_NOAUCTION) && + !IS_SET(victim->comm,COMM_QUIET) ) + { + act_new("$n auctions '$t'", + ch,argument,d->character,TO_VICT,POS_DEAD); + } + } +} + +/* RT chat replaced with ROM gossip */ +void do_gossip( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + DESCRIPTOR_DATA *d; + + if (argument[0] == '\0' ) + { + if (IS_SET(ch->comm,COMM_NOGOSSIP)) + { + send_to_char("Gossip channel is now ON.\n\r",ch); + REMOVE_BIT(ch->comm,COMM_NOGOSSIP); + } + else + { + send_to_char("Gossip channel is now OFF.\n\r",ch); + SET_BIT(ch->comm,COMM_NOGOSSIP); + } + } + else /* gossip message sent, turn gossip on if it isn't already */ + { + if (IS_SET(ch->comm,COMM_QUIET)) + { + send_to_char("You must turn off quiet mode first.\n\r",ch); + return; + } + + if (IS_SET(ch->comm,COMM_NOCHANNELS)) + { + send_to_char("The gods have revoked your channel priviliges.\n\r",ch); + return; + + } + + REMOVE_BIT(ch->comm,COMM_NOGOSSIP); + + sprintf( buf, "You gossip '%s'\n\r", argument ); + send_to_char( buf, ch ); + for ( d = descriptor_list; d != NULL; d = d->next ) + { + CHAR_DATA *victim; + + victim = d->original ? d->original : d->character; + + if ( d->connected == CON_PLAYING && + d->character != ch && + !IS_SET(victim->comm,COMM_NOGOSSIP) && + !IS_SET(victim->comm,COMM_QUIET) ) + { + act_new( "$n gossips '$t'", + ch,argument, d->character, TO_VICT,POS_SLEEPING ); + } + } + } +} + +void do_grats( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + DESCRIPTOR_DATA *d; + + if (argument[0] == '\0' ) + { + if (IS_SET(ch->comm,COMM_NOGRATS)) + { + send_to_char("Grats channel is now ON.\n\r",ch); + REMOVE_BIT(ch->comm,COMM_NOGRATS); + } + else + { + send_to_char("Grats channel is now OFF.\n\r",ch); + SET_BIT(ch->comm,COMM_NOGRATS); + } + } + else /* grats message sent, turn grats on if it isn't already */ + { + if (IS_SET(ch->comm,COMM_QUIET)) + { + send_to_char("You must turn off quiet mode first.\n\r",ch); + return; + } + + if (IS_SET(ch->comm,COMM_NOCHANNELS)) + { + send_to_char("The gods have revoked your channel priviliges.\n\r",ch); + return; + + } + + REMOVE_BIT(ch->comm,COMM_NOGRATS); + + sprintf( buf, "You grats '%s'\n\r", argument ); + send_to_char( buf, ch ); + for ( d = descriptor_list; d != NULL; d = d->next ) + { + CHAR_DATA *victim; + + victim = d->original ? d->original : d->character; + + if ( d->connected == CON_PLAYING && + d->character != ch && + !IS_SET(victim->comm,COMM_NOGRATS) && + !IS_SET(victim->comm,COMM_QUIET) ) + { + act_new( "$n grats '$t'", + ch,argument, d->character, TO_VICT,POS_SLEEPING ); + } + } + } +} + +void do_quote( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + DESCRIPTOR_DATA *d; + + if (argument[0] == '\0' ) + { + if (IS_SET(ch->comm,COMM_NOQUOTE)) + { + send_to_char("Quote channel is now ON.\n\r",ch); + REMOVE_BIT(ch->comm,COMM_NOQUOTE); + } + else + { + send_to_char("Quote channel is now OFF.\n\r",ch); + SET_BIT(ch->comm,COMM_NOQUOTE); + } + } + else /* quote message sent, turn quote on if it isn't already */ + { + if (IS_SET(ch->comm,COMM_QUIET)) + { + send_to_char("You must turn off quiet mode first.\n\r",ch); + return; + } + + if (IS_SET(ch->comm,COMM_NOCHANNELS)) + { + send_to_char("The gods have revoked your channel priviliges.\n\r",ch); + return; + + } + + REMOVE_BIT(ch->comm,COMM_NOQUOTE); + + sprintf( buf, "You quote '%s'\n\r", argument ); + send_to_char( buf, ch ); + for ( d = descriptor_list; d != NULL; d = d->next ) + { + CHAR_DATA *victim; + + victim = d->original ? d->original : d->character; + + if ( d->connected == CON_PLAYING && + d->character != ch && + !IS_SET(victim->comm,COMM_NOQUOTE) && + !IS_SET(victim->comm,COMM_QUIET) ) + { + act_new( "$n quotes '$t'", + ch,argument, d->character, TO_VICT,POS_SLEEPING ); + } + } + } +} + +/* RT question channel */ +void do_question( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + DESCRIPTOR_DATA *d; + + if (argument[0] == '\0' ) + { + if (IS_SET(ch->comm,COMM_NOQUESTION)) + { + send_to_char("Q/A channel is now ON.\n\r",ch); + REMOVE_BIT(ch->comm,COMM_NOQUESTION); + } + else + { + send_to_char("Q/A channel is now OFF.\n\r",ch); + SET_BIT(ch->comm,COMM_NOQUESTION); + } + } + else /* question sent, turn Q/A on if it isn't already */ + { + if (IS_SET(ch->comm,COMM_QUIET)) + { + send_to_char("You must turn off quiet mode first.\n\r",ch); + return; + } + + if (IS_SET(ch->comm,COMM_NOCHANNELS)) + { + send_to_char("The gods have revoked your channel priviliges.\n\r",ch); + return; + } + + REMOVE_BIT(ch->comm,COMM_NOQUESTION); + + sprintf( buf, "You question '%s'\n\r", argument ); + send_to_char( buf, ch ); + for ( d = descriptor_list; d != NULL; d = d->next ) + { + CHAR_DATA *victim; + + victim = d->original ? d->original : d->character; + + if ( d->connected == CON_PLAYING && + d->character != ch && + !IS_SET(victim->comm,COMM_NOQUESTION) && + !IS_SET(victim->comm,COMM_QUIET) ) + { + act_new("$n questions '$t'", + ch,argument,d->character,TO_VICT,POS_SLEEPING); + } + } + } +} + +/* RT answer channel - uses same line as questions */ +void do_answer( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + DESCRIPTOR_DATA *d; + + if (argument[0] == '\0' ) + { + if (IS_SET(ch->comm,COMM_NOQUESTION)) + { + send_to_char("Q/A channel is now ON.\n\r",ch); + REMOVE_BIT(ch->comm,COMM_NOQUESTION); + } + else + { + send_to_char("Q/A channel is now OFF.\n\r",ch); + SET_BIT(ch->comm,COMM_NOQUESTION); + } + } + else /* answer sent, turn Q/A on if it isn't already */ + { + if (IS_SET(ch->comm,COMM_QUIET)) + { + send_to_char("You must turn off quiet mode first.\n\r",ch); + return; + } + + if (IS_SET(ch->comm,COMM_NOCHANNELS)) + { + send_to_char("The gods have revoked your channel priviliges.\n\r",ch); + return; + } + + REMOVE_BIT(ch->comm,COMM_NOQUESTION); + + sprintf( buf, "You answer '%s'\n\r", argument ); + send_to_char( buf, ch ); + for ( d = descriptor_list; d != NULL; d = d->next ) + { + CHAR_DATA *victim; + + victim = d->original ? d->original : d->character; + + if ( d->connected == CON_PLAYING && + d->character != ch && + !IS_SET(victim->comm,COMM_NOQUESTION) && + !IS_SET(victim->comm,COMM_QUIET) ) + { + act_new("$n answers '$t'", + ch,argument,d->character,TO_VICT,POS_SLEEPING); + } + } + } +} + +/* RT music channel */ +void do_music( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + DESCRIPTOR_DATA *d; + + if (argument[0] == '\0' ) + { + if (IS_SET(ch->comm,COMM_NOMUSIC)) + { + send_to_char("Music channel is now ON.\n\r",ch); + REMOVE_BIT(ch->comm,COMM_NOMUSIC); + } + else + { + send_to_char("Music channel is now OFF.\n\r",ch); + SET_BIT(ch->comm,COMM_NOMUSIC); + } + } + else /* music sent, turn music on if it isn't already */ + { + if (IS_SET(ch->comm,COMM_QUIET)) + { + send_to_char("You must turn off quiet mode first.\n\r",ch); + return; + } + + if (IS_SET(ch->comm,COMM_NOCHANNELS)) + { + send_to_char("The gods have revoked your channel priviliges.\n\r",ch); + return; + } + + REMOVE_BIT(ch->comm,COMM_NOMUSIC); + + sprintf( buf, "You MUSIC: '%s'\n\r", argument ); + send_to_char( buf, ch ); + sprintf( buf, "$n MUSIC: '%s'", argument ); + for ( d = descriptor_list; d != NULL; d = d->next ) + { + CHAR_DATA *victim; + + victim = d->original ? d->original : d->character; + + if ( d->connected == CON_PLAYING && + d->character != ch && + !IS_SET(victim->comm,COMM_NOMUSIC) && + !IS_SET(victim->comm,COMM_QUIET) ) + { + act_new("$n MUSIC: '$t'", + ch,argument,d->character,TO_VICT,POS_SLEEPING); + } + } + } +} + +/* clan channels */ +void do_clantalk( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + DESCRIPTOR_DATA *d; + + if (!is_clan(ch) || clan_table[ch->clan].independent) + { + send_to_char("You aren't in a clan.\n\r",ch); + return; + } + if ( argument[0] == '\0' ) + { + if (IS_SET(ch->comm,COMM_NOCLAN)) + { + send_to_char("Clan channel is now ON\n\r",ch); + REMOVE_BIT(ch->comm,COMM_NOCLAN); + } + else + { + send_to_char("Clan channel is now OFF\n\r",ch); + SET_BIT(ch->comm,COMM_NOCLAN); + } + return; + } + + if (IS_SET(ch->comm,COMM_NOCHANNELS)) + { + send_to_char("The gods have revoked your channel priviliges.\n\r",ch); + return; + } + + REMOVE_BIT(ch->comm,COMM_NOCLAN); + + sprintf( buf, "You clan '%s'\n\r", argument ); + send_to_char( buf, ch ); + sprintf( buf, "$n clans '%s'", argument ); + for ( d = descriptor_list; d != NULL; d = d->next ) + { + if ( d->connected == CON_PLAYING && + d->character != ch && + is_same_clan(ch,d->character) && + !IS_SET(d->character->comm,COMM_NOCLAN) && + !IS_SET(d->character->comm,COMM_QUIET) ) + { + act_new("$n clans '$t'",ch,argument,d->character,TO_VICT,POS_DEAD); + } + } + + return; +} + +void do_immtalk( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + DESCRIPTOR_DATA *d; + + if ( argument[0] == '\0' ) + { + if (IS_SET(ch->comm,COMM_NOWIZ)) + { + send_to_char("Immortal channel is now ON\n\r",ch); + REMOVE_BIT(ch->comm,COMM_NOWIZ); + } + else + { + send_to_char("Immortal channel is now OFF\n\r",ch); + SET_BIT(ch->comm,COMM_NOWIZ); + } + return; + } + + REMOVE_BIT(ch->comm,COMM_NOWIZ); + + sprintf( buf, "$n: %s", argument ); + act_new("$n: $t",ch,argument,NULL,TO_CHAR,POS_DEAD); + for ( d = descriptor_list; d != NULL; d = d->next ) + { + if ( d->connected == CON_PLAYING && + IS_IMMORTAL(d->character) && + !IS_SET(d->character->comm,COMM_NOWIZ) ) + { + act_new("$n: $t",ch,argument,d->character,TO_VICT,POS_DEAD); + } + } + + return; +} + + + +void do_say( CHAR_DATA *ch, char *argument ) +{ + if ( argument[0] == '\0' ) + { + send_to_char( "Say what?\n\r", ch ); + return; + } + + act( "$n says '$T'", ch, NULL, argument, TO_ROOM ); + act( "You say '$T'", ch, NULL, argument, TO_CHAR ); + return; +} + + + +void do_shout( CHAR_DATA *ch, char *argument ) +{ + DESCRIPTOR_DATA *d; + + if (argument[0] == '\0' ) + { + if (IS_SET(ch->comm,COMM_SHOUTSOFF)) + { + send_to_char("You can hear shouts again.\n\r",ch); + REMOVE_BIT(ch->comm,COMM_SHOUTSOFF); + } + else + { + send_to_char("You will no longer hear shouts.\n\r",ch); + SET_BIT(ch->comm,COMM_SHOUTSOFF); + } + return; + } + + if ( IS_SET(ch->comm, COMM_NOSHOUT) ) + { + send_to_char( "You can't shout.\n\r", ch ); + return; + } + + REMOVE_BIT(ch->comm,COMM_SHOUTSOFF); + + WAIT_STATE( ch, 12 ); + + act( "You shout '$T'", ch, NULL, argument, TO_CHAR ); + for ( d = descriptor_list; d != NULL; d = d->next ) + { + CHAR_DATA *victim; + + victim = d->original ? d->original : d->character; + + if ( d->connected == CON_PLAYING && + d->character != ch && + !IS_SET(victim->comm, COMM_SHOUTSOFF) && + !IS_SET(victim->comm, COMM_QUIET) ) + { + act("$n shouts '$t'",ch,argument,d->character,TO_VICT); + } + } + + return; +} + + + +void do_tell( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH],buf[MAX_STRING_LENGTH]; + CHAR_DATA *victim; + + if ( IS_SET(ch->comm, COMM_NOTELL) || IS_SET(ch->comm,COMM_DEAF)) + { + send_to_char( "Your message didn't get through.\n\r", ch ); + return; + } + + if ( IS_SET(ch->comm, COMM_QUIET) ) + { + send_to_char( "You must turn off quiet mode first.\n\r", ch); + return; + } + + if (IS_SET(ch->comm,COMM_DEAF)) + { + send_to_char("You must turn off deaf mode first.\n\r",ch); + return; + } + + argument = one_argument( argument, arg ); + + if ( arg[0] == '\0' || argument[0] == '\0' ) + { + send_to_char( "Tell whom what?\n\r", ch ); + return; + } + + /* + * Can tell to PC's anywhere, but NPC's only in same room. + * -- Furey + */ + if ( ( victim = get_char_world( ch, arg ) ) == NULL + || ( IS_NPC(victim) && victim->in_room != ch->in_room ) ) + { + send_to_char( "They aren't here.\n\r", ch ); + return; + } + + if ( victim->desc == NULL && !IS_NPC(victim)) + { + act("$N seems to have misplaced $S link...try again later.", + ch,NULL,victim,TO_CHAR); + sprintf(buf,"%s tells you '%s'\n\r",PERS(ch,victim),argument); + buf[0] = UPPER(buf[0]); + add_buf(victim->pcdata->buffer,buf); + return; + } + + if ( !(IS_IMMORTAL(ch) && ch->level > LEVEL_IMMORTAL) && !IS_AWAKE(victim) ) + { + act( "$E can't hear you.", ch, 0, victim, TO_CHAR ); + return; + } + + if ((IS_SET(victim->comm,COMM_QUIET) || IS_SET(victim->comm,COMM_DEAF)) + && !IS_IMMORTAL(ch)) + { + act( "$E is not receiving tells.", ch, 0, victim, TO_CHAR ); + return; + } + + if (IS_SET(victim->comm,COMM_AFK)) + { + if (IS_NPC(victim)) + { + act("$E is AFK, and not receiving tells.",ch,NULL,victim,TO_CHAR); + return; + } + + act("$E is AFK, but your tell will go through when $E returns.", + ch,NULL,victim,TO_CHAR); + sprintf(buf,"%s tells you '%s'\n\r",PERS(ch,victim),argument); + buf[0] = UPPER(buf[0]); + add_buf(victim->pcdata->buffer,buf); + return; + } + + act( "You tell $N '$t'", ch, argument, victim, TO_CHAR ); + act_new("$n tells you '$t'",ch,argument,victim,TO_VICT,POS_DEAD); + victim->reply = ch; + + return; +} + + + +void do_reply( CHAR_DATA *ch, char *argument ) +{ + CHAR_DATA *victim; + char buf[MAX_STRING_LENGTH]; + + if ( IS_SET(ch->comm, COMM_NOTELL) ) + { + send_to_char( "Your message didn't get through.\n\r", ch ); + return; + } + + if ( ( victim = ch->reply ) == NULL ) + { + send_to_char( "They aren't here.\n\r", ch ); + return; + } + + if ( victim->desc == NULL && !IS_NPC(victim)) + { + act("$N seems to have misplaced $S link...try again later.", + ch,NULL,victim,TO_CHAR); + sprintf(buf,"%s tells you '%s'\n\r",PERS(ch,victim),argument); + buf[0] = UPPER(buf[0]); + add_buf(victim->pcdata->buffer,buf); + return; + } + + if ( !IS_IMMORTAL(ch) && !IS_AWAKE(victim) ) + { + act( "$E can't hear you.", ch, 0, victim, TO_CHAR ); + return; + } + + if ((IS_SET(victim->comm,COMM_QUIET) || IS_SET(victim->comm,COMM_DEAF)) + && !IS_IMMORTAL(ch) && !IS_IMMORTAL(victim)) + { + act_new( "$E is not receiving tells.", ch, 0, victim, TO_CHAR,POS_DEAD); + return; + } + + if (!IS_IMMORTAL(victim) && !IS_AWAKE(ch)) + { + send_to_char( "In your dreams, or what?\n\r", ch ); + return; + } + + if (IS_SET(victim->comm,COMM_AFK)) + { + if (IS_NPC(victim)) + { + act_new("$E is AFK, and not receiving tells.", + ch,NULL,victim,TO_CHAR,POS_DEAD); + return; + } + + act_new("$E is AFK, but your tell will go through when $E returns.", + ch,NULL,victim,TO_CHAR,POS_DEAD); + sprintf(buf,"%s tells you '%s'\n\r",PERS(ch,victim),argument); + buf[0] = UPPER(buf[0]); + add_buf(victim->pcdata->buffer,buf); + return; + } + + act_new("You tell $N '$t'",ch,argument,victim,TO_CHAR,POS_DEAD); + act_new("$n tells you '$t'",ch,argument,victim,TO_VICT,POS_DEAD); + victim->reply = ch; + + return; +} + + + +void do_yell( CHAR_DATA *ch, char *argument ) +{ + DESCRIPTOR_DATA *d; + + if ( IS_SET(ch->comm, COMM_NOSHOUT) ) + { + send_to_char( "You can't yell.\n\r", ch ); + return; + } + + if ( argument[0] == '\0' ) + { + send_to_char( "Yell what?\n\r", ch ); + return; + } + + + act("You yell '$t'",ch,argument,NULL,TO_CHAR); + for ( d = descriptor_list; d != NULL; d = d->next ) + { + if ( d->connected == CON_PLAYING + && d->character != ch + && d->character->in_room != NULL + && d->character->in_room->area == ch->in_room->area + && !IS_SET(d->character->comm,COMM_QUIET) ) + { + act("$n yells '$t'",ch,argument,d->character,TO_VICT); + } + } + + return; +} + + +void do_emote( CHAR_DATA *ch, char *argument ) +{ + if ( !IS_NPC(ch) && IS_SET(ch->comm, COMM_NOEMOTE) ) + { + send_to_char( "You can't show your emotions.\n\r", ch ); + return; + } + + if ( argument[0] == '\0' ) + { + send_to_char( "Emote what?\n\r", ch ); + return; + } + + act( "$n $T", ch, NULL, argument, TO_ROOM ); + act( "$n $T", ch, NULL, argument, TO_CHAR ); + return; +} + + +void do_pmote( CHAR_DATA *ch, char *argument ) +{ + CHAR_DATA *vch; + 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) ) + { + send_to_char( "You can't show your emotions.\n\r", ch ); + return; + } + + if ( argument[0] == '\0' ) + { + send_to_char( "Emote what?\n\r", ch ); + return; + } + + act( "$n $t", ch, argument, NULL, TO_CHAR ); + + 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) + { + act("$N $t",vch,argument,ch,TO_CHAR); + continue; + } + + strcpy(temp,argument); + temp[strlen(argument) - strlen(letter)] = '\0'; + last[0] = '\0'; + name = vch->name; + + for (; *letter != '\0'; letter++) + { + if (*letter == '\'' && matches == strlen(vch->name)) + { + strcat(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)) + { + strcat(temp,"you"); + last[0] = '\0'; + name = vch->name; + continue; + } + strncat(last,letter,1); + continue; + } + + matches = 0; + strcat(temp,last); + strncat(temp,letter,1); + last[0] = '\0'; + name = vch->name; + } + + act("$N $t",vch,temp,ch,TO_CHAR); + } + + return; +} + + +/* + * All the posing stuff. + */ +struct pose_table_type +{ + char * message[2*MAX_CLASS]; +}; + +const struct pose_table_type pose_table [] = +{ + { + { + "You sizzle with energy.", + "$n sizzles with energy.", + "You feel very holy.", + "$n looks very holy.", + "You perform a small card trick.", + "$n performs a small card trick.", + "You show your bulging muscles.", + "$n shows $s bulging muscles." + } + }, + + { + { + "You turn into a butterfly, then return to your normal shape.", + "$n turns into a butterfly, then returns to $s normal shape.", + "You nonchalantly turn wine into water.", + "$n nonchalantly turns wine into water.", + "You wiggle your ears alternately.", + "$n wiggles $s ears alternately.", + "You crack nuts between your fingers.", + "$n cracks nuts between $s fingers." + } + }, + + { + { + "Blue sparks fly from your fingers.", + "Blue sparks fly from $n's fingers.", + "A halo appears over your head.", + "A halo appears over $n's head.", + "You nimbly tie yourself into a knot.", + "$n nimbly ties $mself into a knot.", + "You grizzle your teeth and look mean.", + "$n grizzles $s teeth and looks mean." + } + }, + + { + { + "Little red lights dance in your eyes.", + "Little red lights dance in $n's eyes.", + "You recite words of wisdom.", + "$n recites words of wisdom.", + "You juggle with daggers, apples, and eyeballs.", + "$n juggles with daggers, apples, and eyeballs.", + "You hit your head, and your eyes roll.", + "$n hits $s head, and $s eyes roll." + } + }, + + { + { + "A slimy green monster appears before you and bows.", + "A slimy green monster appears before $n and bows.", + "Deep in prayer, you levitate.", + "Deep in prayer, $n levitates.", + "You steal the underwear off every person in the room.", + "Your underwear is gone! $n stole it!", + "Crunch, crunch -- you munch a bottle.", + "Crunch, crunch -- $n munches a bottle." + } + }, + + { + { + "You turn everybody into a little pink elephant.", + "You are turned into a little pink elephant by $n.", + "An angel consults you.", + "An angel consults $n.", + "The dice roll ... and you win again.", + "The dice roll ... and $n wins again.", + "... 98, 99, 100 ... you do pushups.", + "... 98, 99, 100 ... $n does pushups." + } + }, + + { + { + "A small ball of light dances on your fingertips.", + "A small ball of light dances on $n's fingertips.", + "Your body glows with an unearthly light.", + "$n's body glows with an unearthly light.", + "You count the money in everyone's pockets.", + "Check your money, $n is counting it.", + "Arnold Schwarzenegger admires your physique.", + "Arnold Schwarzenegger admires $n's physique." + } + }, + + { + { + "Smoke and fumes leak from your nostrils.", + "Smoke and fumes leak from $n's nostrils.", + "A spot light hits you.", + "A spot light hits $n.", + "You balance a pocket knife on your tongue.", + "$n balances a pocket knife on your tongue.", + "Watch your feet, you are juggling granite boulders.", + "Watch your feet, $n is juggling granite boulders." + } + }, + + { + { + "The light flickers as you rap in magical languages.", + "The light flickers as $n raps in magical languages.", + "Everyone levitates as you pray.", + "You levitate as $n prays.", + "You produce a coin from everyone's ear.", + "$n produces a coin from your ear.", + "Oomph! You squeeze water out of a granite boulder.", + "Oomph! $n squeezes water out of a granite boulder." + } + }, + + { + { + "Your head disappears.", + "$n's head disappears.", + "A cool breeze refreshes you.", + "A cool breeze refreshes $n.", + "You step behind your shadow.", + "$n steps behind $s shadow.", + "You pick your teeth with a spear.", + "$n picks $s teeth with a spear." + } + }, + + { + { + "A fire elemental singes your hair.", + "A fire elemental singes $n's hair.", + "The sun pierces through the clouds to illuminate you.", + "The sun pierces through the clouds to illuminate $n.", + "Your eyes dance with greed.", + "$n's eyes dance with greed.", + "Everyone is swept off their foot by your hug.", + "You are swept off your feet by $n's hug." + } + }, + + { + { + "The sky changes color to match your eyes.", + "The sky changes color to match $n's eyes.", + "The ocean parts before you.", + "The ocean parts before $n.", + "You deftly steal everyone's weapon.", + "$n deftly steals your weapon.", + "Your karate chop splits a tree.", + "$n's karate chop splits a tree." + } + }, + + { + { + "The stones dance to your command.", + "The stones dance to $n's command.", + "A thunder cloud kneels to you.", + "A thunder cloud kneels to $n.", + "The Grey Mouser buys you a beer.", + "The Grey Mouser buys $n a beer.", + "A strap of your armor breaks over your mighty thews.", + "A strap of $n's armor breaks over $s mighty thews." + } + }, + + { + { + "The heavens and grass change colour as you smile.", + "The heavens and grass change colour as $n smiles.", + "The Burning Man speaks to you.", + "The Burning Man speaks to $n.", + "Everyone's pocket explodes with your fireworks.", + "Your pocket explodes with $n's fireworks.", + "A boulder cracks at your frown.", + "A boulder cracks at $n's frown." + } + }, + + { + { + "Everyone's clothes are transparent, and you are laughing.", + "Your clothes are transparent, and $n is laughing.", + "An eye in a pyramid winks at you.", + "An eye in a pyramid winks at $n.", + "Everyone discovers your dagger a centimeter from their eye.", + "You discover $n's dagger a centimeter from your eye.", + "Mercenaries arrive to do your bidding.", + "Mercenaries arrive to do $n's bidding." + } + }, + + { + { + "A black hole swallows you.", + "A black hole swallows $n.", + "Valentine Michael Smith offers you a glass of water.", + "Valentine Michael Smith offers $n a glass of water.", + "Where did you go?", + "Where did $n go?", + "Four matched Percherons bring in your chariot.", + "Four matched Percherons bring in $n's chariot." + } + }, + + { + { + "The world shimmers in time with your whistling.", + "The world shimmers in time with $n's whistling.", + "The great god Mota gives you a staff.", + "The great god Mota gives $n a staff.", + "Click.", + "Click.", + "Atlas asks you to relieve him.", + "Atlas asks $n to relieve him." + } + } +}; + + + +void do_pose( CHAR_DATA *ch, char *argument ) +{ + int level; + int pose; + + if ( IS_NPC(ch) ) + return; + + level = UMIN( ch->level, sizeof(pose_table) / sizeof(pose_table[0]) - 1 ); + pose = number_range(0, level); + + act( pose_table[pose].message[2*ch->class+0], ch, NULL, NULL, TO_CHAR ); + act( pose_table[pose].message[2*ch->class+1], ch, NULL, NULL, TO_ROOM ); + + return; +} + + + +void do_bug( CHAR_DATA *ch, char *argument ) +{ + append_file( ch, BUG_FILE, argument ); + send_to_char( "Bug logged.\n\r", ch ); + return; +} + +void do_typo( CHAR_DATA *ch, char *argument ) +{ + append_file( ch, TYPO_FILE, argument ); + send_to_char( "Typo logged.\n\r", ch ); + return; +} + +void do_rent( CHAR_DATA *ch, char *argument ) +{ + send_to_char( "There is no rent here. Just save and quit.\n\r", ch ); + return; +} + + +void do_qui( CHAR_DATA *ch, char *argument ) +{ + send_to_char( "If you want to QUIT, you have to spell it out.\n\r", ch ); + return; +} + + + +void do_quit( CHAR_DATA *ch, char *argument ) +{ + DESCRIPTOR_DATA *d,*d_next; + int id; + + if ( IS_NPC(ch) ) + return; + + if ( ch->position == POS_FIGHTING ) + { + send_to_char( "No way! You are fighting.\n\r", ch ); + return; + } + + if ( ch->position < POS_STUNNED ) + { + send_to_char( "You're not DEAD yet.\n\r", ch ); + return; + } + send_to_char( + "Alas, all good things must come to an end.\n\r",ch); + act( "$n has left the game.", ch, NULL, NULL, TO_ROOM ); + sprintf( log_buf, "%s has quit.", ch->name ); + log_string( log_buf ); + wiznet("$N rejoins the real world.",ch,NULL,WIZ_LOGINS,0,get_trust(ch)); + + /* + * After extract_char the ch is no longer valid! + */ + save_char_obj( ch ); + id = ch->id; + d = ch->desc; + extract_char( ch, TRUE ); + if ( d != NULL ) + close_socket( d ); + + /* toast evil cheating bastards */ + for (d = descriptor_list; d != NULL; d = d_next) + { + CHAR_DATA *tch; + + d_next = d->next; + tch = d->original ? d->original : d->character; + if (tch && tch->id == id) + { + extract_char(tch,TRUE); + close_socket(d); + } + } + + return; +} + + + +void do_save( CHAR_DATA *ch, char *argument ) +{ + if ( IS_NPC(ch) ) + return; + + save_char_obj( ch ); + send_to_char("Saving. Remember that ROM has automatic saving now.\n\r", ch); + WAIT_STATE(ch,4 * PULSE_VIOLENCE); + return; +} + + + +void do_follow( CHAR_DATA *ch, char *argument ) +{ +/* RT changed to allow unlimited following and follow the NOFOLLOW rules */ + char arg[MAX_INPUT_LENGTH]; + CHAR_DATA *victim; + + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + { + send_to_char( "Follow whom?\n\r", ch ); + return; + } + + if ( ( victim = get_char_room( ch, arg ) ) == NULL ) + { + send_to_char( "They aren't here.\n\r", ch ); + return; + } + + if ( IS_AFFECTED(ch, AFF_CHARM) && ch->master != NULL ) + { + act( "But you'd rather follow $N!", ch, NULL, ch->master, TO_CHAR ); + return; + } + + if ( victim == ch ) + { + if ( ch->master == NULL ) + { + send_to_char( "You already follow yourself.\n\r", ch ); + return; + } + stop_follower(ch); + return; + } + + if (!IS_NPC(victim) && IS_SET(victim->act,PLR_NOFOLLOW) && !IS_IMMORTAL(ch)) + { + act("$N doesn't seem to want any followers.\n\r", + ch,NULL,victim, TO_CHAR); + return; + } + + REMOVE_BIT(ch->act,PLR_NOFOLLOW); + + if ( ch->master != NULL ) + stop_follower( ch ); + + add_follower( ch, victim ); + return; +} + + +void add_follower( CHAR_DATA *ch, CHAR_DATA *master ) +{ + if ( ch->master != NULL ) + { + bug( "Add_follower: non-null master.", 0 ); + return; + } + + ch->master = master; + ch->leader = NULL; + + if ( can_see( master, ch ) ) + act( "$n now follows you.", ch, NULL, master, TO_VICT ); + + act( "You now follow $N.", ch, NULL, master, TO_CHAR ); + + return; +} + + + +void stop_follower( CHAR_DATA *ch ) +{ + if ( ch->master == NULL ) + { + bug( "Stop_follower: null master.", 0 ); + return; + } + + if ( IS_AFFECTED(ch, AFF_CHARM) ) + { + REMOVE_BIT( ch->affected_by, AFF_CHARM ); + affect_strip( ch, gsn_charm_person ); + } + + if ( can_see( ch->master, ch ) && ch->in_room != NULL) + { + act( "$n stops following you.", ch, NULL, ch->master, TO_VICT ); + act( "You stop following $N.", ch, NULL, ch->master, TO_CHAR ); + } + if (ch->master->pet == ch) + ch->master->pet = NULL; + + ch->master = NULL; + ch->leader = NULL; + return; +} + +/* nukes charmed monsters and pets */ +void nuke_pets( CHAR_DATA *ch ) +{ + CHAR_DATA *pet; + + if ((pet = ch->pet) != NULL) + { + stop_follower(pet); + if (pet->in_room != NULL) + act("$N slowly fades away.",ch,NULL,pet,TO_NOTVICT); + extract_char(pet,TRUE); + } + ch->pet = NULL; + + return; +} + + + +void die_follower( CHAR_DATA *ch ) +{ + CHAR_DATA *fch; + + if ( ch->master != NULL ) + { + if (ch->master->pet == ch) + ch->master->pet = NULL; + stop_follower( ch ); + } + + ch->leader = NULL; + + for ( fch = char_list; fch != NULL; fch = fch->next ) + { + if ( fch->master == ch ) + stop_follower( fch ); + if ( fch->leader == ch ) + fch->leader = fch; + } + + return; +} + + + +void do_order( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + char arg[MAX_INPUT_LENGTH],arg2[MAX_INPUT_LENGTH]; + CHAR_DATA *victim; + CHAR_DATA *och; + CHAR_DATA *och_next; + bool found; + bool fAll; + + argument = one_argument( argument, arg ); + one_argument(argument,arg2); + + if (!str_cmp(arg2,"delete")) + { + send_to_char("That will NOT be done.\n\r",ch); + return; + } + + if ( arg[0] == '\0' || argument[0] == '\0' ) + { + send_to_char( "Order whom to do what?\n\r", ch ); + return; + } + + if ( IS_AFFECTED( ch, AFF_CHARM ) ) + { + send_to_char( "You feel like taking, not giving, orders.\n\r", ch ); + return; + } + + if ( !str_cmp( arg, "all" ) ) + { + fAll = TRUE; + victim = NULL; + } + else + { + fAll = FALSE; + if ( ( victim = get_char_room( ch, arg ) ) == NULL ) + { + send_to_char( "They aren't here.\n\r", ch ); + return; + } + + if ( victim == ch ) + { + send_to_char( "Aye aye, right away!\n\r", ch ); + return; + } + + if (!IS_AFFECTED(victim, AFF_CHARM) || victim->master != ch + || (IS_IMMORTAL(victim) && victim->trust >= ch->trust)) + { + send_to_char( "Do it yourself!\n\r", ch ); + return; + } + } + + found = FALSE; + for ( och = ch->in_room->people; och != NULL; och = och_next ) + { + och_next = och->next_in_room; + + if ( IS_AFFECTED(och, AFF_CHARM) + && och->master == ch + && ( fAll || och == victim ) ) + { + found = TRUE; + sprintf( buf, "$n orders you to '%s'.", argument ); + act( buf, ch, NULL, och, TO_VICT ); + interpret( och, argument ); + } + } + + if ( found ) + { + WAIT_STATE(ch,PULSE_VIOLENCE); + send_to_char( "Ok.\n\r", ch ); + } + else + send_to_char( "You have no followers here.\n\r", ch ); + return; +} + + + +void do_group( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + char arg[MAX_INPUT_LENGTH]; + CHAR_DATA *victim; + + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + { + CHAR_DATA *gch; + CHAR_DATA *leader; + + leader = (ch->leader != NULL) ? ch->leader : ch; + sprintf( buf, "%s's group:\n\r", PERS(leader, ch) ); + send_to_char( buf, ch ); + + for ( gch = char_list; gch != NULL; gch = gch->next ) + { + if ( is_same_group( gch, ch ) ) + { + sprintf( buf, + "[%2d %s] %-16s %4d/%4d hp %4d/%4d mana %4d/%4d mv %5d xp\n\r", + gch->level, + IS_NPC(gch) ? "Mob" : class_table[gch->class].who_name, + capitalize( PERS(gch, ch) ), + gch->hit, gch->max_hit, + gch->mana, gch->max_mana, + gch->move, gch->max_move, + gch->exp ); + send_to_char( buf, ch ); + } + } + return; + } + + if ( ( victim = get_char_room( ch, arg ) ) == NULL ) + { + send_to_char( "They aren't here.\n\r", ch ); + return; + } + + if ( ch->master != NULL || ( ch->leader != NULL && ch->leader != ch ) ) + { + send_to_char( "But you are following someone else!\n\r", ch ); + return; + } + + if ( victim->master != ch && ch != victim ) + { + act_new("$N isn't following you.",ch,NULL,victim,TO_CHAR,POS_SLEEPING); + return; + } + + if (IS_AFFECTED(victim,AFF_CHARM)) + { + send_to_char("You can't remove charmed mobs from your group.\n\r",ch); + return; + } + + if (IS_AFFECTED(ch,AFF_CHARM)) + { + act_new("You like your master too much to leave $m!", + ch,NULL,victim,TO_VICT,POS_SLEEPING); + return; + } + + if ( is_same_group( victim, ch ) && ch != victim ) + { + victim->leader = NULL; + act_new("$n removes $N from $s group.", + ch,NULL,victim,TO_NOTVICT,POS_RESTING); + act_new("$n removes you from $s group.", + ch,NULL,victim,TO_VICT,POS_SLEEPING); + act_new("You remove $N from your group.", + ch,NULL,victim,TO_CHAR,POS_SLEEPING); + return; + } + + victim->leader = ch; + act_new("$N joins $n's group.",ch,NULL,victim,TO_NOTVICT,POS_RESTING); + act_new("You join $n's group.",ch,NULL,victim,TO_VICT,POS_SLEEPING); + act_new("$N joins your group.",ch,NULL,victim,TO_CHAR,POS_SLEEPING); + return; +} + + + +/* + * 'Split' originally by Gnort, God of Chaos. + */ +void do_split( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + char arg1[MAX_INPUT_LENGTH],arg2[MAX_INPUT_LENGTH]; + CHAR_DATA *gch; + int members; + int amount_gold = 0, amount_silver = 0; + int share_gold, share_silver; + int extra_gold, extra_silver; + + argument = one_argument( argument, arg1 ); + one_argument( argument, arg2 ); + + if ( arg1[0] == '\0' ) + { + send_to_char( "Split how much?\n\r", ch ); + return; + } + + amount_silver = atoi( arg1 ); + + if (arg2[0] != '\0') + amount_gold = atoi(arg2); + + if ( amount_gold < 0 || amount_silver < 0) + { + send_to_char( "Your group wouldn't like that.\n\r", ch ); + return; + } + + if ( amount_gold == 0 && amount_silver == 0 ) + { + send_to_char( "You hand out zero coins, but no one notices.\n\r", ch ); + return; + } + + if ( ch->gold < amount_gold || ch->silver < amount_silver) + { + send_to_char( "You don't have that much to split.\n\r", ch ); + return; + } + + members = 0; + for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room ) + { + if ( is_same_group( gch, ch ) && !IS_AFFECTED(gch,AFF_CHARM)) + members++; + } + + if ( members < 2 ) + { + send_to_char( "Just keep it all.\n\r", ch ); + return; + } + + share_silver = amount_silver / members; + extra_silver = amount_silver % members; + + share_gold = amount_gold / members; + extra_gold = amount_gold % members; + + if ( share_gold == 0 && share_silver == 0 ) + { + send_to_char( "Don't even bother, cheapskate.\n\r", ch ); + return; + } + + ch->silver -= amount_silver; + ch->silver += share_silver + extra_silver; + ch->gold -= amount_gold; + ch->gold += share_gold + extra_gold; + + if (share_silver > 0) + { + sprintf(buf, + "You split %d silver coins. Your share is %d silver.\n\r", + amount_silver,share_silver + extra_silver); + send_to_char(buf,ch); + } + + if (share_gold > 0) + { + sprintf(buf, + "You split %d gold coins. Your share is %d gold.\n\r", + amount_gold,share_gold + extra_gold); + send_to_char(buf,ch); + } + + if (share_gold == 0) + { + sprintf(buf,"$n splits %d silver coins. Your share is %d silver.", + amount_silver,share_silver); + } + else if (share_silver == 0) + { + sprintf(buf,"$n splits %d gold coins. Your share is %d gold.", + amount_gold,share_gold); + } + else + { + sprintf(buf, +"$n splits %d silver and %d gold coins, giving you %d silver and %d gold.\n\r", + amount_silver,amount_gold,share_silver,share_gold); + } + + for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room ) + { + if ( gch != ch && is_same_group(gch,ch) && !IS_AFFECTED(gch,AFF_CHARM)) + { + act( buf, ch, NULL, gch, TO_VICT ); + gch->gold += share_gold; + gch->silver += share_silver; + } + } + + return; +} + + + +void do_gtell( CHAR_DATA *ch, char *argument ) +{ + CHAR_DATA *gch; + + if ( argument[0] == '\0' ) + { + send_to_char( "Tell your group what?\n\r", ch ); + return; + } + + if ( IS_SET( ch->comm, COMM_NOTELL ) ) + { + send_to_char( "Your message didn't get through!\n\r", ch ); + return; + } + + for ( gch = char_list; gch != NULL; gch = gch->next ) + { + if ( is_same_group( gch, ch ) ) + act_new("$n tells the group '$t'", + ch,argument,gch,TO_VICT,POS_SLEEPING); + } + + return; +} + +def do_commands( self, rgument ) +{ + char buf[MAX_STRING_LENGTH]; + int cmd; + int col; + + col = 0; + for ( cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++ ) + { + if ( cmd_table[cmd].level < LEVEL_HERO + && cmd_table[cmd].level <= get_trust( ch ) + && cmd_table[cmd].show) + { + sprintf( buf, "%-12s", cmd_table[cmd].name ); + send_to_char( buf, ch ); + if ( ++col % 6 == 0 ) + send_to_char( "\n\r", ch ); + } + } + + if ( col % 6 != 0 ) + send_to_char( "\n\r", ch ); + return; +} + +void do_wizhelp( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + int cmd; + int col; + + col = 0; + for ( cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++ ) + { + if ( cmd_table[cmd].level >= LEVEL_HERO + && cmd_table[cmd].level <= get_trust( ch ) + && cmd_table[cmd].show) + { + sprintf( buf, "%-12s", cmd_table[cmd].name ); + send_to_char( buf, ch ); + if ( ++col % 6 == 0 ) + send_to_char( "\n\r", ch ); + } + } + + if ( col % 6 != 0 ) + send_to_char( "\n\r", ch ); + return; +} + + +/* + * It is very important that this be an equivalence relation: + * (1) A ~ A + * (2) if A ~ B then B ~ A + * (3) if A ~ B and B ~ C, then A ~ C + */ +bool is_same_group( CHAR_DATA *ach, CHAR_DATA *bch ) +{ + if ( ach == NULL || bch == NULL) + return FALSE; + + if ( ach->leader != NULL ) ach = ach->leader; + if ( bch->leader != NULL ) bch = bch->leader; + return ach == bch; +} diff --git a/Rom24/src/act_enter.c b/Rom24/src/act_enter.c new file mode 100644 index 0000000..c9a7f8c --- /dev/null +++ b/Rom24/src/act_enter.c @@ -0,0 +1,214 @@ +/*************************************************************************** + * 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-1998 Russ Taylor * +* ROM has been brought to you by the ROM consortium * +* Russ Taylor (rtaylor@hypercube.org) * +* Gabrielle Taylor (gtaylor@efn.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 * +***************************************************************************/ + +#if defined(macintosh) +#include +#include +#else +#include +#include +#endif +#include +#include +#include +#include "merc.h" +#include "interp.h" + +/* random room generation procedure */ +ROOM_INDEX_DATA *get_random_room(CHAR_DATA *ch) +{ + ROOM_INDEX_DATA *room; + + for ( ; ; ) + { + room = get_room_index( number_range( 0, 65535 ) ); + if ( room != NULL ) + if ( can_see_room(ch,room) + && !room_is_private(room) + && !IS_SET(room->room_flags, ROOM_PRIVATE) + && !IS_SET(room->room_flags, ROOM_SOLITARY) + && !IS_SET(room->room_flags, ROOM_SAFE) + && (IS_NPC(ch) || IS_SET(ch->act,ACT_AGGRESSIVE) + || !IS_SET(room->room_flags,ROOM_LAW))) + break; + } + + return room; +} + +/* RT Enter portals */ +void do_enter( CHAR_DATA *ch, char *argument) +{ + ROOM_INDEX_DATA *location; + + if ( ch->fighting != NULL ) + return; + + /* nifty portal stuff */ + if (argument[0] != '\0') + { + ROOM_INDEX_DATA *old_room; + OBJ_DATA *portal; + CHAR_DATA *fch, *fch_next; + + old_room = ch->in_room; + + portal = get_obj_list( ch, argument, ch->in_room->contents ); + + if (portal == NULL) + { + send_to_char("You don't see that here.\n\r",ch); + return; + } + + if (portal->item_type != ITEM_PORTAL + || (IS_SET(portal->value[1],EX_CLOSED) && !IS_TRUSTED(ch,ANGEL))) + { + send_to_char("You can't seem to find a way in.\n\r",ch); + return; + } + + if (!IS_TRUSTED(ch,ANGEL) && !IS_SET(portal->value[2],GATE_NOCURSE) + && (IS_AFFECTED(ch,AFF_CURSE) + || IS_SET(old_room->room_flags,ROOM_NO_RECALL))) + { + send_to_char("Something prevents you from leaving...\n\r",ch); + return; + } + + if (IS_SET(portal->value[2],GATE_RANDOM) || portal->value[3] == -1) + { + location = get_random_room(ch); + portal->value[3] = location->vnum; /* for record keeping :) */ + } + else if (IS_SET(portal->value[2],GATE_BUGGY) && (number_percent() < 5)) + location = get_random_room(ch); + else + location = get_room_index(portal->value[3]); + + if (location == NULL + || location == old_room + || !can_see_room(ch,location) + || (room_is_private(location) && !IS_TRUSTED(ch,IMPLEMENTOR))) + { + act("$p doesn't seem to go anywhere.",ch,portal,NULL,TO_CHAR); + return; + } + + if (IS_NPC(ch) && IS_SET(ch->act,ACT_AGGRESSIVE) + && IS_SET(location->room_flags,ROOM_LAW)) + { + send_to_char("Something prevents you from leaving...\n\r",ch); + return; + } + + act("$n steps into $p.",ch,portal,NULL,TO_ROOM); + + if (IS_SET(portal->value[2],GATE_NORMAL_EXIT)) + act("You enter $p.",ch,portal,NULL,TO_CHAR); + else + act("You walk through $p and find yourself somewhere else...", + ch,portal,NULL,TO_CHAR); + + char_from_room(ch); + char_to_room(ch, location); + + if (IS_SET(portal->value[2],GATE_GOWITH)) /* take the gate along */ + { + obj_from_room(portal); + obj_to_room(portal,location); + } + + if (IS_SET(portal->value[2],GATE_NORMAL_EXIT)) + act("$n has arrived.",ch,portal,NULL,TO_ROOM); + else + act("$n has arrived through $p.",ch,portal,NULL,TO_ROOM); + + do_function(ch, &do_look, "auto"); + + /* charges */ + if (portal->value[0] > 0) + { + portal->value[0]--; + if (portal->value[0] == 0) + portal->value[0] = -1; + } + + /* protect against circular follows */ + if (old_room == location) + return; + + for ( fch = old_room->people; fch != NULL; fch = fch_next ) + { + fch_next = fch->next_in_room; + + if (portal == NULL || portal->value[0] == -1) + /* no following through dead portals */ + continue; + + if ( fch->master == ch && IS_AFFECTED(fch,AFF_CHARM) + && fch->position < POS_STANDING) + do_function(fch, &do_stand, ""); + + if ( fch->master == ch && fch->position == POS_STANDING) + { + + if (IS_SET(ch->in_room->room_flags,ROOM_LAW) + && (IS_NPC(fch) && IS_SET(fch->act,ACT_AGGRESSIVE))) + { + act("You can't bring $N into the city.", + ch,NULL,fch,TO_CHAR); + act("You aren't allowed in the city.", + fch,NULL,NULL,TO_CHAR); + continue; + } + + act( "You follow $N.", fch, NULL, ch, TO_CHAR ); + do_function(fch, &do_enter, argument); + } + } + + if (portal != NULL && portal->value[0] == -1) + { + act("$p fades out of existence.",ch,portal,NULL,TO_CHAR); + if (ch->in_room == old_room) + act("$p fades out of existence.",ch,portal,NULL,TO_ROOM); + else if (old_room->people != NULL) + { + act("$p fades out of existence.", + old_room->people,portal,NULL,TO_CHAR); + act("$p fades out of existence.", + old_room->people,portal,NULL,TO_ROOM); + } + extract_obj(portal); + } + return; + } + + send_to_char("Nope, can't do it.\n\r",ch); + return; +} diff --git a/Rom24/src/act_info.c b/Rom24/src/act_info.c new file mode 100644 index 0000000..e966f4d --- /dev/null +++ b/Rom24/src/act_info.c @@ -0,0 +1,2755 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +#if defined(macintosh) +#include +#else +#include +#include +#endif +#include +#include +#include +#include +#include +#include "merc.h" +#include "interp.h" +#include "magic.h" +#include "recycle.h" +#include "tables.h" +#include "lookup.h" + +char * const where_name [] = +{ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", +}; + + +/* for keeping track of the player count */ +int max_on = 0; + +/* + * Local functions. + */ +char * format_obj_to_char args( ( OBJ_DATA *obj, CHAR_DATA *ch, + bool fShort ) ); +void show_list_to_char args( ( OBJ_DATA *list, CHAR_DATA *ch, + bool fShort, bool fShowNothing ) ); +void show_char_to_char_0 args( ( CHAR_DATA *victim, CHAR_DATA *ch ) ); +void show_char_to_char_1 args( ( CHAR_DATA *victim, CHAR_DATA *ch ) ); +void show_char_to_char args( ( CHAR_DATA *list, CHAR_DATA *ch ) ); +bool check_blind args( ( CHAR_DATA *ch ) ); + + + +char *format_obj_to_char( OBJ_DATA *obj, CHAR_DATA *ch, bool fShort ) +{ + static char buf[MAX_STRING_LENGTH]; + + buf[0] = '\0'; + + if ((fShort && (obj->short_descr == NULL || obj->short_descr[0] == '\0')) + || (obj->description == NULL || obj->description[0] == '\0')) + return buf; + + if ( IS_OBJ_STAT(obj, ITEM_INVIS) ) strcat( buf, "(Invis) " ); + if ( IS_AFFECTED(ch, AFF_DETECT_EVIL) + && IS_OBJ_STAT(obj, ITEM_EVIL) ) strcat( buf, "(Red Aura) " ); + if (IS_AFFECTED(ch, AFF_DETECT_GOOD) + && IS_OBJ_STAT(obj,ITEM_BLESS)) strcat(buf,"(Blue Aura) " ); + if ( IS_AFFECTED(ch, AFF_DETECT_MAGIC) + && IS_OBJ_STAT(obj, ITEM_MAGIC) ) strcat( buf, "(Magical) " ); + if ( IS_OBJ_STAT(obj, ITEM_GLOW) ) strcat( buf, "(Glowing) " ); + if ( IS_OBJ_STAT(obj, ITEM_HUM) ) strcat( buf, "(Humming) " ); + + if ( fShort ) + { + if ( obj->short_descr != NULL ) + strcat( buf, obj->short_descr ); + } + else + { + if ( obj->description != NULL) + strcat( buf, obj->description ); + } + + return buf; +} + + + +/* + * Show a list to a character. + * Can coalesce duplicated items. + */ +void show_list_to_char( OBJ_DATA *list, CHAR_DATA *ch, bool fShort, bool fShowNothing ) +{ + char buf[MAX_STRING_LENGTH]; + BUFFER *output; + char **prgpstrShow; + int *prgnShow; + char *pstrShow; + OBJ_DATA *obj; + int nShow; + int iShow; + int count; + bool fCombine; + + if ( ch->desc == NULL ) + return; + + /* + * Alloc space for output lines. + */ + output = new_buf(); + + count = 0; + for ( obj = list; obj != NULL; obj = obj->next_content ) + count++; + prgpstrShow = alloc_mem( count * sizeof(char *) ); + prgnShow = alloc_mem( count * sizeof(int) ); + nShow = 0; + + /* + * Format the list of objects. + */ + for ( obj = list; obj != NULL; obj = obj->next_content ) + { + if ( obj->wear_loc == WEAR_NONE && can_see_obj( ch, obj )) + { + pstrShow = format_obj_to_char( obj, ch, fShort ); + + fCombine = FALSE; + + if ( IS_NPC(ch) || IS_SET(ch->comm, COMM_COMBINE) ) + { + /* + * Look for duplicates, case sensitive. + * Matches tend to be near end so run loop backwords. + */ + for ( iShow = nShow - 1; iShow >= 0; iShow-- ) + { + if ( !strcmp( prgpstrShow[iShow], pstrShow ) ) + { + prgnShow[iShow]++; + fCombine = TRUE; + break; + } + } + } + + /* + * Couldn't combine, or didn't want to. + */ + if ( !fCombine ) + { + prgpstrShow [nShow] = str_dup( pstrShow ); + prgnShow [nShow] = 1; + nShow++; + } + } + } + + /* + * Output the formatted list. + */ + for ( iShow = 0; iShow < nShow; iShow++ ) + { + if (prgpstrShow[iShow][0] == '\0') + { + free_string(prgpstrShow[iShow]); + continue; + } + + if ( IS_NPC(ch) || IS_SET(ch->comm, COMM_COMBINE) ) + { + if ( prgnShow[iShow] != 1 ) + { + sprintf( buf, "(%2d) ", prgnShow[iShow] ); + add_buf(output,buf); + } + else + { + add_buf(output," "); + } + } + add_buf(output,prgpstrShow[iShow]); + add_buf(output,"\n\r"); + free_string( prgpstrShow[iShow] ); + } + + if ( fShowNothing && nShow == 0 ) + { + if ( IS_NPC(ch) || IS_SET(ch->comm, COMM_COMBINE) ) + send_to_char( " ", ch ); + send_to_char( "Nothing.\n\r", ch ); + } + page_to_char(buf_string(output),ch); + + /* + * Clean up. + */ + free_buf(output); + free_mem( prgpstrShow, count * sizeof(char *) ); + free_mem( prgnShow, count * sizeof(int) ); + + return; +} + + + +void show_char_to_char_0( CHAR_DATA *victim, CHAR_DATA *ch ) +{ + char buf[MAX_STRING_LENGTH],message[MAX_STRING_LENGTH]; + + buf[0] = '\0'; + + if ( IS_SET(victim->comm,COMM_AFK ) ) strcat( buf, "[AFK] " ); + if ( IS_AFFECTED(victim, AFF_INVISIBLE) ) strcat( buf, "(Invis) " ); + if ( victim->invis_level >= LEVEL_HERO ) strcat( buf, "(Wizi) " ); + if ( IS_AFFECTED(victim, AFF_HIDE) ) strcat( buf, "(Hide) " ); + if ( IS_AFFECTED(victim, AFF_CHARM) ) strcat( buf, "(Charmed) " ); + if ( IS_AFFECTED(victim, AFF_PASS_DOOR) ) strcat( buf, "(Translucent) "); + if ( IS_AFFECTED(victim, AFF_FAERIE_FIRE) ) strcat( buf, "(Pink Aura) " ); + if ( IS_EVIL(victim) + && IS_AFFECTED(ch, AFF_DETECT_EVIL) ) strcat( buf, "(Red Aura) " ); + if ( IS_GOOD(victim) + && IS_AFFECTED(ch, AFF_DETECT_GOOD) ) strcat( buf, "(Golden Aura) "); + if ( IS_AFFECTED(victim, AFF_SANCTUARY) ) strcat( buf, "(White Aura) " ); + if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_KILLER ) ) + strcat( buf, "(KILLER) " ); + if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_THIEF ) ) + strcat( buf, "(THIEF) " ); + if ( victim->position == victim->start_pos && victim->long_descr[0] != '\0' ) + { + strcat( buf, victim->long_descr ); + send_to_char( buf, ch ); + return; + } + + strcat( buf, PERS( victim, ch ) ); + if ( !IS_NPC(victim) && !IS_SET(ch->comm, COMM_BRIEF) + && victim->position == POS_STANDING && ch->on == NULL ) + strcat( buf, victim->pcdata->title ); + + switch ( victim->position ) + { + case POS_DEAD: strcat( buf, " is DEAD!!" ); break; + case POS_MORTAL: strcat( buf, " is mortally wounded." ); break; + case POS_INCAP: strcat( buf, " is incapacitated." ); break; + case POS_STUNNED: strcat( buf, " is lying here stunned." ); break; + case POS_SLEEPING: + if (victim->on != NULL) + { + if (IS_SET(victim->on->value[2],SLEEP_AT)) + { + sprintf(message," is sleeping at %s.", + victim->on->short_descr); + strcat(buf,message); + } + else if (IS_SET(victim->on->value[2],SLEEP_ON)) + { + sprintf(message," is sleeping on %s.", + victim->on->short_descr); + strcat(buf,message); + } + else + { + sprintf(message, " is sleeping in %s.", + victim->on->short_descr); + strcat(buf,message); + } + } + else + strcat(buf," is sleeping here."); + break; + case POS_RESTING: + if (victim->on != NULL) + { + if (IS_SET(victim->on->value[2],REST_AT)) + { + sprintf(message," is resting at %s.", + victim->on->short_descr); + strcat(buf,message); + } + else if (IS_SET(victim->on->value[2],REST_ON)) + { + sprintf(message," is resting on %s.", + victim->on->short_descr); + strcat(buf,message); + } + else + { + sprintf(message, " is resting in %s.", + victim->on->short_descr); + strcat(buf,message); + } + } + else + strcat( buf, " is resting here." ); + break; + case POS_SITTING: + if (victim->on != NULL) + { + if (IS_SET(victim->on->value[2],SIT_AT)) + { + sprintf(message," is sitting at %s.", + victim->on->short_descr); + strcat(buf,message); + } + else if (IS_SET(victim->on->value[2],SIT_ON)) + { + sprintf(message," is sitting on %s.", + victim->on->short_descr); + strcat(buf,message); + } + else + { + sprintf(message, " is sitting in %s.", + victim->on->short_descr); + strcat(buf,message); + } + } + else + strcat(buf, " is sitting here."); + break; + case POS_STANDING: + if (victim->on != NULL) + { + if (IS_SET(victim->on->value[2],STAND_AT)) + { + sprintf(message," is standing at %s.", + victim->on->short_descr); + strcat(buf,message); + } + else if (IS_SET(victim->on->value[2],STAND_ON)) + { + sprintf(message," is standing on %s.", + victim->on->short_descr); + strcat(buf,message); + } + else + { + sprintf(message," is standing in %s.", + victim->on->short_descr); + strcat(buf,message); + } + } + else + strcat( buf, " is here." ); + break; + case POS_FIGHTING: + strcat( buf, " is here, fighting " ); + if ( victim->fighting == NULL ) + strcat( buf, "thin air??" ); + else if ( victim->fighting == ch ) + strcat( buf, "YOU!" ); + else if ( victim->in_room == victim->fighting->in_room ) + { + strcat( buf, PERS( victim->fighting, ch ) ); + strcat( buf, "." ); + } + else + strcat( buf, "someone who left??" ); + break; + } + + strcat( buf, "\n\r" ); + buf[0] = UPPER(buf[0]); + send_to_char( buf, ch ); + return; +} + + + +void show_char_to_char_1( CHAR_DATA *victim, CHAR_DATA *ch ) +{ + char buf[MAX_STRING_LENGTH]; + OBJ_DATA *obj; + int iWear; + int percent; + bool found; + + if ( can_see( victim, ch ) ) + { + if (ch == victim) + act( "$n looks at $mself.",ch,NULL,NULL,TO_ROOM); + else + { + act( "$n looks at you.", ch, NULL, victim, TO_VICT ); + act( "$n looks at $N.", ch, NULL, victim, TO_NOTVICT ); + } + } + + if ( victim->description[0] != '\0' ) + { + send_to_char( victim->description, ch ); + } + else + { + act( "You see nothing special about $M.", ch, NULL, victim, TO_CHAR ); + } + + if ( victim->max_hit > 0 ) + percent = ( 100 * victim->hit ) / victim->max_hit; + else + percent = -1; + + strcpy( buf, PERS(victim, ch) ); + + if (percent >= 100) + strcat( buf, " is in excellent condition.\n\r"); + else if (percent >= 90) + strcat( buf, " has a few scratches.\n\r"); + else if (percent >= 75) + strcat( buf," has some small wounds and bruises.\n\r"); + else if (percent >= 50) + strcat( buf, " has quite a few wounds.\n\r"); + else if (percent >= 30) + strcat( buf, " has some big nasty wounds and scratches.\n\r"); + else if (percent >= 15) + strcat ( buf, " looks pretty hurt.\n\r"); + else if (percent >= 0 ) + strcat (buf, " is in awful condition.\n\r"); + else + strcat(buf, " is bleeding to death.\n\r"); + + buf[0] = UPPER(buf[0]); + send_to_char( buf, ch ); + + found = FALSE; + for ( iWear = 0; iWear < MAX_WEAR; iWear++ ) + { + if ( ( obj = get_eq_char( victim, iWear ) ) != NULL + && can_see_obj( ch, obj ) ) + { + if ( !found ) + { + send_to_char( "\n\r", ch ); + act( "$N is using:", ch, NULL, victim, TO_CHAR ); + found = TRUE; + } + send_to_char( where_name[iWear], ch ); + send_to_char( format_obj_to_char( obj, ch, TRUE ), ch ); + send_to_char( "\n\r", ch ); + } + } + + if ( victim != ch + && !IS_NPC(ch) + && number_percent( ) < get_skill(ch,gsn_peek)) + { + send_to_char( "\n\rYou peek at the inventory:\n\r", ch ); + check_improve(ch,gsn_peek,TRUE,4); + show_list_to_char( victim->carrying, ch, TRUE, TRUE ); + } + + return; +} + + + +void show_char_to_char( CHAR_DATA *list, CHAR_DATA *ch ) +{ + CHAR_DATA *rch; + + for ( rch = list; rch != NULL; rch = rch->next_in_room ) + { + if ( rch == ch ) + continue; + + if ( get_trust(ch) < rch->invis_level) + continue; + + if ( can_see( ch, rch ) ) + { + show_char_to_char_0( rch, ch ); + } + else if ( room_is_dark( ch->in_room ) + && IS_AFFECTED(rch, AFF_INFRARED ) ) + { + send_to_char( "You see glowing red eyes watching YOU!\n\r", ch ); + } + } + + return; +} + + + +bool check_blind( CHAR_DATA *ch ) +{ + + if (!IS_NPC(ch) && IS_SET(ch->act,PLR_HOLYLIGHT)) + return TRUE; + + if ( IS_AFFECTED(ch, AFF_BLIND) ) + { + send_to_char( "You can't see a thing!\n\r", ch ); + return FALSE; + } + + return TRUE; +} + +/* changes your scroll */ +void do_scroll(CHAR_DATA *ch, char *argument) +{ + char arg[MAX_INPUT_LENGTH]; + char buf[100]; + int lines; + + one_argument(argument,arg); + + if (arg[0] == '\0') + { + if (ch->lines == 0) + send_to_char("You do not page long messages.\n\r",ch); + else + { + sprintf(buf,"You currently display %d lines per page.\n\r", + ch->lines + 2); + send_to_char(buf,ch); + } + return; + } + + if (!is_number(arg)) + { + send_to_char("You must provide a number.\n\r",ch); + return; + } + + lines = atoi(arg); + + if (lines == 0) + { + send_to_char("Paging disabled.\n\r",ch); + ch->lines = 0; + return; + } + + if (lines < 10 || lines > 100) + { + send_to_char("You must provide a reasonable number.\n\r",ch); + return; + } + + sprintf(buf,"Scroll set to %d lines.\n\r",lines); + send_to_char(buf,ch); + ch->lines = lines - 2; +} + +/* RT does socials */ +void do_socials(CHAR_DATA *ch, char *argument) +{ + char buf[MAX_STRING_LENGTH]; + int iSocial; + int col; + + col = 0; + + for (iSocial = 0; social_table[iSocial].name[0] != '\0'; iSocial++) + { + sprintf(buf,"%-12s",social_table[iSocial].name); + send_to_char(buf,ch); + if (++col % 6 == 0) + send_to_char("\n\r",ch); + } + + if ( col % 6 != 0) + send_to_char("\n\r",ch); + return; +} + + + +/* RT Commands to replace news, motd, imotd, etc from ROM */ + +void do_motd(CHAR_DATA *ch, char *argument) +{ + do_function(ch, &do_help, "motd"); +} + +void do_imotd(CHAR_DATA *ch, char *argument) +{ + do_function(ch, &do_help, "imotd"); +} + +void do_rules(CHAR_DATA *ch, char *argument) +{ + do_function(ch, &do_help, "rules"); +} + +void do_story(CHAR_DATA *ch, char *argument) +{ + do_function(ch, &do_help, "story"); +} + +void do_wizlist(CHAR_DATA *ch, char *argument) +{ + do_function(ch, &do_help, "wizlist"); +} + +/* RT this following section holds all the auto commands from ROM, as well as + replacements for config */ + +void do_autolist(CHAR_DATA *ch, char *argument) +{ + /* lists most player flags */ + if (IS_NPC(ch)) + return; + + send_to_char(" action status\n\r",ch); + send_to_char("---------------------\n\r",ch); + + send_to_char("autoassist ",ch); + if (IS_SET(ch->act,PLR_AUTOASSIST)) + send_to_char("ON\n\r",ch); + else + send_to_char("OFF\n\r",ch); + + send_to_char("autoexit ",ch); + if (IS_SET(ch->act,PLR_AUTOEXIT)) + send_to_char("ON\n\r",ch); + else + send_to_char("OFF\n\r",ch); + + send_to_char("autogold ",ch); + if (IS_SET(ch->act,PLR_AUTOGOLD)) + send_to_char("ON\n\r",ch); + else + send_to_char("OFF\n\r",ch); + + send_to_char("autoloot ",ch); + if (IS_SET(ch->act,PLR_AUTOLOOT)) + send_to_char("ON\n\r",ch); + else + send_to_char("OFF\n\r",ch); + + send_to_char("autosac ",ch); + if (IS_SET(ch->act,PLR_AUTOSAC)) + send_to_char("ON\n\r",ch); + else + send_to_char("OFF\n\r",ch); + + send_to_char("autosplit ",ch); + if (IS_SET(ch->act,PLR_AUTOSPLIT)) + send_to_char("ON\n\r",ch); + else + send_to_char("OFF\n\r",ch); + + send_to_char("compact mode ",ch); + if (IS_SET(ch->comm,COMM_COMPACT)) + send_to_char("ON\n\r",ch); + else + send_to_char("OFF\n\r",ch); + + send_to_char("prompt ",ch); + if (IS_SET(ch->comm,COMM_PROMPT)) + send_to_char("ON\n\r",ch); + else + send_to_char("OFF\n\r",ch); + + send_to_char("combine items ",ch); + if (IS_SET(ch->comm,COMM_COMBINE)) + send_to_char("ON\n\r",ch); + else + send_to_char("OFF\n\r",ch); + + if (!IS_SET(ch->act,PLR_CANLOOT)) + send_to_char("Your corpse is safe from thieves.\n\r",ch); + else + send_to_char("Your corpse may be looted.\n\r",ch); + + if (IS_SET(ch->act,PLR_NOSUMMON)) + send_to_char("You cannot be summoned.\n\r",ch); + else + send_to_char("You can be summoned.\n\r",ch); + + if (IS_SET(ch->act,PLR_NOFOLLOW)) + send_to_char("You do not welcome followers.\n\r",ch); + else + send_to_char("You accept followers.\n\r",ch); +} + +void do_autoassist(CHAR_DATA *ch, char *argument) +{ + if (IS_NPC(ch)) + return; + + if (IS_SET(ch->act,PLR_AUTOASSIST)) + { + send_to_char("Autoassist removed.\n\r",ch); + REMOVE_BIT(ch->act,PLR_AUTOASSIST); + } + else + { + send_to_char("You will now assist when needed.\n\r",ch); + SET_BIT(ch->act,PLR_AUTOASSIST); + } +} + +void do_autoexit(CHAR_DATA *ch, char *argument) +{ + if (IS_NPC(ch)) + return; + + if (IS_SET(ch->act,PLR_AUTOEXIT)) + { + send_to_char("Exits will no longer be displayed.\n\r",ch); + REMOVE_BIT(ch->act,PLR_AUTOEXIT); + } + else + { + send_to_char("Exits will now be displayed.\n\r",ch); + SET_BIT(ch->act,PLR_AUTOEXIT); + } +} + +void do_autogold(CHAR_DATA *ch, char *argument) +{ + if (IS_NPC(ch)) + return; + + if (IS_SET(ch->act,PLR_AUTOGOLD)) + { + send_to_char("Autogold removed.\n\r",ch); + REMOVE_BIT(ch->act,PLR_AUTOGOLD); + } + else + { + send_to_char("Automatic gold looting set.\n\r",ch); + SET_BIT(ch->act,PLR_AUTOGOLD); + } +} + +void do_autoloot(CHAR_DATA *ch, char *argument) +{ + if (IS_NPC(ch)) + return; + + if (IS_SET(ch->act,PLR_AUTOLOOT)) + { + send_to_char("Autolooting removed.\n\r",ch); + REMOVE_BIT(ch->act,PLR_AUTOLOOT); + } + else + { + send_to_char("Automatic corpse looting set.\n\r",ch); + SET_BIT(ch->act,PLR_AUTOLOOT); + } +} + +void do_autosac(CHAR_DATA *ch, char *argument) +{ + if (IS_NPC(ch)) + return; + + if (IS_SET(ch->act,PLR_AUTOSAC)) + { + send_to_char("Autosacrificing removed.\n\r",ch); + REMOVE_BIT(ch->act,PLR_AUTOSAC); + } + else + { + send_to_char("Automatic corpse sacrificing set.\n\r",ch); + SET_BIT(ch->act,PLR_AUTOSAC); + } +} + +void do_autosplit(CHAR_DATA *ch, char *argument) +{ + if (IS_NPC(ch)) + return; + + if (IS_SET(ch->act,PLR_AUTOSPLIT)) + { + send_to_char("Autosplitting removed.\n\r",ch); + REMOVE_BIT(ch->act,PLR_AUTOSPLIT); + } + else + { + send_to_char("Automatic gold splitting set.\n\r",ch); + SET_BIT(ch->act,PLR_AUTOSPLIT); + } +} + +void do_brief(CHAR_DATA *ch, char *argument) +{ + if (IS_SET(ch->comm,COMM_BRIEF)) + { + send_to_char("Full descriptions activated.\n\r",ch); + REMOVE_BIT(ch->comm,COMM_BRIEF); + } + else + { + send_to_char("Short descriptions activated.\n\r",ch); + SET_BIT(ch->comm,COMM_BRIEF); + } +} + +void do_compact(CHAR_DATA *ch, char *argument) +{ + if (IS_SET(ch->comm,COMM_COMPACT)) + { + send_to_char("Compact mode removed.\n\r",ch); + REMOVE_BIT(ch->comm,COMM_COMPACT); + } + else + { + send_to_char("Compact mode set.\n\r",ch); + SET_BIT(ch->comm,COMM_COMPACT); + } +} + +void do_show(CHAR_DATA *ch, char *argument) +{ + if (IS_SET(ch->comm,COMM_SHOW_AFFECTS)) + { + send_to_char("Affects will no longer be shown in score.\n\r",ch); + REMOVE_BIT(ch->comm,COMM_SHOW_AFFECTS); + } + else + { + send_to_char("Affects will now be shown in score.\n\r",ch); + SET_BIT(ch->comm,COMM_SHOW_AFFECTS); + } +} + +void do_prompt(CHAR_DATA *ch, char *argument) +{ + char buf[MAX_STRING_LENGTH]; + + if ( argument[0] == '\0' ) + { + if (IS_SET(ch->comm,COMM_PROMPT)) + { + send_to_char("You will no longer see prompts.\n\r",ch); + REMOVE_BIT(ch->comm,COMM_PROMPT); + } + else + { + send_to_char("You will now see prompts.\n\r",ch); + SET_BIT(ch->comm,COMM_PROMPT); + } + return; + } + + if( !strcmp( argument, "all" ) ) + strcpy( buf, "<%hhp %mm %vmv> "); + else + { + if ( strlen(argument) > 50 ) + argument[50] = '\0'; + strcpy( buf, argument ); + smash_tilde( buf ); + if (str_suffix("%c",buf)) + strcat(buf," "); + + } + + free_string( ch->prompt ); + ch->prompt = str_dup( buf ); + sprintf(buf,"Prompt set to %s\n\r",ch->prompt ); + send_to_char(buf,ch); + return; +} + +void do_combine(CHAR_DATA *ch, char *argument) +{ + if (IS_SET(ch->comm,COMM_COMBINE)) + { + send_to_char("Long inventory selected.\n\r",ch); + REMOVE_BIT(ch->comm,COMM_COMBINE); + } + else + { + send_to_char("Combined inventory selected.\n\r",ch); + SET_BIT(ch->comm,COMM_COMBINE); + } +} + +void do_noloot(CHAR_DATA *ch, char *argument) +{ + if (IS_NPC(ch)) + return; + + if (IS_SET(ch->act,PLR_CANLOOT)) + { + send_to_char("Your corpse is now safe from thieves.\n\r",ch); + REMOVE_BIT(ch->act,PLR_CANLOOT); + } + else + { + send_to_char("Your corpse may now be looted.\n\r",ch); + SET_BIT(ch->act,PLR_CANLOOT); + } +} + +void do_nofollow(CHAR_DATA *ch, char *argument) +{ + if (IS_NPC(ch)) + return; + + if (IS_SET(ch->act,PLR_NOFOLLOW)) + { + send_to_char("You now accept followers.\n\r",ch); + REMOVE_BIT(ch->act,PLR_NOFOLLOW); + } + else + { + send_to_char("You no longer accept followers.\n\r",ch); + SET_BIT(ch->act,PLR_NOFOLLOW); + die_follower( ch ); + } +} + +void do_nosummon(CHAR_DATA *ch, char *argument) +{ + if (IS_NPC(ch)) + { + if (IS_SET(ch->imm_flags,IMM_SUMMON)) + { + send_to_char("You are no longer immune to summon.\n\r",ch); + REMOVE_BIT(ch->imm_flags,IMM_SUMMON); + } + else + { + send_to_char("You are now immune to summoning.\n\r",ch); + SET_BIT(ch->imm_flags,IMM_SUMMON); + } + } + else + { + if (IS_SET(ch->act,PLR_NOSUMMON)) + { + send_to_char("You are no longer immune to summon.\n\r",ch); + REMOVE_BIT(ch->act,PLR_NOSUMMON); + } + else + { + send_to_char("You are now immune to summoning.\n\r",ch); + SET_BIT(ch->act,PLR_NOSUMMON); + } + } +} + +void do_look( CHAR_DATA *ch, char *argument ) +{ + char buf [MAX_STRING_LENGTH]; + char arg1 [MAX_INPUT_LENGTH]; + char arg2 [MAX_INPUT_LENGTH]; + char arg3 [MAX_INPUT_LENGTH]; + EXIT_DATA *pexit; + CHAR_DATA *victim; + OBJ_DATA *obj; + char *pdesc; + int door; + int number,count; + + if ( ch->desc == NULL ) + return; + + if ( ch->position < POS_SLEEPING ) + { + send_to_char( "You can't see anything but stars!\n\r", ch ); + return; + } + + if ( ch->position == POS_SLEEPING ) + { + send_to_char( "You can't see anything, you're sleeping!\n\r", ch ); + return; + } + + if ( !check_blind( ch ) ) + return; + + if ( !IS_NPC(ch) + && !IS_SET(ch->act, PLR_HOLYLIGHT) + && room_is_dark( ch->in_room ) ) + { + send_to_char( "It is pitch black ... \n\r", ch ); + show_char_to_char( ch->in_room->people, ch ); + return; + } + + argument = one_argument( argument, arg1 ); + argument = one_argument( argument, arg2 ); + number = number_argument(arg1,arg3); + count = 0; + + if ( arg1[0] == '\0' || !str_cmp( arg1, "auto" ) ) + { + /* 'look' or 'look auto' */ + send_to_char( ch->in_room->name, ch ); + + if (IS_IMMORTAL(ch) && (IS_NPC(ch) || IS_SET(ch->act,PLR_HOLYLIGHT))) + { + sprintf(buf," [Room %d]",ch->in_room->vnum); + send_to_char(buf,ch); + } + + send_to_char( "\n\r", ch ); + + if ( arg1[0] == '\0' + || ( !IS_NPC(ch) && !IS_SET(ch->comm, COMM_BRIEF) ) ) + { + send_to_char( " ",ch); + send_to_char( ch->in_room->description, ch ); + } + + if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_AUTOEXIT) ) + { + send_to_char("\n\r",ch); + do_function(ch, &do_exits, "auto" ); + } + + show_list_to_char( ch->in_room->contents, ch, FALSE, FALSE ); + show_char_to_char( ch->in_room->people, ch ); + return; + } + + if ( !str_cmp( arg1, "i" ) || !str_cmp(arg1, "in") || !str_cmp(arg1,"on")) + { + /* 'look in' */ + if ( arg2[0] == '\0' ) + { + send_to_char( "Look in what?\n\r", ch ); + return; + } + + if ( ( obj = get_obj_here( ch, arg2 ) ) == NULL ) + { + send_to_char( "You do not see that here.\n\r", ch ); + return; + } + + switch ( obj->item_type ) + { + default: + send_to_char( "That is not a container.\n\r", ch ); + break; + + case ITEM_DRINK_CON: + if ( obj->value[1] <= 0 ) + { + send_to_char( "It is empty.\n\r", ch ); + break; + } + + sprintf( buf, "It's %sfilled with a %s liquid.\n\r", + obj->value[1] < obj->value[0] / 4 + ? "less than half-" : + obj->value[1] < 3 * obj->value[0] / 4 + ? "about half-" : "more than half-", + liq_table[obj->value[2]].liq_color + ); + + send_to_char( buf, ch ); + break; + + case ITEM_CONTAINER: + case ITEM_CORPSE_NPC: + case ITEM_CORPSE_PC: + if ( IS_SET(obj->value[1], CONT_CLOSED) ) + { + send_to_char( "It is closed.\n\r", ch ); + break; + } + + act( "$p holds:", ch, obj, NULL, TO_CHAR ); + show_list_to_char( obj->contains, ch, TRUE, TRUE ); + break; + } + return; + } + + if ( ( victim = get_char_room( ch, arg1 ) ) != NULL ) + { + show_char_to_char_1( victim, ch ); + return; + } + + for ( obj = ch->carrying; obj != NULL; obj = obj->next_content ) + { + if ( can_see_obj( ch, obj ) ) + { /* player can see object */ + pdesc = get_extra_descr( arg3, obj->extra_descr ); + if ( pdesc != NULL ) + { if (++count == number) + { + send_to_char( pdesc, ch ); + return; + } + else continue; + } + pdesc = get_extra_descr( arg3, obj->pIndexData->extra_descr ); + if ( pdesc != NULL ) + { if (++count == number) + { + send_to_char( pdesc, ch ); + return; + } + else continue; + } + if ( is_name( arg3, obj->name ) ) + if (++count == number) + { + send_to_char( obj->description, ch ); + send_to_char( "\n\r",ch); + return; + } + } + } + + for ( obj = ch->in_room->contents; obj != NULL; obj = obj->next_content ) + { + if ( can_see_obj( ch, obj ) ) + { + pdesc = get_extra_descr( arg3, obj->extra_descr ); + if ( pdesc != NULL ) + if (++count == number) + { + send_to_char( pdesc, ch ); + return; + } + + pdesc = get_extra_descr( arg3, obj->pIndexData->extra_descr ); + if ( pdesc != NULL ) + if (++count == number) + { + send_to_char( pdesc, ch ); + return; + } + + if ( is_name( arg3, obj->name ) ) + if (++count == number) + { + send_to_char( obj->description, ch ); + send_to_char("\n\r",ch); + return; + } + } + } + + pdesc = get_extra_descr(arg3,ch->in_room->extra_descr); + if (pdesc != NULL) + { + if (++count == number) + { + send_to_char(pdesc,ch); + return; + } + } + + if (count > 0 && count != number) + { + if (count == 1) + sprintf(buf,"You only see one %s here.\n\r",arg3); + else + sprintf(buf,"You only see %d of those here.\n\r",count); + + send_to_char(buf,ch); + return; + } + + if ( !str_cmp( arg1, "n" ) || !str_cmp( arg1, "north" ) ) door = 0; + else if ( !str_cmp( arg1, "e" ) || !str_cmp( arg1, "east" ) ) door = 1; + else if ( !str_cmp( arg1, "s" ) || !str_cmp( arg1, "south" ) ) door = 2; + else if ( !str_cmp( arg1, "w" ) || !str_cmp( arg1, "west" ) ) door = 3; + else if ( !str_cmp( arg1, "u" ) || !str_cmp( arg1, "up" ) ) door = 4; + else if ( !str_cmp( arg1, "d" ) || !str_cmp( arg1, "down" ) ) door = 5; + else + { + send_to_char( "You do not see that here.\n\r", ch ); + return; + } + + /* 'look direction' */ + if ( ( pexit = ch->in_room->exit[door] ) == NULL ) + { + send_to_char( "Nothing special there.\n\r", ch ); + return; + } + + if ( pexit->description != NULL && pexit->description[0] != '\0' ) + send_to_char( pexit->description, ch ); + else + send_to_char( "Nothing special there.\n\r", ch ); + + if ( pexit->keyword != NULL + && pexit->keyword[0] != '\0' + && pexit->keyword[0] != ' ' ) + { + if ( IS_SET(pexit->exit_info, EX_CLOSED) ) + { + act( "The $d is closed.", ch, NULL, pexit->keyword, TO_CHAR ); + } + else if ( IS_SET(pexit->exit_info, EX_ISDOOR) ) + { + act( "The $d is open.", ch, NULL, pexit->keyword, TO_CHAR ); + } + } + + return; +} + +/* RT added back for the hell of it */ +void do_read (CHAR_DATA *ch, char *argument ) +{ + do_function(ch, &do_look, argument); +} + +void do_examine( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + char arg[MAX_INPUT_LENGTH]; + OBJ_DATA *obj; + + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + { + send_to_char( "Examine what?\n\r", ch ); + return; + } + + do_function(ch, &do_look, arg ); + + if ( ( obj = get_obj_here( ch, arg ) ) != NULL ) + { + switch ( obj->item_type ) + { + default: + break; + + case ITEM_JUKEBOX: + do_function(ch, &do_play, "list"); + break; + + case ITEM_MONEY: + if (obj->value[0] == 0) + { + if (obj->value[1] == 0) + sprintf(buf,"Odd...there's no coins in the pile.\n\r"); + else if (obj->value[1] == 1) + sprintf(buf,"Wow. One gold coin.\n\r"); + else + sprintf(buf,"There are %d gold coins in the pile.\n\r", + obj->value[1]); + } + else if (obj->value[1] == 0) + { + if (obj->value[0] == 1) + sprintf(buf,"Wow. One silver coin.\n\r"); + else + sprintf(buf,"There are %d silver coins in the pile.\n\r", + obj->value[0]); + } + else + sprintf(buf, + "There are %d gold and %d silver coins in the pile.\n\r", + obj->value[1],obj->value[0]); + send_to_char(buf,ch); + break; + + case ITEM_DRINK_CON: + case ITEM_CONTAINER: + case ITEM_CORPSE_NPC: + case ITEM_CORPSE_PC: + sprintf(buf,"in %s",argument); + do_function(ch, &do_look, buf ); + } + } + + return; +} + + + +/* + * Thanks to Zrin for auto-exit part. + */ +void do_exits( CHAR_DATA *ch, char *argument ) +{ + extern char * const dir_name[]; + char buf[MAX_STRING_LENGTH]; + EXIT_DATA *pexit; + bool found; + bool fAuto; + int door; + + fAuto = !str_cmp( argument, "auto" ); + + if ( !check_blind( ch ) ) + return; + + if (fAuto) + sprintf(buf,"[Exits:"); + else if (IS_IMMORTAL(ch)) + sprintf(buf,"Obvious exits from room %d:\n\r",ch->in_room->vnum); + else + sprintf(buf,"Obvious exits:\n\r"); + + found = FALSE; + for ( door = 0; door <= 5; door++ ) + { + if ( ( pexit = ch->in_room->exit[door] ) != NULL + && pexit->u1.to_room != NULL + && can_see_room(ch,pexit->u1.to_room) + && !IS_SET(pexit->exit_info, EX_CLOSED) ) + { + found = TRUE; + if ( fAuto ) + { + strcat( buf, " " ); + strcat( buf, dir_name[door] ); + } + else + { + sprintf( buf + strlen(buf), "%-5s - %s", + capitalize( dir_name[door] ), + room_is_dark( pexit->u1.to_room ) + ? "Too dark to tell" + : pexit->u1.to_room->name + ); + if (IS_IMMORTAL(ch)) + sprintf(buf + strlen(buf), + " (room %d)\n\r",pexit->u1.to_room->vnum); + else + sprintf(buf + strlen(buf), "\n\r"); + } + } + } + + if ( !found ) + strcat( buf, fAuto ? " none" : "None.\n\r" ); + + if ( fAuto ) + strcat( buf, "]\n\r" ); + + send_to_char( buf, ch ); + return; +} + +void do_worth( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + + if (IS_NPC(ch)) + { + sprintf(buf,"You have %ld gold and %ld silver.\n\r", + ch->gold,ch->silver); + send_to_char(buf,ch); + return; + } + + sprintf(buf, + "You have %ld gold, %ld silver, and %d experience (%d exp to level).\n\r", + ch->gold, ch->silver,ch->exp, + (ch->level + 1) * exp_per_level(ch,ch->pcdata->points) - ch->exp); + + send_to_char(buf,ch); + + return; +} + + +void do_score( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + int i; + + sprintf( buf, + "You are %s%s, level %d, %d years old (%d hours).\n\r", + ch->name, + IS_NPC(ch) ? "" : ch->pcdata->title, + ch->level, get_age(ch), + ( ch->played + (int) (current_time - ch->logon) ) / 3600); + send_to_char( buf, ch ); + + if ( get_trust( ch ) != ch->level ) + { + sprintf( buf, "You are trusted at level %d.\n\r", + get_trust( ch ) ); + send_to_char( buf, ch ); + } + + sprintf(buf, "Race: %s Sex: %s Class: %s\n\r", + race_table[ch->race].name, + ch->sex == 0 ? "sexless" : ch->sex == 1 ? "male" : "female", + IS_NPC(ch) ? "mobile" : class_table[ch->class].name); + send_to_char(buf,ch); + + + sprintf( buf, + "You have %d/%d hit, %d/%d mana, %d/%d movement.\n\r", + ch->hit, ch->max_hit, + ch->mana, ch->max_mana, + ch->move, ch->max_move); + send_to_char( buf, ch ); + + sprintf( buf, + "You have %d practices and %d training sessions.\n\r", + ch->practice, ch->train); + send_to_char( buf, ch ); + + sprintf( buf, + "You are carrying %d/%d items with weight %ld/%d pounds.\n\r", + ch->carry_number, can_carry_n(ch), + get_carry_weight(ch) / 10, can_carry_w(ch) /10 ); + send_to_char( buf, ch ); + + sprintf( buf, + "Str: %d(%d) Int: %d(%d) Wis: %d(%d) Dex: %d(%d) Con: %d(%d)\n\r", + ch->perm_stat[STAT_STR], + get_curr_stat(ch,STAT_STR), + ch->perm_stat[STAT_INT], + get_curr_stat(ch,STAT_INT), + ch->perm_stat[STAT_WIS], + get_curr_stat(ch,STAT_WIS), + ch->perm_stat[STAT_DEX], + get_curr_stat(ch,STAT_DEX), + ch->perm_stat[STAT_CON], + get_curr_stat(ch,STAT_CON) ); + send_to_char( buf, ch ); + + sprintf( buf, + "You have scored %d exp, and have %ld gold and %ld silver coins.\n\r", + ch->exp, ch->gold, ch->silver ); + send_to_char( buf, ch ); + + /* RT shows exp to level */ + if (!IS_NPC(ch) && ch->level < LEVEL_HERO) + { + sprintf (buf, + "You need %d exp to level.\n\r", + ((ch->level + 1) * exp_per_level(ch,ch->pcdata->points) - ch->exp)); + send_to_char( buf, ch ); + } + + sprintf( buf, "Wimpy set to %d hit points.\n\r", ch->wimpy ); + send_to_char( buf, ch ); + + if ( !IS_NPC(ch) && ch->pcdata->condition[COND_DRUNK] > 10 ) + send_to_char( "You are drunk.\n\r", ch ); + if ( !IS_NPC(ch) && ch->pcdata->condition[COND_THIRST] == 0 ) + send_to_char( "You are thirsty.\n\r", ch ); + if ( !IS_NPC(ch) && ch->pcdata->condition[COND_HUNGER] == 0 ) + send_to_char( "You are hungry.\n\r", ch ); + + switch ( ch->position ) + { + case POS_DEAD: + send_to_char( "You are DEAD!!\n\r", ch ); + break; + case POS_MORTAL: + send_to_char( "You are mortally wounded.\n\r", ch ); + break; + case POS_INCAP: + send_to_char( "You are incapacitated.\n\r", ch ); + break; + case POS_STUNNED: + send_to_char( "You are stunned.\n\r", ch ); + break; + case POS_SLEEPING: + send_to_char( "You are sleeping.\n\r", ch ); + break; + case POS_RESTING: + send_to_char( "You are resting.\n\r", ch ); + break; + case POS_SITTING: + send_to_char( "You are sitting.\n\r", ch ); + break; + case POS_STANDING: + send_to_char( "You are standing.\n\r", ch ); + break; + case POS_FIGHTING: + send_to_char( "You are fighting.\n\r", ch ); + break; + } + + + /* print AC values */ + if (ch->level >= 25) + { + sprintf( buf,"Armor: pierce: %d bash: %d slash: %d magic: %d\n\r", + GET_AC(ch,AC_PIERCE), + GET_AC(ch,AC_BASH), + GET_AC(ch,AC_SLASH), + GET_AC(ch,AC_EXOTIC)); + send_to_char(buf,ch); + } + + for (i = 0; i < 4; i++) + { + char * temp; + + switch(i) + { + case(AC_PIERCE): temp = "piercing"; break; + case(AC_BASH): temp = "bashing"; break; + case(AC_SLASH): temp = "slashing"; break; + case(AC_EXOTIC): temp = "magic"; break; + default: temp = "error"; break; + } + + send_to_char("You are ", ch); + + if (GET_AC(ch,i) >= 101 ) + sprintf(buf,"hopelessly vulnerable to %s.\n\r",temp); + else if (GET_AC(ch,i) >= 80) + sprintf(buf,"defenseless against %s.\n\r",temp); + else if (GET_AC(ch,i) >= 60) + sprintf(buf,"barely protected from %s.\n\r",temp); + else if (GET_AC(ch,i) >= 40) + sprintf(buf,"slightly armored against %s.\n\r",temp); + else if (GET_AC(ch,i) >= 20) + sprintf(buf,"somewhat armored against %s.\n\r",temp); + else if (GET_AC(ch,i) >= 0) + sprintf(buf,"armored against %s.\n\r",temp); + else if (GET_AC(ch,i) >= -20) + sprintf(buf,"well-armored against %s.\n\r",temp); + else if (GET_AC(ch,i) >= -40) + sprintf(buf,"very well-armored against %s.\n\r",temp); + else if (GET_AC(ch,i) >= -60) + sprintf(buf,"heavily armored against %s.\n\r",temp); + else if (GET_AC(ch,i) >= -80) + sprintf(buf,"superbly armored against %s.\n\r",temp); + else if (GET_AC(ch,i) >= -100) + sprintf(buf,"almost invulnerable to %s.\n\r",temp); + else + sprintf(buf,"divinely armored against %s.\n\r",temp); + + send_to_char(buf,ch); + } + + + /* RT wizinvis and holy light */ + if ( IS_IMMORTAL(ch)) + { + send_to_char("Holy Light: ",ch); + if (IS_SET(ch->act,PLR_HOLYLIGHT)) + send_to_char("on",ch); + else + send_to_char("off",ch); + + if (ch->invis_level) + { + sprintf( buf, " Invisible: level %d",ch->invis_level); + send_to_char(buf,ch); + } + + if (ch->incog_level) + { + sprintf(buf," Incognito: level %d",ch->incog_level); + send_to_char(buf,ch); + } + send_to_char("\n\r",ch); + } + + if ( ch->level >= 15 ) + { + sprintf( buf, "Hitroll: %d Damroll: %d.\n\r", + GET_HITROLL(ch), GET_DAMROLL(ch) ); + send_to_char( buf, ch ); + } + + if ( ch->level >= 10 ) + { + sprintf( buf, "Alignment: %d. ", ch->alignment ); + send_to_char( buf, ch ); + } + + send_to_char( "You are ", ch ); + if ( ch->alignment > 900 ) send_to_char( "angelic.\n\r", ch ); + else if ( ch->alignment > 700 ) send_to_char( "saintly.\n\r", ch ); + else if ( ch->alignment > 350 ) send_to_char( "good.\n\r", ch ); + else if ( ch->alignment > 100 ) send_to_char( "kind.\n\r", ch ); + else if ( ch->alignment > -100 ) send_to_char( "neutral.\n\r", ch ); + else if ( ch->alignment > -350 ) send_to_char( "mean.\n\r", ch ); + else if ( ch->alignment > -700 ) send_to_char( "evil.\n\r", ch ); + else if ( ch->alignment > -900 ) send_to_char( "demonic.\n\r", ch ); + else send_to_char( "satanic.\n\r", ch ); + + if (IS_SET(ch->comm,COMM_SHOW_AFFECTS)) + do_function(ch, &do_affects, ""); +} + +void do_affects(CHAR_DATA *ch, char *argument ) +{ + AFFECT_DATA *paf, *paf_last = NULL; + char buf[MAX_STRING_LENGTH]; + + if ( ch->affected != NULL ) + { + send_to_char( "You are affected by the following spells:\n\r", ch ); + for ( paf = ch->affected; paf != NULL; paf = paf->next ) + { + if (paf_last != NULL && paf->type == paf_last->type) + if (ch->level >= 20) + sprintf( buf, " "); + else + continue; + else + sprintf( buf, "Spell: %-15s", skill_table[paf->type].name ); + + send_to_char( buf, ch ); + + if ( ch->level >= 20 ) + { + sprintf( buf, + ": modifies %s by %d ", + affect_loc_name( paf->location ), + paf->modifier); + send_to_char( buf, ch ); + if ( paf->duration == -1 ) + sprintf( buf, "permanently" ); + else + sprintf( buf, "for %d hours", paf->duration ); + send_to_char( buf, ch ); + } + + send_to_char( "\n\r", ch ); + paf_last = paf; + } + } + else + send_to_char("You are not affected by any spells.\n\r",ch); + + return; +} + + + +char * const day_name [] = +{ + "the Moon", "the Bull", "Deception", "Thunder", "Freedom", + "the Great Gods", "the Sun" +}; + +char * const month_name [] = +{ + "Winter", "the Winter Wolf", "the Frost Giant", "the Old Forces", + "the Grand Struggle", "the Spring", "Nature", "Futility", "the Dragon", + "the Sun", "the Heat", "the Battle", "the Dark Shades", "the Shadows", + "the Long Shadows", "the Ancient Darkness", "the Great Evil" +}; + +void do_time( CHAR_DATA *ch, char *argument ) +{ + extern char str_boot_time[]; + char buf[MAX_STRING_LENGTH]; + char *suf; + int day; + + day = time_info.day + 1; + + if ( day > 4 && day < 20 ) suf = "th"; + else if ( day % 10 == 1 ) suf = "st"; + else if ( day % 10 == 2 ) suf = "nd"; + else if ( day % 10 == 3 ) suf = "rd"; + else suf = "th"; + + sprintf( buf, + "It is %d o'clock %s, Day of %s, %d%s the Month of %s.\n\r", + (time_info.hour % 12 == 0) ? 12 : time_info.hour %12, + time_info.hour >= 12 ? "pm" : "am", + day_name[day % 7], + day, suf, + month_name[time_info.month]); + send_to_char(buf,ch); + sprintf(buf,"ROM started up at %s\n\rThe system time is %s.\n\r", + str_boot_time, + (char *) ctime( ¤t_time ) + ); + + send_to_char( buf, ch ); + return; +} + + + +void do_weather( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + + static char * const sky_look[4] = + { + "cloudless", + "cloudy", + "rainy", + "lit by flashes of lightning" + }; + + if ( !IS_OUTSIDE(ch) ) + { + send_to_char( "You can't see the weather indoors.\n\r", ch ); + return; + } + + sprintf( buf, "The sky is %s and %s.\n\r", + sky_look[weather_info.sky], + weather_info.change >= 0 + ? "a warm southerly breeze blows" + : "a cold northern gust blows" + ); + send_to_char( buf, ch ); + return; +} + +void do_help( CHAR_DATA *ch, char *argument ) +{ + HELP_DATA *pHelp; + BUFFER *output; + bool found = FALSE; + char argall[MAX_INPUT_LENGTH],argone[MAX_INPUT_LENGTH]; + int level; + + output = new_buf(); + + if ( argument[0] == '\0' ) + argument = "summary"; + + /* this parts handles help a b so that it returns help 'a b' */ + argall[0] = '\0'; + while (argument[0] != '\0' ) + { + argument = one_argument(argument,argone); + if (argall[0] != '\0') + strcat(argall," "); + strcat(argall,argone); + } + + for ( pHelp = help_first; pHelp != NULL; pHelp = pHelp->next ) + { + level = (pHelp->level < 0) ? -1 * pHelp->level - 1 : pHelp->level; + + if (level > get_trust( ch ) ) + continue; + + if ( is_name( argall, pHelp->keyword ) ) + { + /* add seperator if found */ + if (found) + add_buf(output, + "\n\r============================================================\n\r\n\r"); + if ( pHelp->level >= 0 && str_cmp( argall, "imotd" ) ) + { + add_buf(output,pHelp->keyword); + add_buf(output,"\n\r"); + } + + /* + * Strip leading '.' to allow initial blanks. + */ + if ( pHelp->text[0] == '.' ) + add_buf(output,pHelp->text+1); + else + add_buf(output,pHelp->text); + found = TRUE; + /* small hack :) */ + if (ch->desc != NULL && ch->desc->connected != CON_PLAYING + && ch->desc->connected != CON_GEN_GROUPS) + break; + } + } + + if (!found) + send_to_char( "No help on that word.\n\r", ch ); + else + page_to_char(buf_string(output),ch); + free_buf(output); +} + + +/* whois command */ +void do_whois (CHAR_DATA *ch, char *argument) +{ + char arg[MAX_INPUT_LENGTH]; + BUFFER *output; + char buf[MAX_STRING_LENGTH]; + DESCRIPTOR_DATA *d; + bool found = FALSE; + + one_argument(argument,arg); + + if (arg[0] == '\0') + { + send_to_char("You must provide a name.\n\r",ch); + return; + } + + output = new_buf(); + + for (d = descriptor_list; d != NULL; d = d->next) + { + CHAR_DATA *wch; + char const *class; + + if (d->connected != CON_PLAYING || !can_see(ch,d->character)) + continue; + + wch = ( d->original != NULL ) ? d->original : d->character; + + if (!can_see(ch,wch)) + continue; + + if (!str_prefix(arg,wch->name)) + { + found = TRUE; + + /* work out the printing */ + class = class_table[wch->class].who_name; + switch(wch->level) + { + case MAX_LEVEL - 0 : class = "IMP"; break; + case MAX_LEVEL - 1 : class = "CRE"; break; + case MAX_LEVEL - 2 : class = "SUP"; break; + case MAX_LEVEL - 3 : class = "DEI"; break; + case MAX_LEVEL - 4 : class = "GOD"; break; + case MAX_LEVEL - 5 : class = "IMM"; break; + case MAX_LEVEL - 6 : class = "DEM"; break; + case MAX_LEVEL - 7 : class = "ANG"; break; + case MAX_LEVEL - 8 : class = "AVA"; break; + } + + /* a little formatting */ + sprintf(buf, "[%2d %6s %s] %s%s%s%s%s%s%s%s\n\r", + wch->level, + wch->race < MAX_PC_RACE ? pc_race_table[wch->race].who_name + : " ", + class, + wch->incog_level >= LEVEL_HERO ? "(Incog) ": "", + wch->invis_level >= LEVEL_HERO ? "(Wizi) " : "", + clan_table[wch->clan].who_name, + IS_SET(wch->comm, COMM_AFK) ? "[AFK] " : "", + IS_SET(wch->act,PLR_KILLER) ? "(KILLER) " : "", + IS_SET(wch->act,PLR_THIEF) ? "(THIEF) " : "", + wch->name, IS_NPC(wch) ? "" : wch->pcdata->title); + add_buf(output,buf); + } + } + + if (!found) + { + send_to_char("No one of that name is playing.\n\r",ch); + return; + } + + page_to_char(buf_string(output),ch); + free_buf(output); +} + + +/* + * New 'who' command originally by Alander of Rivers of Mud. + */ +void do_who( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + char buf2[MAX_STRING_LENGTH]; + BUFFER *output; + DESCRIPTOR_DATA *d; + int iClass; + int iRace; + int iClan; + int iLevelLower; + int iLevelUpper; + int nNumber; + int nMatch; + bool rgfClass[MAX_CLASS]; + bool rgfRace[MAX_PC_RACE]; + bool rgfClan[MAX_CLAN]; + bool fClassRestrict = FALSE; + bool fClanRestrict = FALSE; + bool fClan = FALSE; + bool fRaceRestrict = FALSE; + bool fImmortalOnly = FALSE; + + /* + * Set default arguments. + */ + iLevelLower = 0; + iLevelUpper = MAX_LEVEL; + for ( iClass = 0; iClass < MAX_CLASS; iClass++ ) + rgfClass[iClass] = FALSE; + for ( iRace = 0; iRace < MAX_PC_RACE; iRace++ ) + rgfRace[iRace] = FALSE; + for (iClan = 0; iClan < MAX_CLAN; iClan++) + rgfClan[iClan] = FALSE; + + /* + * Parse arguments. + */ + nNumber = 0; + for ( ;; ) + { + char arg[MAX_STRING_LENGTH]; + + argument = one_argument( argument, arg ); + if ( arg[0] == '\0' ) + break; + + if ( is_number( arg ) ) + { + switch ( ++nNumber ) + { + case 1: iLevelLower = atoi( arg ); break; + case 2: iLevelUpper = atoi( arg ); break; + default: + send_to_char( "Only two level numbers allowed.\n\r", ch ); + return; + } + } + else + { + + /* + * Look for classes to turn on. + */ + if (!str_prefix(arg,"immortals")) + { + fImmortalOnly = TRUE; + } + else + { + iClass = class_lookup(arg); + if (iClass == -1) + { + iRace = race_lookup(arg); + + if (iRace == 0 || iRace >= MAX_PC_RACE) + { + if (!str_prefix(arg,"clan")) + fClan = TRUE; + else + { + iClan = clan_lookup(arg); + if (iClan) + { + fClanRestrict = TRUE; + rgfClan[iClan] = TRUE; + } + else + { + send_to_char( + "That's not a valid race, class, or clan.\n\r", + ch); + return; + } + } + } + else + { + fRaceRestrict = TRUE; + rgfRace[iRace] = TRUE; + } + } + else + { + fClassRestrict = TRUE; + rgfClass[iClass] = TRUE; + } + } + } + } + + /* + * Now show matching chars. + */ + nMatch = 0; + buf[0] = '\0'; + output = new_buf(); + for ( d = descriptor_list; d != NULL; d = d->next ) + { + CHAR_DATA *wch; + char const *class; + + /* + * Check for match against restrictions. + * Don't use trust as that exposes trusted mortals. + */ + if ( d->connected != CON_PLAYING || !can_see( ch, d->character ) ) + continue; + + wch = ( d->original != NULL ) ? d->original : d->character; + + if (!can_see(ch,wch)) + continue; + + if ( wch->level < iLevelLower + || wch->level > iLevelUpper + || ( fImmortalOnly && wch->level < LEVEL_IMMORTAL ) + || ( fClassRestrict && !rgfClass[wch->class] ) + || ( fRaceRestrict && !rgfRace[wch->race]) + || ( fClan && !is_clan(wch)) + || ( fClanRestrict && !rgfClan[wch->clan])) + continue; + + nMatch++; + + /* + * Figure out what to print for class. + */ + class = class_table[wch->class].who_name; + switch ( wch->level ) + { + default: break; + { + case MAX_LEVEL - 0 : class = "IMP"; break; + case MAX_LEVEL - 1 : class = "CRE"; break; + case MAX_LEVEL - 2 : class = "SUP"; break; + case MAX_LEVEL - 3 : class = "DEI"; break; + case MAX_LEVEL - 4 : class = "GOD"; break; + case MAX_LEVEL - 5 : class = "IMM"; break; + case MAX_LEVEL - 6 : class = "DEM"; break; + case MAX_LEVEL - 7 : class = "ANG"; break; + case MAX_LEVEL - 8 : class = "AVA"; break; + } + } + + /* + * Format it up. + */ + sprintf( buf, "[%2d %6s %s] %s%s%s%s%s%s%s%s\n\r", + wch->level, + wch->race < MAX_PC_RACE ? pc_race_table[wch->race].who_name + : " ", + class, + wch->incog_level >= LEVEL_HERO ? "(Incog) " : "", + wch->invis_level >= LEVEL_HERO ? "(Wizi) " : "", + clan_table[wch->clan].who_name, + IS_SET(wch->comm, COMM_AFK) ? "[AFK] " : "", + IS_SET(wch->act, PLR_KILLER) ? "(KILLER) " : "", + IS_SET(wch->act, PLR_THIEF) ? "(THIEF) " : "", + wch->name, + IS_NPC(wch) ? "" : wch->pcdata->title ); + add_buf(output,buf); + } + + sprintf( buf2, "\n\rPlayers found: %d\n\r", nMatch ); + add_buf(output,buf2); + page_to_char( buf_string(output), ch ); + free_buf(output); + return; +} + +void do_count ( CHAR_DATA *ch, char *argument ) +{ + int count; + DESCRIPTOR_DATA *d; + char buf[MAX_STRING_LENGTH]; + + count = 0; + + for ( d = descriptor_list; d != NULL; d = d->next ) + if ( d->connected == CON_PLAYING && can_see( ch, d->character ) ) + count++; + + max_on = UMAX(count,max_on); + + if (max_on == count) + sprintf(buf,"There are %d characters on, the most so far today.\n\r", + count); + else + sprintf(buf,"There are %d characters on, the most on today was %d.\n\r", + count,max_on); + + send_to_char(buf,ch); +} + +void do_inventory( CHAR_DATA *ch, char *argument ) +{ + send_to_char( "You are carrying:\n\r", ch ); + show_list_to_char( ch->carrying, ch, TRUE, TRUE ); + return; +} + + + +void do_equipment( CHAR_DATA *ch, char *argument ) +{ + OBJ_DATA *obj; + int iWear; + bool found; + + send_to_char( "You are using:\n\r", ch ); + found = FALSE; + for ( iWear = 0; iWear < MAX_WEAR; iWear++ ) + { + if ( ( obj = get_eq_char( ch, iWear ) ) == NULL ) + continue; + + send_to_char( where_name[iWear], ch ); + if ( can_see_obj( ch, obj ) ) + { + send_to_char( format_obj_to_char( obj, ch, TRUE ), ch ); + send_to_char( "\n\r", ch ); + } + else + { + send_to_char( "something.\n\r", ch ); + } + found = TRUE; + } + + if ( !found ) + send_to_char( "Nothing.\n\r", ch ); + + return; +} + + + +void do_compare( CHAR_DATA *ch, char *argument ) +{ + char arg1[MAX_INPUT_LENGTH]; + char arg2[MAX_INPUT_LENGTH]; + OBJ_DATA *obj1; + OBJ_DATA *obj2; + int value1; + int value2; + char *msg; + + argument = one_argument( argument, arg1 ); + argument = one_argument( argument, arg2 ); + if ( arg1[0] == '\0' ) + { + send_to_char( "Compare what to what?\n\r", ch ); + return; + } + + if ( ( obj1 = get_obj_carry( ch, arg1, ch ) ) == NULL ) + { + send_to_char( "You do not have that item.\n\r", ch ); + return; + } + + if (arg2[0] == '\0') + { + for (obj2 = ch->carrying; obj2 != NULL; obj2 = obj2->next_content) + { + if (obj2->wear_loc != WEAR_NONE + && can_see_obj(ch,obj2) + && obj1->item_type == obj2->item_type + && (obj1->wear_flags & obj2->wear_flags & ~ITEM_TAKE) != 0 ) + break; + } + + if (obj2 == NULL) + { + send_to_char("You aren't wearing anything comparable.\n\r",ch); + return; + } + } + + else if ( (obj2 = get_obj_carry(ch,arg2,ch) ) == NULL ) + { + send_to_char("You do not have that item.\n\r",ch); + return; + } + + msg = NULL; + value1 = 0; + value2 = 0; + + if ( obj1 == obj2 ) + { + msg = "You compare $p to itself. It looks about the same."; + } + else if ( obj1->item_type != obj2->item_type ) + { + msg = "You can't compare $p and $P."; + } + else + { + switch ( obj1->item_type ) + { + default: + msg = "You can't compare $p and $P."; + break; + + case ITEM_ARMOR: + value1 = obj1->value[0] + obj1->value[1] + obj1->value[2]; + value2 = obj2->value[0] + obj2->value[1] + obj2->value[2]; + break; + + case ITEM_WEAPON: + if (obj1->pIndexData->new_format) + value1 = (1 + obj1->value[2]) * obj1->value[1]; + else + value1 = obj1->value[1] + obj1->value[2]; + + if (obj2->pIndexData->new_format) + value2 = (1 + obj2->value[2]) * obj2->value[1]; + else + value2 = obj2->value[1] + obj2->value[2]; + break; + } + } + + if ( msg == NULL ) + { + if ( value1 == value2 ) msg = "$p and $P look about the same."; + else if ( value1 > value2 ) msg = "$p looks better than $P."; + else msg = "$p looks worse than $P."; + } + + act( msg, ch, obj1, obj2, TO_CHAR ); + return; +} + + + +void do_credits( CHAR_DATA *ch, char *argument ) +{ + do_function(ch, &do_help, "diku" ); + return; +} + + + +void do_where( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + char arg[MAX_INPUT_LENGTH]; + CHAR_DATA *victim; + DESCRIPTOR_DATA *d; + bool found; + + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + { + send_to_char( "Players near you:\n\r", ch ); + found = FALSE; + for ( d = descriptor_list; d; d = d->next ) + { + if ( d->connected == CON_PLAYING + && ( victim = d->character ) != NULL + && !IS_NPC(victim) + && victim->in_room != NULL + && !IS_SET(victim->in_room->room_flags,ROOM_NOWHERE) + && (is_room_owner(ch,victim->in_room) + || !room_is_private(victim->in_room)) + && victim->in_room->area == ch->in_room->area + && can_see( ch, victim ) ) + { + found = TRUE; + sprintf( buf, "%-28s %s\n\r", + victim->name, victim->in_room->name ); + send_to_char( buf, ch ); + } + } + if ( !found ) + send_to_char( "None\n\r", ch ); + } + else + { + found = FALSE; + for ( victim = char_list; victim != NULL; victim = victim->next ) + { + if ( victim->in_room != NULL + && victim->in_room->area == ch->in_room->area + && !IS_AFFECTED(victim, AFF_HIDE) + && !IS_AFFECTED(victim, AFF_SNEAK) + && can_see( ch, victim ) + && is_name( arg, victim->name ) ) + { + found = TRUE; + sprintf( buf, "%-28s %s\n\r", + PERS(victim, ch), victim->in_room->name ); + send_to_char( buf, ch ); + break; + } + } + if ( !found ) + act( "You didn't find any $T.", ch, NULL, arg, TO_CHAR ); + } + + return; +} + + + + +void do_consider( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + CHAR_DATA *victim; + char *msg; + int diff; + + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + { + send_to_char( "Consider killing whom?\n\r", ch ); + return; + } + + if ( ( victim = get_char_room( ch, arg ) ) == NULL ) + { + send_to_char( "They're not here.\n\r", ch ); + return; + } + + if (is_safe(ch,victim)) + { + send_to_char("Don't even think about it.\n\r",ch); + return; + } + + diff = victim->level - ch->level; + + if ( diff <= -10 ) msg = "You can kill $N naked and weaponless."; + else if ( diff <= -5 ) msg = "$N is no match for you."; + else if ( diff <= -2 ) msg = "$N looks like an easy kill."; + else if ( diff <= 1 ) msg = "The perfect match!"; + else if ( diff <= 4 ) msg = "$N says 'Do you feel lucky, punk?'."; + else if ( diff <= 9 ) msg = "$N laughs at you mercilessly."; + else msg = "Death will thank you for your gift."; + + act( msg, ch, NULL, victim, TO_CHAR ); + return; +} + + + +void set_title( CHAR_DATA *ch, char *title ) +{ + char buf[MAX_STRING_LENGTH]; + + if ( IS_NPC(ch) ) + { + bug( "Set_title: NPC.", 0 ); + return; + } + + if ( title[0] != '.' && title[0] != ',' && title[0] != '!' && title[0] != '?' ) + { + buf[0] = ' '; + strcpy( buf+1, title ); + } + else + { + strcpy( buf, title ); + } + + free_string( ch->pcdata->title ); + ch->pcdata->title = str_dup( buf ); + return; +} + + + +void do_title( CHAR_DATA *ch, char *argument ) +{ + if ( IS_NPC(ch) ) + return; + + if ( argument[0] == '\0' ) + { + send_to_char( "Change your title to what?\n\r", ch ); + return; + } + + if ( strlen(argument) > 45 ) + argument[45] = '\0'; + + smash_tilde( argument ); + set_title( ch, argument ); + send_to_char( "Ok.\n\r", ch ); +} + + + +void do_description( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + + if ( argument[0] != '\0' ) + { + buf[0] = '\0'; + smash_tilde( argument ); + + if (argument[0] == '-') + { + int len; + bool found = FALSE; + + if (ch->description == NULL || ch->description[0] == '\0') + { + send_to_char("No lines left to remove.\n\r",ch); + return; + } + + strcpy(buf,ch->description); + + for (len = strlen(buf); len > 0; len--) + { + if (buf[len] == '\r') + { + if (!found) /* back it up */ + { + if (len > 0) + len--; + found = TRUE; + } + else /* found the second one */ + { + buf[len + 1] = '\0'; + free_string(ch->description); + ch->description = str_dup(buf); + send_to_char( "Your description is:\n\r", ch ); + send_to_char( ch->description ? ch->description : + "(None).\n\r", ch ); + return; + } + } + } + buf[0] = '\0'; + free_string(ch->description); + ch->description = str_dup(buf); + send_to_char("Description cleared.\n\r",ch); + return; + } + if ( argument[0] == '+' ) + { + if ( ch->description != NULL ) + strcat( buf, ch->description ); + argument++; + while ( isspace(*argument) ) + argument++; + } + + if ( strlen(buf) >= 1024) + { + send_to_char( "Description too long.\n\r", ch ); + return; + } + + strcat( buf, argument ); + strcat( buf, "\n\r" ); + free_string( ch->description ); + ch->description = str_dup( buf ); + } + + send_to_char( "Your description is:\n\r", ch ); + send_to_char( ch->description ? ch->description : "(None).\n\r", ch ); + return; +} + + + +void do_report( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_INPUT_LENGTH]; + + sprintf( buf, + "You say 'I have %d/%d hp %d/%d mana %d/%d mv %d xp.'\n\r", + ch->hit, ch->max_hit, + ch->mana, ch->max_mana, + ch->move, ch->max_move, + ch->exp ); + + send_to_char( buf, ch ); + + sprintf( buf, "$n says 'I have %d/%d hp %d/%d mana %d/%d mv %d xp.'", + ch->hit, ch->max_hit, + ch->mana, ch->max_mana, + ch->move, ch->max_move, + ch->exp ); + + act( buf, ch, NULL, NULL, TO_ROOM ); + + return; +} + + + +void do_practice( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + int sn; + + if ( IS_NPC(ch) ) + return; + + if ( argument[0] == '\0' ) + { + int col; + + col = 0; + for ( sn = 0; sn < MAX_SKILL; sn++ ) + { + if ( skill_table[sn].name == NULL ) + break; + if ( ch->level < skill_table[sn].skill_level[ch->class] + || ch->pcdata->learned[sn] < 1 /* skill is not known */) + continue; + + sprintf( buf, "%-18s %3d%% ", + skill_table[sn].name, ch->pcdata->learned[sn] ); + send_to_char( buf, ch ); + if ( ++col % 3 == 0 ) + send_to_char( "\n\r", ch ); + } + + if ( col % 3 != 0 ) + send_to_char( "\n\r", ch ); + + sprintf( buf, "You have %d practice sessions left.\n\r", + ch->practice ); + send_to_char( buf, ch ); + } + else + { + CHAR_DATA *mob; + int adept; + + if ( !IS_AWAKE(ch) ) + { + send_to_char( "In your dreams, or what?\n\r", ch ); + return; + } + + for ( mob = ch->in_room->people; mob != NULL; mob = mob->next_in_room ) + { + if ( IS_NPC(mob) && IS_SET(mob->act, ACT_PRACTICE) ) + break; + } + + if ( mob == NULL ) + { + send_to_char( "You can't do that here.\n\r", ch ); + return; + } + + if ( ch->practice <= 0 ) + { + send_to_char( "You have no practice sessions left.\n\r", ch ); + return; + } + + if ( ( sn = find_spell( ch,argument ) ) < 0 + || ( !IS_NPC(ch) + && (ch->level < skill_table[sn].skill_level[ch->class] + || ch->pcdata->learned[sn] < 1 /* skill is not known */ + || skill_table[sn].rating[ch->class] == 0))) + { + send_to_char( "You can't practice that.\n\r", ch ); + return; + } + + adept = IS_NPC(ch) ? 100 : class_table[ch->class].skill_adept; + + if ( ch->pcdata->learned[sn] >= adept ) + { + sprintf( buf, "You are already learned at %s.\n\r", + skill_table[sn].name ); + send_to_char( buf, ch ); + } + else + { + ch->practice--; + ch->pcdata->learned[sn] += + int_app[get_curr_stat(ch,STAT_INT)].learn / + skill_table[sn].rating[ch->class]; + if ( ch->pcdata->learned[sn] < adept ) + { + act( "You practice $T.", + ch, NULL, skill_table[sn].name, TO_CHAR ); + act( "$n practices $T.", + ch, NULL, skill_table[sn].name, TO_ROOM ); + } + else + { + ch->pcdata->learned[sn] = adept; + act( "You are now learned at $T.", + ch, NULL, skill_table[sn].name, TO_CHAR ); + act( "$n is now learned at $T.", + ch, NULL, skill_table[sn].name, TO_ROOM ); + } + } + } + return; +} + + + +/* + * 'Wimpy' originally by Dionysos. + */ +void do_wimpy( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + char arg[MAX_INPUT_LENGTH]; + int wimpy; + + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + wimpy = ch->max_hit / 5; + else + wimpy = atoi( arg ); + + if ( wimpy < 0 ) + { + send_to_char( "Your courage exceeds your wisdom.\n\r", ch ); + return; + } + + if ( wimpy > ch->max_hit/2 ) + { + send_to_char( "Such cowardice ill becomes you.\n\r", ch ); + return; + } + + ch->wimpy = wimpy; + sprintf( buf, "Wimpy set to %d hit points.\n\r", wimpy ); + send_to_char( buf, ch ); + return; +} + + + +void do_password( CHAR_DATA *ch, char *argument ) +{ + char arg1[MAX_INPUT_LENGTH]; + char arg2[MAX_INPUT_LENGTH]; + char *pArg; + char *pwdnew; + char *p; + char cEnd; + + if ( IS_NPC(ch) ) + return; + + /* + * Can't use one_argument here because it smashes case. + * So we just steal all its code. Bleagh. + */ + pArg = arg1; + while ( isspace(*argument) ) + argument++; + + cEnd = ' '; + if ( *argument == '\'' || *argument == '"' ) + cEnd = *argument++; + + while ( *argument != '\0' ) + { + if ( *argument == cEnd ) + { + argument++; + break; + } + *pArg++ = *argument++; + } + *pArg = '\0'; + + pArg = arg2; + while ( isspace(*argument) ) + argument++; + + cEnd = ' '; + if ( *argument == '\'' || *argument == '"' ) + cEnd = *argument++; + + while ( *argument != '\0' ) + { + if ( *argument == cEnd ) + { + argument++; + break; + } + *pArg++ = *argument++; + } + *pArg = '\0'; + + if ( arg1[0] == '\0' || arg2[0] == '\0' ) + { + send_to_char( "Syntax: password .\n\r", ch ); + return; + } + + if ( strcmp( crypt( arg1, ch->pcdata->pwd ), ch->pcdata->pwd ) ) + { + WAIT_STATE( ch, 40 ); + send_to_char( "Wrong password. Wait 10 seconds.\n\r", ch ); + return; + } + + if ( strlen(arg2) < 5 ) + { + send_to_char( + "New password must be at least five characters long.\n\r", ch ); + return; + } + + /* + * No tilde allowed because of player file format. + */ + pwdnew = crypt( arg2, ch->name ); + for ( p = pwdnew; *p != '\0'; p++ ) + { + if ( *p == '~' ) + { + send_to_char( + "New password not acceptable, try again.\n\r", ch ); + return; + } + } + + free_string( ch->pcdata->pwd ); + ch->pcdata->pwd = str_dup( pwdnew ); + save_char_obj( ch ); + send_to_char( "Ok.\n\r", ch ); + return; +} diff --git a/Rom24/src/act_move.c b/Rom24/src/act_move.c new file mode 100644 index 0000000..4fe4289 --- /dev/null +++ b/Rom24/src/act_move.c @@ -0,0 +1,1640 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +#if defined(macintosh) +#include +#include +#else +#include +#include +#endif +#include +#include +#include "merc.h" +#include "interp.h" + +char * const dir_name [] = +{ + "north", "east", "south", "west", "up", "down" +}; + +const sh_int rev_dir [] = +{ + 2, 3, 0, 1, 5, 4 +}; + +const sh_int movement_loss [SECT_MAX] = +{ + 1, 2, 2, 3, 4, 6, 4, 1, 6, 10, 6 +}; + + + +/* + * Local functions. + */ +int find_door args( ( CHAR_DATA *ch, char *arg ) ); +bool has_key args( ( CHAR_DATA *ch, int key ) ); + + + +void move_char( CHAR_DATA *ch, int door, bool follow ) +{ + CHAR_DATA *fch; + CHAR_DATA *fch_next; + ROOM_INDEX_DATA *in_room; + ROOM_INDEX_DATA *to_room; + EXIT_DATA *pexit; + + if ( door < 0 || door > 5 ) + { + bug( "Do_move: bad door %d.", door ); + return; + } + + in_room = ch->in_room; + if ( ( pexit = in_room->exit[door] ) == NULL + || ( to_room = pexit->u1.to_room ) == NULL + || !can_see_room(ch,pexit->u1.to_room)) + { + send_to_char( "Alas, you cannot go that way.\n\r", ch ); + return; + } + + if (IS_SET(pexit->exit_info, EX_CLOSED) + && (!IS_AFFECTED(ch, AFF_PASS_DOOR) || IS_SET(pexit->exit_info,EX_NOPASS)) + && !IS_TRUSTED(ch,ANGEL)) + { + act( "The $d is closed.", ch, NULL, pexit->keyword, TO_CHAR ); + return; + } + + if ( IS_AFFECTED(ch, AFF_CHARM) + && ch->master != NULL + && in_room == ch->master->in_room ) + { + send_to_char( "What? And leave your beloved master?\n\r", ch ); + return; + } + + if ( !is_room_owner(ch,to_room) && room_is_private( to_room ) ) + { + send_to_char( "That room is private right now.\n\r", ch ); + return; + } + + if ( !IS_NPC(ch) ) + { + int iClass, iGuild; + int move; + + for ( iClass = 0; iClass < MAX_CLASS; iClass++ ) + { + for ( iGuild = 0; iGuild < MAX_GUILD; iGuild ++) + { + if ( iClass != ch->class + && to_room->vnum == class_table[iClass].guild[iGuild] ) + { + send_to_char( "You aren't allowed in there.\n\r", ch ); + return; + } + } + } + + if ( in_room->sector_type == SECT_AIR + || to_room->sector_type == SECT_AIR ) + { + if ( !IS_AFFECTED(ch, AFF_FLYING) && !IS_IMMORTAL(ch)) + { + send_to_char( "You can't fly.\n\r", ch ); + return; + } + } + + if (( in_room->sector_type == SECT_WATER_NOSWIM + || to_room->sector_type == SECT_WATER_NOSWIM ) + && !IS_AFFECTED(ch,AFF_FLYING)) + { + OBJ_DATA *obj; + bool found; + + /* + * Look for a boat. + */ + found = FALSE; + + if (IS_IMMORTAL(ch)) + found = TRUE; + + for ( obj = ch->carrying; obj != NULL; obj = obj->next_content ) + { + if ( obj->item_type == ITEM_BOAT ) + { + found = TRUE; + break; + } + } + if ( !found ) + { + send_to_char( "You need a boat to go there.\n\r", ch ); + return; + } + } + + move = movement_loss[UMIN(SECT_MAX-1, in_room->sector_type)] + + movement_loss[UMIN(SECT_MAX-1, to_room->sector_type)] + ; + + move /= 2; /* i.e. the average */ + + + /* conditional effects */ + if (IS_AFFECTED(ch,AFF_FLYING) || IS_AFFECTED(ch,AFF_HASTE)) + move /= 2; + + if (IS_AFFECTED(ch,AFF_SLOW)) + move *= 2; + + if ( ch->move < move ) + { + send_to_char( "You are too exhausted.\n\r", ch ); + return; + } + + WAIT_STATE( ch, 1 ); + ch->move -= move; + } + + if ( !IS_AFFECTED(ch, AFF_SNEAK) + && ch->invis_level < LEVEL_HERO) + act( "$n leaves $T.", ch, NULL, dir_name[door], TO_ROOM ); + + char_from_room( ch ); + char_to_room( ch, to_room ); + if ( !IS_AFFECTED(ch, AFF_SNEAK) + && ch->invis_level < LEVEL_HERO) + act( "$n has arrived.", ch, NULL, NULL, TO_ROOM ); + + do_function(ch, &do_look, "auto" ); + + if (in_room == to_room) /* no circular follows */ + return; + + for ( fch = in_room->people; fch != NULL; fch = fch_next ) + { + fch_next = fch->next_in_room; + + if ( fch->master == ch && IS_AFFECTED(fch,AFF_CHARM) + && fch->position < POS_STANDING) + do_function(fch, &do_stand, ""); + + if ( fch->master == ch && fch->position == POS_STANDING + && can_see_room(fch,to_room)) + { + + if (IS_SET(ch->in_room->room_flags,ROOM_LAW) + && (IS_NPC(fch) && IS_SET(fch->act,ACT_AGGRESSIVE))) + { + act("You can't bring $N into the city.", + ch,NULL,fch,TO_CHAR); + act("You aren't allowed in the city.", + fch,NULL,NULL,TO_CHAR); + continue; + } + + act( "You follow $N.", fch, NULL, ch, TO_CHAR ); + move_char( fch, door, TRUE ); + } + } + + return; +} + + + +void do_north( CHAR_DATA *ch, char *argument ) +{ + move_char( ch, DIR_NORTH, FALSE ); + return; +} + + + +void do_east( CHAR_DATA *ch, char *argument ) +{ + move_char( ch, DIR_EAST, FALSE ); + return; +} + + + +void do_south( CHAR_DATA *ch, char *argument ) +{ + move_char( ch, DIR_SOUTH, FALSE ); + return; +} + + + +void do_west( CHAR_DATA *ch, char *argument ) +{ + move_char( ch, DIR_WEST, FALSE ); + return; +} + + + +void do_up( CHAR_DATA *ch, char *argument ) +{ + move_char( ch, DIR_UP, FALSE ); + return; +} + + + +void do_down( CHAR_DATA *ch, char *argument ) +{ + move_char( ch, DIR_DOWN, FALSE ); + return; +} + + + +int find_door( CHAR_DATA *ch, char *arg ) +{ + EXIT_DATA *pexit; + int door; + + if ( !str_cmp( arg, "n" ) || !str_cmp( arg, "north" ) ) door = 0; + else if ( !str_cmp( arg, "e" ) || !str_cmp( arg, "east" ) ) door = 1; + else if ( !str_cmp( arg, "s" ) || !str_cmp( arg, "south" ) ) door = 2; + else if ( !str_cmp( arg, "w" ) || !str_cmp( arg, "west" ) ) door = 3; + else if ( !str_cmp( arg, "u" ) || !str_cmp( arg, "up" ) ) door = 4; + else if ( !str_cmp( arg, "d" ) || !str_cmp( arg, "down" ) ) door = 5; + else + { + for ( door = 0; door <= 5; door++ ) + { + if ( ( pexit = ch->in_room->exit[door] ) != NULL + && IS_SET(pexit->exit_info, EX_ISDOOR) + && pexit->keyword != NULL + && is_name( arg, pexit->keyword ) ) + return door; + } + act( "I see no $T here.", ch, NULL, arg, TO_CHAR ); + return -1; + } + + if ( ( pexit = ch->in_room->exit[door] ) == NULL ) + { + act( "I see no door $T here.", ch, NULL, arg, TO_CHAR ); + return -1; + } + + if ( !IS_SET(pexit->exit_info, EX_ISDOOR) ) + { + send_to_char( "You can't do that.\n\r", ch ); + return -1; + } + + return door; +} + + + +void do_open( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + OBJ_DATA *obj; + int door; + + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + { + send_to_char( "Open what?\n\r", ch ); + return; + } + + if ( ( obj = get_obj_here( ch, arg ) ) != NULL ) + { + /* open portal */ + if (obj->item_type == ITEM_PORTAL) + { + if (!IS_SET(obj->value[1], EX_ISDOOR)) + { + send_to_char("You can't do that.\n\r",ch); + return; + } + + if (!IS_SET(obj->value[1], EX_CLOSED)) + { + send_to_char("It's already open.\n\r",ch); + return; + } + + if (IS_SET(obj->value[1], EX_LOCKED)) + { + send_to_char("It's locked.\n\r",ch); + return; + } + + REMOVE_BIT(obj->value[1], EX_CLOSED); + act("You open $p.",ch,obj,NULL,TO_CHAR); + act("$n opens $p.",ch,obj,NULL,TO_ROOM); + return; + } + + /* 'open object' */ + if ( obj->item_type != ITEM_CONTAINER) + { send_to_char( "That's not a container.\n\r", ch ); return; } + if ( !IS_SET(obj->value[1], CONT_CLOSED) ) + { send_to_char( "It's already open.\n\r", ch ); return; } + if ( !IS_SET(obj->value[1], CONT_CLOSEABLE) ) + { send_to_char( "You can't do that.\n\r", ch ); return; } + if ( IS_SET(obj->value[1], CONT_LOCKED) ) + { send_to_char( "It's locked.\n\r", ch ); return; } + + REMOVE_BIT(obj->value[1], CONT_CLOSED); + act("You open $p.",ch,obj,NULL,TO_CHAR); + act( "$n opens $p.", ch, obj, NULL, TO_ROOM ); + return; + } + + if ( ( door = find_door( ch, arg ) ) >= 0 ) + { + /* 'open door' */ + ROOM_INDEX_DATA *to_room; + EXIT_DATA *pexit; + EXIT_DATA *pexit_rev; + + pexit = ch->in_room->exit[door]; + if ( !IS_SET(pexit->exit_info, EX_CLOSED) ) + { send_to_char( "It's already open.\n\r", ch ); return; } + if ( IS_SET(pexit->exit_info, EX_LOCKED) ) + { send_to_char( "It's locked.\n\r", ch ); return; } + + REMOVE_BIT(pexit->exit_info, EX_CLOSED); + act( "$n opens the $d.", ch, NULL, pexit->keyword, TO_ROOM ); + send_to_char( "Ok.\n\r", ch ); + + /* open the other side */ + if ( ( to_room = pexit->u1.to_room ) != NULL + && ( pexit_rev = to_room->exit[rev_dir[door]] ) != NULL + && pexit_rev->u1.to_room == ch->in_room ) + { + CHAR_DATA *rch; + + REMOVE_BIT( pexit_rev->exit_info, EX_CLOSED ); + for ( rch = to_room->people; rch != NULL; rch = rch->next_in_room ) + act( "The $d opens.", rch, NULL, pexit_rev->keyword, TO_CHAR ); + } + } + + return; +} + + + +void do_close( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + OBJ_DATA *obj; + int door; + + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + { + send_to_char( "Close what?\n\r", ch ); + return; + } + + if ( ( obj = get_obj_here( ch, arg ) ) != NULL ) + { + /* portal stuff */ + if (obj->item_type == ITEM_PORTAL) + { + + if (!IS_SET(obj->value[1],EX_ISDOOR) + || IS_SET(obj->value[1],EX_NOCLOSE)) + { + send_to_char("You can't do that.\n\r",ch); + return; + } + + if (IS_SET(obj->value[1],EX_CLOSED)) + { + send_to_char("It's already closed.\n\r",ch); + return; + } + + SET_BIT(obj->value[1],EX_CLOSED); + act("You close $p.",ch,obj,NULL,TO_CHAR); + act("$n closes $p.",ch,obj,NULL,TO_ROOM); + return; + } + + /* 'close object' */ + if ( obj->item_type != ITEM_CONTAINER ) + { send_to_char( "That's not a container.\n\r", ch ); return; } + if ( IS_SET(obj->value[1], CONT_CLOSED) ) + { send_to_char( "It's already closed.\n\r", ch ); return; } + if ( !IS_SET(obj->value[1], CONT_CLOSEABLE) ) + { send_to_char( "You can't do that.\n\r", ch ); return; } + + SET_BIT(obj->value[1], CONT_CLOSED); + act("You close $p.",ch,obj,NULL,TO_CHAR); + act( "$n closes $p.", ch, obj, NULL, TO_ROOM ); + return; + } + + if ( ( door = find_door( ch, arg ) ) >= 0 ) + { + /* 'close door' */ + ROOM_INDEX_DATA *to_room; + EXIT_DATA *pexit; + EXIT_DATA *pexit_rev; + + pexit = ch->in_room->exit[door]; + if ( IS_SET(pexit->exit_info, EX_CLOSED) ) + { send_to_char( "It's already closed.\n\r", ch ); return; } + + SET_BIT(pexit->exit_info, EX_CLOSED); + act( "$n closes the $d.", ch, NULL, pexit->keyword, TO_ROOM ); + send_to_char( "Ok.\n\r", ch ); + + /* close the other side */ + if ( ( to_room = pexit->u1.to_room ) != NULL + && ( pexit_rev = to_room->exit[rev_dir[door]] ) != 0 + && pexit_rev->u1.to_room == ch->in_room ) + { + CHAR_DATA *rch; + + SET_BIT( pexit_rev->exit_info, EX_CLOSED ); + for ( rch = to_room->people; rch != NULL; rch = rch->next_in_room ) + act( "The $d closes.", rch, NULL, pexit_rev->keyword, TO_CHAR ); + } + } + + return; +} + + + +bool has_key( CHAR_DATA *ch, int key ) +{ + OBJ_DATA *obj; + + for ( obj = ch->carrying; obj != NULL; obj = obj->next_content ) + { + if ( obj->pIndexData->vnum == key ) + return TRUE; + } + + return FALSE; +} + + + +void do_lock( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + OBJ_DATA *obj; + int door; + + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + { + send_to_char( "Lock what?\n\r", ch ); + return; + } + + if ( ( obj = get_obj_here( ch, arg ) ) != NULL ) + { + /* portal stuff */ + if (obj->item_type == ITEM_PORTAL) + { + if (!IS_SET(obj->value[1],EX_ISDOOR) + || IS_SET(obj->value[1],EX_NOCLOSE)) + { + send_to_char("You can't do that.\n\r",ch); + return; + } + if (!IS_SET(obj->value[1],EX_CLOSED)) + { + send_to_char("It's not closed.\n\r",ch); + return; + } + + if (obj->value[4] < 0 || IS_SET(obj->value[1],EX_NOLOCK)) + { + send_to_char("It can't be locked.\n\r",ch); + return; + } + + if (!has_key(ch,obj->value[4])) + { + send_to_char("You lack the key.\n\r",ch); + return; + } + + if (IS_SET(obj->value[1],EX_LOCKED)) + { + send_to_char("It's already locked.\n\r",ch); + return; + } + + SET_BIT(obj->value[1],EX_LOCKED); + act("You lock $p.",ch,obj,NULL,TO_CHAR); + act("$n locks $p.",ch,obj,NULL,TO_ROOM); + return; + } + + /* 'lock object' */ + if ( obj->item_type != ITEM_CONTAINER ) + { send_to_char( "That's not a container.\n\r", ch ); return; } + if ( !IS_SET(obj->value[1], CONT_CLOSED) ) + { send_to_char( "It's not closed.\n\r", ch ); return; } + if ( obj->value[2] < 0 ) + { send_to_char( "It can't be locked.\n\r", ch ); return; } + if ( !has_key( ch, obj->value[2] ) ) + { send_to_char( "You lack the key.\n\r", ch ); return; } + if ( IS_SET(obj->value[1], CONT_LOCKED) ) + { send_to_char( "It's already locked.\n\r", ch ); return; } + + SET_BIT(obj->value[1], CONT_LOCKED); + act("You lock $p.",ch,obj,NULL,TO_CHAR); + act( "$n locks $p.", ch, obj, NULL, TO_ROOM ); + return; + } + + if ( ( door = find_door( ch, arg ) ) >= 0 ) + { + /* 'lock door' */ + ROOM_INDEX_DATA *to_room; + EXIT_DATA *pexit; + EXIT_DATA *pexit_rev; + + pexit = ch->in_room->exit[door]; + if ( !IS_SET(pexit->exit_info, EX_CLOSED) ) + { send_to_char( "It's not closed.\n\r", ch ); return; } + if ( pexit->key < 0 ) + { send_to_char( "It can't be locked.\n\r", ch ); return; } + if ( !has_key( ch, pexit->key) ) + { send_to_char( "You lack the key.\n\r", ch ); return; } + if ( IS_SET(pexit->exit_info, EX_LOCKED) ) + { send_to_char( "It's already locked.\n\r", ch ); return; } + + SET_BIT(pexit->exit_info, EX_LOCKED); + send_to_char( "*Click*\n\r", ch ); + act( "$n locks the $d.", ch, NULL, pexit->keyword, TO_ROOM ); + + /* lock the other side */ + if ( ( to_room = pexit->u1.to_room ) != NULL + && ( pexit_rev = to_room->exit[rev_dir[door]] ) != 0 + && pexit_rev->u1.to_room == ch->in_room ) + { + SET_BIT( pexit_rev->exit_info, EX_LOCKED ); + } + } + + return; +} + + + +void do_unlock( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + OBJ_DATA *obj; + int door; + + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + { + send_to_char( "Unlock what?\n\r", ch ); + return; + } + + if ( ( obj = get_obj_here( ch, arg ) ) != NULL ) + { + /* portal stuff */ + if (obj->item_type == ITEM_PORTAL) + { + if (!IS_SET(obj->value[1],EX_ISDOOR)) + { + send_to_char("You can't do that.\n\r",ch); + return; + } + + if (!IS_SET(obj->value[1],EX_CLOSED)) + { + send_to_char("It's not closed.\n\r",ch); + return; + } + + if (obj->value[4] < 0) + { + send_to_char("It can't be unlocked.\n\r",ch); + return; + } + + if (!has_key(ch,obj->value[4])) + { + send_to_char("You lack the key.\n\r",ch); + return; + } + + if (!IS_SET(obj->value[1],EX_LOCKED)) + { + send_to_char("It's already unlocked.\n\r",ch); + return; + } + + REMOVE_BIT(obj->value[1],EX_LOCKED); + act("You unlock $p.",ch,obj,NULL,TO_CHAR); + act("$n unlocks $p.",ch,obj,NULL,TO_ROOM); + return; + } + + /* 'unlock object' */ + if ( obj->item_type != ITEM_CONTAINER ) + { send_to_char( "That's not a container.\n\r", ch ); return; } + if ( !IS_SET(obj->value[1], CONT_CLOSED) ) + { send_to_char( "It's not closed.\n\r", ch ); return; } + if ( obj->value[2] < 0 ) + { send_to_char( "It can't be unlocked.\n\r", ch ); return; } + if ( !has_key( ch, obj->value[2] ) ) + { send_to_char( "You lack the key.\n\r", ch ); return; } + if ( !IS_SET(obj->value[1], CONT_LOCKED) ) + { send_to_char( "It's already unlocked.\n\r", ch ); return; } + + REMOVE_BIT(obj->value[1], CONT_LOCKED); + act("You unlock $p.",ch,obj,NULL,TO_CHAR); + act( "$n unlocks $p.", ch, obj, NULL, TO_ROOM ); + return; + } + + if ( ( door = find_door( ch, arg ) ) >= 0 ) + { + /* 'unlock door' */ + ROOM_INDEX_DATA *to_room; + EXIT_DATA *pexit; + EXIT_DATA *pexit_rev; + + pexit = ch->in_room->exit[door]; + if ( !IS_SET(pexit->exit_info, EX_CLOSED) ) + { send_to_char( "It's not closed.\n\r", ch ); return; } + if ( pexit->key < 0 ) + { send_to_char( "It can't be unlocked.\n\r", ch ); return; } + if ( !has_key( ch, pexit->key) ) + { send_to_char( "You lack the key.\n\r", ch ); return; } + if ( !IS_SET(pexit->exit_info, EX_LOCKED) ) + { send_to_char( "It's already unlocked.\n\r", ch ); return; } + + REMOVE_BIT(pexit->exit_info, EX_LOCKED); + send_to_char( "*Click*\n\r", ch ); + act( "$n unlocks the $d.", ch, NULL, pexit->keyword, TO_ROOM ); + + /* unlock the other side */ + if ( ( to_room = pexit->u1.to_room ) != NULL + && ( pexit_rev = to_room->exit[rev_dir[door]] ) != NULL + && pexit_rev->u1.to_room == ch->in_room ) + { + REMOVE_BIT( pexit_rev->exit_info, EX_LOCKED ); + } + } + + return; +} + + + +void do_pick( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + CHAR_DATA *gch; + OBJ_DATA *obj; + int door; + + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + { + send_to_char( "Pick what?\n\r", ch ); + return; + } + + WAIT_STATE( ch, skill_table[gsn_pick_lock].beats ); + + /* look for guards */ + for ( gch = ch->in_room->people; gch; gch = gch->next_in_room ) + { + if ( IS_NPC(gch) && IS_AWAKE(gch) && ch->level + 5 < gch->level ) + { + act( "$N is standing too close to the lock.", + ch, NULL, gch, TO_CHAR ); + return; + } + } + + if ( !IS_NPC(ch) && number_percent( ) > get_skill(ch,gsn_pick_lock)) + { + send_to_char( "You failed.\n\r", ch); + check_improve(ch,gsn_pick_lock,FALSE,2); + return; + } + + if ( ( obj = get_obj_here( ch, arg ) ) != NULL ) + { + /* portal stuff */ + if (obj->item_type == ITEM_PORTAL) + { + if (!IS_SET(obj->value[1],EX_ISDOOR)) + { + send_to_char("You can't do that.\n\r",ch); + return; + } + + if (!IS_SET(obj->value[1],EX_CLOSED)) + { + send_to_char("It's not closed.\n\r",ch); + return; + } + + if (obj->value[4] < 0) + { + send_to_char("It can't be unlocked.\n\r",ch); + return; + } + + if (IS_SET(obj->value[1],EX_PICKPROOF)) + { + send_to_char("You failed.\n\r",ch); + return; + } + + REMOVE_BIT(obj->value[1],EX_LOCKED); + act("You pick the lock on $p.",ch,obj,NULL,TO_CHAR); + act("$n picks the lock on $p.",ch,obj,NULL,TO_ROOM); + check_improve(ch,gsn_pick_lock,TRUE,2); + return; + } + + + + + + /* 'pick object' */ + if ( obj->item_type != ITEM_CONTAINER ) + { send_to_char( "That's not a container.\n\r", ch ); return; } + if ( !IS_SET(obj->value[1], CONT_CLOSED) ) + { send_to_char( "It's not closed.\n\r", ch ); return; } + if ( obj->value[2] < 0 ) + { send_to_char( "It can't be unlocked.\n\r", ch ); return; } + if ( !IS_SET(obj->value[1], CONT_LOCKED) ) + { send_to_char( "It's already unlocked.\n\r", ch ); return; } + if ( IS_SET(obj->value[1], CONT_PICKPROOF) ) + { send_to_char( "You failed.\n\r", ch ); return; } + + REMOVE_BIT(obj->value[1], CONT_LOCKED); + act("You pick the lock on $p.",ch,obj,NULL,TO_CHAR); + act("$n picks the lock on $p.",ch,obj,NULL,TO_ROOM); + check_improve(ch,gsn_pick_lock,TRUE,2); + return; + } + + if ( ( door = find_door( ch, arg ) ) >= 0 ) + { + /* 'pick door' */ + ROOM_INDEX_DATA *to_room; + EXIT_DATA *pexit; + EXIT_DATA *pexit_rev; + + pexit = ch->in_room->exit[door]; + if ( !IS_SET(pexit->exit_info, EX_CLOSED) && !IS_IMMORTAL(ch)) + { send_to_char( "It's not closed.\n\r", ch ); return; } + if ( pexit->key < 0 && !IS_IMMORTAL(ch)) + { send_to_char( "It can't be picked.\n\r", ch ); return; } + if ( !IS_SET(pexit->exit_info, EX_LOCKED) ) + { send_to_char( "It's already unlocked.\n\r", ch ); return; } + if ( IS_SET(pexit->exit_info, EX_PICKPROOF) && !IS_IMMORTAL(ch)) + { send_to_char( "You failed.\n\r", ch ); return; } + + REMOVE_BIT(pexit->exit_info, EX_LOCKED); + send_to_char( "*Click*\n\r", ch ); + act( "$n picks the $d.", ch, NULL, pexit->keyword, TO_ROOM ); + check_improve(ch,gsn_pick_lock,TRUE,2); + + /* pick the other side */ + if ( ( to_room = pexit->u1.to_room ) != NULL + && ( pexit_rev = to_room->exit[rev_dir[door]] ) != NULL + && pexit_rev->u1.to_room == ch->in_room ) + { + REMOVE_BIT( pexit_rev->exit_info, EX_LOCKED ); + } + } + + return; +} + + + + +void do_stand( CHAR_DATA *ch, char *argument ) +{ + OBJ_DATA *obj = NULL; + + if (argument[0] != '\0') + { + if (ch->position == POS_FIGHTING) + { + send_to_char("Maybe you should finish fighting first?\n\r",ch); + return; + } + obj = get_obj_list(ch,argument,ch->in_room->contents); + if (obj == NULL) + { + send_to_char("You don't see that here.\n\r",ch); + return; + } + if (obj->item_type != ITEM_FURNITURE + || (!IS_SET(obj->value[2],STAND_AT) + && !IS_SET(obj->value[2],STAND_ON) + && !IS_SET(obj->value[2],STAND_IN))) + { + send_to_char("You can't seem to find a place to stand.\n\r",ch); + return; + } + if (ch->on != obj && count_users(obj) >= obj->value[0]) + { + act_new("There's no room to stand on $p.", + ch,obj,NULL,TO_CHAR,POS_DEAD); + return; + } + ch->on = obj; + } + + switch ( ch->position ) + { + case POS_SLEEPING: + if ( IS_AFFECTED(ch, AFF_SLEEP) ) + { send_to_char( "You can't wake up!\n\r", ch ); return; } + + if (obj == NULL) + { + send_to_char( "You wake and stand up.\n\r", ch ); + act( "$n wakes and stands up.", ch, NULL, NULL, TO_ROOM ); + ch->on = NULL; + } + else if (IS_SET(obj->value[2],STAND_AT)) + { + act_new("You wake and stand at $p.",ch,obj,NULL,TO_CHAR,POS_DEAD); + act("$n wakes and stands at $p.",ch,obj,NULL,TO_ROOM); + } + else if (IS_SET(obj->value[2],STAND_ON)) + { + act_new("You wake and stand on $p.",ch,obj,NULL,TO_CHAR,POS_DEAD); + act("$n wakes and stands on $p.",ch,obj,NULL,TO_ROOM); + } + else + { + act_new("You wake and stand in $p.",ch,obj,NULL,TO_CHAR,POS_DEAD); + act("$n wakes and stands in $p.",ch,obj,NULL,TO_ROOM); + } + ch->position = POS_STANDING; + do_function(ch, &do_look, "auto"); + break; + + case POS_RESTING: case POS_SITTING: + if (obj == NULL) + { + send_to_char( "You stand up.\n\r", ch ); + act( "$n stands up.", ch, NULL, NULL, TO_ROOM ); + ch->on = NULL; + } + else if (IS_SET(obj->value[2],STAND_AT)) + { + act("You stand at $p.",ch,obj,NULL,TO_CHAR); + act("$n stands at $p.",ch,obj,NULL,TO_ROOM); + } + else if (IS_SET(obj->value[2],STAND_ON)) + { + act("You stand on $p.",ch,obj,NULL,TO_CHAR); + act("$n stands on $p.",ch,obj,NULL,TO_ROOM); + } + else + { + act("You stand in $p.",ch,obj,NULL,TO_CHAR); + act("$n stands on $p.",ch,obj,NULL,TO_ROOM); + } + ch->position = POS_STANDING; + break; + + case POS_STANDING: + send_to_char( "You are already standing.\n\r", ch ); + break; + + case POS_FIGHTING: + send_to_char( "You are already fighting!\n\r", ch ); + break; + } + + return; +} + + + +void do_rest( CHAR_DATA *ch, char *argument ) +{ + OBJ_DATA *obj = NULL; + + if (ch->position == POS_FIGHTING) + { + send_to_char("You are already fighting!\n\r",ch); + return; + } + + /* okay, now that we know we can rest, find an object to rest on */ + if (argument[0] != '\0') + { + obj = get_obj_list(ch,argument,ch->in_room->contents); + if (obj == NULL) + { + send_to_char("You don't see that here.\n\r",ch); + return; + } + } + else obj = ch->on; + + if (obj != NULL) + { + if (obj->item_type != ITEM_FURNITURE + || (!IS_SET(obj->value[2],REST_ON) + && !IS_SET(obj->value[2],REST_IN) + && !IS_SET(obj->value[2],REST_AT))) + { + send_to_char("You can't rest on that.\n\r",ch); + return; + } + + if (obj != NULL && ch->on != obj && count_users(obj) >= obj->value[0]) + { + act_new("There's no more room on $p.",ch,obj,NULL,TO_CHAR,POS_DEAD); + return; + } + + ch->on = obj; + } + + switch ( ch->position ) + { + case POS_SLEEPING: + if (IS_AFFECTED(ch,AFF_SLEEP)) + { + send_to_char("You can't wake up!\n\r",ch); + return; + } + + if (obj == NULL) + { + send_to_char( "You wake up and start resting.\n\r", ch ); + act ("$n wakes up and starts resting.",ch,NULL,NULL,TO_ROOM); + } + else if (IS_SET(obj->value[2],REST_AT)) + { + act_new("You wake up and rest at $p.", + ch,obj,NULL,TO_CHAR,POS_SLEEPING); + act("$n wakes up and rests at $p.",ch,obj,NULL,TO_ROOM); + } + else if (IS_SET(obj->value[2],REST_ON)) + { + act_new("You wake up and rest on $p.", + ch,obj,NULL,TO_CHAR,POS_SLEEPING); + act("$n wakes up and rests on $p.",ch,obj,NULL,TO_ROOM); + } + else + { + act_new("You wake up and rest in $p.", + ch,obj,NULL,TO_CHAR,POS_SLEEPING); + act("$n wakes up and rests in $p.",ch,obj,NULL,TO_ROOM); + } + ch->position = POS_RESTING; + break; + + case POS_RESTING: + send_to_char( "You are already resting.\n\r", ch ); + break; + + case POS_STANDING: + if (obj == NULL) + { + send_to_char( "You rest.\n\r", ch ); + act( "$n sits down and rests.", ch, NULL, NULL, TO_ROOM ); + } + else if (IS_SET(obj->value[2],REST_AT)) + { + act("You sit down at $p and rest.",ch,obj,NULL,TO_CHAR); + act("$n sits down at $p and rests.",ch,obj,NULL,TO_ROOM); + } + else if (IS_SET(obj->value[2],REST_ON)) + { + act("You sit on $p and rest.",ch,obj,NULL,TO_CHAR); + act("$n sits on $p and rests.",ch,obj,NULL,TO_ROOM); + } + else + { + act("You rest in $p.",ch,obj,NULL,TO_CHAR); + act("$n rests in $p.",ch,obj,NULL,TO_ROOM); + } + ch->position = POS_RESTING; + break; + + case POS_SITTING: + if (obj == NULL) + { + send_to_char("You rest.\n\r",ch); + act("$n rests.",ch,NULL,NULL,TO_ROOM); + } + else if (IS_SET(obj->value[2],REST_AT)) + { + act("You rest at $p.",ch,obj,NULL,TO_CHAR); + act("$n rests at $p.",ch,obj,NULL,TO_ROOM); + } + else if (IS_SET(obj->value[2],REST_ON)) + { + act("You rest on $p.",ch,obj,NULL,TO_CHAR); + act("$n rests on $p.",ch,obj,NULL,TO_ROOM); + } + else + { + act("You rest in $p.",ch,obj,NULL,TO_CHAR); + act("$n rests in $p.",ch,obj,NULL,TO_ROOM); + } + ch->position = POS_RESTING; + break; + } + + + return; +} + + +void do_sit (CHAR_DATA *ch, char *argument ) +{ + OBJ_DATA *obj = NULL; + + if (ch->position == POS_FIGHTING) + { + send_to_char("Maybe you should finish this fight first?\n\r",ch); + return; + } + + /* okay, now that we know we can sit, find an object to sit on */ + if (argument[0] != '\0') + { + obj = get_obj_list(ch,argument,ch->in_room->contents); + if (obj == NULL) + { + send_to_char("You don't see that here.\n\r",ch); + return; + } + } + else obj = ch->on; + + if (obj != NULL) + { + if (obj->item_type != ITEM_FURNITURE + || (!IS_SET(obj->value[2],SIT_ON) + && !IS_SET(obj->value[2],SIT_IN) + && !IS_SET(obj->value[2],SIT_AT))) + { + send_to_char("You can't sit on that.\n\r",ch); + return; + } + + if (obj != NULL && ch->on != obj && count_users(obj) >= obj->value[0]) + { + act_new("There's no more room on $p.",ch,obj,NULL,TO_CHAR,POS_DEAD); + return; + } + + ch->on = obj; + } + switch (ch->position) + { + case POS_SLEEPING: + if (IS_AFFECTED(ch,AFF_SLEEP)) + { + send_to_char("You can't wake up!\n\r",ch); + return; + } + + if (obj == NULL) + { + send_to_char( "You wake and sit up.\n\r", ch ); + act( "$n wakes and sits up.", ch, NULL, NULL, TO_ROOM ); + } + else if (IS_SET(obj->value[2],SIT_AT)) + { + act_new("You wake and sit at $p.",ch,obj,NULL,TO_CHAR,POS_DEAD); + act("$n wakes and sits at $p.",ch,obj,NULL,TO_ROOM); + } + else if (IS_SET(obj->value[2],SIT_ON)) + { + act_new("You wake and sit on $p.",ch,obj,NULL,TO_CHAR,POS_DEAD); + act("$n wakes and sits at $p.",ch,obj,NULL,TO_ROOM); + } + else + { + act_new("You wake and sit in $p.",ch,obj,NULL,TO_CHAR,POS_DEAD); + act("$n wakes and sits in $p.",ch,obj,NULL,TO_ROOM); + } + + ch->position = POS_SITTING; + break; + case POS_RESTING: + if (obj == NULL) + send_to_char("You stop resting.\n\r",ch); + else if (IS_SET(obj->value[2],SIT_AT)) + { + act("You sit at $p.",ch,obj,NULL,TO_CHAR); + act("$n sits at $p.",ch,obj,NULL,TO_ROOM); + } + + else if (IS_SET(obj->value[2],SIT_ON)) + { + act("You sit on $p.",ch,obj,NULL,TO_CHAR); + act("$n sits on $p.",ch,obj,NULL,TO_ROOM); + } + ch->position = POS_SITTING; + break; + case POS_SITTING: + send_to_char("You are already sitting down.\n\r",ch); + break; + case POS_STANDING: + if (obj == NULL) + { + send_to_char("You sit down.\n\r",ch); + act("$n sits down on the ground.",ch,NULL,NULL,TO_ROOM); + } + else if (IS_SET(obj->value[2],SIT_AT)) + { + act("You sit down at $p.",ch,obj,NULL,TO_CHAR); + act("$n sits down at $p.",ch,obj,NULL,TO_ROOM); + } + else if (IS_SET(obj->value[2],SIT_ON)) + { + act("You sit on $p.",ch,obj,NULL,TO_CHAR); + act("$n sits on $p.",ch,obj,NULL,TO_ROOM); + } + else + { + act("You sit down in $p.",ch,obj,NULL,TO_CHAR); + act("$n sits down in $p.",ch,obj,NULL,TO_ROOM); + } + ch->position = POS_SITTING; + break; + } + return; +} + + +void do_sleep( CHAR_DATA *ch, char *argument ) +{ + OBJ_DATA *obj = NULL; + + switch ( ch->position ) + { + case POS_SLEEPING: + send_to_char( "You are already sleeping.\n\r", ch ); + break; + + case POS_RESTING: + case POS_SITTING: + case POS_STANDING: + if (argument[0] == '\0' && ch->on == NULL) + { + send_to_char( "You go to sleep.\n\r", ch ); + act( "$n goes to sleep.", ch, NULL, NULL, TO_ROOM ); + ch->position = POS_SLEEPING; + } + else /* find an object and sleep on it */ + { + if (argument[0] == '\0') + obj = ch->on; + else + obj = get_obj_list( ch, argument, ch->in_room->contents ); + + if (obj == NULL) + { + send_to_char("You don't see that here.\n\r",ch); + return; + } + if (obj->item_type != ITEM_FURNITURE + || (!IS_SET(obj->value[2],SLEEP_ON) + && !IS_SET(obj->value[2],SLEEP_IN) + && !IS_SET(obj->value[2],SLEEP_AT))) + { + send_to_char("You can't sleep on that!\n\r",ch); + return; + } + + if (ch->on != obj && count_users(obj) >= obj->value[0]) + { + act_new("There is no room on $p for you.", + ch,obj,NULL,TO_CHAR,POS_DEAD); + return; + } + + ch->on = obj; + if (IS_SET(obj->value[2],SLEEP_AT)) + { + act("You go to sleep at $p.",ch,obj,NULL,TO_CHAR); + act("$n goes to sleep at $p.",ch,obj,NULL,TO_ROOM); + } + else if (IS_SET(obj->value[2],SLEEP_ON)) + { + act("You go to sleep on $p.",ch,obj,NULL,TO_CHAR); + act("$n goes to sleep on $p.",ch,obj,NULL,TO_ROOM); + } + else + { + act("You go to sleep in $p.",ch,obj,NULL,TO_CHAR); + act("$n goes to sleep in $p.",ch,obj,NULL,TO_ROOM); + } + ch->position = POS_SLEEPING; + } + break; + + case POS_FIGHTING: + send_to_char( "You are already fighting!\n\r", ch ); + break; + } + + return; +} + + + +void do_wake( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + CHAR_DATA *victim; + + one_argument( argument, arg ); + if ( arg[0] == '\0' ) + { do_function(ch, &do_stand, ""); return; } + + if ( !IS_AWAKE(ch) ) + { send_to_char( "You are asleep yourself!\n\r", ch ); return; } + + if ( ( victim = get_char_room( ch, arg ) ) == NULL ) + { send_to_char( "They aren't here.\n\r", ch ); return; } + + if ( IS_AWAKE(victim) ) + { act( "$N is already awake.", ch, NULL, victim, TO_CHAR ); return; } + + if ( IS_AFFECTED(victim, AFF_SLEEP) ) + { act( "You can't wake $M!", ch, NULL, victim, TO_CHAR ); return; } + + act_new( "$n wakes you.", ch, NULL, victim, TO_VICT,POS_SLEEPING ); + do_function(ch, &do_stand, ""); + return; +} + + + +void do_sneak( CHAR_DATA *ch, char *argument ) +{ + AFFECT_DATA af; + + send_to_char( "You attempt to move silently.\n\r", ch ); + affect_strip( ch, gsn_sneak ); + + if (IS_AFFECTED(ch,AFF_SNEAK)) + return; + + if ( number_percent( ) < get_skill(ch,gsn_sneak)) + { + check_improve(ch,gsn_sneak,TRUE,3); + af.where = TO_AFFECTS; + af.type = gsn_sneak; + af.level = ch->level; + af.duration = ch->level; + af.location = APPLY_NONE; + af.modifier = 0; + af.bitvector = AFF_SNEAK; + affect_to_char( ch, &af ); + } + else + check_improve(ch,gsn_sneak,FALSE,3); + + return; +} + + + +void do_hide( CHAR_DATA *ch, char *argument ) +{ + send_to_char( "You attempt to hide.\n\r", ch ); + + if ( IS_AFFECTED(ch, AFF_HIDE) ) + REMOVE_BIT(ch->affected_by, AFF_HIDE); + + if ( number_percent( ) < get_skill(ch,gsn_hide)) + { + SET_BIT(ch->affected_by, AFF_HIDE); + check_improve(ch,gsn_hide,TRUE,3); + } + else + check_improve(ch,gsn_hide,FALSE,3); + + return; +} + + + +/* + * Contributed by Alander. + */ +void do_visible( CHAR_DATA *ch, char *argument ) +{ + affect_strip ( ch, gsn_invis ); + affect_strip ( ch, gsn_mass_invis ); + affect_strip ( ch, gsn_sneak ); + REMOVE_BIT ( ch->affected_by, AFF_HIDE ); + REMOVE_BIT ( ch->affected_by, AFF_INVISIBLE ); + REMOVE_BIT ( ch->affected_by, AFF_SNEAK ); + send_to_char( "Ok.\n\r", ch ); + return; +} + + + +void do_recall( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + CHAR_DATA *victim; + ROOM_INDEX_DATA *location; + + if (IS_NPC(ch) && !IS_SET(ch->act,ACT_PET)) + { + send_to_char("Only players can recall.\n\r",ch); + return; + } + + act( "$n prays for transportation!", ch, 0, 0, TO_ROOM ); + + if ( ( location = get_room_index( ROOM_VNUM_TEMPLE ) ) == NULL ) + { + send_to_char( "You are completely lost.\n\r", ch ); + return; + } + + if ( ch->in_room == location ) + return; + + if ( IS_SET(ch->in_room->room_flags, ROOM_NO_RECALL) + || IS_AFFECTED(ch, AFF_CURSE)) + { + send_to_char( "Mota has forsaken you.\n\r", ch ); + return; + } + + if ( ( victim = ch->fighting ) != NULL ) + { + int lose,skill; + + skill = get_skill(ch,gsn_recall); + + if ( number_percent() < 80 * skill / 100 ) + { + check_improve(ch,gsn_recall,FALSE,6); + WAIT_STATE( ch, 4 ); + sprintf( buf, "You failed!.\n\r"); + send_to_char( buf, ch ); + return; + } + + lose = (ch->desc != NULL) ? 25 : 50; + gain_exp( ch, 0 - lose ); + check_improve(ch,gsn_recall,TRUE,4); + sprintf( buf, "You recall from combat! You lose %d exps.\n\r", lose ); + send_to_char( buf, ch ); + stop_fighting( ch, TRUE ); + + } + + ch->move /= 2; + act( "$n disappears.", ch, NULL, NULL, TO_ROOM ); + char_from_room( ch ); + char_to_room( ch, location ); + act( "$n appears in the room.", ch, NULL, NULL, TO_ROOM ); + do_function(ch, &do_look, "auto" ); + + if (ch->pet != NULL) + do_function(ch->pet, &do_recall, ""); + + return; +} + + + +void do_train( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + CHAR_DATA *mob; + sh_int stat = - 1; + char *pOutput = NULL; + int cost; + + if ( IS_NPC(ch) ) + return; + + /* + * Check for trainer. + */ + for ( mob = ch->in_room->people; mob; mob = mob->next_in_room ) + { + if ( IS_NPC(mob) && IS_SET(mob->act, ACT_TRAIN) ) + break; + } + + if ( mob == NULL ) + { + send_to_char( "You can't do that here.\n\r", ch ); + return; + } + + if ( argument[0] == '\0' ) + { + sprintf( buf, "You have %d training sessions.\n\r", ch->train ); + send_to_char( buf, ch ); + argument = "foo"; + } + + cost = 1; + + if ( !str_cmp( argument, "str" ) ) + { + if ( class_table[ch->class].attr_prime == STAT_STR ) + cost = 1; + stat = STAT_STR; + pOutput = "strength"; + } + + else if ( !str_cmp( argument, "int" ) ) + { + if ( class_table[ch->class].attr_prime == STAT_INT ) + cost = 1; + stat = STAT_INT; + pOutput = "intelligence"; + } + + else if ( !str_cmp( argument, "wis" ) ) + { + if ( class_table[ch->class].attr_prime == STAT_WIS ) + cost = 1; + stat = STAT_WIS; + pOutput = "wisdom"; + } + + else if ( !str_cmp( argument, "dex" ) ) + { + if ( class_table[ch->class].attr_prime == STAT_DEX ) + cost = 1; + stat = STAT_DEX; + pOutput = "dexterity"; + } + + else if ( !str_cmp( argument, "con" ) ) + { + if ( class_table[ch->class].attr_prime == STAT_CON ) + cost = 1; + stat = STAT_CON; + pOutput = "constitution"; + } + + else if ( !str_cmp(argument, "hp" ) ) + cost = 1; + + else if ( !str_cmp(argument, "mana" ) ) + cost = 1; + + else + { + strcpy( buf, "You can train:" ); + if ( ch->perm_stat[STAT_STR] < get_max_train(ch,STAT_STR)) + strcat( buf, " str" ); + if ( ch->perm_stat[STAT_INT] < get_max_train(ch,STAT_INT)) + strcat( buf, " int" ); + if ( ch->perm_stat[STAT_WIS] < get_max_train(ch,STAT_WIS)) + strcat( buf, " wis" ); + if ( ch->perm_stat[STAT_DEX] < get_max_train(ch,STAT_DEX)) + strcat( buf, " dex" ); + if ( ch->perm_stat[STAT_CON] < get_max_train(ch,STAT_CON)) + strcat( buf, " con" ); + strcat( buf, " hp mana"); + + if ( buf[strlen(buf)-1] != ':' ) + { + strcat( buf, ".\n\r" ); + send_to_char( buf, ch ); + } + else + { + /* + * This message dedicated to Jordan ... you big stud! + */ + act( "You have nothing left to train, you $T!", + ch, NULL, + ch->sex == SEX_MALE ? "big stud" : + ch->sex == SEX_FEMALE ? "hot babe" : + "wild thing", + TO_CHAR ); + } + + return; + } + + if (!str_cmp("hp",argument)) + { + if ( cost > ch->train ) + { + send_to_char( "You don't have enough training sessions.\n\r", ch ); + return; + } + + ch->train -= cost; + ch->pcdata->perm_hit += 10; + ch->max_hit += 10; + ch->hit +=10; + act( "Your durability increases!",ch,NULL,NULL,TO_CHAR); + act( "$n's durability increases!",ch,NULL,NULL,TO_ROOM); + return; + } + + if (!str_cmp("mana",argument)) + { + if ( cost > ch->train ) + { + send_to_char( "You don't have enough training sessions.\n\r", ch ); + return; + } + + ch->train -= cost; + ch->pcdata->perm_mana += 10; + ch->max_mana += 10; + ch->mana += 10; + act( "Your power increases!",ch,NULL,NULL,TO_CHAR); + act( "$n's power increases!",ch,NULL,NULL,TO_ROOM); + return; + } + + if ( ch->perm_stat[stat] >= get_max_train(ch,stat) ) + { + act( "Your $T is already at maximum.", ch, NULL, pOutput, TO_CHAR ); + return; + } + + if ( cost > ch->train ) + { + send_to_char( "You don't have enough training sessions.\n\r", ch ); + return; + } + + ch->train -= cost; + + ch->perm_stat[stat] += 1; + act( "Your $T increases!", ch, NULL, pOutput, TO_CHAR ); + act( "$n's $T increases!", ch, NULL, pOutput, TO_ROOM ); + return; +} diff --git a/Rom24/src/act_obj.c b/Rom24/src/act_obj.c new file mode 100644 index 0000000..ede4c33 --- /dev/null +++ b/Rom24/src/act_obj.c @@ -0,0 +1,2989 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +#if defined(macintosh) +#include +#include +#else +#include +#include +#endif +#include +#include +#include +#include "merc.h" +#include "interp.h" + +/* + * Local functions. + */ +#define CD CHAR_DATA +#define OD OBJ_DATA +bool remove_obj args( (CHAR_DATA *ch, int iWear, bool fReplace ) ); +void wear_obj args( (CHAR_DATA *ch, OBJ_DATA *obj, bool fReplace ) ); +CD * find_keeper args( (CHAR_DATA *ch ) ); +int get_cost args( (CHAR_DATA *keeper, OBJ_DATA *obj, bool fBuy ) ); +void obj_to_keeper args( (OBJ_DATA *obj, CHAR_DATA *ch ) ); +OD * get_obj_keeper args( (CHAR_DATA *ch,CHAR_DATA *keeper,char *argument)); + +#undef OD +#undef CD + +/* RT part of the corpse looting code */ + +bool can_loot(CHAR_DATA *ch, OBJ_DATA *obj) +{ + CHAR_DATA *owner, *wch; + + if (IS_IMMORTAL(ch)) + return TRUE; + + if (!obj->owner || obj->owner == NULL) + return TRUE; + + owner = NULL; + for ( wch = char_list; wch != NULL ; wch = wch->next ) + if (!str_cmp(wch->name,obj->owner)) + owner = wch; + + if (owner == NULL) + return TRUE; + + if (!str_cmp(ch->name,owner->name)) + return TRUE; + + if (!IS_NPC(owner) && IS_SET(owner->act,PLR_CANLOOT)) + return TRUE; + + if (is_same_group(ch,owner)) + return TRUE; + + return FALSE; +} + + +void get_obj( CHAR_DATA *ch, OBJ_DATA *obj, OBJ_DATA *container ) +{ + /* variables for AUTOSPLIT */ + CHAR_DATA *gch; + int members; + char buffer[100]; + + if ( !CAN_WEAR(obj, ITEM_TAKE) ) + { + send_to_char( "You can't take that.\n\r", ch ); + return; + } + + if ( ch->carry_number + get_obj_number( obj ) > can_carry_n( ch ) ) + { + act( "$d: you can't carry that many items.", + ch, NULL, obj->name, TO_CHAR ); + return; + } + + if ((!obj->in_obj || obj->in_obj->carried_by != ch) + && (get_carry_weight(ch) + get_obj_weight(obj) > can_carry_w(ch))) + { + act( "$d: you can't carry that much weight.", + ch, NULL, obj->name, TO_CHAR ); + return; + } + + if (!can_loot(ch,obj)) + { + act("Corpse looting is not permitted.",ch,NULL,NULL,TO_CHAR ); + return; + } + + if (obj->in_room != NULL) + { + for (gch = obj->in_room->people; gch != NULL; gch = gch->next_in_room) + if (gch->on == obj) + { + act("$N appears to be using $p.", + ch,obj,gch,TO_CHAR); + return; + } + } + + + if ( container != NULL ) + { + if (container->pIndexData->vnum == OBJ_VNUM_PIT + && get_trust(ch) < obj->level) + { + send_to_char("You are not powerful enough to use it.\n\r",ch); + return; + } + + if (container->pIndexData->vnum == OBJ_VNUM_PIT + && !CAN_WEAR(container, ITEM_TAKE) + && !IS_OBJ_STAT(obj,ITEM_HAD_TIMER)) + obj->timer = 0; + act( "You get $p from $P.", ch, obj, container, TO_CHAR ); + act( "$n gets $p from $P.", ch, obj, container, TO_ROOM ); + REMOVE_BIT(obj->extra_flags,ITEM_HAD_TIMER); + obj_from_obj( obj ); + } + else + { + act( "You get $p.", ch, obj, container, TO_CHAR ); + act( "$n gets $p.", ch, obj, container, TO_ROOM ); + obj_from_room( obj ); + } + + if ( obj->item_type == ITEM_MONEY) + { + ch->silver += obj->value[0]; + ch->gold += obj->value[1]; + if (IS_SET(ch->act,PLR_AUTOSPLIT)) + { /* AUTOSPLIT code */ + members = 0; + for (gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room ) + { + if (!IS_AFFECTED(gch,AFF_CHARM) && is_same_group( gch, ch ) ) + members++; + } + + if ( members > 1 && (obj->value[0] > 1 || obj->value[1])) + { + sprintf(buffer,"%d %d",obj->value[0],obj->value[1]); + do_function(ch, &do_split, buffer); + } + } + + extract_obj( obj ); + } + else + { + obj_to_char( obj, ch ); + } + + return; +} + + + +void do_get( CHAR_DATA *ch, char *argument ) +{ + char arg1[MAX_INPUT_LENGTH]; + char arg2[MAX_INPUT_LENGTH]; + OBJ_DATA *obj; + OBJ_DATA *obj_next; + OBJ_DATA *container; + bool found; + + argument = one_argument( argument, arg1 ); + argument = one_argument( argument, arg2 ); + + if (!str_cmp(arg2,"from")) + argument = one_argument(argument,arg2); + + /* Get type. */ + if ( arg1[0] == '\0' ) + { + send_to_char( "Get what?\n\r", ch ); + return; + } + + if ( arg2[0] == '\0' ) + { + if ( str_cmp( arg1, "all" ) && str_prefix( "all.", arg1 ) ) + { + /* 'get obj' */ + obj = get_obj_list( ch, arg1, ch->in_room->contents ); + if ( obj == NULL ) + { + act( "I see no $T here.", ch, NULL, arg1, TO_CHAR ); + return; + } + + get_obj( ch, obj, NULL ); + } + else + { + /* 'get all' or 'get all.obj' */ + found = FALSE; + for ( obj = ch->in_room->contents; obj != NULL; obj = obj_next ) + { + obj_next = obj->next_content; + if ( ( arg1[3] == '\0' || is_name( &arg1[4], obj->name ) ) + && can_see_obj( ch, obj ) ) + { + found = TRUE; + get_obj( ch, obj, NULL ); + } + } + + if ( !found ) + { + if ( arg1[3] == '\0' ) + send_to_char( "I see nothing here.\n\r", ch ); + else + act( "I see no $T here.", ch, NULL, &arg1[4], TO_CHAR ); + } + } + } + else + { + /* 'get ... container' */ + if ( !str_cmp( arg2, "all" ) || !str_prefix( "all.", arg2 ) ) + { + send_to_char( "You can't do that.\n\r", ch ); + return; + } + + if ( ( container = get_obj_here( ch, arg2 ) ) == NULL ) + { + act( "I see no $T here.", ch, NULL, arg2, TO_CHAR ); + return; + } + + switch ( container->item_type ) + { + default: + send_to_char( "That's not a container.\n\r", ch ); + return; + + case ITEM_CONTAINER: + case ITEM_CORPSE_NPC: + break; + + case ITEM_CORPSE_PC: + { + + if (!can_loot(ch,container)) + { + send_to_char( "You can't do that.\n\r", ch ); + return; + } + } + } + + if ( IS_SET(container->value[1], CONT_CLOSED) ) + { + act( "The $d is closed.", ch, NULL, container->name, TO_CHAR ); + return; + } + + if ( str_cmp( arg1, "all" ) && str_prefix( "all.", arg1 ) ) + { + /* 'get obj container' */ + obj = get_obj_list( ch, arg1, container->contains ); + if ( obj == NULL ) + { + act( "I see nothing like that in the $T.", + ch, NULL, arg2, TO_CHAR ); + return; + } + get_obj( ch, obj, container ); + } + else + { + /* 'get all container' or 'get all.obj container' */ + found = FALSE; + for ( obj = container->contains; obj != NULL; obj = obj_next ) + { + obj_next = obj->next_content; + if ( ( arg1[3] == '\0' || is_name( &arg1[4], obj->name ) ) + && can_see_obj( ch, obj ) ) + { + found = TRUE; + if (container->pIndexData->vnum == OBJ_VNUM_PIT + && !IS_IMMORTAL(ch)) + { + send_to_char("Don't be so greedy!\n\r",ch); + return; + } + get_obj( ch, obj, container ); + } + } + + if ( !found ) + { + if ( arg1[3] == '\0' ) + act( "I see nothing in the $T.", + ch, NULL, arg2, TO_CHAR ); + else + act( "I see nothing like that in the $T.", + ch, NULL, arg2, TO_CHAR ); + } + } + } + + return; +} + + + +void do_put( CHAR_DATA *ch, char *argument ) +{ + char arg1[MAX_INPUT_LENGTH]; + char arg2[MAX_INPUT_LENGTH]; + OBJ_DATA *container; + OBJ_DATA *obj; + OBJ_DATA *obj_next; + + argument = one_argument( argument, arg1 ); + argument = one_argument( argument, arg2 ); + + if (!str_cmp(arg2,"in") || !str_cmp(arg2,"on")) + argument = one_argument(argument,arg2); + + if ( arg1[0] == '\0' || arg2[0] == '\0' ) + { + send_to_char( "Put what in what?\n\r", ch ); + return; + } + + if ( !str_cmp( arg2, "all" ) || !str_prefix( "all.", arg2 ) ) + { + send_to_char( "You can't do that.\n\r", ch ); + return; + } + + if ( ( container = get_obj_here( ch, arg2 ) ) == NULL ) + { + act( "I see no $T here.", ch, NULL, arg2, TO_CHAR ); + return; + } + + if ( container->item_type != ITEM_CONTAINER ) + { + send_to_char( "That's not a container.\n\r", ch ); + return; + } + + if ( IS_SET(container->value[1], CONT_CLOSED) ) + { + act( "The $d is closed.", ch, NULL, container->name, TO_CHAR ); + return; + } + + if ( str_cmp( arg1, "all" ) && str_prefix( "all.", arg1 ) ) + { + /* 'put obj container' */ + if ( ( obj = get_obj_carry( ch, arg1, ch ) ) == NULL ) + { + send_to_char( "You do not have that item.\n\r", ch ); + return; + } + + if ( obj == container ) + { + send_to_char( "You can't fold it into itself.\n\r", ch ); + return; + } + + if ( !can_drop_obj( ch, obj ) ) + { + send_to_char( "You can't let go of it.\n\r", ch ); + return; + } + + if (WEIGHT_MULT(obj) != 100) + { + send_to_char("You have a feeling that would be a bad idea.\n\r",ch); + return; + } + + if (get_obj_weight( obj ) + get_true_weight( container ) + > (container->value[0] * 10) + || get_obj_weight(obj) > (container->value[3] * 10)) + { + send_to_char( "It won't fit.\n\r", ch ); + return; + } + + if (container->pIndexData->vnum == OBJ_VNUM_PIT + && !CAN_WEAR(container,ITEM_TAKE)) + { if (obj->timer) + SET_BIT(obj->extra_flags,ITEM_HAD_TIMER); + else + obj->timer = number_range(100,200); + } + obj_from_char( obj ); + obj_to_obj( obj, container ); + + if (IS_SET(container->value[1],CONT_PUT_ON)) + { + act("$n puts $p on $P.",ch,obj,container, TO_ROOM); + act("You put $p on $P.",ch,obj,container, TO_CHAR); + } + else + { + act( "$n puts $p in $P.", ch, obj, container, TO_ROOM ); + act( "You put $p in $P.", ch, obj, container, TO_CHAR ); + } + } + else + { + /* 'put all container' or 'put all.obj container' */ + for ( obj = ch->carrying; obj != NULL; obj = obj_next ) + { + obj_next = obj->next_content; + + if ( ( arg1[3] == '\0' || is_name( &arg1[4], obj->name ) ) + && can_see_obj( ch, obj ) + && WEIGHT_MULT(obj) == 100 + && obj->wear_loc == WEAR_NONE + && obj != container + && can_drop_obj( ch, obj ) + && get_obj_weight( obj ) + get_true_weight( container ) + <= (container->value[0] * 10) + && get_obj_weight(obj) < (container->value[3] * 10)) + { + if (container->pIndexData->vnum == OBJ_VNUM_PIT + && !CAN_WEAR(obj, ITEM_TAKE) ) + { if (obj->timer) + SET_BIT(obj->extra_flags,ITEM_HAD_TIMER); + else + obj->timer = number_range(100,200); + } + obj_from_char( obj ); + obj_to_obj( obj, container ); + + if (IS_SET(container->value[1],CONT_PUT_ON)) + { + act("$n puts $p on $P.",ch,obj,container, TO_ROOM); + act("You put $p on $P.",ch,obj,container, TO_CHAR); + } + else + { + act( "$n puts $p in $P.", ch, obj, container, TO_ROOM ); + act( "You put $p in $P.", ch, obj, container, TO_CHAR ); + } + } + } + } + + return; +} + + + +void do_drop( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + OBJ_DATA *obj; + OBJ_DATA *obj_next; + bool found; + + argument = one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + { + send_to_char( "Drop what?\n\r", ch ); + return; + } + + if ( is_number( arg ) ) + { + /* 'drop NNNN coins' */ + int amount, gold = 0, silver = 0; + + amount = atoi(arg); + argument = one_argument( argument, arg ); + if ( amount <= 0 + || ( str_cmp( arg, "coins" ) && str_cmp( arg, "coin" ) && + str_cmp( arg, "gold" ) && str_cmp( arg, "silver") ) ) + { + send_to_char( "Sorry, you can't do that.\n\r", ch ); + return; + } + + if ( !str_cmp( arg, "coins") || !str_cmp(arg,"coin") + || !str_cmp( arg, "silver")) + { + if (ch->silver < amount) + { + send_to_char("You don't have that much silver.\n\r",ch); + return; + } + + ch->silver -= amount; + silver = amount; + } + + else + { + if (ch->gold < amount) + { + send_to_char("You don't have that much gold.\n\r",ch); + return; + } + + ch->gold -= amount; + gold = amount; + } + + for ( obj = ch->in_room->contents; obj != NULL; obj = obj_next ) + { + obj_next = obj->next_content; + + switch ( obj->pIndexData->vnum ) + { + case OBJ_VNUM_SILVER_ONE: + silver += 1; + extract_obj(obj); + break; + + case OBJ_VNUM_GOLD_ONE: + gold += 1; + extract_obj( obj ); + break; + + case OBJ_VNUM_SILVER_SOME: + silver += obj->value[0]; + extract_obj(obj); + break; + + case OBJ_VNUM_GOLD_SOME: + gold += obj->value[1]; + extract_obj( obj ); + break; + + case OBJ_VNUM_COINS: + silver += obj->value[0]; + gold += obj->value[1]; + extract_obj(obj); + break; + } + } + + obj_to_room( create_money( gold, silver ), ch->in_room ); + act( "$n drops some coins.", ch, NULL, NULL, TO_ROOM ); + send_to_char( "OK.\n\r", ch ); + return; + } + + if ( str_cmp( arg, "all" ) && str_prefix( "all.", arg ) ) + { + /* 'drop obj' */ + if ( ( obj = get_obj_carry( ch, arg, ch ) ) == NULL ) + { + send_to_char( "You do not have that item.\n\r", ch ); + return; + } + + if ( !can_drop_obj( ch, obj ) ) + { + send_to_char( "You can't let go of it.\n\r", ch ); + return; + } + + obj_from_char( obj ); + obj_to_room( obj, ch->in_room ); + act( "$n drops $p.", ch, obj, NULL, TO_ROOM ); + act( "You drop $p.", ch, obj, NULL, TO_CHAR ); + if (IS_OBJ_STAT(obj,ITEM_MELT_DROP)) + { + act("$p dissolves into smoke.",ch,obj,NULL,TO_ROOM); + act("$p dissolves into smoke.",ch,obj,NULL,TO_CHAR); + extract_obj(obj); + } + } + else + { + /* 'drop all' or 'drop all.obj' */ + found = FALSE; + for ( obj = ch->carrying; obj != NULL; obj = obj_next ) + { + obj_next = obj->next_content; + + if ( ( arg[3] == '\0' || is_name( &arg[4], obj->name ) ) + && can_see_obj( ch, obj ) + && obj->wear_loc == WEAR_NONE + && can_drop_obj( ch, obj ) ) + { + found = TRUE; + obj_from_char( obj ); + obj_to_room( obj, ch->in_room ); + act( "$n drops $p.", ch, obj, NULL, TO_ROOM ); + act( "You drop $p.", ch, obj, NULL, TO_CHAR ); + if (IS_OBJ_STAT(obj,ITEM_MELT_DROP)) + { + act("$p dissolves into smoke.",ch,obj,NULL,TO_ROOM); + act("$p dissolves into smoke.",ch,obj,NULL,TO_CHAR); + extract_obj(obj); + } + } + } + + if ( !found ) + { + if ( arg[3] == '\0' ) + act( "You are not carrying anything.", + ch, NULL, arg, TO_CHAR ); + else + act( "You are not carrying any $T.", + ch, NULL, &arg[4], TO_CHAR ); + } + } + + return; +} + + + +void do_give( CHAR_DATA *ch, char *argument ) +{ + char arg1 [MAX_INPUT_LENGTH]; + char arg2 [MAX_INPUT_LENGTH]; + char buf[MAX_STRING_LENGTH]; + CHAR_DATA *victim; + OBJ_DATA *obj; + + argument = one_argument( argument, arg1 ); + argument = one_argument( argument, arg2 ); + + if ( arg1[0] == '\0' || arg2[0] == '\0' ) + { + send_to_char( "Give what to whom?\n\r", ch ); + return; + } + + if ( is_number( arg1 ) ) + { + /* 'give NNNN coins victim' */ + int amount; + bool silver; + + amount = atoi(arg1); + if ( amount <= 0 + || ( str_cmp( arg2, "coins" ) && str_cmp( arg2, "coin" ) && + str_cmp( arg2, "gold" ) && str_cmp( arg2, "silver")) ) + { + send_to_char( "Sorry, you can't do that.\n\r", ch ); + return; + } + + silver = str_cmp(arg2,"gold"); + + argument = one_argument( argument, arg2 ); + if ( arg2[0] == '\0' ) + { + send_to_char( "Give what to whom?\n\r", ch ); + return; + } + + if ( ( victim = get_char_room( ch, arg2 ) ) == NULL ) + { + send_to_char( "They aren't here.\n\r", ch ); + return; + } + + if ( (!silver && ch->gold < amount) || (silver && ch->silver < amount) ) + { + send_to_char( "You haven't got that much.\n\r", ch ); + return; + } + + if (silver) + { + ch->silver -= amount; + victim->silver += amount; + } + else + { + ch->gold -= amount; + victim->gold += amount; + } + + sprintf(buf,"$n gives you %d %s.",amount, silver ? "silver" : "gold"); + act( buf, ch, NULL, victim, TO_VICT ); + act( "$n gives $N some coins.", ch, NULL, victim, TO_NOTVICT ); + sprintf(buf,"You give $N %d %s.",amount, silver ? "silver" : "gold"); + act( buf, ch, NULL, victim, TO_CHAR ); + + if (IS_NPC(victim) && IS_SET(victim->act,ACT_IS_CHANGER)) + { + int change; + + change = (silver ? 95 * amount / 100 / 100 + : 95 * amount); + + + if (!silver && change > victim->silver) + victim->silver += change; + + if (silver && change > victim->gold) + victim->gold += change; + + if (change < 1 && can_see(victim,ch)) + { + act( + "$n tells you 'I'm sorry, you did not give me enough to change.'" + ,victim,NULL,ch,TO_VICT); + ch->reply = victim; + sprintf(buf,"%d %s %s", + amount, silver ? "silver" : "gold",ch->name); + do_function(victim, &do_give, buf); + } + else if (can_see(victim,ch)) + { + sprintf(buf,"%d %s %s", + change, silver ? "gold" : "silver",ch->name); + do_function(victim, &do_give, buf); + if (silver) + { + sprintf(buf,"%d silver %s", + (95 * amount / 100 - change * 100),ch->name); + do_function(victim, &do_give, buf); + } + act("$n tells you 'Thank you, come again.'", + victim,NULL,ch,TO_VICT); + ch->reply = victim; + } + } + return; + } + + if ( ( obj = get_obj_carry( ch, arg1, ch ) ) == NULL ) + { + send_to_char( "You do not have that item.\n\r", ch ); + return; + } + + if ( obj->wear_loc != WEAR_NONE ) + { + send_to_char( "You must remove it first.\n\r", ch ); + return; + } + + if ( ( victim = get_char_room( ch, arg2 ) ) == NULL ) + { + send_to_char( "They aren't here.\n\r", ch ); + return; + } + + if (IS_NPC(victim) && victim->pIndexData->pShop != NULL) + { + act("$N tells you 'Sorry, you'll have to sell that.'", + ch,NULL,victim,TO_CHAR); + ch->reply = victim; + return; + } + + if ( !can_drop_obj( ch, obj ) ) + { + send_to_char( "You can't let go of it.\n\r", ch ); + return; + } + + if ( victim->carry_number + get_obj_number( obj ) > can_carry_n( victim ) ) + { + act( "$N has $S hands full.", ch, NULL, victim, TO_CHAR ); + return; + } + + if (get_carry_weight(victim) + get_obj_weight(obj) > can_carry_w( victim ) ) + { + act( "$N can't carry that much weight.", ch, NULL, victim, TO_CHAR ); + return; + } + + if ( !can_see_obj( victim, obj ) ) + { + act( "$N can't see it.", ch, NULL, victim, TO_CHAR ); + return; + } + + obj_from_char( obj ); + obj_to_char( obj, victim ); + act( "$n gives $p to $N.", ch, obj, victim, TO_NOTVICT ); + act( "$n gives you $p.", ch, obj, victim, TO_VICT ); + act( "You give $p to $N.", ch, obj, victim, TO_CHAR ); + return; +} + + +/* for poisoning weapons and food/drink */ +void do_envenom(CHAR_DATA *ch, char *argument) +{ + OBJ_DATA *obj; + AFFECT_DATA af; + int percent,skill; + + /* find out what */ + if (argument[0] == '\0') + { + send_to_char("Envenom what item?\n\r",ch); + return; + } + + obj = get_obj_list(ch,argument,ch->carrying); + + if (obj== NULL) + { + send_to_char("You don't have that item.\n\r",ch); + return; + } + + if ((skill = get_skill(ch,gsn_envenom)) < 1) + { + send_to_char("Are you crazy? You'd poison yourself!\n\r",ch); + return; + } + + if (obj->item_type == ITEM_FOOD || obj->item_type == ITEM_DRINK_CON) + { + if (IS_OBJ_STAT(obj,ITEM_BLESS) || IS_OBJ_STAT(obj,ITEM_BURN_PROOF)) + { + act("You fail to poison $p.",ch,obj,NULL,TO_CHAR); + return; + } + + if (number_percent() < skill) /* success! */ + { + act("$n treats $p with deadly poison.",ch,obj,NULL,TO_ROOM); + act("You treat $p with deadly poison.",ch,obj,NULL,TO_CHAR); + if (!obj->value[3]) + { + obj->value[3] = 1; + check_improve(ch,gsn_envenom,TRUE,4); + } + WAIT_STATE(ch,skill_table[gsn_envenom].beats); + return; + } + + act("You fail to poison $p.",ch,obj,NULL,TO_CHAR); + if (!obj->value[3]) + check_improve(ch,gsn_envenom,FALSE,4); + WAIT_STATE(ch,skill_table[gsn_envenom].beats); + return; + } + + if (obj->item_type == ITEM_WEAPON) + { + if (IS_WEAPON_STAT(obj,WEAPON_FLAMING) + || IS_WEAPON_STAT(obj,WEAPON_FROST) + || IS_WEAPON_STAT(obj,WEAPON_VAMPIRIC) + || IS_WEAPON_STAT(obj,WEAPON_SHARP) + || IS_WEAPON_STAT(obj,WEAPON_VORPAL) + || IS_WEAPON_STAT(obj,WEAPON_SHOCKING) + || IS_OBJ_STAT(obj,ITEM_BLESS) || IS_OBJ_STAT(obj,ITEM_BURN_PROOF)) + { + act("You can't seem to envenom $p.",ch,obj,NULL,TO_CHAR); + return; + } + + if (obj->value[3] < 0 + || attack_table[obj->value[3]].damage == DAM_BASH) + { + send_to_char("You can only envenom edged weapons.\n\r",ch); + return; + } + + if (IS_WEAPON_STAT(obj,WEAPON_POISON)) + { + act("$p is already envenomed.",ch,obj,NULL,TO_CHAR); + return; + } + + percent = number_percent(); + if (percent < skill) + { + + af.where = TO_WEAPON; + af.type = gsn_poison; + af.level = ch->level * percent / 100; + af.duration = ch->level/2 * percent / 100; + af.location = 0; + af.modifier = 0; + af.bitvector = WEAPON_POISON; + affect_to_obj(obj,&af); + + act("$n coats $p with deadly venom.",ch,obj,NULL,TO_ROOM); + act("You coat $p with venom.",ch,obj,NULL,TO_CHAR); + check_improve(ch,gsn_envenom,TRUE,3); + WAIT_STATE(ch,skill_table[gsn_envenom].beats); + return; + } + else + { + act("You fail to envenom $p.",ch,obj,NULL,TO_CHAR); + check_improve(ch,gsn_envenom,FALSE,3); + WAIT_STATE(ch,skill_table[gsn_envenom].beats); + return; + } + } + + act("You can't poison $p.",ch,obj,NULL,TO_CHAR); + return; +} + +void do_fill( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + char buf[MAX_STRING_LENGTH]; + OBJ_DATA *obj; + OBJ_DATA *fountain; + bool found; + + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + { + send_to_char( "Fill what?\n\r", ch ); + return; + } + + if ( ( obj = get_obj_carry( ch, arg, ch ) ) == NULL ) + { + send_to_char( "You do not have that item.\n\r", ch ); + return; + } + + found = FALSE; + for ( fountain = ch->in_room->contents; fountain != NULL; + fountain = fountain->next_content ) + { + if ( fountain->item_type == ITEM_FOUNTAIN ) + { + found = TRUE; + break; + } + } + + if ( !found ) + { + send_to_char( "There is no fountain here!\n\r", ch ); + return; + } + + if ( obj->item_type != ITEM_DRINK_CON ) + { + send_to_char( "You can't fill that.\n\r", ch ); + return; + } + + if ( obj->value[1] != 0 && obj->value[2] != fountain->value[2] ) + { + send_to_char( "There is already another liquid in it.\n\r", ch ); + return; + } + + if ( obj->value[1] >= obj->value[0] ) + { + send_to_char( "Your container is full.\n\r", ch ); + return; + } + + sprintf(buf,"You fill $p with %s from $P.", + liq_table[fountain->value[2]].liq_name); + act( buf, ch, obj,fountain, TO_CHAR ); + sprintf(buf,"$n fills $p with %s from $P.", + liq_table[fountain->value[2]].liq_name); + act(buf,ch,obj,fountain,TO_ROOM); + obj->value[2] = fountain->value[2]; + obj->value[1] = obj->value[0]; + return; +} + +void do_pour (CHAR_DATA *ch, char *argument) +{ + char arg[MAX_STRING_LENGTH],buf[MAX_STRING_LENGTH]; + OBJ_DATA *out, *in; + CHAR_DATA *vch = NULL; + int amount; + + argument = one_argument(argument,arg); + + if (arg[0] == '\0' || argument[0] == '\0') + { + send_to_char("Pour what into what?\n\r",ch); + return; + } + + + if ((out = get_obj_carry(ch,arg, ch)) == NULL) + { + send_to_char("You don't have that item.\n\r",ch); + return; + } + + if (out->item_type != ITEM_DRINK_CON) + { + send_to_char("That's not a drink container.\n\r",ch); + return; + } + + if (!str_cmp(argument,"out")) + { + if (out->value[1] == 0) + { + send_to_char("It's already empty.\n\r",ch); + return; + } + + out->value[1] = 0; + out->value[3] = 0; + sprintf(buf,"You invert $p, spilling %s all over the ground.", + liq_table[out->value[2]].liq_name); + act(buf,ch,out,NULL,TO_CHAR); + + sprintf(buf,"$n inverts $p, spilling %s all over the ground.", + liq_table[out->value[2]].liq_name); + act(buf,ch,out,NULL,TO_ROOM); + return; + } + + if ((in = get_obj_here(ch,argument)) == NULL) + { + vch = get_char_room(ch,argument); + + if (vch == NULL) + { + send_to_char("Pour into what?\n\r",ch); + return; + } + + in = get_eq_char(vch,WEAR_HOLD); + + if (in == NULL) + { + send_to_char("They aren't holding anything.",ch); + return; + } + } + + if (in->item_type != ITEM_DRINK_CON) + { + send_to_char("You can only pour into other drink containers.\n\r",ch); + return; + } + + if (in == out) + { + send_to_char("You cannot change the laws of physics!\n\r",ch); + return; + } + + if (in->value[1] != 0 && in->value[2] != out->value[2]) + { + send_to_char("They don't hold the same liquid.\n\r",ch); + return; + } + + if (out->value[1] == 0) + { + act("There's nothing in $p to pour.",ch,out,NULL,TO_CHAR); + return; + } + + if (in->value[1] >= in->value[0]) + { + act("$p is already filled to the top.",ch,in,NULL,TO_CHAR); + return; + } + + amount = UMIN(out->value[1],in->value[0] - in->value[1]); + + in->value[1] += amount; + out->value[1] -= amount; + in->value[2] = out->value[2]; + + if (vch == NULL) + { + sprintf(buf,"You pour %s from $p into $P.", + liq_table[out->value[2]].liq_name); + act(buf,ch,out,in,TO_CHAR); + sprintf(buf,"$n pours %s from $p into $P.", + liq_table[out->value[2]].liq_name); + act(buf,ch,out,in,TO_ROOM); + } + else + { + sprintf(buf,"You pour some %s for $N.", + liq_table[out->value[2]].liq_name); + act(buf,ch,NULL,vch,TO_CHAR); + sprintf(buf,"$n pours you some %s.", + liq_table[out->value[2]].liq_name); + act(buf,ch,NULL,vch,TO_VICT); + sprintf(buf,"$n pours some %s for $N.", + liq_table[out->value[2]].liq_name); + act(buf,ch,NULL,vch,TO_NOTVICT); + + } +} + +void do_drink( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + OBJ_DATA *obj; + int amount; + int liquid; + + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + { + for ( obj = ch->in_room->contents; obj; obj = obj->next_content ) + { + if ( obj->item_type == ITEM_FOUNTAIN ) + break; + } + + if ( obj == NULL ) + { + send_to_char( "Drink what?\n\r", ch ); + return; + } + } + else + { + if ( ( obj = get_obj_here( ch, arg ) ) == NULL ) + { + send_to_char( "You can't find it.\n\r", ch ); + return; + } + } + + if ( !IS_NPC(ch) && ch->pcdata->condition[COND_DRUNK] > 10 ) + { + send_to_char( "You fail to reach your mouth. *Hic*\n\r", ch ); + return; + } + + switch ( obj->item_type ) + { + default: + send_to_char( "You can't drink from that.\n\r", ch ); + return; + + case ITEM_FOUNTAIN: + if ( ( liquid = obj->value[2] ) < 0 ) + { + bug( "Do_drink: bad liquid number %d.", liquid ); + liquid = obj->value[2] = 0; + } + amount = liq_table[liquid].liq_affect[4] * 3; + break; + + case ITEM_DRINK_CON: + if ( obj->value[1] <= 0 ) + { + send_to_char( "It is already empty.\n\r", ch ); + return; + } + + if ( ( liquid = obj->value[2] ) < 0 ) + { + bug( "Do_drink: bad liquid number %d.", liquid ); + liquid = obj->value[2] = 0; + } + + amount = liq_table[liquid].liq_affect[4]; + amount = UMIN(amount, obj->value[1]); + break; + } + if (!IS_NPC(ch) && !IS_IMMORTAL(ch) + && ch->pcdata->condition[COND_FULL] > 45) + { + send_to_char("You're too full to drink more.\n\r",ch); + return; + } + + act( "$n drinks $T from $p.", + ch, obj, liq_table[liquid].liq_name, TO_ROOM ); + act( "You drink $T from $p.", + ch, obj, liq_table[liquid].liq_name, TO_CHAR ); + + gain_condition( ch, COND_DRUNK, + amount * liq_table[liquid].liq_affect[COND_DRUNK] / 36 ); + gain_condition( ch, COND_FULL, + amount * liq_table[liquid].liq_affect[COND_FULL] / 4 ); + gain_condition( ch, COND_THIRST, + amount * liq_table[liquid].liq_affect[COND_THIRST] / 10 ); + gain_condition(ch, COND_HUNGER, + amount * liq_table[liquid].liq_affect[COND_HUNGER] / 2 ); + + if ( !IS_NPC(ch) && ch->pcdata->condition[COND_DRUNK] > 10 ) + send_to_char( "You feel drunk.\n\r", ch ); + if ( !IS_NPC(ch) && ch->pcdata->condition[COND_FULL] > 40 ) + send_to_char( "You are full.\n\r", ch ); + if ( !IS_NPC(ch) && ch->pcdata->condition[COND_THIRST] > 40 ) + send_to_char( "Your thirst is quenched.\n\r", ch ); + + if ( obj->value[3] != 0 ) + { + /* The drink was poisoned ! */ + AFFECT_DATA af; + + act( "$n chokes and gags.", ch, NULL, NULL, TO_ROOM ); + send_to_char( "You choke and gag.\n\r", ch ); + af.where = TO_AFFECTS; + af.type = gsn_poison; + af.level = number_fuzzy(amount); + af.duration = 3 * amount; + af.location = APPLY_NONE; + af.modifier = 0; + af.bitvector = AFF_POISON; + affect_join( ch, &af ); + } + + if (obj->value[0] > 0) + obj->value[1] -= amount; + + return; +} + + + +void do_eat( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + OBJ_DATA *obj; + + one_argument( argument, arg ); + if ( arg[0] == '\0' ) + { + send_to_char( "Eat what?\n\r", ch ); + return; + } + + if ( ( obj = get_obj_carry( ch, arg, ch ) ) == NULL ) + { + send_to_char( "You do not have that item.\n\r", ch ); + return; + } + + if ( !IS_IMMORTAL(ch) ) + { + if ( obj->item_type != ITEM_FOOD && obj->item_type != ITEM_PILL ) + { + send_to_char( "That's not edible.\n\r", ch ); + return; + } + + if ( !IS_NPC(ch) && ch->pcdata->condition[COND_FULL] > 40 ) + { + send_to_char( "You are too full to eat more.\n\r", ch ); + return; + } + } + + act( "$n eats $p.", ch, obj, NULL, TO_ROOM ); + act( "You eat $p.", ch, obj, NULL, TO_CHAR ); + + switch ( obj->item_type ) + { + + case ITEM_FOOD: + if ( !IS_NPC(ch) ) + { + int condition; + + condition = ch->pcdata->condition[COND_HUNGER]; + gain_condition( ch, COND_FULL, obj->value[0] ); + gain_condition( ch, COND_HUNGER, obj->value[1]); + if ( condition == 0 && ch->pcdata->condition[COND_HUNGER] > 0 ) + send_to_char( "You are no longer hungry.\n\r", ch ); + else if ( ch->pcdata->condition[COND_FULL] > 40 ) + send_to_char( "You are full.\n\r", ch ); + } + + if ( obj->value[3] != 0 ) + { + /* The food was poisoned! */ + AFFECT_DATA af; + + act( "$n chokes and gags.", ch, 0, 0, TO_ROOM ); + send_to_char( "You choke and gag.\n\r", ch ); + + af.where = TO_AFFECTS; + af.type = gsn_poison; + af.level = number_fuzzy(obj->value[0]); + af.duration = 2 * obj->value[0]; + af.location = APPLY_NONE; + af.modifier = 0; + af.bitvector = AFF_POISON; + affect_join( ch, &af ); + } + break; + + case ITEM_PILL: + obj_cast_spell( obj->value[1], obj->value[0], ch, ch, NULL ); + obj_cast_spell( obj->value[2], obj->value[0], ch, ch, NULL ); + obj_cast_spell( obj->value[3], obj->value[0], ch, ch, NULL ); + break; + } + + extract_obj( obj ); + return; +} + + + +/* + * Remove an object. + */ +bool remove_obj( CHAR_DATA *ch, int iWear, bool fReplace ) +{ + OBJ_DATA *obj; + + if ( ( obj = get_eq_char( ch, iWear ) ) == NULL ) + return TRUE; + + if ( !fReplace ) + return FALSE; + + if ( IS_SET(obj->extra_flags, ITEM_NOREMOVE) ) + { + act( "You can't remove $p.", ch, obj, NULL, TO_CHAR ); + return FALSE; + } + + unequip_char( ch, obj ); + act( "$n stops using $p.", ch, obj, NULL, TO_ROOM ); + act( "You stop using $p.", ch, obj, NULL, TO_CHAR ); + return TRUE; +} + + + +/* + * Wear one object. + * Optional replacement of existing objects. + * Big repetitive code, ick. + */ +void wear_obj( CHAR_DATA *ch, OBJ_DATA *obj, bool fReplace ) +{ + char buf[MAX_STRING_LENGTH]; + + if ( ch->level < obj->level ) + { + sprintf( buf, "You must be level %d to use this object.\n\r", + obj->level ); + send_to_char( buf, ch ); + act( "$n tries to use $p, but is too inexperienced.", + ch, obj, NULL, TO_ROOM ); + return; + } + + if ( obj->item_type == ITEM_LIGHT ) + { + if ( !remove_obj( ch, WEAR_LIGHT, fReplace ) ) + return; + act( "$n lights $p and holds it.", ch, obj, NULL, TO_ROOM ); + act( "You light $p and hold it.", ch, obj, NULL, TO_CHAR ); + equip_char( ch, obj, WEAR_LIGHT ); + return; + } + + if ( CAN_WEAR( obj, ITEM_WEAR_FINGER ) ) + { + if ( get_eq_char( ch, WEAR_FINGER_L ) != NULL + && get_eq_char( ch, WEAR_FINGER_R ) != NULL + && !remove_obj( ch, WEAR_FINGER_L, fReplace ) + && !remove_obj( ch, WEAR_FINGER_R, fReplace ) ) + return; + + if ( get_eq_char( ch, WEAR_FINGER_L ) == NULL ) + { + act( "$n wears $p on $s left finger.", ch, obj, NULL, TO_ROOM ); + act( "You wear $p on your left finger.", ch, obj, NULL, TO_CHAR ); + equip_char( ch, obj, WEAR_FINGER_L ); + return; + } + + if ( get_eq_char( ch, WEAR_FINGER_R ) == NULL ) + { + act( "$n wears $p on $s right finger.", ch, obj, NULL, TO_ROOM ); + act( "You wear $p on your right finger.", ch, obj, NULL, TO_CHAR ); + equip_char( ch, obj, WEAR_FINGER_R ); + return; + } + + bug( "Wear_obj: no free finger.", 0 ); + send_to_char( "You already wear two rings.\n\r", ch ); + return; + } + + if ( CAN_WEAR( obj, ITEM_WEAR_NECK ) ) + { + if ( get_eq_char( ch, WEAR_NECK_1 ) != NULL + && get_eq_char( ch, WEAR_NECK_2 ) != NULL + && !remove_obj( ch, WEAR_NECK_1, fReplace ) + && !remove_obj( ch, WEAR_NECK_2, fReplace ) ) + return; + + if ( get_eq_char( ch, WEAR_NECK_1 ) == NULL ) + { + act( "$n wears $p around $s neck.", ch, obj, NULL, TO_ROOM ); + act( "You wear $p around your neck.", ch, obj, NULL, TO_CHAR ); + equip_char( ch, obj, WEAR_NECK_1 ); + return; + } + + if ( get_eq_char( ch, WEAR_NECK_2 ) == NULL ) + { + act( "$n wears $p around $s neck.", ch, obj, NULL, TO_ROOM ); + act( "You wear $p around your neck.", ch, obj, NULL, TO_CHAR ); + equip_char( ch, obj, WEAR_NECK_2 ); + return; + } + + bug( "Wear_obj: no free neck.", 0 ); + send_to_char( "You already wear two neck items.\n\r", ch ); + return; + } + + if ( CAN_WEAR( obj, ITEM_WEAR_BODY ) ) + { + if ( !remove_obj( ch, WEAR_BODY, fReplace ) ) + return; + act( "$n wears $p on $s torso.", ch, obj, NULL, TO_ROOM ); + act( "You wear $p on your torso.", ch, obj, NULL, TO_CHAR ); + equip_char( ch, obj, WEAR_BODY ); + return; + } + + if ( CAN_WEAR( obj, ITEM_WEAR_HEAD ) ) + { + if ( !remove_obj( ch, WEAR_HEAD, fReplace ) ) + return; + act( "$n wears $p on $s head.", ch, obj, NULL, TO_ROOM ); + act( "You wear $p on your head.", ch, obj, NULL, TO_CHAR ); + equip_char( ch, obj, WEAR_HEAD ); + return; + } + + if ( CAN_WEAR( obj, ITEM_WEAR_LEGS ) ) + { + if ( !remove_obj( ch, WEAR_LEGS, fReplace ) ) + return; + act( "$n wears $p on $s legs.", ch, obj, NULL, TO_ROOM ); + act( "You wear $p on your legs.", ch, obj, NULL, TO_CHAR ); + equip_char( ch, obj, WEAR_LEGS ); + return; + } + + if ( CAN_WEAR( obj, ITEM_WEAR_FEET ) ) + { + if ( !remove_obj( ch, WEAR_FEET, fReplace ) ) + return; + act( "$n wears $p on $s feet.", ch, obj, NULL, TO_ROOM ); + act( "You wear $p on your feet.", ch, obj, NULL, TO_CHAR ); + equip_char( ch, obj, WEAR_FEET ); + return; + } + + if ( CAN_WEAR( obj, ITEM_WEAR_HANDS ) ) + { + if ( !remove_obj( ch, WEAR_HANDS, fReplace ) ) + return; + act( "$n wears $p on $s hands.", ch, obj, NULL, TO_ROOM ); + act( "You wear $p on your hands.", ch, obj, NULL, TO_CHAR ); + equip_char( ch, obj, WEAR_HANDS ); + return; + } + + if ( CAN_WEAR( obj, ITEM_WEAR_ARMS ) ) + { + if ( !remove_obj( ch, WEAR_ARMS, fReplace ) ) + return; + act( "$n wears $p on $s arms.", ch, obj, NULL, TO_ROOM ); + act( "You wear $p on your arms.", ch, obj, NULL, TO_CHAR ); + equip_char( ch, obj, WEAR_ARMS ); + return; + } + + if ( CAN_WEAR( obj, ITEM_WEAR_ABOUT ) ) + { + if ( !remove_obj( ch, WEAR_ABOUT, fReplace ) ) + return; + act( "$n wears $p about $s torso.", ch, obj, NULL, TO_ROOM ); + act( "You wear $p about your torso.", ch, obj, NULL, TO_CHAR ); + equip_char( ch, obj, WEAR_ABOUT ); + return; + } + + if ( CAN_WEAR( obj, ITEM_WEAR_WAIST ) ) + { + if ( !remove_obj( ch, WEAR_WAIST, fReplace ) ) + return; + act( "$n wears $p about $s waist.", ch, obj, NULL, TO_ROOM ); + act( "You wear $p about your waist.", ch, obj, NULL, TO_CHAR ); + equip_char( ch, obj, WEAR_WAIST ); + return; + } + + if ( CAN_WEAR( obj, ITEM_WEAR_WRIST ) ) + { + if ( get_eq_char( ch, WEAR_WRIST_L ) != NULL + && get_eq_char( ch, WEAR_WRIST_R ) != NULL + && !remove_obj( ch, WEAR_WRIST_L, fReplace ) + && !remove_obj( ch, WEAR_WRIST_R, fReplace ) ) + return; + + if ( get_eq_char( ch, WEAR_WRIST_L ) == NULL ) + { + act( "$n wears $p around $s left wrist.", + ch, obj, NULL, TO_ROOM ); + act( "You wear $p around your left wrist.", + ch, obj, NULL, TO_CHAR ); + equip_char( ch, obj, WEAR_WRIST_L ); + return; + } + + if ( get_eq_char( ch, WEAR_WRIST_R ) == NULL ) + { + act( "$n wears $p around $s right wrist.", + ch, obj, NULL, TO_ROOM ); + act( "You wear $p around your right wrist.", + ch, obj, NULL, TO_CHAR ); + equip_char( ch, obj, WEAR_WRIST_R ); + return; + } + + bug( "Wear_obj: no free wrist.", 0 ); + send_to_char( "You already wear two wrist items.\n\r", ch ); + return; + } + + if ( CAN_WEAR( obj, ITEM_WEAR_SHIELD ) ) + { + OBJ_DATA *weapon; + + if ( !remove_obj( ch, WEAR_SHIELD, fReplace ) ) + return; + + weapon = get_eq_char(ch,WEAR_WIELD); + if (weapon != NULL && ch->size < SIZE_LARGE + && IS_WEAPON_STAT(weapon,WEAPON_TWO_HANDS)) + { + send_to_char("Your hands are tied up with your weapon!\n\r",ch); + return; + } + + act( "$n wears $p as a shield.", ch, obj, NULL, TO_ROOM ); + act( "You wear $p as a shield.", ch, obj, NULL, TO_CHAR ); + equip_char( ch, obj, WEAR_SHIELD ); + return; + } + + if ( CAN_WEAR( obj, ITEM_WIELD ) ) + { + int sn,skill; + + if ( !remove_obj( ch, WEAR_WIELD, fReplace ) ) + return; + + if ( !IS_NPC(ch) + && get_obj_weight(obj) > (str_app[get_curr_stat(ch,STAT_STR)].wield + * 10)) + { + send_to_char( "It is too heavy for you to wield.\n\r", ch ); + return; + } + + if (!IS_NPC(ch) && ch->size < SIZE_LARGE + && IS_WEAPON_STAT(obj,WEAPON_TWO_HANDS) + && get_eq_char(ch,WEAR_SHIELD) != NULL) + { + send_to_char("You need two hands free for that weapon.\n\r",ch); + return; + } + + act( "$n wields $p.", ch, obj, NULL, TO_ROOM ); + act( "You wield $p.", ch, obj, NULL, TO_CHAR ); + equip_char( ch, obj, WEAR_WIELD ); + + sn = get_weapon_sn(ch); + + if (sn == gsn_hand_to_hand) + return; + + skill = get_weapon_skill(ch,sn); + + if (skill >= 100) + act("$p feels like a part of you!",ch,obj,NULL,TO_CHAR); + else if (skill > 85) + act("You feel quite confident with $p.",ch,obj,NULL,TO_CHAR); + else if (skill > 70) + act("You are skilled with $p.",ch,obj,NULL,TO_CHAR); + else if (skill > 50) + act("Your skill with $p is adequate.",ch,obj,NULL,TO_CHAR); + else if (skill > 25) + act("$p feels a little clumsy in your hands.",ch,obj,NULL,TO_CHAR); + else if (skill > 1) + act("You fumble and almost drop $p.",ch,obj,NULL,TO_CHAR); + else + act("You don't even know which end is up on $p.", + ch,obj,NULL,TO_CHAR); + + return; + } + + if ( CAN_WEAR( obj, ITEM_HOLD ) ) + { + if ( !remove_obj( ch, WEAR_HOLD, fReplace ) ) + return; + act( "$n holds $p in $s hand.", ch, obj, NULL, TO_ROOM ); + act( "You hold $p in your hand.", ch, obj, NULL, TO_CHAR ); + equip_char( ch, obj, WEAR_HOLD ); + return; + } + + if ( CAN_WEAR(obj,ITEM_WEAR_FLOAT) ) + { + if (!remove_obj(ch,WEAR_FLOAT, fReplace) ) + return; + act("$n releases $p to float next to $m.",ch,obj,NULL,TO_ROOM); + act("You release $p and it floats next to you.",ch,obj,NULL,TO_CHAR); + equip_char(ch,obj,WEAR_FLOAT); + return; + } + + if ( fReplace ) + send_to_char( "You can't wear, wield, or hold that.\n\r", ch ); + + return; +} + + + +void do_wear( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + OBJ_DATA *obj; + + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + { + send_to_char( "Wear, wield, or hold what?\n\r", ch ); + return; + } + + if ( !str_cmp( arg, "all" ) ) + { + OBJ_DATA *obj_next; + + for ( obj = ch->carrying; obj != NULL; obj = obj_next ) + { + obj_next = obj->next_content; + if ( obj->wear_loc == WEAR_NONE && can_see_obj( ch, obj ) ) + wear_obj( ch, obj, FALSE ); + } + return; + } + else + { + if ( ( obj = get_obj_carry( ch, arg, ch ) ) == NULL ) + { + send_to_char( "You do not have that item.\n\r", ch ); + return; + } + + wear_obj( ch, obj, TRUE ); + } + + return; +} + + + +void do_remove( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + OBJ_DATA *obj; + + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + { + send_to_char( "Remove what?\n\r", ch ); + return; + } + + if ( ( obj = get_obj_wear( ch, arg ) ) == NULL ) + { + send_to_char( "You do not have that item.\n\r", ch ); + return; + } + + remove_obj( ch, obj->wear_loc, TRUE ); + return; +} + + + +void do_sacrifice( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + char buf[MAX_STRING_LENGTH]; + OBJ_DATA *obj; + int silver; + + /* variables for AUTOSPLIT */ + CHAR_DATA *gch; + int members; + char buffer[100]; + + + one_argument( argument, arg ); + + if ( arg[0] == '\0' || !str_cmp( arg, ch->name ) ) + { + act( "$n offers $mself to Mota, who graciously declines.", + ch, NULL, NULL, TO_ROOM ); + send_to_char( + "Mota appreciates your offer and may accept it later.\n\r", ch ); + return; + } + + obj = get_obj_list( ch, arg, ch->in_room->contents ); + if ( obj == NULL ) + { + send_to_char( "You can't find it.\n\r", ch ); + return; + } + + if ( obj->item_type == ITEM_CORPSE_PC ) + { + if (obj->contains) + { + send_to_char( + "Mota wouldn't like that.\n\r",ch); + return; + } + } + + + if ( !CAN_WEAR(obj, ITEM_TAKE) || CAN_WEAR(obj, ITEM_NO_SAC)) + { + act( "$p is not an acceptable sacrifice.", ch, obj, 0, TO_CHAR ); + return; + } + + if (obj->in_room != NULL) + { + for (gch = obj->in_room->people; gch != NULL; gch = gch->next_in_room) + if (gch->on == obj) + { + act("$N appears to be using $p.", + ch,obj,gch,TO_CHAR); + return; + } + } + + silver = UMAX(1,obj->level * 3); + + if (obj->item_type != ITEM_CORPSE_NPC && obj->item_type != ITEM_CORPSE_PC) + silver = UMIN(silver,obj->cost); + + if (silver == 1) + send_to_char( + "Mota gives you one silver coin for your sacrifice.\n\r", ch ); + else + { + sprintf(buf,"Mota gives you %d silver coins for your sacrifice.\n\r", + silver); + send_to_char(buf,ch); + } + + ch->silver += silver; + + if (IS_SET(ch->act,PLR_AUTOSPLIT) ) + { /* AUTOSPLIT code */ + members = 0; + for (gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room ) + { + if ( is_same_group( gch, ch ) ) + members++; + } + + if ( members > 1 && silver > 1) + { + sprintf(buffer,"%d",silver); + do_function(ch, &do_split, buffer); + } + } + + act( "$n sacrifices $p to Mota.", ch, obj, NULL, TO_ROOM ); + wiznet("$N sends up $p as a burnt offering.", + ch,obj,WIZ_SACCING,0,0); + extract_obj( obj ); + return; +} + + + +void do_quaff( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + OBJ_DATA *obj; + + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + { + send_to_char( "Quaff what?\n\r", ch ); + return; + } + + if ( ( obj = get_obj_carry( ch, arg, ch ) ) == NULL ) + { + send_to_char( "You do not have that potion.\n\r", ch ); + return; + } + + if ( obj->item_type != ITEM_POTION ) + { + send_to_char( "You can quaff only potions.\n\r", ch ); + return; + } + + if (ch->level < obj->level) + { + send_to_char("This liquid is too powerful for you to drink.\n\r",ch); + return; + } + + act( "$n quaffs $p.", ch, obj, NULL, TO_ROOM ); + act( "You quaff $p.", ch, obj, NULL ,TO_CHAR ); + + obj_cast_spell( obj->value[1], obj->value[0], ch, ch, NULL ); + obj_cast_spell( obj->value[2], obj->value[0], ch, ch, NULL ); + obj_cast_spell( obj->value[3], obj->value[0], ch, ch, NULL ); + + extract_obj( obj ); + return; +} + + + +void do_recite( CHAR_DATA *ch, char *argument ) +{ + char arg1[MAX_INPUT_LENGTH]; + char arg2[MAX_INPUT_LENGTH]; + CHAR_DATA *victim; + OBJ_DATA *scroll; + OBJ_DATA *obj; + + argument = one_argument( argument, arg1 ); + argument = one_argument( argument, arg2 ); + + if ( ( scroll = get_obj_carry( ch, arg1, ch ) ) == NULL ) + { + send_to_char( "You do not have that scroll.\n\r", ch ); + return; + } + + if ( scroll->item_type != ITEM_SCROLL ) + { + send_to_char( "You can recite only scrolls.\n\r", ch ); + return; + } + + if ( ch->level < scroll->level) + { + send_to_char( + "This scroll is too complex for you to comprehend.\n\r",ch); + return; + } + + obj = NULL; + if ( arg2[0] == '\0' ) + { + victim = ch; + } + else + { + if ( ( victim = get_char_room ( ch, arg2 ) ) == NULL + && ( obj = get_obj_here ( ch, arg2 ) ) == NULL ) + { + send_to_char( "You can't find it.\n\r", ch ); + return; + } + } + + act( "$n recites $p.", ch, scroll, NULL, TO_ROOM ); + act( "You recite $p.", ch, scroll, NULL, TO_CHAR ); + + if (number_percent() >= 20 + get_skill(ch,gsn_scrolls) * 4/5) + { + send_to_char("You mispronounce a syllable.\n\r",ch); + check_improve(ch,gsn_scrolls,FALSE,2); + } + + else + { + obj_cast_spell( scroll->value[1], scroll->value[0], ch, victim, obj ); + obj_cast_spell( scroll->value[2], scroll->value[0], ch, victim, obj ); + obj_cast_spell( scroll->value[3], scroll->value[0], ch, victim, obj ); + check_improve(ch,gsn_scrolls,TRUE,2); + } + + extract_obj( scroll ); + return; +} + + + +void do_brandish( CHAR_DATA *ch, char *argument ) +{ + CHAR_DATA *vch; + CHAR_DATA *vch_next; + OBJ_DATA *staff; + int sn; + + if ( ( staff = get_eq_char( ch, WEAR_HOLD ) ) == NULL ) + { + send_to_char( "You hold nothing in your hand.\n\r", ch ); + return; + } + + if ( staff->item_type != ITEM_STAFF ) + { + send_to_char( "You can brandish only with a staff.\n\r", ch ); + return; + } + + if ( ( sn = staff->value[3] ) < 0 + || sn >= MAX_SKILL + || skill_table[sn].spell_fun == 0 ) + { + bug( "Do_brandish: bad sn %d.", sn ); + return; + } + + WAIT_STATE( ch, 2 * PULSE_VIOLENCE ); + + if ( staff->value[2] > 0 ) + { + act( "$n brandishes $p.", ch, staff, NULL, TO_ROOM ); + act( "You brandish $p.", ch, staff, NULL, TO_CHAR ); + if ( ch->level < staff->level + || number_percent() >= 20 + get_skill(ch,gsn_staves) * 4/5) + { + act ("You fail to invoke $p.",ch,staff,NULL,TO_CHAR); + act ("...and nothing happens.",ch,NULL,NULL,TO_ROOM); + check_improve(ch,gsn_staves,FALSE,2); + } + + else for ( vch = ch->in_room->people; vch; vch = vch_next ) + { + vch_next = vch->next_in_room; + + switch ( skill_table[sn].target ) + { + default: + bug( "Do_brandish: bad target for sn %d.", sn ); + return; + + case TAR_IGNORE: + if ( vch != ch ) + continue; + break; + + case TAR_CHAR_OFFENSIVE: + if ( IS_NPC(ch) ? IS_NPC(vch) : !IS_NPC(vch) ) + continue; + break; + + case TAR_CHAR_DEFENSIVE: + if ( IS_NPC(ch) ? !IS_NPC(vch) : IS_NPC(vch) ) + continue; + break; + + case TAR_CHAR_SELF: + if ( vch != ch ) + continue; + break; + } + + obj_cast_spell( staff->value[3], staff->value[0], ch, vch, NULL ); + check_improve(ch,gsn_staves,TRUE,2); + } + } + + if ( --staff->value[2] <= 0 ) + { + act( "$n's $p blazes bright and is gone.", ch, staff, NULL, TO_ROOM ); + act( "Your $p blazes bright and is gone.", ch, staff, NULL, TO_CHAR ); + extract_obj( staff ); + } + + return; +} + + + +void do_zap( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + CHAR_DATA *victim; + OBJ_DATA *wand; + OBJ_DATA *obj; + + one_argument( argument, arg ); + if ( arg[0] == '\0' && ch->fighting == NULL ) + { + send_to_char( "Zap whom or what?\n\r", ch ); + return; + } + + if ( ( wand = get_eq_char( ch, WEAR_HOLD ) ) == NULL ) + { + send_to_char( "You hold nothing in your hand.\n\r", ch ); + return; + } + + if ( wand->item_type != ITEM_WAND ) + { + send_to_char( "You can zap only with a wand.\n\r", ch ); + return; + } + + obj = NULL; + if ( arg[0] == '\0' ) + { + if ( ch->fighting != NULL ) + { + victim = ch->fighting; + } + else + { + send_to_char( "Zap whom or what?\n\r", ch ); + return; + } + } + else + { + if ( ( victim = get_char_room ( ch, arg ) ) == NULL + && ( obj = get_obj_here ( ch, arg ) ) == NULL ) + { + send_to_char( "You can't find it.\n\r", ch ); + return; + } + } + + WAIT_STATE( ch, 2 * PULSE_VIOLENCE ); + + if ( wand->value[2] > 0 ) + { + if ( victim != NULL ) + { + act( "$n zaps $N with $p.", ch, wand, victim, TO_NOTVICT ); + act( "You zap $N with $p.", ch, wand, victim, TO_CHAR ); + act( "$n zaps you with $p.",ch, wand, victim, TO_VICT ); + } + else + { + act( "$n zaps $P with $p.", ch, wand, obj, TO_ROOM ); + act( "You zap $P with $p.", ch, wand, obj, TO_CHAR ); + } + + if (ch->level < wand->level + || number_percent() >= 20 + get_skill(ch,gsn_wands) * 4/5) + { + act( "Your efforts with $p produce only smoke and sparks.", + ch,wand,NULL,TO_CHAR); + act( "$n's efforts with $p produce only smoke and sparks.", + ch,wand,NULL,TO_ROOM); + check_improve(ch,gsn_wands,FALSE,2); + } + else + { + obj_cast_spell( wand->value[3], wand->value[0], ch, victim, obj ); + check_improve(ch,gsn_wands,TRUE,2); + } + } + + if ( --wand->value[2] <= 0 ) + { + act( "$n's $p explodes into fragments.", ch, wand, NULL, TO_ROOM ); + act( "Your $p explodes into fragments.", ch, wand, NULL, TO_CHAR ); + extract_obj( wand ); + } + + return; +} + + + +void do_steal( CHAR_DATA *ch, char *argument ) +{ + char buf [MAX_STRING_LENGTH]; + char arg1 [MAX_INPUT_LENGTH]; + char arg2 [MAX_INPUT_LENGTH]; + CHAR_DATA *victim; + OBJ_DATA *obj; + int percent; + + argument = one_argument( argument, arg1 ); + argument = one_argument( argument, arg2 ); + + if ( arg1[0] == '\0' || arg2[0] == '\0' ) + { + send_to_char( "Steal what from whom?\n\r", ch ); + return; + } + + if ( ( victim = get_char_room( ch, arg2 ) ) == NULL ) + { + send_to_char( "They aren't here.\n\r", ch ); + return; + } + + if ( victim == ch ) + { + send_to_char( "That's pointless.\n\r", ch ); + return; + } + + if (is_safe(ch,victim)) + return; + + if ( IS_NPC(victim) + && victim->position == POS_FIGHTING) + { + send_to_char( "Kill stealing is not permitted.\n\r" + "You'd better not -- you might get hit.\n\r",ch); + return; + } + + WAIT_STATE( ch, skill_table[gsn_steal].beats ); + percent = number_percent(); + + if (!IS_AWAKE(victim)) + percent -= 10; + else if (!can_see(victim,ch)) + percent += 25; + else + percent += 50; + + if ( ((ch->level + 7 < victim->level || ch->level -7 > victim->level) + && !IS_NPC(victim) && !IS_NPC(ch) ) + || ( !IS_NPC(ch) && percent > get_skill(ch,gsn_steal)) + || ( !IS_NPC(ch) && !is_clan(ch)) ) + { + /* + * Failure. + */ + send_to_char( "Oops.\n\r", ch ); + affect_strip(ch,gsn_sneak); + REMOVE_BIT(ch->affected_by,AFF_SNEAK); + + act( "$n tried to steal from you.\n\r", ch, NULL, victim, TO_VICT ); + act( "$n tried to steal from $N.\n\r", ch, NULL, victim, TO_NOTVICT ); + switch(number_range(0,3)) + { + case 0 : + sprintf( buf, "%s is a lousy thief!", ch->name ); + break; + case 1 : + sprintf( buf, "%s couldn't rob %s way out of a paper bag!", + ch->name,(ch->sex == 2) ? "her" : "his"); + break; + case 2 : + sprintf( buf,"%s tried to rob me!",ch->name ); + break; + case 3 : + sprintf(buf,"Keep your hands out of there, %s!",ch->name); + break; + } + if (!IS_AWAKE(victim)) + do_function(victim, &do_wake, ""); + if (IS_AWAKE(victim)) + do_function(victim, &do_yell, buf ); + if ( !IS_NPC(ch) ) + { + if ( IS_NPC(victim) ) + { + check_improve(ch,gsn_steal,FALSE,2); + multi_hit( victim, ch, TYPE_UNDEFINED ); + } + else + { + sprintf(buf,"$N tried to steal from %s.",victim->name); + wiznet(buf,ch,NULL,WIZ_FLAGS,0,0); + if ( !IS_SET(ch->act, PLR_THIEF) ) + { + SET_BIT(ch->act, PLR_THIEF); + send_to_char( "*** You are now a THIEF!! ***\n\r", ch ); + save_char_obj( ch ); + } + } + } + + return; + } + + if ( !str_cmp( arg1, "coin" ) + || !str_cmp( arg1, "coins" ) + || !str_cmp( arg1, "gold" ) + || !str_cmp( arg1, "silver")) + { + int gold, silver; + + gold = victim->gold * number_range(1, ch->level) / MAX_LEVEL; + silver = victim->silver * number_range(1,ch->level) / MAX_LEVEL; + if ( gold <= 0 && silver <= 0 ) + { + send_to_char( "You couldn't get any coins.\n\r", ch ); + return; + } + + ch->gold += gold; + ch->silver += silver; + victim->silver -= silver; + victim->gold -= gold; + if (silver <= 0) + sprintf( buf, "Bingo! You got %d gold coins.\n\r", gold ); + else if (gold <= 0) + sprintf( buf, "Bingo! You got %d silver coins.\n\r",silver); + else + sprintf(buf, "Bingo! You got %d silver and %d gold coins.\n\r", + silver,gold); + + send_to_char( buf, ch ); + check_improve(ch,gsn_steal,TRUE,2); + return; + } + + if ( ( obj = get_obj_carry( victim, arg1, ch ) ) == NULL ) + { + send_to_char( "You can't find it.\n\r", ch ); + return; + } + + if ( !can_drop_obj( ch, obj ) + || IS_SET(obj->extra_flags, ITEM_INVENTORY) + || obj->level > ch->level ) + { + send_to_char( "You can't pry it away.\n\r", ch ); + return; + } + + if ( ch->carry_number + get_obj_number( obj ) > can_carry_n( ch ) ) + { + send_to_char( "You have your hands full.\n\r", ch ); + return; + } + + if ( ch->carry_weight + get_obj_weight( obj ) > can_carry_w( ch ) ) + { + send_to_char( "You can't carry that much weight.\n\r", ch ); + return; + } + + obj_from_char( obj ); + obj_to_char( obj, ch ); + act("You pocket $p.",ch,obj,NULL,TO_CHAR); + check_improve(ch,gsn_steal,TRUE,2); + send_to_char( "Got it!\n\r", ch ); + return; +} + + + +/* + * Shopping commands. + */ +CHAR_DATA *find_keeper( CHAR_DATA *ch ) +{ + /*char buf[MAX_STRING_LENGTH];*/ + CHAR_DATA *keeper; + SHOP_DATA *pShop; + + pShop = NULL; + for ( keeper = ch->in_room->people; keeper; keeper = keeper->next_in_room ) + { + if ( IS_NPC(keeper) && (pShop = keeper->pIndexData->pShop) != NULL ) + break; + } + + if ( pShop == NULL ) + { + send_to_char( "You can't do that here.\n\r", ch ); + return NULL; + } + + /* + * Undesirables. + * + if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_KILLER) ) + { + do_function(keeper, &do_say, "Killers are not welcome!"); + sprintf(buf, "%s the KILLER is over here!\n\r", ch->name); + do_function(keeper, &do_yell, buf ); + return NULL; + } + + if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_THIEF) ) + { + do_function(keeper, &do_say, "Thieves are not welcome!"); + sprintf(buf, "%s the THIEF is over here!\n\r", ch->name); + do_function(keeper, &do_yell, buf ); + return NULL; + } + */ + /* + * Shop hours. + */ + if ( time_info.hour < pShop->open_hour ) + { + do_function(keeper, &do_say, "Sorry, I am closed. Come back later."); + return NULL; + } + + if ( time_info.hour > pShop->close_hour ) + { + do_function(keeper, &do_say, "Sorry, I am closed. Come back tomorrow."); + return NULL; + } + + /* + * Invisible or hidden people. + */ + if ( !can_see( keeper, ch ) ) + { + do_function(keeper, &do_say, "I don't trade with folks I can't see."); + return NULL; + } + + return keeper; +} + +/* insert an object at the right spot for the keeper */ +void obj_to_keeper( OBJ_DATA *obj, CHAR_DATA *ch ) +{ + OBJ_DATA *t_obj, *t_obj_next; + + /* see if any duplicates are found */ + for (t_obj = ch->carrying; t_obj != NULL; t_obj = t_obj_next) + { + t_obj_next = t_obj->next_content; + + if (obj->pIndexData == t_obj->pIndexData + && !str_cmp(obj->short_descr,t_obj->short_descr)) + { + /* if this is an unlimited item, destroy the new one */ + if (IS_OBJ_STAT(t_obj,ITEM_INVENTORY)) + { + extract_obj(obj); + return; + } + obj->cost = t_obj->cost; /* keep it standard */ + break; + } + } + + if (t_obj == NULL) + { + obj->next_content = ch->carrying; + ch->carrying = obj; + } + else + { + obj->next_content = t_obj->next_content; + t_obj->next_content = obj; + } + + obj->carried_by = ch; + obj->in_room = NULL; + obj->in_obj = NULL; + ch->carry_number += get_obj_number( obj ); + ch->carry_weight += get_obj_weight( obj ); +} + +/* get an object from a shopkeeper's list */ +OBJ_DATA *get_obj_keeper( CHAR_DATA *ch, CHAR_DATA *keeper, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + OBJ_DATA *obj; + int number; + int count; + + number = number_argument( argument, arg ); + count = 0; + for ( obj = keeper->carrying; obj != NULL; obj = obj->next_content ) + { + if (obj->wear_loc == WEAR_NONE + && can_see_obj( keeper, obj ) + && can_see_obj(ch,obj) + && is_name( arg, obj->name ) ) + { + if ( ++count == number ) + return obj; + + /* skip other objects of the same name */ + while (obj->next_content != NULL + && obj->pIndexData == obj->next_content->pIndexData + && !str_cmp(obj->short_descr,obj->next_content->short_descr)) + obj = obj->next_content; + } + } + + return NULL; +} + +int get_cost( CHAR_DATA *keeper, OBJ_DATA *obj, bool fBuy ) +{ + SHOP_DATA *pShop; + int cost; + + if ( obj == NULL || ( pShop = keeper->pIndexData->pShop ) == NULL ) + return 0; + + if ( fBuy ) + { + cost = obj->cost * pShop->profit_buy / 100; + } + else + { + OBJ_DATA *obj2; + int itype; + + cost = 0; + for ( itype = 0; itype < MAX_TRADE; itype++ ) + { + if ( obj->item_type == pShop->buy_type[itype] ) + { + cost = obj->cost * pShop->profit_sell / 100; + break; + } + } + + if (!IS_OBJ_STAT(obj,ITEM_SELL_EXTRACT)) + for ( obj2 = keeper->carrying; obj2; obj2 = obj2->next_content ) + { + if ( obj->pIndexData == obj2->pIndexData + && !str_cmp(obj->short_descr,obj2->short_descr) ) + { if (IS_OBJ_STAT(obj2,ITEM_INVENTORY)) + cost /= 2; + else + cost = cost * 3 / 4; + } + } + } + + if ( obj->item_type == ITEM_STAFF || obj->item_type == ITEM_WAND ) + { + if (obj->value[1] == 0) + cost /= 4; + else + cost = cost * obj->value[2] / obj->value[1]; + } + + return cost; +} + + + +void do_buy( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + int cost,roll; + + if ( argument[0] == '\0' ) + { + send_to_char( "Buy what?\n\r", ch ); + return; + } + + if ( IS_SET(ch->in_room->room_flags, ROOM_PET_SHOP) ) + { + char arg[MAX_INPUT_LENGTH]; + char buf[MAX_STRING_LENGTH]; + CHAR_DATA *pet; + ROOM_INDEX_DATA *pRoomIndexNext; + ROOM_INDEX_DATA *in_room; + + smash_tilde(argument); + + if ( IS_NPC(ch) ) + return; + + argument = one_argument(argument,arg); + + /* hack to make new thalos pets work */ + if (ch->in_room->vnum == 9621) + pRoomIndexNext = get_room_index(9706); + else + pRoomIndexNext = get_room_index( ch->in_room->vnum + 1 ); + if ( pRoomIndexNext == NULL ) + { + bug( "Do_buy: bad pet shop at vnum %d.", ch->in_room->vnum ); + send_to_char( "Sorry, you can't buy that here.\n\r", ch ); + return; + } + + in_room = ch->in_room; + ch->in_room = pRoomIndexNext; + pet = get_char_room( ch, arg ); + ch->in_room = in_room; + + if ( pet == NULL || !IS_SET(pet->act, ACT_PET) ) + { + send_to_char( "Sorry, you can't buy that here.\n\r", ch ); + return; + } + + if ( ch->pet != NULL ) + { + send_to_char("You already own a pet.\n\r",ch); + return; + } + + cost = 10 * pet->level * pet->level; + + if ( (ch->silver + 100 * ch->gold) < cost ) + { + send_to_char( "You can't afford it.\n\r", ch ); + return; + } + + if ( ch->level < pet->level ) + { + send_to_char( + "You're not powerful enough to master this pet.\n\r", ch ); + return; + } + + /* haggle */ + roll = number_percent(); + if (roll < get_skill(ch,gsn_haggle)) + { + cost -= cost / 2 * roll / 100; + sprintf(buf,"You haggle the price down to %d coins.\n\r",cost); + send_to_char(buf,ch); + check_improve(ch,gsn_haggle,TRUE,4); + + } + + deduct_cost(ch,cost); + pet = create_mobile( pet->pIndexData ); + SET_BIT(pet->act, ACT_PET); + SET_BIT(pet->affected_by, AFF_CHARM); + pet->comm = COMM_NOTELL|COMM_NOSHOUT|COMM_NOCHANNELS; + + argument = one_argument( argument, arg ); + if ( arg[0] != '\0' ) + { + sprintf( buf, "%s %s", pet->name, arg ); + free_string( pet->name ); + pet->name = str_dup( buf ); + } + + sprintf( buf, "%sA neck tag says 'I belong to %s'.\n\r", + pet->description, ch->name ); + free_string( pet->description ); + pet->description = str_dup( buf ); + + char_to_room( pet, ch->in_room ); + add_follower( pet, ch ); + pet->leader = ch; + ch->pet = pet; + send_to_char( "Enjoy your pet.\n\r", ch ); + act( "$n bought $N as a pet.", ch, NULL, pet, TO_ROOM ); + return; + } + else + { + CHAR_DATA *keeper; + OBJ_DATA *obj,*t_obj; + char arg[MAX_INPUT_LENGTH]; + int number, count = 1; + + if ( ( keeper = find_keeper( ch ) ) == NULL ) + return; + + number = mult_argument(argument,arg); + obj = get_obj_keeper( ch,keeper, arg ); + cost = get_cost( keeper, obj, TRUE ); + + if (number < 1 || number > 99) + { + act("$n tells you 'Get real!",keeper,NULL,ch,TO_VICT); + return; + } + + if ( cost <= 0 || !can_see_obj( ch, obj ) ) + { + act( "$n tells you 'I don't sell that -- try 'list''.", + keeper, NULL, ch, TO_VICT ); + ch->reply = keeper; + return; + } + + if (!IS_OBJ_STAT(obj,ITEM_INVENTORY)) + { + for (t_obj = obj->next_content; + count < number && t_obj != NULL; + t_obj = t_obj->next_content) + { + if (t_obj->pIndexData == obj->pIndexData + && !str_cmp(t_obj->short_descr,obj->short_descr)) + count++; + else + break; + } + + if (count < number) + { + act("$n tells you 'I don't have that many in stock.", + keeper,NULL,ch,TO_VICT); + ch->reply = keeper; + return; + } + } + + if ( (ch->silver + ch->gold * 100) < cost * number ) + { + if (number > 1) + act("$n tells you 'You can't afford to buy that many.", + keeper,obj,ch,TO_VICT); + else + act( "$n tells you 'You can't afford to buy $p'.", + keeper, obj, ch, TO_VICT ); + ch->reply = keeper; + return; + } + + if ( obj->level > ch->level ) + { + act( "$n tells you 'You can't use $p yet'.", + keeper, obj, ch, TO_VICT ); + ch->reply = keeper; + return; + } + + if (ch->carry_number + number * get_obj_number(obj) > can_carry_n(ch)) + { + send_to_char( "You can't carry that many items.\n\r", ch ); + return; + } + + if ( ch->carry_weight + number * get_obj_weight(obj) > can_carry_w(ch)) + { + send_to_char( "You can't carry that much weight.\n\r", ch ); + return; + } + + /* haggle */ + roll = number_percent(); + if (!IS_OBJ_STAT(obj,ITEM_SELL_EXTRACT) + && roll < get_skill(ch,gsn_haggle)) + { + cost -= obj->cost / 2 * roll / 100; + act("You haggle with $N.",ch,NULL,keeper,TO_CHAR); + check_improve(ch,gsn_haggle,TRUE,4); + } + + if (number > 1) + { + sprintf(buf,"$n buys $p[%d].",number); + act(buf,ch,obj,NULL,TO_ROOM); + sprintf(buf,"You buy $p[%d] for %d silver.",number,cost * number); + act(buf,ch,obj,NULL,TO_CHAR); + } + else + { + act( "$n buys $p.", ch, obj, NULL, TO_ROOM ); + sprintf(buf,"You buy $p for %d silver.",cost); + act( buf, ch, obj, NULL, TO_CHAR ); + } + deduct_cost(ch,cost * number); + keeper->gold += cost * number/100; + keeper->silver += cost * number - (cost * number/100) * 100; + + for (count = 0; count < number; count++) + { + if ( IS_SET( obj->extra_flags, ITEM_INVENTORY ) ) + t_obj = create_object( obj->pIndexData, obj->level ); + else + { + t_obj = obj; + obj = obj->next_content; + obj_from_char( t_obj ); + } + + if (t_obj->timer > 0 && !IS_OBJ_STAT(t_obj,ITEM_HAD_TIMER)) + t_obj->timer = 0; + REMOVE_BIT(t_obj->extra_flags,ITEM_HAD_TIMER); + obj_to_char( t_obj, ch ); + if (cost < t_obj->cost) + t_obj->cost = cost; + } + } +} + + + +void do_list( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + + if ( IS_SET(ch->in_room->room_flags, ROOM_PET_SHOP) ) + { + ROOM_INDEX_DATA *pRoomIndexNext; + CHAR_DATA *pet; + bool found; + + /* hack to make new thalos pets work */ + if (ch->in_room->vnum == 9621) + pRoomIndexNext = get_room_index(9706); + else + pRoomIndexNext = get_room_index( ch->in_room->vnum + 1 ); + + if ( pRoomIndexNext == NULL ) + { + bug( "Do_list: bad pet shop at vnum %d.", ch->in_room->vnum ); + send_to_char( "You can't do that here.\n\r", ch ); + return; + } + + found = FALSE; + for ( pet = pRoomIndexNext->people; pet; pet = pet->next_in_room ) + { + if ( IS_SET(pet->act, ACT_PET) ) + { + if ( !found ) + { + found = TRUE; + send_to_char( "Pets for sale:\n\r", ch ); + } + sprintf( buf, "[%2d] %8d - %s\n\r", + pet->level, + 10 * pet->level * pet->level, + pet->short_descr ); + send_to_char( buf, ch ); + } + } + if ( !found ) + send_to_char( "Sorry, we're out of pets right now.\n\r", ch ); + return; + } + else + { + CHAR_DATA *keeper; + OBJ_DATA *obj; + int cost,count; + bool found; + char arg[MAX_INPUT_LENGTH]; + + if ( ( keeper = find_keeper( ch ) ) == NULL ) + return; + one_argument(argument,arg); + + found = FALSE; + for ( obj = keeper->carrying; obj; obj = obj->next_content ) + { + if ( obj->wear_loc == WEAR_NONE + && can_see_obj( ch, obj ) + && ( cost = get_cost( keeper, obj, TRUE ) ) > 0 + && ( arg[0] == '\0' + || is_name(arg,obj->name) )) + { + if ( !found ) + { + found = TRUE; + send_to_char( "[Lv Price Qty] Item\n\r", ch ); + } + + if (IS_OBJ_STAT(obj,ITEM_INVENTORY)) + sprintf(buf,"[%2d %5d -- ] %s\n\r", + obj->level,cost,obj->short_descr); + else + { + count = 1; + + while (obj->next_content != NULL + && obj->pIndexData == obj->next_content->pIndexData + && !str_cmp(obj->short_descr, + obj->next_content->short_descr)) + { + obj = obj->next_content; + count++; + } + sprintf(buf,"[%2d %5d %2d ] %s\n\r", + obj->level,cost,count,obj->short_descr); + } + send_to_char( buf, ch ); + } + } + + if ( !found ) + send_to_char( "You can't buy anything here.\n\r", ch ); + return; + } +} + + + +void do_sell( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + char arg[MAX_INPUT_LENGTH]; + CHAR_DATA *keeper; + OBJ_DATA *obj; + int cost,roll; + + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + { + send_to_char( "Sell what?\n\r", ch ); + return; + } + + if ( ( keeper = find_keeper( ch ) ) == NULL ) + return; + + if ( ( obj = get_obj_carry( ch, arg, ch ) ) == NULL ) + { + act( "$n tells you 'You don't have that item'.", + keeper, NULL, ch, TO_VICT ); + ch->reply = keeper; + return; + } + + if ( !can_drop_obj( ch, obj ) ) + { + send_to_char( "You can't let go of it.\n\r", ch ); + return; + } + + if (!can_see_obj(keeper,obj)) + { + act("$n doesn't see what you are offering.",keeper,NULL,ch,TO_VICT); + return; + } + + if ( ( cost = get_cost( keeper, obj, FALSE ) ) <= 0 ) + { + act( "$n looks uninterested in $p.", keeper, obj, ch, TO_VICT ); + return; + } + if ( cost > (keeper-> silver + 100 * keeper->gold) ) + { + act("$n tells you 'I'm afraid I don't have enough wealth to buy $p.", + keeper,obj,ch,TO_VICT); + return; + } + + act( "$n sells $p.", ch, obj, NULL, TO_ROOM ); + /* haggle */ + roll = number_percent(); + if (!IS_OBJ_STAT(obj,ITEM_SELL_EXTRACT) && roll < get_skill(ch,gsn_haggle)) + { + send_to_char("You haggle with the shopkeeper.\n\r",ch); + cost += obj->cost / 2 * roll / 100; + cost = UMIN(cost,95 * get_cost(keeper,obj,TRUE) / 100); + cost = UMIN(cost,(keeper->silver + 100 * keeper->gold)); + check_improve(ch,gsn_haggle,TRUE,4); + } + sprintf( buf, "You sell $p for %d silver and %d gold piece%s.", + cost - (cost/100) * 100, cost/100, cost == 1 ? "" : "s" ); + act( buf, ch, obj, NULL, TO_CHAR ); + ch->gold += cost/100; + ch->silver += cost - (cost/100) * 100; + deduct_cost(keeper,cost); + if ( keeper->gold < 0 ) + keeper->gold = 0; + if ( keeper->silver< 0) + keeper->silver = 0; + + if ( obj->item_type == ITEM_TRASH || IS_OBJ_STAT(obj,ITEM_SELL_EXTRACT)) + { + extract_obj( obj ); + } + else + { + obj_from_char( obj ); + if (obj->timer) + SET_BIT(obj->extra_flags,ITEM_HAD_TIMER); + else + obj->timer = number_range(50,100); + obj_to_keeper( obj, keeper ); + } + + return; +} + + + +void do_value( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + char arg[MAX_INPUT_LENGTH]; + CHAR_DATA *keeper; + OBJ_DATA *obj; + int cost; + + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + { + send_to_char( "Value what?\n\r", ch ); + return; + } + + if ( ( keeper = find_keeper( ch ) ) == NULL ) + return; + + if ( ( obj = get_obj_carry( ch, arg, ch ) ) == NULL ) + { + act( "$n tells you 'You don't have that item'.", + keeper, NULL, ch, TO_VICT ); + ch->reply = keeper; + return; + } + + if (!can_see_obj(keeper,obj)) + { + act("$n doesn't see what you are offering.",keeper,NULL,ch,TO_VICT); + return; + } + + if ( !can_drop_obj( ch, obj ) ) + { + send_to_char( "You can't let go of it.\n\r", ch ); + return; + } + + if ( ( cost = get_cost( keeper, obj, FALSE ) ) <= 0 ) + { + act( "$n looks uninterested in $p.", keeper, obj, ch, TO_VICT ); + return; + } + + sprintf( buf, + "$n tells you 'I'll give you %d silver and %d gold coins for $p'.", + cost - (cost/100) * 100, cost/100 ); + act( buf, keeper, obj, ch, TO_VICT ); + ch->reply = keeper; + + return; +} diff --git a/Rom24/src/act_wiz.c b/Rom24/src/act_wiz.c new file mode 100644 index 0000000..de7617f --- /dev/null +++ b/Rom24/src/act_wiz.c @@ -0,0 +1,4378 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +#if defined(macintosh) +#include +#include +#else +#include +#include +#endif +#include +#include +#include +#include "merc.h" +#include "interp.h" +#include "recycle.h" +#include "tables.h" +#include "lookup.h" + +/* + * Local functions. + */ +ROOM_INDEX_DATA * find_location args( ( CHAR_DATA *ch, char *arg ) ); + +void do_wiznet( CHAR_DATA *ch, char *argument ) +{ + int flag; + char buf[MAX_STRING_LENGTH]; + + 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; + } + + /* show wiznet status */ + 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")) + /* list of all wiznet options */ + { + 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)) + { + sprintf(buf,"You will no longer see %s on wiznet.\n\r", + wiznet_table[flag].name); + send_to_char(buf,ch); + REMOVE_BIT(ch->wiznet,wiznet_table[flag].flag); + return; + } + else + { + sprintf(buf,"You will now see %s on wiznet.\n\r", + wiznet_table[flag].name); + send_to_char(buf,ch); + 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) +{ + DESCRIPTOR_DATA *d; + + 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) + { + if (IS_SET(d->character->wiznet,WIZ_PREFIX)) + send_to_char("--> ",d->character); + act_new(string,d->character,obj,ch,TO_CHAR,POS_DEAD); + } + } + + return; +} + +void do_guild( CHAR_DATA *ch, char *argument ) +{ + char arg1[MAX_INPUT_LENGTH],arg2[MAX_INPUT_LENGTH]; + char buf[MAX_STRING_LENGTH]; + CHAR_DATA *victim; + int clan; + + argument = one_argument( argument, arg1 ); + argument = one_argument( argument, arg2 ); + + if ( arg1[0] == '\0' || arg2[0] == '\0' ) + { + send_to_char( "Syntax: guild \n\r",ch); + return; + } + if ( ( victim = get_char_world( ch, arg1 ) ) == NULL ) + { + send_to_char( "They aren't playing.\n\r", ch ); + return; + } + + if (!str_prefix(arg2,"none")) + { + send_to_char("They are now clanless.\n\r",ch); + send_to_char("You are now a member of no clan!\n\r",victim); + victim->clan = 0; + return; + } + + if ((clan = clan_lookup(arg2)) == 0) + { + send_to_char("No such clan exists.\n\r",ch); + return; + } + + if (clan_table[clan].independent) + { + sprintf(buf,"They are now a %s.\n\r",clan_table[clan].name); + send_to_char(buf,ch); + sprintf(buf,"You are now a %s.\n\r",clan_table[clan].name); + send_to_char(buf,victim); + } + else + { + sprintf(buf,"They are now a member of clan %s.\n\r", + capitalize(clan_table[clan].name)); + send_to_char(buf,ch); + sprintf(buf,"You are now a member of clan %s.\n\r", + capitalize(clan_table[clan].name)); + } + + victim->clan = clan; +} + +/* equips a character */ +void do_outfit ( CHAR_DATA *ch, char *argument ) +{ + OBJ_DATA *obj; + int i,sn,vnum; + + if (ch->level > 5 || IS_NPC(ch)) + { + send_to_char("Find it yourself!\n\r",ch); + return; + } + + if ( ( obj = get_eq_char( ch, WEAR_LIGHT ) ) == NULL ) + { + obj = create_object( get_obj_index(OBJ_VNUM_SCHOOL_BANNER), 0 ); + obj->cost = 0; + obj_to_char( obj, ch ); + equip_char( ch, obj, WEAR_LIGHT ); + } + + if ( ( obj = get_eq_char( ch, WEAR_BODY ) ) == NULL ) + { + obj = create_object( get_obj_index(OBJ_VNUM_SCHOOL_VEST), 0 ); + obj->cost = 0; + obj_to_char( obj, ch ); + equip_char( ch, obj, WEAR_BODY ); + } + + /* do the weapon thing */ + if ((obj = get_eq_char(ch,WEAR_WIELD)) == NULL) + { + sn = 0; + vnum = OBJ_VNUM_SCHOOL_SWORD; /* just in case! */ + + for (i = 0; weapon_table[i].name != NULL; i++) + { + if (ch->pcdata->learned[sn] < + ch->pcdata->learned[*weapon_table[i].gsn]) + { + sn = *weapon_table[i].gsn; + vnum = weapon_table[i].vnum; + } + } + + obj = create_object(get_obj_index(vnum),0); + obj_to_char(obj,ch); + equip_char(ch,obj,WEAR_WIELD); + } + + if (((obj = get_eq_char(ch,WEAR_WIELD)) == NULL + || !IS_WEAPON_STAT(obj,WEAPON_TWO_HANDS)) + && (obj = get_eq_char( ch, WEAR_SHIELD ) ) == NULL ) + { + obj = create_object( get_obj_index(OBJ_VNUM_SCHOOL_SHIELD), 0 ); + obj->cost = 0; + obj_to_char( obj, ch ); + equip_char( ch, obj, WEAR_SHIELD ); + } + + send_to_char("You have been equipped by Mota.\n\r",ch); +} + + +/* RT nochannels command, for those spammers */ +void do_nochannels( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH], buf[MAX_STRING_LENGTH]; + 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 ); + send_to_char( "NOCHANNELS removed.\n\r", ch ); + sprintf(buf,"$N restores channels to %s",victim->name); + wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); + } + else + { + SET_BIT(victim->comm, COMM_NOCHANNELS); + send_to_char( "The gods have revoked your channel priviliges.\n\r", + victim ); + send_to_char( "NOCHANNELS set.\n\r", ch ); + sprintf(buf,"$N revokes %s's channels.",victim->name); + wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); + } + + return; +} + + +void do_smote(CHAR_DATA *ch, char *argument ) +{ + CHAR_DATA *vch; + 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) ) + { + send_to_char( "You can't show your emotions.\n\r", ch ); + return; + } + + if ( argument[0] == '\0' ) + { + send_to_char( "Emote what?\n\r", ch ); + return; + } + + if (strstr(argument,ch->name) == NULL) + { + send_to_char("You must include your name in an smote.\n\r",ch); + return; + } + + send_to_char(argument,ch); + send_to_char("\n\r",ch); + + 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) + { + send_to_char(argument,vch); + send_to_char("\n\r",vch); + continue; + } + + strcpy(temp,argument); + temp[strlen(argument) - strlen(letter)] = '\0'; + last[0] = '\0'; + name = vch->name; + + for (; *letter != '\0'; letter++) + { + if (*letter == '\'' && matches == strlen(vch->name)) + { + strcat(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)) + { + strcat(temp,"you"); + last[0] = '\0'; + name = vch->name; + continue; + } + strncat(last,letter,1); + continue; + } + + matches = 0; + strcat(temp,last); + strncat(temp,letter,1); + last[0] = '\0'; + name = vch->name; + } + + send_to_char(temp,vch); + send_to_char("\n\r",vch); + } + + return; +} + +void do_bamfin( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + + if ( !IS_NPC(ch) ) + { + smash_tilde( argument ); + + if (argument[0] == '\0') + { + sprintf(buf,"Your poofin is %s\n\r",ch->pcdata->bamfin); + send_to_char(buf,ch); + 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 ); + + sprintf(buf,"Your poofin is now %s\n\r",ch->pcdata->bamfin); + send_to_char(buf,ch); + } + return; +} + +void do_bamfout( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + + if ( !IS_NPC(ch) ) + { + smash_tilde( argument ); + + if (argument[0] == '\0') + { + sprintf(buf,"Your poofout is %s\n\r",ch->pcdata->bamfout); + send_to_char(buf,ch); + 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 ); + + sprintf(buf,"Your poofout is now %s\n\r",ch->pcdata->bamfout); + send_to_char(buf,ch); + } + return; +} + + + +void do_deny( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH],buf[MAX_STRING_LENGTH]; + 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,0); + send_to_char( "OK.\n\r", ch ); + save_char_obj(victim); + stop_fighting(victim,TRUE); + do_function(victim, &do_quit, "" ); + + return; +} + + + +void do_disconnect( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + 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 ) + { + close_socket( d ); + send_to_char( "Ok.\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 ) + { + 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_socket( d ); + send_to_char( "Ok.\n\r", ch ); + return; + } + } + + bug( "Do_disconnect: desc not found.", 0 ); + send_to_char( "Descriptor not found!\n\r", ch ); + return; +} + + + +void do_pardon( CHAR_DATA *ch, char *argument ) +{ + char arg1[MAX_INPUT_LENGTH]; + char arg2[MAX_INPUT_LENGTH]; + 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 .\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 ( !str_cmp( arg2, "killer" ) ) + { + if ( IS_SET(victim->act, PLR_KILLER) ) + { + REMOVE_BIT( victim->act, PLR_KILLER ); + send_to_char( "Killer flag removed.\n\r", ch ); + send_to_char( "You are no longer a KILLER.\n\r", victim ); + } + return; + } + + if ( !str_cmp( arg2, "thief" ) ) + { + if ( IS_SET(victim->act, PLR_THIEF) ) + { + REMOVE_BIT( victim->act, PLR_THIEF ); + send_to_char( "Thief flag removed.\n\r", ch ); + send_to_char( "You are no longer a THIEF.\n\r", victim ); + } + return; + } + + send_to_char( "Syntax: pardon .\n\r", ch ); + return; +} + + + +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); + send_to_char( argument, d->character ); + send_to_char( "\n\r", d->character ); + } + } + + return; +} + + + +void do_recho( CHAR_DATA *ch, char *argument ) +{ + DESCRIPTOR_DATA *d; + + if ( argument[0] == '\0' ) + { + send_to_char( "Local echo what?\n\r", ch ); + + return; + } + + for ( d = descriptor_list; d; d = d->next ) + { + if ( d->connected == CON_PLAYING + && d->character->in_room == ch->in_room ) + { + if (get_trust(d->character) >= get_trust(ch)) + send_to_char( "local> ",d->character); + send_to_char( argument, d->character ); + send_to_char( "\n\r", d->character ); + } + } + + return; +} + +void do_zecho(CHAR_DATA *ch, char *argument) +{ + DESCRIPTOR_DATA *d; + + if (argument[0] == '\0') + { + send_to_char("Zone echo what?\n\r",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 (get_trust(d->character) >= get_trust(ch)) + send_to_char("zone> ",d->character); + send_to_char(argument,d->character); + send_to_char("\n\r",d->character); + } + } +} + +void do_pecho( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + CHAR_DATA *victim; + + argument = one_argument(argument, arg); + + if ( argument[0] == '\0' || arg[0] == '\0' ) + { + send_to_char("Personal echo what?\n\r", ch); + return; + } + + if ( (victim = get_char_world(ch, arg) ) == NULL ) + { + send_to_char("Target not found.\n\r",ch); + return; + } + + if (get_trust(victim) >= get_trust(ch) && get_trust(ch) != MAX_LEVEL) + send_to_char( "personal> ",victim); + + send_to_char(argument,victim); + send_to_char("\n\r",victim); + send_to_char( "personal> ",ch); + send_to_char(argument,ch); + send_to_char("\n\r",ch); +} + + +ROOM_INDEX_DATA *find_location( CHAR_DATA *ch, char *arg ) +{ + CHAR_DATA *victim; + OBJ_DATA *obj; + + if ( is_number(arg) ) + return 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; +} + + + +void do_transfer( CHAR_DATA *ch, char *argument ) +{ + 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 ); + 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 ( 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 ) ) + { + char buf[MAX_STRING_LENGTH]; + sprintf( buf, "%s %s", d->character->name, arg2 ); + do_function(ch, &do_transfer, buf ); + } + } + return; + } + + /* + * Thanks to Grodyn for the optional location parameter. + */ + 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 ( !is_room_owner(ch,location) && room_is_private( location ) + && get_trust(ch) < MAX_LEVEL) + { + send_to_char( "That room is private right now.\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 ) + { + send_to_char( "They are in limbo.\n\r", ch ); + return; + } + + if ( victim->fighting != NULL ) + stop_fighting( victim, TRUE ); + act( "$n disappears in a mushroom cloud.", victim, NULL, NULL, TO_ROOM ); + char_from_room( victim ); + char_to_room( victim, location ); + act( "$n arrives from a puff of smoke.", victim, NULL, NULL, TO_ROOM ); + if ( ch != victim ) + act( "$n has transferred you.", ch, NULL, victim, TO_VICT ); + do_function(victim, &do_look, "auto" ); + send_to_char( "Ok.\n\r", ch ); +} + + + +void do_at( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + ROOM_INDEX_DATA *location; + ROOM_INDEX_DATA *original; + OBJ_DATA *on; + CHAR_DATA *wch; + + 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 (!is_room_owner(ch,location) && room_is_private( location ) + && get_trust(ch) < MAX_LEVEL) + { + send_to_char( "That room is private right now.\n\r", ch ); + return; + } + + original = ch->in_room; + on = ch->on; + char_from_room( ch ); + char_to_room( ch, location ); + interpret( ch, argument ); + + /* + * See if 'ch' still exists before continuing! + * Handles 'at XXXX quit' case. + */ + for ( wch = char_list; wch != NULL; wch = wch->next ) + { + if ( wch == ch ) + { + char_from_room( ch ); + char_to_room( ch, original ); + ch->on = on; + break; + } + } + + return; +} + + + +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 (!is_room_owner(ch,location) && 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 ( 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_function(ch, &do_look, "auto" ); + return; +} + +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 ( 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_function(ch, &do_look, "auto" ); + return; +} + +/* RT to replace the 3 stat commands */ + +void do_stat ( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + char *string; + OBJ_DATA *obj; + ROOM_INDEX_DATA *location; + CHAR_DATA *victim; + + string = one_argument(argument, arg); + if ( arg[0] == '\0') + { + send_to_char("Syntax:\n\r",ch); + send_to_char(" stat \n\r",ch); + send_to_char(" stat obj \n\r",ch); + send_to_char(" stat mob \n\r",ch); + send_to_char(" stat room \n\r",ch); + return; + } + + if (!str_cmp(arg,"room")) + { + do_function(ch, &do_rstat, string); + return; + } + + if (!str_cmp(arg,"obj")) + { + do_function(ch, &do_ostat, string); + return; + } + + if(!str_cmp(arg,"char") || !str_cmp(arg,"mob")) + { + do_function(ch, &do_mstat, string); + return; + } + + /* do it the old way */ + + obj = get_obj_world(ch,argument); + if (obj != NULL) + { + do_function(ch, &do_ostat, argument); + return; + } + + victim = get_char_world(ch,argument); + if (victim != NULL) + { + do_function(ch, &do_mstat, argument); + return; + } + + location = find_location(ch,argument); + if (location != NULL) + { + do_function(ch, &do_rstat, argument); + return; + } + + send_to_char("Nothing by that name found anywhere.\n\r",ch); +} + +void do_rstat( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + char arg[MAX_INPUT_LENGTH]; + 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 (!is_room_owner(ch,location) && 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; + } + + sprintf( buf, "Name: '%s'\n\rArea: '%s'\n\r", + location->name, + location->area->name ); + send_to_char( buf, ch ); + + sprintf( buf, + "Vnum: %d Sector: %d Light: %d Healing: %d Mana: %d\n\r", + location->vnum, + location->sector_type, + location->light, + location->heal_rate, + location->mana_rate ); + send_to_char( buf, ch ); + + sprintf( buf, + "Room flags: %d.\n\rDescription:\n\r%s", + location->room_flags, + location->description ); + send_to_char( buf, ch ); + + 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 ) + { + sprintf( buf, + "Door: %d. To: %d. Key: %d. Exit flags: %d.\n\rKeyword: '%s'. Description: %s", + + door, + (pexit->u1.to_room == NULL ? -1 : pexit->u1.to_room->vnum), + pexit->key, + pexit->exit_info, + pexit->keyword, + pexit->description[0] != '\0' + ? pexit->description : "(none).\n\r" ); + send_to_char( buf, ch ); + } + } + + return; +} + + + +void do_ostat( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + char arg[MAX_INPUT_LENGTH]; + AFFECT_DATA *paf; + OBJ_DATA *obj; + + 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; + } + + sprintf( buf, "Name(s): %s\n\r", + obj->name ); + send_to_char( buf, ch ); + + sprintf( buf, "Vnum: %d Format: %s Type: %s Resets: %d\n\r", + obj->pIndexData->vnum, obj->pIndexData->new_format ? "new" : "old", + item_name(obj->item_type), obj->pIndexData->reset_num ); + send_to_char( buf, ch ); + + sprintf( buf, "Short description: %s\n\rLong description: %s\n\r", + obj->short_descr, obj->description ); + send_to_char( buf, ch ); + + sprintf( buf, "Wear bits: %s\n\rExtra bits: %s\n\r", + wear_bit_name(obj->wear_flags), extra_bit_name( obj->extra_flags ) ); + send_to_char( buf, ch ); + + sprintf( buf, "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) ); + send_to_char( buf, ch ); + + sprintf( buf, "Level: %d Cost: %d Condition: %d Timer: %d\n\r", + obj->level, obj->cost, obj->condition, obj->timer ); + send_to_char( buf, ch ); + + sprintf( buf, + "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 ); + send_to_char( buf, ch ); + + sprintf( buf, "Values: %d %d %d %d %d\n\r", + obj->value[0], obj->value[1], obj->value[2], obj->value[3], + obj->value[4] ); + send_to_char( buf, ch ); + + /* now give out vital statistics as per identify */ + + switch ( obj->item_type ) + { + case ITEM_SCROLL: + case ITEM_POTION: + case ITEM_PILL: + sprintf( buf, "Level %d spells of:", obj->value[0] ); + send_to_char( buf, ch ); + + if ( obj->value[1] >= 0 && obj->value[1] < MAX_SKILL ) + { + send_to_char( " '", ch ); + send_to_char( skill_table[obj->value[1]].name, ch ); + send_to_char( "'", ch ); + } + + if ( obj->value[2] >= 0 && obj->value[2] < MAX_SKILL ) + { + send_to_char( " '", ch ); + send_to_char( skill_table[obj->value[2]].name, ch ); + send_to_char( "'", ch ); + } + + if ( obj->value[3] >= 0 && obj->value[3] < MAX_SKILL ) + { + send_to_char( " '", ch ); + send_to_char( skill_table[obj->value[3]].name, ch ); + send_to_char( "'", ch ); + } + + if (obj->value[4] >= 0 && obj->value[4] < MAX_SKILL) + { + send_to_char(" '",ch); + send_to_char(skill_table[obj->value[4]].name,ch); + send_to_char("'",ch); + } + + send_to_char( ".\n\r", ch ); + break; + + case ITEM_WAND: + case ITEM_STAFF: + sprintf( buf, "Has %d(%d) charges of level %d", + obj->value[1], obj->value[2], obj->value[0] ); + send_to_char( buf, ch ); + + if ( obj->value[3] >= 0 && obj->value[3] < MAX_SKILL ) + { + send_to_char( " '", ch ); + send_to_char( skill_table[obj->value[3]].name, ch ); + send_to_char( "'", ch ); + } + + send_to_char( ".\n\r", ch ); + break; + + case ITEM_DRINK_CON: + sprintf(buf,"It holds %s-colored %s.\n\r", + liq_table[obj->value[2]].liq_color, + liq_table[obj->value[2]].liq_name); + send_to_char(buf,ch); + 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/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) + sprintf(buf,"Damage is %dd%d (average %d)\n\r", + obj->value[1],obj->value[2], + (1 + obj->value[2]) * obj->value[1] / 2); + else + sprintf( buf, "Damage is %d to %d (average %d)\n\r", + obj->value[1], obj->value[2], + ( obj->value[1] + obj->value[2] ) / 2 ); + send_to_char( buf, ch ); + + sprintf(buf,"Damage noun is %s.\n\r", + (obj->value[3] > 0 && obj->value[3] < MAX_DAMAGE_MESSAGE) ? + attack_table[obj->value[3]].noun : "undefined"); + send_to_char(buf,ch); + + if (obj->value[4]) /* weapon flags */ + { + sprintf(buf,"Weapons flags: %s\n\r", + weapon_bit_name(obj->value[4])); + send_to_char(buf,ch); + } + break; + + case ITEM_ARMOR: + sprintf( buf, + "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] ); + send_to_char( buf, ch ); + break; + + case ITEM_CONTAINER: + sprintf(buf,"Capacity: %d# Maximum weight: %d# flags: %s\n\r", + obj->value[0], obj->value[3], cont_bit_name(obj->value[1])); + send_to_char(buf,ch); + if (obj->value[4] != 100) + { + sprintf(buf,"Weight multiplier: %d%%\n\r", + obj->value[4]); + send_to_char(buf,ch); + } + break; + } + + + 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 ) + { + sprintf( buf, "Affects %s by %d, level %d", + affect_loc_name( paf->location ), paf->modifier,paf->level ); + send_to_char(buf,ch); + if ( paf->duration > -1) + sprintf(buf,", %d hours.\n\r",paf->duration); + else + sprintf(buf,".\n\r"); + send_to_char( buf, ch ); + if (paf->bitvector) + { + switch(paf->where) + { + case TO_AFFECTS: + sprintf(buf,"Adds %s affect.\n", + affect_bit_name(paf->bitvector)); + break; + case TO_WEAPON: + sprintf(buf,"Adds %s weapon flags.\n", + weapon_bit_name(paf->bitvector)); + break; + case TO_OBJECT: + sprintf(buf,"Adds %s object flag.\n", + extra_bit_name(paf->bitvector)); + break; + case TO_IMMUNE: + sprintf(buf,"Adds immunity to %s.\n", + imm_bit_name(paf->bitvector)); + break; + case TO_RESIST: + sprintf(buf,"Adds resistance to %s.\n\r", + imm_bit_name(paf->bitvector)); + break; + case TO_VULN: + sprintf(buf,"Adds vulnerability to %s.\n\r", + imm_bit_name(paf->bitvector)); + break; + default: + sprintf(buf,"Unknown bit %d: %d\n\r", + paf->where,paf->bitvector); + break; + } + send_to_char(buf,ch); + } + } + + if (!obj->enchanted) + for ( paf = obj->pIndexData->affected; paf != NULL; paf = paf->next ) + { + sprintf( buf, "Affects %s by %d, level %d.\n\r", + affect_loc_name( paf->location ), paf->modifier,paf->level ); + send_to_char( buf, ch ); + if (paf->bitvector) + { + switch(paf->where) + { + case TO_AFFECTS: + sprintf(buf,"Adds %s affect.\n", + affect_bit_name(paf->bitvector)); + break; + case TO_OBJECT: + sprintf(buf,"Adds %s object flag.\n", + extra_bit_name(paf->bitvector)); + break; + case TO_IMMUNE: + sprintf(buf,"Adds immunity to %s.\n", + imm_bit_name(paf->bitvector)); + break; + case TO_RESIST: + sprintf(buf,"Adds resistance to %s.\n\r", + imm_bit_name(paf->bitvector)); + break; + case TO_VULN: + sprintf(buf,"Adds vulnerability to %s.\n\r", + imm_bit_name(paf->bitvector)); + break; + default: + sprintf(buf,"Unknown bit %d: %d\n\r", + paf->where,paf->bitvector); + break; + } + send_to_char(buf,ch); + } + } + + return; +} + + + +void do_mstat( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + char arg[MAX_INPUT_LENGTH]; + AFFECT_DATA *paf; + CHAR_DATA *victim; + + 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; + } + + sprintf( buf, "Name: %s\n\r", + victim->name); + send_to_char( buf, ch ); + + sprintf( buf, + "Vnum: %d Format: %s Race: %s Group: %d Sex: %s Room: %d\n\r", + IS_NPC(victim) ? victim->pIndexData->vnum : 0, + IS_NPC(victim) ? victim->pIndexData->new_format ? "new" : "old" : "pc", + race_table[victim->race].name, + IS_NPC(victim) ? victim->group : 0, sex_table[victim->sex].name, + victim->in_room == NULL ? 0 : victim->in_room->vnum + ); + send_to_char( buf, ch ); + + if (IS_NPC(victim)) + { + sprintf(buf,"Count: %d Killed: %d\n\r", + victim->pIndexData->count,victim->pIndexData->killed); + send_to_char(buf,ch); + } + + sprintf( buf, + "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) ); + send_to_char( buf, ch ); + + sprintf( buf, "Hp: %d/%d Mana: %d/%d Move: %d/%d Practices: %d\n\r", + victim->hit, victim->max_hit, + victim->mana, victim->max_mana, + victim->move, victim->max_move, + IS_NPC(ch) ? 0 : victim->practice ); + send_to_char( buf, ch ); + + sprintf( buf, + "Lv: %d Class: %s Align: %d Gold: %ld Silver: %ld Exp: %d\n\r", + victim->level, + IS_NPC(victim) ? "mobile" : class_table[victim->class].name, + victim->alignment, + victim->gold, victim->silver, victim->exp ); + send_to_char( buf, ch ); + + sprintf(buf,"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)); + send_to_char(buf,ch); + + sprintf( buf, + "Hit: %d Dam: %d Saves: %d Size: %s Position: %s Wimpy: %d\n\r", + GET_HITROLL(victim), GET_DAMROLL(victim), victim->saving_throw, + size_table[victim->size].name, position_table[victim->position].name, + victim->wimpy ); + send_to_char( buf, ch ); + + if (IS_NPC(victim) && victim->pIndexData->new_format) + { + sprintf(buf, "Damage: %dd%d Message: %s\n\r", + victim->damage[DICE_NUMBER],victim->damage[DICE_TYPE], + attack_table[victim->dam_type].noun); + send_to_char(buf,ch); + } + sprintf( buf, "Fighting: %s\n\r", + victim->fighting ? victim->fighting->name : "(none)" ); + send_to_char( buf, ch ); + + if ( !IS_NPC(victim) ) + { + sprintf( buf, + "Thirst: %d Hunger: %d Full: %d Drunk: %d\n\r", + victim->pcdata->condition[COND_THIRST], + victim->pcdata->condition[COND_HUNGER], + victim->pcdata->condition[COND_FULL], + victim->pcdata->condition[COND_DRUNK] ); + send_to_char( buf, ch ); + } + + sprintf( buf, "Carry number: %d Carry weight: %ld\n\r", + victim->carry_number, get_carry_weight(victim) / 10 ); + send_to_char( buf, ch ); + + + if (!IS_NPC(victim)) + { + sprintf( buf, + "Age: %d Played: %d Last Level: %d Timer: %d\n\r", + get_age(victim), + (int) (victim->played + current_time - victim->logon) / 3600, + victim->pcdata->last_level, + victim->timer ); + send_to_char( buf, ch ); + } + + sprintf(buf, "Act: %s\n\r",act_bit_name(victim->act)); + send_to_char(buf,ch); + + if (victim->comm) + { + sprintf(buf,"Comm: %s\n\r",comm_bit_name(victim->comm)); + send_to_char(buf,ch); + } + + if (IS_NPC(victim) && victim->off_flags) + { + sprintf(buf, "Offense: %s\n\r",off_bit_name(victim->off_flags)); + send_to_char(buf,ch); + } + + if (victim->imm_flags) + { + sprintf(buf, "Immune: %s\n\r",imm_bit_name(victim->imm_flags)); + send_to_char(buf,ch); + } + + if (victim->res_flags) + { + sprintf(buf, "Resist: %s\n\r", imm_bit_name(victim->res_flags)); + send_to_char(buf,ch); + } + + if (victim->vuln_flags) + { + sprintf(buf, "Vulnerable: %s\n\r", imm_bit_name(victim->vuln_flags)); + send_to_char(buf,ch); + } + + sprintf(buf, "Form: %s\n\rParts: %s\n\r", + form_bit_name(victim->form), part_bit_name(victim->parts)); + send_to_char(buf,ch); + + if (victim->affected_by) + { + sprintf(buf, "Affected by %s\n\r", + affect_bit_name(victim->affected_by)); + send_to_char(buf,ch); + } + + sprintf( buf, "Master: %s Leader: %s Pet: %s\n\r", + victim->master ? victim->master->name : "(none)", + victim->leader ? victim->leader->name : "(none)", + victim->pet ? victim->pet->name : "(none)"); + send_to_char( buf, ch ); + + sprintf( buf, "Short description: %s\n\rLong description: %s", + victim->short_descr, + victim->long_descr[0] != '\0' ? victim->long_descr : "(none)\n\r" ); + send_to_char( buf, ch ); + + if ( IS_NPC(victim) && victim->spec_fun != 0 ) + { + sprintf(buf,"Mobile has special procedure %s.\n\r", + spec_name(victim->spec_fun)); + send_to_char(buf,ch); + } + + for ( paf = victim->affected; paf != NULL; paf = paf->next ) + { + sprintf( buf, + "Spell: '%s' modifies %s by %d for %d hours with bits %s, level %d.\n\r", + skill_table[(int) paf->type].name, + affect_loc_name( paf->location ), + paf->modifier, + paf->duration, + affect_bit_name( paf->bitvector ), + paf->level + ); + send_to_char( buf, ch ); + } + + return; +} + +/* ofind and mfind replaced with vnum, vnum skill also added */ + +void do_vnum(CHAR_DATA *ch, char *argument) +{ + char arg[MAX_INPUT_LENGTH]; + char *string; + + string = one_argument(argument,arg); + + if (arg[0] == '\0') + { + send_to_char("Syntax:\n\r",ch); + send_to_char(" vnum obj \n\r",ch); + send_to_char(" vnum mob \n\r",ch); + send_to_char(" vnum skill \n\r",ch); + return; + } + + if (!str_cmp(arg,"obj")) + { + do_function(ch, &do_ofind, string); + return; + } + + if (!str_cmp(arg,"mob") || !str_cmp(arg,"char")) + { + do_function(ch, &do_mfind, string); + return; + } + + if (!str_cmp(arg,"skill") || !str_cmp(arg,"spell")) + { + do_function (ch, &do_slookup, string); + return; + } + /* do both */ + do_function(ch, &do_mfind, argument); + do_function(ch, &do_ofind, argument); +} + + +void do_mfind( CHAR_DATA *ch, char *argument ) +{ + extern int top_mob_index; + char buf[MAX_STRING_LENGTH]; + char arg[MAX_INPUT_LENGTH]; + MOB_INDEX_DATA *pMobIndex; + int vnum; + int nMatch; + bool fAll; + bool found; + + one_argument( argument, arg ); + if ( arg[0] == '\0' ) + { + send_to_char( "Find whom?\n\r", ch ); + return; + } + + fAll = FALSE; /* !str_cmp( arg, "all" ); */ + 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 ( fAll || is_name( argument, pMobIndex->player_name ) ) + { + found = TRUE; + sprintf( buf, "[%5d] %s\n\r", + pMobIndex->vnum, pMobIndex->short_descr ); + send_to_char( buf, ch ); + } + } + } + + if ( !found ) + send_to_char( "No mobiles by that name.\n\r", ch ); + + return; +} + + + +void do_ofind( CHAR_DATA *ch, char *argument ) +{ + extern int top_obj_index; + char buf[MAX_STRING_LENGTH]; + char arg[MAX_INPUT_LENGTH]; + OBJ_INDEX_DATA *pObjIndex; + int vnum; + int nMatch; + bool fAll; + bool found; + + one_argument( argument, arg ); + if ( arg[0] == '\0' ) + { + send_to_char( "Find what?\n\r", ch ); + return; + } + + fAll = FALSE; /* !str_cmp( arg, "all" ); */ + 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 ( fAll || is_name( argument, pObjIndex->name ) ) + { + found = TRUE; + sprintf( buf, "[%5d] %s\n\r", + pObjIndex->vnum, pObjIndex->short_descr ); + send_to_char( buf, ch ); + } + } + } + + if ( !found ) + send_to_char( "No objects by that name.\n\r", ch ); + + return; +} + + +void do_owhere(CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_INPUT_LENGTH]; + BUFFER *buffer; + OBJ_DATA *obj; + OBJ_DATA *in_obj; + bool found; + int number = 0, max_found; + + found = FALSE; + 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 ) + { + if ( !can_see_obj( ch, obj ) || !is_name( argument, obj->name ) + || ch->level < obj->level) + continue; + + 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,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)) + 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_mwhere( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + BUFFER *buffer; + CHAR_DATA *victim; + bool found; + int count = 0; + + if ( argument[0] == '\0' ) + { + DESCRIPTOR_DATA *d; + + /* show characters logged */ + + buffer = new_buf(); + 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) + sprintf(buf,"%3d) %s (in the body of %s) is in %s [%d]\n\r", + count, d->original->name,victim->short_descr, + victim->in_room->name,victim->in_room->vnum); + else + sprintf(buf,"%3d) %s is in %s [%d]\n\r", + count, victim->name,victim->in_room->name, + victim->in_room->vnum); + add_buf(buffer,buf); + } + } + + page_to_char(buf_string(buffer),ch); + free_buf(buffer); + return; + } + + found = FALSE; + buffer = new_buf(); + for ( victim = char_list; victim != NULL; victim = victim->next ) + { + if ( victim->in_room != NULL + && is_name( argument, victim->name ) ) + { + 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 ) + act( "You didn't find any $T.", ch, NULL, argument, TO_CHAR ); + else + page_to_char(buf_string(buffer),ch); + + free_buf(buffer); + + return; +} + + + +void do_reboo( CHAR_DATA *ch, char *argument ) +{ + send_to_char( "If you want to REBOOT, spell it out.\n\r", ch ); + return; +} + + + +void do_reboot( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + extern bool merc_down; + DESCRIPTOR_DATA *d,*d_next; + CHAR_DATA *vch; + + if (ch->invis_level < LEVEL_HERO) + { + sprintf( buf, "Reboot by %s.", ch->name ); + do_function(ch, &do_echo, buf ); + } + + merc_down = TRUE; + for ( d = descriptor_list; d != NULL; d = d_next ) + { + d_next = d->next; + vch = d->original ? d->original : d->character; + if (vch != NULL) + save_char_obj(vch); + close_socket(d); + } + + return; +} + +void do_shutdow( CHAR_DATA *ch, char *argument ) +{ + send_to_char( "If you want to SHUTDOWN, spell it out.\n\r", ch ); + return; +} + +void do_shutdown( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + extern bool merc_down; + DESCRIPTOR_DATA *d,*d_next; + CHAR_DATA *vch; + + 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_function(ch, &do_echo, buf ); + } + merc_down = TRUE; + for ( d = descriptor_list; d != NULL; d = d_next) + { + d_next = d->next; + vch = d->original ? d->original : d->character; + if (vch != NULL) + save_char_obj(vch); + close_socket(d); + } + return; +} + +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)) + { + act_new("$N is no longer snoop-proof.",ch,NULL,victim,TO_CHAR,POS_DEAD); + send_to_char("Your snoop-proofing was just removed.\n\r",victim); + REMOVE_BIT(victim->comm,COMM_SNOOP_PROOF); + } + else + { + act_new("$N is now snoop-proof.",ch,NULL,victim,TO_CHAR,POS_DEAD); + send_to_char("You are now immune to snooping.\n\r",victim); + SET_BIT(victim->comm,COMM_SNOOP_PROOF); + } +} + + + +void do_snoop( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + DESCRIPTOR_DATA *d; + CHAR_DATA *victim; + char buf[MAX_STRING_LENGTH]; + + 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 ) + { + send_to_char( "No descriptor to snoop.\n\r", ch ); + 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)); + 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 ) + { + send_to_char( "Busy already.\n\r", 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)) + { + send_to_char("That character is in a private room.\n\r",ch); + return; + } + + if ( get_trust( victim ) >= get_trust( ch ) + || IS_SET(victim->comm,COMM_SNOOP_PROOF)) + { + send_to_char( "You failed.\n\r", 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 ) + { + send_to_char( "No snoop loops.\n\r", ch ); + return; + } + } + } + + victim->desc->snoop_by = 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)); + send_to_char( "Ok.\n\r", ch ); + return; +} + + + +void do_switch( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH], buf[MAX_STRING_LENGTH]; + 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( "Ok.\n\r", ch ); + return; + } + + if (!IS_NPC(victim)) + { + send_to_char("You can only switch into mobiles.\n\r",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)) + { + send_to_char("That character is in a private room.\n\r",ch); + return; + } + + if ( victim->desc != NULL ) + { + send_to_char( "Character in use.\n\r", ch ); + 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; + /* change communications to match */ + if (ch->prompt != NULL) + victim->prompt = str_dup(ch->prompt); + victim->comm = ch->comm; + victim->lines = ch->lines; + send_to_char( "Ok.\n\r", victim ); + return; +} + + + +void do_return( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + + 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. Type replay to see any 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->desc->character = ch->desc->original; + ch->desc->original = NULL; + ch->desc->character->desc = ch->desc; + ch->desc = NULL; + return; +} + +/* 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; +} + +/* 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_object(c_obj->pIndexData,0); + clone_object(c_obj,t_obj); + obj_to_obj(t_obj,clone); + recursive_clone(ch,c_obj,t_obj); + } + } +} + +/* command that is similar to load */ +void do_clone(CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + char *rest; + CHAR_DATA *mob; + OBJ_DATA *obj; + + 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,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,rest); + if (mob == NULL) + { + send_to_char("You don't see that here.\n\r",ch); + return; + } + } + else /* find both */ + { + mob = get_char_room(ch,argument); + obj = get_obj_here(ch,argument); + if (mob == NULL && obj == NULL) + { + send_to_char("You don't see that here.\n\r",ch); + return; + } + } + + /* clone an object */ + if (obj != NULL) + { + OBJ_DATA *clone; + + if (!obj_check(ch,obj)) + { + send_to_char( + "Your powers are not great enough for such a task.\n\r",ch); + return; + } + + 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[MAX_STRING_LENGTH]; + + if (!IS_NPC(mob)) + { + send_to_char("You can only clone mobiles.\n\r",ch); + return; + } + + 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)) + { + send_to_char( + "Your powers are not great enough for such a task.\n\r",ch); + return; + } + + clone = create_mobile(mob->pIndexData); + clone_mobile(mob,clone); + + for (obj = mob->carrying; obj != NULL; obj = obj->next_content) + { + if (obj_check(ch,obj)) + { + 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)); + return; + } +} + +/* RT to replace the two load commands */ + +void do_load(CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + + argument = one_argument(argument,arg); + + if (arg[0] == '\0') + { + send_to_char("Syntax:\n\r",ch); + send_to_char(" load mob \n\r",ch); + send_to_char(" load obj \n\r",ch); + return; + } + + if (!str_cmp(arg,"mob") || !str_cmp(arg,"char")) + { + do_function(ch, &do_mload, argument); + return; + } + + if (!str_cmp(arg,"obj")) + { + do_function(ch, &do_oload, argument); + return; + } + /* echo syntax */ + do_function(ch, &do_load, ""); +} + + +void do_mload( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + MOB_INDEX_DATA *pMobIndex; + CHAR_DATA *victim; + char buf[MAX_STRING_LENGTH]; + + one_argument( argument, arg ); + + if ( arg[0] == '\0' || !is_number(arg) ) + { + send_to_char( "Syntax: load mob .\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 ); + sprintf(buf,"$N loads %s.",victim->short_descr); + wiznet(buf,ch,NULL,WIZ_LOAD,WIZ_SECURE,get_trust(ch)); + send_to_char( "Ok.\n\r", ch ); + return; +} + + + +void do_oload( CHAR_DATA *ch, char *argument ) +{ + char arg1[MAX_INPUT_LENGTH] ,arg2[MAX_INPUT_LENGTH]; + OBJ_INDEX_DATA *pObjIndex; + OBJ_DATA *obj; + int level; + + argument = one_argument( argument, arg1 ); + one_argument( argument, arg2 ); + + if ( arg1[0] == '\0' || !is_number(arg1)) + { + send_to_char( "Syntax: load obj .\n\r", ch ); + return; + } + + level = get_trust(ch); /* default */ + + if ( arg2[0] != '\0') /* load with a level */ + { + if (!is_number(arg2)) + { + send_to_char( "Syntax: oload .\n\r", ch ); + return; + } + level = atoi(arg2); + if (level < 0 || level > get_trust(ch)) + { + send_to_char( "Level must be be between 0 and your level.\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 ); + wiznet("$N loads $p.",ch,obj,WIZ_LOAD,WIZ_SECURE,get_trust(ch)); + send_to_char( "Ok.\n\r", ch ); + return; +} + + + +void do_purge( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + char buf[100]; + CHAR_DATA *victim; + OBJ_DATA *obj; + DESCRIPTOR_DATA *d; + + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + { + /* 'purge' */ + 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 /* 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); + send_to_char( "Ok.\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) ) + { + + 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); + sprintf(buf,"%s tried to purge you!\n\r",ch->name); + send_to_char(buf,victim); + return; + } + + act("$n disintegrates $N.",ch,0,victim,TO_NOTVICT); + + if (victim->level > 1) + save_char_obj( victim ); + d = victim->desc; + extract_char( victim, TRUE ); + if ( d != NULL ) + close_socket( d ); + + return; + } + + act( "$n purges $N.", ch, NULL, victim, TO_NOTVICT ); + extract_char( victim, TRUE ); + return; +} + + + +void do_advance( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + char arg1[MAX_INPUT_LENGTH]; + char arg2[MAX_INPUT_LENGTH]; + CHAR_DATA *victim; + int level; + int iLevel; + + argument = one_argument( argument, arg1 ); + argument = one_argument( argument, arg2 ); + + if ( arg1[0] == '\0' || arg2[0] == '\0' || !is_number( arg2 ) ) + { + send_to_char( "Syntax: advance .\n\r", ch ); + return; + } + + if ( ( victim = get_char_world( ch, arg1 ) ) == NULL ) + { + send_to_char( "That player is not here.\n\r", ch); + return; + } + + if ( IS_NPC(victim) ) + { + send_to_char( "Not on NPC's.\n\r", ch ); + return; + } + + if ( ( level = atoi( arg2 ) ) < 1 || level > MAX_LEVEL ) + { + sprintf(buf,"Level must be 1 to %d.\n\r", MAX_LEVEL); + send_to_char(buf, ch); + return; + } + + if ( level > get_trust( ch ) ) + { + send_to_char( "Limited to your trust level.\n\r", ch ); + return; + } + + /* + * Lower level: + * Reset to level 1. + * Then raise again. + * Currently, an imp can lower another imp. + * -- Swiftest + */ + if ( level <= victim->level ) + { + int temp_prac; + + send_to_char( "Lowering a player's level!\n\r", ch ); + send_to_char( "**** OOOOHHHHHHHHHH NNNNOOOO ****\n\r", victim ); + temp_prac = victim->practice; + victim->level = 1; + victim->exp = exp_per_level(victim,victim->pcdata->points); + victim->max_hit = 10; + victim->max_mana = 100; + victim->max_move = 100; + victim->practice = 0; + victim->hit = victim->max_hit; + victim->mana = victim->max_mana; + victim->move = victim->max_move; + advance_level( victim, TRUE ); + victim->practice = temp_prac; + } + else + { + send_to_char( "Raising a player's level!\n\r", ch ); + send_to_char( "**** OOOOHHHHHHHHHH YYYYEEEESSS ****\n\r", victim ); + } + + for ( iLevel = victim->level ; iLevel < level; iLevel++ ) + { + victim->level += 1; + advance_level( victim,TRUE); + } + sprintf(buf,"You are now level %d.\n\r",victim->level); + send_to_char(buf,victim); + victim->exp = exp_per_level(victim,victim->pcdata->points) + * UMAX( 1, victim->level ); + victim->trust = 0; + save_char_obj(victim); + return; +} + + + +void do_trust( CHAR_DATA *ch, char *argument ) +{ + char arg1[MAX_INPUT_LENGTH]; + char arg2[MAX_INPUT_LENGTH]; + char buf[MAX_STRING_LENGTH]; + CHAR_DATA *victim; + int level; + + argument = one_argument( argument, arg1 ); + argument = one_argument( argument, arg2 ); + + if ( arg1[0] == '\0' || arg2[0] == '\0' || !is_number( arg2 ) ) + { + send_to_char( "Syntax: trust .\n\r", ch ); + return; + } + + if ( ( victim = get_char_world( ch, arg1 ) ) == NULL ) + { + send_to_char( "That player is not here.\n\r", ch); + return; + } + + if ( ( level = atoi( arg2 ) ) < 0 || level > MAX_LEVEL ) + { + sprintf(buf, "Level must be 0 (reset) or 1 to %d.\n\r",MAX_LEVEL); + send_to_char(buf, ch); + return; + } + + if ( level > get_trust( ch ) ) + { + send_to_char( "Limited to your trust.\n\r", ch ); + return; + } + + victim->trust = level; + return; +} + + + +void do_restore( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH], buf[MAX_STRING_LENGTH]; + CHAR_DATA *victim; + CHAR_DATA *vch; + DESCRIPTOR_DATA *d; + + one_argument( argument, arg ); + if (arg[0] == '\0' || !str_cmp(arg,"room")) + { + /* cure room */ + + for (vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room) + { + affect_strip(vch,gsn_plague); + affect_strip(vch,gsn_poison); + affect_strip(vch,gsn_blindness); + affect_strip(vch,gsn_sleep); + affect_strip(vch,gsn_curse); + + vch->hit = vch->max_hit; + vch->mana = vch->max_mana; + vch->move = vch->max_move; + update_pos( vch); + act("$n has restored you.",ch,NULL,vch,TO_VICT); + } + + sprintf(buf,"$N restored room %d.",ch->in_room->vnum); + wiznet(buf,ch,NULL,WIZ_RESTORE,WIZ_SECURE,get_trust(ch)); + + send_to_char("Room restored.\n\r",ch); + return; + + } + + if ( get_trust(ch) >= MAX_LEVEL - 1 && !str_cmp(arg,"all")) + { + /* cure all */ + + for (d = descriptor_list; d != NULL; d = d->next) + { + victim = d->character; + + if (victim == NULL || IS_NPC(victim)) + continue; + + affect_strip(victim,gsn_plague); + affect_strip(victim,gsn_poison); + affect_strip(victim,gsn_blindness); + affect_strip(victim,gsn_sleep); + affect_strip(victim,gsn_curse); + + victim->hit = victim->max_hit; + victim->mana = victim->max_mana; + victim->move = victim->max_move; + update_pos( victim); + if (victim->in_room != NULL) + act("$n has restored you.",ch,NULL,victim,TO_VICT); + } + send_to_char("All active players restored.\n\r",ch); + return; + } + + if ( ( victim = get_char_world( ch, arg ) ) == NULL ) + { + send_to_char( "They aren't here.\n\r", ch ); + return; + } + + affect_strip(victim,gsn_plague); + affect_strip(victim,gsn_poison); + affect_strip(victim,gsn_blindness); + affect_strip(victim,gsn_sleep); + affect_strip(victim,gsn_curse); + victim->hit = victim->max_hit; + victim->mana = victim->max_mana; + victim->move = victim->max_move; + update_pos( victim ); + act( "$n has restored you.", ch, NULL, victim, TO_VICT ); + sprintf(buf,"$N restored %s", + IS_NPC(victim) ? victim->short_descr : victim->name); + wiznet(buf,ch,NULL,WIZ_RESTORE,WIZ_SECURE,get_trust(ch)); + send_to_char( "Ok.\n\r", ch ); + return; +} + + +void do_freeze( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH],buf[MAX_STRING_LENGTH]; + CHAR_DATA *victim; + + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + { + send_to_char( "Freeze 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; + } + + if ( IS_SET(victim->act, PLR_FREEZE) ) + { + REMOVE_BIT(victim->act, PLR_FREEZE); + send_to_char( "You can play again.\n\r", victim ); + send_to_char( "FREEZE removed.\n\r", ch ); + sprintf(buf,"$N thaws %s.",victim->name); + wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); + } + else + { + SET_BIT(victim->act, PLR_FREEZE); + send_to_char( "You can't do ANYthing!\n\r", victim ); + send_to_char( "FREEZE set.\n\r", ch ); + sprintf(buf,"$N puts %s in the deep freeze.",victim->name); + wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); + } + + save_char_obj( victim ); + + return; +} + + + +void do_log( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + CHAR_DATA *victim; + + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + { + send_to_char( "Log whom?\n\r", ch ); + return; + } + + if ( !str_cmp( arg, "all" ) ) + { + if ( fLogAll ) + { + fLogAll = FALSE; + send_to_char( "Log ALL off.\n\r", ch ); + } + else + { + fLogAll = TRUE; + send_to_char( "Log ALL on.\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; + } + + /* + * No level check, gods can log anyone. + */ + if ( IS_SET(victim->act, PLR_LOG) ) + { + REMOVE_BIT(victim->act, PLR_LOG); + send_to_char( "LOG removed.\n\r", ch ); + } + else + { + SET_BIT(victim->act, PLR_LOG); + send_to_char( "LOG set.\n\r", ch ); + } + + return; +} + + + +void do_noemote( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH],buf[MAX_STRING_LENGTH]; + CHAR_DATA *victim; + + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + { + send_to_char( "Noemote 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 ( get_trust( victim ) >= get_trust( ch ) ) + { + send_to_char( "You failed.\n\r", ch ); + return; + } + + if ( IS_SET(victim->comm, COMM_NOEMOTE) ) + { + REMOVE_BIT(victim->comm, COMM_NOEMOTE); + send_to_char( "You can emote again.\n\r", victim ); + send_to_char( "NOEMOTE removed.\n\r", ch ); + sprintf(buf,"$N restores emotes to %s.",victim->name); + wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); + } + else + { + SET_BIT(victim->comm, COMM_NOEMOTE); + send_to_char( "You can't emote!\n\r", victim ); + send_to_char( "NOEMOTE set.\n\r", ch ); + sprintf(buf,"$N revokes %s's emotes.",victim->name); + wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); + } + + return; +} + + + +void do_noshout( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH],buf[MAX_STRING_LENGTH]; + CHAR_DATA *victim; + + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + { + send_to_char( "Noshout 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; + } + + if ( IS_SET(victim->comm, COMM_NOSHOUT) ) + { + REMOVE_BIT(victim->comm, COMM_NOSHOUT); + send_to_char( "You can shout again.\n\r", victim ); + send_to_char( "NOSHOUT removed.\n\r", ch ); + sprintf(buf,"$N restores shouts to %s.",victim->name); + wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); + } + else + { + SET_BIT(victim->comm, COMM_NOSHOUT); + send_to_char( "You can't shout!\n\r", victim ); + send_to_char( "NOSHOUT set.\n\r", ch ); + sprintf(buf,"$N revokes %s's shouts.",victim->name); + wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); + } + + return; +} + + + +void do_notell( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH],buf[MAX_STRING_LENGTH]; + CHAR_DATA *victim; + + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + { + send_to_char( "Notell 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_NOTELL) ) + { + REMOVE_BIT(victim->comm, COMM_NOTELL); + send_to_char( "You can tell again.\n\r", victim ); + send_to_char( "NOTELL removed.\n\r", ch ); + sprintf(buf,"$N restores tells to %s.",victim->name); + wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); + } + else + { + SET_BIT(victim->comm, COMM_NOTELL); + send_to_char( "You can't tell!\n\r", victim ); + send_to_char( "NOTELL set.\n\r", ch ); + sprintf(buf,"$N revokes %s's tells.",victim->name); + wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); + } + + return; +} + + + +void do_peace( CHAR_DATA *ch, char *argument ) +{ + CHAR_DATA *rch; + + for ( rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room ) + { + if ( rch->fighting != NULL ) + stop_fighting( rch, TRUE ); + if (IS_NPC(rch) && IS_SET(rch->act,ACT_AGGRESSIVE)) + REMOVE_BIT(rch->act,ACT_AGGRESSIVE); + } + + send_to_char( "Ok.\n\r", ch ); + return; +} + +void do_wizlock( CHAR_DATA *ch, char *argument ) +{ + extern bool wizlock; + wizlock = !wizlock; + + if ( wizlock ) + { + wiznet("$N has wizlocked the game.",ch,NULL,0,0,0); + send_to_char( "Game wizlocked.\n\r", ch ); + } + else + { + wiznet("$N removes wizlock.",ch,NULL,0,0,0); + send_to_char( "Game un-wizlocked.\n\r", ch ); + } + + return; +} + +/* RT anti-newbie code */ + +void do_newlock( CHAR_DATA *ch, char *argument ) +{ + extern bool newlock; + newlock = !newlock; + + if ( newlock ) + { + wiznet("$N locks out new characters.",ch,NULL,0,0,0); + send_to_char( "New characters have been locked out.\n\r", ch ); + } + else + { + wiznet("$N allows new characters back in.",ch,NULL,0,0,0); + send_to_char( "Newlock removed.\n\r", ch ); + } + + return; +} + + +void do_slookup( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + char arg[MAX_INPUT_LENGTH]; + int sn; + + one_argument( argument, arg ); + if ( arg[0] == '\0' ) + { + send_to_char( "Lookup which skill or spell?\n\r", ch ); + return; + } + + if ( !str_cmp( arg, "all" ) ) + { + for ( sn = 0; sn < MAX_SKILL; sn++ ) + { + if ( skill_table[sn].name == NULL ) + break; + sprintf( buf, "Sn: %3d Slot: %3d Skill/spell: '%s'\n\r", + sn, skill_table[sn].slot, skill_table[sn].name ); + send_to_char( buf, ch ); + } + } + else + { + if ( ( sn = skill_lookup( arg ) ) < 0 ) + { + send_to_char( "No such skill or spell.\n\r", ch ); + return; + } + + sprintf( buf, "Sn: %3d Slot: %3d Skill/spell: '%s'\n\r", + sn, skill_table[sn].slot, skill_table[sn].name ); + send_to_char( buf, ch ); + } + + return; +} + +/* RT set replaces sset, mset, oset, and rset */ + +void do_set( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + + argument = one_argument(argument,arg); + + if (arg[0] == '\0') + { + send_to_char("Syntax:\n\r",ch); + send_to_char(" set mob \n\r",ch); + send_to_char(" set obj \n\r",ch); + send_to_char(" set room \n\r",ch); + send_to_char(" set skill \n\r",ch); + return; + } + + if (!str_prefix(arg,"mobile") || !str_prefix(arg,"character")) + { + do_function(ch, &do_mset, argument); + return; + } + + if (!str_prefix(arg,"skill") || !str_prefix(arg,"spell")) + { + do_function(ch, &do_sset, argument); + return; + } + + if (!str_prefix(arg,"object")) + { + do_function(ch, &do_oset, argument); + return; + } + + if (!str_prefix(arg,"room")) + { + do_function(ch, &do_rset, argument); + return; + } + /* echo syntax */ + do_function(ch, &do_set, ""); +} + + +void do_sset( CHAR_DATA *ch, char *argument ) +{ + char arg1 [MAX_INPUT_LENGTH]; + char arg2 [MAX_INPUT_LENGTH]; + char arg3 [MAX_INPUT_LENGTH]; + CHAR_DATA *victim; + int value; + int sn; + bool fAll; + + argument = one_argument( argument, arg1 ); + argument = one_argument( argument, arg2 ); + argument = one_argument( argument, arg3 ); + + if ( arg1[0] == '\0' || arg2[0] == '\0' || arg3[0] == '\0' ) + { + send_to_char( "Syntax:\n\r",ch); + send_to_char( " set skill \n\r", ch); + send_to_char( " set skill all \n\r",ch); + send_to_char(" (use the name of the skill, not the number)\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; + } + + fAll = !str_cmp( arg2, "all" ); + sn = 0; + if ( !fAll && ( sn = skill_lookup( arg2 ) ) < 0 ) + { + send_to_char( "No such skill or spell.\n\r", ch ); + return; + } + + /* + * Snarf the value. + */ + if ( !is_number( arg3 ) ) + { + send_to_char( "Value must be numeric.\n\r", ch ); + return; + } + + value = atoi( arg3 ); + if ( value < 0 || value > 100 ) + { + send_to_char( "Value range is 0 to 100.\n\r", ch ); + return; + } + + if ( fAll ) + { + for ( sn = 0; sn < MAX_SKILL; sn++ ) + { + if ( skill_table[sn].name != NULL ) + victim->pcdata->learned[sn] = value; + } + } + else + { + victim->pcdata->learned[sn] = value; + } + + return; +} + + +void do_mset( CHAR_DATA *ch, char *argument ) +{ + char arg1 [MAX_INPUT_LENGTH]; + char arg2 [MAX_INPUT_LENGTH]; + char arg3 [MAX_INPUT_LENGTH]; + char buf[100]; + CHAR_DATA *victim; + int value; + + smash_tilde( argument ); + argument = one_argument( argument, arg1 ); + argument = one_argument( argument, arg2 ); + strcpy( arg3, argument ); + + if ( arg1[0] == '\0' || arg2[0] == '\0' || arg3[0] == '\0' ) + { + send_to_char("Syntax:\n\r",ch); + send_to_char(" set char \n\r",ch); + send_to_char( " Field being one of:\n\r", ch ); + send_to_char( " str int wis dex con sex class level\n\r", ch ); + send_to_char( " race group gold silver hp mana move prac\n\r",ch); + send_to_char( " align train thirst hunger drunk full\n\r", ch ); + return; + } + + if ( ( victim = get_char_world( ch, arg1 ) ) == NULL ) + { + send_to_char( "They aren't here.\n\r", ch ); + return; + } + + /* clear zones for mobs */ + victim->zone = NULL; + + /* + * Snarf the value (which need not be numeric). + */ + value = is_number( arg3 ) ? atoi( arg3 ) : -1; + + /* + * Set something. + */ + if ( !str_cmp( arg2, "str" ) ) + { + if ( value < 3 || value > get_max_train(victim,STAT_STR) ) + { + sprintf(buf, + "Strength range is 3 to %d\n\r.", + get_max_train(victim,STAT_STR)); + send_to_char(buf,ch); + return; + } + + victim->perm_stat[STAT_STR] = value; + return; + } + + if ( !str_cmp( arg2, "int" ) ) + { + if ( value < 3 || value > get_max_train(victim,STAT_INT) ) + { + sprintf(buf, + "Intelligence range is 3 to %d.\n\r", + get_max_train(victim,STAT_INT)); + send_to_char(buf,ch); + return; + } + + victim->perm_stat[STAT_INT] = value; + return; + } + + if ( !str_cmp( arg2, "wis" ) ) + { + if ( value < 3 || value > get_max_train(victim,STAT_WIS) ) + { + sprintf(buf, + "Wisdom range is 3 to %d.\n\r",get_max_train(victim,STAT_WIS)); + send_to_char( buf, ch ); + return; + } + + victim->perm_stat[STAT_WIS] = value; + return; + } + + if ( !str_cmp( arg2, "dex" ) ) + { + if ( value < 3 || value > get_max_train(victim,STAT_DEX) ) + { + sprintf(buf, + "Dexterity range is 3 to %d.\n\r", + get_max_train(victim,STAT_DEX)); + send_to_char( buf, ch ); + return; + } + + victim->perm_stat[STAT_DEX] = value; + return; + } + + if ( !str_cmp( arg2, "con" ) ) + { + if ( value < 3 || value > get_max_train(victim,STAT_CON) ) + { + sprintf(buf, + "Constitution range is 3 to %d.\n\r", + get_max_train(victim,STAT_CON)); + send_to_char( buf, ch ); + return; + } + + victim->perm_stat[STAT_CON] = value; + return; + } + + if ( !str_prefix( arg2, "sex" ) ) + { + if ( value < 0 || value > 2 ) + { + send_to_char( "Sex range is 0 to 2.\n\r", ch ); + return; + } + victim->sex = value; + if (!IS_NPC(victim)) + victim->pcdata->true_sex = value; + return; + } + + if ( !str_prefix( arg2, "class" ) ) + { + int class; + + if (IS_NPC(victim)) + { + send_to_char("Mobiles have no class.\n\r",ch); + return; + } + + class = class_lookup(arg3); + if ( class == -1 ) + { + char buf[MAX_STRING_LENGTH]; + + strcpy( buf, "Possible classes are: " ); + for ( class = 0; class < MAX_CLASS; class++ ) + { + if ( class > 0 ) + strcat( buf, " " ); + strcat( buf, class_table[class].name ); + } + strcat( buf, ".\n\r" ); + + send_to_char(buf,ch); + return; + } + + victim->class = class; + return; + } + + if ( !str_prefix( arg2, "level" ) ) + { + if ( !IS_NPC(victim) ) + { + send_to_char( "Not on PC's.\n\r", ch ); + return; + } + + if ( value < 0 || value > MAX_LEVEL ) + { + sprintf(buf, "Level range is 0 to %d.\n\r", MAX_LEVEL); + send_to_char(buf, ch); + return; + } + victim->level = value; + return; + } + + if ( !str_prefix( arg2, "gold" ) ) + { + victim->gold = value; + return; + } + + if ( !str_prefix(arg2, "silver" ) ) + { + victim->silver = value; + return; + } + + if ( !str_prefix( arg2, "hp" ) ) + { + if ( value < -10 || value > 30000 ) + { + send_to_char( "Hp range is -10 to 30,000 hit points.\n\r", ch ); + return; + } + victim->max_hit = value; + if (!IS_NPC(victim)) + victim->pcdata->perm_hit = value; + return; + } + + if ( !str_prefix( arg2, "mana" ) ) + { + if ( value < 0 || value > 30000 ) + { + send_to_char( "Mana range is 0 to 30,000 mana points.\n\r", ch ); + return; + } + victim->max_mana = value; + if (!IS_NPC(victim)) + victim->pcdata->perm_mana = value; + return; + } + + if ( !str_prefix( arg2, "move" ) ) + { + if ( value < 0 || value > 30000 ) + { + send_to_char( "Move range is 0 to 30,000 move points.\n\r", ch ); + return; + } + victim->max_move = value; + if (!IS_NPC(victim)) + victim->pcdata->perm_move = value; + return; + } + + if ( !str_prefix( arg2, "practice" ) ) + { + if ( value < 0 || value > 250 ) + { + send_to_char( "Practice range is 0 to 250 sessions.\n\r", ch ); + return; + } + victim->practice = value; + return; + } + + if ( !str_prefix( arg2, "train" )) + { + if (value < 0 || value > 50 ) + { + send_to_char("Training session range is 0 to 50 sessions.\n\r",ch); + return; + } + victim->train = value; + return; + } + + if ( !str_prefix( arg2, "align" ) ) + { + if ( value < -1000 || value > 1000 ) + { + send_to_char( "Alignment range is -1000 to 1000.\n\r", ch ); + return; + } + victim->alignment = value; + return; + } + + if ( !str_prefix( arg2, "thirst" ) ) + { + if ( IS_NPC(victim) ) + { + send_to_char( "Not on NPC's.\n\r", ch ); + return; + } + + if ( value < -1 || value > 100 ) + { + send_to_char( "Thirst range is -1 to 100.\n\r", ch ); + return; + } + + victim->pcdata->condition[COND_THIRST] = value; + return; + } + + if ( !str_prefix( arg2, "drunk" ) ) + { + if ( IS_NPC(victim) ) + { + send_to_char( "Not on NPC's.\n\r", ch ); + return; + } + + if ( value < -1 || value > 100 ) + { + send_to_char( "Drunk range is -1 to 100.\n\r", ch ); + return; + } + + victim->pcdata->condition[COND_DRUNK] = value; + return; + } + + if ( !str_prefix( arg2, "full" ) ) + { + if ( IS_NPC(victim) ) + { + send_to_char( "Not on NPC's.\n\r", ch ); + return; + } + + if ( value < -1 || value > 100 ) + { + send_to_char( "Full range is -1 to 100.\n\r", ch ); + return; + } + + victim->pcdata->condition[COND_FULL] = value; + return; + } + + if ( !str_prefix( arg2, "hunger" ) ) + { + if ( IS_NPC(victim) ) + { + send_to_char( "Not on NPC's.\n\r", ch ); + return; + } + + if ( value < -1 || value > 100 ) + { + send_to_char( "Full range is -1 to 100.\n\r", ch ); + return; + } + + victim->pcdata->condition[COND_HUNGER] = value; + return; + } + + if (!str_prefix( arg2, "race" ) ) + { + int race; + + race = race_lookup(arg3); + + if ( race == 0) + { + send_to_char("That is not a valid race.\n\r",ch); + return; + } + + if (!IS_NPC(victim) && !race_table[race].pc_race) + { + send_to_char("That is not a valid player race.\n\r",ch); + return; + } + + victim->race = race; + return; + } + + if (!str_prefix(arg2,"group")) + { + if (!IS_NPC(victim)) + { + send_to_char("Only on NPCs.\n\r",ch); + return; + } + victim->group = value; + return; + } + + + /* + * Generate usage message. + */ + do_function(ch, &do_mset, "" ); + return; +} + +void do_string( CHAR_DATA *ch, char *argument ) +{ + char type [MAX_INPUT_LENGTH]; + char arg1 [MAX_INPUT_LENGTH]; + char arg2 [MAX_INPUT_LENGTH]; + char arg3 [MAX_INPUT_LENGTH]; + CHAR_DATA *victim; + OBJ_DATA *obj; + + smash_tilde( argument ); + argument = one_argument( argument, type ); + argument = one_argument( argument, arg1 ); + argument = one_argument( argument, arg2 ); + strcpy( arg3, argument ); + + if ( type[0] == '\0' || arg1[0] == '\0' || arg2[0] == '\0' || arg3[0] == '\0' ) + { + send_to_char("Syntax:\n\r",ch); + send_to_char(" string char \n\r",ch); + send_to_char(" fields: name short long desc title spec\n\r",ch); + send_to_char(" string obj \n\r",ch); + send_to_char(" fields: name short long extended\n\r",ch); + return; + } + + if (!str_prefix(type,"character") || !str_prefix(type,"mobile")) + { + if ( ( victim = get_char_world( ch, arg1 ) ) == NULL ) + { + send_to_char( "They aren't here.\n\r", ch ); + return; + } + + /* clear zone for mobs */ + victim->zone = NULL; + + /* string something */ + + if ( !str_prefix( arg2, "name" ) ) + { + if ( !IS_NPC(victim) ) + { + send_to_char( "Not on PC's.\n\r", ch ); + return; + } + free_string( victim->name ); + victim->name = str_dup( arg3 ); + return; + } + + if ( !str_prefix( arg2, "description" ) ) + { + free_string(victim->description); + victim->description = str_dup(arg3); + return; + } + + if ( !str_prefix( arg2, "short" ) ) + { + free_string( victim->short_descr ); + victim->short_descr = str_dup( arg3 ); + return; + } + + if ( !str_prefix( arg2, "long" ) ) + { + free_string( victim->long_descr ); + strcat(arg3,"\n\r"); + victim->long_descr = str_dup( arg3 ); + return; + } + + if ( !str_prefix( arg2, "title" ) ) + { + if ( IS_NPC(victim) ) + { + send_to_char( "Not on NPC's.\n\r", ch ); + return; + } + + set_title( victim, arg3 ); + return; + } + + if ( !str_prefix( arg2, "spec" ) ) + { + if ( !IS_NPC(victim) ) + { + send_to_char( "Not on PC's.\n\r", ch ); + return; + } + + if ( ( victim->spec_fun = spec_lookup( arg3 ) ) == 0 ) + { + send_to_char( "No such spec fun.\n\r", ch ); + return; + } + + return; + } + } + + if (!str_prefix(type,"object")) + { + /* string an obj */ + + if ( ( obj = get_obj_world( ch, arg1 ) ) == NULL ) + { + send_to_char( "Nothing like that in heaven or earth.\n\r", ch ); + return; + } + + if ( !str_prefix( arg2, "name" ) ) + { + free_string( obj->name ); + obj->name = str_dup( arg3 ); + return; + } + + if ( !str_prefix( arg2, "short" ) ) + { + free_string( obj->short_descr ); + obj->short_descr = str_dup( arg3 ); + return; + } + + if ( !str_prefix( arg2, "long" ) ) + { + free_string( obj->description ); + obj->description = str_dup( arg3 ); + return; + } + + if ( !str_prefix( arg2, "ed" ) || !str_prefix( arg2, "extended")) + { + EXTRA_DESCR_DATA *ed; + + argument = one_argument( argument, arg3 ); + if ( argument == NULL ) + { + send_to_char( "Syntax: oset ed \n\r", + ch ); + return; + } + + strcat(argument,"\n\r"); + + ed = new_extra_descr(); + + ed->keyword = str_dup( arg3 ); + ed->description = str_dup( argument ); + ed->next = obj->extra_descr; + obj->extra_descr = ed; + return; + } + } + + + /* echo bad use message */ + do_function(ch, &do_string, ""); +} + + + +void do_oset( CHAR_DATA *ch, char *argument ) +{ + char arg1 [MAX_INPUT_LENGTH]; + char arg2 [MAX_INPUT_LENGTH]; + char arg3 [MAX_INPUT_LENGTH]; + OBJ_DATA *obj; + int value; + + smash_tilde( argument ); + argument = one_argument( argument, arg1 ); + argument = one_argument( argument, arg2 ); + strcpy( arg3, argument ); + + if ( arg1[0] == '\0' || arg2[0] == '\0' || arg3[0] == '\0' ) + { + send_to_char("Syntax:\n\r",ch); + send_to_char(" set obj \n\r",ch); + send_to_char(" Field being one of:\n\r", ch ); + send_to_char(" value0 value1 value2 value3 value4 (v1-v4)\n\r", ch ); + send_to_char(" extra wear level weight cost timer\n\r", ch ); + return; + } + + if ( ( obj = get_obj_world( ch, arg1 ) ) == NULL ) + { + send_to_char( "Nothing like that in heaven or earth.\n\r", ch ); + return; + } + + /* + * Snarf the value (which need not be numeric). + */ + value = atoi( arg3 ); + + /* + * Set something. + */ + if ( !str_cmp( arg2, "value0" ) || !str_cmp( arg2, "v0" ) ) + { + obj->value[0] = UMIN(50,value); + return; + } + + if ( !str_cmp( arg2, "value1" ) || !str_cmp( arg2, "v1" ) ) + { + obj->value[1] = value; + return; + } + + if ( !str_cmp( arg2, "value2" ) || !str_cmp( arg2, "v2" ) ) + { + obj->value[2] = value; + return; + } + + if ( !str_cmp( arg2, "value3" ) || !str_cmp( arg2, "v3" ) ) + { + obj->value[3] = value; + return; + } + + if ( !str_cmp( arg2, "value4" ) || !str_cmp( arg2, "v4" ) ) + { + obj->value[4] = value; + return; + } + + if ( !str_prefix( arg2, "extra" ) ) + { + obj->extra_flags = value; + return; + } + + if ( !str_prefix( arg2, "wear" ) ) + { + obj->wear_flags = value; + return; + } + + if ( !str_prefix( arg2, "level" ) ) + { + obj->level = value; + return; + } + + if ( !str_prefix( arg2, "weight" ) ) + { + obj->weight = value; + return; + } + + if ( !str_prefix( arg2, "cost" ) ) + { + obj->cost = value; + return; + } + + if ( !str_prefix( arg2, "timer" ) ) + { + obj->timer = value; + return; + } + + /* + * Generate usage message. + */ + do_function(ch, &do_oset, "" ); + return; +} + + + +void do_rset( CHAR_DATA *ch, char *argument ) +{ + char arg1 [MAX_INPUT_LENGTH]; + char arg2 [MAX_INPUT_LENGTH]; + char arg3 [MAX_INPUT_LENGTH]; + ROOM_INDEX_DATA *location; + int value; + + smash_tilde( argument ); + argument = one_argument( argument, arg1 ); + argument = one_argument( argument, arg2 ); + strcpy( arg3, argument ); + + if ( arg1[0] == '\0' || arg2[0] == '\0' || arg3[0] == '\0' ) + { + send_to_char( "Syntax:\n\r",ch); + send_to_char( " set room \n\r",ch); + send_to_char( " Field being one of:\n\r", ch ); + send_to_char( " flags sector\n\r", ch ); + return; + } + + if ( ( location = find_location( ch, arg1 ) ) == NULL ) + { + send_to_char( "No such location.\n\r", ch ); + return; + } + + if (!is_room_owner(ch,location) && 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; + } + + /* + * Snarf the value. + */ + if ( !is_number( arg3 ) ) + { + send_to_char( "Value must be numeric.\n\r", ch ); + return; + } + value = atoi( arg3 ); + + /* + * Set something. + */ + if ( !str_prefix( arg2, "flags" ) ) + { + location->room_flags = value; + return; + } + + if ( !str_prefix( arg2, "sector" ) ) + { + location->sector_type = value; + return; + } + + /* + * Generate usage message. + */ + do_function(ch, &do_rset, ""); + return; +} + + + +void do_sockets( CHAR_DATA *ch, char *argument ) +{ + char buf[2 * MAX_STRING_LENGTH]; + char buf2[MAX_STRING_LENGTH]; + char arg[MAX_INPUT_LENGTH]; + DESCRIPTOR_DATA *d; + int count; + + count = 0; + buf[0] = '\0'; + + one_argument(argument,arg); + for ( d = descriptor_list; d != NULL; d = d->next ) + { + if ( d->character != NULL && can_see( ch, d->character ) + && (arg[0] == '\0' || is_name(arg,d->character->name) + || (d->original && is_name(arg,d->original->name)))) + { + count++; + sprintf( buf + strlen(buf), "[%3d %2d] %s@%s\n\r", + d->descriptor, + d->connected, + d->original ? d->original->name : + d->character ? d->character->name : "(none)", + d->host + ); + } + } + if (count == 0) + { + send_to_char("No one by that name is connected.\n\r",ch); + return; + } + + sprintf( buf2, "%d user%s\n\r", count, count == 1 ? "" : "s" ); + strcat(buf,buf2); + page_to_char( buf, ch ); + return; +} + + + +/* + * Thanks to Grodyn for pointing out bugs in this function. + */ +void do_force( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + char arg[MAX_INPUT_LENGTH]; + char arg2[MAX_INPUT_LENGTH]; + + argument = one_argument( argument, arg ); + + if ( arg[0] == '\0' || argument[0] == '\0' ) + { + send_to_char( "Force whom to do what?\n\r", ch ); + return; + } + + one_argument(argument,arg2); + + if (!str_cmp(arg2,"delete")) + { + send_to_char("That will NOT be done.\n\r",ch); + return; + } + + sprintf( buf, "$n forces you to '%s'.", argument ); + + if ( !str_cmp( arg, "all" ) ) + { + CHAR_DATA *vch; + CHAR_DATA *vch_next; + + if (get_trust(ch) < MAX_LEVEL - 3) + { + send_to_char("Not at your level!\n\r",ch); + return; + } + + for ( vch = char_list; vch != NULL; vch = vch_next ) + { + vch_next = vch->next; + + if ( !IS_NPC(vch) && get_trust( vch ) < get_trust( ch ) ) + { + act( buf, ch, NULL, vch, TO_VICT ); + interpret( vch, argument ); + } + } + } + else if (!str_cmp(arg,"players")) + { + CHAR_DATA *vch; + CHAR_DATA *vch_next; + + if (get_trust(ch) < MAX_LEVEL - 2) + { + send_to_char("Not at your level!\n\r",ch); + return; + } + + for ( vch = char_list; vch != NULL; vch = vch_next ) + { + vch_next = vch->next; + + if ( !IS_NPC(vch) && get_trust( vch ) < get_trust( ch ) + && vch->level < LEVEL_HERO) + { + act( buf, ch, NULL, vch, TO_VICT ); + interpret( vch, argument ); + } + } + } + else if (!str_cmp(arg,"gods")) + { + CHAR_DATA *vch; + CHAR_DATA *vch_next; + + if (get_trust(ch) < MAX_LEVEL - 2) + { + send_to_char("Not at your level!\n\r",ch); + return; + } + + for ( vch = char_list; vch != NULL; vch = vch_next ) + { + vch_next = vch->next; + + if ( !IS_NPC(vch) && get_trust( vch ) < get_trust( ch ) + && vch->level >= LEVEL_HERO) + { + act( buf, ch, NULL, vch, TO_VICT ); + interpret( vch, argument ); + } + } + } + else + { + CHAR_DATA *victim; + + 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( "Aye aye, right away!\n\r", 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)) + { + send_to_char("That character is in a private room.\n\r",ch); + return; + } + + if ( get_trust( victim ) >= get_trust( ch ) ) + { + send_to_char( "Do it yourself!\n\r", ch ); + return; + } + + if ( !IS_NPC(victim) && get_trust(ch) < MAX_LEVEL -3) + { + send_to_char("Not at your level!\n\r",ch); + return; + } + + act( buf, ch, NULL, victim, TO_VICT ); + interpret( victim, argument ); + } + + send_to_char( "Ok.\n\r", ch ); + return; +} + + + +/* + * New routines by Dionysos. + */ +void do_invis( CHAR_DATA *ch, char *argument ) +{ + int level; + char arg[MAX_STRING_LENGTH]; + + /* RT code for taking a level argument */ + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + /* take the default path */ + + if ( ch->invis_level) + { + ch->invis_level = 0; + act( "$n slowly fades into existence.", ch, NULL, NULL, TO_ROOM ); + send_to_char( "You slowly fade back into existence.\n\r", ch ); + } + else + { + ch->invis_level = get_trust(ch); + act( "$n slowly fades into thin air.", ch, NULL, NULL, TO_ROOM ); + send_to_char( "You slowly vanish into thin air.\n\r", ch ); + } + else + /* do the level thing */ + { + level = atoi(arg); + if (level < 2 || level > get_trust(ch)) + { + send_to_char("Invis level must be between 2 and your level.\n\r",ch); + return; + } + else + { + ch->reply = NULL; + ch->invis_level = level; + act( "$n slowly fades into thin air.", ch, NULL, NULL, TO_ROOM ); + send_to_char( "You slowly vanish into thin air.\n\r", ch ); + } + } + + return; +} + + +void do_incognito( CHAR_DATA *ch, char *argument ) +{ + int level; + char arg[MAX_STRING_LENGTH]; + + /* RT code for taking a level argument */ + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + /* take the default path */ + + if ( ch->incog_level) + { + ch->incog_level = 0; + act( "$n is no longer cloaked.", ch, NULL, NULL, TO_ROOM ); + send_to_char( "You are no longer cloaked.\n\r", ch ); + } + else + { + ch->incog_level = get_trust(ch); + act( "$n cloaks $s presence.", ch, NULL, NULL, TO_ROOM ); + send_to_char( "You cloak your presence.\n\r", ch ); + } + else + /* do the level thing */ + { + level = atoi(arg); + if (level < 2 || level > get_trust(ch)) + { + send_to_char("Incog level must be between 2 and your level.\n\r",ch); + return; + } + else + { + ch->reply = NULL; + ch->incog_level = level; + act( "$n cloaks $s presence.", ch, NULL, NULL, TO_ROOM ); + send_to_char( "You cloak your presence.\n\r", ch ); + } + } + + return; +} + + + +void do_holylight( CHAR_DATA *ch, char *argument ) +{ + if ( IS_NPC(ch) ) + return; + + if ( IS_SET(ch->act, PLR_HOLYLIGHT) ) + { + REMOVE_BIT(ch->act, PLR_HOLYLIGHT); + send_to_char( "Holy light mode off.\n\r", ch ); + } + else + { + SET_BIT(ch->act, PLR_HOLYLIGHT); + send_to_char( "Holy light mode on.\n\r", ch ); + } + + return; +} + +/* prefix command: it will put the string typed on each line typed */ + +void do_prefi (CHAR_DATA *ch, char *argument) +{ + send_to_char("You cannot abbreviate the prefix command.\r\n",ch); + return; +} + +void do_prefix (CHAR_DATA *ch, char *argument) +{ + char buf[MAX_INPUT_LENGTH]; + + if (argument[0] == '\0') + { + if (ch->prefix[0] == '\0') + { + send_to_char("You have no prefix to clear.\r\n",ch); + return; + } + + send_to_char("Prefix removed.\r\n",ch); + free_string(ch->prefix); + ch->prefix = str_dup(""); + return; + } + + if (ch->prefix[0] != '\0') + { + sprintf(buf,"Prefix changed to %s.\r\n",argument); + free_string(ch->prefix); + } + else + { + sprintf(buf,"Prefix set to %s.\r\n",argument); + } + + ch->prefix = str_dup(argument); +} diff --git a/Rom24/src/alias.c b/Rom24/src/alias.c new file mode 100644 index 0000000..8f1fa6f --- /dev/null +++ b/Rom24/src/alias.c @@ -0,0 +1,273 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +#if defined(macintosh) +#include +#else +#include +#endif +#include +#include +#include +#include "merc.h" + +/* does aliasing and other fun stuff */ +void substitute_alias(DESCRIPTOR_DATA *d, char *argument) +{ + CHAR_DATA *ch; + char buf[MAX_STRING_LENGTH],prefix[MAX_INPUT_LENGTH],name[MAX_INPUT_LENGTH]; + char *point; + int alias; + + ch = d->original ? d->original : d->character; + + /* check for prefix */ + if (ch->prefix[0] != '\0' && str_prefix("prefix",argument)) + { + if (strlen(ch->prefix) + strlen(argument) > MAX_INPUT_LENGTH) + send_to_char("Line to long, prefix not processed.\r\n",ch); + else + { + sprintf(prefix,"%s %s",ch->prefix,argument); + argument = prefix; + } + } + + if (IS_NPC(ch) || ch->pcdata->alias[0] == NULL + || !str_prefix("alias",argument) || !str_prefix("una",argument) + || !str_prefix("prefix",argument)) + { + interpret(d->character,argument); + return; + } + + strcpy(buf,argument); + + for (alias = 0; alias < MAX_ALIAS; alias++) /* go through the aliases */ + { + if (ch->pcdata->alias[alias] == NULL) + break; + + if (!str_prefix(ch->pcdata->alias[alias],argument)) + { + point = one_argument(argument,name); + if (!strcmp(ch->pcdata->alias[alias],name)) + { + buf[0] = '\0'; + strcat(buf,ch->pcdata->alias_sub[alias]); + strcat(buf," "); + strcat(buf,point); + + if (strlen(buf) > MAX_INPUT_LENGTH - 1) + { + send_to_char( + "Alias substitution too long. Truncated.\r\n",ch); + buf[MAX_INPUT_LENGTH -1] = '\0'; + } + break; + } + } + } + interpret(d->character,buf); +} + +void do_alia(CHAR_DATA *ch, char *argument) +{ + send_to_char("I'm sorry, alias must be entered in full.\n\r",ch); + return; +} + +void do_alias(CHAR_DATA *ch, char *argument) +{ + CHAR_DATA *rch; + char arg[MAX_INPUT_LENGTH],buf[MAX_STRING_LENGTH]; + int pos; + + smash_tilde(argument); + + if (ch->desc == NULL) + rch = ch; + else + rch = ch->desc->original ? ch->desc->original : ch; + + if (IS_NPC(rch)) + return; + + argument = one_argument(argument,arg); + + + if (arg[0] == '\0') + { + + if (rch->pcdata->alias[0] == NULL) + { + send_to_char("You have no aliases defined.\n\r",ch); + return; + } + send_to_char("Your current aliases are:\n\r",ch); + + for (pos = 0; pos < MAX_ALIAS; pos++) + { + if (rch->pcdata->alias[pos] == NULL + || rch->pcdata->alias_sub[pos] == NULL) + break; + + sprintf(buf," %s: %s\n\r",rch->pcdata->alias[pos], + rch->pcdata->alias_sub[pos]); + send_to_char(buf,ch); + } + return; + } + + if (!str_prefix("una",arg) || !str_cmp("alias",arg)) + { + send_to_char("Sorry, that word is reserved.\n\r",ch); + return; + } + + if (argument[0] == '\0') + { + for (pos = 0; pos < MAX_ALIAS; pos++) + { + if (rch->pcdata->alias[pos] == NULL + || rch->pcdata->alias_sub[pos] == NULL) + break; + + if (!str_cmp(arg,rch->pcdata->alias[pos])) + { + sprintf(buf,"%s aliases to '%s'.\n\r",rch->pcdata->alias[pos], + rch->pcdata->alias_sub[pos]); + send_to_char(buf,ch); + return; + } + } + + send_to_char("That alias is not defined.\n\r",ch); + return; + } + + if (!str_prefix(argument,"delete") || !str_prefix(argument,"prefix")) + { + send_to_char("That shall not be done!\n\r",ch); + return; + } + + for (pos = 0; pos < MAX_ALIAS; pos++) + { + if (rch->pcdata->alias[pos] == NULL) + break; + + if (!str_cmp(arg,rch->pcdata->alias[pos])) /* redefine an alias */ + { + free_string(rch->pcdata->alias_sub[pos]); + rch->pcdata->alias_sub[pos] = str_dup(argument); + sprintf(buf,"%s is now realiased to '%s'.\n\r",arg,argument); + send_to_char(buf,ch); + return; + } + } + + if (pos >= MAX_ALIAS) + { + send_to_char("Sorry, you have reached the alias limit.\n\r",ch); + return; + } + + /* make a new alias */ + rch->pcdata->alias[pos] = str_dup(arg); + rch->pcdata->alias_sub[pos] = str_dup(argument); + sprintf(buf,"%s is now aliased to '%s'.\n\r",arg,argument); + send_to_char(buf,ch); +} + + +void do_unalias(CHAR_DATA *ch, char *argument) +{ + CHAR_DATA *rch; + char arg[MAX_INPUT_LENGTH]; + int pos; + bool found = FALSE; + + if (ch->desc == NULL) + rch = ch; + else + rch = ch->desc->original ? ch->desc->original : ch; + + if (IS_NPC(rch)) + return; + + argument = one_argument(argument,arg); + + if (arg[0] == '\0') + { + send_to_char("Unalias what?\n\r",ch); + return; + } + + for (pos = 0; pos < MAX_ALIAS; pos++) + { + if (rch->pcdata->alias[pos] == NULL) + break; + + if (found) + { + rch->pcdata->alias[pos-1] = rch->pcdata->alias[pos]; + rch->pcdata->alias_sub[pos-1] = rch->pcdata->alias_sub[pos]; + rch->pcdata->alias[pos] = NULL; + rch->pcdata->alias_sub[pos] = NULL; + continue; + } + + if(!strcmp(arg,rch->pcdata->alias[pos])) + { + send_to_char("Alias removed.\n\r",ch); + free_string(rch->pcdata->alias[pos]); + free_string(rch->pcdata->alias_sub[pos]); + rch->pcdata->alias[pos] = NULL; + rch->pcdata->alias_sub[pos] = NULL; + found = TRUE; + } + } + + if (!found) + send_to_char("No alias of that name to remove.\n\r",ch); +} + + + + + + + + + + + + + + + diff --git a/Rom24/src/ban.c b/Rom24/src/ban.c new file mode 100644 index 0000000..4656d10 --- /dev/null +++ b/Rom24/src/ban.c @@ -0,0 +1,309 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +#if defined(macintosh) +#include +#include +#else +#include +#include +#endif +#include +#include +#include +#include +#include "merc.h" +#include "recycle.h" + +BAN_DATA *ban_list; + +void save_bans(void) +{ + BAN_DATA *pban; + FILE *fp; + bool found = FALSE; + + fclose( fpReserve ); + if ( ( fp = fopen( BAN_FILE, "w" ) ) == NULL ) + { + perror( BAN_FILE ); + } + + for (pban = ban_list; pban != NULL; pban = pban->next) + { + if (IS_SET(pban->ban_flags,BAN_PERMANENT)) + { + found = TRUE; + fprintf(fp,"%-20s %-2d %s\n",pban->name,pban->level, + print_flags(pban->ban_flags)); + } + } + + fclose(fp); + fpReserve = fopen( NULL_FILE, "r" ); + if (!found) + unlink(BAN_FILE); +} + +void load_bans(void) +{ + FILE *fp; + BAN_DATA *ban_last; + + if ( ( fp = fopen( BAN_FILE, "r" ) ) == NULL ) + return; + + ban_last = NULL; + for ( ; ; ) + { + BAN_DATA *pban; + if ( feof(fp) ) + { + fclose( fp ); + return; + } + + pban = new_ban(); + + pban->name = str_dup(fread_word(fp)); + pban->level = fread_number(fp); + pban->ban_flags = fread_flag(fp); + fread_to_eol(fp); + + if (ban_list == NULL) + ban_list = pban; + else + ban_last->next = pban; + ban_last = pban; + } +} + +bool check_ban(char *site,int type) +{ + BAN_DATA *pban; + char host[MAX_STRING_LENGTH]; + + strcpy(host,capitalize(site)); + host[0] = LOWER(host[0]); + + for ( pban = ban_list; pban != NULL; pban = pban->next ) + { + if(!IS_SET(pban->ban_flags,type)) + continue; + + if (IS_SET(pban->ban_flags,BAN_PREFIX) + && IS_SET(pban->ban_flags,BAN_SUFFIX) + && strstr(pban->name,host) != NULL) + return TRUE; + + if (IS_SET(pban->ban_flags,BAN_PREFIX) + && !str_suffix(pban->name,host)) + return TRUE; + + if (IS_SET(pban->ban_flags,BAN_SUFFIX) + && !str_prefix(pban->name,host)) + return TRUE; + } + + return FALSE; +} + + +void ban_site(CHAR_DATA *ch, char *argument, bool fPerm) +{ + char buf[MAX_STRING_LENGTH],buf2[MAX_STRING_LENGTH]; + char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH]; + char *name; + BUFFER *buffer; + BAN_DATA *pban, *prev; + bool prefix = FALSE,suffix = FALSE; + int type; + + argument = one_argument(argument,arg1); + argument = one_argument(argument,arg2); + + if ( arg1[0] == '\0' ) + { + if (ban_list == NULL) + { + send_to_char("No sites banned at this time.\n\r",ch); + return; + } + buffer = new_buf(); + + add_buf(buffer,"Banned sites level type status\n\r"); + for (pban = ban_list;pban != NULL;pban = pban->next) + { + sprintf(buf2,"%s%s%s", + IS_SET(pban->ban_flags,BAN_PREFIX) ? "*" : "", + pban->name, + IS_SET(pban->ban_flags,BAN_SUFFIX) ? "*" : ""); + sprintf(buf,"%-12s %-3d %-7s %s\n\r", + buf2, pban->level, + IS_SET(pban->ban_flags,BAN_NEWBIES) ? "newbies" : + IS_SET(pban->ban_flags,BAN_PERMIT) ? "permit" : + IS_SET(pban->ban_flags,BAN_ALL) ? "all" : "", + IS_SET(pban->ban_flags,BAN_PERMANENT) ? "perm" : "temp"); + add_buf(buffer,buf); + } + + page_to_char( buf_string(buffer), ch ); + free_buf(buffer); + return; + } + + /* find out what type of ban */ + if (arg2[0] == '\0' || !str_prefix(arg2,"all")) + type = BAN_ALL; + else if (!str_prefix(arg2,"newbies")) + type = BAN_NEWBIES; + else if (!str_prefix(arg2,"permit")) + type = BAN_PERMIT; + else + { + send_to_char("Acceptable ban types are all, newbies, and permit.\n\r", + ch); + return; + } + + name = arg1; + + if (name[0] == '*') + { + prefix = TRUE; + name++; + } + + if (name[strlen(name) - 1] == '*') + { + suffix = TRUE; + name[strlen(name) - 1] = '\0'; + } + + if (strlen(name) == 0) + { + send_to_char("You have to ban SOMETHING.\n\r",ch); + return; + } + + prev = NULL; + for ( pban = ban_list; pban != NULL; prev = pban, pban = pban->next ) + { + if (!str_cmp(name,pban->name)) + { + if (pban->level > get_trust(ch)) + { + send_to_char( "That ban was set by a higher power.\n\r", ch ); + return; + } + else + { + if (prev == NULL) + ban_list = pban->next; + else + prev->next = pban->next; + free_ban(pban); + } + } + } + + pban = new_ban(); + pban->name = str_dup(name); + pban->level = get_trust(ch); + + /* set ban type */ + pban->ban_flags = type; + + if (prefix) + SET_BIT(pban->ban_flags,BAN_PREFIX); + if (suffix) + SET_BIT(pban->ban_flags,BAN_SUFFIX); + if (fPerm) + SET_BIT(pban->ban_flags,BAN_PERMANENT); + + pban->next = ban_list; + ban_list = pban; + save_bans(); + sprintf(buf,"%s has been banned.\n\r",pban->name); + send_to_char( buf, ch ); + return; +} + +void do_ban(CHAR_DATA *ch, char *argument) +{ + ban_site(ch,argument,FALSE); +} + +void do_permban(CHAR_DATA *ch, char *argument) +{ + ban_site(ch,argument,TRUE); +} + +void do_allow( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + char buf[MAX_STRING_LENGTH]; + BAN_DATA *prev; + BAN_DATA *curr; + + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + { + send_to_char( "Remove which site from the ban list?\n\r", ch ); + return; + } + + prev = NULL; + for ( curr = ban_list; curr != NULL; prev = curr, curr = curr->next ) + { + if ( !str_cmp( arg, curr->name ) ) + { + if (curr->level > get_trust(ch)) + { + send_to_char( + "You are not powerful enough to lift that ban.\n\r",ch); + return; + } + if ( prev == NULL ) + ban_list = ban_list->next; + else + prev->next = curr->next; + + free_ban(curr); + sprintf(buf,"Ban on %s lifted.\n\r",arg); + send_to_char( buf, ch ); + save_bans(); + return; + } + } + + send_to_char( "Site is not banned.\n\r", ch ); + return; +} + + diff --git a/Rom24/src/comm.c b/Rom24/src/comm.c new file mode 100644 index 0000000..3a60c68 --- /dev/null +++ b/Rom24/src/comm.c @@ -0,0 +1,2572 @@ +/*************************************************************************** + * 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. * + * * + * Thanks to abaddon for proof-reading our comm.c and pointing out bugs. * + * Any remaining bugs are, of course, our work, not his. :) * + * * + * 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 * +***************************************************************************/ + +/* + * This file contains all of the OS-dependent stuff: + * startup, signals, BSD sockets for tcp/ip, i/o, timing. + * + * The data flow for input is: + * Game_loop ---> Read_from_descriptor ---> Read + * Game_loop ---> Read_from_buffer + * + * The data flow for output is: + * Game_loop ---> Process_Output ---> Write_to_descriptor -> Write + * + * The OS-dependent functions are Read_from_descriptor and Write_to_descriptor. + * -- Furey 26 Jan 1993 + */ + +#if defined(macintosh) +#include +#else +#include +#include +#endif + +#include +#include +#include +#include +#include +#include + +#include "merc.h" +#include "interp.h" +#include "recycle.h" +#include "tables.h" + +/* + * Malloc debugging stuff. + */ +#if defined(sun) +#undef MALLOC_DEBUG +#endif + +#if defined(MALLOC_DEBUG) +#include +extern int malloc_debug args( ( int ) ); +extern int malloc_verify args( ( void ) ); +#endif + + + +/* + * Signal handling. + * Apollo has a problem with __attribute(atomic) in signal.h, + * I dance around it. + */ +#if defined(apollo) +#define __attribute(x) +#endif + +#if defined(unix) +#include +#endif + +#if defined(apollo) +#undef __attribute +#endif + + + +/* + * Socket and TCP/IP stuff. + */ +#if defined(macintosh) || defined(MSDOS) +const char echo_off_str [] = { '\0' }; +const char echo_on_str [] = { '\0' }; +const char go_ahead_str [] = { '\0' }; +#endif + +#if defined(unix) +#include +#include +#include +#include +#include "telnet.h" +const char echo_off_str [] = { IAC, WILL, TELOPT_ECHO, '\0' }; +const char echo_on_str [] = { IAC, WONT, TELOPT_ECHO, '\0' }; +const char go_ahead_str [] = { IAC, GA, '\0' }; +#endif + + + +/* + * OS-dependent declarations. + */ +#if defined(_AIX) +#include +int accept args( ( int s, struct sockaddr *addr, int *addrlen ) ); +int bind args( ( int s, struct sockaddr *name, int namelen ) ); +void bzero args( ( char *b, int length ) ); +int getpeername args( ( int s, struct sockaddr *name, int *namelen ) ); +int getsockname args( ( int s, struct sockaddr *name, int *namelen ) ); +int gettimeofday args( ( struct timeval *tp, struct timezone *tzp ) ); +int listen args( ( int s, int backlog ) ); +int setsockopt args( ( int s, int level, int optname, void *optval, + int optlen ) ); +int socket args( ( int domain, int type, int protocol ) ); +#endif + +#if defined(apollo) +#include +void bzero args( ( char *b, int length ) ); +#endif + +#if defined(__hpux) +int accept args( ( int s, void *addr, int *addrlen ) ); +int bind args( ( int s, const void *addr, int addrlen ) ); +void bzero args( ( char *b, int length ) ); +int getpeername args( ( int s, void *addr, int *addrlen ) ); +int getsockname args( ( int s, void *name, int *addrlen ) ); +int gettimeofday args( ( struct timeval *tp, struct timezone *tzp ) ); +int listen args( ( int s, int backlog ) ); +int setsockopt args( ( int s, int level, int optname, + const void *optval, int optlen ) ); +int socket args( ( int domain, int type, int protocol ) ); +#endif + +#if defined(interactive) +#include +#include +#endif + +#if defined(linux) +/* + Linux shouldn't need these. If you have a problem compiling, try + uncommenting these functions. +*/ +/* +int accept args( ( int s, struct sockaddr *addr, int *addrlen ) ); +int bind args( ( int s, struct sockaddr *name, int namelen ) ); +int getpeername args( ( int s, struct sockaddr *name, int *namelen ) ); +int getsockname args( ( int s, struct sockaddr *name, int *namelen ) ); +int listen args( ( int s, int backlog ) ); +*/ + +int close args( ( int fd ) ); +int gettimeofday args( ( struct timeval *tp, struct timezone *tzp ) ); +int read args( ( int fd, char *buf, int nbyte ) ); +int select args( ( int width, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, struct timeval *timeout ) ); +int socket args( ( int domain, int type, int protocol ) ); +int write args( ( int fd, char *buf, int nbyte ) ); +#endif + +#if defined(macintosh) +#include +#include +#include +struct timeval +{ + time_t tv_sec; + time_t tv_usec; +}; +#if !defined(isascii) +#define isascii(c) ( (c) < 0200 ) +#endif +static long theKeys [4]; + +int gettimeofday args( ( struct timeval *tp, void *tzp ) ); +#endif + +#if defined(MIPS_OS) +extern int errno; +#endif + +#if defined(MSDOS) +int gettimeofday args( ( struct timeval *tp, void *tzp ) ); +int kbhit args( ( void ) ); +#endif + +#if defined(NeXT) +int close args( ( int fd ) ); +int fcntl args( ( int fd, int cmd, int arg ) ); +#if !defined(htons) +u_short htons args( ( u_short hostshort ) ); +#endif +#if !defined(ntohl) +u_long ntohl args( ( u_long hostlong ) ); +#endif +int read args( ( int fd, char *buf, int nbyte ) ); +int select args( ( int width, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, struct timeval *timeout ) ); +int write args( ( int fd, char *buf, int nbyte ) ); +#endif + +#if defined(sequent) +int accept args( ( int s, struct sockaddr *addr, int *addrlen ) ); +int bind args( ( int s, struct sockaddr *name, int namelen ) ); +int close args( ( int fd ) ); +int fcntl args( ( int fd, int cmd, int arg ) ); +int getpeername args( ( int s, struct sockaddr *name, int *namelen ) ); +int getsockname args( ( int s, struct sockaddr *name, int *namelen ) ); +int gettimeofday args( ( struct timeval *tp, struct timezone *tzp ) ); +#if !defined(htons) +u_short htons args( ( u_short hostshort ) ); +#endif +int listen args( ( int s, int backlog ) ); +#if !defined(ntohl) +u_long ntohl args( ( u_long hostlong ) ); +#endif +int read args( ( int fd, char *buf, int nbyte ) ); +int select args( ( int width, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, struct timeval *timeout ) ); +int setsockopt args( ( int s, int level, int optname, caddr_t optval, + int optlen ) ); +int socket args( ( int domain, int type, int protocol ) ); +int write args( ( int fd, char *buf, int nbyte ) ); +#endif + +/* This includes Solaris Sys V as well */ +#if defined(sun) +int accept args( ( int s, struct sockaddr *addr, int *addrlen ) ); +int bind args( ( int s, struct sockaddr *name, int namelen ) ); +void bzero args( ( char *b, int length ) ); +int close args( ( int fd ) ); +int getpeername args( ( int s, struct sockaddr *name, int *namelen ) ); +int getsockname args( ( int s, struct sockaddr *name, int *namelen ) ); +int listen args( ( int s, int backlog ) ); +int read args( ( int fd, char *buf, int nbyte ) ); +int select args( ( int width, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, struct timeval *timeout ) ); + +#if !defined(__SVR4) +int gettimeofday args( ( struct timeval *tp, struct timezone *tzp ) ); + +#if defined(SYSV) +int setsockopt args( ( int s, int level, int optname, + const char *optval, int optlen ) ); +#else +int setsockopt args( ( int s, int level, int optname, void *optval, + int optlen ) ); +#endif +#endif +int socket args( ( int domain, int type, int protocol ) ); +int write args( ( int fd, char *buf, int nbyte ) ); +#endif + +#if defined(ultrix) +int accept args( ( int s, struct sockaddr *addr, int *addrlen ) ); +int bind args( ( int s, struct sockaddr *name, int namelen ) ); +void bzero args( ( char *b, int length ) ); +int close args( ( int fd ) ); +int getpeername args( ( int s, struct sockaddr *name, int *namelen ) ); +int getsockname args( ( int s, struct sockaddr *name, int *namelen ) ); +int gettimeofday args( ( struct timeval *tp, struct timezone *tzp ) ); +int listen args( ( int s, int backlog ) ); +int read args( ( int fd, char *buf, int nbyte ) ); +int select args( ( int width, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, struct timeval *timeout ) ); +int setsockopt args( ( int s, int level, int optname, void *optval, + int optlen ) ); +int socket args( ( int domain, int type, int protocol ) ); +int write args( ( int fd, char *buf, int nbyte ) ); +#endif + + + +/* + * Global variables. + */ +DESCRIPTOR_DATA * descriptor_list; /* All open descriptors */ +DESCRIPTOR_DATA * d_next; /* Next descriptor in loop */ +FILE * fpReserve; /* Reserved file handle */ +bool god; /* All new chars are gods! */ +bool merc_down; /* Shutdown */ +bool wizlock; /* Game is wizlocked */ +bool newlock; /* Game is newlocked */ +char str_boot_time[MAX_INPUT_LENGTH]; +time_t current_time; /* time of this pulse */ + + + +/* + * OS-dependent local functions. + */ +#if defined(macintosh) || defined(MSDOS) +void game_loop_mac_msdos args( ( void ) ); +bool read_from_descriptor args( ( DESCRIPTOR_DATA *d ) ); +bool write_to_descriptor args( ( int desc, char *txt, int length ) ); +#endif + +#if defined(unix) +void game_loop_unix args( ( int control ) ); +int init_socket args( ( int port ) ); +void init_descriptor args( ( int control ) ); +bool read_from_descriptor args( ( DESCRIPTOR_DATA *d ) ); +bool write_to_descriptor args( ( int desc, char *txt, int length ) ); +#endif + + + + +/* + * Other local functions (OS-independent). + */ +bool check_parse_name args( ( char *name ) ); +bool check_reconnect args( ( DESCRIPTOR_DATA *d, char *name, + bool fConn ) ); +bool check_playing args( ( DESCRIPTOR_DATA *d, char *name ) ); +int main args( ( int argc, char **argv ) ); +void nanny args( ( DESCRIPTOR_DATA *d, char *argument ) ); +bool process_output args( ( DESCRIPTOR_DATA *d, bool fPrompt ) ); +void read_from_buffer args( ( DESCRIPTOR_DATA *d ) ); +void stop_idling args( ( CHAR_DATA *ch ) ); +void bust_a_prompt args( ( CHAR_DATA *ch ) ); + + +int main( int argc, char **argv ) +{ + struct timeval now_time; + int port; + +#if defined(unix) + int control; +#endif + + /* + * Memory debugging if needed. + */ +#if defined(MALLOC_DEBUG) + malloc_debug( 2 ); +#endif + + /* + * Init time. + */ + gettimeofday( &now_time, NULL ); + current_time = (time_t) now_time.tv_sec; + strcpy( str_boot_time, ctime( ¤t_time ) ); + + /* + * Macintosh console initialization. + */ +#if defined(macintosh) + console_options.nrows = 31; + cshow( stdout ); + csetmode( C_RAW, stdin ); + cecho2file( "log file", 1, stderr ); +#endif + + /* + * Reserve one channel for our use. + */ + if ( ( fpReserve = fopen( NULL_FILE, "r" ) ) == NULL ) + { + perror( NULL_FILE ); + exit( 1 ); + } + + /* + * Get the port number. + */ + port = 4000; + if ( argc > 1 ) + { + if ( !is_number( argv[1] ) ) + { + fprintf( stderr, "Usage: %s [port #]\n", argv[0] ); + exit( 1 ); + } + else if ( ( port = atoi( argv[1] ) ) <= 1024 ) + { + fprintf( stderr, "Port number must be above 1024.\n" ); + exit( 1 ); + } + } + + /* + * Run the game. + */ +#if defined(macintosh) || defined(MSDOS) + boot_db( ); + log_string( "Merc is ready to rock." ); + game_loop_mac_msdos( ); +#endif + +#if defined(unix) + control = init_socket( port ); + boot_db( ); + sprintf( log_buf, "ROM is ready to rock on port %d.", port ); + log_string( log_buf ); + game_loop_unix( control ); + close (control); +#endif + + /* + * That's all, folks. + */ + log_string( "Normal termination of game." ); + exit( 0 ); + return 0; +} + + + +#if defined(unix) +int init_socket( int port ) +{ + static struct sockaddr_in sa_zero; + struct sockaddr_in sa; + int x = 1; + int fd; + + if ( ( fd = socket( AF_INET, SOCK_STREAM, 0 ) ) < 0 ) + { + perror( "Init_socket: socket" ); + exit( 1 ); + } + + if ( setsockopt( fd, SOL_SOCKET, SO_REUSEADDR, + (char *) &x, sizeof(x) ) < 0 ) + { + perror( "Init_socket: SO_REUSEADDR" ); + close(fd); + exit( 1 ); + } + +#if defined(SO_DONTLINGER) && !defined(SYSV) + { + struct linger ld; + + ld.l_onoff = 1; + ld.l_linger = 1000; + + if ( setsockopt( fd, SOL_SOCKET, SO_DONTLINGER, + (char *) &ld, sizeof(ld) ) < 0 ) + { + perror( "Init_socket: SO_DONTLINGER" ); + close(fd); + exit( 1 ); + } + } +#endif + + sa = sa_zero; + sa.sin_family = AF_INET; + sa.sin_port = htons( port ); + + if ( bind( fd, (struct sockaddr *) &sa, sizeof(sa) ) < 0 ) + { + perror("Init socket: bind" ); + close(fd); + exit(1); + } + + + if ( listen( fd, 3 ) < 0 ) + { + perror("Init socket: listen"); + close(fd); + exit(1); + } + + return fd; +} +#endif + + + +#if defined(macintosh) || defined(MSDOS) +void game_loop_mac_msdos( void ) +{ + struct timeval last_time; + struct timeval now_time; + static DESCRIPTOR_DATA dcon; + + gettimeofday( &last_time, NULL ); + current_time = (time_t) last_time.tv_sec; + + /* + * New_descriptor analogue. + */ + dcon.descriptor = 0; + dcon.connected = CON_GET_NAME; + dcon.host = str_dup( "localhost" ); + dcon.outsize = 2000; + dcon.outbuf = alloc_mem( dcon.outsize ); + dcon.next = descriptor_list; + dcon.showstr_head = NULL; + dcon.showstr_point = NULL; + descriptor_list = &dcon; + + /* + * Send the greeting. + */ + { + extern char * help_greeting; + if ( help_greeting[0] == '.' ) + write_to_buffer( &dcon, help_greeting+1, 0 ); + else + write_to_buffer( &dcon, help_greeting , 0 ); + } + + /* Main loop */ + while ( !merc_down ) + { + DESCRIPTOR_DATA *d; + + /* + * Process input. + */ + for ( d = descriptor_list; d != NULL; d = d_next ) + { + d_next = d->next; + d->fcommand = FALSE; + +#if defined(MSDOS) + if ( kbhit( ) ) +#endif + { + if ( d->character != NULL ) + d->character->timer = 0; + if ( !read_from_descriptor( d ) ) + { + if ( d->character != NULL && d->connected == CON_PLAYING) + save_char_obj( d->character ); + d->outtop = 0; + close_socket( d ); + continue; + } + } + + if (d->character != NULL && d->character->daze > 0) + --d->character->daze; + + if ( d->character != NULL && d->character->wait > 0 ) + { + --d->character->wait; + continue; + } + + read_from_buffer( d ); + if ( d->incomm[0] != '\0' ) + { + d->fcommand = TRUE; + stop_idling( d->character ); + + if ( d->connected == CON_PLAYING ) + substitute_alias( d, d->incomm ); + else + nanny( d, d->incomm ); + + d->incomm[0] = '\0'; + } + } + + + + /* + * Autonomous game motion. + */ + update_handler( ); + + + + /* + * Output. + */ + for ( d = descriptor_list; d != NULL; d = d_next ) + { + d_next = d->next; + + if ( ( d->fcommand || d->outtop > 0 ) ) + { + if ( !process_output( d, TRUE ) ) + { + if ( d->character != NULL && d->connected == CON_PLAYING) + save_char_obj( d->character ); + d->outtop = 0; + close_socket( d ); + } + } + } + + + + /* + * Synchronize to a clock. + * Busy wait (blargh). + */ + now_time = last_time; + for ( ; ; ) + { + int delta; + +#if defined(MSDOS) + if ( kbhit( ) ) +#endif + { + if ( dcon.character != NULL ) + dcon.character->timer = 0; + if ( !read_from_descriptor( &dcon ) ) + { + if ( dcon.character != NULL && d->connected == CON_PLAYING) + save_char_obj( d->character ); + dcon.outtop = 0; + close_socket( &dcon ); + } +#if defined(MSDOS) + break; +#endif + } + + gettimeofday( &now_time, NULL ); + delta = ( now_time.tv_sec - last_time.tv_sec ) * 1000 * 1000 + + ( now_time.tv_usec - last_time.tv_usec ); + if ( delta >= 1000000 / PULSE_PER_SECOND ) + break; + } + last_time = now_time; + current_time = (time_t) last_time.tv_sec; + } + + return; +} +#endif + + + +#if defined(unix) +void game_loop_unix( int control ) +{ + static struct timeval null_time; + struct timeval last_time; + + signal( SIGPIPE, SIG_IGN ); + gettimeofday( &last_time, NULL ); + current_time = (time_t) last_time.tv_sec; + + /* Main loop */ + while ( !merc_down ) + { + fd_set in_set; + fd_set out_set; + fd_set exc_set; + DESCRIPTOR_DATA *d; + int maxdesc; + +#if defined(MALLOC_DEBUG) + if ( malloc_verify( ) != 1 ) + abort( ); +#endif + + /* + * Poll all active descriptors. + */ + FD_ZERO( &in_set ); + FD_ZERO( &out_set ); + FD_ZERO( &exc_set ); + FD_SET( control, &in_set ); + maxdesc = control; + for ( d = descriptor_list; d; d = d->next ) + { + maxdesc = UMAX( maxdesc, d->descriptor ); + FD_SET( d->descriptor, &in_set ); + FD_SET( d->descriptor, &out_set ); + FD_SET( d->descriptor, &exc_set ); + } + + if ( select( maxdesc+1, &in_set, &out_set, &exc_set, &null_time ) < 0 ) + { + perror( "Game_loop: select: poll" ); + exit( 1 ); + } + + /* + * New connection? + */ + if ( FD_ISSET( control, &in_set ) ) + init_descriptor( control ); + + /* + * Kick out the freaky folks. + */ + for ( d = descriptor_list; d != NULL; d = d_next ) + { + d_next = d->next; + if ( FD_ISSET( d->descriptor, &exc_set ) ) + { + FD_CLR( d->descriptor, &in_set ); + FD_CLR( d->descriptor, &out_set ); + if ( d->character && d->connected == CON_PLAYING) + save_char_obj( d->character ); + d->outtop = 0; + close_socket( d ); + } + } + + /* + * Process input. + */ + for ( d = descriptor_list; d != NULL; d = d_next ) + { + d_next = d->next; + d->fcommand = FALSE; + + if ( FD_ISSET( d->descriptor, &in_set ) ) + { + if ( d->character != NULL ) + d->character->timer = 0; + if ( !read_from_descriptor( d ) ) + { + FD_CLR( d->descriptor, &out_set ); + if ( d->character != NULL && d->connected == CON_PLAYING) + save_char_obj( d->character ); + d->outtop = 0; + close_socket( d ); + continue; + } + } + + if (d->character != NULL && d->character->daze > 0) + --d->character->daze; + + if ( d->character != NULL && d->character->wait > 0 ) + { + --d->character->wait; + continue; + } + + read_from_buffer( d ); + if ( d->incomm[0] != '\0' ) + { + d->fcommand = TRUE; + stop_idling( d->character ); + + if (d->showstr_point) + show_string(d,d->incomm); + else if ( d->connected == CON_PLAYING ) + substitute_alias( d, d->incomm ); + else + nanny( d, d->incomm ); + + d->incomm[0] = '\0'; + } + } + + + + /* + * Autonomous game motion. + */ + update_handler( ); + + + + /* + * Output. + */ + for ( d = descriptor_list; d != NULL; d = d_next ) + { + d_next = d->next; + + if ( ( d->fcommand || d->outtop > 0 ) + && FD_ISSET(d->descriptor, &out_set) ) + { + if ( !process_output( d, TRUE ) ) + { + if ( d->character != NULL && d->connected == CON_PLAYING) + save_char_obj( d->character ); + d->outtop = 0; + close_socket( d ); + } + } + } + + + + /* + * Synchronize to a clock. + * Sleep( last_time + 1/PULSE_PER_SECOND - now ). + * Careful here of signed versus unsigned arithmetic. + */ + { + struct timeval now_time; + long secDelta; + long usecDelta; + + gettimeofday( &now_time, NULL ); + usecDelta = ((int) last_time.tv_usec) - ((int) now_time.tv_usec) + + 1000000 / PULSE_PER_SECOND; + secDelta = ((int) last_time.tv_sec ) - ((int) now_time.tv_sec ); + while ( usecDelta < 0 ) + { + usecDelta += 1000000; + secDelta -= 1; + } + + while ( usecDelta >= 1000000 ) + { + usecDelta -= 1000000; + secDelta += 1; + } + + if ( secDelta > 0 || ( secDelta == 0 && usecDelta > 0 ) ) + { + struct timeval stall_time; + + stall_time.tv_usec = usecDelta; + stall_time.tv_sec = secDelta; + if ( select( 0, NULL, NULL, NULL, &stall_time ) < 0 ) + { + perror( "Game_loop: select: stall" ); + exit( 1 ); + } + } + } + + gettimeofday( &last_time, NULL ); + current_time = (time_t) last_time.tv_sec; + } + + return; +} +#endif + + + +#if defined(unix) +void init_descriptor( int control ) +{ + char buf[MAX_STRING_LENGTH]; + DESCRIPTOR_DATA *dnew; + struct sockaddr_in sock; + struct hostent *from; + int desc; + socklen_t size; + + size = sizeof(sock); + getsockname( control, (struct sockaddr *) &sock, &size ); + if ( ( desc = accept( control, (struct sockaddr *) &sock, &size) ) < 0 ) + { + perror( "New_descriptor: accept" ); + return; + } + +#if !defined(FNDELAY) +#define FNDELAY O_NDELAY +#endif + + if ( fcntl( desc, F_SETFL, FNDELAY ) == -1 ) + { + perror( "New_descriptor: fcntl: FNDELAY" ); + return; + } + + /* + * Cons a new descriptor. + */ + dnew = new_descriptor(); + + dnew->descriptor = desc; + dnew->connected = CON_GET_NAME; + dnew->showstr_head = NULL; + dnew->showstr_point = NULL; + dnew->outsize = 2000; + dnew->outbuf = alloc_mem( dnew->outsize ); + + size = sizeof(sock); + if ( getpeername( desc, (struct sockaddr *) &sock, &size ) < 0 ) + { + perror( "New_descriptor: getpeername" ); + dnew->host = str_dup( "(unknown)" ); + } + else + { + /* + * Would be nice to use inet_ntoa here but it takes a struct arg, + * which ain't very compatible between gcc and system libraries. + */ + int addr; + + addr = ntohl( sock.sin_addr.s_addr ); + sprintf( buf, "%d.%d.%d.%d", + ( addr >> 24 ) & 0xFF, ( addr >> 16 ) & 0xFF, + ( addr >> 8 ) & 0xFF, ( addr ) & 0xFF + ); + sprintf( log_buf, "Sock.sinaddr: %s", buf ); + log_string( log_buf ); + from = gethostbyaddr( (char *) &sock.sin_addr, + sizeof(sock.sin_addr), AF_INET ); + dnew->host = str_dup( from ? from->h_name : buf ); + } + + /* + * Swiftest: I added the following to ban sites. I don't + * endorse banning of sites, but Copper has few descriptors now + * and some people from certain sites keep abusing access by + * using automated 'autodialers' and leaving connections hanging. + * + * Furey: added suffix check by request of Nickel of HiddenWorlds. + */ + if ( check_ban(dnew->host,BAN_ALL)) + { + write_to_descriptor( desc, + "Your site has been banned from this mud.\n\r", 0 ); + close( desc ); + free_descriptor(dnew); + return; + } + /* + * Init descriptor data. + */ + dnew->next = descriptor_list; + descriptor_list = dnew; + + /* + * Send the greeting. + */ + { + extern char * help_greeting; + if ( help_greeting[0] == '.' ) + write_to_buffer( dnew, help_greeting+1, 0 ); + else + write_to_buffer( dnew, help_greeting , 0 ); + } + + return; +} +#endif + + + +void close_socket( DESCRIPTOR_DATA *dclose ) +{ + CHAR_DATA *ch; + + if ( dclose->outtop > 0 ) + process_output( dclose, FALSE ); + + if ( dclose->snoop_by != NULL ) + { + write_to_buffer( dclose->snoop_by, + "Your victim has left the game.\n\r", 0 ); + } + + { + DESCRIPTOR_DATA *d; + + for ( d = descriptor_list; d != NULL; d = d->next ) + { + if ( d->snoop_by == dclose ) + d->snoop_by = NULL; + } + } + + if ( ( ch = dclose->character ) != NULL ) + { + sprintf( log_buf, "Closing link to %s.", ch->name ); + log_string( log_buf ); + /* cut down on wiznet spam when rebooting */ + if ( dclose->connected == CON_PLAYING && !merc_down) + { + act( "$n has lost $s link.", ch, NULL, NULL, TO_ROOM ); + wiznet("Net death has claimed $N.",ch,NULL,WIZ_LINKS,0,0); + ch->desc = NULL; + } + else + { + free_char(dclose->original ? dclose->original : + dclose->character ); + } + } + + if ( d_next == dclose ) + d_next = d_next->next; + + if ( dclose == descriptor_list ) + { + descriptor_list = descriptor_list->next; + } + else + { + DESCRIPTOR_DATA *d; + + for ( d = descriptor_list; d && d->next != dclose; d = d->next ) + ; + if ( d != NULL ) + d->next = dclose->next; + else + bug( "Close_socket: dclose not found.", 0 ); + } + + close( dclose->descriptor ); + free_descriptor(dclose); +#if defined(MSDOS) || defined(macintosh) + exit(1); +#endif + return; +} + + + +bool read_from_descriptor( DESCRIPTOR_DATA *d ) +{ + int iStart; + + /* Hold horses if pending command already. */ + if ( d->incomm[0] != '\0' ) + return TRUE; + + /* Check for overflow. */ + iStart = strlen(d->inbuf); + if ( iStart >= sizeof(d->inbuf) - 10 ) + { + sprintf( log_buf, "%s input overflow!", d->host ); + log_string( log_buf ); + write_to_descriptor( d->descriptor, + "\n\r*** PUT A LID ON IT!!! ***\n\r", 0 ); + return FALSE; + } + + /* Snarf input. */ +#if defined(macintosh) + for ( ; ; ) + { + int c; + c = getc( stdin ); + if ( c == '\0' || c == EOF ) + break; + putc( c, stdout ); + if ( c == '\r' ) + putc( '\n', stdout ); + d->inbuf[iStart++] = c; + if ( iStart > sizeof(d->inbuf) - 10 ) + break; + } +#endif + +#if defined(MSDOS) || defined(unix) + for ( ; ; ) + { + int nRead; + + nRead = read( d->descriptor, d->inbuf + iStart, + sizeof(d->inbuf) - 10 - iStart ); + if ( nRead > 0 ) + { + iStart += nRead; + if ( d->inbuf[iStart-1] == '\n' || d->inbuf[iStart-1] == '\r' ) + break; + } + else if ( nRead == 0 ) + { + log_string( "EOF encountered on read." ); + return FALSE; + } + else if ( errno == EWOULDBLOCK ) + break; + else + { + perror( "Read_from_descriptor" ); + return FALSE; + } + } +#endif + + d->inbuf[iStart] = '\0'; + return TRUE; +} + + + +/* + * Transfer one line from input buffer to input line. + */ +void read_from_buffer( DESCRIPTOR_DATA *d ) +{ + int i, j, k; + + /* + * Hold horses if pending command already. + */ + if ( d->incomm[0] != '\0' ) + return; + + /* + * Look for at least one new line. + */ + for ( i = 0; d->inbuf[i] != '\n' && d->inbuf[i] != '\r'; i++ ) + { + if ( d->inbuf[i] == '\0' ) + return; + } + + /* + * Canonical input processing. + */ + for ( i = 0, k = 0; d->inbuf[i] != '\n' && d->inbuf[i] != '\r'; i++ ) + { + if ( k >= MAX_INPUT_LENGTH - 2 ) + { + write_to_descriptor( d->descriptor, "Line too long.\n\r", 0 ); + + /* skip the rest of the line */ + for ( ; d->inbuf[i] != '\0'; i++ ) + { + if ( d->inbuf[i] == '\n' || d->inbuf[i] == '\r' ) + break; + } + d->inbuf[i] = '\n'; + d->inbuf[i+1] = '\0'; + break; + } + + if ( d->inbuf[i] == '\b' && k > 0 ) + --k; + else if ( isascii(d->inbuf[i]) && isprint(d->inbuf[i]) ) + d->incomm[k++] = d->inbuf[i]; + } + + /* + * Finish off the line. + */ + if ( k == 0 ) + d->incomm[k++] = ' '; + d->incomm[k] = '\0'; + + /* + * Deal with bozos with #repeat 1000 ... + */ + + if ( k > 1 || d->incomm[0] == '!' ) + { + if ( d->incomm[0] != '!' && strcmp( d->incomm, d->inlast ) ) + { + d->repeat = 0; + } + else + { + if (++d->repeat >= 25 && d->character + && d->connected == CON_PLAYING) + { + sprintf( log_buf, "%s input spamming!", d->host ); + log_string( log_buf ); + wiznet("Spam spam spam $N spam spam spam spam spam!", + d->character,NULL,WIZ_SPAM,0,get_trust(d->character)); + if (d->incomm[0] == '!') + wiznet(d->inlast,d->character,NULL,WIZ_SPAM,0, + get_trust(d->character)); + else + wiznet(d->incomm,d->character,NULL,WIZ_SPAM,0, + get_trust(d->character)); + + d->repeat = 0; +/* + write_to_descriptor( d->descriptor, + "\n\r*** PUT A LID ON IT!!! ***\n\r", 0 ); + strcpy( d->incomm, "quit" ); +*/ + } + } + } + + + /* + * Do '!' substitution. + */ + if ( d->incomm[0] == '!' ) + strcpy( d->incomm, d->inlast ); + else + strcpy( d->inlast, d->incomm ); + + /* + * Shift the input buffer. + */ + while ( d->inbuf[i] == '\n' || d->inbuf[i] == '\r' ) + i++; + for ( j = 0; ( d->inbuf[j] = d->inbuf[i+j] ) != '\0'; j++ ) + ; + return; +} + + + +/* + * Low level output function. + */ +bool process_output( DESCRIPTOR_DATA *d, bool fPrompt ) +{ + extern bool merc_down; + + /* + * Bust a prompt. + */ + if (!merc_down && d->showstr_point) + write_to_buffer(d,"[Hit Return to continue]\n\r",0); + else if (fPrompt && !merc_down && d->connected == CON_PLAYING) + { + CHAR_DATA *ch; + CHAR_DATA *victim; + + ch = d->character; + + /* battle prompt */ + if ((victim = ch->fighting) != NULL && can_see(ch,victim)) + { + int percent; + char wound[100]; + char buf[MAX_STRING_LENGTH]; + + if (victim->max_hit > 0) + percent = victim->hit * 100 / victim->max_hit; + else + percent = -1; + + if (percent >= 100) + sprintf(wound,"is in excellent condition."); + else if (percent >= 90) + sprintf(wound,"has a few scratches."); + else if (percent >= 75) + sprintf(wound,"has some small wounds and bruises."); + else if (percent >= 50) + sprintf(wound,"has quite a few wounds."); + else if (percent >= 30) + sprintf(wound,"has some big nasty wounds and scratches."); + else if (percent >= 15) + sprintf(wound,"looks pretty hurt."); + else if (percent >= 0) + sprintf(wound,"is in awful condition."); + else + sprintf(wound,"is bleeding to death."); + + sprintf(buf,"%s %s \n\r", + IS_NPC(victim) ? victim->short_descr : victim->name,wound); + buf[0] = UPPER(buf[0]); + write_to_buffer( d, buf, 0); + } + + + ch = d->original ? d->original : d->character; + if (!IS_SET(ch->comm, COMM_COMPACT) ) + write_to_buffer( d, "\n\r", 2 ); + + + if ( IS_SET(ch->comm, COMM_PROMPT) ) + bust_a_prompt( d->character ); + + if (IS_SET(ch->comm,COMM_TELNET_GA)) + write_to_buffer(d,go_ahead_str,0); + } + + /* + * Short-circuit if nothing to write. + */ + if ( d->outtop == 0 ) + return TRUE; + + /* + * Snoop-o-rama. + */ + if ( d->snoop_by != NULL ) + { + if (d->character != NULL) + write_to_buffer( d->snoop_by, d->character->name,0); + write_to_buffer( d->snoop_by, "> ", 2 ); + write_to_buffer( d->snoop_by, d->outbuf, d->outtop ); + } + + /* + * OS-dependent output. + */ + if ( !write_to_descriptor( d->descriptor, d->outbuf, d->outtop ) ) + { + d->outtop = 0; + return FALSE; + } + else + { + d->outtop = 0; + return TRUE; + } +} + +/* + * Bust a prompt (player settable prompt) + * coded by Morgenes for Aldara Mud + */ +void bust_a_prompt( CHAR_DATA *ch ) +{ + char buf[MAX_STRING_LENGTH]; + char buf2[MAX_STRING_LENGTH]; + const char *str; + const char *i; + char *point; + char doors[MAX_INPUT_LENGTH]; + EXIT_DATA *pexit; + bool found; + const char *dir_name[] = {"N","E","S","W","U","D"}; + int door; + + point = buf; + str = ch->prompt; + if (str == NULL || str[0] == '\0') + { + sprintf( buf, "<%dhp %dm %dmv> %s", + ch->hit,ch->mana,ch->move,ch->prefix); + send_to_char(buf,ch); + return; + } + + if (IS_SET(ch->comm,COMM_AFK)) + { + send_to_char(" ",ch); + return; + } + + while( *str != '\0' ) + { + if( *str != '%' ) + { + *point++ = *str++; + continue; + } + ++str; + switch( *str ) + { + default : + i = " "; break; + case 'e': + found = FALSE; + doors[0] = '\0'; + for (door = 0; door < 6; door++) + { + if ((pexit = ch->in_room->exit[door]) != NULL + && pexit ->u1.to_room != NULL + && (can_see_room(ch,pexit->u1.to_room) + || (IS_AFFECTED(ch,AFF_INFRARED) + && !IS_AFFECTED(ch,AFF_BLIND))) + && !IS_SET(pexit->exit_info,EX_CLOSED)) + { + found = TRUE; + strcat(doors,dir_name[door]); + } + } + if (!found) + strcat(buf,"none"); + sprintf(buf2,"%s",doors); + i = buf2; break; + case 'c' : + sprintf(buf2,"%s","\n\r"); + i = buf2; break; + case 'h' : + sprintf( buf2, "%d", ch->hit ); + i = buf2; break; + case 'H' : + sprintf( buf2, "%d", ch->max_hit ); + i = buf2; break; + case 'm' : + sprintf( buf2, "%d", ch->mana ); + i = buf2; break; + case 'M' : + sprintf( buf2, "%d", ch->max_mana ); + i = buf2; break; + case 'v' : + sprintf( buf2, "%d", ch->move ); + i = buf2; break; + case 'V' : + sprintf( buf2, "%d", ch->max_move ); + i = buf2; break; + case 'x' : + sprintf( buf2, "%d", ch->exp ); + i = buf2; break; + case 'X' : + sprintf(buf2, "%d", IS_NPC(ch) ? 0 : + (ch->level + 1) * exp_per_level(ch,ch->pcdata->points) - ch->exp); + i = buf2; break; + case 'g' : + sprintf( buf2, "%ld", ch->gold); + i = buf2; break; + case 's' : + sprintf( buf2, "%ld", ch->silver); + i = buf2; break; + case 'a' : + if( ch->level > 9 ) + sprintf( buf2, "%d", ch->alignment ); + else + sprintf( buf2, "%s", IS_GOOD(ch) ? "good" : IS_EVIL(ch) ? + "evil" : "neutral" ); + i = buf2; break; + case 'r' : + if( ch->in_room != NULL ) + sprintf( buf2, "%s", + ((!IS_NPC(ch) && IS_SET(ch->act,PLR_HOLYLIGHT)) || + (!IS_AFFECTED(ch,AFF_BLIND) && !room_is_dark( ch->in_room ))) + ? ch->in_room->name : "darkness"); + else + sprintf( buf2, " " ); + i = buf2; break; + case 'R' : + if( IS_IMMORTAL( ch ) && ch->in_room != NULL ) + sprintf( buf2, "%d", ch->in_room->vnum ); + else + sprintf( buf2, " " ); + i = buf2; break; + case 'z' : + if( IS_IMMORTAL( ch ) && ch->in_room != NULL ) + sprintf( buf2, "%s", ch->in_room->area->name ); + else + sprintf( buf2, " " ); + i = buf2; break; + case '%' : + sprintf( buf2, "%%" ); + i = buf2; break; + } + ++str; + while( (*point = *i) != '\0' ) + ++point, ++i; + } + write_to_buffer( ch->desc, buf, point - buf ); + + if (ch->prefix[0] != '\0') + write_to_buffer(ch->desc,ch->prefix,0); + return; +} + + + +/* + * Append onto an output buffer. + */ +void write_to_buffer( DESCRIPTOR_DATA *d, const char *txt, int length ) +{ + /* + * Find length in case caller didn't. + */ + if ( length <= 0 ) + length = strlen(txt); + + /* + * Initial \n\r if needed. + */ + if ( d->outtop == 0 && !d->fcommand ) + { + d->outbuf[0] = '\n'; + d->outbuf[1] = '\r'; + d->outtop = 2; + } + + /* + * Expand the buffer as needed. + */ + while ( d->outtop + length >= d->outsize ) + { + char *outbuf; + + if (d->outsize >= 32000) + { + bug("Buffer overflow. Closing.\n\r",0); + close_socket(d); + return; + } + outbuf = alloc_mem( 2 * d->outsize ); + strncpy( outbuf, d->outbuf, d->outtop ); + free_mem( d->outbuf, d->outsize ); + d->outbuf = outbuf; + d->outsize *= 2; + } + + /* + * Copy. + */ + strncpy( d->outbuf + d->outtop, txt, length ); + d->outtop += length; + return; +} + + + +/* + * Lowest level output function. + * Write a block of text to the file descriptor. + * If this gives errors on very long blocks (like 'ofind all'), + * try lowering the max block size. + */ +bool write_to_descriptor( int desc, char *txt, int length ) +{ + int iStart; + int nWrite; + int nBlock; + +#if defined(macintosh) || defined(MSDOS) + if ( desc == 0 ) + desc = 1; +#endif + + if ( length <= 0 ) + length = strlen(txt); + + for ( iStart = 0; iStart < length; iStart += nWrite ) + { + nBlock = UMIN( length - iStart, 4096 ); + if ( ( nWrite = write( desc, txt + iStart, nBlock ) ) < 0 ) + { perror( "Write_to_descriptor" ); return FALSE; } + } + + return TRUE; +} + + + +/* + * Deal with sockets that haven't logged in yet. + */ +void nanny( DESCRIPTOR_DATA *d, char *argument ) +{ + DESCRIPTOR_DATA *d_old, *d_next; + char buf[MAX_STRING_LENGTH]; + char arg[MAX_INPUT_LENGTH]; + CHAR_DATA *ch; + char *pwdnew; + char *p; + int iClass,race,i,weapon; + bool fOld; + + while ( isspace(*argument) ) + argument++; + + ch = d->character; + + switch ( d->connected ) + { + + default: + bug( "Nanny: bad d->connected %d.", d->connected ); + close_socket( d ); + return; + + case CON_GET_NAME: + if ( argument[0] == '\0' ) + { + close_socket( d ); + return; + } + + argument[0] = UPPER(argument[0]); + if ( !check_parse_name( argument ) ) + { + write_to_buffer( d, "Illegal name, try another.\n\rName: ", 0 ); + return; + } + + fOld = load_char_obj( d, argument ); + ch = d->character; + + if (IS_SET(ch->act, PLR_DENY)) + { + sprintf( log_buf, "Denying access to %s@%s.", argument, d->host ); + log_string( log_buf ); + write_to_buffer( d, "You are denied access.\n\r", 0 ); + close_socket( d ); + return; + } + + if (check_ban(d->host,BAN_PERMIT) && !IS_SET(ch->act,PLR_PERMIT)) + { + write_to_buffer(d,"Your site has been banned from this mud.\n\r",0); + close_socket(d); + return; + } + + if ( check_reconnect( d, argument, FALSE ) ) + { + fOld = TRUE; + } + else + { + if ( wizlock && !IS_IMMORTAL(ch)) + { + write_to_buffer( d, "The game is wizlocked.\n\r", 0 ); + close_socket( d ); + return; + } + } + + if ( fOld ) + { + /* Old player */ + write_to_buffer( d, "Password: ", 0 ); + write_to_buffer( d, echo_off_str, 0 ); + d->connected = CON_GET_OLD_PASSWORD; + return; + } + else + { + /* New player */ + if (newlock) + { + write_to_buffer( d, "The game is newlocked.\n\r", 0 ); + close_socket( d ); + return; + } + + if (check_ban(d->host,BAN_NEWBIES)) + { + write_to_buffer(d, + "New players are not allowed from your site.\n\r",0); + close_socket(d); + return; + } + + sprintf( buf, "Did I get that right, %s (Y/N)? ", argument ); + write_to_buffer( d, buf, 0 ); + d->connected = CON_CONFIRM_NEW_NAME; + return; + } + break; + + case CON_GET_OLD_PASSWORD: +#if defined(unix) + write_to_buffer( d, "\n\r", 2 ); +#endif + + if ( strcmp( crypt( argument, ch->pcdata->pwd ), ch->pcdata->pwd )) + { + write_to_buffer( d, "Wrong password.\n\r", 0 ); + close_socket( d ); + return; + } + + write_to_buffer( d, echo_on_str, 0 ); + + if (check_playing(d,ch->name)) + return; + + if ( check_reconnect( d, ch->name, TRUE ) ) + return; + + sprintf( log_buf, "%s@%s has connected.", ch->name, d->host ); + log_string( log_buf ); + wiznet(log_buf,NULL,NULL,WIZ_SITES,0,get_trust(ch)); + + if ( IS_IMMORTAL(ch) ) + { + do_function(ch, &do_help, "imotd" ); + d->connected = CON_READ_IMOTD; + } + else + { + do_function(ch, &do_help, "motd" ); + d->connected = CON_READ_MOTD; + } + break; + +/* RT code for breaking link */ + + case CON_BREAK_CONNECT: + switch( *argument ) + { + case 'y' : case 'Y': + for ( d_old = descriptor_list; d_old != NULL; d_old = d_next ) + { + d_next = d_old->next; + if (d_old == d || d_old->character == NULL) + continue; + + if (str_cmp(ch->name,d_old->original ? + d_old->original->name : d_old->character->name)) + continue; + + close_socket(d_old); + } + if (check_reconnect(d,ch->name,TRUE)) + return; + write_to_buffer(d,"Reconnect attempt failed.\n\rName: ",0); + if ( d->character != NULL ) + { + free_char( d->character ); + d->character = NULL; + } + d->connected = CON_GET_NAME; + break; + + case 'n' : case 'N': + write_to_buffer(d,"Name: ",0); + if ( d->character != NULL ) + { + free_char( d->character ); + d->character = NULL; + } + d->connected = CON_GET_NAME; + break; + + default: + write_to_buffer(d,"Please type Y or N? ",0); + break; + } + break; + + case CON_CONFIRM_NEW_NAME: + switch ( *argument ) + { + case 'y': case 'Y': + sprintf( buf, "New character.\n\rGive me a password for %s: %s", + ch->name, echo_off_str ); + write_to_buffer( d, buf, 0 ); + d->connected = CON_GET_NEW_PASSWORD; + break; + + case 'n': case 'N': + write_to_buffer( d, "Ok, what IS it, then? ", 0 ); + free_char( d->character ); + d->character = NULL; + d->connected = CON_GET_NAME; + break; + + default: + write_to_buffer( d, "Please type Yes or No? ", 0 ); + break; + } + break; + + case CON_GET_NEW_PASSWORD: +#if defined(unix) + write_to_buffer( d, "\n\r", 2 ); +#endif + + if ( strlen(argument) < 5 ) + { + write_to_buffer( d, + "Password must be at least five characters long.\n\rPassword: ", + 0 ); + return; + } + + pwdnew = crypt( argument, ch->name ); + for ( p = pwdnew; *p != '\0'; p++ ) + { + if ( *p == '~' ) + { + write_to_buffer( d, + "New password not acceptable, try again.\n\rPassword: ", + 0 ); + return; + } + } + + free_string( ch->pcdata->pwd ); + ch->pcdata->pwd = str_dup( pwdnew ); + write_to_buffer( d, "Please retype password: ", 0 ); + d->connected = CON_CONFIRM_NEW_PASSWORD; + break; + + case CON_CONFIRM_NEW_PASSWORD: +#if defined(unix) + write_to_buffer( d, "\n\r", 2 ); +#endif + + if ( strcmp( crypt( argument, ch->pcdata->pwd ), ch->pcdata->pwd ) ) + { + write_to_buffer( d, "Passwords don't match.\n\rRetype password: ", + 0 ); + d->connected = CON_GET_NEW_PASSWORD; + return; + } + + write_to_buffer( d, echo_on_str, 0 ); + write_to_buffer(d,"The following races are available:\n\r ",0); + for ( race = 1; race_table[race].name != NULL; race++ ) + { + if (!race_table[race].pc_race) + break; + write_to_buffer(d,race_table[race].name,0); + write_to_buffer(d," ",1); + } + write_to_buffer(d,"\n\r",0); + write_to_buffer(d,"What is your race (help for more information)? ",0); + d->connected = CON_GET_NEW_RACE; + break; + + case CON_GET_NEW_RACE: + one_argument(argument,arg); + + if (!strcmp(arg,"help")) + { + argument = one_argument(argument,arg); + if (argument[0] == '\0') + do_function(ch, &do_help, "race help"); + else + do_function(ch, &do_help, argument); + write_to_buffer(d, + "What is your race (help for more information)? ",0); + break; + } + + race = race_lookup(argument); + + if (race == 0 || !race_table[race].pc_race) + { + write_to_buffer(d,"That is not a valid race.\n\r",0); + write_to_buffer(d,"The following races are available:\n\r ",0); + for ( race = 1; race_table[race].name != NULL; race++ ) + { + if (!race_table[race].pc_race) + break; + write_to_buffer(d,race_table[race].name,0); + write_to_buffer(d," ",1); + } + write_to_buffer(d,"\n\r",0); + write_to_buffer(d, + "What is your race? (help for more information) ",0); + break; + } + + ch->race = race; + /* initialize stats */ + for (i = 0; i < MAX_STATS; i++) + ch->perm_stat[i] = pc_race_table[race].stats[i]; + ch->affected_by = ch->affected_by|race_table[race].aff; + ch->imm_flags = ch->imm_flags|race_table[race].imm; + ch->res_flags = ch->res_flags|race_table[race].res; + ch->vuln_flags = ch->vuln_flags|race_table[race].vuln; + ch->form = race_table[race].form; + ch->parts = race_table[race].parts; + + /* add skills */ + for (i = 0; i < 5; i++) + { + if (pc_race_table[race].skills[i] == NULL) + break; + group_add(ch,pc_race_table[race].skills[i],FALSE); + } + /* add cost */ + ch->pcdata->points = pc_race_table[race].points; + ch->size = pc_race_table[race].size; + + write_to_buffer( d, "What is your sex (M/F)? ", 0 ); + d->connected = CON_GET_NEW_SEX; + break; + + + case CON_GET_NEW_SEX: + switch ( argument[0] ) + { + case 'm': case 'M': ch->sex = SEX_MALE; + ch->pcdata->true_sex = SEX_MALE; + break; + case 'f': case 'F': ch->sex = SEX_FEMALE; + ch->pcdata->true_sex = SEX_FEMALE; + break; + default: + write_to_buffer( d, "That's not a sex.\n\rWhat IS your sex? ", 0 ); + return; + } + + strcpy( buf, "Select a class [" ); + for ( iClass = 0; iClass < MAX_CLASS; iClass++ ) + { + if ( iClass > 0 ) + strcat( buf, " " ); + strcat( buf, class_table[iClass].name ); + } + strcat( buf, "]: " ); + write_to_buffer( d, buf, 0 ); + d->connected = CON_GET_NEW_CLASS; + break; + + case CON_GET_NEW_CLASS: + iClass = class_lookup(argument); + + if ( iClass == -1 ) + { + write_to_buffer( d, + "That's not a class.\n\rWhat IS your class? ", 0 ); + return; + } + + ch->class = iClass; + + sprintf( log_buf, "%s@%s new player.", ch->name, d->host ); + log_string( log_buf ); + wiznet("Newbie alert! $N sighted.",ch,NULL,WIZ_NEWBIE,0,0); + wiznet(log_buf,NULL,NULL,WIZ_SITES,0,get_trust(ch)); + + write_to_buffer( d, "\n\r", 2 ); + write_to_buffer( d, "You may be good, neutral, or evil.\n\r",0); + write_to_buffer( d, "Which alignment (G/N/E)? ",0); + d->connected = CON_GET_ALIGNMENT; + break; + +case CON_GET_ALIGNMENT: + switch( argument[0]) + { + case 'g' : case 'G' : ch->alignment = 750; break; + case 'n' : case 'N' : ch->alignment = 0; break; + case 'e' : case 'E' : ch->alignment = -750; break; + default: + write_to_buffer(d,"That's not a valid alignment.\n\r",0); + write_to_buffer(d,"Which alignment (G/N/E)? ",0); + return; + } + + write_to_buffer(d,"\n\r",0); + + group_add(ch,"rom basics",FALSE); + group_add(ch,class_table[ch->class].base_group,FALSE); + ch->pcdata->learned[gsn_recall] = 50; + write_to_buffer(d,"Do you wish to customize this character?\n\r",0); + write_to_buffer(d,"Customization takes time, but allows a wider range of skills and abilities.\n\r",0); + write_to_buffer(d,"Customize (Y/N)? ",0); + d->connected = CON_DEFAULT_CHOICE; + break; + +case CON_DEFAULT_CHOICE: + write_to_buffer(d,"\n\r",2); + switch ( argument[0] ) + { + case 'y': case 'Y': + ch->gen_data = new_gen_data(); + ch->gen_data->points_chosen = ch->pcdata->points; + do_function(ch, &do_help, "group header"); + list_group_costs(ch); + write_to_buffer(d,"You already have the following skills:\n\r",0); + do_function(ch, &do_skills, ""); + do_function(ch, &do_help, "menu choice"); + d->connected = CON_GEN_GROUPS; + break; + case 'n': case 'N': + group_add(ch,class_table[ch->class].default_group,TRUE); + write_to_buffer( d, "\n\r", 2 ); + write_to_buffer(d, + "Please pick a weapon from the following choices:\n\r",0); + buf[0] = '\0'; + for ( i = 0; weapon_table[i].name != NULL; i++) + if (ch->pcdata->learned[*weapon_table[i].gsn] > 0) + { + strcat(buf,weapon_table[i].name); + strcat(buf," "); + } + strcat(buf,"\n\rYour choice? "); + write_to_buffer(d,buf,0); + d->connected = CON_PICK_WEAPON; + break; + default: + write_to_buffer( d, "Please answer (Y/N)? ", 0 ); + return; + } + break; + + case CON_PICK_WEAPON: + write_to_buffer(d,"\n\r",2); + weapon = weapon_lookup(argument); + if (weapon == -1 || ch->pcdata->learned[*weapon_table[weapon].gsn] <= 0) + { + write_to_buffer(d, + "That's not a valid selection. Choices are:\n\r",0); + buf[0] = '\0'; + for ( i = 0; weapon_table[i].name != NULL; i++) + if (ch->pcdata->learned[*weapon_table[i].gsn] > 0) + { + strcat(buf,weapon_table[i].name); + strcat(buf," "); + } + strcat(buf,"\n\rYour choice? "); + write_to_buffer(d,buf,0); + return; + } + + ch->pcdata->learned[*weapon_table[weapon].gsn] = 40; + write_to_buffer(d,"\n\r",2); + do_function(ch, &do_help, "motd"); + d->connected = CON_READ_MOTD; + break; + + case CON_GEN_GROUPS: + send_to_char("\n\r",ch); + + if (!str_cmp(argument,"done")) + { + if (ch->pcdata->points == pc_race_table[ch->race].points) + { + send_to_char("You didn't pick anything.\n\r",ch); + break; + } + + if (ch->pcdata->points <= 40 + pc_race_table[ch->race].points) + { + sprintf(buf, + "You must take at least %d points of skills and groups", + 40 + pc_race_table[ch->race].points); + send_to_char(buf, ch); + break; + } + + sprintf(buf,"Creation points: %d\n\r",ch->pcdata->points); + send_to_char(buf,ch); + sprintf(buf,"Experience per level: %d\n\r", + exp_per_level(ch,ch->gen_data->points_chosen)); + if (ch->pcdata->points < 40) + ch->train = (40 - ch->pcdata->points + 1) / 2; + free_gen_data(ch->gen_data); + ch->gen_data = NULL; + send_to_char(buf,ch); + write_to_buffer( d, "\n\r", 2 ); + write_to_buffer(d, + "Please pick a weapon from the following choices:\n\r",0); + buf[0] = '\0'; + for ( i = 0; weapon_table[i].name != NULL; i++) + if (ch->pcdata->learned[*weapon_table[i].gsn] > 0) + { + strcat(buf,weapon_table[i].name); + strcat(buf," "); + } + strcat(buf,"\n\rYour choice? "); + write_to_buffer(d,buf,0); + d->connected = CON_PICK_WEAPON; + break; + } + + if (!parse_gen_groups(ch,argument)) + send_to_char( + "Choices are: list,learned,premise,add,drop,info,help, and done.\n\r" + ,ch); + + do_function(ch, &do_help, "menu choice"); + break; + + case CON_READ_IMOTD: + write_to_buffer(d,"\n\r",2); + do_function(ch, &do_help, "motd"); + d->connected = CON_READ_MOTD; + break; + + case CON_READ_MOTD: + if ( ch->pcdata == NULL || ch->pcdata->pwd[0] == '\0') + { + write_to_buffer( d, "Warning! Null password!\n\r",0 ); + write_to_buffer( d, "Please report old password with bug.\n\r",0); + write_to_buffer( d, + "Type 'password null ' to fix.\n\r",0); + } + + write_to_buffer( d, + "\n\rWelcome to ROM 2.4. Please do not feed the mobiles.\n\r", + 0 ); + ch->next = char_list; + char_list = ch; + d->connected = CON_PLAYING; + reset_char(ch); + + if ( ch->level == 0 ) + { + + ch->perm_stat[class_table[ch->class].attr_prime] += 3; + + ch->level = 1; + ch->exp = exp_per_level(ch,ch->pcdata->points); + ch->hit = ch->max_hit; + ch->mana = ch->max_mana; + ch->move = ch->max_move; + ch->train = 3; + ch->practice = 5; + sprintf( buf, "the %s", + title_table [ch->class] [ch->level] + [ch->sex == SEX_FEMALE ? 1 : 0] ); + set_title( ch, buf ); + + do_function (ch, &do_outfit,""); + obj_to_char(create_object(get_obj_index(OBJ_VNUM_MAP),0),ch); + + char_to_room( ch, get_room_index( ROOM_VNUM_SCHOOL ) ); + send_to_char("\n\r",ch); + do_function(ch, &do_help, "newbie info"); + send_to_char("\n\r",ch); + } + else if ( ch->in_room != NULL ) + { + char_to_room( ch, ch->in_room ); + } + else if ( IS_IMMORTAL(ch) ) + { + char_to_room( ch, get_room_index( ROOM_VNUM_CHAT ) ); + } + else + { + char_to_room( ch, get_room_index( ROOM_VNUM_TEMPLE ) ); + } + + act( "$n has entered the game.", ch, NULL, NULL, TO_ROOM ); + do_function(ch, &do_look, "auto" ); + + wiznet("$N has left real life behind.",ch,NULL, + WIZ_LOGINS,WIZ_SITES,get_trust(ch)); + + if (ch->pet != NULL) + { + char_to_room(ch->pet,ch->in_room); + act("$n has entered the game.",ch->pet,NULL,NULL,TO_ROOM); + } + + do_function(ch, &do_unread, ""); + break; + } + + return; +} + + + +/* + * Parse a name for acceptability. + */ +bool check_parse_name( char *name ) +{ + int clan; + + /* + * Reserved words. + */ + if (is_exact_name(name, + "all auto immortal self someone something the you loner")) + { + return FALSE; + } + + /* check clans */ + for (clan = 0; clan < MAX_CLAN; clan++) + { + if (LOWER(name[0]) == LOWER(clan_table[clan].name[0]) + && !str_cmp(name,clan_table[clan].name)) + return FALSE; + } + + if (str_cmp(capitalize(name),"Alander") && (!str_prefix("Alan",name) + || !str_suffix("Alander",name))) + return FALSE; + + /* + * Length restrictions. + */ + + if ( strlen(name) < 2 ) + return FALSE; + +#if defined(MSDOS) + if ( strlen(name) > 8 ) + return FALSE; +#endif + +#if defined(macintosh) || defined(unix) + if ( strlen(name) > 12 ) + return FALSE; +#endif + + /* + * Alphanumerics only. + * Lock out IllIll twits. + */ + { + char *pc; + bool fIll,adjcaps = FALSE,cleancaps = FALSE; + int total_caps = 0; + + fIll = TRUE; + for ( pc = name; *pc != '\0'; pc++ ) + { + if ( !isalpha(*pc) ) + return FALSE; + + if ( isupper(*pc)) /* ugly anti-caps hack */ + { + if (adjcaps) + cleancaps = TRUE; + total_caps++; + adjcaps = TRUE; + } + else + adjcaps = FALSE; + + if ( LOWER(*pc) != 'i' && LOWER(*pc) != 'l' ) + fIll = FALSE; + } + + if ( fIll ) + return FALSE; + + if (cleancaps || (total_caps > (strlen(name)) / 2 && strlen(name) < 3)) + return FALSE; + } + + /* + * Prevent players from naming themselves after mobs. + */ + { + extern MOB_INDEX_DATA *mob_index_hash[MAX_KEY_HASH]; + MOB_INDEX_DATA *pMobIndex; + int iHash; + + for ( iHash = 0; iHash < MAX_KEY_HASH; iHash++ ) + { + for ( pMobIndex = mob_index_hash[iHash]; + pMobIndex != NULL; + pMobIndex = pMobIndex->next ) + { + if ( is_name( name, pMobIndex->player_name ) ) + return FALSE; + } + } + } + + return TRUE; +} + + + +/* + * Look for link-dead player to reconnect. + */ +bool check_reconnect( DESCRIPTOR_DATA *d, char *name, bool fConn ) +{ + CHAR_DATA *ch; + + for ( ch = char_list; ch != NULL; ch = ch->next ) + { + if ( !IS_NPC(ch) + && (!fConn || ch->desc == NULL) + && !str_cmp( d->character->name, ch->name ) ) + { + if ( fConn == FALSE ) + { + free_string( d->character->pcdata->pwd ); + d->character->pcdata->pwd = str_dup( ch->pcdata->pwd ); + } + else + { + free_char( d->character ); + d->character = ch; + ch->desc = d; + ch->timer = 0; + send_to_char( + "Reconnecting. Type replay to see missed tells.\n\r", ch ); + act( "$n has reconnected.", ch, NULL, NULL, TO_ROOM ); + + sprintf( log_buf, "%s@%s reconnected.", ch->name, d->host ); + log_string( log_buf ); + wiznet("$N groks the fullness of $S link.", + ch,NULL,WIZ_LINKS,0,0); + d->connected = CON_PLAYING; + } + return TRUE; + } + } + + return FALSE; +} + + + +/* + * Check if already playing. + */ +bool check_playing( DESCRIPTOR_DATA *d, char *name ) +{ + DESCRIPTOR_DATA *dold; + + for ( dold = descriptor_list; dold; dold = dold->next ) + { + if ( dold != d + && dold->character != NULL + && dold->connected != CON_GET_NAME + && dold->connected != CON_GET_OLD_PASSWORD + && !str_cmp( name, dold->original + ? dold->original->name : dold->character->name ) ) + { + write_to_buffer( d, "That character is already playing.\n\r",0); + write_to_buffer( d, "Do you wish to connect anyway (Y/N)?",0); + d->connected = CON_BREAK_CONNECT; + return TRUE; + } + } + + return FALSE; +} + + + +void stop_idling( CHAR_DATA *ch ) +{ + if ( ch == NULL + || ch->desc == NULL + || ch->desc->connected != CON_PLAYING + || ch->was_in_room == NULL + || ch->in_room != get_room_index(ROOM_VNUM_LIMBO)) + return; + + ch->timer = 0; + char_from_room( ch ); + char_to_room( ch, ch->was_in_room ); + ch->was_in_room = NULL; + act( "$n has returned from the void.", ch, NULL, NULL, TO_ROOM ); + return; +} + + + +/* + * Write to one char. + */ +void send_to_char( const char *txt, CHAR_DATA *ch ) +{ + if ( txt != NULL && ch->desc != NULL ) + write_to_buffer( ch->desc, txt, strlen(txt) ); + return; +} + +/* + * Send a page to one char. + */ +void page_to_char( const char *txt, CHAR_DATA *ch ) +{ + if ( txt == NULL || ch->desc == NULL) + return; + + if (ch->lines == 0 ) + { + send_to_char(txt,ch); + return; + } + +#if defined(macintosh) + send_to_char(txt,ch); +#else + ch->desc->showstr_head = alloc_mem(strlen(txt) + 1); + strcpy(ch->desc->showstr_head,txt); + ch->desc->showstr_point = ch->desc->showstr_head; + show_string(ch->desc,""); +#endif +} + + +/* string pager */ +void show_string(struct descriptor_data *d, char *input) +{ + char buffer[4*MAX_STRING_LENGTH]; + char buf[MAX_INPUT_LENGTH]; + register char *scan, *chk; + int lines = 0, toggle = 1; + int show_lines; + + one_argument(input,buf); + if (buf[0] != '\0') + { + if (d->showstr_head) + { + free_mem(d->showstr_head,strlen(d->showstr_head)); + d->showstr_head = 0; + } + d->showstr_point = 0; + return; + } + + if (d->character) + show_lines = d->character->lines; + else + show_lines = 0; + + for (scan = buffer; ; scan++, d->showstr_point++) + { + if (((*scan = *d->showstr_point) == '\n' || *scan == '\r') + && (toggle = -toggle) < 0) + lines++; + + else if (!*scan || (show_lines > 0 && lines >= show_lines)) + { + *scan = '\0'; + write_to_buffer(d,buffer,strlen(buffer)); + for (chk = d->showstr_point; isspace(*chk); chk++); + { + if (!*chk) + { + if (d->showstr_head) + { + free_mem(d->showstr_head,strlen(d->showstr_head)); + d->showstr_head = 0; + } + d->showstr_point = 0; + } + } + return; + } + } + return; +} + + +/* quick sex fixer */ +void fix_sex(CHAR_DATA *ch) +{ + if (ch->sex < 0 || ch->sex > 2) + ch->sex = IS_NPC(ch) ? 0 : ch->pcdata->true_sex; +} + +void act_new( const char *format, CHAR_DATA *ch, const void *arg1, + const void *arg2, int type, int min_pos) +{ + static char * const he_she [] = { "it", "he", "she" }; + static char * const him_her [] = { "it", "him", "her" }; + static char * const his_her [] = { "its", "his", "her" }; + + char buf[MAX_STRING_LENGTH]; + char fname[MAX_INPUT_LENGTH]; + CHAR_DATA *to; + CHAR_DATA *vch = (CHAR_DATA *) arg2; + OBJ_DATA *obj1 = (OBJ_DATA *) arg1; + OBJ_DATA *obj2 = (OBJ_DATA *) arg2; + const char *str; + const char *i; + char *point; + + /* + * Discard null and zero-length messages. + */ + if ( format == NULL || format[0] == '\0' ) + return; + + /* discard null rooms and chars */ + if (ch == NULL || ch->in_room == NULL) + return; + + to = ch->in_room->people; + if ( type == TO_VICT ) + { + if ( vch == NULL ) + { + bug( "Act: null vch with TO_VICT.", 0 ); + return; + } + + if (vch->in_room == NULL) + return; + + to = vch->in_room->people; + } + + for ( ; to != NULL; to = to->next_in_room ) + { + if ( to->desc == NULL || to->position < min_pos ) + continue; + + if ( (type == TO_CHAR) && to != ch ) + continue; + if ( type == TO_VICT && ( to != vch || to == ch ) ) + continue; + if ( type == TO_ROOM && to == ch ) + continue; + if ( type == TO_NOTVICT && (to == ch || to == vch) ) + continue; + + point = buf; + str = format; + while ( *str != '\0' ) + { + if ( *str != '$' ) + { + *point++ = *str++; + continue; + } + ++str; + + if ( arg2 == NULL && *str >= 'A' && *str <= 'Z' ) + { + bug( "Act: missing arg2 for code %d.", *str ); + i = " <@@@> "; + } + else + { + switch ( *str ) + { + default: bug( "Act: bad code %d.", *str ); + i = " <@@@> "; break; + /* Thx alex for 't' idea */ + case 't': i = (char *) arg1; break; + case 'T': i = (char *) arg2; break; + case 'n': i = PERS( ch, to ); break; + case 'N': i = PERS( vch, to ); break; + case 'e': i = he_she [URANGE(0, ch ->sex, 2)]; break; + case 'E': i = he_she [URANGE(0, vch ->sex, 2)]; break; + case 'm': i = him_her [URANGE(0, ch ->sex, 2)]; break; + case 'M': i = him_her [URANGE(0, vch ->sex, 2)]; break; + case 's': i = his_her [URANGE(0, ch ->sex, 2)]; break; + case 'S': i = his_her [URANGE(0, vch ->sex, 2)]; break; + + case 'p': + i = can_see_obj( to, obj1 ) + ? obj1->short_descr + : "something"; + break; + + case 'P': + i = can_see_obj( to, obj2 ) + ? obj2->short_descr + : "something"; + break; + + case 'd': + if ( arg2 == NULL || ((char *) arg2)[0] == '\0' ) + { + i = "door"; + } + else + { + one_argument( (char *) arg2, fname ); + i = fname; + } + break; + } + } + + ++str; + while ( ( *point = *i ) != '\0' ) + ++point, ++i; + } + + *point++ = '\n'; + *point++ = '\r'; + buf[0] = UPPER(buf[0]); + write_to_buffer( to->desc, buf, point - buf ); + } + + return; +} + + + +/* + * Macintosh support functions. + */ +#if defined(macintosh) +int gettimeofday( struct timeval *tp, void *tzp ) +{ + tp->tv_sec = time( NULL ); + tp->tv_usec = 0; +} +#endif diff --git a/Rom24/src/const.c b/Rom24/src/const.c new file mode 100644 index 0000000..71eae1f --- /dev/null +++ b/Rom24/src/const.c @@ -0,0 +1,2125 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +#if defined(macintosh) +#include +#else +#include +#endif +#include +#include +#include "merc.h" +#include "magic.h" +#include "interp.h" + + +/* item type list */ +const struct item_type item_table [] = +{ + { ITEM_LIGHT, "light" }, + { ITEM_SCROLL, "scroll" }, + { ITEM_WAND, "wand" }, + { ITEM_STAFF, "staff" }, + { ITEM_WEAPON, "weapon" }, + { ITEM_TREASURE, "treasure" }, + { ITEM_ARMOR, "armor" }, + { ITEM_POTION, "potion" }, + { ITEM_CLOTHING, "clothing" }, + { ITEM_FURNITURE, "furniture" }, + { ITEM_TRASH, "trash" }, + { ITEM_CONTAINER, "container" }, + { ITEM_DRINK_CON, "drink" }, + { ITEM_KEY, "key" }, + { ITEM_FOOD, "food" }, + { ITEM_MONEY, "money" }, + { ITEM_BOAT, "boat" }, + { ITEM_CORPSE_NPC,"npc_corpse" }, + { ITEM_CORPSE_PC, "pc_corpse" }, + { ITEM_FOUNTAIN, "fountain" }, + { ITEM_PILL, "pill" }, + { ITEM_PROTECT, "protect" }, + { ITEM_MAP, "map" }, + { ITEM_PORTAL, "portal" }, + { ITEM_WARP_STONE,"warp_stone" }, + { ITEM_ROOM_KEY, "room_key" }, + { ITEM_GEM, "gem" }, + { ITEM_JEWELRY, "jewelry" }, + { ITEM_JUKEBOX, "jukebox" }, + { 0, NULL } +}; + + +/* weapon selection table */ +const struct weapon_type weapon_table [] = +{ + { "sword", OBJ_VNUM_SCHOOL_SWORD, WEAPON_SWORD, &gsn_sword }, + { "mace", OBJ_VNUM_SCHOOL_MACE, WEAPON_MACE, &gsn_mace }, + { "dagger", OBJ_VNUM_SCHOOL_DAGGER, WEAPON_DAGGER, &gsn_dagger }, + { "axe", OBJ_VNUM_SCHOOL_AXE, WEAPON_AXE, &gsn_axe }, + { "staff", OBJ_VNUM_SCHOOL_STAFF, WEAPON_SPEAR, &gsn_spear }, + { "flail", OBJ_VNUM_SCHOOL_FLAIL, WEAPON_FLAIL, &gsn_flail }, + { "whip", OBJ_VNUM_SCHOOL_WHIP, WEAPON_WHIP, &gsn_whip }, + { "polearm", OBJ_VNUM_SCHOOL_POLEARM,WEAPON_POLEARM, &gsn_polearm }, + { NULL, 0, 0, NULL } +}; + + + +/* wiznet table and prototype for future flag setting */ +const struct wiznet_type wiznet_table [] = +{ + { "on", WIZ_ON, IM }, + { "prefix", WIZ_PREFIX, IM }, + { "ticks", WIZ_TICKS, IM }, + { "logins", WIZ_LOGINS, IM }, + { "sites", WIZ_SITES, L4 }, + { "links", WIZ_LINKS, L7 }, + { "newbies", WIZ_NEWBIE, IM }, + { "spam", WIZ_SPAM, L5 }, + { "deaths", WIZ_DEATHS, IM }, + { "resets", WIZ_RESETS, L4 }, + { "mobdeaths", WIZ_MOBDEATHS, L4 }, + { "flags", WIZ_FLAGS, L5 }, + { "penalties", WIZ_PENALTIES, L5 }, + { "saccing", WIZ_SACCING, L5 }, + { "levels", WIZ_LEVELS, IM }, + { "load", WIZ_LOAD, L2 }, + { "restore", WIZ_RESTORE, L2 }, + { "snoops", WIZ_SNOOPS, L2 }, + { "switches", WIZ_SWITCHES, L2 }, + { "secure", WIZ_SECURE, L1 }, + { NULL, 0, 0 } +}; + +/* attack table -- not very organized :( */ +const struct attack_type attack_table [MAX_DAMAGE_MESSAGE] = +{ + { "none", "hit", -1 }, /* 0 */ + { "slice", "slice", DAM_SLASH }, + { "stab", "stab", DAM_PIERCE }, + { "slash", "slash", DAM_SLASH }, + { "whip", "whip", DAM_SLASH }, + { "claw", "claw", DAM_SLASH }, /* 5 */ + { "blast", "blast", DAM_BASH }, + { "pound", "pound", DAM_BASH }, + { "crush", "crush", DAM_BASH }, + { "grep", "grep", DAM_SLASH }, + { "bite", "bite", DAM_PIERCE }, /* 10 */ + { "pierce", "pierce", DAM_PIERCE }, + { "suction", "suction", DAM_BASH }, + { "beating", "beating", DAM_BASH }, + { "digestion", "digestion", DAM_ACID }, + { "charge", "charge", DAM_BASH }, /* 15 */ + { "slap", "slap", DAM_BASH }, + { "punch", "punch", DAM_BASH }, + { "wrath", "wrath", DAM_ENERGY }, + { "magic", "magic", DAM_ENERGY }, + { "divine", "divine power", DAM_HOLY }, /* 20 */ + { "cleave", "cleave", DAM_SLASH }, + { "scratch", "scratch", DAM_PIERCE }, + { "peck", "peck", DAM_PIERCE }, + { "peckb", "peck", DAM_BASH }, + { "chop", "chop", DAM_SLASH }, /* 25 */ + { "sting", "sting", DAM_PIERCE }, + { "smash", "smash", DAM_BASH }, + { "shbite", "shocking bite",DAM_LIGHTNING }, + { "flbite", "flaming bite", DAM_FIRE }, + { "frbite", "freezing bite", DAM_COLD }, /* 30 */ + { "acbite", "acidic bite", DAM_ACID }, + { "chomp", "chomp", DAM_PIERCE }, + { "drain", "life drain", DAM_NEGATIVE }, + { "thrust", "thrust", DAM_PIERCE }, + { "slime", "slime", DAM_ACID }, + { "shock", "shock", DAM_LIGHTNING }, + { "thwack", "thwack", DAM_BASH }, + { "flame", "flame", DAM_FIRE }, + { "chill", "chill", DAM_COLD }, + { NULL, NULL, 0 } +}; + +/* race table */ +const struct race_type race_table [] = +{ +/* + { + name, pc_race?, + act bits, aff_by bits, off bits, + imm, res, vuln, + form, parts + }, +*/ + { "unique", FALSE, 0, 0, 0, 0, 0, 0, 0, 0 }, + + { + "human", TRUE, + 0, 0, 0, + 0, 0, 0, + A|H|M|V, A|B|C|D|E|F|G|H|I|J|K + }, + + { + "elf", TRUE, + 0, AFF_INFRARED, 0, + 0, RES_CHARM, VULN_IRON, + A|H|M|V, A|B|C|D|E|F|G|H|I|J|K + }, + + { + "dwarf", TRUE, + 0, AFF_INFRARED, 0, + 0, RES_POISON|RES_DISEASE, VULN_DROWNING, + A|H|M|V, A|B|C|D|E|F|G|H|I|J|K + }, + + { + "giant", TRUE, + 0, 0, 0, + 0, RES_FIRE|RES_COLD, VULN_MENTAL|VULN_LIGHTNING, + A|H|M|V, A|B|C|D|E|F|G|H|I|J|K + }, + + { + "bat", FALSE, + 0, AFF_FLYING|AFF_DARK_VISION, OFF_DODGE|OFF_FAST, + 0, 0, VULN_LIGHT, + A|G|V, A|C|D|E|F|H|J|K|P + }, + + { + "bear", FALSE, + 0, 0, OFF_CRUSH|OFF_DISARM|OFF_BERSERK, + 0, RES_BASH|RES_COLD, 0, + A|G|V, A|B|C|D|E|F|H|J|K|U|V + }, + + { + "cat", FALSE, + 0, AFF_DARK_VISION, OFF_FAST|OFF_DODGE, + 0, 0, 0, + A|G|V, A|C|D|E|F|H|J|K|Q|U|V + }, + + { + "centipede", FALSE, + 0, AFF_DARK_VISION, 0, + 0, RES_PIERCE|RES_COLD, VULN_BASH, + A|B|G|O, A|C|K + }, + + { + "dog", FALSE, + 0, 0, OFF_FAST, + 0, 0, 0, + A|G|V, A|C|D|E|F|H|J|K|U|V + }, + + { + "doll", FALSE, + 0, 0, 0, + IMM_COLD|IMM_POISON|IMM_HOLY|IMM_NEGATIVE|IMM_MENTAL|IMM_DISEASE + |IMM_DROWNING, RES_BASH|RES_LIGHT, + VULN_SLASH|VULN_FIRE|VULN_ACID|VULN_LIGHTNING|VULN_ENERGY, + E|J|M|cc, A|B|C|G|H|K + }, + + { "dragon", FALSE, + 0, AFF_INFRARED|AFF_FLYING, 0, + 0, RES_FIRE|RES_BASH|RES_CHARM, + VULN_PIERCE|VULN_COLD, + A|H|Z, A|C|D|E|F|G|H|I|J|K|P|Q|U|V|X + }, + + { + "fido", FALSE, + 0, 0, OFF_DODGE|ASSIST_RACE, + 0, 0, VULN_MAGIC, + A|B|G|V, A|C|D|E|F|H|J|K|Q|V + }, + + { + "fox", FALSE, + 0, AFF_DARK_VISION, OFF_FAST|OFF_DODGE, + 0, 0, 0, + A|G|V, A|C|D|E|F|H|J|K|Q|V + }, + + { + "goblin", FALSE, + 0, AFF_INFRARED, 0, + 0, RES_DISEASE, VULN_MAGIC, + A|H|M|V, A|B|C|D|E|F|G|H|I|J|K + }, + + { + "hobgoblin", FALSE, + 0, AFF_INFRARED, 0, + 0, RES_DISEASE|RES_POISON, 0, + A|H|M|V, A|B|C|D|E|F|G|H|I|J|K|Y + }, + + { + "kobold", FALSE, + 0, AFF_INFRARED, 0, + 0, RES_POISON, VULN_MAGIC, + A|B|H|M|V, A|B|C|D|E|F|G|H|I|J|K|Q + }, + + { + "lizard", FALSE, + 0, 0, 0, + 0, RES_POISON, VULN_COLD, + A|G|X|cc, A|C|D|E|F|H|K|Q|V + }, + + { + "modron", FALSE, + 0, AFF_INFRARED, ASSIST_RACE|ASSIST_ALIGN, + IMM_CHARM|IMM_DISEASE|IMM_MENTAL|IMM_HOLY|IMM_NEGATIVE, + RES_FIRE|RES_COLD|RES_ACID, 0, + H, A|B|C|G|H|J|K + }, + + { + "orc", FALSE, + 0, AFF_INFRARED, 0, + 0, RES_DISEASE, VULN_LIGHT, + A|H|M|V, A|B|C|D|E|F|G|H|I|J|K + }, + + { + "pig", FALSE, + 0, 0, 0, + 0, 0, 0, + A|G|V, A|C|D|E|F|H|J|K + }, + + { + "rabbit", FALSE, + 0, 0, OFF_DODGE|OFF_FAST, + 0, 0, 0, + A|G|V, A|C|D|E|F|H|J|K + }, + + { + "school monster", FALSE, + ACT_NOALIGN, 0, 0, + IMM_CHARM|IMM_SUMMON, 0, VULN_MAGIC, + A|M|V, A|B|C|D|E|F|H|J|K|Q|U + }, + + { + "snake", FALSE, + 0, 0, 0, + 0, RES_POISON, VULN_COLD, + A|G|X|Y|cc, A|D|E|F|K|L|Q|V|X + }, + + { + "song bird", FALSE, + 0, AFF_FLYING, OFF_FAST|OFF_DODGE, + 0, 0, 0, + A|G|W, A|C|D|E|F|H|K|P + }, + + { + "troll", FALSE, + 0, AFF_REGENERATION|AFF_INFRARED|AFF_DETECT_HIDDEN, + OFF_BERSERK, + 0, RES_CHARM|RES_BASH, VULN_FIRE|VULN_ACID, + A|B|H|M|V, A|B|C|D|E|F|G|H|I|J|K|U|V + }, + + { + "water fowl", FALSE, + 0, AFF_SWIM|AFF_FLYING, 0, + 0, RES_DROWNING, 0, + A|G|W, A|C|D|E|F|H|K|P + }, + + { + "wolf", FALSE, + 0, AFF_DARK_VISION, OFF_FAST|OFF_DODGE, + 0, 0, 0, + A|G|V, A|C|D|E|F|J|K|Q|V + }, + + { + "wyvern", FALSE, + 0, AFF_FLYING|AFF_DETECT_INVIS|AFF_DETECT_HIDDEN, + OFF_BASH|OFF_FAST|OFF_DODGE, + IMM_POISON, 0, VULN_LIGHT, + A|B|G|Z, A|C|D|E|F|H|J|K|Q|V|X + }, + + { + "unique", FALSE, + 0, 0, 0, + 0, 0, 0, + 0, 0 + }, + + + { + NULL, 0, 0, 0, 0, 0, 0 + } +}; + +const struct pc_race_type pc_race_table [] = +{ + { "null race", "", 0, { 100, 100, 100, 100 }, + { "" }, { 13, 13, 13, 13, 13 }, { 18, 18, 18, 18, 18 }, 0 }, + +/* + { + "race name", short name, points, { class multipliers }, + { bonus skills }, + { base stats }, { max stats }, size + }, +*/ + { + "human", "Human", 0, { 100, 100, 100, 100 }, + { "" }, + { 13, 13, 13, 13, 13 }, { 18, 18, 18, 18, 18 }, SIZE_MEDIUM + }, + + { + "elf", " Elf ", 5, { 100, 125, 100, 120 }, + { "sneak", "hide" }, + { 12, 14, 13, 15, 11 }, { 16, 20, 18, 21, 15 }, SIZE_SMALL + }, + + { + "dwarf", "Dwarf", 8, { 150, 100, 125, 100 }, + { "berserk" }, + { 14, 12, 14, 10, 15 }, { 20, 16, 19, 14, 21 }, SIZE_MEDIUM + }, + + { + "giant", "Giant", 6, { 200, 150, 150, 105 }, + { "bash", "fast healing" }, + { 16, 11, 13, 11, 14 }, { 22, 15, 18, 15, 20 }, SIZE_LARGE + } +}; + + + + +/* + * Class table. + */ +const struct class_type class_table [MAX_CLASS] = +{ + { + "mage", "Mag", STAT_INT, OBJ_VNUM_SCHOOL_DAGGER, + { 3018, 9618 }, 75, 20, 6, 6, 8, TRUE, + "mage basics", "mage default" + }, + + { + "cleric", "Cle", STAT_WIS, OBJ_VNUM_SCHOOL_MACE, + { 3003, 9619 }, 75, 20, 2, 7, 10, TRUE, + "cleric basics", "cleric default" + }, + + { + "thief", "Thi", STAT_DEX, OBJ_VNUM_SCHOOL_DAGGER, + { 3028, 9639 }, 75, 20, -4, 8, 13, FALSE, + "thief basics", "thief default" + }, + + { + "warrior", "War", STAT_STR, OBJ_VNUM_SCHOOL_SWORD, + { 3022, 9633 }, 75, 20, -10, 11, 15, FALSE, + "warrior basics", "warrior default" + } +}; + + + +/* + * Titles. + */ +char * const title_table [MAX_CLASS][MAX_LEVEL+1][2] = +{ + { + { "Man", "Woman" }, + + { "Apprentice of Magic", "Apprentice of Magic" }, + { "Spell Student", "Spell Student" }, + { "Scholar of Magic", "Scholar of Magic" }, + { "Delver in Spells", "Delveress in Spells" }, + { "Medium of Magic", "Medium of Magic" }, + + { "Scribe of Magic", "Scribess of Magic" }, + { "Seer", "Seeress" }, + { "Sage", "Sage" }, + { "Illusionist", "Illusionist" }, + { "Abjurer", "Abjuress" }, + + { "Invoker", "Invoker" }, + { "Enchanter", "Enchantress" }, + { "Conjurer", "Conjuress" }, + { "Magician", "Witch" }, + { "Creator", "Creator" }, + + { "Savant", "Savant" }, + { "Magus", "Craftess" }, + { "Wizard", "Wizard" }, + { "Warlock", "War Witch" }, + { "Sorcerer", "Sorceress" }, + + { "Elder Sorcerer", "Elder Sorceress" }, + { "Grand Sorcerer", "Grand Sorceress" }, + { "Great Sorcerer", "Great Sorceress" }, + { "Golem Maker", "Golem Maker" }, + { "Greater Golem Maker", "Greater Golem Maker" }, + + { "Maker of Stones", "Maker of Stones", }, + { "Maker of Potions", "Maker of Potions", }, + { "Maker of Scrolls", "Maker of Scrolls", }, + { "Maker of Wands", "Maker of Wands", }, + { "Maker of Staves", "Maker of Staves", }, + + { "Demon Summoner", "Demon Summoner" }, + { "Greater Demon Summoner", "Greater Demon Summoner" }, + { "Dragon Charmer", "Dragon Charmer" }, + { "Greater Dragon Charmer", "Greater Dragon Charmer" }, + { "Master of all Magic", "Master of all Magic" }, + + { "Master Mage", "Master Mage" }, + { "Master Mage", "Master Mage" }, + { "Master Mage", "Master Mage" }, + { "Master Mage", "Master Mage" }, + { "Master Mage", "Master Mage" }, + + { "Master Mage", "Master Mage" }, + { "Master Mage", "Master Mage" }, + { "Master Mage", "Master Mage" }, + { "Master Mage", "Master Mage" }, + { "Master Mage", "Master Mage" }, + + { "Master Mage", "Master Mage" }, + { "Master Mage", "Master Mage" }, + { "Master Mage", "Master Mage" }, + { "Master Mage", "Master Mage" }, + { "Master Mage", "Master Mage" }, + + { "Mage Hero", "Mage Heroine" }, + { "Avatar of Magic", "Avatar of Magic" }, + { "Angel of Magic", "Angel of Magic" }, + { "Demigod of Magic", "Demigoddess of Magic" }, + { "Immortal of Magic", "Immortal of Magic" }, + { "God of Magic", "Goddess of Magic" }, + { "Deity of Magic", "Deity of Magic" }, + { "Supremity of Magic", "Supremity of Magic" }, + { "Creator", "Creator" }, + { "Implementor", "Implementress" } + }, + + { + { "Man", "Woman" }, + + { "Believer", "Believer" }, + { "Attendant", "Attendant" }, + { "Acolyte", "Acolyte" }, + { "Novice", "Novice" }, + { "Missionary", "Missionary" }, + + { "Adept", "Adept" }, + { "Deacon", "Deaconess" }, + { "Vicar", "Vicaress" }, + { "Priest", "Priestess" }, + { "Minister", "Lady Minister" }, + + { "Canon", "Canon" }, + { "Levite", "Levitess" }, + { "Curate", "Curess" }, + { "Monk", "Nun" }, + { "Healer", "Healess" }, + + { "Chaplain", "Chaplain" }, + { "Expositor", "Expositress" }, + { "Bishop", "Bishop" }, + { "Arch Bishop", "Arch Lady of the Church" }, + { "Patriarch", "Matriarch" }, + + { "Elder Patriarch", "Elder Matriarch" }, + { "Grand Patriarch", "Grand Matriarch" }, + { "Great Patriarch", "Great Matriarch" }, + { "Demon Killer", "Demon Killer" }, + { "Greater Demon Killer", "Greater Demon Killer" }, + + { "Cardinal of the Sea", "Cardinal of the Sea" }, + { "Cardinal of the Earth", "Cardinal of the Earth" }, + { "Cardinal of the Air", "Cardinal of the Air" }, + { "Cardinal of the Ether", "Cardinal of the Ether" }, + { "Cardinal of the Heavens", "Cardinal of the Heavens" }, + + { "Avatar of an Immortal", "Avatar of an Immortal" }, + { "Avatar of a Deity", "Avatar of a Deity" }, + { "Avatar of a Supremity", "Avatar of a Supremity" }, + { "Avatar of an Implementor", "Avatar of an Implementor" }, + { "Master of all Divinity", "Mistress of all Divinity" }, + + { "Master Cleric", "Master Cleric" }, + { "Master Cleric", "Master Cleric" }, + { "Master Cleric", "Master Cleric" }, + { "Master Cleric", "Master Cleric" }, + { "Master Cleric", "Master Cleric" }, + + { "Master Cleric", "Master Cleric" }, + { "Master Cleric", "Master Cleric" }, + { "Master Cleric", "Master Cleric" }, + { "Master Cleric", "Master Cleric" }, + { "Master Cleric", "Master Cleric" }, + + { "Master Cleric", "Master Cleric" }, + { "Master Cleric", "Master Cleric" }, + { "Master Cleric", "Master Cleric" }, + { "Master Cleric", "Master Cleric" }, + { "Master Cleric", "Master Cleric" }, + + { "Holy Hero", "Holy Heroine" }, + { "Holy Avatar", "Holy Avatar" }, + { "Angel", "Angel" }, + { "Demigod", "Demigoddess", }, + { "Immortal", "Immortal" }, + { "God", "Goddess" }, + { "Deity", "Deity" }, + { "Supreme Master", "Supreme Mistress" }, + { "Creator", "Creator" }, + { "Implementor", "Implementress" } + }, + + { + { "Man", "Woman" }, + + { "Pilferer", "Pilferess" }, + { "Footpad", "Footpad" }, + { "Filcher", "Filcheress" }, + { "Pick-Pocket", "Pick-Pocket" }, + { "Sneak", "Sneak" }, + + { "Pincher", "Pincheress" }, + { "Cut-Purse", "Cut-Purse" }, + { "Snatcher", "Snatcheress" }, + { "Sharper", "Sharpress" }, + { "Rogue", "Rogue" }, + + { "Robber", "Robber" }, + { "Magsman", "Magswoman" }, + { "Highwayman", "Highwaywoman" }, + { "Burglar", "Burglaress" }, + { "Thief", "Thief" }, + + { "Knifer", "Knifer" }, + { "Quick-Blade", "Quick-Blade" }, + { "Killer", "Murderess" }, + { "Brigand", "Brigand" }, + { "Cut-Throat", "Cut-Throat" }, + + { "Spy", "Spy" }, + { "Grand Spy", "Grand Spy" }, + { "Master Spy", "Master Spy" }, + { "Assassin", "Assassin" }, + { "Greater Assassin", "Greater Assassin" }, + + { "Master of Vision", "Mistress of Vision" }, + { "Master of Hearing", "Mistress of Hearing" }, + { "Master of Smell", "Mistress of Smell" }, + { "Master of Taste", "Mistress of Taste" }, + { "Master of Touch", "Mistress of Touch" }, + + { "Crime Lord", "Crime Mistress" }, + { "Infamous Crime Lord", "Infamous Crime Mistress" }, + { "Greater Crime Lord", "Greater Crime Mistress" }, + { "Master Crime Lord", "Master Crime Mistress" }, + { "Godfather", "Godmother" }, + + { "Master Thief", "Master Thief" }, + { "Master Thief", "Master Thief" }, + { "Master Thief", "Master Thief" }, + { "Master Thief", "Master Thief" }, + { "Master Thief", "Master Thief" }, + + { "Master Thief", "Master Thief" }, + { "Master Thief", "Master Thief" }, + { "Master Thief", "Master Thief" }, + { "Master Thief", "Master Thief" }, + { "Master Thief", "Master Thief" }, + + { "Master Thief", "Master Thief" }, + { "Master Thief", "Master Thief" }, + { "Master Thief", "Master Thief" }, + { "Master Thief", "Master Thief" }, + { "Master Thief", "Master Thief" }, + + { "Assassin Hero", "Assassin Heroine" }, + { "Avatar of Death", "Avatar of Death", }, + { "Angel of Death", "Angel of Death" }, + { "Demigod of Assassins", "Demigoddess of Assassins" }, + { "Immortal Assasin", "Immortal Assassin" }, + { "God of Assassins", "God of Assassins", }, + { "Deity of Assassins", "Deity of Assassins" }, + { "Supreme Master", "Supreme Mistress" }, + { "Creator", "Creator" }, + { "Implementor", "Implementress" } + }, + + { + { "Man", "Woman" }, + + { "Swordpupil", "Swordpupil" }, + { "Recruit", "Recruit" }, + { "Sentry", "Sentress" }, + { "Fighter", "Fighter" }, + { "Soldier", "Soldier" }, + + { "Warrior", "Warrior" }, + { "Veteran", "Veteran" }, + { "Swordsman", "Swordswoman" }, + { "Fencer", "Fenceress" }, + { "Combatant", "Combatess" }, + + { "Hero", "Heroine" }, + { "Myrmidon", "Myrmidon" }, + { "Swashbuckler", "Swashbuckleress" }, + { "Mercenary", "Mercenaress" }, + { "Swordmaster", "Swordmistress" }, + + { "Lieutenant", "Lieutenant" }, + { "Champion", "Lady Champion" }, + { "Dragoon", "Lady Dragoon" }, + { "Cavalier", "Lady Cavalier" }, + { "Knight", "Lady Knight" }, + + { "Grand Knight", "Grand Knight" }, + { "Master Knight", "Master Knight" }, + { "Paladin", "Paladin" }, + { "Grand Paladin", "Grand Paladin" }, + { "Demon Slayer", "Demon Slayer" }, + + { "Greater Demon Slayer", "Greater Demon Slayer" }, + { "Dragon Slayer", "Dragon Slayer" }, + { "Greater Dragon Slayer", "Greater Dragon Slayer" }, + { "Underlord", "Underlord" }, + { "Overlord", "Overlord" }, + + { "Baron of Thunder", "Baroness of Thunder" }, + { "Baron of Storms", "Baroness of Storms" }, + { "Baron of Tornadoes", "Baroness of Tornadoes" }, + { "Baron of Hurricanes", "Baroness of Hurricanes" }, + { "Baron of Meteors", "Baroness of Meteors" }, + + { "Master Warrior", "Master Warrior" }, + { "Master Warrior", "Master Warrior" }, + { "Master Warrior", "Master Warrior" }, + { "Master Warrior", "Master Warrior" }, + { "Master Warrior", "Master Warrior" }, + + { "Master Warrior", "Master Warrior" }, + { "Master Warrior", "Master Warrior" }, + { "Master Warrior", "Master Warrior" }, + { "Master Warrior", "Master Warrior" }, + { "Master Warrior", "Master Warrior" }, + + { "Master Warrior", "Master Warrior" }, + { "Master Warrior", "Master Warrior" }, + { "Master Warrior", "Master Warrior" }, + { "Master Warrior", "Master Warrior" }, + { "Master Warrior", "Master Warrior" }, + + { "Knight Hero", "Knight Heroine" }, + { "Avatar of War", "Avatar of War" }, + { "Angel of War", "Angel of War" }, + { "Demigod of War", "Demigoddess of War" }, + { "Immortal Warlord", "Immortal Warlord" }, + { "God of War", "God of War" }, + { "Deity of War", "Deity of War" }, + { "Supreme Master of War", "Supreme Mistress of War" }, + { "Creator", "Creator" }, + { "Implementor", "Implementress" } + } +}; + + + +/* + * Attribute bonus tables. + */ +const struct str_app_type str_app [26] = +{ + { -5, -4, 0, 0 }, /* 0 */ + { -5, -4, 3, 1 }, /* 1 */ + { -3, -2, 3, 2 }, + { -3, -1, 10, 3 }, /* 3 */ + { -2, -1, 25, 4 }, + { -2, -1, 55, 5 }, /* 5 */ + { -1, 0, 80, 6 }, + { -1, 0, 90, 7 }, + { 0, 0, 100, 8 }, + { 0, 0, 100, 9 }, + { 0, 0, 115, 10 }, /* 10 */ + { 0, 0, 115, 11 }, + { 0, 0, 130, 12 }, + { 0, 0, 130, 13 }, /* 13 */ + { 0, 1, 140, 14 }, + { 1, 1, 150, 15 }, /* 15 */ + { 1, 2, 165, 16 }, + { 2, 3, 180, 22 }, + { 2, 3, 200, 25 }, /* 18 */ + { 3, 4, 225, 30 }, + { 3, 5, 250, 35 }, /* 20 */ + { 4, 6, 300, 40 }, + { 4, 6, 350, 45 }, + { 5, 7, 400, 50 }, + { 5, 8, 450, 55 }, + { 6, 9, 500, 60 } /* 25 */ +}; + + + +const struct int_app_type int_app [26] = +{ + { 3 }, /* 0 */ + { 5 }, /* 1 */ + { 7 }, + { 8 }, /* 3 */ + { 9 }, + { 10 }, /* 5 */ + { 11 }, + { 12 }, + { 13 }, + { 15 }, + { 17 }, /* 10 */ + { 19 }, + { 22 }, + { 25 }, + { 28 }, + { 31 }, /* 15 */ + { 34 }, + { 37 }, + { 40 }, /* 18 */ + { 44 }, + { 49 }, /* 20 */ + { 55 }, + { 60 }, + { 70 }, + { 80 }, + { 85 } /* 25 */ +}; + + + +const struct wis_app_type wis_app [26] = +{ + { 0 }, /* 0 */ + { 0 }, /* 1 */ + { 0 }, + { 0 }, /* 3 */ + { 0 }, + { 1 }, /* 5 */ + { 1 }, + { 1 }, + { 1 }, + { 1 }, + { 1 }, /* 10 */ + { 1 }, + { 1 }, + { 1 }, + { 1 }, + { 2 }, /* 15 */ + { 2 }, + { 2 }, + { 3 }, /* 18 */ + { 3 }, + { 3 }, /* 20 */ + { 3 }, + { 4 }, + { 4 }, + { 4 }, + { 5 } /* 25 */ +}; + + + +const struct dex_app_type dex_app [26] = +{ + { 60 }, /* 0 */ + { 50 }, /* 1 */ + { 50 }, + { 40 }, + { 30 }, + { 20 }, /* 5 */ + { 10 }, + { 0 }, + { 0 }, + { 0 }, + { 0 }, /* 10 */ + { 0 }, + { 0 }, + { 0 }, + { 0 }, + { - 10 }, /* 15 */ + { - 15 }, + { - 20 }, + { - 30 }, + { - 40 }, + { - 50 }, /* 20 */ + { - 60 }, + { - 75 }, + { - 90 }, + { -105 }, + { -120 } /* 25 */ +}; + + +const struct con_app_type con_app [26] = +{ + { -4, 20 }, /* 0 */ + { -3, 25 }, /* 1 */ + { -2, 30 }, + { -2, 35 }, /* 3 */ + { -1, 40 }, + { -1, 45 }, /* 5 */ + { -1, 50 }, + { 0, 55 }, + { 0, 60 }, + { 0, 65 }, + { 0, 70 }, /* 10 */ + { 0, 75 }, + { 0, 80 }, + { 0, 85 }, + { 0, 88 }, + { 1, 90 }, /* 15 */ + { 2, 95 }, + { 2, 97 }, + { 3, 99 }, /* 18 */ + { 3, 99 }, + { 4, 99 }, /* 20 */ + { 4, 99 }, + { 5, 99 }, + { 6, 99 }, + { 7, 99 }, + { 8, 99 } /* 25 */ +}; + + + +/* + * Liquid properties. + * Used in world.obj. + */ +const struct liq_type liq_table [] = +{ +/* name color proof, full, thirst, food, ssize */ + { "water", "clear", { 0, 1, 10, 0, 16 } }, + { "beer", "amber", { 12, 1, 8, 1, 12 } }, + { "red wine", "burgundy", { 30, 1, 8, 1, 5 } }, + { "ale", "brown", { 15, 1, 8, 1, 12 } }, + { "dark ale", "dark", { 16, 1, 8, 1, 12 } }, + + { "whisky", "golden", { 120, 1, 5, 0, 2 } }, + { "lemonade", "pink", { 0, 1, 9, 2, 12 } }, + { "firebreather", "boiling", { 190, 0, 4, 0, 2 } }, + { "local specialty", "clear", { 151, 1, 3, 0, 2 } }, + { "slime mold juice", "green", { 0, 2, -8, 1, 2 } }, + + { "milk", "white", { 0, 2, 9, 3, 12 } }, + { "tea", "tan", { 0, 1, 8, 0, 6 } }, + { "coffee", "black", { 0, 1, 8, 0, 6 } }, + { "blood", "red", { 0, 2, -1, 2, 6 } }, + { "salt water", "clear", { 0, 1, -2, 0, 1 } }, + + { "coke", "brown", { 0, 2, 9, 2, 12 } }, + { "root beer", "brown", { 0, 2, 9, 2, 12 } }, + { "elvish wine", "green", { 35, 2, 8, 1, 5 } }, + { "white wine", "golden", { 28, 1, 8, 1, 5 } }, + { "champagne", "golden", { 32, 1, 8, 1, 5 } }, + + { "mead", "honey-colored",{ 34, 2, 8, 2, 12 } }, + { "rose wine", "pink", { 26, 1, 8, 1, 5 } }, + { "benedictine wine", "burgundy", { 40, 1, 8, 1, 5 } }, + { "vodka", "clear", { 130, 1, 5, 0, 2 } }, + { "cranberry juice", "red", { 0, 1, 9, 2, 12 } }, + + { "orange juice", "orange", { 0, 2, 9, 3, 12 } }, + { "absinthe", "green", { 200, 1, 4, 0, 2 } }, + { "brandy", "golden", { 80, 1, 5, 0, 4 } }, + { "aquavit", "clear", { 140, 1, 5, 0, 2 } }, + { "schnapps", "clear", { 90, 1, 5, 0, 2 } }, + + { "icewine", "purple", { 50, 2, 6, 1, 5 } }, + { "amontillado", "burgundy", { 35, 2, 8, 1, 5 } }, + { "sherry", "red", { 38, 2, 7, 1, 5 } }, + { "framboise", "red", { 50, 1, 7, 1, 5 } }, + { "rum", "amber", { 151, 1, 4, 0, 2 } }, + + { "cordial", "clear", { 100, 1, 5, 0, 2 } }, + { NULL, NULL, { 0, 0, 0, 0, 0 } } +}; + + + +/* + * The skill and spell table. + * Slot numbers must never be changed as they appear in #OBJECTS sections. + */ +#define SLOT(n) n + +const struct skill_type skill_table [MAX_SKILL] = +{ + +/* + * Magic spells. + */ + + { + "reserved", { 99, 99, 99, 99 }, { 99, 99, 99, 99}, + 0, TAR_IGNORE, POS_STANDING, + NULL, SLOT( 0), 0, 0, + "", "", "" + }, + + { + "acid blast", { 28, 53, 35, 32 }, { 1, 1, 2, 2}, + spell_acid_blast, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT(70), 20, 12, + "acid blast", "!Acid Blast!" + }, + + { + "armor", { 7, 2, 10, 5 }, { 1, 1, 2, 2}, + spell_armor, TAR_CHAR_DEFENSIVE, POS_STANDING, + NULL, SLOT( 1), 5, 12, + "", "You feel less armored.", "" + }, + + { + "bless", { 53, 7, 53, 8 }, { 1, 1, 2, 2}, + spell_bless, TAR_OBJ_CHAR_DEF, POS_STANDING, + NULL, SLOT( 3), 5, 12, + "", "You feel less righteous.", + "$p's holy aura fades." + }, + + { + "blindness", { 12, 8, 17, 15 }, { 1, 1, 2, 2}, + spell_blindness, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + &gsn_blindness, SLOT( 4), 5, 12, + "", "You can see again.", "" + }, + + { + "burning hands", { 7, 53, 10, 9 }, { 1, 1, 2, 2}, + spell_burning_hands, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT( 5), 15, 12, + "burning hands", "!Burning Hands!", "" + }, + + { + "call lightning", { 26, 18, 31, 22 }, { 1, 1, 2, 2}, + spell_call_lightning, TAR_IGNORE, POS_FIGHTING, + NULL, SLOT( 6), 15, 12, + "lightning bolt", "!Call Lightning!", "" + }, + + { "calm", { 48, 16, 50, 20 }, { 1, 1, 2, 2}, + spell_calm, TAR_IGNORE, POS_FIGHTING, + NULL, SLOT(509), 30, 12, + "", "You have lost your peace of mind.", "" + }, + + { + "cancellation", { 18, 26, 34, 34 }, { 1, 1, 2, 2}, + spell_cancellation, TAR_CHAR_DEFENSIVE, POS_FIGHTING, + NULL, SLOT(507), 20, 12, + "" "!cancellation!", "" + }, + + { + "cause critical", { 53, 13, 53, 19 }, { 1, 1, 2, 2}, + spell_cause_critical, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT(63), 20, 12, + "spell", "!Cause Critical!", "" + }, + + { + "cause light", { 53, 1, 53, 3 }, { 1, 1, 2, 2}, + spell_cause_light, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT(62), 15, 12, + "spell", "!Cause Light!", "" + }, + + { + "cause serious", { 53, 7, 53, 10 }, { 1, 1, 2, 2}, + spell_cause_serious, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT(64), 17, 12, + "spell", "!Cause Serious!", "" + }, + + { + "chain lightning", { 33, 53, 39, 36 }, { 1, 1, 2, 2}, + spell_chain_lightning, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT(500), 25, 12, + "lightning", "!Chain Lightning!", "" + }, + + { + "change sex", { 53, 53, 53, 53 }, { 1, 1, 2, 2}, + spell_change_sex, TAR_CHAR_DEFENSIVE, POS_FIGHTING, + NULL, SLOT(82), 15, 12, + "", "Your body feels familiar again.", "" + }, + + { + "charm person", { 20, 53, 25, 53 }, { 1, 1, 2, 2}, + spell_charm_person, TAR_CHAR_OFFENSIVE, POS_STANDING, + &gsn_charm_person, SLOT( 7), 5, 12, + "", "You feel more self-confident.", "" + }, + + { + "chill touch", { 4, 53, 6, 6 }, { 1, 1, 2, 2}, + spell_chill_touch, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT( 8), 15, 12, + "chilling touch", "You feel less cold.", "" + }, + + { + "colour spray", { 16, 53, 22, 20 }, { 1, 1, 2, 2}, + spell_colour_spray, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT(10), 15, 12, + "colour spray", "!Colour Spray!", "" + }, + + { + "continual light", { 6, 4, 6, 9 }, { 1, 1, 2, 2}, + spell_continual_light, TAR_IGNORE, POS_STANDING, + NULL, SLOT(57), 7, 12, + "", "!Continual Light!", "" + }, + + { + "control weather", { 15, 19, 28, 22 }, { 1, 1, 2, 2}, + spell_control_weather, TAR_IGNORE, POS_STANDING, + NULL, SLOT(11), 25, 12, + "", "!Control Weather!", "" + }, + + { + "create food", { 10, 5, 11, 12 }, { 1, 1, 2, 2}, + spell_create_food, TAR_IGNORE, POS_STANDING, + NULL, SLOT(12), 5, 12, + "", "!Create Food!", "" + }, + + { + "create rose", { 16, 11, 10, 24 }, { 1, 1, 2, 2 }, + spell_create_rose, TAR_IGNORE, POS_STANDING, + NULL, SLOT(511), 30, 12, + "", "!Create Rose!", "" + }, + + { + "create spring", { 14, 17, 23, 20 }, { 1, 1, 2, 2}, + spell_create_spring, TAR_IGNORE, POS_STANDING, + NULL, SLOT(80), 20, 12, + "", "!Create Spring!", "" + }, + + { + "create water", { 8, 3, 12, 11 }, { 1, 1, 2, 2}, + spell_create_water, TAR_OBJ_INV, POS_STANDING, + NULL, SLOT(13), 5, 12, + "", "!Create Water!", "" + }, + + { + "cure blindness", { 53, 6, 53, 8 }, { 1, 1, 2, 2}, + spell_cure_blindness, TAR_CHAR_DEFENSIVE, POS_FIGHTING, + NULL, SLOT(14), 5, 12, + "", "!Cure Blindness!", "" + }, + + { + "cure critical", { 53, 13, 53, 19 }, { 1, 1, 2, 2}, + spell_cure_critical, TAR_CHAR_DEFENSIVE, POS_FIGHTING, + NULL, SLOT(15), 20, 12, + "", "!Cure Critical!", "" + }, + + { + "cure disease", { 53, 13, 53, 14 }, { 1, 1, 2, 2}, + spell_cure_disease, TAR_CHAR_DEFENSIVE, POS_STANDING, + NULL, SLOT(501), 20, 12, + "", "!Cure Disease!", "" + }, + + { + "cure light", { 53, 1, 53, 3 }, { 1, 1, 2, 2}, + spell_cure_light, TAR_CHAR_DEFENSIVE, POS_FIGHTING, + NULL, SLOT(16), 10, 12, + "", "!Cure Light!", "" + }, + + { + "cure poison", { 53, 14, 53, 16 }, { 1, 1, 2, 2}, + spell_cure_poison, TAR_CHAR_DEFENSIVE, POS_STANDING, + NULL, SLOT(43), 5, 12, + "", "!Cure Poison!", "" + }, + + { + "cure serious", { 53, 7, 53, 10 }, { 1, 1, 2, 2}, + spell_cure_serious, TAR_CHAR_DEFENSIVE, POS_FIGHTING, + NULL, SLOT(61), 15, 12, + "", "!Cure Serious!", "" + }, + + { + "curse", { 18, 18, 26, 22 }, { 1, 1, 2, 2}, + spell_curse, TAR_OBJ_CHAR_OFF, POS_FIGHTING, + &gsn_curse, SLOT(17), 20, 12, + "curse", "The curse wears off.", + "$p is no longer impure." + }, + + { + "demonfire", { 53, 34, 53, 45 }, { 1, 1, 2, 2}, + spell_demonfire, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT(505), 20, 12, + "torments", "!Demonfire!", "" + }, + + { + "detect evil", { 11, 4, 12, 53 }, { 1, 1, 2, 2}, + spell_detect_evil, TAR_CHAR_SELF, POS_STANDING, + NULL, SLOT(18), 5, 12, + "", "The red in your vision disappears.", "" + }, + + { + "detect good", { 11, 4, 12, 53 }, { 1, 1, 2, 2}, + spell_detect_good, TAR_CHAR_SELF, POS_STANDING, + NULL, SLOT(513), 5, 12, + "", "The gold in your vision disappears.", "" + }, + + { + "detect hidden", { 15, 11, 12, 53 }, { 1, 1, 2, 2}, + spell_detect_hidden, TAR_CHAR_SELF, POS_STANDING, + NULL, SLOT(44), 5, 12, + "", "You feel less aware of your surroundings.", + "" + }, + + { + "detect invis", { 3, 8, 6, 53 }, { 1, 1, 2, 2}, + spell_detect_invis, TAR_CHAR_SELF, POS_STANDING, + NULL, SLOT(19), 5, 12, + "", "You no longer see invisible objects.", + "" + }, + + { + "detect magic", { 2, 6, 5, 53 }, { 1, 1, 2, 2}, + spell_detect_magic, TAR_CHAR_SELF, POS_STANDING, + NULL, SLOT(20), 5, 12, + "", "The detect magic wears off.", "" + }, + + { + "detect poison", { 15, 7, 9, 53 }, { 1, 1, 2, 2}, + spell_detect_poison, TAR_OBJ_INV, POS_STANDING, + NULL, SLOT(21), 5, 12, + "", "!Detect Poison!", "" + }, + + { + "dispel evil", { 53, 15, 53, 21 }, { 1, 1, 2, 2}, + spell_dispel_evil, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT(22), 15, 12, + "dispel evil", "!Dispel Evil!", "" + }, + + { + "dispel good", { 53, 15, 53, 21 }, { 1, 1, 2, 2}, + spell_dispel_good, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT(512), 15, 12, + "dispel good", "!Dispel Good!", "" + }, + + { + "dispel magic", { 16, 24, 30, 30 }, { 1, 1, 2, 2}, + spell_dispel_magic, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT(59), 15, 12, + "", "!Dispel Magic!", "" + }, + + { + "earthquake", { 53, 10, 53, 14 }, { 1, 1, 2, 2}, + spell_earthquake, TAR_IGNORE, POS_FIGHTING, + NULL, SLOT(23), 15, 12, + "earthquake", "!Earthquake!", "" + }, + + { + "enchant armor", { 16, 53, 53, 53 }, { 2, 2, 4, 4 }, + spell_enchant_armor, TAR_OBJ_INV, POS_STANDING, + NULL, SLOT(510), 100, 24, + "", "!Enchant Armor!", "" + }, + + { + "enchant weapon", { 17, 53, 53, 53 }, { 2, 2, 4, 4}, + spell_enchant_weapon, TAR_OBJ_INV, POS_STANDING, + NULL, SLOT(24), 100, 24, + "", "!Enchant Weapon!", "" + }, + + { + "energy drain", { 19, 22, 26, 23 }, { 1, 1, 2, 2}, + spell_energy_drain, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT(25), 35, 12, + "energy drain", "!Energy Drain!", "" + }, + + { + "faerie fire", { 6, 3, 5, 8 }, { 1, 1, 2, 2}, + spell_faerie_fire, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT(72), 5, 12, + "faerie fire", "The pink aura around you fades away.", + "" + }, + + { + "faerie fog", { 14, 21, 16, 24 }, { 1, 1, 2, 2}, + spell_faerie_fog, TAR_IGNORE, POS_STANDING, + NULL, SLOT(73), 12, 12, + "faerie fog", "!Faerie Fog!", "" + }, + + { + "farsight", { 14, 16, 16, 53 }, { 1, 1, 2, 2}, + spell_farsight, TAR_IGNORE, POS_STANDING, + NULL, SLOT(521), 36, 20, + "farsight", "!Farsight!", "" + }, + + { + "fireball", { 22, 53, 30, 26 }, { 1, 1, 2, 2}, + spell_fireball, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT(26), 15, 12, + "fireball", "!Fireball!", "" + }, + + { + "fireproof", { 13, 12, 19, 18 }, { 1, 1, 2, 2}, + spell_fireproof, TAR_OBJ_INV, POS_STANDING, + NULL, SLOT(523), 10, 12, + "", "", "$p's protective aura fades." + }, + + { + "flamestrike", { 53, 20, 53, 27 }, { 1, 1, 2, 2}, + spell_flamestrike, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT(65), 20, 12, + "flamestrike", "!Flamestrike!", "" + }, + + { + "fly", { 10, 18, 20, 22 }, { 1, 1, 2, 2}, + spell_fly, TAR_CHAR_DEFENSIVE, POS_STANDING, + NULL, SLOT(56), 10, 18, + "", "You slowly float to the ground.", "" + }, + + { + "floating disc", { 4, 10, 7, 16 }, { 1, 1, 2, 2}, + spell_floating_disc, TAR_IGNORE, POS_STANDING, + NULL, SLOT(522), 40, 24, + "", "!Floating disc!", "" + }, + + { + "frenzy", { 53, 24, 53, 26 }, { 1, 1, 2, 2}, + spell_frenzy, TAR_CHAR_DEFENSIVE, POS_STANDING, + NULL, SLOT(504), 30, 24, + "", "Your rage ebbs.", "" + }, + + { + "gate", { 27, 17, 32, 28 }, { 1, 1, 2, 2}, + spell_gate, TAR_IGNORE, POS_FIGHTING, + NULL, SLOT(83), 80, 12, + "", "!Gate!", "" + }, + + { + "giant strength", { 11, 53, 22, 20 }, { 1, 1, 2, 2}, + spell_giant_strength, TAR_CHAR_DEFENSIVE, POS_STANDING, + NULL, SLOT(39), 20, 12, + "", "You feel weaker.", "" + }, + + { + "harm", { 53, 23, 53, 28 }, { 1, 1, 2, 2}, + spell_harm, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT(27), 35, 12, + "harm spell", "!Harm!, """ + }, + + { + "haste", { 21, 53, 26, 29 }, { 1, 1, 2, 2}, + spell_haste, TAR_CHAR_DEFENSIVE, POS_FIGHTING, + NULL, SLOT(502), 30, 12, + "", "You feel yourself slow down.", "" + }, + + { + "heal", { 53, 21, 33, 30 }, { 1, 1, 2, 2}, + spell_heal, TAR_CHAR_DEFENSIVE, POS_FIGHTING, + NULL, SLOT(28), 50, 12, + "", "!Heal!", "" + }, + + { + "heat metal", { 53, 16, 53, 23 }, { 1, 1, 2, 2 }, + spell_heat_metal, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT(516), 25, 18, + "spell", "!Heat Metal!", "" + }, + + { + "holy word", { 53, 36, 53, 42 }, { 2, 2, 4, 4}, + spell_holy_word, TAR_IGNORE, POS_FIGHTING, + NULL, SLOT(506), 200, 24, + "divine wrath", "!Holy Word!", "" + }, + + { + "identify", { 15, 16, 18, 53 }, { 1, 1, 2, 2}, + spell_identify, TAR_OBJ_INV, POS_STANDING, + NULL, SLOT(53), 12, 24, + "", "!Identify!", "" + }, + + { + "infravision", { 9, 13, 10, 16 }, { 1, 1, 2, 2}, + spell_infravision, TAR_CHAR_DEFENSIVE, POS_STANDING, + NULL, SLOT(77), 5, 18, + "", "You no longer see in the dark.", "" + }, + + { + "invisibility", { 5, 53, 9, 53 }, { 1, 1, 2, 2}, + spell_invis, TAR_OBJ_CHAR_DEF, POS_STANDING, + &gsn_invis, SLOT(29), 5, 12, + "", "You are no longer invisible.", + "$p fades into view." + }, + + { + "know alignment", { 12, 9, 20, 53 }, { 1, 1, 2, 2}, + spell_know_alignment, TAR_CHAR_DEFENSIVE, POS_FIGHTING, + NULL, SLOT(58), 9, 12, + "", "!Know Alignment!", "" + }, + + { + "lightning bolt", { 13, 23, 18, 16 }, { 1, 1, 2, 2}, + spell_lightning_bolt, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT(30), 15, 12, + "lightning bolt", "!Lightning Bolt!", "" + }, + + { + "locate object", { 9, 15, 11, 53 }, { 1, 1, 2, 2}, + spell_locate_object, TAR_IGNORE, POS_STANDING, + NULL, SLOT(31), 20, 18, + "", "!Locate Object!", "" + }, + + { + "magic missile", { 1, 53, 2, 2 }, { 1, 1, 2, 2}, + spell_magic_missile, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT(32), 15, 12, + "magic missile", "!Magic Missile!", "" + }, + + { + "mass healing", { 53, 38, 53, 46 }, { 2, 2, 4, 4}, + spell_mass_healing, TAR_IGNORE, POS_STANDING, + NULL, SLOT(508), 100, 36, + "", "!Mass Healing!", "" + }, + + { + "mass invis", { 22, 25, 31, 53 }, { 1, 1, 2, 2}, + spell_mass_invis, TAR_IGNORE, POS_STANDING, + &gsn_mass_invis, SLOT(69), 20, 24, + "", "You are no longer invisible.", "" + }, + + { + "nexus", { 40, 35, 50, 45 }, { 2, 2, 4, 4}, + spell_nexus, TAR_IGNORE, POS_STANDING, + NULL, SLOT(520), 150, 36, + "", "!Nexus!", "" + }, + + { + "pass door", { 24, 32, 25, 37 }, { 1, 1, 2, 2}, + spell_pass_door, TAR_CHAR_SELF, POS_STANDING, + NULL, SLOT(74), 20, 12, + "", "You feel solid again.", "" + }, + + { + "plague", { 23, 17, 36, 26 }, { 1, 1, 2, 2}, + spell_plague, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + &gsn_plague, SLOT(503), 20, 12, + "sickness", "Your sores vanish.", "" + }, + + { + "poison", { 17, 12, 15, 21 }, { 1, 1, 2, 2}, + spell_poison, TAR_OBJ_CHAR_OFF, POS_FIGHTING, + &gsn_poison, SLOT(33), 10, 12, + "poison", "You feel less sick.", + "The poison on $p dries up." + }, + + { + "portal", { 35, 30, 45, 40 }, { 2, 2, 4, 4}, + spell_portal, TAR_IGNORE, POS_STANDING, + NULL, SLOT(519), 100, 24, + "", "!Portal!", "" + }, + + { + "protection evil", { 12, 9, 17, 11 }, { 1, 1, 2, 2}, + spell_protection_evil, TAR_CHAR_SELF, POS_STANDING, + NULL, SLOT(34), 5, 12, + "", "You feel less protected.", "" + }, + + { + "protection good", { 12, 9, 17, 11 }, { 1, 1, 2, 2}, + spell_protection_good, TAR_CHAR_SELF, POS_STANDING, + NULL, SLOT(514), 5, 12, + "", "You feel less protected.", "" + }, + + { + "ray of truth", { 53, 35, 53, 47 }, { 1, 1, 2, 2}, + spell_ray_of_truth, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT(518), 20, 12, + "ray of truth", "!Ray of Truth!", "" + }, + + { + "recharge", { 9, 53, 53, 53 }, { 1, 1, 2, 2 }, + spell_recharge, TAR_OBJ_INV, POS_STANDING, + NULL, SLOT(517), 60, 24, + "", "!Recharge!", "" + }, + + { + "refresh", { 8, 5, 12, 9 }, { 1, 1, 2, 2}, + spell_refresh, TAR_CHAR_DEFENSIVE, POS_STANDING, + NULL, SLOT(81), 12, 18, + "refresh", "!Refresh!", "" + }, + + { + "remove curse", { 53, 18, 53, 22 }, { 1, 1, 2, 2}, + spell_remove_curse, TAR_OBJ_CHAR_DEF, POS_STANDING, + NULL, SLOT(35), 5, 12, + "", "!Remove Curse!", "" + }, + + { + "sanctuary", { 36, 20, 42, 30 }, { 1, 1, 2, 2}, + spell_sanctuary, TAR_CHAR_DEFENSIVE, POS_STANDING, + &gsn_sanctuary, SLOT(36), 75, 12, + "", "The white aura around your body fades.", + "" + }, + + { + "shield", { 20, 35, 35, 40 }, { 1, 1, 2, 2}, + spell_shield, TAR_CHAR_DEFENSIVE, POS_STANDING, + NULL, SLOT(67), 12, 18, + "", "Your force shield shimmers then fades away.", + "" + }, + + { + "shocking grasp", { 10, 53, 14, 13 }, { 1, 1, 2, 2}, + spell_shocking_grasp, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT(53), 15, 12, + "shocking grasp", "!Shocking Grasp!", "" + }, + + { + "sleep", { 10, 53, 11, 53 }, { 1, 1, 2, 2}, + spell_sleep, TAR_CHAR_OFFENSIVE, POS_STANDING, + &gsn_sleep, SLOT(38), 15, 12, + "", "You feel less tired.", "" + }, + + { + "slow", { 23, 30, 29, 32 }, { 1, 1, 2, 2}, + spell_slow, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT(515), 30, 12, + "", "You feel yourself speed up.", "" + }, + + { + "stone skin", { 25, 40, 40, 45 }, { 1, 1, 2, 2}, + spell_stone_skin, TAR_CHAR_SELF, POS_STANDING, + NULL, SLOT(66), 12, 18, + "", "Your skin feels soft again.", "" + }, + + { + "summon", { 24, 12, 29, 22 }, { 1, 1, 2, 2}, + spell_summon, TAR_IGNORE, POS_STANDING, + NULL, SLOT(40), 50, 12, + "", "!Summon!", "" + }, + + { + "teleport", { 13, 22, 25, 36 }, { 1, 1, 2, 2}, + spell_teleport, TAR_CHAR_SELF, POS_FIGHTING, + NULL, SLOT( 2), 35, 12, + "", "!Teleport!", "" + }, + + { + "ventriloquate", { 1, 53, 2, 53 }, { 1, 1, 2, 2}, + spell_ventriloquate, TAR_IGNORE, POS_STANDING, + NULL, SLOT(41), 5, 12, + "", "!Ventriloquate!", "" + }, + + { + "weaken", { 11, 14, 16, 17 }, { 1, 1, 2, 2}, + spell_weaken, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT(68), 20, 12, + "spell", "You feel stronger.", "" + }, + + { + "word of recall", { 32, 28, 40, 30 }, { 1, 1, 2, 2}, + spell_word_of_recall, TAR_CHAR_SELF, POS_RESTING, + NULL, SLOT(42), 5, 12, + "", "!Word of Recall!", "" + }, + +/* + * Dragon breath + */ + { + "acid breath", { 31, 32, 33, 34 }, { 1, 1, 2, 2}, + spell_acid_breath, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT(200), 100, 24, + "blast of acid", "!Acid Breath!", "" + }, + + { + "fire breath", { 40, 45, 50, 51 }, { 1, 1, 2, 2}, + spell_fire_breath, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT(201), 200, 24, + "blast of flame", "The smoke leaves your eyes.", "" + }, + + { + "frost breath", { 34, 36, 38, 40 }, { 1, 1, 2, 2}, + spell_frost_breath, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT(202), 125, 24, + "blast of frost", "!Frost Breath!", "" + }, + + { + "gas breath", { 39, 43, 47, 50 }, { 1, 1, 2, 2}, + spell_gas_breath, TAR_IGNORE, POS_FIGHTING, + NULL, SLOT(203), 175, 24, + "blast of gas", "!Gas Breath!", "" + }, + + { + "lightning breath", { 37, 40, 43, 46 }, { 1, 1, 2, 2}, + spell_lightning_breath, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT(204), 150, 24, + "blast of lightning", "!Lightning Breath!", "" + }, + +/* + * Spells for mega1.are from Glop/Erkenbrand. + */ + { + "general purpose", { 53, 53, 53, 53 }, { 0, 0, 0, 0 }, + spell_general_purpose, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT(401), 0, 12, + "general purpose ammo", "!General Purpose Ammo!", "" + }, + + { + "high explosive", { 53, 53, 53, 53 }, { 0, 0, 0, 0 }, + spell_high_explosive, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + NULL, SLOT(402), 0, 12, + "high explosive ammo", "!High Explosive Ammo!", "" + }, + + +/* combat and weapons skills */ + + + { + "axe", { 1, 1, 1, 1 }, { 6, 6, 5, 4}, + spell_null, TAR_IGNORE, POS_FIGHTING, + &gsn_axe, SLOT( 0), 0, 0, + "", "!Axe!", "" + }, + + { + "dagger", { 1, 1, 1, 1 }, { 2, 3, 2, 2}, + spell_null, TAR_IGNORE, POS_FIGHTING, + &gsn_dagger, SLOT( 0), 0, 0, + "", "!Dagger!", "" + }, + + { + "flail", { 1, 1, 1, 1 }, { 6, 3, 6, 4}, + spell_null, TAR_IGNORE, POS_FIGHTING, + &gsn_flail, SLOT( 0), 0, 0, + "", "!Flail!", "" + }, + + { + "mace", { 1, 1, 1, 1 }, { 5, 2, 3, 3}, + spell_null, TAR_IGNORE, POS_FIGHTING, + &gsn_mace, SLOT( 0), 0, 0, + "", "!Mace!", "" + }, + + { + "polearm", { 1, 1, 1, 1 }, { 6, 6, 6, 4}, + spell_null, TAR_IGNORE, POS_FIGHTING, + &gsn_polearm, SLOT( 0), 0, 0, + "", "!Polearm!", "" + }, + + { + "shield block", { 1, 1, 1, 1 }, { 6, 4, 6, 2}, + spell_null, TAR_IGNORE, POS_FIGHTING, + &gsn_shield_block, SLOT(0), 0, 0, + "", "!Shield!", "" + }, + + { + "spear", { 1, 1, 1, 1 }, { 4, 4, 4, 3}, + spell_null, TAR_IGNORE, POS_FIGHTING, + &gsn_spear, SLOT( 0), 0, 0, + "", "!Spear!", "" + }, + + { + "sword", { 1, 1, 1, 1}, { 5, 6, 3, 2}, + spell_null, TAR_IGNORE, POS_FIGHTING, + &gsn_sword, SLOT( 0), 0, 0, + "", "!sword!", "" + }, + + { + "whip", { 1, 1, 1, 1}, { 6, 5, 5, 4}, + spell_null, TAR_IGNORE, POS_FIGHTING, + &gsn_whip, SLOT( 0), 0, 0, + "", "!Whip!", "" + }, + + { + "backstab", { 53, 53, 1, 53 }, { 0, 0, 5, 0}, + spell_null, TAR_IGNORE, POS_STANDING, + &gsn_backstab, SLOT( 0), 0, 24, + "backstab", "!Backstab!", "" + }, + + { + "bash", { 53, 53, 53, 1 }, { 0, 0, 0, 4}, + spell_null, TAR_IGNORE, POS_FIGHTING, + &gsn_bash, SLOT( 0), 0, 24, + "bash", "!Bash!", "" + }, + + { + "berserk", { 53, 53, 53, 18 }, { 0, 0, 0, 5}, + spell_null, TAR_IGNORE, POS_FIGHTING, + &gsn_berserk, SLOT( 0), 0, 24, + "", "You feel your pulse slow down.", "" + }, + + { + "dirt kicking", { 53, 53, 3, 3 }, { 0, 0, 4, 4}, + spell_null, TAR_IGNORE, POS_FIGHTING, + &gsn_dirt, SLOT( 0), 0, 24, + "kicked dirt", "You rub the dirt out of your eyes.", "" + }, + + { + "disarm", { 53, 53, 12, 11 }, { 0, 0, 6, 4}, + spell_null, TAR_IGNORE, POS_FIGHTING, + &gsn_disarm, SLOT( 0), 0, 24, + "", "!Disarm!", "" + }, + + { + "dodge", { 20, 22, 1, 13 }, { 8, 8, 4, 6}, + spell_null, TAR_IGNORE, POS_FIGHTING, + &gsn_dodge, SLOT( 0), 0, 0, + "", "!Dodge!", "" + }, + + { + "enhanced damage", { 45, 30, 25, 1 }, { 10, 9, 5, 3}, + spell_null, TAR_IGNORE, POS_FIGHTING, + &gsn_enhanced_damage, SLOT( 0), 0, 0, + "", "!Enhanced Damage!", "" + }, + + { + "envenom", { 53, 53, 10, 53 }, { 0, 0, 4, 0 }, + spell_null, TAR_IGNORE, POS_RESTING, + &gsn_envenom, SLOT(0), 0, 36, + "", "!Envenom!", "" + }, + + { + "hand to hand", { 25, 10, 15, 6 }, { 8, 5, 6, 4}, + spell_null, TAR_IGNORE, POS_FIGHTING, + &gsn_hand_to_hand, SLOT( 0), 0, 0, + "", "!Hand to Hand!", "" + }, + + { + "kick", { 53, 12, 14, 8 }, { 0, 4, 6, 3}, + spell_null, TAR_CHAR_OFFENSIVE, POS_FIGHTING, + &gsn_kick, SLOT( 0), 0, 12, + "kick", "!Kick!", "" + }, + + { + "parry", { 22, 20, 13, 1 }, { 8, 8, 6, 4}, + spell_null, TAR_IGNORE, POS_FIGHTING, + &gsn_parry, SLOT( 0), 0, 0, + "", "!Parry!", "" + }, + + { + "rescue", { 53, 53, 53, 1 }, { 0, 0, 0, 4}, + spell_null, TAR_IGNORE, POS_FIGHTING, + &gsn_rescue, SLOT( 0), 0, 12, + "", "!Rescue!", "" + }, + + { + "trip", { 53, 53, 1, 15 }, { 0, 0, 4, 8}, + spell_null, TAR_IGNORE, POS_FIGHTING, + &gsn_trip, SLOT( 0), 0, 24, + "trip", "!Trip!", "" + }, + + { + "second attack", { 30, 24, 12, 5 }, { 10, 8, 5, 3}, + spell_null, TAR_IGNORE, POS_FIGHTING, + &gsn_second_attack, SLOT( 0), 0, 0, + "", "!Second Attack!", "" + }, + + { + "third attack", { 53, 53, 24, 12 }, { 0, 0, 10, 4}, + spell_null, TAR_IGNORE, POS_FIGHTING, + &gsn_third_attack, SLOT( 0), 0, 0, + "", "!Third Attack!", "" + }, + +/* non-combat skills */ + + { + "fast healing", { 15, 9, 16, 6 }, { 8, 5, 6, 4}, + spell_null, TAR_IGNORE, POS_SLEEPING, + &gsn_fast_healing, SLOT( 0), 0, 0, + "", "!Fast Healing!", "" + }, + + { + "haggle", { 7, 18, 1, 14 }, { 5, 8, 3, 6}, + spell_null, TAR_IGNORE, POS_RESTING, + &gsn_haggle, SLOT( 0), 0, 0, + "", "!Haggle!", "" + }, + + { + "hide", { 53, 53, 1, 12 }, { 0, 0, 4, 6}, + spell_null, TAR_IGNORE, POS_RESTING, + &gsn_hide, SLOT( 0), 0, 12, + "", "!Hide!", "" + }, + + { + "lore", { 10, 10, 6, 20 }, { 6, 6, 4, 8}, + spell_null, TAR_IGNORE, POS_RESTING, + &gsn_lore, SLOT( 0), 0, 36, + "", "!Lore!", "" + }, + + { + "meditation", { 6, 6, 15, 15 }, { 5, 5, 8, 8}, + spell_null, TAR_IGNORE, POS_SLEEPING, + &gsn_meditation, SLOT( 0), 0, 0, + "", "Meditation", "" + }, + + { + "peek", { 8, 21, 1, 14 }, { 5, 7, 3, 6}, + spell_null, TAR_IGNORE, POS_STANDING, + &gsn_peek, SLOT( 0), 0, 0, + "", "!Peek!", "" + }, + + { + "pick lock", { 25, 25, 7, 25 }, { 8, 8, 4, 8}, + spell_null, TAR_IGNORE, POS_STANDING, + &gsn_pick_lock, SLOT( 0), 0, 12, + "", "!Pick!", "" + }, + + { + "sneak", { 53, 53, 4, 10 }, { 0, 0, 4, 6}, + spell_null, TAR_IGNORE, POS_STANDING, + &gsn_sneak, SLOT( 0), 0, 12, + "", "You no longer feel stealthy.", "" + }, + + { + "steal", { 53, 53, 5, 53 }, { 0, 0, 4, 0}, + spell_null, TAR_IGNORE, POS_STANDING, + &gsn_steal, SLOT( 0), 0, 24, + "", "!Steal!", "" + }, + + { + "scrolls", { 1, 1, 1, 1 }, { 2, 3, 5, 8}, + spell_null, TAR_IGNORE, POS_STANDING, + &gsn_scrolls, SLOT( 0), 0, 24, + "", "!Scrolls!", "" + }, + + { + "staves", { 1, 1, 1, 1 }, { 2, 3, 5, 8}, + spell_null, TAR_IGNORE, POS_STANDING, + &gsn_staves, SLOT( 0), 0, 12, + "", "!Staves!", "" + }, + + { + "wands", { 1, 1, 1, 1 }, { 2, 3, 5, 8}, + spell_null, TAR_IGNORE, POS_STANDING, + &gsn_wands, SLOT( 0), 0, 12, + "", "!Wands!", "" + }, + + { + "recall", { 1, 1, 1, 1 }, { 2, 2, 2, 2}, + spell_null, TAR_IGNORE, POS_STANDING, + &gsn_recall, SLOT( 0), 0, 12, + "", "!Recall!", "" + } +}; + +const struct group_type group_table [MAX_GROUP] = +{ + + { + "rom basics", { 0, 0, 0, 0 }, + { "scrolls", "staves", "wands", "recall" } + }, + + { + "mage basics", { 0, -1, -1, -1 }, + { "dagger" } + }, + + { + "cleric basics", { -1, 0, -1, -1 }, + { "mace" } + }, + + { + "thief basics", { -1, -1, 0, -1 }, + { "dagger", "steal" } + }, + + { + "warrior basics", { -1, -1, -1, 0 }, + { "sword", "second attack" } + }, + + { + "mage default", { 40, -1, -1, -1 }, + { "lore", "beguiling", "combat", "detection", "enhancement", "illusion", + "maladictions", "protective", "transportation", "weather" } + }, + + { + "cleric default", { -1, 40, -1, -1 }, + { "flail", "attack", "creation", "curative", "benedictions", + "detection", "healing", "maladictions", "protective", "shield block", + "transportation", "weather" } + }, + + { + "thief default", { -1, -1, 40, -1 }, + { "mace", "sword", "backstab", "disarm", "dodge", "second attack", + "trip", "hide", "peek", "pick lock", "sneak" } + }, + + { + "warrior default", { -1, -1, -1, 40 }, + { "weaponsmaster", "shield block", "bash", "disarm", "enhanced damage", + "parry", "rescue", "third attack" } + }, + + { + "weaponsmaster", { 40, 40, 40, 20 }, + { "axe", "dagger", "flail", "mace", "polearm", "spear", "sword","whip" } + }, + + { + "attack", { -1, 5, -1, 8 }, + { "demonfire", "dispel evil", "dispel good", "earthquake", + "flamestrike", "heat metal", "ray of truth" } + }, + + { + "beguiling", { 4, -1, 6, -1 }, + { "calm", "charm person", "sleep" } + }, + + { + "benedictions", { -1, 4, -1, 8 }, + { "bless", "calm", "frenzy", "holy word", "remove curse" } + }, + + { + "combat", { 6, -1, 10, 9 }, + { "acid blast", "burning hands", "chain lightning", "chill touch", + "colour spray", "fireball", "lightning bolt", "magic missile", + "shocking grasp" } + }, + + { + "creation", { 4, 4, 8, 8 }, + { "continual light", "create food", "create spring", "create water", + "create rose", "floating disc" } + }, + + { + "curative", { -1, 4, -1, 8 }, + { "cure blindness", "cure disease", "cure poison" } + }, + + { + "detection", { 4, 3, 6, -1 }, + { "detect evil", "detect good", "detect hidden", "detect invis", + "detect magic", "detect poison", "farsight", "identify", + "know alignment", "locate object" } + }, + + { + "draconian", { 8, -1, -1, -1 }, + { "acid breath", "fire breath", "frost breath", "gas breath", + "lightning breath" } + }, + + { + "enchantment", { 6, -1, -1, -1 }, + { "enchant armor", "enchant weapon", "fireproof", "recharge" } + }, + + { + "enhancement", { 5, -1, 9, 9 }, + { "giant strength", "haste", "infravision", "refresh" } + }, + + { + "harmful", { -1, 3, -1, 6 }, + { "cause critical", "cause light", "cause serious", "harm" } + }, + + { + "healing", { -1, 3, -1, 6 }, + { "cure critical", "cure light", "cure serious", "heal", + "mass healing", "refresh" } + }, + + { + "illusion", { 4, -1, 7, -1 }, + { "invis", "mass invis", "ventriloquate" } + }, + + { + "maladictions", { 5, 5, 9, 9 }, + { "blindness", "change sex", "curse", "energy drain", "plague", + "poison", "slow", "weaken" } + }, + + { + "protective", { 4, 4, 7, 8 }, + { "armor", "cancellation", "dispel magic", "fireproof", + "protection evil", "protection good", "sanctuary", "shield", + "stone skin" } + }, + + { + "transportation", { 4, 4, 8, 9 }, + { "fly", "gate", "nexus", "pass door", "portal", "summon", "teleport", + "word of recall" } + }, + + { + "weather", { 4, 4, 8, 8 }, + { "call lightning", "control weather", "faerie fire", "faerie fog", + "lightning bolt" } + } + + + +}; diff --git a/Rom24/src/db.c b/Rom24/src/db.c new file mode 100644 index 0000000..83b9712 --- /dev/null +++ b/Rom24/src/db.c @@ -0,0 +1,3372 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +#include +#include +#include +#include +#include +#if defined(macintosh) +#include +#else +#include +#include +#include +#endif + +#include "merc.h" +#include "db.h" +#include "recycle.h" +#include "music.h" +#include "lookup.h" + + +#if !defined(macintosh) +extern int _filbuf args( (FILE *) ); +#endif + +#if !defined(OLD_RAND) +#if !defined(linux) +long random(); +#endif +void srandom(unsigned int); +int getpid(); +time_t time(time_t *tloc); +#endif + + +/* externals for counting purposes */ +extern OBJ_DATA *obj_free; +extern CHAR_DATA *char_free; +extern DESCRIPTOR_DATA *descriptor_free; +extern PC_DATA *pcdata_free; +extern AFFECT_DATA *affect_free; + +/* + * Globals. + */ +HELP_DATA * help_first; +HELP_DATA * help_last; + +SHOP_DATA * shop_first; +SHOP_DATA * shop_last; + +NOTE_DATA * note_free; + +char bug_buf [2*MAX_INPUT_LENGTH]; +CHAR_DATA * char_list; +char * help_greeting; +char log_buf [2*MAX_INPUT_LENGTH]; +KILL_DATA kill_table [MAX_LEVEL]; +NOTE_DATA * note_list; +OBJ_DATA * object_list; +TIME_INFO_DATA time_info; +WEATHER_DATA weather_info; + +sh_int gsn_backstab; +sh_int gsn_dodge; +sh_int gsn_envenom; +sh_int gsn_hide; +sh_int gsn_peek; +sh_int gsn_pick_lock; +sh_int gsn_sneak; +sh_int gsn_steal; + +sh_int gsn_disarm; +sh_int gsn_enhanced_damage; +sh_int gsn_kick; +sh_int gsn_parry; +sh_int gsn_rescue; +sh_int gsn_second_attack; +sh_int gsn_third_attack; + +sh_int gsn_blindness; +sh_int gsn_charm_person; +sh_int gsn_curse; +sh_int gsn_invis; +sh_int gsn_mass_invis; +sh_int gsn_poison; +sh_int gsn_plague; +sh_int gsn_sleep; +sh_int gsn_sanctuary; +sh_int gsn_fly; +/* new gsns */ + +sh_int gsn_axe; +sh_int gsn_dagger; +sh_int gsn_flail; +sh_int gsn_mace; +sh_int gsn_polearm; +sh_int gsn_shield_block; +sh_int gsn_spear; +sh_int gsn_sword; +sh_int gsn_whip; + +sh_int gsn_bash; +sh_int gsn_berserk; +sh_int gsn_dirt; +sh_int gsn_hand_to_hand; +sh_int gsn_trip; + +sh_int gsn_fast_healing; +sh_int gsn_haggle; +sh_int gsn_lore; +sh_int gsn_meditation; + +sh_int gsn_scrolls; +sh_int gsn_staves; +sh_int gsn_wands; +sh_int gsn_recall; + + + +/* + * Locals. + */ +MOB_INDEX_DATA * mob_index_hash [MAX_KEY_HASH]; +OBJ_INDEX_DATA * obj_index_hash [MAX_KEY_HASH]; +ROOM_INDEX_DATA * room_index_hash [MAX_KEY_HASH]; +char * string_hash [MAX_KEY_HASH]; + +AREA_DATA * area_first; +AREA_DATA * area_last; + +char * string_space; +char * top_string; +char str_empty [1]; + +int top_affect; +int top_area; +int top_ed; +int top_exit; +int top_help; +int top_mob_index; +int top_obj_index; +int top_reset; +int top_room; +int top_shop; +int mobile_count = 0; +int newmobs = 0; +int newobjs = 0; + + +/* + * Memory management. + * Increase MAX_STRING if you have too. + * Tune the others only if you understand what you're doing. + */ +#define MAX_STRING 1413120 +#define MAX_PERM_BLOCK 131072 +#define MAX_MEM_LIST 11 + +void * rgFreeList [MAX_MEM_LIST]; +const int rgSizeList [MAX_MEM_LIST] = +{ + 16, 32, 64, 128, 256, 1024, 2048, 4096, 8192, 16384, 32768-64 +}; + +int nAllocString; +int sAllocString; +int nAllocPerm; +int sAllocPerm; + + + +/* + * Semi-locals. + */ +bool fBootDb; +FILE * fpArea; +char strArea[MAX_INPUT_LENGTH]; + + + +/* + * Local booting procedures. +*/ +void init_mm args( ( void ) ); +void load_area args( ( FILE *fp ) ); +void load_helps args( ( FILE *fp ) ); +void load_old_mob args( ( FILE *fp ) ); +void load_mobiles args( ( FILE *fp ) ); +void load_old_obj args( ( FILE *fp ) ); +void load_objects args( ( FILE *fp ) ); +void load_resets args( ( FILE *fp ) ); +void load_rooms args( ( FILE *fp ) ); +void load_shops args( ( FILE *fp ) ); +void load_socials args( ( FILE *fp ) ); +void load_specials args( ( FILE *fp ) ); +void load_notes args( ( void ) ); +void load_bans args( ( void ) ); + +void fix_exits args( ( void ) ); + +void reset_area args( ( AREA_DATA * pArea ) ); + +/* + * Big mama top level function. + */ +void boot_db( void ) +{ + + /* + * Init some data space stuff. + */ + { + if ( ( string_space = calloc( 1, MAX_STRING ) ) == NULL ) + { + bug( "Boot_db: can't alloc %d string space.", MAX_STRING ); + exit( 1 ); + } + top_string = string_space; + fBootDb = TRUE; + } + + /* + * Init random number generator. + */ + { + init_mm( ); + } + + /* + * Set time and weather. + */ + { + long lhour, lday, lmonth; + + lhour = (current_time - 650336715) + / (PULSE_TICK / PULSE_PER_SECOND); + time_info.hour = lhour % 24; + lday = lhour / 24; + time_info.day = lday % 35; + lmonth = lday / 35; + time_info.month = lmonth % 17; + time_info.year = lmonth / 17; + + if ( time_info.hour < 5 ) weather_info.sunlight = SUN_DARK; + else if ( time_info.hour < 6 ) weather_info.sunlight = SUN_RISE; + else if ( time_info.hour < 19 ) weather_info.sunlight = SUN_LIGHT; + else if ( time_info.hour < 20 ) weather_info.sunlight = SUN_SET; + else weather_info.sunlight = SUN_DARK; + + weather_info.change = 0; + weather_info.mmhg = 960; + if ( time_info.month >= 7 && time_info.month <=12 ) + weather_info.mmhg += number_range( 1, 50 ); + else + weather_info.mmhg += number_range( 1, 80 ); + + if ( weather_info.mmhg <= 980 ) weather_info.sky = SKY_LIGHTNING; + else if ( weather_info.mmhg <= 1000 ) weather_info.sky = SKY_RAINING; + else if ( weather_info.mmhg <= 1020 ) weather_info.sky = SKY_CLOUDY; + else weather_info.sky = SKY_CLOUDLESS; + + } + + /* + * Assign gsn's for skills which have them. + */ + { + int sn; + + for ( sn = 0; sn < MAX_SKILL; sn++ ) + { + if ( skill_table[sn].pgsn != NULL ) + *skill_table[sn].pgsn = sn; + } + } + + /* + * Read in all the area files. + */ + { + FILE *fpList; + + if ( ( fpList = fopen( AREA_LIST, "r" ) ) == NULL ) + { + perror( AREA_LIST ); + exit( 1 ); + } + + for ( ; ; ) + { + strcpy( strArea, fread_word( fpList ) ); + if ( strArea[0] == '$' ) + break; + + if ( strArea[0] == '-' ) + { + fpArea = stdin; + } + else + { + if ( ( fpArea = fopen( strArea, "r" ) ) == NULL ) + { + perror( strArea ); + exit( 1 ); + } + } + + for ( ; ; ) + { + char *word; + + if ( fread_letter( fpArea ) != '#' ) + { + bug( "Boot_db: # not found.", 0 ); + exit( 1 ); + } + + word = fread_word( fpArea ); + + if ( word[0] == '$' ) break; + else if ( !str_cmp( word, "AREA" ) ) load_area (fpArea); + else if ( !str_cmp( word, "HELPS" ) ) load_helps (fpArea); + else if ( !str_cmp( word, "MOBOLD" ) ) load_old_mob (fpArea); + else if ( !str_cmp( word, "MOBILES" ) ) load_mobiles (fpArea); + else if ( !str_cmp( word, "OBJOLD" ) ) load_old_obj (fpArea); + else if ( !str_cmp( word, "OBJECTS" ) ) load_objects (fpArea); + else if ( !str_cmp( word, "RESETS" ) ) load_resets (fpArea); + else if ( !str_cmp( word, "ROOMS" ) ) load_rooms (fpArea); + else if ( !str_cmp( word, "SHOPS" ) ) load_shops (fpArea); + else if ( !str_cmp( word, "SOCIALS" ) ) load_socials (fpArea); + else if ( !str_cmp( word, "SPECIALS" ) ) load_specials(fpArea); + else + { + bug( "Boot_db: bad section name.", 0 ); + exit( 1 ); + } + } + + if ( fpArea != stdin ) + fclose( fpArea ); + fpArea = NULL; + } + fclose( fpList ); + } + + /* + * Fix up exits. + * Declare db booting over. + * Reset all areas once. + * Load up the songs, notes and ban files. + */ + { + fix_exits( ); + fBootDb = FALSE; + area_update( ); + load_notes( ); + load_bans(); + load_songs(); + } + + return; +} + + + +/* + * Snarf an 'area' header line. + */ +void load_area( FILE *fp ) +{ + AREA_DATA *pArea; + + pArea = alloc_perm( sizeof(*pArea) ); + pArea->reset_first = NULL; + pArea->reset_last = NULL; + pArea->file_name = fread_string(fp); + pArea->name = fread_string( fp ); + pArea->credits = fread_string( fp ); + pArea->min_vnum = fread_number(fp); + pArea->max_vnum = fread_number(fp); + pArea->age = 15; + pArea->nplayer = 0; + pArea->empty = FALSE; + + if ( area_first == NULL ) + area_first = pArea; + if ( area_last != NULL ) + area_last->next = pArea; + area_last = pArea; + pArea->next = NULL; + + top_area++; + return; +} + + + +/* + * Snarf a help section. + */ +void load_helps( FILE *fp ) +{ + HELP_DATA *pHelp; + + for ( ; ; ) + { + pHelp = alloc_perm( sizeof(*pHelp) ); + pHelp->level = fread_number( fp ); + pHelp->keyword = fread_string( fp ); + if ( pHelp->keyword[0] == '$' ) + break; + pHelp->text = fread_string( fp ); + + if ( !str_cmp( pHelp->keyword, "greeting" ) ) + help_greeting = pHelp->text; + + if ( help_first == NULL ) + help_first = pHelp; + if ( help_last != NULL ) + help_last->next = pHelp; + + help_last = pHelp; + pHelp->next = NULL; + top_help++; + } + + return; +} + + + +/* + * Snarf a mob section. old style + */ +void load_old_mob( FILE *fp ) +{ + MOB_INDEX_DATA *pMobIndex; + /* for race updating */ + int race; + char name[MAX_STRING_LENGTH]; + + for ( ; ; ) + { + sh_int vnum; + char letter; + int iHash; + + letter = fread_letter( fp ); + if ( letter != '#' ) + { + bug( "Load_mobiles: # not found.", 0 ); + exit( 1 ); + } + + vnum = fread_number( fp ); + if ( vnum == 0 ) + break; + + fBootDb = FALSE; + if ( get_mob_index( vnum ) != NULL ) + { + bug( "Load_mobiles: vnum %d duplicated.", vnum ); + exit( 1 ); + } + fBootDb = TRUE; + + pMobIndex = alloc_perm( sizeof(*pMobIndex) ); + pMobIndex->vnum = vnum; + pMobIndex->new_format = FALSE; + pMobIndex->player_name = fread_string( fp ); + pMobIndex->short_descr = fread_string( fp ); + pMobIndex->long_descr = fread_string( fp ); + pMobIndex->description = fread_string( fp ); + + pMobIndex->long_descr[0] = UPPER(pMobIndex->long_descr[0]); + pMobIndex->description[0] = UPPER(pMobIndex->description[0]); + + pMobIndex->act = fread_flag( fp ) | ACT_IS_NPC; + pMobIndex->affected_by = fread_flag( fp ); + pMobIndex->pShop = NULL; + pMobIndex->alignment = fread_number( fp ); + letter = fread_letter( fp ); + pMobIndex->level = fread_number( fp ); + + /* + * The unused stuff is for imps who want to use the old-style + * stats-in-files method. + */ + fread_number( fp ); /* Unused */ + fread_number( fp ); /* Unused */ + fread_number( fp ); /* Unused */ + /* 'd' */ fread_letter( fp ); /* Unused */ + fread_number( fp ); /* Unused */ + /* '+' */ fread_letter( fp ); /* Unused */ + fread_number( fp ); /* Unused */ + fread_number( fp ); /* Unused */ + /* 'd' */ fread_letter( fp ); /* Unused */ + fread_number( fp ); /* Unused */ + /* '+' */ fread_letter( fp ); /* Unused */ + fread_number( fp ); /* Unused */ + pMobIndex->wealth = fread_number( fp )/20; + /* xp can't be used! */ fread_number( fp ); /* Unused */ + pMobIndex->start_pos = fread_number( fp ); /* Unused */ + pMobIndex->default_pos = fread_number( fp ); /* Unused */ + + if (pMobIndex->start_pos < POS_SLEEPING) + pMobIndex->start_pos = POS_STANDING; + if (pMobIndex->default_pos < POS_SLEEPING) + pMobIndex->default_pos = POS_STANDING; + + /* + * Back to meaningful values. + */ + pMobIndex->sex = fread_number( fp ); + + /* compute the race BS */ + one_argument(pMobIndex->player_name,name); + + if (name[0] == '\0' || (race = race_lookup(name)) == 0) + { + /* fill in with blanks */ + pMobIndex->race = race_lookup("human"); + pMobIndex->off_flags = OFF_DODGE|OFF_DISARM|OFF_TRIP|ASSIST_VNUM; + pMobIndex->imm_flags = 0; + pMobIndex->res_flags = 0; + pMobIndex->vuln_flags = 0; + pMobIndex->form = FORM_EDIBLE|FORM_SENTIENT|FORM_BIPED|FORM_MAMMAL; + pMobIndex->parts = PART_HEAD|PART_ARMS|PART_LEGS|PART_HEART| + PART_BRAINS|PART_GUTS; + } + else + { + pMobIndex->race = race; + pMobIndex->off_flags = OFF_DODGE|OFF_DISARM|OFF_TRIP|ASSIST_RACE| + race_table[race].off; + pMobIndex->imm_flags = race_table[race].imm; + pMobIndex->res_flags = race_table[race].res; + pMobIndex->vuln_flags = race_table[race].vuln; + pMobIndex->form = race_table[race].form; + pMobIndex->parts = race_table[race].parts; + } + + if ( letter != 'S' ) + { + bug( "Load_mobiles: vnum %d non-S.", vnum ); + exit( 1 ); + } + + iHash = vnum % MAX_KEY_HASH; + pMobIndex->next = mob_index_hash[iHash]; + mob_index_hash[iHash] = pMobIndex; + top_mob_index++; + kill_table[URANGE(0, pMobIndex->level, MAX_LEVEL-1)].number++; + } + + return; +} + +/* + * Snarf an obj section. old style + */ +void load_old_obj( FILE *fp ) +{ + OBJ_INDEX_DATA *pObjIndex; + + for ( ; ; ) + { + sh_int vnum; + char letter; + int iHash; + + letter = fread_letter( fp ); + if ( letter != '#' ) + { + bug( "Load_objects: # not found.", 0 ); + exit( 1 ); + } + + vnum = fread_number( fp ); + if ( vnum == 0 ) + break; + + fBootDb = FALSE; + if ( get_obj_index( vnum ) != NULL ) + { + bug( "Load_objects: vnum %d duplicated.", vnum ); + exit( 1 ); + } + fBootDb = TRUE; + + pObjIndex = alloc_perm( sizeof(*pObjIndex) ); + pObjIndex->vnum = vnum; + pObjIndex->new_format = FALSE; + pObjIndex->reset_num = 0; + pObjIndex->name = fread_string( fp ); + pObjIndex->short_descr = fread_string( fp ); + pObjIndex->description = fread_string( fp ); + /* Action description */ fread_string( fp ); + + pObjIndex->short_descr[0] = LOWER(pObjIndex->short_descr[0]); + pObjIndex->description[0] = UPPER(pObjIndex->description[0]); + pObjIndex->material = str_dup(""); + + pObjIndex->item_type = fread_number( fp ); + pObjIndex->extra_flags = fread_flag( fp ); + pObjIndex->wear_flags = fread_flag( fp ); + pObjIndex->value[0] = fread_number( fp ); + pObjIndex->value[1] = fread_number( fp ); + pObjIndex->value[2] = fread_number( fp ); + pObjIndex->value[3] = fread_number( fp ); + pObjIndex->value[4] = 0; + pObjIndex->level = 0; + pObjIndex->condition = 100; + pObjIndex->weight = fread_number( fp ); + pObjIndex->cost = fread_number( fp ); /* Unused */ + /* Cost per day */ fread_number( fp ); + + + if (pObjIndex->item_type == ITEM_WEAPON) + { + if (is_name("two",pObjIndex->name) + || is_name("two-handed",pObjIndex->name) + || is_name("claymore",pObjIndex->name)) + SET_BIT(pObjIndex->value[4],WEAPON_TWO_HANDS); + } + + for ( ; ; ) + { + char letter; + + letter = fread_letter( fp ); + + if ( letter == 'A' ) + { + AFFECT_DATA *paf; + + paf = alloc_perm( sizeof(*paf) ); + paf->where = TO_OBJECT; + paf->type = -1; + paf->level = 20; /* RT temp fix */ + paf->duration = -1; + paf->location = fread_number( fp ); + paf->modifier = fread_number( fp ); + paf->bitvector = 0; + paf->next = pObjIndex->affected; + pObjIndex->affected = paf; + top_affect++; + } + + else if ( letter == 'E' ) + { + EXTRA_DESCR_DATA *ed; + + ed = alloc_perm( sizeof(*ed) ); + ed->keyword = fread_string( fp ); + ed->description = fread_string( fp ); + ed->next = pObjIndex->extra_descr; + pObjIndex->extra_descr = ed; + top_ed++; + } + + else + { + ungetc( letter, fp ); + break; + } + } + + /* fix armors */ + if (pObjIndex->item_type == ITEM_ARMOR) + { + pObjIndex->value[1] = pObjIndex->value[0]; + pObjIndex->value[2] = pObjIndex->value[1]; + } + + /* + * Translate spell "slot numbers" to internal "skill numbers." + */ + switch ( pObjIndex->item_type ) + { + case ITEM_PILL: + case ITEM_POTION: + case ITEM_SCROLL: + pObjIndex->value[1] = slot_lookup( pObjIndex->value[1] ); + pObjIndex->value[2] = slot_lookup( pObjIndex->value[2] ); + pObjIndex->value[3] = slot_lookup( pObjIndex->value[3] ); + pObjIndex->value[4] = slot_lookup( pObjIndex->value[4] ); + break; + + case ITEM_STAFF: + case ITEM_WAND: + pObjIndex->value[3] = slot_lookup( pObjIndex->value[3] ); + break; + } + + iHash = vnum % MAX_KEY_HASH; + pObjIndex->next = obj_index_hash[iHash]; + obj_index_hash[iHash] = pObjIndex; + top_obj_index++; + } + + return; +} + + + + + +/* + * Snarf a reset section. + */ +void load_resets( FILE *fp ) +{ + RESET_DATA *pReset; + + if ( area_last == NULL ) + { + bug( "Load_resets: no #AREA seen yet.", 0 ); + exit( 1 ); + } + + for ( ; ; ) + { + ROOM_INDEX_DATA *pRoomIndex; + EXIT_DATA *pexit; + char letter; + OBJ_INDEX_DATA *temp_index; + + if ( ( letter = fread_letter( fp ) ) == 'S' ) + break; + + if ( letter == '*' ) + { + fread_to_eol( fp ); + continue; + } + + pReset = alloc_perm( sizeof(*pReset) ); + pReset->command = letter; + /* if_flag */ fread_number( fp ); + pReset->arg1 = fread_number( fp ); + pReset->arg2 = fread_number( fp ); + pReset->arg3 = (letter == 'G' || letter == 'R') + ? 0 : fread_number( fp ); + pReset->arg4 = (letter == 'P' || letter == 'M') + ? fread_number(fp) : 0; + fread_to_eol( fp ); + + /* + * Validate parameters. + * We're calling the index functions for the side effect. + */ + switch ( letter ) + { + default: + bug( "Load_resets: bad command '%c'.", letter ); + exit( 1 ); + break; + + case 'M': + get_mob_index ( pReset->arg1 ); + get_room_index ( pReset->arg3 ); + break; + + case 'O': + temp_index = get_obj_index ( pReset->arg1 ); + temp_index->reset_num++; + get_room_index ( pReset->arg3 ); + break; + + case 'P': + temp_index = get_obj_index ( pReset->arg1 ); + temp_index->reset_num++; + get_obj_index ( pReset->arg3 ); + break; + + case 'G': + case 'E': + temp_index = get_obj_index ( pReset->arg1 ); + temp_index->reset_num++; + break; + + case 'D': + pRoomIndex = get_room_index( pReset->arg1 ); + + if ( pReset->arg2 < 0 + || pReset->arg2 > 5 + || ( pexit = pRoomIndex->exit[pReset->arg2] ) == NULL + || !IS_SET( pexit->exit_info, EX_ISDOOR ) ) + { + bug( "Load_resets: 'D': exit %d not door.", pReset->arg2 ); + exit( 1 ); + } + + if ( pReset->arg3 < 0 || pReset->arg3 > 2 ) + { + bug( "Load_resets: 'D': bad 'locks': %d.", pReset->arg3 ); + exit( 1 ); + } + + break; + + case 'R': + pRoomIndex = get_room_index( pReset->arg1 ); + + if ( pReset->arg2 < 0 || pReset->arg2 > 6 ) + { + bug( "Load_resets: 'R': bad exit %d.", pReset->arg2 ); + exit( 1 ); + } + + break; + } + + if ( area_last->reset_first == NULL ) + area_last->reset_first = pReset; + if ( area_last->reset_last != NULL ) + area_last->reset_last->next = pReset; + + area_last->reset_last = pReset; + pReset->next = NULL; + top_reset++; + } + + return; +} + + + +/* + * Snarf a room section. + */ +void load_rooms( FILE *fp ) +{ + ROOM_INDEX_DATA *pRoomIndex; + + if ( area_last == NULL ) + { + bug( "Load_resets: no #AREA seen yet.", 0 ); + exit( 1 ); + } + + for ( ; ; ) + { + sh_int vnum; + char letter; + int door; + int iHash; + + letter = fread_letter( fp ); + if ( letter != '#' ) + { + bug( "Load_rooms: # not found.", 0 ); + exit( 1 ); + } + + vnum = fread_number( fp ); + if ( vnum == 0 ) + break; + + fBootDb = FALSE; + if ( get_room_index( vnum ) != NULL ) + { + bug( "Load_rooms: vnum %d duplicated.", vnum ); + exit( 1 ); + } + fBootDb = TRUE; + + pRoomIndex = alloc_perm( sizeof(*pRoomIndex) ); + pRoomIndex->owner = str_dup(""); + pRoomIndex->people = NULL; + pRoomIndex->contents = NULL; + pRoomIndex->extra_descr = NULL; + pRoomIndex->area = area_last; + pRoomIndex->vnum = vnum; + pRoomIndex->name = fread_string( fp ); + pRoomIndex->description = fread_string( fp ); + /* Area number */ fread_number( fp ); + pRoomIndex->room_flags = fread_flag( fp ); + /* horrible hack */ + if ( 3000 <= vnum && vnum < 3400) + SET_BIT(pRoomIndex->room_flags,ROOM_LAW); + pRoomIndex->sector_type = fread_number( fp ); + pRoomIndex->light = 0; + for ( door = 0; door <= 5; door++ ) + pRoomIndex->exit[door] = NULL; + + /* defaults */ + pRoomIndex->heal_rate = 100; + pRoomIndex->mana_rate = 100; + + for ( ; ; ) + { + letter = fread_letter( fp ); + + if ( letter == 'S' ) + break; + + if ( letter == 'H') /* healing room */ + pRoomIndex->heal_rate = fread_number(fp); + + else if ( letter == 'M') /* mana room */ + pRoomIndex->mana_rate = fread_number(fp); + + else if ( letter == 'C') /* clan */ + { + if (pRoomIndex->clan) + { + bug("Load_rooms: duplicate clan fields.",0); + exit(1); + } + pRoomIndex->clan = clan_lookup(fread_string(fp)); + } + + + else if ( letter == 'D' ) + { + EXIT_DATA *pexit; + int locks; + + door = fread_number( fp ); + if ( door < 0 || door > 5 ) + { + bug( "Fread_rooms: vnum %d has bad door number.", vnum ); + exit( 1 ); + } + + pexit = alloc_perm( sizeof(*pexit) ); + pexit->description = fread_string( fp ); + pexit->keyword = fread_string( fp ); + pexit->exit_info = 0; + locks = fread_number( fp ); + pexit->key = fread_number( fp ); + pexit->u1.vnum = fread_number( fp ); + + switch ( locks ) + { + case 1: pexit->exit_info = EX_ISDOOR; break; + case 2: pexit->exit_info = EX_ISDOOR | EX_PICKPROOF; break; + case 3: pexit->exit_info = EX_ISDOOR | EX_NOPASS; break; + case 4: pexit->exit_info = EX_ISDOOR|EX_NOPASS|EX_PICKPROOF; + break; + } + + pRoomIndex->exit[door] = pexit; + pRoomIndex->old_exit[door] = pexit; + top_exit++; + } + else if ( letter == 'E' ) + { + EXTRA_DESCR_DATA *ed; + + ed = alloc_perm( sizeof(*ed) ); + ed->keyword = fread_string( fp ); + ed->description = fread_string( fp ); + ed->next = pRoomIndex->extra_descr; + pRoomIndex->extra_descr = ed; + top_ed++; + } + + else if (letter == 'O') + { + if (pRoomIndex->owner[0] != '\0') + { + bug("Load_rooms: duplicate owner.",0); + exit(1); + } + + pRoomIndex->owner = fread_string(fp); + } + + else + { + bug( "Load_rooms: vnum %d has flag not 'DES'.", vnum ); + exit( 1 ); + } + } + + iHash = vnum % MAX_KEY_HASH; + pRoomIndex->next = room_index_hash[iHash]; + room_index_hash[iHash] = pRoomIndex; + top_room++; + } + + return; +} + + + +/* + * Snarf a shop section. + */ +void load_shops( FILE *fp ) +{ + SHOP_DATA *pShop; + + for ( ; ; ) + { + MOB_INDEX_DATA *pMobIndex; + int iTrade; + + pShop = alloc_perm( sizeof(*pShop) ); + pShop->keeper = fread_number( fp ); + if ( pShop->keeper == 0 ) + break; + for ( iTrade = 0; iTrade < MAX_TRADE; iTrade++ ) + pShop->buy_type[iTrade] = fread_number( fp ); + pShop->profit_buy = fread_number( fp ); + pShop->profit_sell = fread_number( fp ); + pShop->open_hour = fread_number( fp ); + pShop->close_hour = fread_number( fp ); + fread_to_eol( fp ); + pMobIndex = get_mob_index( pShop->keeper ); + pMobIndex->pShop = pShop; + + if ( shop_first == NULL ) + shop_first = pShop; + if ( shop_last != NULL ) + shop_last->next = pShop; + + shop_last = pShop; + pShop->next = NULL; + top_shop++; + } + + return; +} + + +/* + * Snarf spec proc declarations. + */ +void load_specials( FILE *fp ) +{ + for ( ; ; ) + { + MOB_INDEX_DATA *pMobIndex; + char letter; + + switch ( letter = fread_letter( fp ) ) + { + default: + bug( "Load_specials: letter '%c' not *MS.", letter ); + exit( 1 ); + + case 'S': + return; + + case '*': + break; + + case 'M': + pMobIndex = get_mob_index ( fread_number ( fp ) ); + pMobIndex->spec_fun = spec_lookup ( fread_word ( fp ) ); + if ( pMobIndex->spec_fun == 0 ) + { + bug( "Load_specials: 'M': vnum %d.", pMobIndex->vnum ); + exit( 1 ); + } + break; + } + + fread_to_eol( fp ); + } +} + + +/* + * Translate all room exits from virtual to real. + * Has to be done after all rooms are read in. + * Check for bad reverse exits. + */ +void fix_exits( void ) +{ + extern const sh_int rev_dir []; + char buf[MAX_STRING_LENGTH]; + ROOM_INDEX_DATA *pRoomIndex; + ROOM_INDEX_DATA *to_room; + EXIT_DATA *pexit; + EXIT_DATA *pexit_rev; + int iHash; + int door; + + for ( iHash = 0; iHash < MAX_KEY_HASH; iHash++ ) + { + for ( pRoomIndex = room_index_hash[iHash]; + pRoomIndex != NULL; + pRoomIndex = pRoomIndex->next ) + { + bool fexit; + + fexit = FALSE; + for ( door = 0; door <= 5; door++ ) + { + if ( ( pexit = pRoomIndex->exit[door] ) != NULL ) + { + if ( pexit->u1.vnum <= 0 + || get_room_index(pexit->u1.vnum) == NULL) + pexit->u1.to_room = NULL; + else + { + fexit = TRUE; + pexit->u1.to_room = get_room_index( pexit->u1.vnum ); + } + } + } + if (!fexit) + SET_BIT(pRoomIndex->room_flags,ROOM_NO_MOB); + } + } + + for ( iHash = 0; iHash < MAX_KEY_HASH; iHash++ ) + { + for ( pRoomIndex = room_index_hash[iHash]; + pRoomIndex != NULL; + pRoomIndex = pRoomIndex->next ) + { + for ( door = 0; door <= 5; door++ ) + { + if ( ( pexit = pRoomIndex->exit[door] ) != NULL + && ( to_room = pexit->u1.to_room ) != NULL + && ( pexit_rev = to_room->exit[rev_dir[door]] ) != NULL + && pexit_rev->u1.to_room != pRoomIndex + && (pRoomIndex->vnum < 1200 || pRoomIndex->vnum > 1299)) + { + sprintf( buf, "Fix_exits: %d:%d -> %d:%d -> %d.", + pRoomIndex->vnum, door, + to_room->vnum, rev_dir[door], + (pexit_rev->u1.to_room == NULL) + ? 0 : pexit_rev->u1.to_room->vnum ); + bug( buf, 0 ); + } + } + } + } + + return; +} + + + +/* + * Repopulate areas periodically. + */ +void area_update( void ) +{ + AREA_DATA *pArea; + char buf[MAX_STRING_LENGTH]; + + for ( pArea = area_first; pArea != NULL; pArea = pArea->next ) + { + + if ( ++pArea->age < 3 ) + continue; + + /* + * Check age and reset. + * Note: Mud School resets every 3 minutes (not 15). + */ + if ( (!pArea->empty && (pArea->nplayer == 0 || pArea->age >= 15)) + || pArea->age >= 31) + { + ROOM_INDEX_DATA *pRoomIndex; + + reset_area( pArea ); + sprintf(buf,"%s has just been reset.",pArea->name); + wiznet(buf,NULL,NULL,WIZ_RESETS,0,0); + + pArea->age = number_range( 0, 3 ); + pRoomIndex = get_room_index( ROOM_VNUM_SCHOOL ); + if ( pRoomIndex != NULL && pArea == pRoomIndex->area ) + pArea->age = 15 - 2; + else if (pArea->nplayer == 0) + pArea->empty = TRUE; + } + } + + return; +} + + + +/* + * Reset one area. + */ +void reset_area( AREA_DATA *pArea ) +{ + RESET_DATA *pReset; + CHAR_DATA *mob; + bool last; + int level; + + mob = NULL; + last = TRUE; + level = 0; + for ( pReset = pArea->reset_first; pReset != NULL; pReset = pReset->next ) + { + ROOM_INDEX_DATA *pRoomIndex; + MOB_INDEX_DATA *pMobIndex; + OBJ_INDEX_DATA *pObjIndex; + OBJ_INDEX_DATA *pObjToIndex; + EXIT_DATA *pexit; + OBJ_DATA *obj; + OBJ_DATA *obj_to; + int count, limit; + + switch ( pReset->command ) + { + default: + bug( "Reset_area: bad command %c.", pReset->command ); + break; + + case 'M': + if ( ( pMobIndex = get_mob_index( pReset->arg1 ) ) == NULL ) + { + bug( "Reset_area: 'M': bad vnum %d.", pReset->arg1 ); + continue; + } + + if ( ( pRoomIndex = get_room_index( pReset->arg3 ) ) == NULL ) + { + bug( "Reset_area: 'R': bad vnum %d.", pReset->arg3 ); + continue; + } + + if ( pMobIndex->count >= pReset->arg2 ) + { + last = FALSE; + break; + } + + count = 0; + for (mob = pRoomIndex->people; mob != NULL; mob = mob->next_in_room) + if (mob->pIndexData == pMobIndex) + { + count++; + if (count >= pReset->arg4) + { + last = FALSE; + break; + } + } + + if (count >= pReset->arg4) + break; + + mob = create_mobile( pMobIndex ); + + /* + * Check for pet shop. + */ + { + ROOM_INDEX_DATA *pRoomIndexPrev; + pRoomIndexPrev = get_room_index( pRoomIndex->vnum - 1 ); + if ( pRoomIndexPrev != NULL + && IS_SET(pRoomIndexPrev->room_flags, ROOM_PET_SHOP) ) + SET_BIT(mob->act, ACT_PET); + } + + /* set area */ + mob->zone = pRoomIndex->area; + + char_to_room( mob, pRoomIndex ); + level = URANGE( 0, mob->level - 2, LEVEL_HERO - 1 ); + last = TRUE; + break; + + case 'O': + if ( ( pObjIndex = get_obj_index( pReset->arg1 ) ) == NULL ) + { + bug( "Reset_area: 'O': bad vnum %d.", pReset->arg1 ); + continue; + } + + if ( ( pRoomIndex = get_room_index( pReset->arg3 ) ) == NULL ) + { + bug( "Reset_area: 'R': bad vnum %d.", pReset->arg3 ); + continue; + } + + if ( pArea->nplayer > 0 + || count_obj_list( pObjIndex, pRoomIndex->contents ) > 0 ) + { + last = FALSE; + break; + } + + obj = create_object( pObjIndex, UMIN(number_fuzzy(level), + LEVEL_HERO - 1) ); + obj->cost = 0; + obj_to_room( obj, pRoomIndex ); + last = TRUE; + break; + + case 'P': + if ( ( pObjIndex = get_obj_index( pReset->arg1 ) ) == NULL ) + { + bug( "Reset_area: 'P': bad vnum %d.", pReset->arg1 ); + continue; + } + + if ( ( pObjToIndex = get_obj_index( pReset->arg3 ) ) == NULL ) + { + bug( "Reset_area: 'P': bad vnum %d.", pReset->arg3 ); + continue; + } + + if (pReset->arg2 > 50) /* old format */ + limit = 6; + else if (pReset->arg2 == -1) /* no limit */ + limit = 999; + else + limit = pReset->arg2; + + if (pArea->nplayer > 0 + || (obj_to = get_obj_type( pObjToIndex ) ) == NULL + || (obj_to->in_room == NULL && !last) + || ( pObjIndex->count >= limit && number_range(0,4) != 0) + || (count = count_obj_list(pObjIndex,obj_to->contains)) + > pReset->arg4 ) + { + last = FALSE; + break; + } + + while (count < pReset->arg4) + { + obj = create_object( pObjIndex, number_fuzzy(obj_to->level) ); + obj_to_obj( obj, obj_to ); + count++; + if (pObjIndex->count >= limit) + break; + } + /* fix object lock state! */ + obj_to->value[1] = obj_to->pIndexData->value[1]; + last = TRUE; + break; + + case 'G': + case 'E': + if ( ( pObjIndex = get_obj_index( pReset->arg1 ) ) == NULL ) + { + bug( "Reset_area: 'E' or 'G': bad vnum %d.", pReset->arg1 ); + continue; + } + + if ( !last ) + break; + + if ( mob == NULL ) + { + bug( "Reset_area: 'E' or 'G': null mob for vnum %d.", + pReset->arg1 ); + last = FALSE; + break; + } + + if ( mob->pIndexData->pShop != NULL ) + { + int olevel = 0,i,j; + + if (!pObjIndex->new_format) + switch ( pObjIndex->item_type ) + { + case ITEM_PILL: + case ITEM_POTION: + case ITEM_SCROLL: + olevel = 53; + for (i = 1; i < 5; i++) + { + if (pObjIndex->value[i] > 0) + { + for (j = 0; j < MAX_CLASS; j++) + { + olevel = UMIN(olevel, + skill_table[pObjIndex->value[i]]. + skill_level[j]); + } + } + } + + olevel = UMAX(0,(olevel * 3 / 4) - 2); + break; + case ITEM_WAND: olevel = number_range( 10, 20 ); break; + case ITEM_STAFF: olevel = number_range( 15, 25 ); break; + case ITEM_ARMOR: olevel = number_range( 5, 15 ); break; + case ITEM_WEAPON: olevel = number_range( 5, 15 ); break; + case ITEM_TREASURE: olevel = number_range( 10, 20 ); break; + } + + obj = create_object( pObjIndex, olevel ); + SET_BIT( obj->extra_flags, ITEM_INVENTORY ); + } + + else + { + if (pReset->arg2 > 50) /* old format */ + limit = 6; + else if (pReset->arg2 == -1) /* no limit */ + limit = 999; + else + limit = pReset->arg2; + + if (pObjIndex->count < limit || number_range(0,4) == 0) + { + obj=create_object(pObjIndex,UMIN(number_fuzzy(level), + LEVEL_HERO - 1)); + /* error message if it is too high */ + if (obj->level > mob->level + 3 + || (obj->item_type == ITEM_WEAPON + && pReset->command == 'E' + && obj->level < mob->level -5 && obj->level < 45)) + fprintf(stderr, + "Err: obj %s (%d) -- %d, mob %s (%d) -- %d\n", + obj->short_descr,obj->pIndexData->vnum,obj->level, + mob->short_descr,mob->pIndexData->vnum,mob->level); + } + else + break; + } + obj_to_char( obj, mob ); + if ( pReset->command == 'E' ) + equip_char( mob, obj, pReset->arg3 ); + last = TRUE; + break; + + case 'D': + if ( ( pRoomIndex = get_room_index( pReset->arg1 ) ) == NULL ) + { + bug( "Reset_area: 'D': bad vnum %d.", pReset->arg1 ); + continue; + } + + if ( ( pexit = pRoomIndex->exit[pReset->arg2] ) == NULL ) + break; + + switch ( pReset->arg3 ) + { + case 0: + REMOVE_BIT( pexit->exit_info, EX_CLOSED ); + REMOVE_BIT( pexit->exit_info, EX_LOCKED ); + break; + + case 1: + SET_BIT( pexit->exit_info, EX_CLOSED ); + REMOVE_BIT( pexit->exit_info, EX_LOCKED ); + break; + + case 2: + SET_BIT( pexit->exit_info, EX_CLOSED ); + SET_BIT( pexit->exit_info, EX_LOCKED ); + break; + } + + last = TRUE; + break; + + case 'R': + if ( ( pRoomIndex = get_room_index( pReset->arg1 ) ) == NULL ) + { + bug( "Reset_area: 'R': bad vnum %d.", pReset->arg1 ); + continue; + } + + { + int d0; + int d1; + + for ( d0 = 0; d0 < pReset->arg2 - 1; d0++ ) + { + d1 = number_range( d0, pReset->arg2-1 ); + pexit = pRoomIndex->exit[d0]; + pRoomIndex->exit[d0] = pRoomIndex->exit[d1]; + pRoomIndex->exit[d1] = pexit; + } + } + break; + } + } + + return; +} + + + +/* + * Create an instance of a mobile. + */ +CHAR_DATA *create_mobile( MOB_INDEX_DATA *pMobIndex ) +{ + CHAR_DATA *mob; + int i; + AFFECT_DATA af; + + mobile_count++; + + if ( pMobIndex == NULL ) + { + bug( "Create_mobile: NULL pMobIndex.", 0 ); + exit( 1 ); + } + + mob = new_char(); + + mob->pIndexData = pMobIndex; + + mob->name = pMobIndex->player_name; + mob->id = get_mob_id(); + mob->short_descr = pMobIndex->short_descr; + mob->long_descr = pMobIndex->long_descr; + mob->description = pMobIndex->description; + mob->spec_fun = pMobIndex->spec_fun; + mob->prompt = NULL; + + if (pMobIndex->wealth == 0) + { + mob->silver = 0; + mob->gold = 0; + } + else + { + long wealth; + + wealth = number_range(pMobIndex->wealth/2, 3 * pMobIndex->wealth/2); + mob->gold = number_range(wealth/200,wealth/100); + mob->silver = wealth - (mob->gold * 100); + } + + if (pMobIndex->new_format) + /* load in new style */ + { + /* read from prototype */ + mob->group = pMobIndex->group; + mob->act = pMobIndex->act; + mob->comm = COMM_NOCHANNELS|COMM_NOSHOUT|COMM_NOTELL; + mob->affected_by = pMobIndex->affected_by; + mob->alignment = pMobIndex->alignment; + mob->level = pMobIndex->level; + mob->hitroll = pMobIndex->hitroll; + mob->damroll = pMobIndex->damage[DICE_BONUS]; + mob->max_hit = dice(pMobIndex->hit[DICE_NUMBER], + pMobIndex->hit[DICE_TYPE]) + + pMobIndex->hit[DICE_BONUS]; + mob->hit = mob->max_hit; + mob->max_mana = dice(pMobIndex->mana[DICE_NUMBER], + pMobIndex->mana[DICE_TYPE]) + + pMobIndex->mana[DICE_BONUS]; + mob->mana = mob->max_mana; + mob->damage[DICE_NUMBER]= pMobIndex->damage[DICE_NUMBER]; + mob->damage[DICE_TYPE] = pMobIndex->damage[DICE_TYPE]; + mob->dam_type = pMobIndex->dam_type; + if (mob->dam_type == 0) + switch(number_range(1,3)) + { + case (1): mob->dam_type = 3; break; /* slash */ + case (2): mob->dam_type = 7; break; /* pound */ + case (3): mob->dam_type = 11; break; /* pierce */ + } + for (i = 0; i < 4; i++) + mob->armor[i] = pMobIndex->ac[i]; + mob->off_flags = pMobIndex->off_flags; + mob->imm_flags = pMobIndex->imm_flags; + mob->res_flags = pMobIndex->res_flags; + mob->vuln_flags = pMobIndex->vuln_flags; + mob->start_pos = pMobIndex->start_pos; + mob->default_pos = pMobIndex->default_pos; + mob->sex = pMobIndex->sex; + if (mob->sex == 3) /* random sex */ + mob->sex = number_range(1,2); + mob->race = pMobIndex->race; + mob->form = pMobIndex->form; + mob->parts = pMobIndex->parts; + mob->size = pMobIndex->size; + mob->material = str_dup(pMobIndex->material); + + /* computed on the spot */ + + for (i = 0; i < MAX_STATS; i ++) + mob->perm_stat[i] = UMIN(25,11 + mob->level/4); + + if (IS_SET(mob->act,ACT_WARRIOR)) + { + mob->perm_stat[STAT_STR] += 3; + mob->perm_stat[STAT_INT] -= 1; + mob->perm_stat[STAT_CON] += 2; + } + + if (IS_SET(mob->act,ACT_THIEF)) + { + mob->perm_stat[STAT_DEX] += 3; + mob->perm_stat[STAT_INT] += 1; + mob->perm_stat[STAT_WIS] -= 1; + } + + if (IS_SET(mob->act,ACT_CLERIC)) + { + mob->perm_stat[STAT_WIS] += 3; + mob->perm_stat[STAT_DEX] -= 1; + mob->perm_stat[STAT_STR] += 1; + } + + if (IS_SET(mob->act,ACT_MAGE)) + { + mob->perm_stat[STAT_INT] += 3; + mob->perm_stat[STAT_STR] -= 1; + mob->perm_stat[STAT_DEX] += 1; + } + + if (IS_SET(mob->off_flags,OFF_FAST)) + mob->perm_stat[STAT_DEX] += 2; + + mob->perm_stat[STAT_STR] += mob->size - SIZE_MEDIUM; + mob->perm_stat[STAT_CON] += (mob->size - SIZE_MEDIUM) / 2; + + /* let's get some spell action */ + if (IS_AFFECTED(mob,AFF_SANCTUARY)) + { + af.where = TO_AFFECTS; + af.type = skill_lookup("sanctuary"); + af.level = mob->level; + af.duration = -1; + af.location = APPLY_NONE; + af.modifier = 0; + af.bitvector = AFF_SANCTUARY; + affect_to_char( mob, &af ); + } + + if (IS_AFFECTED(mob,AFF_HASTE)) + { + af.where = TO_AFFECTS; + af.type = skill_lookup("haste"); + af.level = mob->level; + af.duration = -1; + af.location = APPLY_DEX; + af.modifier = 1 + (mob->level >= 18) + (mob->level >= 25) + + (mob->level >= 32); + af.bitvector = AFF_HASTE; + affect_to_char( mob, &af ); + } + + if (IS_AFFECTED(mob,AFF_PROTECT_EVIL)) + { + af.where = TO_AFFECTS; + af.type = skill_lookup("protection evil"); + af.level = mob->level; + af.duration = -1; + af.location = APPLY_SAVES; + af.modifier = -1; + af.bitvector = AFF_PROTECT_EVIL; + affect_to_char(mob,&af); + } + + if (IS_AFFECTED(mob,AFF_PROTECT_GOOD)) + { + af.where = TO_AFFECTS; + af.type = skill_lookup("protection good"); + af.level = mob->level; + af.duration = -1; + af.location = APPLY_SAVES; + af.modifier = -1; + af.bitvector = AFF_PROTECT_GOOD; + affect_to_char(mob,&af); + } + } + else /* read in old format and convert */ + { + mob->act = pMobIndex->act; + mob->affected_by = pMobIndex->affected_by; + mob->alignment = pMobIndex->alignment; + mob->level = pMobIndex->level; + mob->hitroll = pMobIndex->hitroll; + mob->damroll = 0; + mob->max_hit = mob->level * 8 + number_range( + mob->level * mob->level/4, + mob->level * mob->level); + mob->max_hit *= .9; + mob->hit = mob->max_hit; + mob->max_mana = 100 + dice(mob->level,10); + mob->mana = mob->max_mana; + switch(number_range(1,3)) + { + case (1): mob->dam_type = 3; break; /* slash */ + case (2): mob->dam_type = 7; break; /* pound */ + case (3): mob->dam_type = 11; break; /* pierce */ + } + for (i = 0; i < 3; i++) + mob->armor[i] = interpolate(mob->level,100,-100); + mob->armor[3] = interpolate(mob->level,100,0); + mob->race = pMobIndex->race; + mob->off_flags = pMobIndex->off_flags; + mob->imm_flags = pMobIndex->imm_flags; + mob->res_flags = pMobIndex->res_flags; + mob->vuln_flags = pMobIndex->vuln_flags; + mob->start_pos = pMobIndex->start_pos; + mob->default_pos = pMobIndex->default_pos; + mob->sex = pMobIndex->sex; + mob->form = pMobIndex->form; + mob->parts = pMobIndex->parts; + mob->size = SIZE_MEDIUM; + mob->material = ""; + + for (i = 0; i < MAX_STATS; i ++) + mob->perm_stat[i] = 11 + mob->level/4; + } + + mob->position = mob->start_pos; + + + /* link the mob to the world list */ + mob->next = char_list; + char_list = mob; + pMobIndex->count++; + return mob; +} + +/* duplicate a mobile exactly -- except inventory */ +void clone_mobile(CHAR_DATA *parent, CHAR_DATA *clone) +{ + int i; + AFFECT_DATA *paf; + + if ( parent == NULL || clone == NULL || !IS_NPC(parent)) + return; + + /* start fixing values */ + clone->name = str_dup(parent->name); + clone->version = parent->version; + clone->short_descr = str_dup(parent->short_descr); + clone->long_descr = str_dup(parent->long_descr); + clone->description = str_dup(parent->description); + clone->group = parent->group; + clone->sex = parent->sex; + clone->class = parent->class; + clone->race = parent->race; + clone->level = parent->level; + clone->trust = 0; + clone->timer = parent->timer; + clone->wait = parent->wait; + clone->hit = parent->hit; + clone->max_hit = parent->max_hit; + clone->mana = parent->mana; + clone->max_mana = parent->max_mana; + clone->move = parent->move; + clone->max_move = parent->max_move; + clone->gold = parent->gold; + clone->silver = parent->silver; + clone->exp = parent->exp; + clone->act = parent->act; + clone->comm = parent->comm; + clone->imm_flags = parent->imm_flags; + clone->res_flags = parent->res_flags; + clone->vuln_flags = parent->vuln_flags; + clone->invis_level = parent->invis_level; + clone->affected_by = parent->affected_by; + clone->position = parent->position; + clone->practice = parent->practice; + clone->train = parent->train; + clone->saving_throw = parent->saving_throw; + clone->alignment = parent->alignment; + clone->hitroll = parent->hitroll; + clone->damroll = parent->damroll; + clone->wimpy = parent->wimpy; + clone->form = parent->form; + clone->parts = parent->parts; + clone->size = parent->size; + clone->material = str_dup(parent->material); + clone->off_flags = parent->off_flags; + clone->dam_type = parent->dam_type; + clone->start_pos = parent->start_pos; + clone->default_pos = parent->default_pos; + clone->spec_fun = parent->spec_fun; + + for (i = 0; i < 4; i++) + clone->armor[i] = parent->armor[i]; + + for (i = 0; i < MAX_STATS; i++) + { + clone->perm_stat[i] = parent->perm_stat[i]; + clone->mod_stat[i] = parent->mod_stat[i]; + } + + for (i = 0; i < 3; i++) + clone->damage[i] = parent->damage[i]; + + /* now add the affects */ + for (paf = parent->affected; paf != NULL; paf = paf->next) + affect_to_char(clone,paf); + +} + + + + +/* + * Create an instance of an object. + */ +OBJ_DATA *create_object( OBJ_INDEX_DATA *pObjIndex, int level ) +{ + AFFECT_DATA *paf; + OBJ_DATA *obj; + int i; + + if ( pObjIndex == NULL ) + { + bug( "Create_object: NULL pObjIndex.", 0 ); + exit( 1 ); + } + + obj = new_obj(); + + obj->pIndexData = pObjIndex; + obj->in_room = NULL; + obj->enchanted = FALSE; + + if (pObjIndex->new_format) + obj->level = pObjIndex->level; + else + obj->level = UMAX(0,level); + obj->wear_loc = -1; + + obj->name = pObjIndex->name; + obj->short_descr = pObjIndex->short_descr; + obj->description = pObjIndex->description; + obj->material = str_dup(pObjIndex->material); + obj->item_type = pObjIndex->item_type; + obj->extra_flags = pObjIndex->extra_flags; + obj->wear_flags = pObjIndex->wear_flags; + obj->value[0] = pObjIndex->value[0]; + obj->value[1] = pObjIndex->value[1]; + obj->value[2] = pObjIndex->value[2]; + obj->value[3] = pObjIndex->value[3]; + obj->value[4] = pObjIndex->value[4]; + obj->weight = pObjIndex->weight; + + if (level == -1 || pObjIndex->new_format) + obj->cost = pObjIndex->cost; + else + obj->cost = number_fuzzy( 10 ) + * number_fuzzy( level ) * number_fuzzy( level ); + + /* + * Mess with object properties. + */ + switch ( obj->item_type ) + { + default: + bug( "Read_object: vnum %d bad type.", pObjIndex->vnum ); + break; + + case ITEM_LIGHT: + if (obj->value[2] == 999) + obj->value[2] = -1; + break; + + case ITEM_FURNITURE: + case ITEM_TRASH: + case ITEM_CONTAINER: + case ITEM_DRINK_CON: + case ITEM_KEY: + case ITEM_FOOD: + case ITEM_BOAT: + case ITEM_CORPSE_NPC: + case ITEM_CORPSE_PC: + case ITEM_FOUNTAIN: + case ITEM_MAP: + case ITEM_CLOTHING: + case ITEM_PORTAL: + if (!pObjIndex->new_format) + obj->cost /= 5; + break; + + case ITEM_TREASURE: + case ITEM_WARP_STONE: + case ITEM_ROOM_KEY: + case ITEM_GEM: + case ITEM_JEWELRY: + break; + + case ITEM_JUKEBOX: + for (i = 0; i < 5; i++) + obj->value[i] = -1; + break; + + case ITEM_SCROLL: + if (level != -1 && !pObjIndex->new_format) + obj->value[0] = number_fuzzy( obj->value[0] ); + break; + + case ITEM_WAND: + case ITEM_STAFF: + if (level != -1 && !pObjIndex->new_format) + { + obj->value[0] = number_fuzzy( obj->value[0] ); + obj->value[1] = number_fuzzy( obj->value[1] ); + obj->value[2] = obj->value[1]; + } + if (!pObjIndex->new_format) + obj->cost *= 2; + break; + + case ITEM_WEAPON: + if (level != -1 && !pObjIndex->new_format) + { + obj->value[1] = number_fuzzy( number_fuzzy( 1 * level / 4 + 2 ) ); + obj->value[2] = number_fuzzy( number_fuzzy( 3 * level / 4 + 6 ) ); + } + break; + + case ITEM_ARMOR: + if (level != -1 && !pObjIndex->new_format) + { + obj->value[0] = number_fuzzy( level / 5 + 3 ); + obj->value[1] = number_fuzzy( level / 5 + 3 ); + obj->value[2] = number_fuzzy( level / 5 + 3 ); + } + break; + + case ITEM_POTION: + case ITEM_PILL: + if (level != -1 && !pObjIndex->new_format) + obj->value[0] = number_fuzzy( number_fuzzy( obj->value[0] ) ); + break; + + case ITEM_MONEY: + if (!pObjIndex->new_format) + obj->value[0] = obj->cost; + break; + } + + for (paf = pObjIndex->affected; paf != NULL; paf = paf->next) + if ( paf->location == APPLY_SPELL_AFFECT ) + affect_to_obj(obj,paf); + + obj->next = object_list; + object_list = obj; + pObjIndex->count++; + + return obj; +} + +/* duplicate an object exactly -- except contents */ +void clone_object(OBJ_DATA *parent, OBJ_DATA *clone) +{ + int i; + AFFECT_DATA *paf; + EXTRA_DESCR_DATA *ed,*ed_new; + + if (parent == NULL || clone == NULL) + return; + + /* start fixing the object */ + clone->name = str_dup(parent->name); + clone->short_descr = str_dup(parent->short_descr); + clone->description = str_dup(parent->description); + clone->item_type = parent->item_type; + clone->extra_flags = parent->extra_flags; + clone->wear_flags = parent->wear_flags; + clone->weight = parent->weight; + clone->cost = parent->cost; + clone->level = parent->level; + clone->condition = parent->condition; + clone->material = str_dup(parent->material); + clone->timer = parent->timer; + + for (i = 0; i < 5; i ++) + clone->value[i] = parent->value[i]; + + /* affects */ + clone->enchanted = parent->enchanted; + + for (paf = parent->affected; paf != NULL; paf = paf->next) + affect_to_obj(clone,paf); + + /* extended desc */ + for (ed = parent->extra_descr; ed != NULL; ed = ed->next) + { + ed_new = new_extra_descr(); + ed_new->keyword = str_dup( ed->keyword); + ed_new->description = str_dup( ed->description ); + ed_new->next = clone->extra_descr; + clone->extra_descr = ed_new; + } + +} + + + +/* + * Clear a new character. + */ +void clear_char( CHAR_DATA *ch ) +{ + static CHAR_DATA ch_zero; + int i; + + *ch = ch_zero; + ch->name = &str_empty[0]; + ch->short_descr = &str_empty[0]; + ch->long_descr = &str_empty[0]; + ch->description = &str_empty[0]; + ch->prompt = &str_empty[0]; + ch->logon = current_time; + ch->lines = PAGELEN; + for (i = 0; i < 4; i++) + ch->armor[i] = 100; + ch->position = POS_STANDING; + ch->hit = 20; + ch->max_hit = 20; + ch->mana = 100; + ch->max_mana = 100; + ch->move = 100; + ch->max_move = 100; + ch->on = NULL; + for (i = 0; i < MAX_STATS; i ++) + { + ch->perm_stat[i] = 13; + ch->mod_stat[i] = 0; + } + return; +} + +/* + * Get an extra description from a list. + */ +char *get_extra_descr( const char *name, EXTRA_DESCR_DATA *ed ) +{ + for ( ; ed != NULL; ed = ed->next ) + { + if ( is_name( (char *) name, ed->keyword ) ) + return ed->description; + } + return NULL; +} + + + +/* + * Translates mob virtual number to its mob index struct. + * Hash table lookup. + */ +MOB_INDEX_DATA *get_mob_index( int vnum ) +{ + MOB_INDEX_DATA *pMobIndex; + + for ( pMobIndex = mob_index_hash[vnum % MAX_KEY_HASH]; + pMobIndex != NULL; + pMobIndex = pMobIndex->next ) + { + if ( pMobIndex->vnum == vnum ) + return pMobIndex; + } + + if ( fBootDb ) + { + bug( "Get_mob_index: bad vnum %d.", vnum ); + exit( 1 ); + } + + return NULL; +} + + + +/* + * Translates mob virtual number to its obj index struct. + * Hash table lookup. + */ +OBJ_INDEX_DATA *get_obj_index( int vnum ) +{ + OBJ_INDEX_DATA *pObjIndex; + + for ( pObjIndex = obj_index_hash[vnum % MAX_KEY_HASH]; + pObjIndex != NULL; + pObjIndex = pObjIndex->next ) + { + if ( pObjIndex->vnum == vnum ) + return pObjIndex; + } + + if ( fBootDb ) + { + bug( "Get_obj_index: bad vnum %d.", vnum ); + exit( 1 ); + } + + return NULL; +} + + + +/* + * Translates mob virtual number to its room index struct. + * Hash table lookup. + */ +ROOM_INDEX_DATA *get_room_index( int vnum ) +{ + ROOM_INDEX_DATA *pRoomIndex; + + for ( pRoomIndex = room_index_hash[vnum % MAX_KEY_HASH]; + pRoomIndex != NULL; + pRoomIndex = pRoomIndex->next ) + { + if ( pRoomIndex->vnum == vnum ) + return pRoomIndex; + } + + if ( fBootDb ) + { + bug( "Get_room_index: bad vnum %d.", vnum ); + exit( 1 ); + } + + return NULL; +} + + + +/* + * Read a letter from a file. + */ +char fread_letter( FILE *fp ) +{ + char c; + + do + { + c = getc( fp ); + } + while ( isspace(c) ); + + return c; +} + + + +/* + * Read a number from a file. + */ +int fread_number( FILE *fp ) +{ + int number; + bool sign; + char c; + + do + { + c = getc( fp ); + } + while ( isspace(c) ); + + number = 0; + + sign = FALSE; + if ( c == '+' ) + { + c = getc( fp ); + } + else if ( c == '-' ) + { + sign = TRUE; + c = getc( fp ); + } + + if ( !isdigit(c) ) + { + bug( "Fread_number: bad format.", 0 ); + exit( 1 ); + } + + while ( isdigit(c) ) + { + number = number * 10 + c - '0'; + c = getc( fp ); + } + + if ( sign ) + number = 0 - number; + + if ( c == '|' ) + number += fread_number( fp ); + else if ( c != ' ' ) + ungetc( c, fp ); + + return number; +} + +long fread_flag( FILE *fp) +{ + int number; + char c; + bool negative = FALSE; + + do + { + c = getc(fp); + } + while ( isspace(c)); + + if (c == '-') + { + negative = TRUE; + c = getc(fp); + } + + number = 0; + + if (!isdigit(c)) + { + while (('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z')) + { + number += flag_convert(c); + c = getc(fp); + } + } + + while (isdigit(c)) + { + number = number * 10 + c - '0'; + c = getc(fp); + } + + if (c == '|') + number += fread_flag(fp); + + else if ( c != ' ') + ungetc(c,fp); + + if (negative) + return -1 * number; + + return number; +} + +long flag_convert(char letter ) +{ + long bitsum = 0; + char i; + + if ('A' <= letter && letter <= 'Z') + { + bitsum = 1; + for (i = letter; i > 'A'; i--) + bitsum *= 2; + } + else if ('a' <= letter && letter <= 'z') + { + bitsum = 67108864; /* 2^26 */ + for (i = letter; i > 'a'; i --) + bitsum *= 2; + } + + return bitsum; +} + + + + +/* + * Read and allocate space for a string from a file. + * These strings are read-only and shared. + * Strings are hashed: + * each string prepended with hash pointer to prev string, + * hash code is simply the string length. + * this function takes 40% to 50% of boot-up time. + */ +char *fread_string( FILE *fp ) +{ + char *plast; + char c; + + plast = top_string + sizeof(char *); + if ( plast > &string_space[MAX_STRING - MAX_STRING_LENGTH] ) + { + bug( "Fread_string: MAX_STRING %d exceeded.", MAX_STRING ); + exit( 1 ); + } + + /* + * Skip blanks. + * Read first char. + */ + do + { + c = getc( fp ); + } + while ( isspace(c) ); + + if ( ( *plast++ = c ) == '~' ) + return &str_empty[0]; + + for ( ;; ) + { + /* + * Back off the char type lookup, + * it was too dirty for portability. + * -- Furey + */ + + switch ( *plast = getc(fp) ) + { + default: + plast++; + break; + + case EOF: + /* temp fix */ + bug( "Fread_string: EOF", 0 ); + return NULL; + /* exit( 1 ); */ + break; + + case '\n': + plast++; + *plast++ = '\r'; + break; + + case '\r': + break; + + case '~': + plast++; + { + union + { + char * pc; + char rgc[sizeof(char *)]; + } u1; + int ic; + int iHash; + char *pHash; + char *pHashPrev; + char *pString; + + plast[-1] = '\0'; + iHash = UMIN( MAX_KEY_HASH - 1, plast - 1 - top_string ); + for ( pHash = string_hash[iHash]; pHash; pHash = pHashPrev ) + { + for ( ic = 0; ic < sizeof(char *); ic++ ) + u1.rgc[ic] = pHash[ic]; + pHashPrev = u1.pc; + pHash += sizeof(char *); + + if ( top_string[sizeof(char *)] == pHash[0] + && !strcmp( top_string+sizeof(char *)+1, pHash+1 ) ) + return pHash; + } + + if ( fBootDb ) + { + pString = top_string; + top_string = plast; + u1.pc = string_hash[iHash]; + for ( ic = 0; ic < sizeof(char *); ic++ ) + pString[ic] = u1.rgc[ic]; + string_hash[iHash] = pString; + + nAllocString += 1; + sAllocString += top_string - pString; + return pString + sizeof(char *); + } + else + { + return str_dup( top_string + sizeof(char *) ); + } + } + } + } +} + +char *fread_string_eol( FILE *fp ) +{ + static bool char_special[256-EOF]; + char *plast; + char c; + + if ( char_special[EOF-EOF] != TRUE ) + { + char_special[EOF - EOF] = TRUE; + char_special['\n' - EOF] = TRUE; + char_special['\r' - EOF] = TRUE; + } + + plast = top_string + sizeof(char *); + if ( plast > &string_space[MAX_STRING - MAX_STRING_LENGTH] ) + { + bug( "Fread_string: MAX_STRING %d exceeded.", MAX_STRING ); + exit( 1 ); + } + + /* + * Skip blanks. + * Read first char. + */ + do + { + c = getc( fp ); + } + while ( isspace(c) ); + + if ( ( *plast++ = c ) == '\n') + return &str_empty[0]; + + for ( ;; ) + { + if ( !char_special[ ( *plast++ = getc( fp ) ) - EOF ] ) + continue; + + switch ( plast[-1] ) + { + default: + break; + + case EOF: + bug( "Fread_string_eol EOF", 0 ); + exit( 1 ); + break; + + case '\n': case '\r': + { + union + { + char * pc; + char rgc[sizeof(char *)]; + } u1; + int ic; + int iHash; + char *pHash; + char *pHashPrev; + char *pString; + + plast[-1] = '\0'; + iHash = UMIN( MAX_KEY_HASH - 1, plast - 1 - top_string ); + for ( pHash = string_hash[iHash]; pHash; pHash = pHashPrev ) + { + for ( ic = 0; ic < sizeof(char *); ic++ ) + u1.rgc[ic] = pHash[ic]; + pHashPrev = u1.pc; + pHash += sizeof(char *); + + if ( top_string[sizeof(char *)] == pHash[0] + && !strcmp( top_string+sizeof(char *)+1, pHash+1 ) ) + return pHash; + } + + if ( fBootDb ) + { + pString = top_string; + top_string = plast; + u1.pc = string_hash[iHash]; + for ( ic = 0; ic < sizeof(char *); ic++ ) + pString[ic] = u1.rgc[ic]; + string_hash[iHash] = pString; + + nAllocString += 1; + sAllocString += top_string - pString; + return pString + sizeof(char *); + } + else + { + return str_dup( top_string + sizeof(char *) ); + } + } + } + } +} + + + +/* + * Read to end of line (for comments). + */ +void fread_to_eol( FILE *fp ) +{ + char c; + + do + { + c = getc( fp ); + } + while ( c != '\n' && c != '\r' ); + + do + { + c = getc( fp ); + } + while ( c == '\n' || c == '\r' ); + + ungetc( c, fp ); + return; +} + + + +/* + * Read one word (into static buffer). + */ +char *fread_word( FILE *fp ) +{ + static char word[MAX_INPUT_LENGTH]; + char *pword; + char cEnd; + + do + { + cEnd = getc( fp ); + } + while ( isspace( cEnd ) ); + + if ( cEnd == '\'' || cEnd == '"' ) + { + pword = word; + } + else + { + word[0] = cEnd; + pword = word+1; + cEnd = ' '; + } + + for ( ; pword < word + MAX_INPUT_LENGTH; pword++ ) + { + *pword = getc( fp ); + if ( cEnd == ' ' ? isspace(*pword) : *pword == cEnd ) + { + if ( cEnd == ' ' ) + ungetc( *pword, fp ); + *pword = '\0'; + return word; + } + } + + bug( "Fread_word: word too long.", 0 ); + exit( 1 ); + return NULL; +} + +/* + * Allocate some ordinary memory, + * with the expectation of freeing it someday. + */ +void *alloc_mem( int sMem ) +{ + void *pMem; + int *magic; + int iList; + + sMem += sizeof(*magic); + + for ( iList = 0; iList < MAX_MEM_LIST; iList++ ) + { + if ( sMem <= rgSizeList[iList] ) + break; + } + + if ( iList == MAX_MEM_LIST ) + { + bug( "Alloc_mem: size %d too large.", sMem ); + exit( 1 ); + } + + if ( rgFreeList[iList] == NULL ) + { + pMem = alloc_perm( rgSizeList[iList] ); + } + else + { + pMem = rgFreeList[iList]; + rgFreeList[iList] = * ((void **) rgFreeList[iList]); + } + + magic = (int *) pMem; + *magic = MAGIC_NUM; + pMem += sizeof(*magic); + + return pMem; +} + + + +/* + * Free some memory. + * Recycle it back onto the free list for blocks of that size. + */ +void free_mem( void *pMem, int sMem ) +{ + int iList; + int *magic; + + pMem -= sizeof(*magic); + magic = (int *) pMem; + + if (*magic != MAGIC_NUM) + { + bug("Attempt to recyle invalid memory of size %d.",sMem); + bug((char*) pMem + sizeof(*magic),0); + return; + } + + *magic = 0; + sMem += sizeof(*magic); + + for ( iList = 0; iList < MAX_MEM_LIST; iList++ ) + { + if ( sMem <= rgSizeList[iList] ) + break; + } + + if ( iList == MAX_MEM_LIST ) + { + bug( "Free_mem: size %d too large.", sMem ); + exit( 1 ); + } + + * ((void **) pMem) = rgFreeList[iList]; + rgFreeList[iList] = pMem; + + return; +} + + +/* + * Allocate some permanent memory. + * Permanent memory is never freed, + * pointers into it may be copied safely. + */ +void *alloc_perm( int sMem ) +{ + static char *pMemPerm; + static int iMemPerm; + void *pMem; + + while ( sMem % sizeof(long) != 0 ) + sMem++; + if ( sMem > MAX_PERM_BLOCK ) + { + bug( "Alloc_perm: %d too large.", sMem ); + exit( 1 ); + } + + if ( pMemPerm == NULL || iMemPerm + sMem > MAX_PERM_BLOCK ) + { + iMemPerm = 0; + if ( ( pMemPerm = calloc( 1, MAX_PERM_BLOCK ) ) == NULL ) + { + perror( "Alloc_perm" ); + exit( 1 ); + } + } + + pMem = pMemPerm + iMemPerm; + iMemPerm += sMem; + nAllocPerm += 1; + sAllocPerm += sMem; + return pMem; +} + + + +/* + * Duplicate a string into dynamic memory. + * Fread_strings are read-only and shared. + */ +char *str_dup( const char *str ) +{ + char *str_new; + + if ( str[0] == '\0' ) + return &str_empty[0]; + + if ( str >= string_space && str < top_string ) + return (char *) str; + + str_new = alloc_mem( strlen(str) + 1 ); + strcpy( str_new, str ); + return str_new; +} + + + +/* + * Free a string. + * Null is legal here to simplify callers. + * Read-only shared strings are not touched. + */ +void free_string( char *pstr ) +{ + if ( pstr == NULL + || pstr == &str_empty[0] + || ( pstr >= string_space && pstr < top_string ) ) + return; + + free_mem( pstr, strlen(pstr) + 1 ); + return; +} + + + +void do_areas( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + AREA_DATA *pArea1; + AREA_DATA *pArea2; + int iArea; + int iAreaHalf; + + if (argument[0] != '\0') + { + send_to_char("No argument is used with this command.\n\r",ch); + return; + } + + iAreaHalf = (top_area + 1) / 2; + pArea1 = area_first; + pArea2 = area_first; + for ( iArea = 0; iArea < iAreaHalf; iArea++ ) + pArea2 = pArea2->next; + + for ( iArea = 0; iArea < iAreaHalf; iArea++ ) + { + sprintf( buf, "%-39s%-39s\n\r", + pArea1->credits, (pArea2 != NULL) ? pArea2->credits : "" ); + send_to_char( buf, ch ); + pArea1 = pArea1->next; + if ( pArea2 != NULL ) + pArea2 = pArea2->next; + } + + return; +} + + + +void do_memory( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + + sprintf( buf, "Affects %5d\n\r", top_affect ); send_to_char( buf, ch ); + sprintf( buf, "Areas %5d\n\r", top_area ); send_to_char( buf, ch ); + sprintf( buf, "ExDes %5d\n\r", top_ed ); send_to_char( buf, ch ); + sprintf( buf, "Exits %5d\n\r", top_exit ); send_to_char( buf, ch ); + sprintf( buf, "Helps %5d\n\r", top_help ); send_to_char( buf, ch ); + sprintf( buf, "Socials %5d\n\r", social_count ); send_to_char( buf, ch ); + sprintf( buf, "Mobs %5d(%d new format)\n\r", top_mob_index,newmobs ); + send_to_char( buf, ch ); + sprintf( buf, "(in use)%5d\n\r", mobile_count ); send_to_char( buf, ch ); + sprintf( buf, "Objs %5d(%d new format)\n\r", top_obj_index,newobjs ); + send_to_char( buf, ch ); + sprintf( buf, "Resets %5d\n\r", top_reset ); send_to_char( buf, ch ); + sprintf( buf, "Rooms %5d\n\r", top_room ); send_to_char( buf, ch ); + sprintf( buf, "Shops %5d\n\r", top_shop ); send_to_char( buf, ch ); + + sprintf( buf, "Strings %5d strings of %7d bytes (max %d).\n\r", + nAllocString, sAllocString, MAX_STRING ); + send_to_char( buf, ch ); + + sprintf( buf, "Perms %5d blocks of %7d bytes.\n\r", + nAllocPerm, sAllocPerm ); + send_to_char( buf, ch ); + + return; +} + +void do_dump( CHAR_DATA *ch, char *argument ) +{ + int count,count2,num_pcs,aff_count; + CHAR_DATA *fch; + MOB_INDEX_DATA *pMobIndex; + PC_DATA *pc; + OBJ_DATA *obj; + OBJ_INDEX_DATA *pObjIndex; + ROOM_INDEX_DATA *room; + EXIT_DATA *exit; + DESCRIPTOR_DATA *d; + AFFECT_DATA *af; + FILE *fp; + int vnum,nMatch = 0; + + /* open file */ + fclose(fpReserve); + fp = fopen("mem.dmp","w"); + + /* report use of data structures */ + + num_pcs = 0; + aff_count = 0; + + /* mobile prototypes */ + fprintf(fp,"MobProt %4d (%8zd bytes)\n", + top_mob_index, top_mob_index * (sizeof(*pMobIndex))); + + /* mobs */ + count = 0; count2 = 0; + for (fch = char_list; fch != NULL; fch = fch->next) + { + count++; + if (fch->pcdata != NULL) + num_pcs++; + for (af = fch->affected; af != NULL; af = af->next) + aff_count++; + } + for (fch = char_free; fch != NULL; fch = fch->next) + count2++; + + fprintf(fp,"Mobs %4d (%8zd bytes), %2d free (%zd bytes)\n", + count, count * (sizeof(*fch)), count2, count2 * (sizeof(*fch))); + + /* pcdata */ + count = 0; + for (pc = pcdata_free; pc != NULL; pc = pc->next) + count++; + + fprintf(fp,"Pcdata %4d (%8zd bytes), %2d free (%zd bytes)\n", + num_pcs, num_pcs * (sizeof(*pc)), count, count * (sizeof(*pc))); + + /* descriptors */ + count = 0; count2 = 0; + for (d = descriptor_list; d != NULL; d = d->next) + count++; + for (d= descriptor_free; d != NULL; d = d->next) + count2++; + + fprintf(fp, "Descs %4d (%8zd bytes), %2d free (%zd bytes)\n", + count, count * (sizeof(*d)), count2, count2 * (sizeof(*d))); + + /* object prototypes */ + for ( vnum = 0; nMatch < top_obj_index; vnum++ ) + if ( ( pObjIndex = get_obj_index( vnum ) ) != NULL ) + { + for (af = pObjIndex->affected; af != NULL; af = af->next) + aff_count++; + nMatch++; + } + + fprintf(fp,"ObjProt %4d (%8zd bytes)\n", + top_obj_index, top_obj_index * (sizeof(*pObjIndex))); + + + /* objects */ + count = 0; count2 = 0; + for (obj = object_list; obj != NULL; obj = obj->next) + { + count++; + for (af = obj->affected; af != NULL; af = af->next) + aff_count++; + } + for (obj = obj_free; obj != NULL; obj = obj->next) + count2++; + + fprintf(fp,"Objs %4d (%8zd bytes), %2d free (%zd bytes)\n", + count, count * (sizeof(*obj)), count2, count2 * (sizeof(*obj))); + + /* affects */ + count = 0; + for (af = affect_free; af != NULL; af = af->next) + count++; + + fprintf(fp,"Affects %4d (%8zd bytes), %2d free (%zd bytes)\n", + aff_count, aff_count * (sizeof(*af)), count, count * (sizeof(*af))); + + /* rooms */ + fprintf(fp,"Rooms %4d (%8zd bytes)\n", + top_room, top_room * (sizeof(*room))); + + /* exits */ + fprintf(fp,"Exits %4d (%8zd bytes)\n", + top_exit, top_exit * (sizeof(*exit))); + + fclose(fp); + + /* start printing out mobile data */ + fp = fopen("mob.dmp","w"); + + fprintf(fp,"\nMobile Analysis\n"); + fprintf(fp, "---------------\n"); + nMatch = 0; + for (vnum = 0; nMatch < top_mob_index; vnum++) + if ((pMobIndex = get_mob_index(vnum)) != NULL) + { + nMatch++; + fprintf(fp,"#%-4d %3d active %3d killed %s\n", + pMobIndex->vnum,pMobIndex->count, + pMobIndex->killed,pMobIndex->short_descr); + } + fclose(fp); + + /* start printing out object data */ + fp = fopen("obj.dmp","w"); + + fprintf(fp,"\nObject Analysis\n"); + fprintf(fp, "---------------\n"); + nMatch = 0; + for (vnum = 0; nMatch < top_obj_index; vnum++) + if ((pObjIndex = get_obj_index(vnum)) != NULL) + { + nMatch++; + fprintf(fp,"#%-4d %3d active %3d reset %s\n", + pObjIndex->vnum,pObjIndex->count, + pObjIndex->reset_num,pObjIndex->short_descr); + } + + /* close file */ + fclose(fp); + fpReserve = fopen( NULL_FILE, "r" ); +} + + + +/* + * Stick a little fuzz on a number. + */ +int number_fuzzy( int number ) +{ + switch ( number_bits( 2 ) ) + { + case 0: number -= 1; break; + case 3: number += 1; break; + } + + return UMAX( 1, number ); +} + + + +/* + * Generate a random number. + */ +int number_range( int from, int to ) +{ + int power; + int number; + + if (from == 0 && to == 0) + return 0; + + if ( ( to = to - from + 1 ) <= 1 ) + return from; + + for ( power = 2; power < to; power <<= 1 ) + ; + + while ( ( number = number_mm() & (power -1 ) ) >= to ) + ; + + return from + number; +} + + + +/* + * Generate a percentile roll. + */ +int number_percent( void ) +{ + int percent; + + while ( (percent = number_mm() & (128-1) ) > 99 ) + ; + + return 1 + percent; +} + + + +/* + * Generate a random door. + */ +int number_door( void ) +{ + int door; + + while ( ( door = number_mm() & (8-1) ) > 5) + ; + + return door; +} + +int number_bits( int width ) +{ + return number_mm( ) & ( ( 1 << width ) - 1 ); +} + + + + +/* + * I've gotten too many bad reports on OS-supplied random number generators. + * This is the Mitchell-Moore algorithm from Knuth Volume II. + * Best to leave the constants alone unless you've read Knuth. + * -- Furey + */ + +/* I noticed streaking with this random number generator, so I switched + back to the system srandom call. If this doesn't work for you, + define OLD_RAND to use the old system -- Alander */ + +#if defined (OLD_RAND) +static int rgiState[2+55]; +#endif + +void init_mm( ) +{ +#if defined (OLD_RAND) + int *piState; + int iState; + + piState = &rgiState[2]; + + piState[-2] = 55 - 55; + piState[-1] = 55 - 24; + + piState[0] = ((int) current_time) & ((1 << 30) - 1); + piState[1] = 1; + for ( iState = 2; iState < 55; iState++ ) + { + piState[iState] = (piState[iState-1] + piState[iState-2]) + & ((1 << 30) - 1); + } +#else + srandom(time(NULL)^getpid()); +#endif + return; +} + + + +long number_mm( void ) +{ +#if defined (OLD_RAND) + int *piState; + int iState1; + int iState2; + int iRand; + + piState = &rgiState[2]; + iState1 = piState[-2]; + iState2 = piState[-1]; + iRand = (piState[iState1] + piState[iState2]) + & ((1 << 30) - 1); + piState[iState1] = iRand; + if ( ++iState1 == 55 ) + iState1 = 0; + if ( ++iState2 == 55 ) + iState2 = 0; + piState[-2] = iState1; + piState[-1] = iState2; + return iRand >> 6; +#else + return random() >> 6; +#endif +} + + +/* + * Roll some dice. + */ +int dice( int number, int size ) +{ + int idice; + int sum; + + switch ( size ) + { + case 0: return 0; + case 1: return number; + } + + for ( idice = 0, sum = 0; idice < number; idice++ ) + sum += number_range( 1, size ); + + return sum; +} + + + +/* + * Simple linear interpolation. + */ +int interpolate( int level, int value_00, int value_32 ) +{ + return value_00 + level * (value_32 - value_00) / 32; +} + + + +/* + * Removes the tildes from a string. + * Used for player-entered strings that go into disk files. + */ +void smash_tilde( char *str ) +{ + for ( ; *str != '\0'; str++ ) + { + if ( *str == '~' ) + *str = '-'; + } + + return; +} + + + +/* + * Compare strings, case insensitive. + * Return TRUE if different + * (compatibility with historical functions). + */ +bool str_cmp( const char *astr, const char *bstr ) +{ + if ( astr == NULL ) + { + bug( "Str_cmp: null astr.", 0 ); + return TRUE; + } + + if ( bstr == NULL ) + { + bug( "Str_cmp: null bstr.", 0 ); + return TRUE; + } + + for ( ; *astr || *bstr; astr++, bstr++ ) + { + if ( LOWER(*astr) != LOWER(*bstr) ) + return TRUE; + } + + return FALSE; +} + + + +/* + * Compare strings, case insensitive, for prefix matching. + * Return TRUE if astr not a prefix of bstr + * (compatibility with historical functions). + */ +bool str_prefix( const char *astr, const char *bstr ) +{ + if ( astr == NULL ) + { + bug( "Strn_cmp: null astr.", 0 ); + return TRUE; + } + + if ( bstr == NULL ) + { + bug( "Strn_cmp: null bstr.", 0 ); + return TRUE; + } + + for ( ; *astr; astr++, bstr++ ) + { + if ( LOWER(*astr) != LOWER(*bstr) ) + return TRUE; + } + + return FALSE; +} + + + +/* + * Compare strings, case insensitive, for match anywhere. + * Returns TRUE is astr not part of bstr. + * (compatibility with historical functions). + */ +bool str_infix( const char *astr, const char *bstr ) +{ + int sstr1; + int sstr2; + int ichar; + char c0; + + if ( ( c0 = LOWER(astr[0]) ) == '\0' ) + return FALSE; + + sstr1 = strlen(astr); + sstr2 = strlen(bstr); + + for ( ichar = 0; ichar <= sstr2 - sstr1; ichar++ ) + { + if ( c0 == LOWER(bstr[ichar]) && !str_prefix( astr, bstr + ichar ) ) + return FALSE; + } + + return TRUE; +} + + + +/* + * Compare strings, case insensitive, for suffix matching. + * Return TRUE if astr not a suffix of bstr + * (compatibility with historical functions). + */ +bool str_suffix( const char *astr, const char *bstr ) +{ + int sstr1; + int sstr2; + + sstr1 = strlen(astr); + sstr2 = strlen(bstr); + if ( sstr1 <= sstr2 && !str_cmp( astr, bstr + sstr2 - sstr1 ) ) + return FALSE; + else + return TRUE; +} + + + +/* + * Returns an initial-capped string. + */ +char *capitalize( const char *str ) +{ + static char strcap[MAX_STRING_LENGTH]; + int i; + + for ( i = 0; str[i] != '\0'; i++ ) + strcap[i] = LOWER(str[i]); + strcap[i] = '\0'; + strcap[0] = UPPER(strcap[0]); + return strcap; +} + + +/* + * Append a string to a file. + */ +void append_file( CHAR_DATA *ch, char *file, char *str ) +{ + FILE *fp; + + if ( IS_NPC(ch) || str[0] == '\0' ) + return; + + fclose( fpReserve ); + if ( ( fp = fopen( file, "a" ) ) == NULL ) + { + perror( file ); + send_to_char( "Could not open the file!\n\r", ch ); + } + else + { + fprintf( fp, "[%5d] %s: %s\n", + ch->in_room ? ch->in_room->vnum : 0, ch->name, str ); + fclose( fp ); + } + + fpReserve = fopen( NULL_FILE, "r" ); + return; +} + + + +/* + * Reports a bug. + */ +void bug( const char *str, int param ) +{ + char buf[MAX_STRING_LENGTH]; + + if ( fpArea != NULL ) + { + int iLine; + int iChar; + + if ( fpArea == stdin ) + { + iLine = 0; + } + else + { + iChar = ftell( fpArea ); + fseek( fpArea, 0, 0 ); + for ( iLine = 0; ftell( fpArea ) < iChar; iLine++ ) + { + while ( getc( fpArea ) != '\n' ) + ; + } + fseek( fpArea, iChar, 0 ); + } + + sprintf( buf, "[*****] FILE: %s LINE: %d", strArea, iLine ); + log_string( buf ); +/* RT removed because we don't want bugs shutting the mud + if ( ( fp = fopen( "shutdown.txt", "a" ) ) != NULL ) + { + fprintf( fp, "[*****] %s\n", buf ); + fclose( fp ); + } +*/ + } + + strcpy( buf, "[*****] BUG: " ); + sprintf( buf + strlen(buf), str, param ); + log_string( buf ); +/* RT removed due to bug-file spamming + fclose( fpReserve ); + if ( ( fp = fopen( BUG_FILE, "a" ) ) != NULL ) + { + fprintf( fp, "%s\n", buf ); + fclose( fp ); + } + fpReserve = fopen( NULL_FILE, "r" ); +*/ + + return; +} + + + +/* + * Writes a string to the log. + */ +void log_string( const char *str ) +{ + char *strtime; + + strtime = ctime( ¤t_time ); + strtime[strlen(strtime)-1] = '\0'; + fprintf( stderr, "%s :: %s\n", strtime, str ); + return; +} + + + +/* + * This function is here to aid in debugging. + * If the last expression in a function is another function call, + * gcc likes to generate a JMP instead of a CALL. + * This is called "tail chaining." + * It hoses the debugger call stack for that call. + * So I make this the last call in certain critical functions, + * where I really need the call stack to be right for debugging! + * + * If you don't understand this, then LEAVE IT ALONE. + * Don't remove any calls to tail_chain anywhere. + * + * -- Furey + */ +void tail_chain( void ) +{ + return; +} diff --git a/Rom24/src/db.h b/Rom24/src/db.h new file mode 100644 index 0000000..48b5824 --- /dev/null +++ b/Rom24/src/db.h @@ -0,0 +1,52 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +/* vals from db.c */ +extern bool fBootDb; +extern int newmobs; +extern int newobjs; +extern MOB_INDEX_DATA * mob_index_hash [MAX_KEY_HASH]; +extern OBJ_INDEX_DATA * obj_index_hash [MAX_KEY_HASH]; +extern int top_mob_index; +extern int top_obj_index; +extern int top_affect; +extern int top_ed; +extern AREA_DATA * area_first; + + +/* from db2.c */ +extern int social_count; + +/* conversion from db.h */ +void convert_mob(MOB_INDEX_DATA *mob); +void convert_obj(OBJ_INDEX_DATA *obj); + +/* macro for flag swapping */ +#define GET_UNSET(flag1,flag2) (~(flag1)&((flag1)|(flag2))) + +/* Magic number for memory allocation */ +#define MAGIC_NUM 52571214 diff --git a/Rom24/src/db2.c b/Rom24/src/db2.c new file mode 100644 index 0000000..89c0929 --- /dev/null +++ b/Rom24/src/db2.c @@ -0,0 +1,493 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +#include +#include +#include +#include +#include +#if defined(macintosh) +#include +#else +#include +#include +#endif + +#include "merc.h" +#include "db.h" +#include "lookup.h" + + +/* values for db2.c */ +struct social_type social_list [MAX_SOCIALS]; +int social_count; + +/* snarf a socials file */ +void load_socials( FILE *fp) +{ + for ( ; ; ) + { + struct social_type social; + char *temp; + /* clear social */ + social.char_no_arg = NULL; + social.others_no_arg = NULL; + social.char_found = NULL; + social.others_found = NULL; + social.vict_found = NULL; + social.char_not_found = NULL; + social.char_auto = NULL; + social.others_auto = NULL; + + temp = fread_word(fp); + if (!strcmp(temp,"#0")) + return; /* done */ + strcpy(social.name,temp); + fread_to_eol(fp); + + temp = fread_string_eol(fp); + if (!strcmp(temp,"$")) + social.char_no_arg = NULL; + else if (!strcmp(temp,"#")) + { + social_list[social_count] = social; + social_count++; + continue; + } + else + social.char_no_arg = temp; + + temp = fread_string_eol(fp); + if (!strcmp(temp,"$")) + social.others_no_arg = NULL; + + + + + + + + + + + + + + + temp = fread_string_eol(fp); + if (!strcmp(temp,"$")) + social.char_auto = NULL; + else if (!strcmp(temp,"#")) + { + social_list[social_count] = social; + social_count++; + continue; + } + else + social.char_auto = temp; + + temp = fread_string_eol(fp); + if (!strcmp(temp,"$")) + social.others_auto = NULL; + else if (!strcmp(temp,"#")) + { + social_list[social_count] = social; + social_count++; + continue; + } + else + social.others_auto = temp; + + social_list[social_count] = social; + social_count++; + } + return; +} + + + + + + +/* + * Snarf a mob section. new style + */ +void load_mobiles( FILE *fp ) +{ + MOB_INDEX_DATA *pMobIndex; + + for ( ; ; ) + { + sh_int vnum; + char letter; + int iHash; + + letter = fread_letter( fp ); + if ( letter != '#' ) + { + bug( "Load_mobiles: # not found.", 0 ); + exit( 1 ); + } + + vnum = fread_number( fp ); + if ( vnum == 0 ) + break; + + fBootDb = FALSE; + if ( get_mob_index( vnum ) != NULL ) + { + bug( "Load_mobiles: vnum %d duplicated.", vnum ); + exit( 1 ); + } + fBootDb = TRUE; + + pMobIndex = alloc_perm( sizeof(*pMobIndex) ); + pMobIndex->vnum = vnum; + pMobIndex->new_format = TRUE; + newmobs++; + pMobIndex->player_name = fread_string( fp ); + pMobIndex->short_descr = fread_string( fp ); + pMobIndex->long_descr = fread_string( fp ); + pMobIndex->description = fread_string( fp ); + pMobIndex->race = race_lookup(fread_string( fp )); + + pMobIndex->long_descr[0] = UPPER(pMobIndex->long_descr[0]); + pMobIndex->description[0] = UPPER(pMobIndex->description[0]); + + pMobIndex->act = fread_flag( fp ) | ACT_IS_NPC + | race_table[pMobIndex->race].act; + pMobIndex->affected_by = fread_flag( fp ) + | race_table[pMobIndex->race].aff; + pMobIndex->pShop = NULL; + pMobIndex->alignment = fread_number( fp ); + pMobIndex->group = fread_number( fp ); + + pMobIndex->level = fread_number( fp ); + pMobIndex->hitroll = fread_number( fp ); + + /* read hit dice */ + pMobIndex->hit[DICE_NUMBER] = fread_number( fp ); + /* 'd' */ fread_letter( fp ); + pMobIndex->hit[DICE_TYPE] = fread_number( fp ); + /* '+' */ fread_letter( fp ); + pMobIndex->hit[DICE_BONUS] = fread_number( fp ); + + /* read mana dice */ + pMobIndex->mana[DICE_NUMBER] = fread_number( fp ); + fread_letter( fp ); + pMobIndex->mana[DICE_TYPE] = fread_number( fp ); + fread_letter( fp ); + pMobIndex->mana[DICE_BONUS] = fread_number( fp ); + + /* read damage dice */ + pMobIndex->damage[DICE_NUMBER] = fread_number( fp ); + fread_letter( fp ); + pMobIndex->damage[DICE_TYPE] = fread_number( fp ); + fread_letter( fp ); + pMobIndex->damage[DICE_BONUS] = fread_number( fp ); + pMobIndex->dam_type = attack_lookup(fread_word(fp)); + + /* read armor class */ + pMobIndex->ac[AC_PIERCE] = fread_number( fp ) * 10; + pMobIndex->ac[AC_BASH] = fread_number( fp ) * 10; + pMobIndex->ac[AC_SLASH] = fread_number( fp ) * 10; + pMobIndex->ac[AC_EXOTIC] = fread_number( fp ) * 10; + + /* read flags and add in data from the race table */ + pMobIndex->off_flags = fread_flag( fp ) + | race_table[pMobIndex->race].off; + pMobIndex->imm_flags = fread_flag( fp ) + | race_table[pMobIndex->race].imm; + pMobIndex->res_flags = fread_flag( fp ) + | race_table[pMobIndex->race].res; + pMobIndex->vuln_flags = fread_flag( fp ) + | race_table[pMobIndex->race].vuln; + + /* vital statistics */ + pMobIndex->start_pos = position_lookup(fread_word(fp)); + pMobIndex->default_pos = position_lookup(fread_word(fp)); + pMobIndex->sex = sex_lookup(fread_word(fp)); + + pMobIndex->wealth = fread_number( fp ); + + pMobIndex->form = fread_flag( fp ) + | race_table[pMobIndex->race].form; + pMobIndex->parts = fread_flag( fp ) + | race_table[pMobIndex->race].parts; + /* size */ + pMobIndex->size = size_lookup(fread_word(fp)); + pMobIndex->material = str_dup(fread_word( fp )); + + for ( ; ; ) + { + letter = fread_letter( fp ); + + if (letter == 'F') + { + char *word; + long vector; + + word = fread_word(fp); + vector = fread_flag(fp); + + if (!str_prefix(word,"act")) + REMOVE_BIT(pMobIndex->act,vector); + else if (!str_prefix(word,"aff")) + REMOVE_BIT(pMobIndex->affected_by,vector); + else if (!str_prefix(word,"off")) + REMOVE_BIT(pMobIndex->off_flags,vector); + else if (!str_prefix(word,"imm")) + REMOVE_BIT(pMobIndex->imm_flags,vector); + else if (!str_prefix(word,"res")) + REMOVE_BIT(pMobIndex->res_flags,vector); + else if (!str_prefix(word,"vul")) + REMOVE_BIT(pMobIndex->vuln_flags,vector); + else if (!str_prefix(word,"for")) + REMOVE_BIT(pMobIndex->form,vector); + else if (!str_prefix(word,"par")) + REMOVE_BIT(pMobIndex->parts,vector); + else + { + bug("Flag remove: flag not found.",0); + exit(1); + } + } + else + { + ungetc(letter,fp); + break; + } + } + + iHash = vnum % MAX_KEY_HASH; + pMobIndex->next = mob_index_hash[iHash]; + mob_index_hash[iHash] = pMobIndex; + top_mob_index++; + kill_table[URANGE(0, pMobIndex->level, MAX_LEVEL-1)].number++; + } + + return; +} + +/* + * Snarf an obj section. new style + */ +void load_objects( FILE *fp ) +{ + OBJ_INDEX_DATA *pObjIndex; + + for ( ; ; ) + { + sh_int vnum; + char letter; + int iHash; + + letter = fread_letter( fp ); + if ( letter != '#' ) + { + bug( "Load_objects: # not found.", 0 ); + exit( 1 ); + } + + vnum = fread_number( fp ); + if ( vnum == 0 ) + break; + + fBootDb = FALSE; + if ( get_obj_index( vnum ) != NULL ) + { + bug( "Load_objects: vnum %d duplicated.", vnum ); + exit( 1 ); + } + fBootDb = TRUE; + + pObjIndex = alloc_perm( sizeof(*pObjIndex) ); + pObjIndex->vnum = vnum; + pObjIndex->new_format = TRUE; + pObjIndex->reset_num = 0; + newobjs++; + pObjIndex->name = fread_string( fp ); + pObjIndex->short_descr = fread_string( fp ); + pObjIndex->description = fread_string( fp ); + pObjIndex->material = fread_string( fp ); + + pObjIndex->item_type = item_lookup(fread_word( fp )); + pObjIndex->extra_flags = fread_flag( fp ); + pObjIndex->wear_flags = fread_flag( fp ); + switch(pObjIndex->item_type) + { + case ITEM_WEAPON: + pObjIndex->value[0] = weapon_type(fread_word(fp)); + pObjIndex->value[1] = fread_number(fp); + pObjIndex->value[2] = fread_number(fp); + pObjIndex->value[3] = attack_lookup(fread_word(fp)); + pObjIndex->value[4] = fread_flag(fp); + break; + case ITEM_CONTAINER: + pObjIndex->value[0] = fread_number(fp); + pObjIndex->value[1] = fread_flag(fp); + pObjIndex->value[2] = fread_number(fp); + pObjIndex->value[3] = fread_number(fp); + pObjIndex->value[4] = fread_number(fp); + break; + case ITEM_DRINK_CON: + case ITEM_FOUNTAIN: + pObjIndex->value[0] = fread_number(fp); + pObjIndex->value[1] = fread_number(fp); + pObjIndex->value[2] = liq_lookup(fread_word(fp)); + pObjIndex->value[3] = fread_number(fp); + pObjIndex->value[4] = fread_number(fp); + break; + case ITEM_WAND: + case ITEM_STAFF: + pObjIndex->value[0] = fread_number(fp); + pObjIndex->value[1] = fread_number(fp); + pObjIndex->value[2] = fread_number(fp); + pObjIndex->value[3] = skill_lookup(fread_word(fp)); + pObjIndex->value[4] = fread_number(fp); + break; + case ITEM_POTION: + case ITEM_PILL: + case ITEM_SCROLL: + pObjIndex->value[0] = fread_number(fp); + pObjIndex->value[1] = skill_lookup(fread_word(fp)); + pObjIndex->value[2] = skill_lookup(fread_word(fp)); + pObjIndex->value[3] = skill_lookup(fread_word(fp)); + pObjIndex->value[4] = skill_lookup(fread_word(fp)); + break; + default: + pObjIndex->value[0] = fread_flag( fp ); + pObjIndex->value[1] = fread_flag( fp ); + pObjIndex->value[2] = fread_flag( fp ); + pObjIndex->value[3] = fread_flag( fp ); + pObjIndex->value[4] = fread_flag( fp ); + break; + } + pObjIndex->level = fread_number( fp ); + pObjIndex->weight = fread_number( fp ); + pObjIndex->cost = fread_number( fp ); + + /* condition */ + letter = fread_letter( fp ); + switch (letter) + { + case ('P') : pObjIndex->condition = 100; break; + case ('G') : pObjIndex->condition = 90; break; + case ('A') : pObjIndex->condition = 75; break; + case ('W') : pObjIndex->condition = 50; break; + case ('D') : pObjIndex->condition = 25; break; + case ('B') : pObjIndex->condition = 10; break; + case ('R') : pObjIndex->condition = 0; break; + default: pObjIndex->condition = 100; break; + } + + for ( ; ; ) + { + char letter; + + letter = fread_letter( fp ); + + if ( letter == 'A' ) + { + AFFECT_DATA *paf; + + paf = alloc_perm( sizeof(*paf) ); + paf->where = TO_OBJECT; + paf->type = -1; + paf->level = pObjIndex->level; + paf->duration = -1; + paf->location = fread_number( fp ); + paf->modifier = fread_number( fp ); + paf->bitvector = 0; + paf->next = pObjIndex->affected; + pObjIndex->affected = paf; + top_affect++; + } + + else if (letter == 'F') + { + AFFECT_DATA *paf; + + paf = alloc_perm( sizeof(*paf) ); + letter = fread_letter(fp); + switch (letter) + { + case 'A': + paf->where = TO_AFFECTS; + break; + case 'I': + paf->where = TO_IMMUNE; + break; + case 'R': + paf->where = TO_RESIST; + break; + case 'V': + paf->where = TO_VULN; + break; + default: + bug( "Load_objects: Bad where on flag set.", 0 ); + exit( 1 ); + } + paf->type = -1; + paf->level = pObjIndex->level; + paf->duration = -1; + paf->location = fread_number(fp); + paf->modifier = fread_number(fp); + paf->bitvector = fread_flag(fp); + paf->next = pObjIndex->affected; + pObjIndex->affected = paf; + top_affect++; + } + + else if ( letter == 'E' ) + { + EXTRA_DESCR_DATA *ed; + + ed = alloc_perm( sizeof(*ed) ); + ed->keyword = fread_string( fp ); + ed->description = fread_string( fp ); + ed->next = pObjIndex->extra_descr; + pObjIndex->extra_descr = ed; + top_ed++; + } + + else + { + ungetc( letter, fp ); + break; + } + } + + iHash = vnum % MAX_KEY_HASH; + pObjIndex->next = obj_index_hash[iHash]; + obj_index_hash[iHash] = pObjIndex; + top_obj_index++; + } + + return; +} + diff --git a/Rom24/src/effects.c b/Rom24/src/effects.c new file mode 100644 index 0000000..c56fe92 --- /dev/null +++ b/Rom24/src/effects.c @@ -0,0 +1,621 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +#if defined(macintosh) +#include +#else +#include +#endif +#include +#include +#include +#include +#include "merc.h" +#include "recycle.h" + +void acid_effect(void *vo, int level, int dam, int target) +{ + if (target == TARGET_ROOM) /* nail objects on the floor */ + { + ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo; + OBJ_DATA *obj, *obj_next; + + for (obj = room->contents; obj != NULL; obj = obj_next) + { + obj_next = obj->next_content; + acid_effect(obj,level,dam,TARGET_OBJ); + } + return; + } + + if (target == TARGET_CHAR) /* do the effect on a victim */ + { + CHAR_DATA *victim = (CHAR_DATA *) vo; + OBJ_DATA *obj, *obj_next; + + /* let's toast some gear */ + for (obj = victim->carrying; obj != NULL; obj = obj_next) + { + obj_next = obj->next_content; + acid_effect(obj,level,dam,TARGET_OBJ); + } + return; + } + + if (target == TARGET_OBJ) /* toast an object */ + { + OBJ_DATA *obj = (OBJ_DATA *) vo; + OBJ_DATA *t_obj,*n_obj; + int chance; + char *msg; + + if (IS_OBJ_STAT(obj,ITEM_BURN_PROOF) + || IS_OBJ_STAT(obj,ITEM_NOPURGE) + || number_range(0,4) == 0) + return; + + chance = level / 4 + dam / 10; + + if (chance > 25) + chance = (chance - 25) / 2 + 25; + if (chance > 50) + chance = (chance - 50) / 2 + 50; + + if (IS_OBJ_STAT(obj,ITEM_BLESS)) + chance -= 5; + + chance -= obj->level * 2; + + switch (obj->item_type) + { + default: + return; + case ITEM_CONTAINER: + case ITEM_CORPSE_PC: + case ITEM_CORPSE_NPC: + msg = "$p fumes and dissolves."; + break; + case ITEM_ARMOR: + msg = "$p is pitted and etched."; + break; + case ITEM_CLOTHING: + msg = "$p is corroded into scrap."; + break; + case ITEM_STAFF: + case ITEM_WAND: + chance -= 10; + msg = "$p corrodes and breaks."; + break; + case ITEM_SCROLL: + chance += 10; + msg = "$p is burned into waste."; + break; + } + + chance = URANGE(5,chance,95); + + if (number_percent() > chance) + return; + + if (obj->carried_by != NULL) + act(msg,obj->carried_by,obj,NULL,TO_ALL); + else if (obj->in_room != NULL && obj->in_room->people != NULL) + act(msg,obj->in_room->people,obj,NULL,TO_ALL); + + if (obj->item_type == ITEM_ARMOR) /* etch it */ + { + AFFECT_DATA *paf; + bool af_found = FALSE; + int i; + + affect_enchant(obj); + + for ( paf = obj->affected; paf != NULL; paf = paf->next) + { + if ( paf->location == APPLY_AC) + { + af_found = TRUE; + paf->type = -1; + paf->modifier += 1; + paf->level = UMAX(paf->level,level); + break; + } + } + + if (!af_found) + /* needs a new affect */ + { + paf = new_affect(); + + paf->type = -1; + paf->level = level; + paf->duration = -1; + paf->location = APPLY_AC; + paf->modifier = 1; + paf->bitvector = 0; + paf->next = obj->affected; + obj->affected = paf; + } + + if (obj->carried_by != NULL && obj->wear_loc != WEAR_NONE) + for (i = 0; i < 4; i++) + obj->carried_by->armor[i] += 1; + return; + } + + /* get rid of the object */ + if (obj->contains) /* dump contents */ + { + for (t_obj = obj->contains; t_obj != NULL; t_obj = n_obj) + { + n_obj = t_obj->next_content; + obj_from_obj(t_obj); + if (obj->in_room != NULL) + obj_to_room(t_obj,obj->in_room); + else if (obj->carried_by != NULL) + obj_to_room(t_obj,obj->carried_by->in_room); + else + { + extract_obj(t_obj); + continue; + } + + acid_effect(t_obj,level/2,dam/2,TARGET_OBJ); + } + } + + extract_obj(obj); + return; + } +} + + +void cold_effect(void *vo, int level, int dam, int target) +{ + if (target == TARGET_ROOM) /* nail objects on the floor */ + { + ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo; + OBJ_DATA *obj, *obj_next; + + for (obj = room->contents; obj != NULL; obj = obj_next) + { + obj_next = obj->next_content; + cold_effect(obj,level,dam,TARGET_OBJ); + } + return; + } + + if (target == TARGET_CHAR) /* whack a character */ + { + CHAR_DATA *victim = (CHAR_DATA *) vo; + OBJ_DATA *obj, *obj_next; + + /* chill touch effect */ + if (!saves_spell(level/4 + dam / 20, victim, DAM_COLD)) + { + AFFECT_DATA af; + + act("$n turns blue and shivers.",victim,NULL,NULL,TO_ROOM); + act("A chill sinks deep into your bones.",victim,NULL,NULL,TO_CHAR); + af.where = TO_AFFECTS; + af.type = skill_lookup("chill touch"); + af.level = level; + af.duration = 6; + af.location = APPLY_STR; + af.modifier = -1; + af.bitvector = 0; + affect_join( victim, &af ); + } + + /* hunger! (warmth sucked out */ + if (!IS_NPC(victim)) + gain_condition(victim,COND_HUNGER,dam/20); + + /* let's toast some gear */ + for (obj = victim->carrying; obj != NULL; obj = obj_next) + { + obj_next = obj->next_content; + cold_effect(obj,level,dam,TARGET_OBJ); + } + return; + } + + if (target == TARGET_OBJ) /* toast an object */ + { + OBJ_DATA *obj = (OBJ_DATA *) vo; + int chance; + char *msg; + + if (IS_OBJ_STAT(obj,ITEM_BURN_PROOF) + || IS_OBJ_STAT(obj,ITEM_NOPURGE) + || number_range(0,4) == 0) + return; + + chance = level / 4 + dam / 10; + + if (chance > 25) + chance = (chance - 25) / 2 + 25; + if (chance > 50) + chance = (chance - 50) / 2 + 50; + + if (IS_OBJ_STAT(obj,ITEM_BLESS)) + chance -= 5; + + chance -= obj->level * 2; + + switch(obj->item_type) + { + default: + return; + case ITEM_POTION: + msg = "$p freezes and shatters!"; + chance += 25; + break; + case ITEM_DRINK_CON: + msg = "$p freezes and shatters!"; + chance += 5; + break; + } + + chance = URANGE(5,chance,95); + + if (number_percent() > chance) + return; + + if (obj->carried_by != NULL) + act(msg,obj->carried_by,obj,NULL,TO_ALL); + else if (obj->in_room != NULL && obj->in_room->people != NULL) + act(msg,obj->in_room->people,obj,NULL,TO_ALL); + + extract_obj(obj); + return; + } +} + + + +void fire_effect(void *vo, int level, int dam, int target) +{ + if (target == TARGET_ROOM) /* nail objects on the floor */ + { + ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo; + OBJ_DATA *obj, *obj_next; + + for (obj = room->contents; obj != NULL; obj = obj_next) + { + obj_next = obj->next_content; + fire_effect(obj,level,dam,TARGET_OBJ); + } + return; + } + + if (target == TARGET_CHAR) /* do the effect on a victim */ + { + CHAR_DATA *victim = (CHAR_DATA *) vo; + OBJ_DATA *obj, *obj_next; + + /* chance of blindness */ + if (!IS_AFFECTED(victim,AFF_BLIND) + && !saves_spell(level / 4 + dam / 20, victim,DAM_FIRE)) + { + AFFECT_DATA af; + act("$n is blinded by smoke!",victim,NULL,NULL,TO_ROOM); + act("Your eyes tear up from smoke...you can't see a thing!", + victim,NULL,NULL,TO_CHAR); + + af.where = TO_AFFECTS; + af.type = skill_lookup("fire breath"); + af.level = level; + af.duration = number_range(0,level/10); + af.location = APPLY_HITROLL; + af.modifier = -4; + af.bitvector = AFF_BLIND; + + affect_to_char(victim,&af); + } + + /* getting thirsty */ + if (!IS_NPC(victim)) + gain_condition(victim,COND_THIRST,dam/20); + + /* let's toast some gear! */ + for (obj = victim->carrying; obj != NULL; obj = obj_next) + { + obj_next = obj->next_content; + + fire_effect(obj,level,dam,TARGET_OBJ); + } + return; + } + + if (target == TARGET_OBJ) /* toast an object */ + { + OBJ_DATA *obj = (OBJ_DATA *) vo; + OBJ_DATA *t_obj,*n_obj; + int chance; + char *msg; + + if (IS_OBJ_STAT(obj,ITEM_BURN_PROOF) + || IS_OBJ_STAT(obj,ITEM_NOPURGE) + || number_range(0,4) == 0) + return; + + chance = level / 4 + dam / 10; + + if (chance > 25) + chance = (chance - 25) / 2 + 25; + if (chance > 50) + chance = (chance - 50) / 2 + 50; + + if (IS_OBJ_STAT(obj,ITEM_BLESS)) + chance -= 5; + chance -= obj->level * 2; + + switch ( obj->item_type ) + { + default: + return; + case ITEM_CONTAINER: + msg = "$p ignites and burns!"; + break; + case ITEM_POTION: + chance += 25; + msg = "$p bubbles and boils!"; + break; + case ITEM_SCROLL: + chance += 50; + msg = "$p crackles and burns!"; + break; + case ITEM_STAFF: + chance += 10; + msg = "$p smokes and chars!"; + break; + case ITEM_WAND: + msg = "$p sparks and sputters!"; + break; + case ITEM_FOOD: + msg = "$p blackens and crisps!"; + break; + case ITEM_PILL: + msg = "$p melts and drips!"; + break; + } + + chance = URANGE(5,chance,95); + + if (number_percent() > chance) + return; + + if (obj->carried_by != NULL) + act( msg, obj->carried_by, obj, NULL, TO_ALL ); + else if (obj->in_room != NULL && obj->in_room->people != NULL) + act(msg,obj->in_room->people,obj,NULL,TO_ALL); + + if (obj->contains) + { + /* dump the contents */ + + for (t_obj = obj->contains; t_obj != NULL; t_obj = n_obj) + { + n_obj = t_obj->next_content; + obj_from_obj(t_obj); + if (obj->in_room != NULL) + obj_to_room(t_obj,obj->in_room); + else if (obj->carried_by != NULL) + obj_to_room(t_obj,obj->carried_by->in_room); + else + { + extract_obj(t_obj); + continue; + } + fire_effect(t_obj,level/2,dam/2,TARGET_OBJ); + } + } + + extract_obj( obj ); + return; + } +} + +void poison_effect(void *vo,int level, int dam, int target) +{ + if (target == TARGET_ROOM) /* nail objects on the floor */ + { + ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo; + OBJ_DATA *obj, *obj_next; + + for (obj = room->contents; obj != NULL; obj = obj_next) + { + obj_next = obj->next_content; + poison_effect(obj,level,dam,TARGET_OBJ); + } + return; + } + + if (target == TARGET_CHAR) /* do the effect on a victim */ + { + CHAR_DATA *victim = (CHAR_DATA *) vo; + OBJ_DATA *obj, *obj_next; + + /* chance of poisoning */ + if (!saves_spell(level / 4 + dam / 20,victim,DAM_POISON)) + { + AFFECT_DATA af; + + send_to_char("You feel poison coursing through your veins.\n\r", + victim); + act("$n looks very ill.",victim,NULL,NULL,TO_ROOM); + + af.where = TO_AFFECTS; + af.type = gsn_poison; + af.level = level; + af.duration = level / 2; + af.location = APPLY_STR; + af.modifier = -1; + af.bitvector = AFF_POISON; + affect_join( victim, &af ); + } + + /* equipment */ + for (obj = victim->carrying; obj != NULL; obj = obj_next) + { + obj_next = obj->next_content; + poison_effect(obj,level,dam,TARGET_OBJ); + } + return; + } + + if (target == TARGET_OBJ) /* do some poisoning */ + { + OBJ_DATA *obj = (OBJ_DATA *) vo; + int chance; + + + if (IS_OBJ_STAT(obj,ITEM_BURN_PROOF) + || IS_OBJ_STAT(obj,ITEM_BLESS) + || number_range(0,4) == 0) + return; + + chance = level / 4 + dam / 10; + if (chance > 25) + chance = (chance - 25) / 2 + 25; + if (chance > 50) + chance = (chance - 50) / 2 + 50; + + chance -= obj->level * 2; + + switch (obj->item_type) + { + default: + return; + case ITEM_FOOD: + break; + case ITEM_DRINK_CON: + if (obj->value[0] == obj->value[1]) + return; + break; + } + + chance = URANGE(5,chance,95); + + if (number_percent() > chance) + return; + + obj->value[3] = 1; + return; + } +} + + +void shock_effect(void *vo,int level, int dam, int target) +{ + if (target == TARGET_ROOM) + { + ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo; + OBJ_DATA *obj, *obj_next; + + for (obj = room->contents; obj != NULL; obj = obj_next) + { + obj_next = obj->next_content; + shock_effect(obj,level,dam,TARGET_OBJ); + } + return; + } + + if (target == TARGET_CHAR) + { + CHAR_DATA *victim = (CHAR_DATA *) vo; + OBJ_DATA *obj, *obj_next; + + /* daze and confused? */ + if (!saves_spell(level/4 + dam/20,victim,DAM_LIGHTNING)) + { + send_to_char("Your muscles stop responding.\n\r",victim); + DAZE_STATE(victim,UMAX(12,level/4 + dam/20)); + } + + /* toast some gear */ + for (obj = victim->carrying; obj != NULL; obj = obj_next) + { + obj_next = obj->next_content; + shock_effect(obj,level,dam,TARGET_OBJ); + } + return; + } + + if (target == TARGET_OBJ) + { + OBJ_DATA *obj = (OBJ_DATA *) vo; + int chance; + char *msg; + + if (IS_OBJ_STAT(obj,ITEM_BURN_PROOF) + || IS_OBJ_STAT(obj,ITEM_NOPURGE) + || number_range(0,4) == 0) + return; + + chance = level / 4 + dam / 10; + + if (chance > 25) + chance = (chance - 25) / 2 + 25; + if (chance > 50) + chance = (chance - 50) /2 + 50; + + if (IS_OBJ_STAT(obj,ITEM_BLESS)) + chance -= 5; + + chance -= obj->level * 2; + + switch(obj->item_type) + { + default: + return; + case ITEM_WAND: + case ITEM_STAFF: + chance += 10; + msg = "$p overloads and explodes!"; + break; + case ITEM_JEWELRY: + chance -= 10; + msg = "$p is fused into a worthless lump."; + } + + chance = URANGE(5,chance,95); + + if (number_percent() > chance) + return; + + if (obj->carried_by != NULL) + act(msg,obj->carried_by,obj,NULL,TO_ALL); + else if (obj->in_room != NULL && obj->in_room->people != NULL) + act(msg,obj->in_room->people,obj,NULL,TO_ALL); + + extract_obj(obj); + return; + } +} + diff --git a/Rom24/src/fight.c b/Rom24/src/fight.c new file mode 100644 index 0000000..b9acac0 --- /dev/null +++ b/Rom24/src/fight.c @@ -0,0 +1,3095 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +#if defined(macintosh) +#include +#else +#include +#endif +#include +#include +#include +#include "merc.h" +#include "interp.h" + +/* + * Local functions. + */ +void check_assist args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); +bool check_dodge args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); +void check_killer args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); +bool check_parry args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); +bool check_shield_block args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); +void dam_message args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dam, + int dt, bool immune ) ); +void death_cry args( ( CHAR_DATA *ch ) ); +void group_gain args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); +int xp_compute args( ( CHAR_DATA *gch, CHAR_DATA *victim, + int total_levels ) ); +bool is_safe args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); +void make_corpse args( ( CHAR_DATA *ch ) ); +void one_hit args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dt ) ); +void mob_hit args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dt ) ); +void raw_kill args( ( CHAR_DATA *victim ) ); +void set_fighting args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); +void disarm args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); + + + +/* + * Control the fights going on. + * Called periodically by update_handler. + */ +void violence_update( void ) +{ + CHAR_DATA *ch; + CHAR_DATA *ch_next; + CHAR_DATA *victim; + + for ( ch = char_list; ch != NULL; ch = ch->next ) + { + ch_next = ch->next; + + if ( ( victim = ch->fighting ) == NULL || ch->in_room == NULL ) + continue; + + if ( IS_AWAKE(ch) && ch->in_room == victim->in_room ) + multi_hit( ch, victim, TYPE_UNDEFINED ); + else + stop_fighting( ch, FALSE ); + + if ( ( victim = ch->fighting ) == NULL ) + continue; + + /* + * Fun for the whole family! + */ + check_assist(ch,victim); + } + + return; +} + +/* for auto assisting */ +void check_assist(CHAR_DATA *ch,CHAR_DATA *victim) +{ + CHAR_DATA *rch, *rch_next; + + for (rch = ch->in_room->people; rch != NULL; rch = rch_next) + { + rch_next = rch->next_in_room; + + if (IS_AWAKE(rch) && rch->fighting == NULL) + { + + /* quick check for ASSIST_PLAYER */ + if (!IS_NPC(ch) && IS_NPC(rch) + && IS_SET(rch->off_flags,ASSIST_PLAYERS) + && rch->level + 6 > victim->level) + { + do_function(rch, &do_emote, "screams and attacks!"); + multi_hit(rch,victim,TYPE_UNDEFINED); + continue; + } + + /* PCs next */ + if (!IS_NPC(ch) || IS_AFFECTED(ch,AFF_CHARM)) + { + if ( ( (!IS_NPC(rch) && IS_SET(rch->act,PLR_AUTOASSIST)) + || IS_AFFECTED(rch,AFF_CHARM)) + && is_same_group(ch,rch) + && !is_safe(rch, victim)) + multi_hit (rch,victim,TYPE_UNDEFINED); + + continue; + } + + /* now check the NPC cases */ + + if (IS_NPC(ch) && !IS_AFFECTED(ch,AFF_CHARM)) + + { + if ( (IS_NPC(rch) && IS_SET(rch->off_flags,ASSIST_ALL)) + + || (IS_NPC(rch) && rch->group && rch->group == ch->group) + + || (IS_NPC(rch) && rch->race == ch->race + && IS_SET(rch->off_flags,ASSIST_RACE)) + + || (IS_NPC(rch) && IS_SET(rch->off_flags,ASSIST_ALIGN) + && ((IS_GOOD(rch) && IS_GOOD(ch)) + || (IS_EVIL(rch) && IS_EVIL(ch)) + || (IS_NEUTRAL(rch) && IS_NEUTRAL(ch)))) + + || (rch->pIndexData == ch->pIndexData + && IS_SET(rch->off_flags,ASSIST_VNUM))) + + { + CHAR_DATA *vch; + CHAR_DATA *target; + int number; + + if (number_bits(1) == 0) + continue; + + target = NULL; + number = 0; + for (vch = ch->in_room->people; vch; vch = vch->next) + { + if (can_see(rch,vch) + && is_same_group(vch,victim) + && number_range(0,number) == 0) + { + target = vch; + number++; + } + } + + if (target != NULL) + { + do_function(rch, &do_emote, "screams and attacks!"); + multi_hit(rch,target,TYPE_UNDEFINED); + } + } + } + } + } +} + + +/* + * Do one group of attacks. + */ +void multi_hit( CHAR_DATA *ch, CHAR_DATA *victim, int dt ) +{ + int chance; + + /* decrement the wait */ + if (ch->desc == NULL) + ch->wait = UMAX(0,ch->wait - PULSE_VIOLENCE); + + if (ch->desc == NULL) + ch->daze = UMAX(0,ch->daze - PULSE_VIOLENCE); + + + /* no attacks for stunnies -- just a check */ + if (ch->position < POS_RESTING) + return; + + if (IS_NPC(ch)) + { + mob_hit(ch,victim,dt); + return; + } + + one_hit( ch, victim, dt ); + + if (ch->fighting != victim) + return; + + if (IS_AFFECTED(ch,AFF_HASTE)) + one_hit(ch,victim,dt); + + if ( ch->fighting != victim || dt == gsn_backstab ) + return; + + chance = get_skill(ch,gsn_second_attack)/2; + + if (IS_AFFECTED(ch,AFF_SLOW)) + chance /= 2; + + if ( number_percent( ) < chance ) + { + one_hit( ch, victim, dt ); + check_improve(ch,gsn_second_attack,TRUE,5); + if ( ch->fighting != victim ) + return; + } + + chance = get_skill(ch,gsn_third_attack)/4; + + if (IS_AFFECTED(ch,AFF_SLOW)) + chance = 0;; + + if ( number_percent( ) < chance ) + { + one_hit( ch, victim, dt ); + check_improve(ch,gsn_third_attack,TRUE,6); + if ( ch->fighting != victim ) + return; + } + + return; +} + +/* procedure for all mobile attacks */ +void mob_hit (CHAR_DATA *ch, CHAR_DATA *victim, int dt) +{ + int chance,number; + CHAR_DATA *vch, *vch_next; + + one_hit(ch,victim,dt); + + if (ch->fighting != victim) + return; + + /* Area attack -- BALLS nasty! */ + + if (IS_SET(ch->off_flags,OFF_AREA_ATTACK)) + { + for (vch = ch->in_room->people; vch != NULL; vch = vch_next) + { + vch_next = vch->next; + if ((vch != victim && vch->fighting == ch)) + one_hit(ch,vch,dt); + } + } + + if (IS_AFFECTED(ch,AFF_HASTE) + || (IS_SET(ch->off_flags,OFF_FAST) && !IS_AFFECTED(ch,AFF_SLOW))) + one_hit(ch,victim,dt); + + if (ch->fighting != victim || dt == gsn_backstab) + return; + + chance = get_skill(ch,gsn_second_attack)/2; + + if (IS_AFFECTED(ch,AFF_SLOW) && !IS_SET(ch->off_flags,OFF_FAST)) + chance /= 2; + + if (number_percent() < chance) + { + one_hit(ch,victim,dt); + if (ch->fighting != victim) + return; + } + + chance = get_skill(ch,gsn_third_attack)/4; + + if (IS_AFFECTED(ch,AFF_SLOW) && !IS_SET(ch->off_flags,OFF_FAST)) + chance = 0; + + if (number_percent() < chance) + { + one_hit(ch,victim,dt); + if (ch->fighting != victim) + return; + } + + /* oh boy! Fun stuff! */ + + if (ch->wait > 0) + return; + + number = number_range(0,2); + + if (number == 1 && IS_SET(ch->act,ACT_MAGE)) + { + /* { mob_cast_mage(ch,victim); return; } */ ; + } + + if (number == 2 && IS_SET(ch->act,ACT_CLERIC)) + { + /* { mob_cast_cleric(ch,victim); return; } */ ; + } + + /* now for the skills */ + + number = number_range(0,8); + + switch(number) + { + case (0) : + if (IS_SET(ch->off_flags,OFF_BASH)) + do_function(ch, &do_bash, ""); + break; + + case (1) : + if (IS_SET(ch->off_flags,OFF_BERSERK) && !IS_AFFECTED(ch,AFF_BERSERK)) + do_function(ch, &do_berserk, ""); + break; + + + case (2) : + if (IS_SET(ch->off_flags,OFF_DISARM) + || (get_weapon_sn(ch) != gsn_hand_to_hand + && (IS_SET(ch->act,ACT_WARRIOR) + || IS_SET(ch->act,ACT_THIEF)))) + do_function(ch, &do_disarm, ""); + break; + + case (3) : + if (IS_SET(ch->off_flags,OFF_KICK)) + do_function(ch, &do_kick, ""); + break; + + case (4) : + if (IS_SET(ch->off_flags,OFF_KICK_DIRT)) + do_function(ch, &do_dirt, ""); + break; + + case (5) : + if (IS_SET(ch->off_flags,OFF_TAIL)) + { + /* do_function(ch, &do_tail, "") */ ; + } + break; + + case (6) : + if (IS_SET(ch->off_flags,OFF_TRIP)) + do_function(ch, &do_trip, ""); + break; + + case (7) : + if (IS_SET(ch->off_flags,OFF_CRUSH)) + { + /* do_function(ch, &do_crush, "") */ ; + } + break; + case (8) : + if (IS_SET(ch->off_flags,OFF_BACKSTAB)) + { + do_function(ch, &do_backstab, ""); + } + } +} + + +/* + * Hit one guy once. + */ +void one_hit( CHAR_DATA *ch, CHAR_DATA *victim, int dt ) +{ + OBJ_DATA *wield; + int victim_ac; + int thac0; + int thac0_00; + int thac0_32; + int dam; + int diceroll; + int sn,skill; + int dam_type; + bool result; + + sn = -1; + + + /* just in case */ + if (victim == ch || ch == NULL || victim == NULL) + return; + + /* + * Can't beat a dead char! + * Guard against weird room-leavings. + */ + if ( victim->position == POS_DEAD || ch->in_room != victim->in_room ) + return; + + /* + * Figure out the type of damage message. + */ + wield = get_eq_char( ch, WEAR_WIELD ); + + if ( dt == TYPE_UNDEFINED ) + { + dt = TYPE_HIT; + if ( wield != NULL && wield->item_type == ITEM_WEAPON ) + dt += wield->value[3]; + else + dt += ch->dam_type; + } + + if (dt < TYPE_HIT) + if (wield != NULL) + dam_type = attack_table[wield->value[3]].damage; + else + dam_type = attack_table[ch->dam_type].damage; + else + dam_type = attack_table[dt - TYPE_HIT].damage; + + if (dam_type == -1) + dam_type = DAM_BASH; + + /* get the weapon skill */ + sn = get_weapon_sn(ch); + skill = 20 + get_weapon_skill(ch,sn); + + /* + * Calculate to-hit-armor-class-0 versus armor. + */ + if ( IS_NPC(ch) ) + { + thac0_00 = 20; + thac0_32 = -4; /* as good as a thief */ + if (IS_SET(ch->act,ACT_WARRIOR)) + thac0_32 = -10; + else if (IS_SET(ch->act,ACT_THIEF)) + thac0_32 = -4; + else if (IS_SET(ch->act,ACT_CLERIC)) + thac0_32 = 2; + else if (IS_SET(ch->act,ACT_MAGE)) + thac0_32 = 6; + } + else + { + thac0_00 = class_table[ch->class].thac0_00; + thac0_32 = class_table[ch->class].thac0_32; + } + thac0 = interpolate( ch->level, thac0_00, thac0_32 ); + + if (thac0 < 0) + thac0 = thac0/2; + + if (thac0 < -5) + thac0 = -5 + (thac0 + 5) / 2; + + thac0 -= GET_HITROLL(ch) * skill/100; + thac0 += 5 * (100 - skill) / 100; + + if (dt == gsn_backstab) + thac0 -= 10 * (100 - get_skill(ch,gsn_backstab)); + + switch(dam_type) + { + case(DAM_PIERCE):victim_ac = GET_AC(victim,AC_PIERCE)/10; break; + case(DAM_BASH): victim_ac = GET_AC(victim,AC_BASH)/10; break; + case(DAM_SLASH): victim_ac = GET_AC(victim,AC_SLASH)/10; break; + default: victim_ac = GET_AC(victim,AC_EXOTIC)/10; break; + }; + + if (victim_ac < -15) + victim_ac = (victim_ac + 15) / 5 - 15; + + if ( !can_see( ch, victim ) ) + victim_ac -= 4; + + if ( victim->position < POS_FIGHTING) + victim_ac += 4; + + if (victim->position < POS_RESTING) + victim_ac += 6; + + /* + * The moment of excitement! + */ + while ( ( diceroll = number_bits( 5 ) ) >= 20 ) + ; + + if ( diceroll == 0 + || ( diceroll != 19 && diceroll < thac0 - victim_ac ) ) + { + /* Miss. */ + damage( ch, victim, 0, dt, dam_type, TRUE ); + tail_chain( ); + return; + } + + /* + * Hit. + * Calc damage. + */ + if ( IS_NPC(ch) && (!ch->pIndexData->new_format || wield == NULL)) + if (!ch->pIndexData->new_format) + { + dam = number_range( ch->level / 2, ch->level * 3 / 2 ); + if ( wield != NULL ) + dam += dam / 2; + } + else + dam = dice(ch->damage[DICE_NUMBER],ch->damage[DICE_TYPE]); + + else + { + if (sn != -1) + check_improve(ch,sn,TRUE,5); + if ( wield != NULL ) + { + if (wield->pIndexData->new_format) + dam = dice(wield->value[1],wield->value[2]) * skill/100; + else + dam = number_range( wield->value[1] * skill/100, + wield->value[2] * skill/100); + + if (get_eq_char(ch,WEAR_SHIELD) == NULL) /* no shield = more */ + dam = dam * 11/10; + + /* sharpness! */ + if (IS_WEAPON_STAT(wield,WEAPON_SHARP)) + { + int percent; + + if ((percent = number_percent()) <= (skill / 8)) + dam = 2 * dam + (dam * 2 * percent / 100); + } + } + else + dam = number_range( 1 + 4 * skill/100, 2 * ch->level/3 * skill/100); + } + + /* + * Bonuses. + */ + if ( get_skill(ch,gsn_enhanced_damage) > 0 ) + { + diceroll = number_percent(); + if (diceroll <= get_skill(ch,gsn_enhanced_damage)) + { + check_improve(ch,gsn_enhanced_damage,TRUE,6); + dam += 2 * ( dam * diceroll/300); + } + } + + if ( !IS_AWAKE(victim) ) + dam *= 2; + else if (victim->position < POS_FIGHTING) + dam = dam * 3 / 2; + + if ( dt == gsn_backstab && wield != NULL) + { if ( wield->value[0] != 2 ) + dam *= 2 + (ch->level / 10); + else + dam *= 2 + (ch->level / 8); + } + dam += GET_DAMROLL(ch) * UMIN(100,skill) /100; + + if ( dam <= 0 ) + dam = 1; + + result = damage( ch, victim, dam, dt, dam_type, TRUE ); + + /* but do we have a funky weapon? */ + if (result && wield != NULL) + { + int dam; + + if (ch->fighting == victim && IS_WEAPON_STAT(wield,WEAPON_POISON)) + { + int level; + AFFECT_DATA *poison, af; + + if ((poison = affect_find(wield->affected,gsn_poison)) == NULL) + level = wield->level; + else + level = poison->level; + + if (!saves_spell(level / 2,victim,DAM_POISON)) + { + send_to_char("You feel poison coursing through your veins.", + victim); + act("$n is poisoned by the venom on $p.", + victim,wield,NULL,TO_ROOM); + + af.where = TO_AFFECTS; + af.type = gsn_poison; + af.level = level * 3/4; + af.duration = level / 2; + af.location = APPLY_STR; + af.modifier = -1; + af.bitvector = AFF_POISON; + affect_join( victim, &af ); + } + + /* weaken the poison if it's temporary */ + if (poison != NULL) + { + poison->level = UMAX(0,poison->level - 2); + poison->duration = UMAX(0,poison->duration - 1); + + if (poison->level == 0 || poison->duration == 0) + act("The poison on $p has worn off.",ch,wield,NULL,TO_CHAR); + } + } + + + if (ch->fighting == victim && IS_WEAPON_STAT(wield,WEAPON_VAMPIRIC)) + { + dam = number_range(1, wield->level / 5 + 1); + act("$p draws life from $n.",victim,wield,NULL,TO_ROOM); + act("You feel $p drawing your life away.", + victim,wield,NULL,TO_CHAR); + damage(ch,victim,dam,0,DAM_NEGATIVE,FALSE); + ch->alignment = UMAX(-1000,ch->alignment - 1); + ch->hit += dam/2; + } + + if (ch->fighting == victim && IS_WEAPON_STAT(wield,WEAPON_FLAMING)) + { + dam = number_range(1,wield->level / 4 + 1); + act("$n is burned by $p.",victim,wield,NULL,TO_ROOM); + act("$p sears your flesh.",victim,wield,NULL,TO_CHAR); + fire_effect( (void *) victim,wield->level/2,dam,TARGET_CHAR); + damage(ch,victim,dam,0,DAM_FIRE,FALSE); + } + + if (ch->fighting == victim && IS_WEAPON_STAT(wield,WEAPON_FROST)) + { + dam = number_range(1,wield->level / 6 + 2); + act("$p freezes $n.",victim,wield,NULL,TO_ROOM); + act("The cold touch of $p surrounds you with ice.", + victim,wield,NULL,TO_CHAR); + cold_effect(victim,wield->level/2,dam,TARGET_CHAR); + damage(ch,victim,dam,0,DAM_COLD,FALSE); + } + + if (ch->fighting == victim && IS_WEAPON_STAT(wield,WEAPON_SHOCKING)) + { + dam = number_range(1,wield->level/5 + 2); + act("$n is struck by lightning from $p.",victim,wield,NULL,TO_ROOM); + act("You are shocked by $p.",victim,wield,NULL,TO_CHAR); + shock_effect(victim,wield->level/2,dam,TARGET_CHAR); + damage(ch,victim,dam,0,DAM_LIGHTNING,FALSE); + } + } + tail_chain( ); + return; +} + + +/* + * Inflict damage from a hit. + */ +bool damage(CHAR_DATA *ch,CHAR_DATA *victim,int dam,int dt,int dam_type, + bool show) +{ + OBJ_DATA *corpse; + bool immune; + + if ( victim->position == POS_DEAD ) + return FALSE; + + /* + * Stop up any residual loopholes. + */ + if ( dam > 1200 && dt >= TYPE_HIT) + { + bug( "Damage: %d: more than 1200 points!", dam ); + dam = 1200; + if (!IS_IMMORTAL(ch)) + { + OBJ_DATA *obj; + obj = get_eq_char( ch, WEAR_WIELD ); + send_to_char("You really shouldn't cheat.\n\r",ch); + if (obj != NULL) + extract_obj(obj); + } + + } + + + /* damage reduction */ + if ( dam > 35) + dam = (dam - 35)/2 + 35; + if ( dam > 80) + dam = (dam - 80)/2 + 80; + + + + + if ( victim != ch ) + { + /* + * Certain attacks are forbidden. + * Most other attacks are returned. + */ + if ( is_safe( ch, victim ) ) + return FALSE; + check_killer( ch, victim ); + + if ( victim->position > POS_STUNNED ) + { + if ( victim->fighting == NULL ) + set_fighting( victim, ch ); + if (victim->timer <= 4) + victim->position = POS_FIGHTING; + } + + if ( victim->position > POS_STUNNED ) + { + if ( ch->fighting == NULL ) + set_fighting( ch, victim ); + } + + /* + * More charm stuff. + */ + if ( victim->master == ch ) + stop_follower( victim ); + } + + /* + * Inviso attacks ... not. + */ + if ( IS_AFFECTED(ch, AFF_INVISIBLE) ) + { + affect_strip( ch, gsn_invis ); + affect_strip( ch, gsn_mass_invis ); + REMOVE_BIT( ch->affected_by, AFF_INVISIBLE ); + act( "$n fades into existence.", ch, NULL, NULL, TO_ROOM ); + } + + /* + * Damage modifiers. + */ + + if ( dam > 1 && !IS_NPC(victim) + && victim->pcdata->condition[COND_DRUNK] > 10 ) + dam = 9 * dam / 10; + + if ( dam > 1 && IS_AFFECTED(victim, AFF_SANCTUARY) ) + dam /= 2; + + if ( dam > 1 && ((IS_AFFECTED(victim, AFF_PROTECT_EVIL) && IS_EVIL(ch) ) + || (IS_AFFECTED(victim, AFF_PROTECT_GOOD) && IS_GOOD(ch) ))) + dam -= dam / 4; + + immune = FALSE; + + + /* + * Check for parry, and dodge. + */ + if ( dt >= TYPE_HIT && ch != victim) + { + if ( check_parry( ch, victim ) ) + return FALSE; + if ( check_dodge( ch, victim ) ) + return FALSE; + if ( check_shield_block(ch,victim)) + return FALSE; + + } + + switch(check_immune(victim,dam_type)) + { + case(IS_IMMUNE): + immune = TRUE; + dam = 0; + break; + case(IS_RESISTANT): + dam -= dam/3; + break; + case(IS_VULNERABLE): + dam += dam/2; + break; + } + + if (show) + dam_message( ch, victim, dam, dt, immune ); + + if (dam == 0) + return FALSE; + + /* + * Hurt the victim. + * Inform the victim of his new state. + */ + victim->hit -= dam; + if ( !IS_NPC(victim) + && victim->level >= LEVEL_IMMORTAL + && victim->hit < 1 ) + victim->hit = 1; + update_pos( victim ); + + switch( victim->position ) + { + case POS_MORTAL: + act( "$n is mortally wounded, and will die soon, if not aided.", + victim, NULL, NULL, TO_ROOM ); + send_to_char( + "You are mortally wounded, and will die soon, if not aided.\n\r", + victim ); + break; + + case POS_INCAP: + act( "$n is incapacitated and will slowly die, if not aided.", + victim, NULL, NULL, TO_ROOM ); + send_to_char( + "You are incapacitated and will slowly die, if not aided.\n\r", + victim ); + break; + + case POS_STUNNED: + act( "$n is stunned, but will probably recover.", + victim, NULL, NULL, TO_ROOM ); + send_to_char("You are stunned, but will probably recover.\n\r", + victim ); + break; + + case POS_DEAD: + act( "$n is DEAD!!", victim, 0, 0, TO_ROOM ); + send_to_char( "You have been KILLED!!\n\r\n\r", victim ); + break; + + default: + if ( dam > victim->max_hit / 4 ) + send_to_char( "That really did HURT!\n\r", victim ); + if ( victim->hit < victim->max_hit / 4 ) + send_to_char( "You sure are BLEEDING!\n\r", victim ); + break; + } + + /* + * Sleep spells and extremely wounded folks. + */ + if ( !IS_AWAKE(victim) ) + stop_fighting( victim, FALSE ); + + /* + * Payoff for killing things. + */ + if ( victim->position == POS_DEAD ) + { + group_gain( ch, victim ); + + if ( !IS_NPC(victim) ) + { + sprintf( log_buf, "%s killed by %s at %d", + victim->name, + (IS_NPC(ch) ? ch->short_descr : ch->name), + ch->in_room->vnum ); + log_string( log_buf ); + + /* + * Dying penalty: + * 2/3 way back to previous level. + */ + if ( victim->exp > exp_per_level(victim,victim->pcdata->points) + * victim->level ) + gain_exp( victim, (2 * (exp_per_level(victim,victim->pcdata->points) + * victim->level - victim->exp)/3) + 50 ); + } + + sprintf( log_buf, "%s got toasted by %s at %s [room %d]", + (IS_NPC(victim) ? victim->short_descr : victim->name), + (IS_NPC(ch) ? ch->short_descr : ch->name), + ch->in_room->name, ch->in_room->vnum); + + if (IS_NPC(victim)) + wiznet(log_buf,NULL,NULL,WIZ_MOBDEATHS,0,0); + else + wiznet(log_buf,NULL,NULL,WIZ_DEATHS,0,0); + + raw_kill( victim ); + /* dump the flags */ + if (ch != victim && !IS_NPC(ch) && !is_same_clan(ch,victim)) + { + if (IS_SET(victim->act,PLR_KILLER)) + REMOVE_BIT(victim->act,PLR_KILLER); + else + REMOVE_BIT(victim->act,PLR_THIEF); + } + + /* RT new auto commands */ + + if (!IS_NPC(ch) + && (corpse = get_obj_list(ch,"corpse",ch->in_room->contents)) != NULL + && corpse->item_type == ITEM_CORPSE_NPC && can_see_obj(ch,corpse)) + { + OBJ_DATA *coins; + + corpse = get_obj_list( ch, "corpse", ch->in_room->contents ); + + if ( IS_SET(ch->act, PLR_AUTOLOOT) && + corpse && corpse->contains) /* exists and not empty */ + { + do_function(ch, &do_get, "all corpse"); + } + + if (IS_SET(ch->act,PLR_AUTOGOLD) && + corpse && corpse->contains && /* exists and not empty */ + !IS_SET(ch->act,PLR_AUTOLOOT)) + { + if ((coins = get_obj_list(ch,"gcash",corpse->contains)) + != NULL) + { + do_function(ch, &do_get, "all.gcash corpse"); + } + } + + if (IS_SET(ch->act, PLR_AUTOSAC)) + { + if (IS_SET(ch->act,PLR_AUTOLOOT) && corpse && corpse->contains) + { + return TRUE; /* leave if corpse has treasure */ + } + else + { + do_function(ch, &do_sacrifice, "corpse"); + } + } + } + + return TRUE; + } + + if ( victim == ch ) + return TRUE; + + /* + * Take care of link dead people. + */ + if ( !IS_NPC(victim) && victim->desc == NULL ) + { + if ( number_range( 0, victim->wait ) == 0 ) + { + do_function(victim, &do_recall, "" ); + return TRUE; + } + } + + /* + * Wimp out? + */ + if ( IS_NPC(victim) && dam > 0 && victim->wait < PULSE_VIOLENCE / 2) + { + if ( ( IS_SET(victim->act, ACT_WIMPY) && number_bits( 2 ) == 0 + && victim->hit < victim->max_hit / 5) + || ( IS_AFFECTED(victim, AFF_CHARM) && victim->master != NULL + && victim->master->in_room != victim->in_room ) ) + { + do_function(victim, &do_flee, "" ); + } + } + + if ( !IS_NPC(victim) + && victim->hit > 0 + && victim->hit <= victim->wimpy + && victim->wait < PULSE_VIOLENCE / 2 ) + { + do_function (victim, &do_flee, "" ); + } + + tail_chain( ); + return TRUE; +} + +bool is_safe(CHAR_DATA *ch, CHAR_DATA *victim) +{ + if (victim->in_room == NULL || ch->in_room == NULL) + return TRUE; + + if (victim->fighting == ch || victim == ch) + return FALSE; + + if (IS_IMMORTAL(ch) && ch->level > LEVEL_IMMORTAL) + return FALSE; + + /* killing mobiles */ + if (IS_NPC(victim)) + { + + /* safe room? */ + if (IS_SET(victim->in_room->room_flags,ROOM_SAFE)) + { + send_to_char("Not in this room.\n\r",ch); + return TRUE; + } + + if (victim->pIndexData->pShop != NULL) + { + send_to_char("The shopkeeper wouldn't like that.\n\r",ch); + return TRUE; + } + + /* no killing healers, trainers, etc */ + if (IS_SET(victim->act,ACT_TRAIN) + || IS_SET(victim->act,ACT_PRACTICE) + || IS_SET(victim->act,ACT_IS_HEALER) + || IS_SET(victim->act,ACT_IS_CHANGER)) + { + send_to_char("I don't think Mota would approve.\n\r",ch); + return TRUE; + } + + if (!IS_NPC(ch)) + { + /* no pets */ + if (IS_SET(victim->act,ACT_PET)) + { + act("But $N looks so cute and cuddly...", + ch,NULL,victim,TO_CHAR); + return TRUE; + } + + /* no charmed creatures unless owner */ + if (IS_AFFECTED(victim,AFF_CHARM) && ch != victim->master) + { + send_to_char("You don't own that monster.\n\r",ch); + return TRUE; + } + } + } + /* killing players */ + else + { + /* NPC doing the killing */ + if (IS_NPC(ch)) + { + /* safe room check */ + if (IS_SET(victim->in_room->room_flags,ROOM_SAFE)) + { + send_to_char("Not in this room.\n\r",ch); + return TRUE; + } + + /* charmed mobs and pets cannot attack players while owned */ + if (IS_AFFECTED(ch,AFF_CHARM) && ch->master != NULL + && ch->master->fighting != victim) + { + send_to_char("Players are your friends!\n\r",ch); + return TRUE; + } + } + /* player doing the killing */ + else + { + if (!is_clan(ch)) + { + send_to_char("Join a clan if you want to kill players.\n\r",ch); + return TRUE; + } + + if (IS_SET(victim->act,PLR_KILLER) || IS_SET(victim->act,PLR_THIEF)) + return FALSE; + + if (!is_clan(victim)) + { + send_to_char("They aren't in a clan, leave them alone.\n\r",ch); + return TRUE; + } + + if (ch->level > victim->level + 8) + { + send_to_char("Pick on someone your own size.\n\r",ch); + return TRUE; + } + } + } + return FALSE; +} + +bool is_safe_spell(CHAR_DATA *ch, CHAR_DATA *victim, bool area ) +{ + if (victim->in_room == NULL || ch->in_room == NULL) + return TRUE; + + if (victim == ch && area) + return TRUE; + + if (victim->fighting == ch || victim == ch) + return FALSE; + + if (IS_IMMORTAL(ch) && ch->level > LEVEL_IMMORTAL && !area) + return FALSE; + + /* killing mobiles */ + if (IS_NPC(victim)) + { + /* safe room? */ + if (IS_SET(victim->in_room->room_flags,ROOM_SAFE)) + return TRUE; + + if (victim->pIndexData->pShop != NULL) + return TRUE; + + /* no killing healers, trainers, etc */ + if (IS_SET(victim->act,ACT_TRAIN) + || IS_SET(victim->act,ACT_PRACTICE) + || IS_SET(victim->act,ACT_IS_HEALER) + || IS_SET(victim->act,ACT_IS_CHANGER)) + return TRUE; + + if (!IS_NPC(ch)) + { + /* no pets */ + if (IS_SET(victim->act,ACT_PET)) + return TRUE; + + /* no charmed creatures unless owner */ + if (IS_AFFECTED(victim,AFF_CHARM) && (area || ch != victim->master)) + return TRUE; + + /* legal kill? -- cannot hit mob fighting non-group member */ + if (victim->fighting != NULL && !is_same_group(ch,victim->fighting)) + return TRUE; + } + else + { + /* area effect spells do not hit other mobs */ + if (area && !is_same_group(victim,ch->fighting)) + return TRUE; + } + } + /* killing players */ + else + { + if (area && IS_IMMORTAL(victim) && victim->level > LEVEL_IMMORTAL) + return TRUE; + + /* NPC doing the killing */ + if (IS_NPC(ch)) + { + /* charmed mobs and pets cannot attack players while owned */ + if (IS_AFFECTED(ch,AFF_CHARM) && ch->master != NULL + && ch->master->fighting != victim) + return TRUE; + + /* safe room? */ + if (IS_SET(victim->in_room->room_flags,ROOM_SAFE)) + return TRUE; + + /* legal kill? -- mobs only hit players grouped with opponent*/ + if (ch->fighting != NULL && !is_same_group(ch->fighting,victim)) + return TRUE; + } + + /* player doing the killing */ + else + { + if (!is_clan(ch)) + return TRUE; + + if (IS_SET(victim->act,PLR_KILLER) || IS_SET(victim->act,PLR_THIEF)) + return FALSE; + + if (!is_clan(victim)) + return TRUE; + + if (ch->level > victim->level + 8) + return TRUE; + } + + } + return FALSE; +} +/* + * See if an attack justifies a KILLER flag. + */ +void check_killer( CHAR_DATA *ch, CHAR_DATA *victim ) +{ + char buf[MAX_STRING_LENGTH]; + /* + * Follow charm thread to responsible character. + * Attacking someone's charmed char is hostile! + */ + while ( IS_AFFECTED(victim, AFF_CHARM) && victim->master != NULL ) + victim = victim->master; + + /* + * NPC's are fair game. + * So are killers and thieves. + */ + if ( IS_NPC(victim) + || IS_SET(victim->act, PLR_KILLER) + || IS_SET(victim->act, PLR_THIEF)) + return; + + /* + * Charm-o-rama. + */ + if ( IS_SET(ch->affected_by, AFF_CHARM) ) + { + if ( ch->master == NULL ) + { + char buf[MAX_STRING_LENGTH]; + + sprintf( buf, "Check_killer: %s bad AFF_CHARM", + IS_NPC(ch) ? ch->short_descr : ch->name ); + bug( buf, 0 ); + affect_strip( ch, gsn_charm_person ); + REMOVE_BIT( ch->affected_by, AFF_CHARM ); + return; + } +/* + send_to_char( "*** You are now a KILLER!! ***\n\r", ch->master ); + SET_BIT(ch->master->act, PLR_KILLER); +*/ + + stop_follower( ch ); + return; + } + + /* + * NPC's are cool of course (as long as not charmed). + * Hitting yourself is cool too (bleeding). + * So is being immortal (Alander's idea). + * And current killers stay as they are. + */ + if ( IS_NPC(ch) + || ch == victim + || ch->level >= LEVEL_IMMORTAL + || !is_clan(ch) + || IS_SET(ch->act, PLR_KILLER) + || ch->fighting == victim) + return; + + send_to_char( "*** You are now a KILLER!! ***\n\r", ch ); + SET_BIT(ch->act, PLR_KILLER); + sprintf(buf,"$N is attempting to murder %s",victim->name); + wiznet(buf,ch,NULL,WIZ_FLAGS,0,0); + save_char_obj( ch ); + return; +} + + + +/* + * Check for parry. + */ +bool check_parry( CHAR_DATA *ch, CHAR_DATA *victim ) +{ + int chance; + + if ( !IS_AWAKE(victim) ) + return FALSE; + + chance = get_skill(victim,gsn_parry) / 2; + + if ( get_eq_char( victim, WEAR_WIELD ) == NULL ) + { + if (IS_NPC(victim)) + chance /= 2; + else + return FALSE; + } + + if (!can_see(ch,victim)) + chance /= 2; + + if ( number_percent( ) >= chance + victim->level - ch->level ) + return FALSE; + + act( "You parry $n's attack.", ch, NULL, victim, TO_VICT ); + act( "$N parries your attack.", ch, NULL, victim, TO_CHAR ); + check_improve(victim,gsn_parry,TRUE,6); + return TRUE; +} + +/* + * Check for shield block. + */ +bool check_shield_block( CHAR_DATA *ch, CHAR_DATA *victim ) +{ + int chance; + + if ( !IS_AWAKE(victim) ) + return FALSE; + + + chance = get_skill(victim,gsn_shield_block) / 5 + 3; + + + if ( get_eq_char( victim, WEAR_SHIELD ) == NULL ) + return FALSE; + + if ( number_percent( ) >= chance + victim->level - ch->level ) + return FALSE; + + act( "You block $n's attack with your shield.", ch, NULL, victim, +TO_VICT ); + act( "$N blocks your attack with a shield.", ch, NULL, victim, +TO_CHAR ); + check_improve(victim,gsn_shield_block,TRUE,6); + return TRUE; +} + + +/* + * Check for dodge. + */ +bool check_dodge( CHAR_DATA *ch, CHAR_DATA *victim ) +{ + int chance; + + if ( !IS_AWAKE(victim) ) + return FALSE; + + chance = get_skill(victim,gsn_dodge) / 2; + + if (!can_see(victim,ch)) + chance /= 2; + + if ( number_percent( ) >= chance + victim->level - ch->level ) + return FALSE; + + act( "You dodge $n's attack.", ch, NULL, victim, TO_VICT ); + act( "$N dodges your attack.", ch, NULL, victim, TO_CHAR ); + check_improve(victim,gsn_dodge,TRUE,6); + return TRUE; +} + + + +/* + * Set position of a victim. + */ +void update_pos( CHAR_DATA *victim ) +{ + if ( victim->hit > 0 ) + { + if ( victim->position <= POS_STUNNED ) + victim->position = POS_STANDING; + return; + } + + if ( IS_NPC(victim) && victim->hit < 1 ) + { + victim->position = POS_DEAD; + return; + } + + if ( victim->hit <= -11 ) + { + victim->position = POS_DEAD; + return; + } + + if ( victim->hit <= -6 ) victim->position = POS_MORTAL; + else if ( victim->hit <= -3 ) victim->position = POS_INCAP; + else victim->position = POS_STUNNED; + + return; +} + + + +/* + * Start fights. + */ +void set_fighting( CHAR_DATA *ch, CHAR_DATA *victim ) +{ + if ( ch->fighting != NULL ) + { + bug( "Set_fighting: already fighting", 0 ); + return; + } + + if ( IS_AFFECTED(ch, AFF_SLEEP) ) + affect_strip( ch, gsn_sleep ); + + ch->fighting = victim; + ch->position = POS_FIGHTING; + + return; +} + + + +/* + * Stop fights. + */ +void stop_fighting( CHAR_DATA *ch, bool fBoth ) +{ + CHAR_DATA *fch; + + for ( fch = char_list; fch != NULL; fch = fch->next ) + { + if ( fch == ch || ( fBoth && fch->fighting == ch ) ) + { + fch->fighting = NULL; + fch->position = IS_NPC(fch) ? fch->default_pos : POS_STANDING; + update_pos( fch ); + } + } + + return; +} + + + +/* + * Make a corpse out of a character. + */ +void make_corpse( CHAR_DATA *ch ) +{ + char buf[MAX_STRING_LENGTH]; + OBJ_DATA *corpse; + OBJ_DATA *obj; + OBJ_DATA *obj_next; + char *name; + + if ( IS_NPC(ch) ) + { + name = ch->short_descr; + corpse = create_object(get_obj_index(OBJ_VNUM_CORPSE_NPC), 0); + corpse->timer = number_range( 3, 6 ); + if ( ch->gold > 0 ) + { + obj_to_obj( create_money( ch->gold, ch->silver ), corpse ); + ch->gold = 0; + ch->silver = 0; + } + corpse->cost = 0; + } + else + { + name = ch->name; + corpse = create_object(get_obj_index(OBJ_VNUM_CORPSE_PC), 0); + corpse->timer = number_range( 25, 40 ); + REMOVE_BIT(ch->act,PLR_CANLOOT); + if (!is_clan(ch)) + corpse->owner = str_dup(ch->name); + else + { + corpse->owner = NULL; + if (ch->gold > 1 || ch->silver > 1) + { + obj_to_obj(create_money(ch->gold / 2, ch->silver/2), corpse); + ch->gold -= ch->gold/2; + ch->silver -= ch->silver/2; + } + } + + corpse->cost = 0; + } + + corpse->level = ch->level; + + sprintf( buf, corpse->short_descr, name ); + free_string( corpse->short_descr ); + corpse->short_descr = str_dup( buf ); + + sprintf( buf, corpse->description, name ); + free_string( corpse->description ); + corpse->description = str_dup( buf ); + + for ( obj = ch->carrying; obj != NULL; obj = obj_next ) + { + bool floating = FALSE; + + obj_next = obj->next_content; + if (obj->wear_loc == WEAR_FLOAT) + floating = TRUE; + obj_from_char( obj ); + if (obj->item_type == ITEM_POTION) + obj->timer = number_range(500,1000); + if (obj->item_type == ITEM_SCROLL) + obj->timer = number_range(1000,2500); + if (IS_SET(obj->extra_flags,ITEM_ROT_DEATH) && !floating) + { + obj->timer = number_range(5,10); + REMOVE_BIT(obj->extra_flags,ITEM_ROT_DEATH); + } + REMOVE_BIT(obj->extra_flags,ITEM_VIS_DEATH); + + if ( IS_SET( obj->extra_flags, ITEM_INVENTORY ) ) + extract_obj( obj ); + else if (floating) + { + if (IS_OBJ_STAT(obj,ITEM_ROT_DEATH)) /* get rid of it! */ + { + if (obj->contains != NULL) + { + OBJ_DATA *in, *in_next; + + act("$p evaporates,scattering its contents.", + ch,obj,NULL,TO_ROOM); + for (in = obj->contains; in != NULL; in = in_next) + { + in_next = in->next_content; + obj_from_obj(in); + obj_to_room(in,ch->in_room); + } + } + else + act("$p evaporates.", + ch,obj,NULL,TO_ROOM); + extract_obj(obj); + } + else + { + act("$p falls to the floor.",ch,obj,NULL,TO_ROOM); + obj_to_room(obj,ch->in_room); + } + } + else + obj_to_obj( obj, corpse ); + } + + obj_to_room( corpse, ch->in_room ); + return; +} + + + +/* + * Improved Death_cry contributed by Diavolo. + */ +void death_cry( CHAR_DATA *ch ) +{ + ROOM_INDEX_DATA *was_in_room; + char *msg; + int door; + int vnum; + + vnum = 0; + msg = "You hear $n's death cry."; + + switch ( number_bits(4)) + { + case 0: msg = "$n hits the ground ... DEAD."; break; + case 1: + if (ch->material == 0) + { + msg = "$n splatters blood on your armor."; + break; + } + case 2: + if (IS_SET(ch->parts,PART_GUTS)) + { + msg = "$n spills $s guts all over the floor."; + vnum = OBJ_VNUM_GUTS; + } + break; + case 3: + if (IS_SET(ch->parts,PART_HEAD)) + { + msg = "$n's severed head plops on the ground."; + vnum = OBJ_VNUM_SEVERED_HEAD; + } + break; + case 4: + if (IS_SET(ch->parts,PART_HEART)) + { + msg = "$n's heart is torn from $s chest."; + vnum = OBJ_VNUM_TORN_HEART; + } + break; + case 5: + if (IS_SET(ch->parts,PART_ARMS)) + { + msg = "$n's arm is sliced from $s dead body."; + vnum = OBJ_VNUM_SLICED_ARM; + } + break; + case 6: + if (IS_SET(ch->parts,PART_LEGS)) + { + msg = "$n's leg is sliced from $s dead body."; + vnum = OBJ_VNUM_SLICED_LEG; + } + break; + case 7: + if (IS_SET(ch->parts,PART_BRAINS)) + { + msg = "$n's head is shattered, and $s brains splash all over you."; + vnum = OBJ_VNUM_BRAINS; + } + } + + act( msg, ch, NULL, NULL, TO_ROOM ); + + if ( vnum != 0 ) + { + char buf[MAX_STRING_LENGTH]; + OBJ_DATA *obj; + char *name; + + name = IS_NPC(ch) ? ch->short_descr : ch->name; + obj = create_object( get_obj_index( vnum ), 0 ); + obj->timer = number_range( 4, 7 ); + + sprintf( buf, obj->short_descr, name ); + free_string( obj->short_descr ); + obj->short_descr = str_dup( buf ); + + sprintf( buf, obj->description, name ); + free_string( obj->description ); + obj->description = str_dup( buf ); + + if (obj->item_type == ITEM_FOOD) + { + if (IS_SET(ch->form,FORM_POISON)) + obj->value[3] = 1; + else if (!IS_SET(ch->form,FORM_EDIBLE)) + obj->item_type = ITEM_TRASH; + } + + obj_to_room( obj, ch->in_room ); + } + + if ( IS_NPC(ch) ) + msg = "You hear something's death cry."; + else + msg = "You hear someone's death cry."; + + was_in_room = ch->in_room; + for ( door = 0; door <= 5; door++ ) + { + EXIT_DATA *pexit; + + if ( ( pexit = was_in_room->exit[door] ) != NULL + && pexit->u1.to_room != NULL + && pexit->u1.to_room != was_in_room ) + { + ch->in_room = pexit->u1.to_room; + act( msg, ch, NULL, NULL, TO_ROOM ); + } + } + ch->in_room = was_in_room; + + return; +} + + + +void raw_kill( CHAR_DATA *victim ) +{ + int i; + + stop_fighting( victim, TRUE ); + death_cry( victim ); + make_corpse( victim ); + + if ( IS_NPC(victim) ) + { + victim->pIndexData->killed++; + kill_table[URANGE(0, victim->level, MAX_LEVEL-1)].killed++; + extract_char( victim, TRUE ); + return; + } + + extract_char( victim, FALSE ); + while ( victim->affected ) + affect_remove( victim, victim->affected ); + victim->affected_by = race_table[victim->race].aff; + for (i = 0; i < 4; i++) + victim->armor[i]= 100; + victim->position = POS_RESTING; + victim->hit = UMAX( 1, victim->hit ); + victim->mana = UMAX( 1, victim->mana ); + victim->move = UMAX( 1, victim->move ); +/* save_char_obj( victim ); we're stable enough to not need this :) */ + return; +} + + + +void group_gain( CHAR_DATA *ch, CHAR_DATA *victim ) +{ + char buf[MAX_STRING_LENGTH]; + CHAR_DATA *gch; + CHAR_DATA *lch; + int xp; + int members; + int group_levels; + + /* + * Monsters don't get kill xp's or alignment changes. + * P-killing doesn't help either. + * Dying of mortal wounds or poison doesn't give xp to anyone! + */ + if ( victim == ch ) + return; + + members = 0; + group_levels = 0; + for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room ) + { + if ( is_same_group( gch, ch ) ) + { + members++; + group_levels += IS_NPC(gch) ? gch->level / 2 : gch->level; + } + } + + if ( members == 0 ) + { + bug( "Group_gain: members.", members ); + members = 1; + group_levels = ch->level ; + } + + lch = (ch->leader != NULL) ? ch->leader : ch; + + for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room ) + { + OBJ_DATA *obj; + OBJ_DATA *obj_next; + + if ( !is_same_group( gch, ch ) || IS_NPC(gch)) + continue; + +/* Taken out, add it back if you want it + if ( gch->level - lch->level >= 5 ) + { + send_to_char( "You are too high for this group.\n\r", gch ); + continue; + } + + if ( gch->level - lch->level <= -5 ) + { + send_to_char( "You are too low for this group.\n\r", gch ); + continue; + } +*/ + + xp = xp_compute( gch, victim, group_levels ); + sprintf( buf, "You receive %d experience points.\n\r", xp ); + send_to_char( buf, gch ); + gain_exp( gch, xp ); + + for ( obj = ch->carrying; obj != NULL; obj = obj_next ) + { + obj_next = obj->next_content; + if ( obj->wear_loc == WEAR_NONE ) + continue; + + if ( ( IS_OBJ_STAT(obj, ITEM_ANTI_EVIL) && IS_EVIL(ch) ) + || ( IS_OBJ_STAT(obj, ITEM_ANTI_GOOD) && IS_GOOD(ch) ) + || ( IS_OBJ_STAT(obj, ITEM_ANTI_NEUTRAL) && IS_NEUTRAL(ch) ) ) + { + act( "You are zapped by $p.", ch, obj, NULL, TO_CHAR ); + act( "$n is zapped by $p.", ch, obj, NULL, TO_ROOM ); + obj_from_char( obj ); + obj_to_room( obj, ch->in_room ); + } + } + } + + return; +} + + + +/* + * Compute xp for a kill. + * Also adjust alignment of killer. + * Edit this function to change xp computations. + */ +int xp_compute( CHAR_DATA *gch, CHAR_DATA *victim, int total_levels ) +{ + int xp,base_exp; + int align,level_range; + int change; + int time_per_level; + + level_range = victim->level - gch->level; + + /* compute the base exp */ + switch (level_range) + { + default : base_exp = 0; break; + case -9 : base_exp = 1; break; + case -8 : base_exp = 2; break; + case -7 : base_exp = 5; break; + case -6 : base_exp = 9; break; + case -5 : base_exp = 11; break; + case -4 : base_exp = 22; break; + case -3 : base_exp = 33; break; + case -2 : base_exp = 50; break; + case -1 : base_exp = 66; break; + case 0 : base_exp = 83; break; + case 1 : base_exp = 99; break; + case 2 : base_exp = 121; break; + case 3 : base_exp = 143; break; + case 4 : base_exp = 165; break; + } + + if (level_range > 4) + base_exp = 160 + 20 * (level_range - 4); + + /* do alignment computations */ + + align = victim->alignment - gch->alignment; + + if (IS_SET(victim->act,ACT_NOALIGN)) + { + /* no change */ + } + + else if (align > 500) /* monster is more good than slayer */ + { + change = (align - 500) * base_exp / 500 * gch->level/total_levels; + change = UMAX(1,change); + gch->alignment = UMAX(-1000,gch->alignment - change); + } + + else if (align < -500) /* monster is more evil than slayer */ + { + change = ( -1 * align - 500) * base_exp/500 * gch->level/total_levels; + change = UMAX(1,change); + gch->alignment = UMIN(1000,gch->alignment + change); + } + + else /* improve this someday */ + { + change = gch->alignment * base_exp/500 * gch->level/total_levels; + gch->alignment -= change; + } + + /* calculate exp multiplier */ + if (IS_SET(victim->act,ACT_NOALIGN)) + xp = base_exp; + + else if (gch->alignment > 500) /* for goodie two shoes */ + { + if (victim->alignment < -750) + xp = (base_exp *4)/3; + + else if (victim->alignment < -500) + xp = (base_exp * 5)/4; + + else if (victim->alignment > 750) + xp = base_exp / 4; + + else if (victim->alignment > 500) + xp = base_exp / 2; + + else if (victim->alignment > 250) + xp = (base_exp * 3)/4; + + else + xp = base_exp; + } + + else if (gch->alignment < -500) /* for baddies */ + { + if (victim->alignment > 750) + xp = (base_exp * 5)/4; + + else if (victim->alignment > 500) + xp = (base_exp * 11)/10; + + else if (victim->alignment < -750) + xp = base_exp/2; + + else if (victim->alignment < -500) + xp = (base_exp * 3)/4; + + else if (victim->alignment < -250) + xp = (base_exp * 9)/10; + + else + xp = base_exp; + } + + else if (gch->alignment > 200) /* a little good */ + { + + if (victim->alignment < -500) + xp = (base_exp * 6)/5; + + else if (victim->alignment > 750) + xp = base_exp/2; + + else if (victim->alignment > 0) + xp = (base_exp * 3)/4; + + else + xp = base_exp; + } + + else if (gch->alignment < -200) /* a little bad */ + { + if (victim->alignment > 500) + xp = (base_exp * 6)/5; + + else if (victim->alignment < -750) + xp = base_exp/2; + + else if (victim->alignment < 0) + xp = (base_exp * 3)/4; + + else + xp = base_exp; + } + + else /* neutral */ + { + + if (victim->alignment > 500 || victim->alignment < -500) + xp = (base_exp * 4)/3; + + else if (victim->alignment < 200 && victim->alignment > -200) + xp = base_exp/2; + + else + xp = base_exp; + } + + /* more exp at the low levels */ + if (gch->level < 6) + xp = 10 * xp / (gch->level + 4); + + /* less at high */ + if (gch->level > 35 ) + xp = 15 * xp / (gch->level - 25 ); + + /* reduce for playing time */ + + { + /* compute quarter-hours per level */ + time_per_level = 4 * + (gch->played + (int) (current_time - gch->logon))/3600 + / gch->level; + + time_per_level = URANGE(2,time_per_level,12); + if (gch->level < 15) /* make it a curve */ + time_per_level = UMAX(time_per_level,(15 - gch->level)); + xp = xp * time_per_level / 12; + } + + /* randomize the rewards */ + xp = number_range (xp * 3/4, xp * 5/4); + + /* adjust for grouping */ + xp = xp * gch->level/( UMAX(1,total_levels -1) ); + + return xp; +} + + +void dam_message( CHAR_DATA *ch, CHAR_DATA *victim,int dam,int dt,bool immune ) +{ + char buf1[256], buf2[256], buf3[256]; + const char *vs; + const char *vp; + const char *attack; + char punct; + + if (ch == NULL || victim == NULL) + return; + + if ( dam == 0 ) { vs = "miss"; vp = "misses"; } + else if ( dam <= 4 ) { vs = "scratch"; vp = "scratches"; } + else if ( dam <= 8 ) { vs = "graze"; vp = "grazes"; } + else if ( dam <= 12 ) { vs = "hit"; vp = "hits"; } + else if ( dam <= 16 ) { vs = "injure"; vp = "injures"; } + else if ( dam <= 20 ) { vs = "wound"; vp = "wounds"; } + else if ( dam <= 24 ) { vs = "maul"; vp = "mauls"; } + else if ( dam <= 28 ) { vs = "decimate"; vp = "decimates"; } + else if ( dam <= 32 ) { vs = "devastate"; vp = "devastates"; } + else if ( dam <= 36 ) { vs = "maim"; vp = "maims"; } + else if ( dam <= 40 ) { vs = "MUTILATE"; vp = "MUTILATES"; } + else if ( dam <= 44 ) { vs = "DISEMBOWEL"; vp = "DISEMBOWELS"; } + else if ( dam <= 48 ) { vs = "DISMEMBER"; vp = "DISMEMBERS"; } + else if ( dam <= 52 ) { vs = "MASSACRE"; vp = "MASSACRES"; } + else if ( dam <= 56 ) { vs = "MANGLE"; vp = "MANGLES"; } + else if ( dam <= 60 ) { vs = "*** DEMOLISH ***"; + vp = "*** DEMOLISHES ***"; } + else if ( dam <= 75 ) { vs = "*** DEVASTATE ***"; + vp = "*** DEVASTATES ***"; } + else if ( dam <= 100) { vs = "=== OBLITERATE ==="; + vp = "=== OBLITERATES ==="; } + else if ( dam <= 125) { vs = ">>> ANNIHILATE <<<"; + vp = ">>> ANNIHILATES <<<"; } + else if ( dam <= 150) { vs = "<<< ERADICATE >>>"; + vp = "<<< ERADICATES >>>"; } + else { vs = "do UNSPEAKABLE things to"; + vp = "does UNSPEAKABLE things to"; } + + punct = (dam <= 24) ? '.' : '!'; + + if ( dt == TYPE_HIT ) + { + if (ch == victim) + { + sprintf( buf1, "$n %s $melf%c",vp,punct); + sprintf( buf2, "You %s yourself%c",vs,punct); + } + else + { + sprintf( buf1, "$n %s $N%c", vp, punct ); + sprintf( buf2, "You %s $N%c", vs, punct ); + sprintf( buf3, "$n %s you%c", vp, punct ); + } + } + else + { + if ( dt >= 0 && dt < MAX_SKILL ) + attack = skill_table[dt].noun_damage; + else if ( dt >= TYPE_HIT + && dt < TYPE_HIT + MAX_DAMAGE_MESSAGE) + attack = attack_table[dt - TYPE_HIT].noun; + else + { + bug( "Dam_message: bad dt %d.", dt ); + dt = TYPE_HIT; + attack = attack_table[0].name; + } + + if (immune) + { + if (ch == victim) + { + sprintf(buf1,"$n is unaffected by $s own %s.",attack); + sprintf(buf2,"Luckily, you are immune to that."); + } + else + { + sprintf(buf1,"$N is unaffected by $n's %s!",attack); + sprintf(buf2,"$N is unaffected by your %s!",attack); + sprintf(buf3,"$n's %s is powerless against you.",attack); + } + } + else + { + if (ch == victim) + { + sprintf( buf1, "$n's %s %s $m%c",attack,vp,punct); + sprintf( buf2, "Your %s %s you%c",attack,vp,punct); + } + else + { + sprintf( buf1, "$n's %s %s $N%c", attack, vp, punct ); + sprintf( buf2, "Your %s %s $N%c", attack, vp, punct ); + sprintf( buf3, "$n's %s %s you%c", attack, vp, punct ); + } + } + } + + if (ch == victim) + { + act(buf1,ch,NULL,NULL,TO_ROOM); + act(buf2,ch,NULL,NULL,TO_CHAR); + } + else + { + act( buf1, ch, NULL, victim, TO_NOTVICT ); + act( buf2, ch, NULL, victim, TO_CHAR ); + act( buf3, ch, NULL, victim, TO_VICT ); + } + + return; +} + + + +/* + * Disarm a creature. + * Caller must check for successful attack. + */ +void disarm( CHAR_DATA *ch, CHAR_DATA *victim ) +{ + OBJ_DATA *obj; + + if ( ( obj = get_eq_char( victim, WEAR_WIELD ) ) == NULL ) + return; + + if ( IS_OBJ_STAT(obj,ITEM_NOREMOVE)) + { + act("$S weapon won't budge!",ch,NULL,victim,TO_CHAR); + act("$n tries to disarm you, but your weapon won't budge!", + ch,NULL,victim,TO_VICT); + act("$n tries to disarm $N, but fails.",ch,NULL,victim,TO_NOTVICT); + return; + } + + act( "$n DISARMS you and sends your weapon flying!", + ch, NULL, victim, TO_VICT ); + act( "You disarm $N!", ch, NULL, victim, TO_CHAR ); + act( "$n disarms $N!", ch, NULL, victim, TO_NOTVICT ); + + obj_from_char( obj ); + if ( IS_OBJ_STAT(obj,ITEM_NODROP) || IS_OBJ_STAT(obj,ITEM_INVENTORY) ) + obj_to_char( obj, victim ); + else + { + obj_to_room( obj, victim->in_room ); + if (IS_NPC(victim) && victim->wait == 0 && can_see_obj(victim,obj)) + get_obj(victim,obj,NULL); + } + + return; +} + +void do_berserk( CHAR_DATA *ch, char *argument) +{ + int chance, hp_percent; + + if ((chance = get_skill(ch,gsn_berserk)) == 0 + || (IS_NPC(ch) && !IS_SET(ch->off_flags,OFF_BERSERK)) + || (!IS_NPC(ch) + && ch->level < skill_table[gsn_berserk].skill_level[ch->class])) + { + send_to_char("You turn red in the face, but nothing happens.\n\r",ch); + return; + } + + if (IS_AFFECTED(ch,AFF_BERSERK) || is_affected(ch,gsn_berserk) + || is_affected(ch,skill_lookup("frenzy"))) + { + send_to_char("You get a little madder.\n\r",ch); + return; + } + + if (IS_AFFECTED(ch,AFF_CALM)) + { + send_to_char("You're feeling to mellow to berserk.\n\r",ch); + return; + } + + if (ch->mana < 50) + { + send_to_char("You can't get up enough energy.\n\r",ch); + return; + } + + /* modifiers */ + + /* fighting */ + if (ch->position == POS_FIGHTING) + chance += 10; + + /* damage -- below 50% of hp helps, above hurts */ + hp_percent = 100 * ch->hit/ch->max_hit; + chance += 25 - hp_percent/2; + + if (number_percent() < chance) + { + AFFECT_DATA af; + + WAIT_STATE(ch,PULSE_VIOLENCE); + ch->mana -= 50; + ch->move /= 2; + + /* heal a little damage */ + ch->hit += ch->level * 2; + ch->hit = UMIN(ch->hit,ch->max_hit); + + send_to_char("Your pulse races as you are consumed by rage!\n\r",ch); + act("$n gets a wild look in $s eyes.",ch,NULL,NULL,TO_ROOM); + check_improve(ch,gsn_berserk,TRUE,2); + + af.where = TO_AFFECTS; + af.type = gsn_berserk; + af.level = ch->level; + af.duration = number_fuzzy(ch->level / 8); + af.modifier = UMAX(1,ch->level/5); + af.bitvector = AFF_BERSERK; + + af.location = APPLY_HITROLL; + affect_to_char(ch,&af); + + af.location = APPLY_DAMROLL; + affect_to_char(ch,&af); + + af.modifier = UMAX(10,10 * (ch->level/5)); + af.location = APPLY_AC; + affect_to_char(ch,&af); + } + + else + { + WAIT_STATE(ch,3 * PULSE_VIOLENCE); + ch->mana -= 25; + ch->move /= 2; + + send_to_char("Your pulse speeds up, but nothing happens.\n\r",ch); + check_improve(ch,gsn_berserk,FALSE,2); + } +} + +void do_bash( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + CHAR_DATA *victim; + int chance; + + one_argument(argument,arg); + + if ( (chance = get_skill(ch,gsn_bash)) == 0 + || (IS_NPC(ch) && !IS_SET(ch->off_flags,OFF_BASH)) + || (!IS_NPC(ch) + && ch->level < skill_table[gsn_bash].skill_level[ch->class])) + { + send_to_char("Bashing? What's that?\n\r",ch); + return; + } + + if (arg[0] == '\0') + { + victim = ch->fighting; + if (victim == NULL) + { + send_to_char("But you aren't fighting anyone!\n\r",ch); + return; + } + } + + else if ((victim = get_char_room(ch,arg)) == NULL) + { + send_to_char("They aren't here.\n\r",ch); + return; + } + + if (victim->position < POS_FIGHTING) + { + act("You'll have to let $M get back up first.",ch,NULL,victim,TO_CHAR); + return; + } + + if (victim == ch) + { + send_to_char("You try to bash your brains out, but fail.\n\r",ch); + return; + } + + if (is_safe(ch,victim)) + return; + + if ( IS_NPC(victim) && + victim->fighting != NULL && + !is_same_group(ch,victim->fighting)) + { + send_to_char("Kill stealing is not permitted.\n\r",ch); + return; + } + + if (IS_AFFECTED(ch,AFF_CHARM) && ch->master == victim) + { + act("But $N is your friend!",ch,NULL,victim,TO_CHAR); + return; + } + + /* modifiers */ + + /* size and weight */ + chance += ch->carry_weight / 250; + chance -= victim->carry_weight / 200; + + if (ch->size < victim->size) + chance += (ch->size - victim->size) * 15; + else + chance += (ch->size - victim->size) * 10; + + + /* stats */ + chance += get_curr_stat(ch,STAT_STR); + chance -= (get_curr_stat(victim,STAT_DEX) * 4)/3; + chance -= GET_AC(victim,AC_BASH) /25; + /* speed */ + if (IS_SET(ch->off_flags,OFF_FAST) || IS_AFFECTED(ch,AFF_HASTE)) + chance += 10; + if (IS_SET(victim->off_flags,OFF_FAST) || IS_AFFECTED(victim,AFF_HASTE)) + chance -= 30; + + /* level */ + chance += (ch->level - victim->level); + + if (!IS_NPC(victim) + && chance < get_skill(victim,gsn_dodge) ) + { /* + act("$n tries to bash you, but you dodge it.",ch,NULL,victim,TO_VICT); + act("$N dodges your bash, you fall flat on your face.",ch,NULL,victim,TO_CHAR); + WAIT_STATE(ch,skill_table[gsn_bash].beats); + return;*/ + chance -= 3 * (get_skill(victim,gsn_dodge) - chance); + } + + /* now the attack */ + if (number_percent() < chance ) + { + + act("$n sends you sprawling with a powerful bash!", + ch,NULL,victim,TO_VICT); + act("You slam into $N, and send $M flying!",ch,NULL,victim,TO_CHAR); + act("$n sends $N sprawling with a powerful bash.", + ch,NULL,victim,TO_NOTVICT); + check_improve(ch,gsn_bash,TRUE,1); + + DAZE_STATE(victim, 3 * PULSE_VIOLENCE); + WAIT_STATE(ch,skill_table[gsn_bash].beats); + victim->position = POS_RESTING; + damage(ch,victim,number_range(2,2 + 2 * ch->size + chance/20),gsn_bash, + DAM_BASH,FALSE); + + } + else + { + damage(ch,victim,0,gsn_bash,DAM_BASH,FALSE); + act("You fall flat on your face!", + ch,NULL,victim,TO_CHAR); + act("$n falls flat on $s face.", + ch,NULL,victim,TO_NOTVICT); + act("You evade $n's bash, causing $m to fall flat on $s face.", + ch,NULL,victim,TO_VICT); + check_improve(ch,gsn_bash,FALSE,1); + ch->position = POS_RESTING; + WAIT_STATE(ch,skill_table[gsn_bash].beats * 3/2); + } + check_killer(ch,victim); +} + +void do_dirt( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + CHAR_DATA *victim; + int chance; + + one_argument(argument,arg); + + if ( (chance = get_skill(ch,gsn_dirt)) == 0 + || (IS_NPC(ch) && !IS_SET(ch->off_flags,OFF_KICK_DIRT)) + || (!IS_NPC(ch) + && ch->level < skill_table[gsn_dirt].skill_level[ch->class])) + { + send_to_char("You get your feet dirty.\n\r",ch); + return; + } + + if (arg[0] == '\0') + { + victim = ch->fighting; + if (victim == NULL) + { + send_to_char("But you aren't in combat!\n\r",ch); + return; + } + } + + else if ((victim = get_char_room(ch,arg)) == NULL) + { + send_to_char("They aren't here.\n\r",ch); + return; + } + + if (IS_AFFECTED(victim,AFF_BLIND)) + { + act("$E's already been blinded.",ch,NULL,victim,TO_CHAR); + return; + } + + if (victim == ch) + { + send_to_char("Very funny.\n\r",ch); + return; + } + + if (is_safe(ch,victim)) + return; + + if (IS_NPC(victim) && + victim->fighting != NULL && + !is_same_group(ch,victim->fighting)) + { + send_to_char("Kill stealing is not permitted.\n\r",ch); + return; + } + + if (IS_AFFECTED(ch,AFF_CHARM) && ch->master == victim) + { + act("But $N is such a good friend!",ch,NULL,victim,TO_CHAR); + return; + } + + /* modifiers */ + + /* dexterity */ + chance += get_curr_stat(ch,STAT_DEX); + chance -= 2 * get_curr_stat(victim,STAT_DEX); + + /* speed */ + if (IS_SET(ch->off_flags,OFF_FAST) || IS_AFFECTED(ch,AFF_HASTE)) + chance += 10; + if (IS_SET(victim->off_flags,OFF_FAST) || IS_AFFECTED(victim,AFF_HASTE)) + chance -= 25; + + /* level */ + chance += (ch->level - victim->level) * 2; + + /* sloppy hack to prevent false zeroes */ + if (chance % 5 == 0) + chance += 1; + + /* terrain */ + + switch(ch->in_room->sector_type) + { + case(SECT_INSIDE): chance -= 20; break; + case(SECT_CITY): chance -= 10; break; + case(SECT_FIELD): chance += 5; break; + case(SECT_FOREST): break; + case(SECT_HILLS): break; + case(SECT_MOUNTAIN): chance -= 10; break; + case(SECT_WATER_SWIM): chance = 0; break; + case(SECT_WATER_NOSWIM): chance = 0; break; + case(SECT_AIR): chance = 0; break; + case(SECT_DESERT): chance += 10; break; + } + + if (chance == 0) + { + send_to_char("There isn't any dirt to kick.\n\r",ch); + return; + } + + /* now the attack */ + if (number_percent() < chance) + { + AFFECT_DATA af; + act("$n is blinded by the dirt in $s eyes!",victim,NULL,NULL,TO_ROOM); + act("$n kicks dirt in your eyes!",ch,NULL,victim,TO_VICT); + damage(ch,victim,number_range(2,5),gsn_dirt,DAM_NONE,FALSE); + send_to_char("You can't see a thing!\n\r",victim); + check_improve(ch,gsn_dirt,TRUE,2); + WAIT_STATE(ch,skill_table[gsn_dirt].beats); + + af.where = TO_AFFECTS; + af.type = gsn_dirt; + af.level = ch->level; + af.duration = 0; + af.location = APPLY_HITROLL; + af.modifier = -4; + af.bitvector = AFF_BLIND; + + affect_to_char(victim,&af); + } + else + { + damage(ch,victim,0,gsn_dirt,DAM_NONE,TRUE); + check_improve(ch,gsn_dirt,FALSE,2); + WAIT_STATE(ch,skill_table[gsn_dirt].beats); + } + check_killer(ch,victim); +} + +void do_trip( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + CHAR_DATA *victim; + int chance; + + one_argument(argument,arg); + + if ( (chance = get_skill(ch,gsn_trip)) == 0 + || (IS_NPC(ch) && !IS_SET(ch->off_flags,OFF_TRIP)) + || (!IS_NPC(ch) + && ch->level < skill_table[gsn_trip].skill_level[ch->class])) + { + send_to_char("Tripping? What's that?\n\r",ch); + return; + } + + + if (arg[0] == '\0') + { + victim = ch->fighting; + if (victim == NULL) + { + send_to_char("But you aren't fighting anyone!\n\r",ch); + return; + } + } + + else if ((victim = get_char_room(ch,arg)) == NULL) + { + send_to_char("They aren't here.\n\r",ch); + return; + } + + if (is_safe(ch,victim)) + return; + + if (IS_NPC(victim) && + victim->fighting != NULL && + !is_same_group(ch,victim->fighting)) + { + send_to_char("Kill stealing is not permitted.\n\r",ch); + return; + } + + if (IS_AFFECTED(victim,AFF_FLYING)) + { + act("$S feet aren't on the ground.",ch,NULL,victim,TO_CHAR); + return; + } + + if (victim->position < POS_FIGHTING) + { + act("$N is already down.",ch,NULL,victim,TO_CHAR); + return; + } + + if (victim == ch) + { + send_to_char("You fall flat on your face!\n\r",ch); + WAIT_STATE(ch,2 * skill_table[gsn_trip].beats); + act("$n trips over $s own feet!",ch,NULL,NULL,TO_ROOM); + return; + } + + if (IS_AFFECTED(ch,AFF_CHARM) && ch->master == victim) + { + act("$N is your beloved master.",ch,NULL,victim,TO_CHAR); + return; + } + + /* modifiers */ + + /* size */ + if (ch->size < victim->size) + chance += (ch->size - victim->size) * 10; /* bigger = harder to trip */ + + /* dex */ + chance += get_curr_stat(ch,STAT_DEX); + chance -= get_curr_stat(victim,STAT_DEX) * 3 / 2; + + /* speed */ + if (IS_SET(ch->off_flags,OFF_FAST) || IS_AFFECTED(ch,AFF_HASTE)) + chance += 10; + if (IS_SET(victim->off_flags,OFF_FAST) || IS_AFFECTED(victim,AFF_HASTE)) + chance -= 20; + + /* level */ + chance += (ch->level - victim->level) * 2; + + + /* now the attack */ + if (number_percent() < chance) + { + act("$n trips you and you go down!",ch,NULL,victim,TO_VICT); + act("You trip $N and $N goes down!",ch,NULL,victim,TO_CHAR); + act("$n trips $N, sending $M to the ground.",ch,NULL,victim,TO_NOTVICT); + check_improve(ch,gsn_trip,TRUE,1); + + DAZE_STATE(victim,2 * PULSE_VIOLENCE); + WAIT_STATE(ch,skill_table[gsn_trip].beats); + victim->position = POS_RESTING; + damage(ch,victim,number_range(2, 2 + 2 * victim->size),gsn_trip, + DAM_BASH,TRUE); + } + else + { + damage(ch,victim,0,gsn_trip,DAM_BASH,TRUE); + WAIT_STATE(ch,skill_table[gsn_trip].beats*2/3); + check_improve(ch,gsn_trip,FALSE,1); + } + check_killer(ch,victim); +} + + + +void do_kill( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + CHAR_DATA *victim; + + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + { + send_to_char( "Kill whom?\n\r", ch ); + return; + } + + if ( ( victim = get_char_room( ch, arg ) ) == NULL ) + { + send_to_char( "They aren't here.\n\r", ch ); + return; + } +/* Allow player killing + if ( !IS_NPC(victim) ) + { + if ( !IS_SET(victim->act, PLR_KILLER) + && !IS_SET(victim->act, PLR_THIEF) ) + { + send_to_char( "You must MURDER a player.\n\r", ch ); + return; + } + } +*/ + if ( victim == ch ) + { + send_to_char( "You hit yourself. Ouch!\n\r", ch ); + multi_hit( ch, ch, TYPE_UNDEFINED ); + return; + } + + if ( is_safe( ch, victim ) ) + return; + + if ( victim->fighting != NULL && + !is_same_group(ch,victim->fighting)) + { + send_to_char("Kill stealing is not permitted.\n\r",ch); + return; + } + + if ( IS_AFFECTED(ch, AFF_CHARM) && ch->master == victim ) + { + act( "$N is your beloved master.", ch, NULL, victim, TO_CHAR ); + return; + } + + if ( ch->position == POS_FIGHTING ) + { + send_to_char( "You do the best you can!\n\r", ch ); + return; + } + + WAIT_STATE( ch, 1 * PULSE_VIOLENCE ); + check_killer( ch, victim ); + multi_hit( ch, victim, TYPE_UNDEFINED ); + return; +} + + + +void do_murde( CHAR_DATA *ch, char *argument ) +{ + send_to_char( "If you want to MURDER, spell it out.\n\r", ch ); + return; +} + + + +void do_murder( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + char arg[MAX_INPUT_LENGTH]; + CHAR_DATA *victim; + + one_argument( argument, arg ); + + if ( arg[0] == '\0' ) + { + send_to_char( "Murder whom?\n\r", ch ); + return; + } + + if (IS_AFFECTED(ch,AFF_CHARM) || (IS_NPC(ch) && IS_SET(ch->act,ACT_PET))) + return; + + if ( ( victim = get_char_room( ch, arg ) ) == NULL ) + { + send_to_char( "They aren't here.\n\r", ch ); + return; + } + + if ( victim == ch ) + { + send_to_char( "Suicide is a mortal sin.\n\r", ch ); + return; + } + + if ( is_safe( ch, victim ) ) + return; + + if (IS_NPC(victim) && + victim->fighting != NULL && + !is_same_group(ch,victim->fighting)) + { + send_to_char("Kill stealing is not permitted.\n\r",ch); + return; + } + + if ( IS_AFFECTED(ch, AFF_CHARM) && ch->master == victim ) + { + act( "$N is your beloved master.", ch, NULL, victim, TO_CHAR ); + return; + } + + if ( ch->position == POS_FIGHTING ) + { + send_to_char( "You do the best you can!\n\r", ch ); + return; + } + + WAIT_STATE( ch, 1 * PULSE_VIOLENCE ); + if (IS_NPC(ch)) + sprintf(buf, "Help! I am being attacked by %s!",ch->short_descr); + else + sprintf( buf, "Help! I am being attacked by %s!", ch->name ); + do_function(victim, &do_yell, buf ); + check_killer( ch, victim ); + multi_hit( ch, victim, TYPE_UNDEFINED ); + return; +} + + + +void do_backstab( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + CHAR_DATA *victim; + OBJ_DATA *obj; + + one_argument( argument, arg ); + + if (arg[0] == '\0') + { + send_to_char("Backstab whom?\n\r",ch); + return; + } + + if (ch->fighting != NULL) + { + send_to_char("You're facing the wrong end.\n\r",ch); + return; + } + + else if ((victim = get_char_room(ch,arg)) == NULL) + { + send_to_char("They aren't here.\n\r",ch); + return; + } + + if ( victim == ch ) + { + send_to_char( "How can you sneak up on yourself?\n\r", ch ); + return; + } + + if ( is_safe( ch, victim ) ) + return; + + if (IS_NPC(victim) && + victim->fighting != NULL && + !is_same_group(ch,victim->fighting)) + { + send_to_char("Kill stealing is not permitted.\n\r",ch); + return; + } + + if ( ( obj = get_eq_char( ch, WEAR_WIELD ) ) == NULL) + { + send_to_char( "You need to wield a weapon to backstab.\n\r", ch ); + return; + } + + if ( victim->hit < victim->max_hit / 3) + { + act( "$N is hurt and suspicious ... you can't sneak up.", + ch, NULL, victim, TO_CHAR ); + return; + } + + check_killer( ch, victim ); + WAIT_STATE( ch, skill_table[gsn_backstab].beats ); + if ( number_percent( ) < get_skill(ch,gsn_backstab) + || ( get_skill(ch,gsn_backstab) >= 2 && !IS_AWAKE(victim) ) ) + { + check_improve(ch,gsn_backstab,TRUE,1); + multi_hit( ch, victim, gsn_backstab ); + } + else + { + check_improve(ch,gsn_backstab,FALSE,1); + damage( ch, victim, 0, gsn_backstab,DAM_NONE,TRUE); + } + + return; +} + + + +void do_flee( CHAR_DATA *ch, char *argument ) +{ + ROOM_INDEX_DATA *was_in; + ROOM_INDEX_DATA *now_in; + CHAR_DATA *victim; + int attempt; + + if ( ( victim = ch->fighting ) == NULL ) + { + if ( ch->position == POS_FIGHTING ) + ch->position = POS_STANDING; + send_to_char( "You aren't fighting anyone.\n\r", ch ); + return; + } + + was_in = ch->in_room; + for ( attempt = 0; attempt < 6; attempt++ ) + { + EXIT_DATA *pexit; + int door; + + door = number_door( ); + if ( ( pexit = was_in->exit[door] ) == 0 + || pexit->u1.to_room == NULL + || IS_SET(pexit->exit_info, EX_CLOSED) + || number_range(0,ch->daze) != 0 + || ( IS_NPC(ch) + && IS_SET(pexit->u1.to_room->room_flags, ROOM_NO_MOB) ) ) + continue; + + move_char( ch, door, FALSE ); + if ( ( now_in = ch->in_room ) == was_in ) + continue; + + ch->in_room = was_in; + act( "$n has fled!", ch, NULL, NULL, TO_ROOM ); + ch->in_room = now_in; + + if ( !IS_NPC(ch) ) + { + send_to_char( "You flee from combat!\n\r", ch ); + if( (ch->class == 2) + && (number_percent() < 3*(ch->level/2) ) ) + send_to_char( "You snuck away safely.\n\r", ch); + else + { + send_to_char( "You lost 10 exp.\n\r", ch); + gain_exp( ch, -10 ); + } + } + + stop_fighting( ch, TRUE ); + return; + } + + send_to_char( "PANIC! You couldn't escape!\n\r", ch ); + return; +} + + + +void do_rescue( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + CHAR_DATA *victim; + CHAR_DATA *fch; + + one_argument( argument, arg ); + if ( arg[0] == '\0' ) + { + send_to_char( "Rescue whom?\n\r", ch ); + return; + } + + if ( ( victim = get_char_room( ch, arg ) ) == NULL ) + { + send_to_char( "They aren't here.\n\r", ch ); + return; + } + + if ( victim == ch ) + { + send_to_char( "What about fleeing instead?\n\r", ch ); + return; + } + + if ( !IS_NPC(ch) && IS_NPC(victim) ) + { + send_to_char( "Doesn't need your help!\n\r", ch ); + return; + } + + if ( ch->fighting == victim ) + { + send_to_char( "Too late.\n\r", ch ); + return; + } + + if ( ( fch = victim->fighting ) == NULL ) + { + send_to_char( "That person is not fighting right now.\n\r", ch ); + return; + } + + if ( IS_NPC(fch) && !is_same_group(ch,victim)) + { + send_to_char("Kill stealing is not permitted.\n\r",ch); + return; + } + + WAIT_STATE( ch, skill_table[gsn_rescue].beats ); + if ( number_percent( ) > get_skill(ch,gsn_rescue)) + { + send_to_char( "You fail the rescue.\n\r", ch ); + check_improve(ch,gsn_rescue,FALSE,1); + return; + } + + act( "You rescue $N!", ch, NULL, victim, TO_CHAR ); + act( "$n rescues you!", ch, NULL, victim, TO_VICT ); + act( "$n rescues $N!", ch, NULL, victim, TO_NOTVICT ); + check_improve(ch,gsn_rescue,TRUE,1); + + stop_fighting( fch, FALSE ); + stop_fighting( victim, FALSE ); + + check_killer( ch, fch ); + set_fighting( ch, fch ); + set_fighting( fch, ch ); + return; +} + + + +void do_kick( CHAR_DATA *ch, char *argument ) +{ + CHAR_DATA *victim; + + if ( !IS_NPC(ch) + && ch->level < skill_table[gsn_kick].skill_level[ch->class] ) + { + send_to_char( + "You better leave the martial arts to fighters.\n\r", ch ); + return; + } + + if (IS_NPC(ch) && !IS_SET(ch->off_flags,OFF_KICK)) + return; + + if ( ( victim = ch->fighting ) == NULL ) + { + send_to_char( "You aren't fighting anyone.\n\r", ch ); + return; + } + + WAIT_STATE( ch, skill_table[gsn_kick].beats ); + if ( get_skill(ch,gsn_kick) > number_percent()) + { + damage(ch,victim,number_range( 1, ch->level ), gsn_kick,DAM_BASH,TRUE); + check_improve(ch,gsn_kick,TRUE,1); + } + else + { + damage( ch, victim, 0, gsn_kick,DAM_BASH,TRUE); + check_improve(ch,gsn_kick,FALSE,1); + } + check_killer(ch,victim); + return; +} + + + + +void do_disarm( CHAR_DATA *ch, char *argument ) +{ + CHAR_DATA *victim; + OBJ_DATA *obj; + int chance,hth,ch_weapon,vict_weapon,ch_vict_weapon; + + hth = 0; + + if ((chance = get_skill(ch,gsn_disarm)) == 0) + { + send_to_char( "You don't know how to disarm opponents.\n\r", ch ); + return; + } + + if ( get_eq_char( ch, WEAR_WIELD ) == NULL + && ((hth = get_skill(ch,gsn_hand_to_hand)) == 0 + || (IS_NPC(ch) && !IS_SET(ch->off_flags,OFF_DISARM)))) + { + send_to_char( "You must wield a weapon to disarm.\n\r", ch ); + return; + } + + if ( ( victim = ch->fighting ) == NULL ) + { + send_to_char( "You aren't fighting anyone.\n\r", ch ); + return; + } + + if ( ( obj = get_eq_char( victim, WEAR_WIELD ) ) == NULL ) + { + send_to_char( "Your opponent is not wielding a weapon.\n\r", ch ); + return; + } + + /* find weapon skills */ + ch_weapon = get_weapon_skill(ch,get_weapon_sn(ch)); + vict_weapon = get_weapon_skill(victim,get_weapon_sn(victim)); + ch_vict_weapon = get_weapon_skill(ch,get_weapon_sn(victim)); + + /* modifiers */ + + /* skill */ + if ( get_eq_char(ch,WEAR_WIELD) == NULL) + chance = chance * hth/150; + else + chance = chance * ch_weapon/100; + + chance += (ch_vict_weapon/2 - vict_weapon) / 2; + + /* dex vs. strength */ + chance += get_curr_stat(ch,STAT_DEX); + chance -= 2 * get_curr_stat(victim,STAT_STR); + + /* level */ + chance += (ch->level - victim->level) * 2; + + /* and now the attack */ + if (number_percent() < chance) + { + WAIT_STATE( ch, skill_table[gsn_disarm].beats ); + disarm( ch, victim ); + check_improve(ch,gsn_disarm,TRUE,1); + } + else + { + WAIT_STATE(ch,skill_table[gsn_disarm].beats); + act("You fail to disarm $N.",ch,NULL,victim,TO_CHAR); + act("$n tries to disarm you, but fails.",ch,NULL,victim,TO_VICT); + act("$n tries to disarm $N, but fails.",ch,NULL,victim,TO_NOTVICT); + check_improve(ch,gsn_disarm,FALSE,1); + } + check_killer(ch,victim); + return; +} + + + +void do_sla( CHAR_DATA *ch, char *argument ) +{ + send_to_char( "If you want to SLAY, spell it out.\n\r", ch ); + return; +} + + + +void do_slay( CHAR_DATA *ch, char *argument ) +{ + CHAR_DATA *victim; + char arg[MAX_INPUT_LENGTH]; + + one_argument( argument, arg ); + if ( arg[0] == '\0' ) + { + send_to_char( "Slay whom?\n\r", ch ); + return; + } + + if ( ( victim = get_char_room( ch, arg ) ) == NULL ) + { + send_to_char( "They aren't here.\n\r", ch ); + return; + } + + if ( ch == victim ) + { + send_to_char( "Suicide is a mortal sin.\n\r", ch ); + return; + } + + if ( !IS_NPC(victim) && victim->level >= get_trust(ch) ) + { + send_to_char( "You failed.\n\r", ch ); + return; + } + + act( "You slay $M in cold blood!", ch, NULL, victim, TO_CHAR ); + act( "$n slays you in cold blood!", ch, NULL, victim, TO_VICT ); + act( "$n slays $N in cold blood!", ch, NULL, victim, TO_NOTVICT ); + raw_kill( victim ); + return; +} diff --git a/Rom24/src/flags.c b/Rom24/src/flags.c new file mode 100644 index 0000000..068000d --- /dev/null +++ b/Rom24/src/flags.c @@ -0,0 +1,249 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +#if defined(macintosh) +#include +#include +#else +#include +#include +#endif +#include +#include +#include +#include "merc.h" +#include "tables.h" + +int flag_lookup args( ( const char *name, const struct flag_type *flag_table) ); + +void do_flag(CHAR_DATA *ch, char *argument) +{ + char arg1[MAX_INPUT_LENGTH],arg2[MAX_INPUT_LENGTH],arg3[MAX_INPUT_LENGTH]; + char word[MAX_INPUT_LENGTH]; + CHAR_DATA *victim; + long *flag, old = 0, new = 0, marked = 0, pos; + char type; + const struct flag_type *flag_table; + + argument = one_argument(argument,arg1); + argument = one_argument(argument,arg2); + argument = one_argument(argument,arg3); + + type = argument[0]; + + if (type == '=' || type == '-' || type == '+') + argument = one_argument(argument,word); + + if (arg1[0] == '\0') + { + send_to_char("Syntax:\n\r",ch); + send_to_char(" flag mob \n\r",ch); + send_to_char(" flag char \n\r",ch); + send_to_char(" mob flags: act,aff,off,imm,res,vuln,form,part\n\r",ch); + send_to_char(" char flags: plr,comm,aff,imm,res,vuln,\n\r",ch); + send_to_char(" +: add flag, -: remove flag, = set equal to\n\r",ch); + send_to_char(" otherwise flag toggles the flags listed.\n\r",ch); + return; + } + + if (arg2[0] == '\0') + { + send_to_char("What do you wish to set flags on?\n\r",ch); + return; + } + + if (arg3[0] == '\0') + { + send_to_char("You need to specify a flag to set.\n\r",ch); + return; + } + + if (argument[0] == '\0') + { + send_to_char("Which flags do you wish to change?\n\r",ch); + return; + } + + if (!str_prefix(arg1,"mob") || !str_prefix(arg1,"char")) + { + victim = get_char_world(ch,arg2); + if (victim == NULL) + { + send_to_char("You can't find them.\n\r",ch); + return; + } + + /* select a flag to set */ + if (!str_prefix(arg3,"act")) + { + if (!IS_NPC(victim)) + { + send_to_char("Use plr for PCs.\n\r",ch); + return; + } + + flag = &victim->act; + flag_table = act_flags; + } + + else if (!str_prefix(arg3,"plr")) + { + if (IS_NPC(victim)) + { + send_to_char("Use act for NPCs.\n\r",ch); + return; + } + + flag = &victim->act; + flag_table = plr_flags; + } + + else if (!str_prefix(arg3,"aff")) + { + flag = &victim->affected_by; + flag_table = affect_flags; + } + + else if (!str_prefix(arg3,"immunity")) + { + flag = &victim->imm_flags; + flag_table = imm_flags; + } + + else if (!str_prefix(arg3,"resist")) + { + flag = &victim->res_flags; + flag_table = imm_flags; + } + + else if (!str_prefix(arg3,"vuln")) + { + flag = &victim->vuln_flags; + flag_table = imm_flags; + } + + else if (!str_prefix(arg3,"form")) + { + if (!IS_NPC(victim)) + { + send_to_char("Form can't be set on PCs.\n\r",ch); + return; + } + + flag = &victim->form; + flag_table = form_flags; + } + + else if (!str_prefix(arg3,"parts")) + { + if (!IS_NPC(victim)) + { + send_to_char("Parts can't be set on PCs.\n\r",ch); + return; + } + + flag = &victim->parts; + flag_table = part_flags; + } + + else if (!str_prefix(arg3,"comm")) + { + if (IS_NPC(victim)) + { + send_to_char("Comm can't be set on NPCs.\n\r",ch); + return; + } + + flag = &victim->comm; + flag_table = comm_flags; + } + + else + { + send_to_char("That's not an acceptable flag.\n\r",ch); + return; + } + + old = *flag; + victim->zone = NULL; + + if (type != '=') + new = old; + + /* mark the words */ + for (; ;) + { + argument = one_argument(argument,word); + + if (word[0] == '\0') + break; + + pos = flag_lookup(word,flag_table); + if (pos == 0) + { + send_to_char("That flag doesn't exist!\n\r",ch); + return; + } + else + SET_BIT(marked,pos); + } + + for (pos = 0; flag_table[pos].name != NULL; pos++) + { + if (!flag_table[pos].settable && IS_SET(old,flag_table[pos].bit)) + { + SET_BIT(new,flag_table[pos].bit); + continue; + } + + if (IS_SET(marked,flag_table[pos].bit)) + { + switch(type) + { + case '=': + case '+': + SET_BIT(new,flag_table[pos].bit); + break; + case '-': + REMOVE_BIT(new,flag_table[pos].bit); + break; + default: + if (IS_SET(new,flag_table[pos].bit)) + REMOVE_BIT(new,flag_table[pos].bit); + else + SET_BIT(new,flag_table[pos].bit); + } + } + } + *flag = new; + return; + } +} + + + + diff --git a/Rom24/src/handler.c b/Rom24/src/handler.c new file mode 100644 index 0000000..cdc7b18 --- /dev/null +++ b/Rom24/src/handler.c @@ -0,0 +1,2912 @@ +/**************************************************************************r + * 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-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 * +***************************************************************************/ + +#if defined(macintosh) +#include +#else +#include +#endif +#include +#include +#include +#include +#include "merc.h" +#include "interp.h" +#include "magic.h" +#include "recycle.h" +#include "tables.h" + +/* + * Local functions. + */ +void affect_modify args( ( CHAR_DATA *ch, AFFECT_DATA *paf, bool fAdd ) ); + + +/* friend stuff -- for NPC's mostly */ +bool is_friend(CHAR_DATA *ch,CHAR_DATA *victim) +{ + if (is_same_group(ch,victim)) + return TRUE; + + + if (!IS_NPC(ch)) + return FALSE; + + if (!IS_NPC(victim)) + { + if (IS_SET(ch->off_flags,ASSIST_PLAYERS)) + return TRUE; + else + return FALSE; + } + + if (IS_AFFECTED(ch,AFF_CHARM)) + return FALSE; + + if (IS_SET(ch->off_flags,ASSIST_ALL)) + return TRUE; + + if (ch->group && ch->group == victim->group) + return TRUE; + + if (IS_SET(ch->off_flags,ASSIST_VNUM) + && ch->pIndexData == victim->pIndexData) + return TRUE; + + if (IS_SET(ch->off_flags,ASSIST_RACE) && ch->race == victim->race) + return TRUE; + + if (IS_SET(ch->off_flags,ASSIST_ALIGN) + && !IS_SET(ch->act,ACT_NOALIGN) && !IS_SET(victim->act,ACT_NOALIGN) + && ((IS_GOOD(ch) && IS_GOOD(victim)) + || (IS_EVIL(ch) && IS_EVIL(victim)) + || (IS_NEUTRAL(ch) && IS_NEUTRAL(victim)))) + return TRUE; + + return FALSE; +} + +/* returns number of people on an object */ +int count_users(OBJ_DATA *obj) +{ + CHAR_DATA *fch; + int count = 0; + + if (obj->in_room == NULL) + return 0; + + for (fch = obj->in_room->people; fch != NULL; fch = fch->next_in_room) + if (fch->on == obj) + count++; + + return count; +} + +/* returns material number */ +int material_lookup (const char *name) +{ + return 0; +} + +/* returns race number */ +int race_lookup (const char *name) +{ + int race; + + for ( race = 0; race_table[race].name != NULL; race++) + { + if (LOWER(name[0]) == LOWER(race_table[race].name[0]) + && !str_prefix( name,race_table[race].name)) + return race; + } + + return 0; +} + +int liq_lookup (const char *name) +{ + int liq; + + for ( liq = 0; liq_table[liq].liq_name != NULL; liq++) + { + if (LOWER(name[0]) == LOWER(liq_table[liq].liq_name[0]) + && !str_prefix(name,liq_table[liq].liq_name)) + return liq; + } + + return -1; +} + +int weapon_lookup (const char *name) +{ + int type; + + for (type = 0; weapon_table[type].name != NULL; type++) + { + if (LOWER(name[0]) == LOWER(weapon_table[type].name[0]) + && !str_prefix(name,weapon_table[type].name)) + return type; + } + + return -1; +} + +int weapon_type (const char *name) +{ + int type; + + for (type = 0; weapon_table[type].name != NULL; type++) + { + if (LOWER(name[0]) == LOWER(weapon_table[type].name[0]) + && !str_prefix(name,weapon_table[type].name)) + return weapon_table[type].type; + } + + return WEAPON_EXOTIC; +} + + +int item_lookup(const char *name) +{ + int type; + + for (type = 0; item_table[type].name != NULL; type++) + { + if (LOWER(name[0]) == LOWER(item_table[type].name[0]) + && !str_prefix(name,item_table[type].name)) + return item_table[type].type; + } + + return -1; +} + +char *item_name(int item_type) +{ + int type; + + for (type = 0; item_table[type].name != NULL; type++) + if (item_type == item_table[type].type) + return item_table[type].name; + return "none"; +} + +char *weapon_name( int weapon_type) +{ + int type; + + for (type = 0; weapon_table[type].name != NULL; type++) + if (weapon_type == weapon_table[type].type) + return weapon_table[type].name; + return "exotic"; +} + +int attack_lookup (const char *name) +{ + int att; + + for ( att = 0; attack_table[att].name != NULL; att++) + { + if (LOWER(name[0]) == LOWER(attack_table[att].name[0]) + && !str_prefix(name,attack_table[att].name)) + return att; + } + + return 0; +} + +/* returns a flag for wiznet */ +long wiznet_lookup (const char *name) +{ + int flag; + + for (flag = 0; wiznet_table[flag].name != NULL; flag++) + { + if (LOWER(name[0]) == LOWER(wiznet_table[flag].name[0]) + && !str_prefix(name,wiznet_table[flag].name)) + return flag; + } + + return -1; +} + +/* returns class number */ +int class_lookup (const char *name) +{ + int class; + + for ( class = 0; class < MAX_CLASS; class++) + { + if (LOWER(name[0]) == LOWER(class_table[class].name[0]) + && !str_prefix( name,class_table[class].name)) + return class; + } + + return -1; +} + +/* for immunity, vulnerabiltiy, and resistant + the 'globals' (magic and weapons) may be overriden + three other cases -- wood, silver, and iron -- are checked in fight.c */ + +int check_immune(CHAR_DATA *ch, int dam_type) +{ + int immune, def; + int bit; + + immune = -1; + def = IS_NORMAL; + + if (dam_type == DAM_NONE) + return immune; + + if (dam_type <= 3) + { + if (IS_SET(ch->imm_flags,IMM_WEAPON)) + def = IS_IMMUNE; + else if (IS_SET(ch->res_flags,RES_WEAPON)) + def = IS_RESISTANT; + else if (IS_SET(ch->vuln_flags,VULN_WEAPON)) + def = IS_VULNERABLE; + } + else /* magical attack */ + { + if (IS_SET(ch->imm_flags,IMM_MAGIC)) + def = IS_IMMUNE; + else if (IS_SET(ch->res_flags,RES_MAGIC)) + def = IS_RESISTANT; + else if (IS_SET(ch->vuln_flags,VULN_MAGIC)) + def = IS_VULNERABLE; + } + + /* set bits to check -- VULN etc. must ALL be the same or this will fail */ + switch (dam_type) + { + case(DAM_BASH): bit = IMM_BASH; break; + case(DAM_PIERCE): bit = IMM_PIERCE; break; + case(DAM_SLASH): bit = IMM_SLASH; break; + case(DAM_FIRE): bit = IMM_FIRE; break; + case(DAM_COLD): bit = IMM_COLD; break; + case(DAM_LIGHTNING): bit = IMM_LIGHTNING; break; + case(DAM_ACID): bit = IMM_ACID; break; + case(DAM_POISON): bit = IMM_POISON; break; + case(DAM_NEGATIVE): bit = IMM_NEGATIVE; break; + case(DAM_HOLY): bit = IMM_HOLY; break; + case(DAM_ENERGY): bit = IMM_ENERGY; break; + case(DAM_MENTAL): bit = IMM_MENTAL; break; + case(DAM_DISEASE): bit = IMM_DISEASE; break; + case(DAM_DROWNING): bit = IMM_DROWNING; break; + case(DAM_LIGHT): bit = IMM_LIGHT; break; + case(DAM_CHARM): bit = IMM_CHARM; break; + case(DAM_SOUND): bit = IMM_SOUND; break; + default: return def; + } + + if (IS_SET(ch->imm_flags,bit)) + immune = IS_IMMUNE; + else if (IS_SET(ch->res_flags,bit) && immune != IS_IMMUNE) + immune = IS_RESISTANT; + else if (IS_SET(ch->vuln_flags,bit)) + { + if (immune == IS_IMMUNE) + immune = IS_RESISTANT; + else if (immune == IS_RESISTANT) + immune = IS_NORMAL; + else + immune = IS_VULNERABLE; + } + + if (immune == -1) + return def; + else + return immune; +} + +bool is_clan(CHAR_DATA *ch) +{ + return ch->clan; +} + +bool is_same_clan(CHAR_DATA *ch, CHAR_DATA *victim) +{ + if (clan_table[ch->clan].independent) + return FALSE; + else + return (ch->clan == victim->clan); +} + +/* checks mob format */ +bool is_old_mob(CHAR_DATA *ch) +{ + if (ch->pIndexData == NULL) + return FALSE; + else if (ch->pIndexData->new_format) + return FALSE; + return TRUE; +} + +/* for returning skill information */ +int get_skill(CHAR_DATA *ch, int sn) +{ + int skill; + + if (sn == -1) /* shorthand for level based skills */ + { + skill = ch->level * 5 / 2; + } + + else if (sn < -1 || sn > MAX_SKILL) + { + bug("Bad sn %d in get_skill.",sn); + skill = 0; + } + + else if (!IS_NPC(ch)) + { + if (ch->level < skill_table[sn].skill_level[ch->class]) + skill = 0; + else + skill = ch->pcdata->learned[sn]; + } + + else /* mobiles */ + { + + + if (skill_table[sn].spell_fun != spell_null) + skill = 40 + 2 * ch->level; + + else if (sn == gsn_sneak || sn == gsn_hide) + skill = ch->level * 2 + 20; + + else if ((sn == gsn_dodge && IS_SET(ch->off_flags,OFF_DODGE)) + || (sn == gsn_parry && IS_SET(ch->off_flags,OFF_PARRY))) + skill = ch->level * 2; + + else if (sn == gsn_shield_block) + skill = 10 + 2 * ch->level; + + else if (sn == gsn_second_attack + && (IS_SET(ch->act,ACT_WARRIOR) || IS_SET(ch->act,ACT_THIEF))) + skill = 10 + 3 * ch->level; + + else if (sn == gsn_third_attack && IS_SET(ch->act,ACT_WARRIOR)) + skill = 4 * ch->level - 40; + + else if (sn == gsn_hand_to_hand) + skill = 40 + 2 * ch->level; + + else if (sn == gsn_trip && IS_SET(ch->off_flags,OFF_TRIP)) + skill = 10 + 3 * ch->level; + + else if (sn == gsn_bash && IS_SET(ch->off_flags,OFF_BASH)) + skill = 10 + 3 * ch->level; + + else if (sn == gsn_disarm + && (IS_SET(ch->off_flags,OFF_DISARM) + || IS_SET(ch->act,ACT_WARRIOR) + || IS_SET(ch->act,ACT_THIEF))) + skill = 20 + 3 * ch->level; + + else if (sn == gsn_berserk && IS_SET(ch->off_flags,OFF_BERSERK)) + skill = 3 * ch->level; + + else if (sn == gsn_kick) + skill = 10 + 3 * ch->level; + + else if (sn == gsn_backstab && IS_SET(ch->act,ACT_THIEF)) + skill = 20 + 2 * ch->level; + + else if (sn == gsn_rescue) + skill = 40 + ch->level; + + else if (sn == gsn_recall) + skill = 40 + ch->level; + + else if (sn == gsn_sword + || sn == gsn_dagger + || sn == gsn_spear + || sn == gsn_mace + || sn == gsn_axe + || sn == gsn_flail + || sn == gsn_whip + || sn == gsn_polearm) + skill = 40 + 5 * ch->level / 2; + + else + skill = 0; + } + + if (ch->daze > 0) + { + if (skill_table[sn].spell_fun != spell_null) + skill /= 2; + else + skill = 2 * skill / 3; + } + + if ( !IS_NPC(ch) && ch->pcdata->condition[COND_DRUNK] > 10 ) + skill = 9 * skill / 10; + + return URANGE(0,skill,100); +} + +/* for returning weapon information */ +int get_weapon_sn(CHAR_DATA *ch) +{ + OBJ_DATA *wield; + int sn; + + wield = get_eq_char( ch, WEAR_WIELD ); + if (wield == NULL || wield->item_type != ITEM_WEAPON) + sn = gsn_hand_to_hand; + else switch (wield->value[0]) + { + default : sn = -1; break; + case(WEAPON_SWORD): sn = gsn_sword; break; + case(WEAPON_DAGGER): sn = gsn_dagger; break; + case(WEAPON_SPEAR): sn = gsn_spear; break; + case(WEAPON_MACE): sn = gsn_mace; break; + case(WEAPON_AXE): sn = gsn_axe; break; + case(WEAPON_FLAIL): sn = gsn_flail; break; + case(WEAPON_WHIP): sn = gsn_whip; break; + case(WEAPON_POLEARM): sn = gsn_polearm; break; + } + return sn; +} + +int get_weapon_skill(CHAR_DATA *ch, int sn) +{ + int skill; + + /* -1 is exotic */ + if (IS_NPC(ch)) + { + if (sn == -1) + skill = 3 * ch->level; + else if (sn == gsn_hand_to_hand) + skill = 40 + 2 * ch->level; + else + skill = 40 + 5 * ch->level / 2; + } + + else + { + if (sn == -1) + skill = 3 * ch->level; + else + skill = ch->pcdata->learned[sn]; + } + + return URANGE(0,skill,100); +} + + +/* used to de-screw characters */ +void reset_char(CHAR_DATA *ch) +{ + int loc,mod,stat; + OBJ_DATA *obj; + AFFECT_DATA *af; + int i; + + if (IS_NPC(ch)) + return; + + if (ch->pcdata->perm_hit == 0 + || ch->pcdata->perm_mana == 0 + || ch->pcdata->perm_move == 0 + || ch->pcdata->last_level == 0) + { + /* do a FULL reset */ + for (loc = 0; loc < MAX_WEAR; loc++) + { + obj = get_eq_char(ch,loc); + if (obj == NULL) + continue; + if (!obj->enchanted) + for ( af = obj->pIndexData->affected; af != NULL; af = af->next ) + { + mod = af->modifier; + switch(af->location) + { + case APPLY_SEX: ch->sex -= mod; + if (ch->sex < 0 || ch->sex >2) + ch->sex = IS_NPC(ch) ? + 0 : + ch->pcdata->true_sex; + break; + case APPLY_MANA: ch->max_mana -= mod; break; + case APPLY_HIT: ch->max_hit -= mod; break; + case APPLY_MOVE: ch->max_move -= mod; break; + } + } + + for ( af = obj->affected; af != NULL; af = af->next ) + { + mod = af->modifier; + switch(af->location) + { + case APPLY_SEX: ch->sex -= mod; break; + case APPLY_MANA: ch->max_mana -= mod; break; + case APPLY_HIT: ch->max_hit -= mod; break; + case APPLY_MOVE: ch->max_move -= mod; break; + } + } + } + /* now reset the permanent stats */ + ch->pcdata->perm_hit = ch->max_hit; + ch->pcdata->perm_mana = ch->max_mana; + ch->pcdata->perm_move = ch->max_move; + ch->pcdata->last_level = ch->played/3600; + if (ch->pcdata->true_sex < 0 || ch->pcdata->true_sex > 2) + { if (ch->sex > 0 && ch->sex < 3) + ch->pcdata->true_sex = ch->sex; + else + ch->pcdata->true_sex = 0; + } + + } + + /* now restore the character to his/her true condition */ + for (stat = 0; stat < MAX_STATS; stat++) + ch->mod_stat[stat] = 0; + + if (ch->pcdata->true_sex < 0 || ch->pcdata->true_sex > 2) + ch->pcdata->true_sex = 0; + ch->sex = ch->pcdata->true_sex; + ch->max_hit = ch->pcdata->perm_hit; + ch->max_mana = ch->pcdata->perm_mana; + ch->max_move = ch->pcdata->perm_move; + + for (i = 0; i < 4; i++) + ch->armor[i] = 100; + + ch->hitroll = 0; + ch->damroll = 0; + ch->saving_throw = 0; + + /* now start adding back the effects */ + for (loc = 0; loc < MAX_WEAR; loc++) + { + obj = get_eq_char(ch,loc); + if (obj == NULL) + continue; + for (i = 0; i < 4; i++) + ch->armor[i] -= apply_ac( obj, loc, i ); + + if (!obj->enchanted) + for ( af = obj->pIndexData->affected; af != NULL; af = af->next ) + { + mod = af->modifier; + switch(af->location) + { + case APPLY_STR: ch->mod_stat[STAT_STR] += mod; break; + case APPLY_DEX: ch->mod_stat[STAT_DEX] += mod; break; + case APPLY_INT: ch->mod_stat[STAT_INT] += mod; break; + case APPLY_WIS: ch->mod_stat[STAT_WIS] += mod; break; + case APPLY_CON: ch->mod_stat[STAT_CON] += mod; break; + + case APPLY_SEX: ch->sex += mod; break; + case APPLY_MANA: ch->max_mana += mod; break; + case APPLY_HIT: ch->max_hit += mod; break; + case APPLY_MOVE: ch->max_move += mod; break; + + case APPLY_AC: + for (i = 0; i < 4; i ++) + ch->armor[i] += mod; + break; + case APPLY_HITROLL: ch->hitroll += mod; break; + case APPLY_DAMROLL: ch->damroll += mod; break; + + case APPLY_SAVES: ch->saving_throw += mod; break; + case APPLY_SAVING_ROD: ch->saving_throw += mod; break; + case APPLY_SAVING_PETRI: ch->saving_throw += mod; break; + case APPLY_SAVING_BREATH: ch->saving_throw += mod; break; + case APPLY_SAVING_SPELL: ch->saving_throw += mod; break; + } + } + + for ( af = obj->affected; af != NULL; af = af->next ) + { + mod = af->modifier; + switch(af->location) + { + case APPLY_STR: ch->mod_stat[STAT_STR] += mod; break; + case APPLY_DEX: ch->mod_stat[STAT_DEX] += mod; break; + case APPLY_INT: ch->mod_stat[STAT_INT] += mod; break; + case APPLY_WIS: ch->mod_stat[STAT_WIS] += mod; break; + case APPLY_CON: ch->mod_stat[STAT_CON] += mod; break; + + case APPLY_SEX: ch->sex += mod; break; + case APPLY_MANA: ch->max_mana += mod; break; + case APPLY_HIT: ch->max_hit += mod; break; + case APPLY_MOVE: ch->max_move += mod; break; + + case APPLY_AC: + for (i = 0; i < 4; i ++) + ch->armor[i] += mod; + break; + case APPLY_HITROLL: ch->hitroll += mod; break; + case APPLY_DAMROLL: ch->damroll += mod; break; + + case APPLY_SAVES: ch->saving_throw += mod; break; + case APPLY_SAVING_ROD: ch->saving_throw += mod; break; + case APPLY_SAVING_PETRI: ch->saving_throw += mod; break; + case APPLY_SAVING_BREATH: ch->saving_throw += mod; break; + case APPLY_SAVING_SPELL: ch->saving_throw += mod; break; + } + } + } + + /* now add back spell effects */ + for (af = ch->affected; af != NULL; af = af->next) + { + mod = af->modifier; + switch(af->location) + { + case APPLY_STR: ch->mod_stat[STAT_STR] += mod; break; + case APPLY_DEX: ch->mod_stat[STAT_DEX] += mod; break; + case APPLY_INT: ch->mod_stat[STAT_INT] += mod; break; + case APPLY_WIS: ch->mod_stat[STAT_WIS] += mod; break; + case APPLY_CON: ch->mod_stat[STAT_CON] += mod; break; + + case APPLY_SEX: ch->sex += mod; break; + case APPLY_MANA: ch->max_mana += mod; break; + case APPLY_HIT: ch->max_hit += mod; break; + case APPLY_MOVE: ch->max_move += mod; break; + + case APPLY_AC: + for (i = 0; i < 4; i ++) + ch->armor[i] += mod; + break; + case APPLY_HITROLL: ch->hitroll += mod; break; + case APPLY_DAMROLL: ch->damroll += mod; break; + + case APPLY_SAVES: ch->saving_throw += mod; break; + case APPLY_SAVING_ROD: ch->saving_throw += mod; break; + case APPLY_SAVING_PETRI: ch->saving_throw += mod; break; + case APPLY_SAVING_BREATH: ch->saving_throw += mod; break; + case APPLY_SAVING_SPELL: ch->saving_throw += mod; break; + } + } + + /* make sure sex is RIGHT!!!! */ + if (ch->sex < 0 || ch->sex > 2) + ch->sex = ch->pcdata->true_sex; +} + + +/* + * Retrieve a character's trusted level for permission checking. + */ +int get_trust( CHAR_DATA *ch ) +{ + if ( ch->desc != NULL && ch->desc->original != NULL ) + ch = ch->desc->original; + + if (ch->trust) + return ch->trust; + + if ( IS_NPC(ch) && ch->level >= LEVEL_HERO ) + return LEVEL_HERO - 1; + else + return ch->level; +} + + +/* + * Retrieve a character's age. + */ +int get_age( CHAR_DATA *ch ) +{ + return 17 + ( ch->played + (int) (current_time - ch->logon) ) / 72000; +} + +/* command for retrieving stats */ +int get_curr_stat( CHAR_DATA *ch, int stat ) +{ + int max; + + if (IS_NPC(ch) || ch->level > LEVEL_IMMORTAL) + max = 25; + + else + { + max = pc_race_table[ch->race].max_stats[stat] + 4; + + if (class_table[ch->class].attr_prime == stat) + max += 2; + + if ( ch->race == race_lookup("human")) + max += 1; + + max = UMIN(max,25); + } + + return URANGE(3,ch->perm_stat[stat] + ch->mod_stat[stat], max); +} + +/* command for returning max training score */ +int get_max_train( CHAR_DATA *ch, int stat ) +{ + int max; + + if (IS_NPC(ch) || ch->level > LEVEL_IMMORTAL) + return 25; + + max = pc_race_table[ch->race].max_stats[stat]; + if (class_table[ch->class].attr_prime == stat) + { if (ch->race == race_lookup("human")) + max += 3; + else + max += 2; + } + + return UMIN(max,25); +} + + +/* + * Retrieve a character's carry capacity. + */ +int can_carry_n( CHAR_DATA *ch ) +{ + if ( !IS_NPC(ch) && ch->level >= LEVEL_IMMORTAL ) + return 1000; + + if ( IS_NPC(ch) && IS_SET(ch->act, ACT_PET) ) + return 0; + + return MAX_WEAR + 2 * get_curr_stat(ch,STAT_DEX) + ch->level; +} + + + +/* + * Retrieve a character's carry capacity. + */ +int can_carry_w( CHAR_DATA *ch ) +{ + if ( !IS_NPC(ch) && ch->level >= LEVEL_IMMORTAL ) + return 10000000; + + if ( IS_NPC(ch) && IS_SET(ch->act, ACT_PET) ) + return 0; + + return str_app[get_curr_stat(ch,STAT_STR)].carry * 10 + ch->level * 25; +} + + + +/* + * See if a string is one of the names of an object. + */ + +bool is_name ( char *str, char *namelist ) +{ + char name[MAX_INPUT_LENGTH], part[MAX_INPUT_LENGTH]; + char *list, *string; + + /* fix crash on NULL namelist */ + if (namelist == NULL || namelist[0] == '\0') + return FALSE; + + /* fixed to prevent is_name on "" returning TRUE */ + if (str[0] == '\0') + return FALSE; + + string = str; + /* we need ALL parts of string to match part of namelist */ + for ( ; ; ) /* start parsing string */ + { + str = one_argument(str,part); + + if (part[0] == '\0' ) + return TRUE; + + /* check to see if this is part of namelist */ + list = namelist; + for ( ; ; ) /* start parsing namelist */ + { + list = one_argument(list,name); + if (name[0] == '\0') /* this name was not found */ + return FALSE; + + if (!str_prefix(string,name)) + return TRUE; /* full pattern match */ + + if (!str_prefix(part,name)) + break; + } + } +} + +bool is_exact_name(char *str, char *namelist ) +{ + char name[MAX_INPUT_LENGTH]; + + if (namelist == NULL) + return FALSE; + + for ( ; ; ) + { + namelist = one_argument( namelist, name ); + if ( name[0] == '\0' ) + return FALSE; + if ( !str_cmp( str, name ) ) + return TRUE; + } +} + +/* enchanted stuff for eq */ +void affect_enchant(OBJ_DATA *obj) +{ + /* okay, move all the old flags into new vectors if we have to */ + if (!obj->enchanted) + { + AFFECT_DATA *paf, *af_new; + obj->enchanted = TRUE; + + for (paf = obj->pIndexData->affected; + paf != NULL; paf = paf->next) + { + af_new = new_affect(); + + af_new->next = obj->affected; + obj->affected = af_new; + + af_new->where = paf->where; + af_new->type = UMAX(0,paf->type); + af_new->level = paf->level; + af_new->duration = paf->duration; + af_new->location = paf->location; + af_new->modifier = paf->modifier; + af_new->bitvector = paf->bitvector; + } + } +} + + +/* + * Apply or remove an affect to a character. + */ +void affect_modify( CHAR_DATA *ch, AFFECT_DATA *paf, bool fAdd ) +{ + OBJ_DATA *wield; + int mod,i; + + mod = paf->modifier; + + if ( fAdd ) + { + switch (paf->where) + { + case TO_AFFECTS: + SET_BIT(ch->affected_by, paf->bitvector); + break; + case TO_IMMUNE: + SET_BIT(ch->imm_flags,paf->bitvector); + break; + case TO_RESIST: + SET_BIT(ch->res_flags,paf->bitvector); + break; + case TO_VULN: + SET_BIT(ch->vuln_flags,paf->bitvector); + break; + } + } + else + { + switch (paf->where) + { + case TO_AFFECTS: + REMOVE_BIT(ch->affected_by, paf->bitvector); + break; + case TO_IMMUNE: + REMOVE_BIT(ch->imm_flags,paf->bitvector); + break; + case TO_RESIST: + REMOVE_BIT(ch->res_flags,paf->bitvector); + break; + case TO_VULN: + REMOVE_BIT(ch->vuln_flags,paf->bitvector); + break; + } + mod = 0 - mod; + } + + switch ( paf->location ) + { + default: + bug( "Affect_modify: unknown location %d.", paf->location ); + return; + + case APPLY_NONE: break; + case APPLY_STR: ch->mod_stat[STAT_STR] += mod; break; + case APPLY_DEX: ch->mod_stat[STAT_DEX] += mod; break; + case APPLY_INT: ch->mod_stat[STAT_INT] += mod; break; + case APPLY_WIS: ch->mod_stat[STAT_WIS] += mod; break; + case APPLY_CON: ch->mod_stat[STAT_CON] += mod; break; + case APPLY_SEX: ch->sex += mod; break; + case APPLY_CLASS: break; + case APPLY_LEVEL: break; + case APPLY_AGE: break; + case APPLY_HEIGHT: break; + case APPLY_WEIGHT: break; + case APPLY_MANA: ch->max_mana += mod; break; + case APPLY_HIT: ch->max_hit += mod; break; + case APPLY_MOVE: ch->max_move += mod; break; + case APPLY_GOLD: break; + case APPLY_EXP: break; + case APPLY_AC: + for (i = 0; i < 4; i ++) + ch->armor[i] += mod; + break; + case APPLY_HITROLL: ch->hitroll += mod; break; + case APPLY_DAMROLL: ch->damroll += mod; break; + case APPLY_SAVES: ch->saving_throw += mod; break; + case APPLY_SAVING_ROD: ch->saving_throw += mod; break; + case APPLY_SAVING_PETRI: ch->saving_throw += mod; break; + case APPLY_SAVING_BREATH: ch->saving_throw += mod; break; + case APPLY_SAVING_SPELL: ch->saving_throw += mod; break; + case APPLY_SPELL_AFFECT: break; + } + + /* + * Check for weapon wielding. + * Guard against recursion (for weapons with affects). + */ + if ( !IS_NPC(ch) && ( wield = get_eq_char( ch, WEAR_WIELD ) ) != NULL + && get_obj_weight(wield) > (str_app[get_curr_stat(ch,STAT_STR)].wield*10)) + { + static int depth; + + if ( depth == 0 ) + { + depth++; + act( "You drop $p.", ch, wield, NULL, TO_CHAR ); + act( "$n drops $p.", ch, wield, NULL, TO_ROOM ); + obj_from_char( wield ); + obj_to_room( wield, ch->in_room ); + depth--; + } + } + + return; +} + + +/* find an effect in an affect list */ +AFFECT_DATA *affect_find(AFFECT_DATA *paf, int sn) +{ + AFFECT_DATA *paf_find; + + for ( paf_find = paf; paf_find != NULL; paf_find = paf_find->next ) + { + if ( paf_find->type == sn ) + return paf_find; + } + + return NULL; +} + +/* fix object affects when removing one */ +void affect_check(CHAR_DATA *ch,int where,int vector) +{ + AFFECT_DATA *paf; + OBJ_DATA *obj; + + if (where == TO_OBJECT || where == TO_WEAPON || vector == 0) + return; + + for (paf = ch->affected; paf != NULL; paf = paf->next) + if (paf->where == where && paf->bitvector == vector) + { + switch (where) + { + case TO_AFFECTS: + SET_BIT(ch->affected_by,vector); + break; + case TO_IMMUNE: + SET_BIT(ch->imm_flags,vector); + break; + case TO_RESIST: + SET_BIT(ch->res_flags,vector); + break; + case TO_VULN: + SET_BIT(ch->vuln_flags,vector); + break; + } + return; + } + + for (obj = ch->carrying; obj != NULL; obj = obj->next_content) + { + if (obj->wear_loc == -1) + continue; + + for (paf = obj->affected; paf != NULL; paf = paf->next) + if (paf->where == where && paf->bitvector == vector) + { + switch (where) + { + case TO_AFFECTS: + SET_BIT(ch->affected_by,vector); + break; + case TO_IMMUNE: + SET_BIT(ch->imm_flags,vector); + break; + case TO_RESIST: + SET_BIT(ch->res_flags,vector); + break; + case TO_VULN: + SET_BIT(ch->vuln_flags,vector); + + } + return; + } + + if (obj->enchanted) + continue; + + for (paf = obj->pIndexData->affected; paf != NULL; paf = paf->next) + if (paf->where == where && paf->bitvector == vector) + { + switch (where) + { + case TO_AFFECTS: + SET_BIT(ch->affected_by,vector); + break; + case TO_IMMUNE: + SET_BIT(ch->imm_flags,vector); + break; + case TO_RESIST: + SET_BIT(ch->res_flags,vector); + break; + case TO_VULN: + SET_BIT(ch->vuln_flags,vector); + break; + } + return; + } + } +} + +/* + * Give an affect to a char. + */ +void affect_to_char( CHAR_DATA *ch, AFFECT_DATA *paf ) +{ + AFFECT_DATA *paf_new; + + paf_new = new_affect(); + + *paf_new = *paf; + + VALIDATE(paf); /* in case we missed it when we set up paf */ + paf_new->next = ch->affected; + ch->affected = paf_new; + + affect_modify( ch, paf_new, TRUE ); + return; +} + +/* give an affect to an object */ +void affect_to_obj(OBJ_DATA *obj, AFFECT_DATA *paf) +{ + AFFECT_DATA *paf_new; + + paf_new = new_affect(); + + *paf_new = *paf; + + VALIDATE(paf); /* in case we missed it when we set up paf */ + paf_new->next = obj->affected; + obj->affected = paf_new; + + /* apply any affect vectors to the object's extra_flags */ + if (paf->bitvector) + switch (paf->where) + { + case TO_OBJECT: + SET_BIT(obj->extra_flags,paf->bitvector); + break; + case TO_WEAPON: + if (obj->item_type == ITEM_WEAPON) + SET_BIT(obj->value[4],paf->bitvector); + break; + } + + + return; +} + + + +/* + * Remove an affect from a char. + */ +void affect_remove( CHAR_DATA *ch, AFFECT_DATA *paf ) +{ + int where; + int vector; + + if ( ch->affected == NULL ) + { + bug( "Affect_remove: no affect.", 0 ); + return; + } + + affect_modify( ch, paf, FALSE ); + where = paf->where; + vector = paf->bitvector; + + if ( paf == ch->affected ) + { + ch->affected = paf->next; + } + else + { + AFFECT_DATA *prev; + + for ( prev = ch->affected; prev != NULL; prev = prev->next ) + { + if ( prev->next == paf ) + { + prev->next = paf->next; + break; + } + } + + if ( prev == NULL ) + { + bug( "Affect_remove: cannot find paf.", 0 ); + return; + } + } + + free_affect(paf); + + affect_check(ch,where,vector); + return; +} + +void affect_remove_obj( OBJ_DATA *obj, AFFECT_DATA *paf) +{ + int where, vector; + if ( obj->affected == NULL ) + { + bug( "Affect_remove_object: no affect.", 0 ); + return; + } + + if (obj->carried_by != NULL && obj->wear_loc != -1) + affect_modify( obj->carried_by, paf, FALSE ); + + where = paf->where; + vector = paf->bitvector; + + /* remove flags from the object if needed */ + if (paf->bitvector) + switch( paf->where) + { + case TO_OBJECT: + REMOVE_BIT(obj->extra_flags,paf->bitvector); + break; + case TO_WEAPON: + if (obj->item_type == ITEM_WEAPON) + REMOVE_BIT(obj->value[4],paf->bitvector); + break; + } + + if ( paf == obj->affected ) + { + obj->affected = paf->next; + } + else + { + AFFECT_DATA *prev; + + for ( prev = obj->affected; prev != NULL; prev = prev->next ) + { + if ( prev->next == paf ) + { + prev->next = paf->next; + break; + } + } + + if ( prev == NULL ) + { + bug( "Affect_remove_object: cannot find paf.", 0 ); + return; + } + } + + free_affect(paf); + + if (obj->carried_by != NULL && obj->wear_loc != -1) + affect_check(obj->carried_by,where,vector); + return; +} + + + +/* + * Strip all affects of a given sn. + */ +void affect_strip( CHAR_DATA *ch, int sn ) +{ + AFFECT_DATA *paf; + AFFECT_DATA *paf_next; + + for ( paf = ch->affected; paf != NULL; paf = paf_next ) + { + paf_next = paf->next; + if ( paf->type == sn ) + affect_remove( ch, paf ); + } + + return; +} + + + +/* + * Return true if a char is affected by a spell. + */ +bool is_affected( CHAR_DATA *ch, int sn ) +{ + AFFECT_DATA *paf; + + for ( paf = ch->affected; paf != NULL; paf = paf->next ) + { + if ( paf->type == sn ) + return TRUE; + } + + return FALSE; +} + + + +/* + * Add or enhance an affect. + */ +void affect_join( CHAR_DATA *ch, AFFECT_DATA *paf ) +{ + AFFECT_DATA *paf_old; + bool found; + + found = FALSE; + for ( paf_old = ch->affected; paf_old != NULL; paf_old = paf_old->next ) + { + if ( paf_old->type == paf->type ) + { + paf->level = (paf->level += paf_old->level) / 2; + paf->duration += paf_old->duration; + paf->modifier += paf_old->modifier; + affect_remove( ch, paf_old ); + break; + } + } + + affect_to_char( ch, paf ); + return; +} + + + +/* + * Move a char out of a room. + */ +void char_from_room( CHAR_DATA *ch ) +{ + OBJ_DATA *obj; + + if ( ch->in_room == NULL ) + { + bug( "Char_from_room: NULL.", 0 ); + return; + } + + if ( !IS_NPC(ch) ) + --ch->in_room->area->nplayer; + + if ( ( obj = get_eq_char( ch, WEAR_LIGHT ) ) != NULL + && obj->item_type == ITEM_LIGHT + && obj->value[2] != 0 + && ch->in_room->light > 0 ) + --ch->in_room->light; + + if ( ch == ch->in_room->people ) + { + ch->in_room->people = ch->next_in_room; + } + else + { + CHAR_DATA *prev; + + for ( prev = ch->in_room->people; prev; prev = prev->next_in_room ) + { + if ( prev->next_in_room == ch ) + { + prev->next_in_room = ch->next_in_room; + break; + } + } + + if ( prev == NULL ) + bug( "Char_from_room: ch not found.", 0 ); + } + + ch->in_room = NULL; + ch->next_in_room = NULL; + ch->on = NULL; /* sanity check! */ + return; +} + + + +/* + * Move a char into a room. + */ +void char_to_room( CHAR_DATA *ch, ROOM_INDEX_DATA *pRoomIndex ) +{ + OBJ_DATA *obj; + + if ( pRoomIndex == NULL ) + { + ROOM_INDEX_DATA *room; + + bug( "Char_to_room: NULL.", 0 ); + + if ((room = get_room_index(ROOM_VNUM_TEMPLE)) != NULL) + char_to_room(ch,room); + + return; + } + + ch->in_room = pRoomIndex; + ch->next_in_room = pRoomIndex->people; + pRoomIndex->people = ch; + + if ( !IS_NPC(ch) ) + { + if (ch->in_room->area->empty) + { + ch->in_room->area->empty = FALSE; + ch->in_room->area->age = 0; + } + ++ch->in_room->area->nplayer; + } + + if ( ( obj = get_eq_char( ch, WEAR_LIGHT ) ) != NULL + && obj->item_type == ITEM_LIGHT + && obj->value[2] != 0 ) + ++ch->in_room->light; + + if (IS_AFFECTED(ch,AFF_PLAGUE)) + { + AFFECT_DATA *af, plague; + CHAR_DATA *vch; + + for ( af = ch->affected; af != NULL; af = af->next ) + { + if (af->type == gsn_plague) + break; + } + + if (af == NULL) + { + REMOVE_BIT(ch->affected_by,AFF_PLAGUE); + return; + } + + if (af->level == 1) + return; + + plague.where = TO_AFFECTS; + plague.type = gsn_plague; + plague.level = af->level - 1; + plague.duration = number_range(1,2 * plague.level); + plague.location = APPLY_STR; + plague.modifier = -5; + plague.bitvector = AFF_PLAGUE; + + for ( vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room) + { + if (!saves_spell(plague.level - 2,vch,DAM_DISEASE) + && !IS_IMMORTAL(vch) && + !IS_AFFECTED(vch,AFF_PLAGUE) && number_bits(6) == 0) + { + send_to_char("You feel hot and feverish.\n\r",vch); + act("$n shivers and looks very ill.",vch,NULL,NULL,TO_ROOM); + affect_join(vch,&plague); + } + } + } + + + return; +} + + + +/* + * Give an obj to a char. + */ +void obj_to_char( OBJ_DATA *obj, CHAR_DATA *ch ) +{ + obj->next_content = ch->carrying; + ch->carrying = obj; + obj->carried_by = ch; + obj->in_room = NULL; + obj->in_obj = NULL; + ch->carry_number += get_obj_number( obj ); + ch->carry_weight += get_obj_weight( obj ); +} + + + +/* + * Take an obj from its character. + */ +void obj_from_char( OBJ_DATA *obj ) +{ + CHAR_DATA *ch; + + if ( ( ch = obj->carried_by ) == NULL ) + { + bug( "Obj_from_char: null ch.", 0 ); + return; + } + + if ( obj->wear_loc != WEAR_NONE ) + unequip_char( ch, obj ); + + if ( ch->carrying == obj ) + { + ch->carrying = obj->next_content; + } + else + { + OBJ_DATA *prev; + + for ( prev = ch->carrying; prev != NULL; prev = prev->next_content ) + { + if ( prev->next_content == obj ) + { + prev->next_content = obj->next_content; + break; + } + } + + if ( prev == NULL ) + bug( "Obj_from_char: obj not in list.", 0 ); + } + + obj->carried_by = NULL; + obj->next_content = NULL; + ch->carry_number -= get_obj_number( obj ); + ch->carry_weight -= get_obj_weight( obj ); + return; +} + + + +/* + * Find the ac value of an obj, including position effect. + */ +int apply_ac( OBJ_DATA *obj, int iWear, int type ) +{ + if ( obj->item_type != ITEM_ARMOR ) + return 0; + + switch ( iWear ) + { + case WEAR_BODY: return 3 * obj->value[type]; + case WEAR_HEAD: return 2 * obj->value[type]; + case WEAR_LEGS: return 2 * obj->value[type]; + case WEAR_FEET: return obj->value[type]; + case WEAR_HANDS: return obj->value[type]; + case WEAR_ARMS: return obj->value[type]; + case WEAR_SHIELD: return obj->value[type]; + case WEAR_NECK_1: return obj->value[type]; + case WEAR_NECK_2: return obj->value[type]; + case WEAR_ABOUT: return 2 * obj->value[type]; + case WEAR_WAIST: return obj->value[type]; + case WEAR_WRIST_L: return obj->value[type]; + case WEAR_WRIST_R: return obj->value[type]; + case WEAR_HOLD: return obj->value[type]; + } + + return 0; +} + + + +/* + * Find a piece of eq on a character. + */ +OBJ_DATA *get_eq_char( CHAR_DATA *ch, int iWear ) +{ + OBJ_DATA *obj; + + if (ch == NULL) + return NULL; + + for ( obj = ch->carrying; obj != NULL; obj = obj->next_content ) + { + if ( obj->wear_loc == iWear ) + return obj; + } + + return NULL; +} + + + +/* + * Equip a char with an obj. + */ +void equip_char( CHAR_DATA *ch, OBJ_DATA *obj, int iWear ) +{ + AFFECT_DATA *paf; + int i; + + if ( get_eq_char( ch, iWear ) != NULL ) + { + bug( "Equip_char: already equipped (%d).", iWear ); + return; + } + + if ( ( IS_OBJ_STAT(obj, ITEM_ANTI_EVIL) && IS_EVIL(ch) ) + || ( IS_OBJ_STAT(obj, ITEM_ANTI_GOOD) && IS_GOOD(ch) ) + || ( IS_OBJ_STAT(obj, ITEM_ANTI_NEUTRAL) && IS_NEUTRAL(ch) ) ) + { + /* + * Thanks to Morgenes for the bug fix here! + */ + act( "You are zapped by $p and drop it.", ch, obj, NULL, TO_CHAR ); + act( "$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM ); + obj_from_char( obj ); + obj_to_room( obj, ch->in_room ); + return; + } + + for (i = 0; i < 4; i++) + ch->armor[i] -= apply_ac( obj, iWear,i ); + obj->wear_loc = iWear; + + if (!obj->enchanted) + for ( paf = obj->pIndexData->affected; paf != NULL; paf = paf->next ) + if ( paf->location != APPLY_SPELL_AFFECT ) + affect_modify( ch, paf, TRUE ); + for ( paf = obj->affected; paf != NULL; paf = paf->next ) + if ( paf->location == APPLY_SPELL_AFFECT ) + affect_to_char ( ch, paf ); + else + affect_modify( ch, paf, TRUE ); + + if ( obj->item_type == ITEM_LIGHT + && obj->value[2] != 0 + && ch->in_room != NULL ) + ++ch->in_room->light; + + return; +} + + + +/* + * Unequip a char with an obj. + */ +void unequip_char( CHAR_DATA *ch, OBJ_DATA *obj ) +{ + AFFECT_DATA *paf = NULL; + AFFECT_DATA *lpaf = NULL; + AFFECT_DATA *lpaf_next = NULL; + int i; + + if ( obj->wear_loc == WEAR_NONE ) + { + bug( "Unequip_char: already unequipped.", 0 ); + return; + } + + for (i = 0; i < 4; i++) + ch->armor[i] += apply_ac( obj, obj->wear_loc,i ); + obj->wear_loc = -1; + + if (!obj->enchanted) + for ( paf = obj->pIndexData->affected; paf != NULL; paf = paf->next ) + if ( paf->location == APPLY_SPELL_AFFECT ) + { + for ( lpaf = ch->affected; lpaf != NULL; lpaf = lpaf_next ) + { + lpaf_next = lpaf->next; + if ((lpaf->type == paf->type) && + (lpaf->level == paf->level) && + (lpaf->location == APPLY_SPELL_AFFECT)) + { + affect_remove( ch, lpaf ); + lpaf_next = NULL; + } + } + } + else + { + affect_modify( ch, paf, FALSE ); + affect_check(ch,paf->where,paf->bitvector); + } + + for ( paf = obj->affected; paf != NULL; paf = paf->next ) + if ( paf->location == APPLY_SPELL_AFFECT ) + { + bug ( "Norm-Apply: %d", 0 ); + for ( lpaf = ch->affected; lpaf != NULL; lpaf = lpaf_next ) + { + lpaf_next = lpaf->next; + if ((lpaf->type == paf->type) && + (lpaf->level == paf->level) && + (lpaf->location == APPLY_SPELL_AFFECT)) + { + bug ( "location = %d", lpaf->location ); + bug ( "type = %d", lpaf->type ); + affect_remove( ch, lpaf ); + lpaf_next = NULL; + } + } + } + else + { + affect_modify( ch, paf, FALSE ); + affect_check(ch,paf->where,paf->bitvector); + } + + if ( obj->item_type == ITEM_LIGHT + && obj->value[2] != 0 + && ch->in_room != NULL + && ch->in_room->light > 0 ) + --ch->in_room->light; + + return; +} + + + +/* + * Count occurrences of an obj in a list. + */ +int count_obj_list( OBJ_INDEX_DATA *pObjIndex, OBJ_DATA *list ) +{ + OBJ_DATA *obj; + int nMatch; + + nMatch = 0; + for ( obj = list; obj != NULL; obj = obj->next_content ) + { + if ( obj->pIndexData == pObjIndex ) + nMatch++; + } + + return nMatch; +} + + + +/* + * Move an obj out of a room. + */ +void obj_from_room( OBJ_DATA *obj ) +{ + ROOM_INDEX_DATA *in_room; + CHAR_DATA *ch; + + if ( ( in_room = obj->in_room ) == NULL ) + { + bug( "obj_from_room: NULL.", 0 ); + return; + } + + for (ch = in_room->people; ch != NULL; ch = ch->next_in_room) + if (ch->on == obj) + ch->on = NULL; + + if ( obj == in_room->contents ) + { + in_room->contents = obj->next_content; + } + else + { + OBJ_DATA *prev; + + for ( prev = in_room->contents; prev; prev = prev->next_content ) + { + if ( prev->next_content == obj ) + { + prev->next_content = obj->next_content; + break; + } + } + + if ( prev == NULL ) + { + bug( "Obj_from_room: obj not found.", 0 ); + return; + } + } + + obj->in_room = NULL; + obj->next_content = NULL; + return; +} + + + +/* + * Move an obj into a room. + */ +void obj_to_room( OBJ_DATA *obj, ROOM_INDEX_DATA *pRoomIndex ) +{ + obj->next_content = pRoomIndex->contents; + pRoomIndex->contents = obj; + obj->in_room = pRoomIndex; + obj->carried_by = NULL; + obj->in_obj = NULL; + return; +} + + + +/* + * Move an object into an object. + */ +void obj_to_obj( OBJ_DATA *obj, OBJ_DATA *obj_to ) +{ + obj->next_content = obj_to->contains; + obj_to->contains = obj; + obj->in_obj = obj_to; + obj->in_room = NULL; + obj->carried_by = NULL; + if (obj_to->pIndexData->vnum == OBJ_VNUM_PIT) + obj->cost = 0; + + for ( ; obj_to != NULL; obj_to = obj_to->in_obj ) + { + if ( obj_to->carried_by != NULL ) + { + obj_to->carried_by->carry_number += get_obj_number( obj ); + obj_to->carried_by->carry_weight += get_obj_weight( obj ) + * WEIGHT_MULT(obj_to) / 100; + } + } + + return; +} + + + +/* + * Move an object out of an object. + */ +void obj_from_obj( OBJ_DATA *obj ) +{ + OBJ_DATA *obj_from; + + if ( ( obj_from = obj->in_obj ) == NULL ) + { + bug( "Obj_from_obj: null obj_from.", 0 ); + return; + } + + if ( obj == obj_from->contains ) + { + obj_from->contains = obj->next_content; + } + else + { + OBJ_DATA *prev; + + for ( prev = obj_from->contains; prev; prev = prev->next_content ) + { + if ( prev->next_content == obj ) + { + prev->next_content = obj->next_content; + break; + } + } + + if ( prev == NULL ) + { + bug( "Obj_from_obj: obj not found.", 0 ); + return; + } + } + + obj->next_content = NULL; + obj->in_obj = NULL; + + for ( ; obj_from != NULL; obj_from = obj_from->in_obj ) + { + if ( obj_from->carried_by != NULL ) + { + obj_from->carried_by->carry_number -= get_obj_number( obj ); + obj_from->carried_by->carry_weight -= get_obj_weight( obj ) + * WEIGHT_MULT(obj_from) / 100; + } + } + + return; +} + + + +/* + * Extract an obj from the world. + */ +void extract_obj( OBJ_DATA *obj ) +{ + OBJ_DATA *obj_content; + OBJ_DATA *obj_next; + + if ( obj->in_room != NULL ) + obj_from_room( obj ); + else if ( obj->carried_by != NULL ) + obj_from_char( obj ); + else if ( obj->in_obj != NULL ) + obj_from_obj( obj ); + + for ( obj_content = obj->contains; obj_content; obj_content = obj_next ) + { + obj_next = obj_content->next_content; + extract_obj( obj_content ); + } + + if ( object_list == obj ) + { + object_list = obj->next; + } + else + { + OBJ_DATA *prev; + + for ( prev = object_list; prev != NULL; prev = prev->next ) + { + if ( prev->next == obj ) + { + prev->next = obj->next; + break; + } + } + + if ( prev == NULL ) + { + bug( "Extract_obj: obj %d not found.", obj->pIndexData->vnum ); + return; + } + } + + --obj->pIndexData->count; + free_obj(obj); + return; +} + + + +/* + * Extract a char from the world. + */ +void extract_char( CHAR_DATA *ch, bool fPull ) +{ + CHAR_DATA *wch; + OBJ_DATA *obj; + OBJ_DATA *obj_next; + + /* doesn't seem to be necessary + if ( ch->in_room == NULL ) + { + bug( "Extract_char: NULL.", 0 ); + return; + } + */ + + nuke_pets(ch); + ch->pet = NULL; /* just in case */ + + if ( fPull ) + + die_follower( ch ); + + stop_fighting( ch, TRUE ); + + for ( obj = ch->carrying; obj != NULL; obj = obj_next ) + { + obj_next = obj->next_content; + extract_obj( obj ); + } + + if (ch->in_room != NULL) + char_from_room( ch ); + + /* Death room is set in the clan tabe now */ + if ( !fPull ) + { + char_to_room(ch,get_room_index(clan_table[ch->clan].hall)); + return; + } + + if ( IS_NPC(ch) ) + --ch->pIndexData->count; + + if ( ch->desc != NULL && ch->desc->original != NULL ) + { + do_function(ch, &do_return, "" ); + ch->desc = NULL; + } + + for ( wch = char_list; wch != NULL; wch = wch->next ) + { + if ( wch->reply == ch ) + wch->reply = NULL; + } + + if ( ch == char_list ) + { + char_list = ch->next; + } + else + { + CHAR_DATA *prev; + + for ( prev = char_list; prev != NULL; prev = prev->next ) + { + if ( prev->next == ch ) + { + prev->next = ch->next; + break; + } + } + + if ( prev == NULL ) + { + bug( "Extract_char: char not found.", 0 ); + return; + } + } + + if ( ch->desc != NULL ) + ch->desc->character = NULL; + free_char( ch ); + return; +} + + + +/* + * Find a char in the room. + */ +CHAR_DATA *get_char_room( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + CHAR_DATA *rch; + int number; + int count; + + number = number_argument( argument, arg ); + count = 0; + if ( !str_cmp( arg, "self" ) ) + return ch; + for ( rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room ) + { + if ( !can_see( ch, rch ) || !is_name( arg, rch->name ) ) + continue; + if ( ++count == number ) + return rch; + } + + return NULL; +} + + + + +/* + * Find a char in the world. + */ +CHAR_DATA *get_char_world( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + CHAR_DATA *wch; + int number; + int count; + + if ( ( wch = get_char_room( ch, argument ) ) != NULL ) + return wch; + + number = number_argument( argument, arg ); + count = 0; + for ( wch = char_list; wch != NULL ; wch = wch->next ) + { + if ( wch->in_room == NULL || !can_see( ch, wch ) + || !is_name( arg, wch->name ) ) + continue; + if ( ++count == number ) + return wch; + } + + return NULL; +} + + + +/* + * Find some object with a given index data. + * Used by area-reset 'P' command. + */ +OBJ_DATA *get_obj_type( OBJ_INDEX_DATA *pObjIndex ) +{ + OBJ_DATA *obj; + + for ( obj = object_list; obj != NULL; obj = obj->next ) + { + if ( obj->pIndexData == pObjIndex ) + return obj; + } + + return NULL; +} + + +/* + * Find an obj in a list. + */ +OBJ_DATA *get_obj_list( CHAR_DATA *ch, char *argument, OBJ_DATA *list ) +{ + char arg[MAX_INPUT_LENGTH]; + OBJ_DATA *obj; + int number; + int count; + + number = number_argument( argument, arg ); + count = 0; + for ( obj = list; obj != NULL; obj = obj->next_content ) + { + if ( can_see_obj( ch, obj ) && is_name( arg, obj->name ) ) + { + if ( ++count == number ) + return obj; + } + } + + return NULL; +} + + + +/* + * Find an obj in player's inventory. + */ +OBJ_DATA *get_obj_carry( CHAR_DATA *ch, char *argument, CHAR_DATA *viewer ) +{ + char arg[MAX_INPUT_LENGTH]; + OBJ_DATA *obj; + int number; + int count; + + number = number_argument( argument, arg ); + count = 0; + for ( obj = ch->carrying; obj != NULL; obj = obj->next_content ) + { + if ( obj->wear_loc == WEAR_NONE + && (can_see_obj( viewer, obj ) ) + && is_name( arg, obj->name ) ) + { + if ( ++count == number ) + return obj; + } + } + + return NULL; +} + + + +/* + * Find an obj in player's equipment. + */ +OBJ_DATA *get_obj_wear( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + OBJ_DATA *obj; + int number; + int count; + + number = number_argument( argument, arg ); + count = 0; + for ( obj = ch->carrying; obj != NULL; obj = obj->next_content ) + { + if ( obj->wear_loc != WEAR_NONE + && can_see_obj( ch, obj ) + && is_name( arg, obj->name ) ) + { + if ( ++count == number ) + return obj; + } + } + + return NULL; +} + + + +/* + * Find an obj in the room or in inventory. + */ +OBJ_DATA *get_obj_here( CHAR_DATA *ch, char *argument ) +{ + OBJ_DATA *obj; + + obj = get_obj_list( ch, argument, ch->in_room->contents ); + if ( obj != NULL ) + return obj; + + if ( ( obj = get_obj_carry( ch, argument, ch ) ) != NULL ) + return obj; + + if ( ( obj = get_obj_wear( ch, argument ) ) != NULL ) + return obj; + + return NULL; +} + + + +/* + * Find an obj in the world. + */ +OBJ_DATA *get_obj_world( CHAR_DATA *ch, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + OBJ_DATA *obj; + int number; + int count; + + if ( ( obj = get_obj_here( ch, argument ) ) != NULL ) + return obj; + + number = number_argument( argument, arg ); + count = 0; + for ( obj = object_list; obj != NULL; obj = obj->next ) + { + if ( can_see_obj( ch, obj ) && is_name( arg, obj->name ) ) + { + if ( ++count == number ) + return obj; + } + } + + return NULL; +} + +/* deduct cost from a character */ + +void deduct_cost(CHAR_DATA *ch, int cost) +{ + int silver = 0, gold = 0; + + silver = UMIN(ch->silver,cost); + + if (silver < cost) + { + gold = ((cost - silver + 99) / 100); + silver = cost - 100 * gold; + } + + ch->gold -= gold; + ch->silver -= silver; + + if (ch->gold < 0) + { + bug("deduct costs: gold %d < 0",ch->gold); + ch->gold = 0; + } + if (ch->silver < 0) + { + bug("deduct costs: silver %d < 0",ch->silver); + ch->silver = 0; + } +} +/* + * Create a 'money' obj. + */ +OBJ_DATA *create_money( int gold, int silver ) +{ + char buf[MAX_STRING_LENGTH]; + OBJ_DATA *obj; + + if ( gold < 0 || silver < 0 || (gold == 0 && silver == 0) ) + { + bug( "Create_money: zero or negative money.",UMIN(gold,silver)); + gold = UMAX(1,gold); + silver = UMAX(1,silver); + } + + if (gold == 0 && silver == 1) + { + obj = create_object( get_obj_index( OBJ_VNUM_SILVER_ONE ), 0 ); + } + else if (gold == 1 && silver == 0) + { + obj = create_object( get_obj_index( OBJ_VNUM_GOLD_ONE), 0 ); + } + else if (silver == 0) + { + obj = create_object( get_obj_index( OBJ_VNUM_GOLD_SOME ), 0 ); + sprintf( buf, obj->short_descr, gold ); + free_string( obj->short_descr ); + obj->short_descr = str_dup( buf ); + obj->value[1] = gold; + obj->cost = gold; + obj->weight = gold/5; + } + else if (gold == 0) + { + obj = create_object( get_obj_index( OBJ_VNUM_SILVER_SOME ), 0 ); + sprintf( buf, obj->short_descr, silver ); + free_string( obj->short_descr ); + obj->short_descr = str_dup( buf ); + obj->value[0] = silver; + obj->cost = silver; + obj->weight = silver/20; + } + + else + { + obj = create_object( get_obj_index( OBJ_VNUM_COINS ), 0 ); + sprintf( buf, obj->short_descr, silver, gold ); + free_string( obj->short_descr ); + obj->short_descr = str_dup( buf ); + obj->value[0] = silver; + obj->value[1] = gold; + obj->cost = 100 * gold + silver; + obj->weight = gold / 5 + silver / 20; + } + + return obj; +} + + + +/* + * Return # of objects which an object counts as. + * Thanks to Tony Chamberlain for the correct recursive code here. + */ +int get_obj_number( OBJ_DATA *obj ) +{ + int number; + + if (obj->item_type == ITEM_CONTAINER || obj->item_type == ITEM_MONEY + || obj->item_type == ITEM_GEM || obj->item_type == ITEM_JEWELRY) + number = 0; + else + number = 1; + + for ( obj = obj->contains; obj != NULL; obj = obj->next_content ) + number += get_obj_number( obj ); + + return number; +} + + +/* + * Return weight of an object, including weight of contents. + */ +int get_obj_weight( OBJ_DATA *obj ) +{ + int weight; + OBJ_DATA *tobj; + + weight = obj->weight; + for ( tobj = obj->contains; tobj != NULL; tobj = tobj->next_content ) + weight += get_obj_weight( tobj ) * WEIGHT_MULT(obj) / 100; + + return weight; +} + +int get_true_weight(OBJ_DATA *obj) +{ + int weight; + + weight = obj->weight; + for ( obj = obj->contains; obj != NULL; obj = obj->next_content ) + weight += get_obj_weight( obj ); + + return weight; +} + +/* + * True if room is dark. + */ +bool room_is_dark( ROOM_INDEX_DATA *pRoomIndex ) +{ + if ( pRoomIndex->light > 0 ) + return FALSE; + + if ( IS_SET(pRoomIndex->room_flags, ROOM_DARK) ) + return TRUE; + + if ( pRoomIndex->sector_type == SECT_INSIDE + || pRoomIndex->sector_type == SECT_CITY ) + return FALSE; + + if ( weather_info.sunlight == SUN_SET + || weather_info.sunlight == SUN_DARK ) + return TRUE; + + return FALSE; +} + + +bool is_room_owner(CHAR_DATA *ch, ROOM_INDEX_DATA *room) +{ + if (room->owner == NULL || room->owner[0] == '\0') + return FALSE; + + return is_name(ch->name,room->owner); +} + +/* + * True if room is private. + */ +bool room_is_private( ROOM_INDEX_DATA *pRoomIndex ) +{ + CHAR_DATA *rch; + int count; + + + if (pRoomIndex->owner != NULL && pRoomIndex->owner[0] != '\0') + return TRUE; + + count = 0; + for ( rch = pRoomIndex->people; rch != NULL; rch = rch->next_in_room ) + count++; + + if ( IS_SET(pRoomIndex->room_flags, ROOM_PRIVATE) && count >= 2 ) + return TRUE; + + if ( IS_SET(pRoomIndex->room_flags, ROOM_SOLITARY) && count >= 1 ) + return TRUE; + + if ( IS_SET(pRoomIndex->room_flags, ROOM_IMP_ONLY) ) + return TRUE; + + return FALSE; +} + +/* visibility on a room -- for entering and exits */ +bool can_see_room( CHAR_DATA *ch, ROOM_INDEX_DATA *pRoomIndex ) +{ + if (IS_SET(pRoomIndex->room_flags, ROOM_IMP_ONLY) + && get_trust(ch) < MAX_LEVEL) + return FALSE; + + if (IS_SET(pRoomIndex->room_flags, ROOM_GODS_ONLY) + && !IS_IMMORTAL(ch)) + return FALSE; + + if (IS_SET(pRoomIndex->room_flags, ROOM_HEROES_ONLY) + && !IS_IMMORTAL(ch)) + return FALSE; + + if (IS_SET(pRoomIndex->room_flags,ROOM_NEWBIES_ONLY) + && ch->level > 5 && !IS_IMMORTAL(ch)) + return FALSE; + + if (!IS_IMMORTAL(ch) && pRoomIndex->clan && ch->clan != pRoomIndex->clan) + return FALSE; + + return TRUE; +} + + + +/* + * True if char can see victim. + */ +bool can_see( CHAR_DATA *ch, CHAR_DATA *victim ) +{ +/* RT changed so that WIZ_INVIS has levels */ + if ( ch == victim ) + return TRUE; + + if ( get_trust(ch) < victim->invis_level) + return FALSE; + + + if (get_trust(ch) < victim->incog_level && ch->in_room != victim->in_room) + return FALSE; + + if ( (!IS_NPC(ch) && IS_SET(ch->act, PLR_HOLYLIGHT)) + || (IS_NPC(ch) && IS_IMMORTAL(ch))) + return TRUE; + + if ( IS_AFFECTED(ch, AFF_BLIND) ) + return FALSE; + + if ( room_is_dark( ch->in_room ) && !IS_AFFECTED(ch, AFF_INFRARED) ) + return FALSE; + + if ( IS_AFFECTED(victim, AFF_INVISIBLE) + && !IS_AFFECTED(ch, AFF_DETECT_INVIS) ) + return FALSE; + + /* sneaking */ + if ( IS_AFFECTED(victim, AFF_SNEAK) + && !IS_AFFECTED(ch,AFF_DETECT_HIDDEN) + && victim->fighting == NULL) + { + int chance; + chance = get_skill(victim,gsn_sneak); + chance += get_curr_stat(victim,STAT_DEX) * 3/2; + chance -= get_curr_stat(ch,STAT_INT) * 2; + chance -= ch->level - victim->level * 3/2; + + if (number_percent() < chance) + return FALSE; + } + + if ( IS_AFFECTED(victim, AFF_HIDE) + && !IS_AFFECTED(ch, AFF_DETECT_HIDDEN) + && victim->fighting == NULL) + return FALSE; + + return TRUE; +} + + + +/* + * True if char can see obj. + */ +bool can_see_obj( CHAR_DATA *ch, OBJ_DATA *obj ) +{ + if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_HOLYLIGHT) ) + return TRUE; + + if ( IS_SET(obj->extra_flags,ITEM_VIS_DEATH)) + return FALSE; + + if ( IS_AFFECTED( ch, AFF_BLIND ) && obj->item_type != ITEM_POTION) + return FALSE; + + if ( obj->item_type == ITEM_LIGHT && obj->value[2] != 0 ) + return TRUE; + + if ( IS_SET(obj->extra_flags, ITEM_INVIS) + && !IS_AFFECTED(ch, AFF_DETECT_INVIS) ) + return FALSE; + + if ( IS_OBJ_STAT(obj,ITEM_GLOW)) + return TRUE; + + if ( room_is_dark( ch->in_room ) && !IS_AFFECTED(ch, AFF_DARK_VISION) ) + return FALSE; + + return TRUE; +} + + + +/* + * True if char can drop obj. + */ +bool can_drop_obj( CHAR_DATA *ch, OBJ_DATA *obj ) +{ + if ( !IS_SET(obj->extra_flags, ITEM_NODROP) ) + return TRUE; + + if ( !IS_NPC(ch) && ch->level >= LEVEL_IMMORTAL ) + return TRUE; + + return FALSE; +} + + +/* + * Return ascii name of an affect location. + */ +char *affect_loc_name( int location ) +{ + switch ( location ) + { + case APPLY_NONE: return "none"; + case APPLY_STR: return "strength"; + case APPLY_DEX: return "dexterity"; + case APPLY_INT: return "intelligence"; + case APPLY_WIS: return "wisdom"; + case APPLY_CON: return "constitution"; + case APPLY_SEX: return "sex"; + case APPLY_CLASS: return "class"; + case APPLY_LEVEL: return "level"; + case APPLY_AGE: return "age"; + case APPLY_MANA: return "mana"; + case APPLY_HIT: return "hp"; + case APPLY_MOVE: return "moves"; + case APPLY_GOLD: return "gold"; + case APPLY_EXP: return "experience"; + case APPLY_AC: return "armor class"; + case APPLY_HITROLL: return "hit roll"; + case APPLY_DAMROLL: return "damage roll"; + case APPLY_SAVES: return "saves"; + case APPLY_SAVING_ROD: return "save vs rod"; + case APPLY_SAVING_PETRI: return "save vs petrification"; + case APPLY_SAVING_BREATH: return "save vs breath"; + case APPLY_SAVING_SPELL: return "save vs spell"; + case APPLY_SPELL_AFFECT: return "none"; + } + + bug( "Affect_location_name: unknown location %d.", location ); + return "(unknown)"; +} + + + +/* + * Return ascii name of an affect bit vector. + */ +char *affect_bit_name( int vector ) +{ + static char buf[512]; + + buf[0] = '\0'; + if ( vector & AFF_BLIND ) strcat( buf, " blind" ); + if ( vector & AFF_INVISIBLE ) strcat( buf, " invisible" ); + if ( vector & AFF_DETECT_EVIL ) strcat( buf, " detect_evil" ); + if ( vector & AFF_DETECT_GOOD ) strcat( buf, " detect_good" ); + if ( vector & AFF_DETECT_INVIS ) strcat( buf, " detect_invis" ); + if ( vector & AFF_DETECT_MAGIC ) strcat( buf, " detect_magic" ); + if ( vector & AFF_DETECT_HIDDEN ) strcat( buf, " detect_hidden" ); + if ( vector & AFF_SANCTUARY ) strcat( buf, " sanctuary" ); + if ( vector & AFF_FAERIE_FIRE ) strcat( buf, " faerie_fire" ); + if ( vector & AFF_INFRARED ) strcat( buf, " infrared" ); + if ( vector & AFF_CURSE ) strcat( buf, " curse" ); + if ( vector & AFF_POISON ) strcat( buf, " poison" ); + if ( vector & AFF_PROTECT_EVIL ) strcat( buf, " prot_evil" ); + if ( vector & AFF_PROTECT_GOOD ) strcat( buf, " prot_good" ); + if ( vector & AFF_SLEEP ) strcat( buf, " sleep" ); + if ( vector & AFF_SNEAK ) strcat( buf, " sneak" ); + if ( vector & AFF_HIDE ) strcat( buf, " hide" ); + if ( vector & AFF_CHARM ) strcat( buf, " charm" ); + if ( vector & AFF_FLYING ) strcat( buf, " flying" ); + if ( vector & AFF_PASS_DOOR ) strcat( buf, " pass_door" ); + if ( vector & AFF_BERSERK ) strcat( buf, " berserk" ); + if ( vector & AFF_CALM ) strcat( buf, " calm" ); + if ( vector & AFF_HASTE ) strcat( buf, " haste" ); + if ( vector & AFF_SLOW ) strcat( buf, " slow" ); + if ( vector & AFF_PLAGUE ) strcat( buf, " plague" ); + if ( vector & AFF_DARK_VISION ) strcat( buf, " dark_vision" ); + return ( buf[0] != '\0' ) ? buf+1 : "none"; +} + + + +/* + * Return ascii name of extra flags vector. + */ +char *extra_bit_name( int extra_flags ) +{ + static char buf[512]; + + buf[0] = '\0'; + if ( extra_flags & ITEM_GLOW ) strcat( buf, " glow" ); + if ( extra_flags & ITEM_HUM ) strcat( buf, " hum" ); + if ( extra_flags & ITEM_DARK ) strcat( buf, " dark" ); + if ( extra_flags & ITEM_LOCK ) strcat( buf, " lock" ); + if ( extra_flags & ITEM_EVIL ) strcat( buf, " evil" ); + if ( extra_flags & ITEM_INVIS ) strcat( buf, " invis" ); + if ( extra_flags & ITEM_MAGIC ) strcat( buf, " magic" ); + if ( extra_flags & ITEM_NODROP ) strcat( buf, " nodrop" ); + if ( extra_flags & ITEM_BLESS ) strcat( buf, " bless" ); + if ( extra_flags & ITEM_ANTI_GOOD ) strcat( buf, " anti-good" ); + if ( extra_flags & ITEM_ANTI_EVIL ) strcat( buf, " anti-evil" ); + if ( extra_flags & ITEM_ANTI_NEUTRAL ) strcat( buf, " anti-neutral" ); + if ( extra_flags & ITEM_NOREMOVE ) strcat( buf, " noremove" ); + if ( extra_flags & ITEM_INVENTORY ) strcat( buf, " inventory" ); + if ( extra_flags & ITEM_NOPURGE ) strcat( buf, " nopurge" ); + if ( extra_flags & ITEM_VIS_DEATH ) strcat( buf, " vis_death" ); + if ( extra_flags & ITEM_ROT_DEATH ) strcat( buf, " rot_death" ); + if ( extra_flags & ITEM_NOLOCATE ) strcat( buf, " no_locate" ); + if ( extra_flags & ITEM_SELL_EXTRACT ) strcat( buf, " sell_extract" ); + if ( extra_flags & ITEM_BURN_PROOF ) strcat( buf, " burn_proof" ); + if ( extra_flags & ITEM_NOUNCURSE ) strcat( buf, " no_uncurse" ); + return ( buf[0] != '\0' ) ? buf+1 : "none"; +} + +/* return ascii name of an act vector */ +char *act_bit_name( int act_flags ) +{ + static char buf[512]; + + buf[0] = '\0'; + + if (IS_SET(act_flags,ACT_IS_NPC)) + { + strcat(buf," npc"); + if (act_flags & ACT_SENTINEL ) strcat(buf, " sentinel"); + if (act_flags & ACT_SCAVENGER ) strcat(buf, " scavenger"); + if (act_flags & ACT_AGGRESSIVE ) strcat(buf, " aggressive"); + if (act_flags & ACT_STAY_AREA ) strcat(buf, " stay_area"); + if (act_flags & ACT_WIMPY ) strcat(buf, " wimpy"); + if (act_flags & ACT_PET ) strcat(buf, " pet"); + if (act_flags & ACT_TRAIN ) strcat(buf, " train"); + if (act_flags & ACT_PRACTICE ) strcat(buf, " practice"); + if (act_flags & ACT_UNDEAD ) strcat(buf, " undead"); + if (act_flags & ACT_CLERIC ) strcat(buf, " cleric"); + if (act_flags & ACT_MAGE ) strcat(buf, " mage"); + if (act_flags & ACT_THIEF ) strcat(buf, " thief"); + if (act_flags & ACT_WARRIOR ) strcat(buf, " warrior"); + if (act_flags & ACT_NOALIGN ) strcat(buf, " no_align"); + if (act_flags & ACT_NOPURGE ) strcat(buf, " no_purge"); + if (act_flags & ACT_IS_HEALER ) strcat(buf, " healer"); + if (act_flags & ACT_IS_CHANGER ) strcat(buf, " changer"); + if (act_flags & ACT_GAIN ) strcat(buf, " skill_train"); + if (act_flags & ACT_UPDATE_ALWAYS) strcat(buf," update_always"); + } + else + { + strcat(buf," player"); + if (act_flags & PLR_AUTOASSIST ) strcat(buf, " autoassist"); + if (act_flags & PLR_AUTOEXIT ) strcat(buf, " autoexit"); + if (act_flags & PLR_AUTOLOOT ) strcat(buf, " autoloot"); + if (act_flags & PLR_AUTOSAC ) strcat(buf, " autosac"); + if (act_flags & PLR_AUTOGOLD ) strcat(buf, " autogold"); + if (act_flags & PLR_AUTOSPLIT ) strcat(buf, " autosplit"); + if (act_flags & PLR_HOLYLIGHT ) strcat(buf, " holy_light"); + if (act_flags & PLR_CANLOOT ) strcat(buf, " loot_corpse"); + if (act_flags & PLR_NOSUMMON ) strcat(buf, " no_summon"); + if (act_flags & PLR_NOFOLLOW ) strcat(buf, " no_follow"); + if (act_flags & PLR_FREEZE ) strcat(buf, " frozen"); + if (act_flags & PLR_THIEF ) strcat(buf, " thief"); + if (act_flags & PLR_KILLER ) strcat(buf, " killer"); + } + return ( buf[0] != '\0' ) ? buf+1 : "none"; +} + +char *comm_bit_name(int comm_flags) +{ + static char buf[512]; + + buf[0] = '\0'; + + if (comm_flags & COMM_QUIET ) strcat(buf, " quiet"); + if (comm_flags & COMM_DEAF ) strcat(buf, " deaf"); + if (comm_flags & COMM_NOWIZ ) strcat(buf, " no_wiz"); + if (comm_flags & COMM_NOAUCTION ) strcat(buf, " no_auction"); + if (comm_flags & COMM_NOGOSSIP ) strcat(buf, " no_gossip"); + if (comm_flags & COMM_NOQUESTION ) strcat(buf, " no_question"); + if (comm_flags & COMM_NOMUSIC ) strcat(buf, " no_music"); + if (comm_flags & COMM_NOQUOTE ) strcat(buf, " no_quote"); + if (comm_flags & COMM_COMPACT ) strcat(buf, " compact"); + if (comm_flags & COMM_BRIEF ) strcat(buf, " brief"); + if (comm_flags & COMM_PROMPT ) strcat(buf, " prompt"); + if (comm_flags & COMM_COMBINE ) strcat(buf, " combine"); + if (comm_flags & COMM_NOEMOTE ) strcat(buf, " no_emote"); + if (comm_flags & COMM_NOSHOUT ) strcat(buf, " no_shout"); + if (comm_flags & COMM_NOTELL ) strcat(buf, " no_tell"); + if (comm_flags & COMM_NOCHANNELS ) strcat(buf, " no_channels"); + + + return ( buf[0] != '\0' ) ? buf+1 : "none"; +} + +char *imm_bit_name(int imm_flags) +{ + static char buf[512]; + + buf[0] = '\0'; + + if (imm_flags & IMM_SUMMON ) strcat(buf, " summon"); + if (imm_flags & IMM_CHARM ) strcat(buf, " charm"); + if (imm_flags & IMM_MAGIC ) strcat(buf, " magic"); + if (imm_flags & IMM_WEAPON ) strcat(buf, " weapon"); + if (imm_flags & IMM_BASH ) strcat(buf, " blunt"); + if (imm_flags & IMM_PIERCE ) strcat(buf, " piercing"); + if (imm_flags & IMM_SLASH ) strcat(buf, " slashing"); + if (imm_flags & IMM_FIRE ) strcat(buf, " fire"); + if (imm_flags & IMM_COLD ) strcat(buf, " cold"); + if (imm_flags & IMM_LIGHTNING ) strcat(buf, " lightning"); + if (imm_flags & IMM_ACID ) strcat(buf, " acid"); + if (imm_flags & IMM_POISON ) strcat(buf, " poison"); + if (imm_flags & IMM_NEGATIVE ) strcat(buf, " negative"); + if (imm_flags & IMM_HOLY ) strcat(buf, " holy"); + if (imm_flags & IMM_ENERGY ) strcat(buf, " energy"); + if (imm_flags & IMM_MENTAL ) strcat(buf, " mental"); + if (imm_flags & IMM_DISEASE ) strcat(buf, " disease"); + if (imm_flags & IMM_DROWNING ) strcat(buf, " drowning"); + if (imm_flags & IMM_LIGHT ) strcat(buf, " light"); + if (imm_flags & VULN_IRON ) strcat(buf, " iron"); + if (imm_flags & VULN_WOOD ) strcat(buf, " wood"); + if (imm_flags & VULN_SILVER ) strcat(buf, " silver"); + + return ( buf[0] != '\0' ) ? buf+1 : "none"; +} + +char *wear_bit_name(int wear_flags) +{ + static char buf[512]; + + buf [0] = '\0'; + if (wear_flags & ITEM_TAKE ) strcat(buf, " take"); + if (wear_flags & ITEM_WEAR_FINGER ) strcat(buf, " finger"); + if (wear_flags & ITEM_WEAR_NECK ) strcat(buf, " neck"); + if (wear_flags & ITEM_WEAR_BODY ) strcat(buf, " torso"); + if (wear_flags & ITEM_WEAR_HEAD ) strcat(buf, " head"); + if (wear_flags & ITEM_WEAR_LEGS ) strcat(buf, " legs"); + if (wear_flags & ITEM_WEAR_FEET ) strcat(buf, " feet"); + if (wear_flags & ITEM_WEAR_HANDS ) strcat(buf, " hands"); + if (wear_flags & ITEM_WEAR_ARMS ) strcat(buf, " arms"); + if (wear_flags & ITEM_WEAR_SHIELD ) strcat(buf, " shield"); + if (wear_flags & ITEM_WEAR_ABOUT ) strcat(buf, " body"); + if (wear_flags & ITEM_WEAR_WAIST ) strcat(buf, " waist"); + if (wear_flags & ITEM_WEAR_WRIST ) strcat(buf, " wrist"); + if (wear_flags & ITEM_WIELD ) strcat(buf, " wield"); + if (wear_flags & ITEM_HOLD ) strcat(buf, " hold"); + if (wear_flags & ITEM_NO_SAC ) strcat(buf, " nosac"); + if (wear_flags & ITEM_WEAR_FLOAT ) strcat(buf, " float"); + + return ( buf[0] != '\0' ) ? buf+1 : "none"; +} + +char *form_bit_name(int form_flags) +{ + static char buf[512]; + + buf[0] = '\0'; + if (form_flags & FORM_POISON ) strcat(buf, " poison"); + else if (form_flags & FORM_EDIBLE ) strcat(buf, " edible"); + if (form_flags & FORM_MAGICAL ) strcat(buf, " magical"); + if (form_flags & FORM_INSTANT_DECAY ) strcat(buf, " instant_rot"); + if (form_flags & FORM_OTHER ) strcat(buf, " other"); + if (form_flags & FORM_ANIMAL ) strcat(buf, " animal"); + if (form_flags & FORM_SENTIENT ) strcat(buf, " sentient"); + if (form_flags & FORM_UNDEAD ) strcat(buf, " undead"); + if (form_flags & FORM_CONSTRUCT ) strcat(buf, " construct"); + if (form_flags & FORM_MIST ) strcat(buf, " mist"); + if (form_flags & FORM_INTANGIBLE ) strcat(buf, " intangible"); + if (form_flags & FORM_BIPED ) strcat(buf, " biped"); + if (form_flags & FORM_CENTAUR ) strcat(buf, " centaur"); + if (form_flags & FORM_INSECT ) strcat(buf, " insect"); + if (form_flags & FORM_SPIDER ) strcat(buf, " spider"); + if (form_flags & FORM_CRUSTACEAN ) strcat(buf, " crustacean"); + if (form_flags & FORM_WORM ) strcat(buf, " worm"); + if (form_flags & FORM_BLOB ) strcat(buf, " blob"); + if (form_flags & FORM_MAMMAL ) strcat(buf, " mammal"); + if (form_flags & FORM_BIRD ) strcat(buf, " bird"); + if (form_flags & FORM_REPTILE ) strcat(buf, " reptile"); + if (form_flags & FORM_SNAKE ) strcat(buf, " snake"); + if (form_flags & FORM_DRAGON ) strcat(buf, " dragon"); + if (form_flags & FORM_AMPHIBIAN ) strcat(buf, " amphibian"); + if (form_flags & FORM_FISH ) strcat(buf, " fish"); + if (form_flags & FORM_COLD_BLOOD ) strcat(buf, " cold_blooded"); + + return ( buf[0] != '\0' ) ? buf+1 : "none"; +} + +char *part_bit_name(int part_flags) +{ + static char buf[512]; + + buf[0] = '\0'; + if (part_flags & PART_HEAD ) strcat(buf, " head"); + if (part_flags & PART_ARMS ) strcat(buf, " arms"); + if (part_flags & PART_LEGS ) strcat(buf, " legs"); + if (part_flags & PART_HEART ) strcat(buf, " heart"); + if (part_flags & PART_BRAINS ) strcat(buf, " brains"); + if (part_flags & PART_GUTS ) strcat(buf, " guts"); + if (part_flags & PART_HANDS ) strcat(buf, " hands"); + if (part_flags & PART_FEET ) strcat(buf, " feet"); + if (part_flags & PART_FINGERS ) strcat(buf, " fingers"); + if (part_flags & PART_EAR ) strcat(buf, " ears"); + if (part_flags & PART_EYE ) strcat(buf, " eyes"); + if (part_flags & PART_LONG_TONGUE ) strcat(buf, " long_tongue"); + if (part_flags & PART_EYESTALKS ) strcat(buf, " eyestalks"); + if (part_flags & PART_TENTACLES ) strcat(buf, " tentacles"); + if (part_flags & PART_FINS ) strcat(buf, " fins"); + if (part_flags & PART_WINGS ) strcat(buf, " wings"); + if (part_flags & PART_TAIL ) strcat(buf, " tail"); + if (part_flags & PART_CLAWS ) strcat(buf, " claws"); + if (part_flags & PART_FANGS ) strcat(buf, " fangs"); + if (part_flags & PART_HORNS ) strcat(buf, " horns"); + if (part_flags & PART_SCALES ) strcat(buf, " scales"); + + return ( buf[0] != '\0' ) ? buf+1 : "none"; +} + +char *weapon_bit_name(int weapon_flags) +{ + static char buf[512]; + + buf[0] = '\0'; + if (weapon_flags & WEAPON_FLAMING ) strcat(buf, " flaming"); + if (weapon_flags & WEAPON_FROST ) strcat(buf, " frost"); + if (weapon_flags & WEAPON_VAMPIRIC ) strcat(buf, " vampiric"); + if (weapon_flags & WEAPON_SHARP ) strcat(buf, " sharp"); + if (weapon_flags & WEAPON_VORPAL ) strcat(buf, " vorpal"); + if (weapon_flags & WEAPON_TWO_HANDS ) strcat(buf, " two-handed"); + if (weapon_flags & WEAPON_SHOCKING ) strcat(buf, " shocking"); + if (weapon_flags & WEAPON_POISON ) strcat(buf, " poison"); + + return ( buf[0] != '\0' ) ? buf+1 : "none"; +} + +char *cont_bit_name( int cont_flags) +{ + static char buf[512]; + + buf[0] = '\0'; + + if (cont_flags & CONT_CLOSEABLE ) strcat(buf, " closable"); + if (cont_flags & CONT_PICKPROOF ) strcat(buf, " pickproof"); + if (cont_flags & CONT_CLOSED ) strcat(buf, " closed"); + if (cont_flags & CONT_LOCKED ) strcat(buf, " locked"); + + return (buf[0] != '\0' ) ? buf+1 : "none"; +} + + +char *off_bit_name(int off_flags) +{ + static char buf[512]; + + buf[0] = '\0'; + + if (off_flags & OFF_AREA_ATTACK ) strcat(buf, " area attack"); + if (off_flags & OFF_BACKSTAB ) strcat(buf, " backstab"); + if (off_flags & OFF_BASH ) strcat(buf, " bash"); + if (off_flags & OFF_BERSERK ) strcat(buf, " berserk"); + if (off_flags & OFF_DISARM ) strcat(buf, " disarm"); + if (off_flags & OFF_DODGE ) strcat(buf, " dodge"); + if (off_flags & OFF_FADE ) strcat(buf, " fade"); + if (off_flags & OFF_FAST ) strcat(buf, " fast"); + if (off_flags & OFF_KICK ) strcat(buf, " kick"); + if (off_flags & OFF_KICK_DIRT ) strcat(buf, " kick_dirt"); + if (off_flags & OFF_PARRY ) strcat(buf, " parry"); + if (off_flags & OFF_RESCUE ) strcat(buf, " rescue"); + if (off_flags & OFF_TAIL ) strcat(buf, " tail"); + if (off_flags & OFF_TRIP ) strcat(buf, " trip"); + if (off_flags & OFF_CRUSH ) strcat(buf, " crush"); + if (off_flags & ASSIST_ALL ) strcat(buf, " assist_all"); + if (off_flags & ASSIST_ALIGN ) strcat(buf, " assist_align"); + if (off_flags & ASSIST_RACE ) strcat(buf, " assist_race"); + if (off_flags & ASSIST_PLAYERS ) strcat(buf, " assist_players"); + if (off_flags & ASSIST_GUARD ) strcat(buf, " assist_guard"); + if (off_flags & ASSIST_VNUM ) strcat(buf, " assist_vnum"); + + return ( buf[0] != '\0' ) ? buf+1 : "none"; +} diff --git a/Rom24/src/healer.c b/Rom24/src/healer.c new file mode 100644 index 0000000..916e21d --- /dev/null +++ b/Rom24/src/healer.c @@ -0,0 +1,196 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +#if defined(macintosh) +#include +#include +#else +#include +#include +#endif +#include +#include +#include +#include "merc.h" +#include "magic.h" + +void do_heal(CHAR_DATA *ch, char *argument) +{ + CHAR_DATA *mob; + char arg[MAX_INPUT_LENGTH]; + int cost,sn; + SPELL_FUN *spell; + char *words; + + /* check for healer */ + for ( mob = ch->in_room->people; mob; mob = mob->next_in_room ) + { + if ( IS_NPC(mob) && IS_SET(mob->act, ACT_IS_HEALER) ) + break; + } + + if ( mob == NULL ) + { + send_to_char( "You can't do that here.\n\r", ch ); + return; + } + + one_argument(argument,arg); + + if (arg[0] == '\0') + { + /* display price list */ + act("$N says 'I offer the following spells:'",ch,NULL,mob,TO_CHAR); + send_to_char(" light: cure light wounds 10 gold\n\r",ch); + send_to_char(" serious: cure serious wounds 15 gold\n\r",ch); + send_to_char(" critic: cure critical wounds 25 gold\n\r",ch); + send_to_char(" heal: healing spell 50 gold\n\r",ch); + send_to_char(" blind: cure blindness 20 gold\n\r",ch); + send_to_char(" disease: cure disease 15 gold\n\r",ch); + send_to_char(" poison: cure poison 25 gold\n\r",ch); + send_to_char(" uncurse: remove curse 50 gold\n\r",ch); + send_to_char(" refresh: restore movement 5 gold\n\r",ch); + send_to_char(" mana: restore mana 10 gold\n\r",ch); + send_to_char(" Type heal to be healed.\n\r",ch); + return; + } + + if (!str_prefix(arg,"light")) + { + spell = spell_cure_light; + sn = skill_lookup("cure light"); + words = "judicandus dies"; + cost = 1000; + } + + else if (!str_prefix(arg,"serious")) + { + spell = spell_cure_serious; + sn = skill_lookup("cure serious"); + words = "judicandus gzfuajg"; + cost = 1600; + } + + else if (!str_prefix(arg,"critical")) + { + spell = spell_cure_critical; + sn = skill_lookup("cure critical"); + words = "judicandus qfuhuqar"; + cost = 2500; + } + + else if (!str_prefix(arg,"heal")) + { + spell = spell_heal; + sn = skill_lookup("heal"); + words = "pzar"; + cost = 5000; + } + + else if (!str_prefix(arg,"blindness")) + { + spell = spell_cure_blindness; + sn = skill_lookup("cure blindness"); + words = "judicandus noselacri"; + cost = 2000; + } + + else if (!str_prefix(arg,"disease")) + { + spell = spell_cure_disease; + sn = skill_lookup("cure disease"); + words = "judicandus eugzagz"; + cost = 1500; + } + + else if (!str_prefix(arg,"poison")) + { + spell = spell_cure_poison; + sn = skill_lookup("cure poison"); + words = "judicandus sausabru"; + cost = 2500; + } + + else if (!str_prefix(arg,"uncurse") || !str_prefix(arg,"curse")) + { + spell = spell_remove_curse; + sn = skill_lookup("remove curse"); + words = "candussido judifgz"; + cost = 5000; + } + + else if (!str_prefix(arg,"mana") || !str_prefix(arg,"energize")) + { + spell = NULL; + sn = -1; + words = "energizer"; + cost = 1000; + } + + + else if (!str_prefix(arg,"refresh") || !str_prefix(arg,"moves")) + { + spell = spell_refresh; + sn = skill_lookup("refresh"); + words = "candusima"; + cost = 500; + } + + else + { + act("$N says 'Type 'heal' for a list of spells.'", + ch,NULL,mob,TO_CHAR); + return; + } + + if (cost > (ch->gold * 100 + ch->silver)) + { + act("$N says 'You do not have enough gold for my services.'", + ch,NULL,mob,TO_CHAR); + return; + } + + WAIT_STATE(ch,PULSE_VIOLENCE); + + deduct_cost(ch,cost); + mob->gold += cost / 100; + mob->silver += cost % 100; + act("$n utters the words '$T'.",mob,NULL,words,TO_ROOM); + + if (spell == NULL) /* restore mana trap...kinda hackish */ + { + ch->mana += dice(2,8) + mob->level / 3; + ch->mana = UMIN(ch->mana,ch->max_mana); + send_to_char("A warm glow passes through you.\n\r",ch); + return; + } + + if (sn == -1) + return; + + spell(sn,mob->level,mob,ch,TARGET_CHAR); +} diff --git a/Rom24/src/interp.c b/Rom24/src/interp.c new file mode 100644 index 0000000..61b295c --- /dev/null +++ b/Rom24/src/interp.c @@ -0,0 +1,796 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +#if defined(macintosh) +#include +#else +#include +#endif +#include +#include +#include +#include +#include +#include "merc.h" +#include "interp.h" + + +bool check_social args( ( CHAR_DATA *ch, char *command, + char *argument ) ); + +/* + * Command logging types. + */ +#define LOG_NORMAL 0 +#define LOG_ALWAYS 1 +#define LOG_NEVER 2 + + + +/* + * Log-all switch. + */ +bool fLogAll = FALSE; + + + +/* + * Command table. + */ +const struct cmd_type cmd_table [] = +{ + /* + * Common movement commands. + */ + { "north", do_north, POS_STANDING, 0, LOG_NEVER, 0 }, + { "east", do_east, POS_STANDING, 0, LOG_NEVER, 0 }, + { "south", do_south, POS_STANDING, 0, LOG_NEVER, 0 }, + { "west", do_west, POS_STANDING, 0, LOG_NEVER, 0 }, + { "up", do_up, POS_STANDING, 0, LOG_NEVER, 0 }, + { "down", do_down, POS_STANDING, 0, LOG_NEVER, 0 }, + + /* + * Common other commands. + * Placed here so one and two letter abbreviations work. + */ + { "at", do_at, POS_DEAD, L6, LOG_NORMAL, 1 }, + { "cast", do_cast, POS_FIGHTING, 0, LOG_NORMAL, 1 }, + { "auction", do_auction, POS_SLEEPING, 0, LOG_NORMAL, 1 }, + { "buy", do_buy, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "channels", do_channels, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "exits", do_exits, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "get", do_get, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "goto", do_goto, POS_DEAD, L8, LOG_NORMAL, 1 }, + { "group", do_group, POS_SLEEPING, 0, LOG_NORMAL, 1 }, + { "guild", do_guild, POS_DEAD, L4, LOG_ALWAYS, 1 }, + { "hit", do_kill, POS_FIGHTING, 0, LOG_NORMAL, 0 }, + { "inventory", do_inventory, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "kill", do_kill, POS_FIGHTING, 0, LOG_NORMAL, 1 }, + { "look", do_look, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "clan", do_clantalk, POS_SLEEPING, 0, LOG_NORMAL, 1 }, + { "music", do_music, POS_SLEEPING, 0, LOG_NORMAL, 1 }, + { "order", do_order, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "practice", do_practice, POS_SLEEPING, 0, LOG_NORMAL, 1 }, + { "rest", do_rest, POS_SLEEPING, 0, LOG_NORMAL, 1 }, + { "sit", do_sit, POS_SLEEPING, 0, LOG_NORMAL, 1 }, + { "sockets", do_sockets, POS_DEAD, L4, LOG_NORMAL, 1 }, + { "stand", do_stand, POS_SLEEPING, 0, LOG_NORMAL, 1 }, + { "tell", do_tell, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "unlock", do_unlock, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "wield", do_wear, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "wizhelp", do_wizhelp, POS_DEAD, IM, LOG_NORMAL, 1 }, + + /* + * Informational commands. + */ + { "affects", do_affects, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "areas", do_areas, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "bug", do_bug, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "changes", do_changes, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "commands", do_commands, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "compare", do_compare, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "consider", do_consider, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "count", do_count, POS_SLEEPING, 0, LOG_NORMAL, 1 }, + { "credits", do_credits, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "equipment", do_equipment, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "examine", do_examine, POS_RESTING, 0, LOG_NORMAL, 1 }, +/* { "groups", do_groups, POS_SLEEPING, 0, LOG_NORMAL, 1 }, */ + { "help", do_help, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "idea", do_idea, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "info", do_groups, POS_SLEEPING, 0, LOG_NORMAL, 1 }, + { "motd", do_motd, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "news", do_news, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "read", do_read, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "report", do_report, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "rules", do_rules, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "score", do_score, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "skills", do_skills, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "socials", do_socials, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "show", do_show, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "spells", do_spells, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "story", do_story, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "time", do_time, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "typo", do_typo, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "weather", do_weather, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "who", do_who, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "whois", do_whois, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "wizlist", do_wizlist, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "worth", do_worth, POS_SLEEPING, 0, LOG_NORMAL, 1 }, + + /* + * Configuration commands. + */ + { "alia", do_alia, POS_DEAD, 0, LOG_NORMAL, 0 }, + { "alias", do_alias, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "autolist", do_autolist, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "autoassist", do_autoassist, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "autoexit", do_autoexit, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "autogold", do_autogold, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "autoloot", do_autoloot, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "autosac", do_autosac, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "autosplit", do_autosplit, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "brief", do_brief, POS_DEAD, 0, LOG_NORMAL, 1 }, +/* { "channels", do_channels, POS_DEAD, 0, LOG_NORMAL, 1 }, */ + { "combine", do_combine, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "compact", do_compact, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "description", do_description, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "delet", do_delet, POS_DEAD, 0, LOG_ALWAYS, 0 }, + { "delete", do_delete, POS_STANDING, 0, LOG_ALWAYS, 1 }, + { "nofollow", do_nofollow, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "noloot", do_noloot, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "nosummon", do_nosummon, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "outfit", do_outfit, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "password", do_password, POS_DEAD, 0, LOG_NEVER, 1 }, + { "prompt", do_prompt, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "scroll", do_scroll, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "title", do_title, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "unalias", do_unalias, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "wimpy", do_wimpy, POS_DEAD, 0, LOG_NORMAL, 1 }, + + /* + * Communication commands. + */ + { "afk", do_afk, POS_SLEEPING, 0, LOG_NORMAL, 1 }, + { "answer", do_answer, POS_SLEEPING, 0, LOG_NORMAL, 1 }, +/* { "auction", do_auction, POS_SLEEPING, 0, LOG_NORMAL, 1 }, */ + { "deaf", do_deaf, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "emote", do_emote, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "pmote", do_pmote, POS_RESTING, 0, LOG_NORMAL, 1 }, + { ".", do_gossip, POS_SLEEPING, 0, LOG_NORMAL, 0 }, + { "gossip", do_gossip, POS_SLEEPING, 0, LOG_NORMAL, 1 }, + { ",", do_emote, POS_RESTING, 0, LOG_NORMAL, 0 }, + { "grats", do_grats, POS_SLEEPING, 0, LOG_NORMAL, 1 }, + { "gtell", do_gtell, POS_DEAD, 0, LOG_NORMAL, 1 }, + { ";", do_gtell, POS_DEAD, 0, LOG_NORMAL, 0 }, +/* { "music", do_music, POS_SLEEPING, 0, LOG_NORMAL, 1 }, */ + { "note", do_note, POS_SLEEPING, 0, LOG_NORMAL, 1 }, + { "pose", do_pose, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "question", do_question, POS_SLEEPING, 0, LOG_NORMAL, 1 }, + { "quote", do_quote, POS_SLEEPING, 0, LOG_NORMAL, 1 }, + { "quiet", do_quiet, POS_SLEEPING, 0, LOG_NORMAL, 1 }, + { "reply", do_reply, POS_SLEEPING, 0, LOG_NORMAL, 1 }, + { "replay", do_replay, POS_SLEEPING, 0, LOG_NORMAL, 1 }, + { "say", do_say, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "'", do_say, POS_RESTING, 0, LOG_NORMAL, 0 }, + { "shout", do_shout, POS_RESTING, 3, LOG_NORMAL, 1 }, + { "unread", do_unread, POS_SLEEPING, 0, LOG_NORMAL, 1 }, + { "yell", do_yell, POS_RESTING, 0, LOG_NORMAL, 1 }, + + /* + * Object manipulation commands. + */ + { "brandish", do_brandish, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "close", do_close, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "drink", do_drink, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "drop", do_drop, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "eat", do_eat, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "envenom", do_envenom, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "fill", do_fill, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "give", do_give, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "heal", do_heal, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "hold", do_wear, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "list", do_list, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "lock", do_lock, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "open", do_open, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "pick", do_pick, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "pour", do_pour, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "put", do_put, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "quaff", do_quaff, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "recite", do_recite, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "remove", do_remove, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "sell", do_sell, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "take", do_get, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "sacrifice", do_sacrifice, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "junk", do_sacrifice, POS_RESTING, 0, LOG_NORMAL, 0 }, + { "tap", do_sacrifice, POS_RESTING, 0, LOG_NORMAL, 0 }, +/* { "unlock", do_unlock, POS_RESTING, 0, LOG_NORMAL, 1 }, */ + { "value", do_value, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "wear", do_wear, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "zap", do_zap, POS_RESTING, 0, LOG_NORMAL, 1 }, + + /* + * Combat commands. + */ + { "backstab", do_backstab, POS_FIGHTING, 0, LOG_NORMAL, 1 }, + { "bash", do_bash, POS_FIGHTING, 0, LOG_NORMAL, 1 }, + { "bs", do_backstab, POS_FIGHTING, 0, LOG_NORMAL, 0 }, + { "berserk", do_berserk, POS_FIGHTING, 0, LOG_NORMAL, 1 }, + { "dirt", do_dirt, POS_FIGHTING, 0, LOG_NORMAL, 1 }, + { "disarm", do_disarm, POS_FIGHTING, 0, LOG_NORMAL, 1 }, + { "flee", do_flee, POS_FIGHTING, 0, LOG_NORMAL, 1 }, + { "kick", do_kick, POS_FIGHTING, 0, LOG_NORMAL, 1 }, + { "murde", do_murde, POS_FIGHTING, 0, LOG_NORMAL, 0 }, + { "murder", do_murder, POS_FIGHTING, 5, LOG_ALWAYS, 1 }, + { "rescue", do_rescue, POS_FIGHTING, 0, LOG_NORMAL, 0 }, + { "trip", do_trip, POS_FIGHTING, 0, LOG_NORMAL, 1 }, + + /* + * Miscellaneous commands. + */ + { "enter", do_enter, POS_STANDING, 0, LOG_NORMAL, 1 }, + { "follow", do_follow, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "gain", do_gain, POS_STANDING, 0, LOG_NORMAL, 1 }, + { "go", do_enter, POS_STANDING, 0, LOG_NORMAL, 0 }, +/* { "group", do_group, POS_SLEEPING, 0, LOG_NORMAL, 1 }, */ + { "groups", do_groups, POS_SLEEPING, 0, LOG_NORMAL, 1 }, + { "hide", do_hide, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "play", do_play, POS_RESTING, 0, LOG_NORMAL, 1 }, +/* { "practice", do_practice, POS_SLEEPING, 0, LOG_NORMAL, 1 }, */ + { "qui", do_qui, POS_DEAD, 0, LOG_NORMAL, 0 }, + { "quit", do_quit, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "recall", do_recall, POS_FIGHTING, 0, LOG_NORMAL, 1 }, + { "/", do_recall, POS_FIGHTING, 0, LOG_NORMAL, 0 }, + { "rent", do_rent, POS_DEAD, 0, LOG_NORMAL, 0 }, + { "save", do_save, POS_DEAD, 0, LOG_NORMAL, 1 }, + { "sleep", do_sleep, POS_SLEEPING, 0, LOG_NORMAL, 1 }, + { "sneak", do_sneak, POS_STANDING, 0, LOG_NORMAL, 1 }, + { "split", do_split, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "steal", do_steal, POS_STANDING, 0, LOG_NORMAL, 1 }, + { "train", do_train, POS_RESTING, 0, LOG_NORMAL, 1 }, + { "visible", do_visible, POS_SLEEPING, 0, LOG_NORMAL, 1 }, + { "wake", do_wake, POS_SLEEPING, 0, LOG_NORMAL, 1 }, + { "where", do_where, POS_RESTING, 0, LOG_NORMAL, 1 }, + + + + /* + * Immortal commands. + */ + { "advance", do_advance, POS_DEAD, ML, LOG_ALWAYS, 1 }, + { "dump", do_dump, POS_DEAD, ML, LOG_ALWAYS, 0 }, + { "trust", do_trust, POS_DEAD, ML, LOG_ALWAYS, 1 }, + { "violate", do_violate, POS_DEAD, ML, LOG_ALWAYS, 1 }, + + { "allow", do_allow, POS_DEAD, L2, LOG_ALWAYS, 1 }, + { "ban", do_ban, POS_DEAD, L2, LOG_ALWAYS, 1 }, + { "deny", do_deny, POS_DEAD, L1, LOG_ALWAYS, 1 }, + { "disconnect", do_disconnect, POS_DEAD, L3, LOG_ALWAYS, 1 }, + { "flag", do_flag, POS_DEAD, L4, LOG_ALWAYS, 1 }, + { "freeze", do_freeze, POS_DEAD, L4, LOG_ALWAYS, 1 }, + { "permban", do_permban, POS_DEAD, L1, LOG_ALWAYS, 1 }, + { "protect", do_protect, POS_DEAD, L1, LOG_ALWAYS, 1 }, + { "reboo", do_reboo, POS_DEAD, L1, LOG_NORMAL, 0 }, + { "reboot", do_reboot, POS_DEAD, L1, LOG_ALWAYS, 1 }, + { "set", do_set, POS_DEAD, L2, LOG_ALWAYS, 1 }, + { "shutdow", do_shutdow, POS_DEAD, L1, LOG_NORMAL, 0 }, + { "shutdown", do_shutdown, POS_DEAD, L1, LOG_ALWAYS, 1 }, +/* { "sockets", do_sockets, POS_DEAD, L4, LOG_NORMAL, 1 }, */ + { "wizlock", do_wizlock, POS_DEAD, L2, LOG_ALWAYS, 1 }, + + { "force", do_force, POS_DEAD, L7, LOG_ALWAYS, 1 }, + { "load", do_load, POS_DEAD, L4, LOG_ALWAYS, 1 }, + { "newlock", do_newlock, POS_DEAD, L4, LOG_ALWAYS, 1 }, + { "nochannels", do_nochannels, POS_DEAD, L5, LOG_ALWAYS, 1 }, + { "noemote", do_noemote, POS_DEAD, L5, LOG_ALWAYS, 1 }, + { "noshout", do_noshout, POS_DEAD, L5, LOG_ALWAYS, 1 }, + { "notell", do_notell, POS_DEAD, L5, LOG_ALWAYS, 1 }, + { "pecho", do_pecho, POS_DEAD, L4, LOG_ALWAYS, 1 }, + { "pardon", do_pardon, POS_DEAD, L3, LOG_ALWAYS, 1 }, + { "purge", do_purge, POS_DEAD, L4, LOG_ALWAYS, 1 }, + { "restore", do_restore, POS_DEAD, L4, LOG_ALWAYS, 1 }, + { "sla", do_sla, POS_DEAD, L3, LOG_NORMAL, 0 }, + { "slay", do_slay, POS_DEAD, L3, LOG_ALWAYS, 1 }, + { "teleport", do_transfer, POS_DEAD, L5, LOG_ALWAYS, 1 }, + { "transfer", do_transfer, POS_DEAD, L5, LOG_ALWAYS, 1 }, + +/* { "at", do_at, POS_DEAD, L6, LOG_NORMAL, 1 }, */ + { "poofin", do_bamfin, POS_DEAD, L8, LOG_NORMAL, 1 }, + { "poofout", do_bamfout, POS_DEAD, L8, LOG_NORMAL, 1 }, + { "gecho", do_echo, POS_DEAD, L4, LOG_ALWAYS, 1 }, +/* { "goto", do_goto, POS_DEAD, L8, LOG_NORMAL, 1 }, */ + { "holylight", do_holylight, POS_DEAD, IM, LOG_NORMAL, 1 }, + { "incognito", do_incognito, POS_DEAD, IM, LOG_NORMAL, 1 }, + { "invis", do_invis, POS_DEAD, IM, LOG_NORMAL, 0 }, + { "log", do_log, POS_DEAD, L1, LOG_ALWAYS, 1 }, + { "memory", do_memory, POS_DEAD, IM, LOG_NORMAL, 1 }, + { "mwhere", do_mwhere, POS_DEAD, IM, LOG_NORMAL, 1 }, + { "owhere", do_owhere, POS_DEAD, IM, LOG_NORMAL, 1 }, + { "peace", do_peace, POS_DEAD, L5, LOG_NORMAL, 1 }, + { "penalty", do_penalty, POS_DEAD, L7, LOG_NORMAL, 1 }, + { "echo", do_recho, POS_DEAD, L6, LOG_ALWAYS, 1 }, + { "return", do_return, POS_DEAD, L6, LOG_NORMAL, 1 }, + { "snoop", do_snoop, POS_DEAD, L5, LOG_ALWAYS, 1 }, + { "stat", do_stat, POS_DEAD, IM, LOG_NORMAL, 1 }, + { "string", do_string, POS_DEAD, L5, LOG_ALWAYS, 1 }, + { "switch", do_switch, POS_DEAD, L6, LOG_ALWAYS, 1 }, + { "wizinvis", do_invis, POS_DEAD, IM, LOG_NORMAL, 1 }, + { "vnum", do_vnum, POS_DEAD, L4, LOG_NORMAL, 1 }, + { "zecho", do_zecho, POS_DEAD, L4, LOG_ALWAYS, 1 }, + + { "clone", do_clone, POS_DEAD, L5, LOG_ALWAYS, 1 }, + + { "wiznet", do_wiznet, POS_DEAD, IM, LOG_NORMAL, 1 }, + { "immtalk", do_immtalk, POS_DEAD, IM, LOG_NORMAL, 1 }, + { "imotd", do_imotd, POS_DEAD, IM, LOG_NORMAL, 1 }, + { ":", do_immtalk, POS_DEAD, IM, LOG_NORMAL, 0 }, + { "smote", do_smote, POS_DEAD, IM, LOG_NORMAL, 1 }, + { "prefi", do_prefi, POS_DEAD, IM, LOG_NORMAL, 0 }, + { "prefix", do_prefix, POS_DEAD, IM, LOG_NORMAL, 1 }, + + /* + * End of list. + */ + { "", 0, POS_DEAD, 0, LOG_NORMAL, 0 } +}; + + + + +/* + * The main entry point for executing commands. + * Can be recursively called from 'at', 'order', 'force'. + */ +void interpret( CHAR_DATA *ch, char *argument ) +{ + char command[MAX_INPUT_LENGTH]; + char logline[MAX_INPUT_LENGTH]; + int cmd; + int trust; + bool found; + + /* + * Strip leading spaces. + */ + while ( isspace(*argument) ) + argument++; + if ( argument[0] == '\0' ) + return; + + /* + * No hiding. + */ + REMOVE_BIT( ch->affected_by, AFF_HIDE ); + + /* + * Implement freeze command. + */ + if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_FREEZE) ) + { + send_to_char( "You're totally frozen!\n\r", ch ); + return; + } + + /* + * Grab the command word. + * Special parsing so ' can be a command, + * also no spaces needed after punctuation. + */ + strcpy( logline, argument ); + if ( !isalpha(argument[0]) && !isdigit(argument[0]) ) + { + command[0] = argument[0]; + command[1] = '\0'; + argument++; + while ( isspace(*argument) ) + argument++; + } + else + { + argument = one_argument( argument, command ); + } + + /* + * Look for command in command table. + */ + found = FALSE; + trust = get_trust( ch ); + for ( cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++ ) + { + if ( command[0] == cmd_table[cmd].name[0] + && !str_prefix( command, cmd_table[cmd].name ) + && cmd_table[cmd].level <= trust ) + { + found = TRUE; + break; + } + } + + /* + * Log and snoop. + */ + if ( cmd_table[cmd].log == LOG_NEVER ) + strcpy( logline, "" ); + + if ( ( !IS_NPC(ch) && IS_SET(ch->act, PLR_LOG) ) + || fLogAll + || cmd_table[cmd].log == LOG_ALWAYS ) + { + sprintf( log_buf, "Log %s: %s", ch->name, logline ); + wiznet(log_buf,ch,NULL,WIZ_SECURE,0,get_trust(ch)); + log_string( log_buf ); + } + + if ( ch->desc != NULL && ch->desc->snoop_by != NULL ) + { + write_to_buffer( ch->desc->snoop_by, "% ", 2 ); + write_to_buffer( ch->desc->snoop_by, logline, 0 ); + write_to_buffer( ch->desc->snoop_by, "\n\r", 2 ); + } + + if ( !found ) + { + /* + * Look for command in socials table. + */ + if ( !check_social( ch, command, argument ) ) + send_to_char( "Huh?\n\r", ch ); + return; + } + + /* + * Character not in position for command? + */ + if ( ch->position < cmd_table[cmd].position ) + { + switch( ch->position ) + { + case POS_DEAD: + send_to_char( "Lie still; you are DEAD.\n\r", ch ); + break; + + case POS_MORTAL: + case POS_INCAP: + send_to_char( "You are hurt far too bad for that.\n\r", ch ); + break; + + case POS_STUNNED: + send_to_char( "You are too stunned to do that.\n\r", ch ); + break; + + case POS_SLEEPING: + send_to_char( "In your dreams, or what?\n\r", ch ); + break; + + case POS_RESTING: + send_to_char( "Nah... You feel too relaxed...\n\r", ch); + break; + + case POS_SITTING: + send_to_char( "Better stand up first.\n\r",ch); + break; + + case POS_FIGHTING: + send_to_char( "No way! You are still fighting!\n\r", ch); + break; + + } + return; + } + + /* + * Dispatch the command. + */ + (*cmd_table[cmd].do_fun) ( ch, argument ); + + tail_chain( ); + return; +} + +/* function to keep argument safe in all commands -- no static strings */ +void do_function (CHAR_DATA *ch, DO_FUN *do_fun, char *argument) +{ + char *command_string; + + /* copy the string */ + command_string = str_dup(argument); + + /* dispatch the command */ + (*do_fun) (ch, command_string); + + /* free the string */ + free_string(command_string); +} + +bool check_social( CHAR_DATA *ch, char *command, char *argument ) +{ + char arg[MAX_INPUT_LENGTH]; + CHAR_DATA *victim; + int cmd; + bool found; + + found = FALSE; + for ( cmd = 0; social_table[cmd].name[0] != '\0'; cmd++ ) + { + if ( command[0] == social_table[cmd].name[0] + && !str_prefix( command, social_table[cmd].name ) ) + { + found = TRUE; + break; + } + } + + if ( !found ) + return FALSE; + + if ( !IS_NPC(ch) && IS_SET(ch->comm, COMM_NOEMOTE) ) + { + send_to_char( "You are anti-social!\n\r", ch ); + return TRUE; + } + + switch ( ch->position ) + { + case POS_DEAD: + send_to_char( "Lie still; you are DEAD.\n\r", ch ); + return TRUE; + + case POS_INCAP: + case POS_MORTAL: + send_to_char( "You are hurt far too bad for that.\n\r", ch ); + return TRUE; + + case POS_STUNNED: + send_to_char( "You are too stunned to do that.\n\r", ch ); + return TRUE; + + case POS_SLEEPING: + /* + * I just know this is the path to a 12" 'if' statement. :( + * But two players asked for it already! -- Furey + */ + if ( !str_cmp( social_table[cmd].name, "snore" ) ) + break; + send_to_char( "In your dreams, or what?\n\r", ch ); + return TRUE; + + } + + one_argument( argument, arg ); + victim = NULL; + if ( arg[0] == '\0' ) + { + act( social_table[cmd].others_no_arg, ch, NULL, victim, TO_ROOM ); + act( social_table[cmd].char_no_arg, ch, NULL, victim, TO_CHAR ); + } + else if ( ( victim = get_char_room( ch, arg ) ) == NULL ) + { + send_to_char( "They aren't here.\n\r", ch ); + } + else if ( victim == ch ) + { + act( social_table[cmd].others_auto, ch, NULL, victim, TO_ROOM ); + act( social_table[cmd].char_auto, ch, NULL, victim, TO_CHAR ); + } + else + { + act( social_table[cmd].others_found, ch, NULL, victim, TO_NOTVICT ); + act( social_table[cmd].char_found, ch, NULL, victim, TO_CHAR ); + act( social_table[cmd].vict_found, ch, NULL, victim, TO_VICT ); + + if ( !IS_NPC(ch) && IS_NPC(victim) + && !IS_AFFECTED(victim, AFF_CHARM) + && IS_AWAKE(victim) + && victim->desc == NULL) + { + switch ( number_bits( 4 ) ) + { + case 0: + + case 1: case 2: case 3: case 4: + case 5: case 6: case 7: case 8: + act( social_table[cmd].others_found, + victim, NULL, ch, TO_NOTVICT ); + act( social_table[cmd].char_found, + victim, NULL, ch, TO_CHAR ); + act( social_table[cmd].vict_found, + victim, NULL, ch, TO_VICT ); + break; + + case 9: case 10: case 11: case 12: + act( "$n slaps $N.", victim, NULL, ch, TO_NOTVICT ); + act( "You slap $N.", victim, NULL, ch, TO_CHAR ); + act( "$n slaps you.", victim, NULL, ch, TO_VICT ); + break; + } + } + } + + return TRUE; +} + + + +/* + * Return true if an argument is completely numeric. + */ +bool is_number ( char *arg ) +{ + + if ( *arg == '\0' ) + return FALSE; + + if ( *arg == '+' || *arg == '-' ) + arg++; + + for ( ; *arg != '\0'; arg++ ) + { + if ( !isdigit( *arg ) ) + return FALSE; + } + + return TRUE; +} + + + +/* + * Given a string like 14.foo, return 14 and 'foo' + */ +int number_argument( char *argument, char *arg ) +{ + char *pdot; + int number; + + for ( pdot = argument; *pdot != '\0'; pdot++ ) + { + if ( *pdot == '.' ) + { + *pdot = '\0'; + number = atoi( argument ); + *pdot = '.'; + strcpy( arg, pdot+1 ); + return number; + } + } + + strcpy( arg, argument ); + return 1; +} + +/* + * Given a string like 14*foo, return 14 and 'foo' +*/ +int mult_argument(char *argument, char *arg) +{ + char *pdot; + int number; + + for ( pdot = argument; *pdot != '\0'; pdot++ ) + { + if ( *pdot == '*' ) + { + *pdot = '\0'; + number = atoi( argument ); + *pdot = '*'; + strcpy( arg, pdot+1 ); + return number; + } + } + + strcpy( arg, argument ); + return 1; +} + + + +/* + * Pick off one argument from a string and return the rest. + * Understands quotes. + */ +char *one_argument( char *argument, char *arg_first ) +{ + char cEnd; + + while ( isspace(*argument) ) + argument++; + + cEnd = ' '; + if ( *argument == '\'' || *argument == '"' ) + cEnd = *argument++; + + while ( *argument != '\0' ) + { + if ( *argument == cEnd ) + { + argument++; + break; + } + *arg_first = LOWER(*argument); + arg_first++; + argument++; + } + *arg_first = '\0'; + + while ( isspace(*argument) ) + argument++; + + return argument; +} + +/* + * Contributed by Alander. + */ +void do_commands( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + int cmd; + int col; + + col = 0; + for ( cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++ ) + { + if ( cmd_table[cmd].level < LEVEL_HERO + && cmd_table[cmd].level <= get_trust( ch ) + && cmd_table[cmd].show) + { + sprintf( buf, "%-12s", cmd_table[cmd].name ); + send_to_char( buf, ch ); + if ( ++col % 6 == 0 ) + send_to_char( "\n\r", ch ); + } + } + + if ( col % 6 != 0 ) + send_to_char( "\n\r", ch ); + return; +} + +void do_wizhelp( CHAR_DATA *ch, char *argument ) +{ + char buf[MAX_STRING_LENGTH]; + int cmd; + int col; + + col = 0; + for ( cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++ ) + { + if ( cmd_table[cmd].level >= LEVEL_HERO + && cmd_table[cmd].level <= get_trust( ch ) + && cmd_table[cmd].show) + { + sprintf( buf, "%-12s", cmd_table[cmd].name ); + send_to_char( buf, ch ); + if ( ++col % 6 == 0 ) + send_to_char( "\n\r", ch ); + } + } + + if ( col % 6 != 0 ) + send_to_char( "\n\r", ch ); + return; +} + diff --git a/Rom24/src/interp.h b/Rom24/src/interp.h new file mode 100644 index 0000000..f731669 --- /dev/null +++ b/Rom24/src/interp.h @@ -0,0 +1,298 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +/* this is a listing of all the commands and command related data */ + +/* wrapper function for safe command execution */ +void do_function args((CHAR_DATA *ch, DO_FUN *do_fun, char *argument)); + +/* for command types */ +#define ML MAX_LEVEL /* implementor */ +#define L1 MAX_LEVEL - 1 /* creator */ +#define L2 MAX_LEVEL - 2 /* supreme being */ +#define L3 MAX_LEVEL - 3 /* deity */ +#define L4 MAX_LEVEL - 4 /* god */ +#define L5 MAX_LEVEL - 5 /* immortal */ +#define L6 MAX_LEVEL - 6 /* demigod */ +#define L7 MAX_LEVEL - 7 /* angel */ +#define L8 MAX_LEVEL - 8 /* avatar */ +#define IM LEVEL_IMMORTAL /* avatar */ +#define HE LEVEL_HERO /* hero */ + +#define COM_INGORE 1 + + +/* + * Structure for a command in the command lookup table. + */ +struct cmd_type +{ + char * const name; + DO_FUN * do_fun; + sh_int position; + sh_int level; + sh_int log; + sh_int show; +}; + +/* the command table itself */ +extern const struct cmd_type cmd_table []; + +/* + * Command functions. + * Defined in act_*.c (mostly). + */ +DECLARE_DO_FUN( do_advance ); +DECLARE_DO_FUN( do_affects ); +DECLARE_DO_FUN( do_afk ); +DECLARE_DO_FUN( do_alia ); +DECLARE_DO_FUN( do_alias ); +DECLARE_DO_FUN( do_allow ); +DECLARE_DO_FUN( do_answer ); +DECLARE_DO_FUN( do_areas ); +DECLARE_DO_FUN( do_at ); +DECLARE_DO_FUN( do_auction ); +DECLARE_DO_FUN( do_autoassist ); +DECLARE_DO_FUN( do_autoexit ); +DECLARE_DO_FUN( do_autogold ); +DECLARE_DO_FUN( do_autolist ); +DECLARE_DO_FUN( do_autoloot ); +DECLARE_DO_FUN( do_autosac ); +DECLARE_DO_FUN( do_autosplit ); +DECLARE_DO_FUN( do_backstab ); +DECLARE_DO_FUN( do_bamfin ); +DECLARE_DO_FUN( do_bamfout ); +DECLARE_DO_FUN( do_ban ); +DECLARE_DO_FUN( do_bash ); +DECLARE_DO_FUN( do_berserk ); +DECLARE_DO_FUN( do_brandish ); +DECLARE_DO_FUN( do_brief ); +DECLARE_DO_FUN( do_bug ); +DECLARE_DO_FUN( do_buy ); +DECLARE_DO_FUN( do_cast ); +DECLARE_DO_FUN( do_changes ); +DECLARE_DO_FUN( do_channels ); +DECLARE_DO_FUN( do_clone ); +DECLARE_DO_FUN( do_close ); +DECLARE_DO_FUN( do_commands ); +DECLARE_DO_FUN( do_combine ); +DECLARE_DO_FUN( do_compact ); +DECLARE_DO_FUN( do_compare ); +DECLARE_DO_FUN( do_consider ); +DECLARE_DO_FUN( do_count ); +DECLARE_DO_FUN( do_credits ); +DECLARE_DO_FUN( do_deaf ); +DECLARE_DO_FUN( do_delet ); +DECLARE_DO_FUN( do_delete ); +DECLARE_DO_FUN( do_deny ); +DECLARE_DO_FUN( do_description ); +DECLARE_DO_FUN( do_dirt ); +DECLARE_DO_FUN( do_disarm ); +DECLARE_DO_FUN( do_disconnect ); +DECLARE_DO_FUN( do_down ); +DECLARE_DO_FUN( do_drink ); +DECLARE_DO_FUN( do_drop ); +DECLARE_DO_FUN( do_dump ); +DECLARE_DO_FUN( do_east ); +DECLARE_DO_FUN( do_eat ); +DECLARE_DO_FUN( do_echo ); +DECLARE_DO_FUN( do_emote ); +DECLARE_DO_FUN( do_enter ); +DECLARE_DO_FUN( do_envenom ); +DECLARE_DO_FUN( do_equipment ); +DECLARE_DO_FUN( do_examine ); +DECLARE_DO_FUN( do_exits ); +DECLARE_DO_FUN( do_fill ); +DECLARE_DO_FUN( do_flag ); +DECLARE_DO_FUN( do_flee ); +DECLARE_DO_FUN( do_follow ); +DECLARE_DO_FUN( do_force ); +DECLARE_DO_FUN( do_freeze ); +DECLARE_DO_FUN( do_gain ); +DECLARE_DO_FUN( do_get ); +DECLARE_DO_FUN( do_give ); +DECLARE_DO_FUN( do_gossip ); +DECLARE_DO_FUN( do_goto ); +DECLARE_DO_FUN( do_grats ); +DECLARE_DO_FUN( do_group ); +DECLARE_DO_FUN( do_groups ); +DECLARE_DO_FUN( do_gtell ); +DECLARE_DO_FUN( do_guild ); +DECLARE_DO_FUN( do_heal ); +DECLARE_DO_FUN( do_help ); +DECLARE_DO_FUN( do_hide ); +DECLARE_DO_FUN( do_holylight ); +DECLARE_DO_FUN( do_idea ); +DECLARE_DO_FUN( do_immtalk ); +DECLARE_DO_FUN( do_incognito ); +DECLARE_DO_FUN( do_clantalk ); +DECLARE_DO_FUN( do_imotd ); +DECLARE_DO_FUN( do_inventory ); +DECLARE_DO_FUN( do_invis ); +DECLARE_DO_FUN( do_kick ); +DECLARE_DO_FUN( do_kill ); +DECLARE_DO_FUN( do_list ); +DECLARE_DO_FUN( do_load ); +DECLARE_DO_FUN( do_lock ); +DECLARE_DO_FUN( do_log ); +DECLARE_DO_FUN( do_look ); +DECLARE_DO_FUN( do_memory ); +DECLARE_DO_FUN( do_mfind ); +DECLARE_DO_FUN( do_mload ); +DECLARE_DO_FUN( do_mset ); +DECLARE_DO_FUN( do_mstat ); +DECLARE_DO_FUN( do_mwhere ); +DECLARE_DO_FUN( do_motd ); +DECLARE_DO_FUN( do_murde ); +DECLARE_DO_FUN( do_murder ); +DECLARE_DO_FUN( do_music ); +DECLARE_DO_FUN( do_newlock ); +DECLARE_DO_FUN( do_news ); +DECLARE_DO_FUN( do_nochannels ); +DECLARE_DO_FUN( do_noemote ); +DECLARE_DO_FUN( do_nofollow ); +DECLARE_DO_FUN( do_noloot ); +DECLARE_DO_FUN( do_north ); +DECLARE_DO_FUN( do_noshout ); +DECLARE_DO_FUN( do_nosummon ); +DECLARE_DO_FUN( do_note ); +DECLARE_DO_FUN( do_notell ); +DECLARE_DO_FUN( do_ofind ); +DECLARE_DO_FUN( do_oload ); +DECLARE_DO_FUN( do_open ); +DECLARE_DO_FUN( do_order ); +DECLARE_DO_FUN( do_oset ); +DECLARE_DO_FUN( do_ostat ); +DECLARE_DO_FUN( do_outfit ); +DECLARE_DO_FUN( do_owhere ); +DECLARE_DO_FUN( do_pardon ); +DECLARE_DO_FUN( do_password ); +DECLARE_DO_FUN( do_peace ); +DECLARE_DO_FUN( do_pecho ); +DECLARE_DO_FUN( do_penalty ); +DECLARE_DO_FUN( do_permban ); +DECLARE_DO_FUN( do_pick ); +DECLARE_DO_FUN( do_play ); +DECLARE_DO_FUN( do_pmote ); +DECLARE_DO_FUN( do_pose ); +DECLARE_DO_FUN( do_pour ); +DECLARE_DO_FUN( do_practice ); +DECLARE_DO_FUN( do_prefi ); +DECLARE_DO_FUN( do_prefix ); +DECLARE_DO_FUN( do_prompt ); +DECLARE_DO_FUN( do_protect ); +DECLARE_DO_FUN( do_purge ); +DECLARE_DO_FUN( do_put ); +DECLARE_DO_FUN( do_quaff ); +DECLARE_DO_FUN( do_question ); +DECLARE_DO_FUN( do_qui ); +DECLARE_DO_FUN( do_quiet ); +DECLARE_DO_FUN( do_quit ); +DECLARE_DO_FUN( do_quote ); +DECLARE_DO_FUN( do_read ); +DECLARE_DO_FUN( do_reboo ); +DECLARE_DO_FUN( do_reboot ); +DECLARE_DO_FUN( do_recall ); +DECLARE_DO_FUN( do_recho ); +DECLARE_DO_FUN( do_recite ); +DECLARE_DO_FUN( do_remove ); +DECLARE_DO_FUN( do_rent ); +DECLARE_DO_FUN( do_replay ); +DECLARE_DO_FUN( do_reply ); +DECLARE_DO_FUN( do_report ); +DECLARE_DO_FUN( do_rescue ); +DECLARE_DO_FUN( do_rest ); +DECLARE_DO_FUN( do_restore ); +DECLARE_DO_FUN( do_return ); +DECLARE_DO_FUN( do_rset ); +DECLARE_DO_FUN( do_rstat ); +DECLARE_DO_FUN( do_rules ); +DECLARE_DO_FUN( do_sacrifice ); +DECLARE_DO_FUN( do_save ); +DECLARE_DO_FUN( do_say ); +DECLARE_DO_FUN( do_scan ); +DECLARE_DO_FUN( do_score ); +DECLARE_DO_FUN( do_scroll ); +DECLARE_DO_FUN( do_sell ); +DECLARE_DO_FUN( do_set ); +DECLARE_DO_FUN( do_shout ); +DECLARE_DO_FUN( do_show ); +DECLARE_DO_FUN( do_shutdow ); +DECLARE_DO_FUN( do_shutdown ); +DECLARE_DO_FUN( do_sit ); +DECLARE_DO_FUN( do_skills ); +DECLARE_DO_FUN( do_sla ); +DECLARE_DO_FUN( do_slay ); +DECLARE_DO_FUN( do_sleep ); +DECLARE_DO_FUN( do_slookup ); +DECLARE_DO_FUN( do_smote ); +DECLARE_DO_FUN( do_sneak ); +DECLARE_DO_FUN( do_snoop ); +DECLARE_DO_FUN( do_socials ); +DECLARE_DO_FUN( do_south ); +DECLARE_DO_FUN( do_sockets ); +DECLARE_DO_FUN( do_spells ); +DECLARE_DO_FUN( do_split ); +DECLARE_DO_FUN( do_sset ); +DECLARE_DO_FUN( do_stand ); +DECLARE_DO_FUN( do_stat ); +DECLARE_DO_FUN( do_steal ); +DECLARE_DO_FUN( do_story ); +DECLARE_DO_FUN( do_string ); +DECLARE_DO_FUN( do_switch ); +DECLARE_DO_FUN( do_tell ); +DECLARE_DO_FUN( do_time ); +DECLARE_DO_FUN( do_title ); +DECLARE_DO_FUN( do_train ); +DECLARE_DO_FUN( do_transfer ); +DECLARE_DO_FUN( do_trip ); +DECLARE_DO_FUN( do_trust ); +DECLARE_DO_FUN( do_typo ); +DECLARE_DO_FUN( do_unalias ); +DECLARE_DO_FUN( do_unlock ); +DECLARE_DO_FUN( do_unread ); +DECLARE_DO_FUN( do_up ); +DECLARE_DO_FUN( do_value ); +DECLARE_DO_FUN( do_visible ); +DECLARE_DO_FUN( do_violate ); +DECLARE_DO_FUN( do_vnum ); +DECLARE_DO_FUN( do_wake ); +DECLARE_DO_FUN( do_wear ); +DECLARE_DO_FUN( do_weather ); +DECLARE_DO_FUN( do_west ); +DECLARE_DO_FUN( do_where ); +DECLARE_DO_FUN( do_who ); +DECLARE_DO_FUN( do_whois ); +DECLARE_DO_FUN( do_wimpy ); +DECLARE_DO_FUN( do_wizhelp ); +DECLARE_DO_FUN( do_wizlock ); +DECLARE_DO_FUN( do_wizlist ); +DECLARE_DO_FUN( do_wiznet ); +DECLARE_DO_FUN( do_worth ); +DECLARE_DO_FUN( do_yell ); +DECLARE_DO_FUN( do_zap ); +DECLARE_DO_FUN( do_zecho ); diff --git a/Rom24/src/lookup.c b/Rom24/src/lookup.c new file mode 100644 index 0000000..512b964 --- /dev/null +++ b/Rom24/src/lookup.c @@ -0,0 +1,106 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +#if defined(macintosh) +#include +#else +#include +#endif +#include +#include +#include "merc.h" +#include "tables.h" + +int flag_lookup (const char *name, const struct flag_type *flag_table) +{ + int flag; + + for (flag = 0; flag_table[flag].name != NULL; flag++) + { + if (LOWER(name[0]) == LOWER(flag_table[flag].name[0]) + && !str_prefix(name,flag_table[flag].name)) + return flag_table[flag].bit; + } + + return 0; +} + +int clan_lookup(const char *name) +{ + int clan; + + for (clan = 0; clan < MAX_CLAN; clan++) + { + if (LOWER(name[0]) == LOWER(clan_table[clan].name[0]) + && !str_prefix(name,clan_table[clan].name)) + return clan; + } + + return 0; +} + +int position_lookup (const char *name) +{ + int pos; + + for (pos = 0; position_table[pos].name != NULL; pos++) + { + if (LOWER(name[0]) == LOWER(position_table[pos].name[0]) + && !str_prefix(name,position_table[pos].name)) + return pos; + } + + return -1; +} + +int sex_lookup (const char *name) +{ + int sex; + + for (sex = 0; sex_table[sex].name != NULL; sex++) + { + if (LOWER(name[0]) == LOWER(sex_table[sex].name[0]) + && !str_prefix(name,sex_table[sex].name)) + return sex; + } + + return -1; +} + +int size_lookup (const char *name) +{ + int size; + + for ( size = 0; size_table[size].name != NULL; size++) + { + if (LOWER(name[0]) == LOWER(size_table[size].name[0]) + && !str_prefix( name,size_table[size].name)) + return size; + } + + return -1; +} diff --git a/Rom24/src/lookup.h b/Rom24/src/lookup.h new file mode 100644 index 0000000..bf43303 --- /dev/null +++ b/Rom24/src/lookup.h @@ -0,0 +1,32 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + + +int clan_lookup args( (const char *name) ); +int position_lookup args( (const char *name) ); +int sex_lookup args( (const char *name) ); +int size_lookup args( (const char *name) ); diff --git a/Rom24/src/magic.c b/Rom24/src/magic.c new file mode 100644 index 0000000..f8bfae6 --- /dev/null +++ b/Rom24/src/magic.c @@ -0,0 +1,4699 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +#if defined(macintosh) +#include +#else +#include +#endif +#include +#include +#include +#include +#include "merc.h" +#include "interp.h" +#include "magic.h" +#include "recycle.h" + +/* + * Local functions. + */ +void say_spell args( ( CHAR_DATA *ch, int sn ) ); + +/* imported functions */ +bool remove_obj args( ( CHAR_DATA *ch, int iWear, bool fReplace ) ); +void wear_obj args( ( CHAR_DATA *ch, OBJ_DATA *obj, bool fReplace ) ); + + + +/* + * Lookup a skill by name. + */ +int skill_lookup( const char *name ) +{ + int sn; + + for ( sn = 0; sn < MAX_SKILL; sn++ ) + { + if ( skill_table[sn].name == NULL ) + break; + if ( LOWER(name[0]) == LOWER(skill_table[sn].name[0]) + && !str_prefix( name, skill_table[sn].name ) ) + return sn; + } + + return -1; +} + +int find_spell( CHAR_DATA *ch, const char *name ) +{ + /* finds a spell the character can cast if possible */ + int sn, found = -1; + + if (IS_NPC(ch)) + return skill_lookup(name); + + for ( sn = 0; sn < MAX_SKILL; sn++ ) + { + if (skill_table[sn].name == NULL) + break; + if (LOWER(name[0]) == LOWER(skill_table[sn].name[0]) + && !str_prefix(name,skill_table[sn].name)) + { + if ( found == -1) + found = sn; + if (ch->level >= skill_table[sn].skill_level[ch->class] + && ch->pcdata->learned[sn] > 0) + return sn; + } + } + return found; +} + + + +/* + * Lookup a skill by slot number. + * Used for object loading. + */ +int slot_lookup( int slot ) +{ + extern bool fBootDb; + int sn; + + if ( slot <= 0 ) + return -1; + + for ( sn = 0; sn < MAX_SKILL; sn++ ) + { + if ( slot == skill_table[sn].slot ) + return sn; + } + + if ( fBootDb ) + { + bug( "Slot_lookup: bad slot %d.", slot ); + abort( ); + } + + return -1; +} + + + +/* + * Utter mystical words for an sn. + */ +void say_spell( CHAR_DATA *ch, int sn ) +{ + char buf [MAX_STRING_LENGTH]; + char buf2 [MAX_STRING_LENGTH]; + CHAR_DATA *rch; + char *pName; + int iSyl; + int length; + + struct syl_type + { + char * old; + char * new; + }; + + static const struct syl_type syl_table[] = + { + { " ", " " }, + { "ar", "abra" }, + { "au", "kada" }, + { "bless", "fido" }, + { "blind", "nose" }, + { "bur", "mosa" }, + { "cu", "judi" }, + { "de", "oculo" }, + { "en", "unso" }, + { "light", "dies" }, + { "lo", "hi" }, + { "mor", "zak" }, + { "move", "sido" }, + { "ness", "lacri" }, + { "ning", "illa" }, + { "per", "duda" }, + { "ra", "gru" }, + { "fresh", "ima" }, + { "re", "candus" }, + { "son", "sabru" }, + { "tect", "infra" }, + { "tri", "cula" }, + { "ven", "nofo" }, + { "a", "a" }, { "b", "b" }, { "c", "q" }, { "d", "e" }, + { "e", "z" }, { "f", "y" }, { "g", "o" }, { "h", "p" }, + { "i", "u" }, { "j", "y" }, { "k", "t" }, { "l", "r" }, + { "m", "w" }, { "n", "i" }, { "o", "a" }, { "p", "s" }, + { "q", "d" }, { "r", "f" }, { "s", "g" }, { "t", "h" }, + { "u", "j" }, { "v", "z" }, { "w", "x" }, { "x", "n" }, + { "y", "l" }, { "z", "k" }, + { "", "" } + }; + + buf[0] = '\0'; + for ( pName = skill_table[sn].name; *pName != '\0'; pName += length ) + { + for ( iSyl = 0; (length = strlen(syl_table[iSyl].old)) != 0; iSyl++ ) + { + if ( !str_prefix( syl_table[iSyl].old, pName ) ) + { + strcat( buf, syl_table[iSyl].new ); + break; + } + } + + if ( length == 0 ) + length = 1; + } + + sprintf( buf2, "$n utters the words, '%s'.", buf ); + sprintf( buf, "$n utters the words, '%s'.", skill_table[sn].name ); + + for ( rch = ch->in_room->people; rch; rch = rch->next_in_room ) + { + if ( rch != ch ) + act((!IS_NPC(rch) && ch->class==rch->class) ? buf : buf2, + ch, NULL, rch, TO_VICT ); + } + + return; +} + + + +/* + * Compute a saving throw. + * Negative apply's make saving throw better. + */ +bool saves_spell( int level, CHAR_DATA *victim, int dam_type ) +{ + int save; + + save = 50 + ( victim->level - level) * 5 - victim->saving_throw * 2; + if (IS_AFFECTED(victim,AFF_BERSERK)) + save += victim->level/2; + + switch(check_immune(victim,dam_type)) + { + case IS_IMMUNE: return TRUE; + case IS_RESISTANT: save += 2; break; + case IS_VULNERABLE: save -= 2; break; + } + + if (!IS_NPC(victim) && class_table[victim->class].fMana) + save = 9 * save / 10; + save = URANGE( 5, save, 95 ); + return number_percent( ) < save; +} + +/* RT save for dispels */ + +bool saves_dispel( int dis_level, int spell_level, int duration) +{ + int save; + + if (duration == -1) + spell_level += 5; + /* very hard to dispel permanent effects */ + + save = 50 + (spell_level - dis_level) * 5; + save = URANGE( 5, save, 95 ); + return number_percent( ) < save; +} + +/* co-routine for dispel magic and cancellation */ + +bool check_dispel( int dis_level, CHAR_DATA *victim, int sn) +{ + AFFECT_DATA *af; + + if (is_affected(victim, sn)) + { + for ( af = victim->affected; af != NULL; af = af->next ) + { + if ( af->type == sn ) + { + if (!saves_dispel(dis_level,af->level,af->duration)) + { + affect_strip(victim,sn); + if ( skill_table[sn].msg_off ) + { + send_to_char( skill_table[sn].msg_off, victim ); + send_to_char( "\n\r", victim ); + } + return TRUE; + } + else + af->level--; + } + } + } + return FALSE; +} + +/* for finding mana costs -- temporary version */ +int mana_cost (CHAR_DATA *ch, int min_mana, int level) +{ + if (ch->level + 2 == level) + return 1000; + return UMAX(min_mana,(100/(2 + ch->level - level))); +} + + + +/* + * The kludgy global is for spells who want more stuff from command line. + */ +char *target_name; + +void do_cast( CHAR_DATA *ch, char *argument ) +{ + char arg1[MAX_INPUT_LENGTH]; + char arg2[MAX_INPUT_LENGTH]; + CHAR_DATA *victim; + OBJ_DATA *obj; + void *vo; + int mana; + int sn; + int target; + + /* + * Switched NPC's can cast spells, but others can't. + */ + if ( IS_NPC(ch) && ch->desc == NULL) + return; + + target_name = one_argument( argument, arg1 ); + one_argument( target_name, arg2 ); + + if ( arg1[0] == '\0' ) + { + send_to_char( "Cast which what where?\n\r", ch ); + return; + } + + if ((sn = find_spell(ch,arg1)) < 1 + || skill_table[sn].spell_fun == spell_null + || (!IS_NPC(ch) && (ch->level < skill_table[sn].skill_level[ch->class] + || ch->pcdata->learned[sn] == 0))) + { + send_to_char( "You don't know any spells of that name.\n\r", ch ); + return; + } + + if ( ch->position < skill_table[sn].minimum_position ) + { + send_to_char( "You can't concentrate enough.\n\r", ch ); + return; + } + + if (ch->level + 2 == skill_table[sn].skill_level[ch->class]) + mana = 50; + else + mana = UMAX( + skill_table[sn].min_mana, + 100 / ( 2 + ch->level - skill_table[sn].skill_level[ch->class] ) ); + + /* + * Locate targets. + */ + victim = NULL; + obj = NULL; + vo = NULL; + target = TARGET_NONE; + + switch ( skill_table[sn].target ) + { + default: + bug( "Do_cast: bad target for sn %d.", sn ); + return; + + case TAR_IGNORE: + break; + + case TAR_CHAR_OFFENSIVE: + if ( arg2[0] == '\0' ) + { + if ( ( victim = ch->fighting ) == NULL ) + { + send_to_char( "Cast the spell on whom?\n\r", ch ); + return; + } + } + else + { + if ( ( victim = get_char_room( ch, target_name ) ) == NULL ) + { + send_to_char( "They aren't here.\n\r", ch ); + return; + } + } +/* + if ( ch == victim ) + { + send_to_char( "You can't do that to yourself.\n\r", ch ); + return; + } +*/ + + + if ( !IS_NPC(ch) ) + { + + if (is_safe(ch,victim) && victim != ch) + { + send_to_char("Not on that target.\n\r",ch); + return; + } + check_killer(ch,victim); + } + + if ( IS_AFFECTED(ch, AFF_CHARM) && ch->master == victim ) + { + send_to_char( "You can't do that on your own follower.\n\r", + ch ); + return; + } + + vo = (void *) victim; + target = TARGET_CHAR; + break; + + case TAR_CHAR_DEFENSIVE: + if ( arg2[0] == '\0' ) + { + victim = ch; + } + else + { + if ( ( victim = get_char_room( ch, target_name ) ) == NULL ) + { + send_to_char( "They aren't here.\n\r", ch ); + return; + } + } + + vo = (void *) victim; + target = TARGET_CHAR; + break; + + case TAR_CHAR_SELF: + if ( arg2[0] != '\0' && !is_name( target_name, ch->name ) ) + { + send_to_char( "You cannot cast this spell on another.\n\r", ch ); + return; + } + + vo = (void *) ch; + target = TARGET_CHAR; + break; + + case TAR_OBJ_INV: + if ( arg2[0] == '\0' ) + { + send_to_char( "What should the spell be cast upon?\n\r", ch ); + return; + } + + if ( ( obj = get_obj_carry( ch, target_name, ch ) ) == NULL ) + { + send_to_char( "You are not carrying that.\n\r", ch ); + return; + } + + vo = (void *) obj; + target = TARGET_OBJ; + break; + + case TAR_OBJ_CHAR_OFF: + if (arg2[0] == '\0') + { + if ((victim = ch->fighting) == NULL) + { + send_to_char("Cast the spell on whom or what?\n\r",ch); + return; + } + + target = TARGET_CHAR; + } + else if ((victim = get_char_room(ch,target_name)) != NULL) + { + target = TARGET_CHAR; + } + + if (target == TARGET_CHAR) /* check the sanity of the attack */ + { + if(is_safe_spell(ch,victim,FALSE) && victim != ch) + { + send_to_char("Not on that target.\n\r",ch); + return; + } + + if ( IS_AFFECTED(ch, AFF_CHARM) && ch->master == victim ) + { + send_to_char( "You can't do that on your own follower.\n\r", + ch ); + return; + } + + if (!IS_NPC(ch)) + check_killer(ch,victim); + + vo = (void *) victim; + } + else if ((obj = get_obj_here(ch,target_name)) != NULL) + { + vo = (void *) obj; + target = TARGET_OBJ; + } + else + { + send_to_char("You don't see that here.\n\r",ch); + return; + } + break; + + case TAR_OBJ_CHAR_DEF: + if (arg2[0] == '\0') + { + vo = (void *) ch; + target = TARGET_CHAR; + } + else if ((victim = get_char_room(ch,target_name)) != NULL) + { + vo = (void *) victim; + target = TARGET_CHAR; + } + else if ((obj = get_obj_carry(ch,target_name,ch)) != NULL) + { + vo = (void *) obj; + target = TARGET_OBJ; + } + else + { + send_to_char("You don't see that here.\n\r",ch); + return; + } + break; + } + + if ( !IS_NPC(ch) && ch->mana < mana ) + { + send_to_char( "You don't have enough mana.\n\r", ch ); + return; + } + + if ( str_cmp( skill_table[sn].name, "ventriloquate" ) ) + say_spell( ch, sn ); + + WAIT_STATE( ch, skill_table[sn].beats ); + + if ( number_percent( ) > get_skill(ch,sn) ) + { + send_to_char( "You lost your concentration.\n\r", ch ); + check_improve(ch,sn,FALSE,1); + ch->mana -= mana / 2; + } + else + { + ch->mana -= mana; + if (IS_NPC(ch) || class_table[ch->class].fMana) + /* class has spells */ + (*skill_table[sn].spell_fun) ( sn, ch->level, ch, vo,target); + else + (*skill_table[sn].spell_fun) (sn, 3 * ch->level/4, ch, vo,target); + check_improve(ch,sn,TRUE,1); + } + + if ((skill_table[sn].target == TAR_CHAR_OFFENSIVE + || (skill_table[sn].target == TAR_OBJ_CHAR_OFF && target == TARGET_CHAR)) + && victim != ch + && victim->master != ch) + { + CHAR_DATA *vch; + CHAR_DATA *vch_next; + + for ( vch = ch->in_room->people; vch; vch = vch_next ) + { + vch_next = vch->next_in_room; + if ( victim == vch && victim->fighting == NULL ) + { check_killer(victim,ch); + multi_hit( victim, ch, TYPE_UNDEFINED ); + break; + } + } + } + + return; +} + + + +/* + * Cast spells at targets using a magical object. + */ +void obj_cast_spell( int sn, int level, CHAR_DATA *ch, CHAR_DATA *victim, OBJ_DATA *obj ) +{ + void *vo; + int target = TARGET_NONE; + + if ( sn <= 0 ) + return; + + if ( sn >= MAX_SKILL || skill_table[sn].spell_fun == 0 ) + { + bug( "Obj_cast_spell: bad sn %d.", sn ); + return; + } + + switch ( skill_table[sn].target ) + { + default: + bug( "Obj_cast_spell: bad target for sn %d.", sn ); + return; + + case TAR_IGNORE: + vo = NULL; + break; + + case TAR_CHAR_OFFENSIVE: + if ( victim == NULL ) + victim = ch->fighting; + if ( victim == NULL ) + { + send_to_char( "You can't do that.\n\r", ch ); + return; + } + if (is_safe(ch,victim) && ch != victim) + { + send_to_char("Something isn't right...\n\r",ch); + return; + } + vo = (void *) victim; + target = TARGET_CHAR; + break; + + case TAR_CHAR_DEFENSIVE: + case TAR_CHAR_SELF: + if ( victim == NULL ) + victim = ch; + vo = (void *) victim; + target = TARGET_CHAR; + break; + + case TAR_OBJ_INV: + if ( obj == NULL ) + { + send_to_char( "You can't do that.\n\r", ch ); + return; + } + vo = (void *) obj; + target = TARGET_OBJ; + break; + + case TAR_OBJ_CHAR_OFF: + if ( victim == NULL && obj == NULL) + { if (ch->fighting != NULL) + victim = ch->fighting; + else + { + send_to_char("You can't do that.\n\r",ch); + return; + } + } + if (victim != NULL) + { + if (is_safe_spell(ch,victim,FALSE) && ch != victim) + { + send_to_char("Somehting isn't right...\n\r",ch); + return; + } + + vo = (void *) victim; + target = TARGET_CHAR; + } + else + { + vo = (void *) obj; + target = TARGET_OBJ; + } + break; + + + case TAR_OBJ_CHAR_DEF: + if (victim == NULL && obj == NULL) + { + vo = (void *) ch; + target = TARGET_CHAR; + } + else if (victim != NULL) + { + vo = (void *) victim; + target = TARGET_CHAR; + } + else + { + vo = (void *) obj; + target = TARGET_OBJ; + } + + break; + } + + target_name = ""; + (*skill_table[sn].spell_fun) ( sn, level, ch, vo,target); + + + + if ( (skill_table[sn].target == TAR_CHAR_OFFENSIVE + || (skill_table[sn].target == TAR_OBJ_CHAR_OFF && target == TARGET_CHAR)) + && victim != ch + && victim->master != ch ) + { + CHAR_DATA *vch; + CHAR_DATA *vch_next; + + for ( vch = ch->in_room->people; vch; vch = vch_next ) + { + vch_next = vch->next_in_room; + if ( victim == vch && victim->fighting == NULL ) + { + check_killer(victim,ch); + multi_hit( victim, ch, TYPE_UNDEFINED ); + break; + } + } + } + + return; +} + + + +/* + * Spell functions. + */ +void spell_acid_blast( int sn, int level, CHAR_DATA *ch, void *vo, int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + int dam; + + dam = dice( level, 12 ); + if ( saves_spell( level, victim, DAM_ACID ) ) + dam /= 2; + damage( ch, victim, dam, sn, DAM_ACID, TRUE); + return; +} + + + +void spell_armor( int sn, int level, CHAR_DATA *ch, void *vo, int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + AFFECT_DATA af; + + if ( is_affected( victim, sn ) ) + { + if (victim == ch) + send_to_char("You are already armored.\n\r",ch); + else + act("$N is already armored.",ch,NULL,victim,TO_CHAR); + return; + } + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.duration = 24; + af.modifier = -20; + af.location = APPLY_AC; + af.bitvector = 0; + affect_to_char( victim, &af ); + send_to_char( "You feel someone protecting you.\n\r", victim ); + if ( ch != victim ) + act("$N is protected by your magic.",ch,NULL,victim,TO_CHAR); + return; +} + + + +void spell_bless( int sn, int level, CHAR_DATA *ch, void *vo, int target) +{ + CHAR_DATA *victim; + OBJ_DATA *obj; + AFFECT_DATA af; + + /* deal with the object case first */ + if (target == TARGET_OBJ) + { + obj = (OBJ_DATA *) vo; + if (IS_OBJ_STAT(obj,ITEM_BLESS)) + { + act("$p is already blessed.",ch,obj,NULL,TO_CHAR); + return; + } + + if (IS_OBJ_STAT(obj,ITEM_EVIL)) + { + AFFECT_DATA *paf; + + paf = affect_find(obj->affected,gsn_curse); + if (!saves_dispel(level,paf != NULL ? paf->level : obj->level,0)) + { + if (paf != NULL) + affect_remove_obj(obj,paf); + act("$p glows a pale blue.",ch,obj,NULL,TO_ALL); + REMOVE_BIT(obj->extra_flags,ITEM_EVIL); + return; + } + else + { + act("The evil of $p is too powerful for you to overcome.", + ch,obj,NULL,TO_CHAR); + return; + } + } + + af.where = TO_OBJECT; + af.type = sn; + af.level = level; + af.duration = 6 + level; + af.location = APPLY_SAVES; + af.modifier = -1; + af.bitvector = ITEM_BLESS; + affect_to_obj(obj,&af); + + act("$p glows with a holy aura.",ch,obj,NULL,TO_ALL); + + if (obj->wear_loc != WEAR_NONE) + ch->saving_throw -= 1; + return; + } + + /* character target */ + victim = (CHAR_DATA *) vo; + + + if ( victim->position == POS_FIGHTING || is_affected( victim, sn ) ) + { + if (victim == ch) + send_to_char("You are already blessed.\n\r",ch); + else + act("$N already has divine favor.",ch,NULL,victim,TO_CHAR); + return; + } + + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.duration = 6+level; + af.location = APPLY_HITROLL; + af.modifier = level / 8; + af.bitvector = 0; + affect_to_char( victim, &af ); + + af.location = APPLY_SAVING_SPELL; + af.modifier = 0 - level / 8; + affect_to_char( victim, &af ); + send_to_char( "You feel righteous.\n\r", victim ); + if ( ch != victim ) + act("You grant $N the favor of your god.",ch,NULL,victim,TO_CHAR); + return; +} + + + +void spell_blindness( int sn, int level, CHAR_DATA *ch, void *vo, int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + AFFECT_DATA af; + + if ( IS_AFFECTED(victim, AFF_BLIND) || saves_spell(level,victim,DAM_OTHER)) + return; + + + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.location = APPLY_HITROLL; + af.modifier = -4; + af.duration = 1+level; + af.bitvector = AFF_BLIND; + affect_to_char( victim, &af ); + send_to_char( "You are blinded!\n\r", victim ); + act("$n appears to be blinded.",victim,NULL,NULL,TO_ROOM); + return; +} + + + +void spell_burning_hands(int sn,int level, CHAR_DATA *ch, void *vo, int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + static const sh_int dam_each[] = + { + 0, + 0, 0, 0, 0, 14, 17, 20, 23, 26, 29, + 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, + 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, + 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, + 44, 44, 45, 45, 46, 46, 47, 47, 48, 48 + }; + int dam; + + level = UMIN(level, sizeof(dam_each)/sizeof(dam_each[0]) - 1); + level = UMAX(0, level); + dam = number_range( dam_each[level] / 2, dam_each[level] * 2 ); + if ( saves_spell( level, victim,DAM_FIRE) ) + dam /= 2; + damage( ch, victim, dam, sn, DAM_FIRE,TRUE); + return; +} + + + +void spell_call_lightning( int sn, int level,CHAR_DATA *ch,void *vo,int target) +{ + CHAR_DATA *vch; + CHAR_DATA *vch_next; + int dam; + + if ( !IS_OUTSIDE(ch) ) + { + send_to_char( "You must be out of doors.\n\r", ch ); + return; + } + + if ( weather_info.sky < SKY_RAINING ) + { + send_to_char( "You need bad weather.\n\r", ch ); + return; + } + + dam = dice(level/2, 8); + + send_to_char( "Mota's lightning strikes your foes!\n\r", ch ); + act( "$n calls Mota's lightning to strike $s foes!", + ch, NULL, NULL, TO_ROOM ); + + for ( vch = char_list; vch != NULL; vch = vch_next ) + { + vch_next = vch->next; + if ( vch->in_room == NULL ) + continue; + if ( vch->in_room == ch->in_room ) + { + if ( vch != ch && ( IS_NPC(ch) ? !IS_NPC(vch) : IS_NPC(vch) ) ) + damage( ch, vch, saves_spell( level,vch,DAM_LIGHTNING) + ? dam / 2 : dam, sn,DAM_LIGHTNING,TRUE); + continue; + } + + if ( vch->in_room->area == ch->in_room->area + && IS_OUTSIDE(vch) + && IS_AWAKE(vch) ) + send_to_char( "Lightning flashes in the sky.\n\r", vch ); + } + + return; +} + +/* RT calm spell stops all fighting in the room */ + +void spell_calm( int sn, int level, CHAR_DATA *ch, void *vo,int target) +{ + CHAR_DATA *vch; + int mlevel = 0; + int count = 0; + int high_level = 0; + int chance; + AFFECT_DATA af; + + /* get sum of all mobile levels in the room */ + for (vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room) + { + if (vch->position == POS_FIGHTING) + { + count++; + if (IS_NPC(vch)) + mlevel += vch->level; + else + mlevel += vch->level/2; + high_level = UMAX(high_level,vch->level); + } + } + + /* compute chance of stopping combat */ + chance = 4 * level - high_level + 2 * count; + + if (IS_IMMORTAL(ch)) /* always works */ + mlevel = 0; + + if (number_range(0, chance) >= mlevel) /* hard to stop large fights */ + { + for (vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room) + { + if (IS_NPC(vch) && (IS_SET(vch->imm_flags,IMM_MAGIC) || + IS_SET(vch->act,ACT_UNDEAD))) + return; + + if (IS_AFFECTED(vch,AFF_CALM) || IS_AFFECTED(vch,AFF_BERSERK) + || is_affected(vch,skill_lookup("frenzy"))) + return; + + send_to_char("A wave of calm passes over you.\n\r",vch); + + if (vch->fighting || vch->position == POS_FIGHTING) + stop_fighting(vch,FALSE); + + + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.duration = level/4; + af.location = APPLY_HITROLL; + if (!IS_NPC(vch)) + af.modifier = -5; + else + af.modifier = -2; + af.bitvector = AFF_CALM; + affect_to_char(vch,&af); + + af.location = APPLY_DAMROLL; + affect_to_char(vch,&af); + } + } +} + +void spell_cancellation( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + bool found = FALSE; + + level += 2; + + if ((!IS_NPC(ch) && IS_NPC(victim) && + !(IS_AFFECTED(ch, AFF_CHARM) && ch->master == victim) ) || + (IS_NPC(ch) && !IS_NPC(victim)) ) + { + send_to_char("You failed, try dispel magic.\n\r",ch); + return; + } + + /* unlike dispel magic, the victim gets NO save */ + + /* begin running through the spells */ + + if (check_dispel(level,victim,skill_lookup("armor"))) + found = TRUE; + + if (check_dispel(level,victim,skill_lookup("bless"))) + found = TRUE; + + if (check_dispel(level,victim,skill_lookup("blindness"))) + { + found = TRUE; + act("$n is no longer blinded.",victim,NULL,NULL,TO_ROOM); + } + + if (check_dispel(level,victim,skill_lookup("calm"))) + { + found = TRUE; + act("$n no longer looks so peaceful...",victim,NULL,NULL,TO_ROOM); + } + + if (check_dispel(level,victim,skill_lookup("change sex"))) + { + found = TRUE; + act("$n looks more like $mself again.",victim,NULL,NULL,TO_ROOM); + } + + if (check_dispel(level,victim,skill_lookup("charm person"))) + { + found = TRUE; + act("$n regains $s free will.",victim,NULL,NULL,TO_ROOM); + } + + if (check_dispel(level,victim,skill_lookup("chill touch"))) + { + found = TRUE; + act("$n looks warmer.",victim,NULL,NULL,TO_ROOM); + } + + if (check_dispel(level,victim,skill_lookup("curse"))) + found = TRUE; + + if (check_dispel(level,victim,skill_lookup("detect evil"))) + found = TRUE; + + if (check_dispel(level,victim,skill_lookup("detect good"))) + found = TRUE; + + if (check_dispel(level,victim,skill_lookup("detect hidden"))) + found = TRUE; + + if (check_dispel(level,victim,skill_lookup("detect invis"))) + found = TRUE; + + if (check_dispel(level,victim,skill_lookup("detect magic"))) + found = TRUE; + + if (check_dispel(level,victim,skill_lookup("faerie fire"))) + { + act("$n's outline fades.",victim,NULL,NULL,TO_ROOM); + found = TRUE; + } + + if (check_dispel(level,victim,skill_lookup("fly"))) + { + act("$n falls to the ground!",victim,NULL,NULL,TO_ROOM); + found = TRUE; + } + + if (check_dispel(level,victim,skill_lookup("frenzy"))) + { + act("$n no longer looks so wild.",victim,NULL,NULL,TO_ROOM);; + found = TRUE; + } + + if (check_dispel(level,victim,skill_lookup("giant strength"))) + { + act("$n no longer looks so mighty.",victim,NULL,NULL,TO_ROOM); + found = TRUE; + } + + if (check_dispel(level,victim,skill_lookup("haste"))) + { + act("$n is no longer moving so quickly.",victim,NULL,NULL,TO_ROOM); + found = TRUE; + } + + if (check_dispel(level,victim,skill_lookup("infravision"))) + found = TRUE; + + if (check_dispel(level,victim,skill_lookup("invis"))) + { + act("$n fades into existance.",victim,NULL,NULL,TO_ROOM); + found = TRUE; + } + + if (check_dispel(level,victim,skill_lookup("mass invis"))) + { + act("$n fades into existance.",victim,NULL,NULL,TO_ROOM); + found = TRUE; + } + + if (check_dispel(level,victim,skill_lookup("pass door"))) + found = TRUE; + + if (check_dispel(level,victim,skill_lookup("protection evil"))) + found = TRUE; + + if (check_dispel(level,victim,skill_lookup("protection good"))) + found = TRUE; + + if (check_dispel(level,victim,skill_lookup("sanctuary"))) + { + act("The white aura around $n's body vanishes.", + victim,NULL,NULL,TO_ROOM); + found = TRUE; + } + + if (check_dispel(level,victim,skill_lookup("shield"))) + { + act("The shield protecting $n vanishes.",victim,NULL,NULL,TO_ROOM); + found = TRUE; + } + + if (check_dispel(level,victim,skill_lookup("sleep"))) + found = TRUE; + + if (check_dispel(level,victim,skill_lookup("slow"))) + { + act("$n is no longer moving so slowly.",victim,NULL,NULL,TO_ROOM); + found = TRUE; + } + + if (check_dispel(level,victim,skill_lookup("stone skin"))) + { + act("$n's skin regains its normal texture.",victim,NULL,NULL,TO_ROOM); + found = TRUE; + } + + if (check_dispel(level,victim,skill_lookup("weaken"))) + { + act("$n looks stronger.",victim,NULL,NULL,TO_ROOM); + found = TRUE; + } + + if (found) + send_to_char("Ok.\n\r",ch); + else + send_to_char("Spell failed.\n\r",ch); +} + +void spell_cause_light( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + damage( ch, (CHAR_DATA *) vo, dice(1, 8) + level / 3, sn,DAM_HARM,TRUE); + return; +} + + + +void spell_cause_critical(int sn,int level,CHAR_DATA *ch,void *vo,int target) +{ + damage( ch, (CHAR_DATA *) vo, dice(3, 8) + level - 6, sn,DAM_HARM,TRUE); + return; +} + + + +void spell_cause_serious(int sn,int level,CHAR_DATA *ch,void *vo,int target) +{ + damage( ch, (CHAR_DATA *) vo, dice(2, 8) + level / 2, sn,DAM_HARM,TRUE); + return; +} + +void spell_chain_lightning(int sn,int level,CHAR_DATA *ch, void *vo,int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + CHAR_DATA *tmp_vict,*last_vict,*next_vict; + bool found; + int dam; + + /* first strike */ + + act("A lightning bolt leaps from $n's hand and arcs to $N.", + ch,NULL,victim,TO_ROOM); + act("A lightning bolt leaps from your hand and arcs to $N.", + ch,NULL,victim,TO_CHAR); + act("A lightning bolt leaps from $n's hand and hits you!", + ch,NULL,victim,TO_VICT); + + dam = dice(level,6); + if (saves_spell(level,victim,DAM_LIGHTNING)) + dam /= 3; + damage(ch,victim,dam,sn,DAM_LIGHTNING,TRUE); + last_vict = victim; + level -= 4; /* decrement damage */ + + /* new targets */ + while (level > 0) + { + found = FALSE; + for (tmp_vict = ch->in_room->people; + tmp_vict != NULL; + tmp_vict = next_vict) + { + next_vict = tmp_vict->next_in_room; + if (!is_safe_spell(ch,tmp_vict,TRUE) && tmp_vict != last_vict) + { + found = TRUE; + last_vict = tmp_vict; + act("The bolt arcs to $n!",tmp_vict,NULL,NULL,TO_ROOM); + act("The bolt hits you!",tmp_vict,NULL,NULL,TO_CHAR); + dam = dice(level,6); + if (saves_spell(level,tmp_vict,DAM_LIGHTNING)) + dam /= 3; + damage(ch,tmp_vict,dam,sn,DAM_LIGHTNING,TRUE); + level -= 4; /* decrement damage */ + } + } /* end target searching loop */ + + if (!found) /* no target found, hit the caster */ + { + if (ch == NULL) + return; + + if (last_vict == ch) /* no double hits */ + { + act("The bolt seems to have fizzled out.",ch,NULL,NULL,TO_ROOM); + act("The bolt grounds out through your body.", + ch,NULL,NULL,TO_CHAR); + return; + } + + last_vict = ch; + act("The bolt arcs to $n...whoops!",ch,NULL,NULL,TO_ROOM); + send_to_char("You are struck by your own lightning!\n\r",ch); + dam = dice(level,6); + if (saves_spell(level,ch,DAM_LIGHTNING)) + dam /= 3; + damage(ch,ch,dam,sn,DAM_LIGHTNING,TRUE); + level -= 4; /* decrement damage */ + if (ch == NULL) + return; + } + /* now go back and find more targets */ + } +} + + +void spell_change_sex( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + AFFECT_DATA af; + + if ( is_affected( victim, sn )) + { + if (victim == ch) + send_to_char("You've already been changed.\n\r",ch); + else + act("$N has already had $s(?) sex changed.",ch,NULL,victim,TO_CHAR); + return; + } + if (saves_spell(level , victim,DAM_OTHER)) + return; + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.duration = 2 * level; + af.location = APPLY_SEX; + do + { + af.modifier = number_range( 0, 2 ) - victim->sex; + } + while ( af.modifier == 0 ); + af.bitvector = 0; + affect_to_char( victim, &af ); + send_to_char( "You feel different.\n\r", victim ); + act("$n doesn't look like $mself anymore...",victim,NULL,NULL,TO_ROOM); + return; +} + + + +void spell_charm_person( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + AFFECT_DATA af; + + if (is_safe(ch,victim)) return; + + if ( victim == ch ) + { + send_to_char( "You like yourself even better!\n\r", ch ); + return; + } + + if ( IS_AFFECTED(victim, AFF_CHARM) + || IS_AFFECTED(ch, AFF_CHARM) + || level < victim->level + || IS_SET(victim->imm_flags,IMM_CHARM) + || saves_spell( level, victim,DAM_CHARM) ) + return; + + + if (IS_SET(victim->in_room->room_flags,ROOM_LAW)) + { + send_to_char( + "The mayor does not allow charming in the city limits.\n\r",ch); + return; + } + + if ( victim->master ) + stop_follower( victim ); + add_follower( victim, ch ); + victim->leader = ch; + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.duration = number_fuzzy( level / 4 ); + af.location = 0; + af.modifier = 0; + af.bitvector = AFF_CHARM; + affect_to_char( victim, &af ); + act( "Isn't $n just so nice?", ch, NULL, victim, TO_VICT ); + if ( ch != victim ) + act("$N looks at you with adoring eyes.",ch,NULL,victim,TO_CHAR); + return; +} + + + +void spell_chill_touch( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + static const sh_int dam_each[] = + { + 0, + 0, 0, 6, 7, 8, 9, 12, 13, 13, 13, + 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, + 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, + 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, + 24, 24, 24, 25, 25, 25, 26, 26, 26, 27 + }; + AFFECT_DATA af; + int dam; + + level = UMIN(level, sizeof(dam_each)/sizeof(dam_each[0]) - 1); + level = UMAX(0, level); + dam = number_range( dam_each[level] / 2, dam_each[level] * 2 ); + if ( !saves_spell( level, victim,DAM_COLD ) ) + { + act("$n turns blue and shivers.",victim,NULL,NULL,TO_ROOM); + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.duration = 6; + af.location = APPLY_STR; + af.modifier = -1; + af.bitvector = 0; + affect_join( victim, &af ); + } + else + { + dam /= 2; + } + + damage( ch, victim, dam, sn, DAM_COLD,TRUE ); + return; +} + + + +void spell_colour_spray( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + static const sh_int dam_each[] = + { + 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 30, 35, 40, 45, 50, 55, 55, 55, 56, 57, + 58, 58, 59, 60, 61, 61, 62, 63, 64, 64, + 65, 66, 67, 67, 68, 69, 70, 70, 71, 72, + 73, 73, 74, 75, 76, 76, 77, 78, 79, 79 + }; + int dam; + + level = UMIN(level, sizeof(dam_each)/sizeof(dam_each[0]) - 1); + level = UMAX(0, level); + dam = number_range( dam_each[level] / 2, dam_each[level] * 2 ); + if ( saves_spell( level, victim,DAM_LIGHT) ) + dam /= 2; + else + spell_blindness(skill_lookup("blindness"), + level/2,ch,(void *) victim,TARGET_CHAR); + + damage( ch, victim, dam, sn, DAM_LIGHT,TRUE ); + return; +} + + + +void spell_continual_light(int sn,int level,CHAR_DATA *ch,void *vo,int target) +{ + OBJ_DATA *light; + + if (target_name[0] != '\0') /* do a glow on some object */ + { + light = get_obj_carry(ch,target_name,ch); + + if (light == NULL) + { + send_to_char("You don't see that here.\n\r",ch); + return; + } + + if (IS_OBJ_STAT(light,ITEM_GLOW)) + { + act("$p is already glowing.",ch,light,NULL,TO_CHAR); + return; + } + + SET_BIT(light->extra_flags,ITEM_GLOW); + act("$p glows with a white light.",ch,light,NULL,TO_ALL); + return; + } + + light = create_object( get_obj_index( OBJ_VNUM_LIGHT_BALL ), 0 ); + obj_to_room( light, ch->in_room ); + act( "$n twiddles $s thumbs and $p appears.", ch, light, NULL, TO_ROOM ); + act( "You twiddle your thumbs and $p appears.", ch, light, NULL, TO_CHAR ); + return; +} + + + +void spell_control_weather(int sn,int level,CHAR_DATA *ch,void *vo,int target) +{ + if ( !str_cmp( target_name, "better" ) ) + weather_info.change += dice( level / 3, 4 ); + else if ( !str_cmp( target_name, "worse" ) ) + weather_info.change -= dice( level / 3, 4 ); + else + send_to_char ("Do you want it to get better or worse?\n\r", ch ); + + send_to_char( "Ok.\n\r", ch ); + return; +} + + + +void spell_create_food( int sn, int level, CHAR_DATA *ch, void *vo,int target) +{ + OBJ_DATA *mushroom; + + mushroom = create_object( get_obj_index( OBJ_VNUM_MUSHROOM ), 0 ); + mushroom->value[0] = level / 2; + mushroom->value[1] = level; + obj_to_room( mushroom, ch->in_room ); + act( "$p suddenly appears.", ch, mushroom, NULL, TO_ROOM ); + act( "$p suddenly appears.", ch, mushroom, NULL, TO_CHAR ); + return; +} + +void spell_create_rose( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + OBJ_DATA *rose; + rose = create_object(get_obj_index(OBJ_VNUM_ROSE), 0); + act("$n has created a beautiful red rose.",ch,rose,NULL,TO_ROOM); + send_to_char("You create a beautiful red rose.\n\r",ch); + obj_to_char(rose,ch); + return; +} + +void spell_create_spring(int sn,int level,CHAR_DATA *ch,void *vo,int target) +{ + OBJ_DATA *spring; + + spring = create_object( get_obj_index( OBJ_VNUM_SPRING ), 0 ); + spring->timer = level; + obj_to_room( spring, ch->in_room ); + act( "$p flows from the ground.", ch, spring, NULL, TO_ROOM ); + act( "$p flows from the ground.", ch, spring, NULL, TO_CHAR ); + return; +} + + + +void spell_create_water( int sn, int level, CHAR_DATA *ch, void *vo,int target) +{ + OBJ_DATA *obj = (OBJ_DATA *) vo; + int water; + + if ( obj->item_type != ITEM_DRINK_CON ) + { + send_to_char( "It is unable to hold water.\n\r", ch ); + return; + } + + if ( obj->value[2] != LIQ_WATER && obj->value[1] != 0 ) + { + send_to_char( "It contains some other liquid.\n\r", ch ); + return; + } + + water = UMIN( + level * (weather_info.sky >= SKY_RAINING ? 4 : 2), + obj->value[0] - obj->value[1] + ); + + if ( water > 0 ) + { + obj->value[2] = LIQ_WATER; + obj->value[1] += water; + if ( !is_name( "water", obj->name ) ) + { + char buf[MAX_STRING_LENGTH]; + + sprintf( buf, "%s water", obj->name ); + free_string( obj->name ); + obj->name = str_dup( buf ); + } + act( "$p is filled.", ch, obj, NULL, TO_CHAR ); + } + + return; +} + + + +void spell_cure_blindness(int sn,int level,CHAR_DATA *ch,void *vo,int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + + if ( !is_affected( victim, gsn_blindness ) ) + { + if (victim == ch) + send_to_char("You aren't blind.\n\r",ch); + else + act("$N doesn't appear to be blinded.",ch,NULL,victim,TO_CHAR); + return; + } + + if (check_dispel(level,victim,gsn_blindness)) + { + send_to_char( "Your vision returns!\n\r", victim ); + act("$n is no longer blinded.",victim,NULL,NULL,TO_ROOM); + } + else + send_to_char("Spell failed.\n\r",ch); +} + + + +void spell_cure_critical( int sn, int level, CHAR_DATA *ch, void *vo,int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + int heal; + + heal = dice(3, 8) + level - 6; + victim->hit = UMIN( victim->hit + heal, victim->max_hit ); + update_pos( victim ); + send_to_char( "You feel better!\n\r", victim ); + if ( ch != victim ) + send_to_char( "Ok.\n\r", ch ); + return; +} + +/* RT added to cure plague */ +void spell_cure_disease( int sn, int level, CHAR_DATA *ch,void *vo,int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + + if ( !is_affected( victim, gsn_plague ) ) + { + if (victim == ch) + send_to_char("You aren't ill.\n\r",ch); + else + act("$N doesn't appear to be diseased.",ch,NULL,victim,TO_CHAR); + return; + } + + if (check_dispel(level,victim,gsn_plague)) + { + send_to_char("Your sores vanish.\n\r",victim); + act("$n looks relieved as $s sores vanish.",victim,NULL,NULL,TO_ROOM); + } + else + send_to_char("Spell failed.\n\r",ch); +} + + + +void spell_cure_light( int sn, int level, CHAR_DATA *ch, void *vo,int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + int heal; + + heal = dice(1, 8) + level / 3; + victim->hit = UMIN( victim->hit + heal, victim->max_hit ); + update_pos( victim ); + send_to_char( "You feel better!\n\r", victim ); + if ( ch != victim ) + send_to_char( "Ok.\n\r", ch ); + return; +} + + + +void spell_cure_poison( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + + if ( !is_affected( victim, gsn_poison ) ) + { + if (victim == ch) + send_to_char("You aren't poisoned.\n\r",ch); + else + act("$N doesn't appear to be poisoned.",ch,NULL,victim,TO_CHAR); + return; + } + + if (check_dispel(level,victim,gsn_poison)) + { + send_to_char("A warm feeling runs through your body.\n\r",victim); + act("$n looks much better.",victim,NULL,NULL,TO_ROOM); + } + else + send_to_char("Spell failed.\n\r",ch); +} + +void spell_cure_serious( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + int heal; + + heal = dice(2, 8) + level /2 ; + victim->hit = UMIN( victim->hit + heal, victim->max_hit ); + update_pos( victim ); + send_to_char( "You feel better!\n\r", victim ); + if ( ch != victim ) + send_to_char( "Ok.\n\r", ch ); + return; +} + + + +void spell_curse( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim; + OBJ_DATA *obj; + AFFECT_DATA af; + + /* deal with the object case first */ + if (target == TARGET_OBJ) + { + obj = (OBJ_DATA *) vo; + if (IS_OBJ_STAT(obj,ITEM_EVIL)) + { + act("$p is already filled with evil.",ch,obj,NULL,TO_CHAR); + return; + } + + if (IS_OBJ_STAT(obj,ITEM_BLESS)) + { + AFFECT_DATA *paf; + + paf = affect_find(obj->affected,skill_lookup("bless")); + if (!saves_dispel(level,paf != NULL ? paf->level : obj->level,0)) + { + if (paf != NULL) + affect_remove_obj(obj,paf); + act("$p glows with a red aura.",ch,obj,NULL,TO_ALL); + REMOVE_BIT(obj->extra_flags,ITEM_BLESS); + return; + } + else + { + act("The holy aura of $p is too powerful for you to overcome.", + ch,obj,NULL,TO_CHAR); + return; + } + } + + af.where = TO_OBJECT; + af.type = sn; + af.level = level; + af.duration = 2 * level; + af.location = APPLY_SAVES; + af.modifier = +1; + af.bitvector = ITEM_EVIL; + affect_to_obj(obj,&af); + + act("$p glows with a malevolent aura.",ch,obj,NULL,TO_ALL); + + if (obj->wear_loc != WEAR_NONE) + ch->saving_throw += 1; + return; + } + + /* character curses */ + victim = (CHAR_DATA *) vo; + + if (IS_AFFECTED(victim,AFF_CURSE) || saves_spell(level,victim,DAM_NEGATIVE)) + return; + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.duration = 2*level; + af.location = APPLY_HITROLL; + af.modifier = -1 * (level / 8); + af.bitvector = AFF_CURSE; + affect_to_char( victim, &af ); + + af.location = APPLY_SAVING_SPELL; + af.modifier = level / 8; + affect_to_char( victim, &af ); + + send_to_char( "You feel unclean.\n\r", victim ); + if ( ch != victim ) + act("$N looks very uncomfortable.",ch,NULL,victim,TO_CHAR); + return; +} + +/* RT replacement demonfire spell */ + +void spell_demonfire(int sn, int level, CHAR_DATA *ch, void *vo,int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + int dam; + + if ( !IS_NPC(ch) && !IS_EVIL(ch) ) + { + victim = ch; + send_to_char("The demons turn upon you!\n\r",ch); + } + + ch->alignment = UMAX(-1000, ch->alignment - 50); + + if (victim != ch) + { + act("$n calls forth the demons of Hell upon $N!", + ch,NULL,victim,TO_ROOM); + act("$n has assailed you with the demons of Hell!", + ch,NULL,victim,TO_VICT); + send_to_char("You conjure forth the demons of hell!\n\r",ch); + } + dam = dice( level, 10 ); + if ( saves_spell( level, victim,DAM_NEGATIVE) ) + dam /= 2; + damage( ch, victim, dam, sn, DAM_NEGATIVE ,TRUE); + spell_curse(gsn_curse, 3 * level / 4, ch, (void *) victim,TARGET_CHAR); +} + +void spell_detect_evil( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + AFFECT_DATA af; + + if ( IS_AFFECTED(victim, AFF_DETECT_EVIL) ) + { + if (victim == ch) + send_to_char("You can already sense evil.\n\r",ch); + else + act("$N can already detect evil.",ch,NULL,victim,TO_CHAR); + return; + } + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.duration = level; + af.modifier = 0; + af.location = APPLY_NONE; + af.bitvector = AFF_DETECT_EVIL; + affect_to_char( victim, &af ); + send_to_char( "Your eyes tingle.\n\r", victim ); + if ( ch != victim ) + send_to_char( "Ok.\n\r", ch ); + return; +} + + +void spell_detect_good( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + AFFECT_DATA af; + + if ( IS_AFFECTED(victim, AFF_DETECT_GOOD) ) + { + if (victim == ch) + send_to_char("You can already sense good.\n\r",ch); + else + act("$N can already detect good.",ch,NULL,victim,TO_CHAR); + return; + } + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.duration = level; + af.modifier = 0; + af.location = APPLY_NONE; + af.bitvector = AFF_DETECT_GOOD; + affect_to_char( victim, &af ); + send_to_char( "Your eyes tingle.\n\r", victim ); + if ( ch != victim ) + send_to_char( "Ok.\n\r", ch ); + return; +} + + + +void spell_detect_hidden(int sn,int level,CHAR_DATA *ch,void *vo,int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + AFFECT_DATA af; + + if ( IS_AFFECTED(victim, AFF_DETECT_HIDDEN) ) + { + if (victim == ch) + send_to_char("You are already as alert as you can be. \n\r",ch); + else + act("$N can already sense hidden lifeforms.",ch,NULL,victim,TO_CHAR); + return; + } + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.duration = level; + af.location = APPLY_NONE; + af.modifier = 0; + af.bitvector = AFF_DETECT_HIDDEN; + affect_to_char( victim, &af ); + send_to_char( "Your awareness improves.\n\r", victim ); + if ( ch != victim ) + send_to_char( "Ok.\n\r", ch ); + return; +} + + + +void spell_detect_invis( int sn, int level, CHAR_DATA *ch, void *vo,int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + AFFECT_DATA af; + + if ( IS_AFFECTED(victim, AFF_DETECT_INVIS) ) + { + if (victim == ch) + send_to_char("You can already see invisible.\n\r",ch); + else + act("$N can already see invisible things.",ch,NULL,victim,TO_CHAR); + return; + } + + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.duration = level; + af.modifier = 0; + af.location = APPLY_NONE; + af.bitvector = AFF_DETECT_INVIS; + affect_to_char( victim, &af ); + send_to_char( "Your eyes tingle.\n\r", victim ); + if ( ch != victim ) + send_to_char( "Ok.\n\r", ch ); + return; +} + + + +void spell_detect_magic( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + AFFECT_DATA af; + + if ( IS_AFFECTED(victim, AFF_DETECT_MAGIC) ) + { + if (victim == ch) + send_to_char("You can already sense magical auras.\n\r",ch); + else + act("$N can already detect magic.",ch,NULL,victim,TO_CHAR); + return; + } + + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.duration = level; + af.modifier = 0; + af.location = APPLY_NONE; + af.bitvector = AFF_DETECT_MAGIC; + affect_to_char( victim, &af ); + send_to_char( "Your eyes tingle.\n\r", victim ); + if ( ch != victim ) + send_to_char( "Ok.\n\r", ch ); + return; +} + + + +void spell_detect_poison( int sn, int level, CHAR_DATA *ch, void *vo,int target) +{ + OBJ_DATA *obj = (OBJ_DATA *) vo; + + if ( obj->item_type == ITEM_DRINK_CON || obj->item_type == ITEM_FOOD ) + { + if ( obj->value[3] != 0 ) + send_to_char( "You smell poisonous fumes.\n\r", ch ); + else + send_to_char( "It looks delicious.\n\r", ch ); + } + else + { + send_to_char( "It doesn't look poisoned.\n\r", ch ); + } + + return; +} + + + +void spell_dispel_evil( int sn, int level, CHAR_DATA *ch, void *vo,int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + int dam; + + if ( !IS_NPC(ch) && IS_EVIL(ch) ) + victim = ch; + + if ( IS_GOOD(victim) ) + { + act( "Mota protects $N.", ch, NULL, victim, TO_ROOM ); + return; + } + + if ( IS_NEUTRAL(victim) ) + { + act( "$N does not seem to be affected.", ch, NULL, victim, TO_CHAR ); + return; + } + + if (victim->hit > (ch->level * 4)) + dam = dice( level, 4 ); + else + dam = UMAX(victim->hit, dice(level,4)); + if ( saves_spell( level, victim,DAM_HOLY) ) + dam /= 2; + damage( ch, victim, dam, sn, DAM_HOLY ,TRUE); + return; +} + + +void spell_dispel_good( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + int dam; + + if ( !IS_NPC(ch) && IS_GOOD(ch) ) + victim = ch; + + if ( IS_EVIL(victim) ) + { + act( "$N is protected by $S evil.", ch, NULL, victim, TO_ROOM ); + return; + } + + if ( IS_NEUTRAL(victim) ) + { + act( "$N does not seem to be affected.", ch, NULL, victim, TO_CHAR ); + return; + } + + if (victim->hit > (ch->level * 4)) + dam = dice( level, 4 ); + else + dam = UMAX(victim->hit, dice(level,4)); + if ( saves_spell( level, victim,DAM_NEGATIVE) ) + dam /= 2; + damage( ch, victim, dam, sn, DAM_NEGATIVE ,TRUE); + return; +} + + +/* modified for enhanced use */ + +void spell_dispel_magic( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + bool found = FALSE; + + if (saves_spell(level, victim,DAM_OTHER)) + { + send_to_char( "You feel a brief tingling sensation.\n\r",victim); + send_to_char( "You failed.\n\r", ch); + return; + } + + /* begin running through the spells */ + + if (check_dispel(level,victim,skill_lookup("armor"))) + found = TRUE; + + if (check_dispel(level,victim,skill_lookup("bless"))) + found = TRUE; + + if (check_dispel(level,victim,skill_lookup("blindness"))) + { + found = TRUE; + act("$n is no longer blinded.",victim,NULL,NULL,TO_ROOM); + } + + if (check_dispel(level,victim,skill_lookup("calm"))) + { + found = TRUE; + act("$n no longer looks so peaceful...",victim,NULL,NULL,TO_ROOM); + } + + if (check_dispel(level,victim,skill_lookup("change sex"))) + { + found = TRUE; + act("$n looks more like $mself again.",victim,NULL,NULL,TO_ROOM); + } + + if (check_dispel(level,victim,skill_lookup("charm person"))) + { + found = TRUE; + act("$n regains $s free will.",victim,NULL,NULL,TO_ROOM); + } + + if (check_dispel(level,victim,skill_lookup("chill touch"))) + { + found = TRUE; + act("$n looks warmer.",victim,NULL,NULL,TO_ROOM); + } + + if (check_dispel(level,victim,skill_lookup("curse"))) + found = TRUE; + + if (check_dispel(level,victim,skill_lookup("detect evil"))) + found = TRUE; + + if (check_dispel(level,victim,skill_lookup("detect good"))) + found = TRUE; + + if (check_dispel(level,victim,skill_lookup("detect hidden"))) + found = TRUE; + + if (check_dispel(level,victim,skill_lookup("detect invis"))) + found = TRUE; + + if (check_dispel(level,victim,skill_lookup("detect magic"))) + found = TRUE; + + if (check_dispel(level,victim,skill_lookup("faerie fire"))) + { + act("$n's outline fades.",victim,NULL,NULL,TO_ROOM); + found = TRUE; + } + + if (check_dispel(level,victim,skill_lookup("fly"))) + { + act("$n falls to the ground!",victim,NULL,NULL,TO_ROOM); + found = TRUE; + } + + if (check_dispel(level,victim,skill_lookup("frenzy"))) + { + act("$n no longer looks so wild.",victim,NULL,NULL,TO_ROOM);; + found = TRUE; + } + + if (check_dispel(level,victim,skill_lookup("giant strength"))) + { + act("$n no longer looks so mighty.",victim,NULL,NULL,TO_ROOM); + found = TRUE; + } + + if (check_dispel(level,victim,skill_lookup("haste"))) + { + act("$n is no longer moving so quickly.",victim,NULL,NULL,TO_ROOM); + found = TRUE; + } + + if (check_dispel(level,victim,skill_lookup("infravision"))) + found = TRUE; + + if (check_dispel(level,victim,skill_lookup("invis"))) + { + act("$n fades into existance.",victim,NULL,NULL,TO_ROOM); + found = TRUE; + } + + if (check_dispel(level,victim,skill_lookup("mass invis"))) + { + act("$n fades into existance.",victim,NULL,NULL,TO_ROOM); + found = TRUE; + } + + if (check_dispel(level,victim,skill_lookup("pass door"))) + found = TRUE; + + + if (check_dispel(level,victim,skill_lookup("protection evil"))) + found = TRUE; + + if (check_dispel(level,victim,skill_lookup("protection good"))) + found = TRUE; + + if (check_dispel(level,victim,skill_lookup("sanctuary"))) + { + act("The white aura around $n's body vanishes.", + victim,NULL,NULL,TO_ROOM); + found = TRUE; + } + + if (IS_AFFECTED(victim,AFF_SANCTUARY) + && !saves_dispel(level, victim->level,-1) + && !is_affected(victim,skill_lookup("sanctuary"))) + { + REMOVE_BIT(victim->affected_by,AFF_SANCTUARY); + act("The white aura around $n's body vanishes.", + victim,NULL,NULL,TO_ROOM); + found = TRUE; + } + + if (check_dispel(level,victim,skill_lookup("shield"))) + { + act("The shield protecting $n vanishes.",victim,NULL,NULL,TO_ROOM); + found = TRUE; + } + + if (check_dispel(level,victim,skill_lookup("sleep"))) + found = TRUE; + + if (check_dispel(level,victim,skill_lookup("slow"))) + { + act("$n is no longer moving so slowly.",victim,NULL,NULL,TO_ROOM); + found = TRUE; + } + + if (check_dispel(level,victim,skill_lookup("stone skin"))) + { + act("$n's skin regains its normal texture.",victim,NULL,NULL,TO_ROOM); + found = TRUE; + } + + if (check_dispel(level,victim,skill_lookup("weaken"))) + { + act("$n looks stronger.",victim,NULL,NULL,TO_ROOM); + found = TRUE; + } + + if (found) + send_to_char("Ok.\n\r",ch); + else + send_to_char("Spell failed.\n\r",ch); + return; +} + +void spell_earthquake( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *vch; + CHAR_DATA *vch_next; + + send_to_char( "The earth trembles beneath your feet!\n\r", ch ); + act( "$n makes the earth tremble and shiver.", ch, NULL, NULL, TO_ROOM ); + + for ( vch = char_list; vch != NULL; vch = vch_next ) + { + vch_next = vch->next; + if ( vch->in_room == NULL ) + continue; + if ( vch->in_room == ch->in_room ) + { + if ( vch != ch && !is_safe_spell(ch,vch,TRUE)) + { if (IS_AFFECTED(vch,AFF_FLYING)) + damage(ch,vch,0,sn,DAM_BASH,TRUE); + else + damage( ch,vch,level + dice(2, 8), sn, DAM_BASH,TRUE); + } + continue; + } + + if ( vch->in_room->area == ch->in_room->area ) + send_to_char( "The earth trembles and shivers.\n\r", vch ); + } + + return; +} + +void spell_enchant_armor( int sn, int level, CHAR_DATA *ch, void *vo,int target) +{ + OBJ_DATA *obj = (OBJ_DATA *) vo; + AFFECT_DATA *paf; + int result, fail; + int ac_bonus, added; + bool ac_found = FALSE; + + if (obj->item_type != ITEM_ARMOR) + { + send_to_char("That isn't an armor.\n\r",ch); + return; + } + + if (obj->wear_loc != -1) + { + send_to_char("The item must be carried to be enchanted.\n\r",ch); + return; + } + + /* this means they have no bonus */ + ac_bonus = 0; + fail = 25; /* base 25% chance of failure */ + + /* find the bonuses */ + + if (!obj->enchanted) + for ( paf = obj->pIndexData->affected; paf != NULL; paf = paf->next ) + { + if ( paf->location == APPLY_AC ) + { + ac_bonus = paf->modifier; + ac_found = TRUE; + fail += 5 * (ac_bonus * ac_bonus); + } + + else /* things get a little harder */ + fail += 20; + } + + for ( paf = obj->affected; paf != NULL; paf = paf->next ) + { + if ( paf->location == APPLY_AC ) + { + ac_bonus = paf->modifier; + ac_found = TRUE; + fail += 5 * (ac_bonus * ac_bonus); + } + + else /* things get a little harder */ + fail += 20; + } + + /* apply other modifiers */ + fail -= level; + + if (IS_OBJ_STAT(obj,ITEM_BLESS)) + fail -= 15; + if (IS_OBJ_STAT(obj,ITEM_GLOW)) + fail -= 5; + + fail = URANGE(5,fail,85); + + result = number_percent(); + + /* the moment of truth */ + if (result < (fail / 5)) /* item destroyed */ + { + act("$p flares blindingly... and evaporates!",ch,obj,NULL,TO_CHAR); + act("$p flares blindingly... and evaporates!",ch,obj,NULL,TO_ROOM); + extract_obj(obj); + return; + } + + if (result < (fail / 3)) /* item disenchanted */ + { + AFFECT_DATA *paf_next; + + act("$p glows brightly, then fades...oops.",ch,obj,NULL,TO_CHAR); + act("$p glows brightly, then fades.",ch,obj,NULL,TO_ROOM); + obj->enchanted = TRUE; + + /* remove all affects */ + for (paf = obj->affected; paf != NULL; paf = paf_next) + { + paf_next = paf->next; + free_affect(paf); + } + obj->affected = NULL; + + /* clear all flags */ + obj->extra_flags = 0; + return; + } + + if ( result <= fail ) /* failed, no bad result */ + { + send_to_char("Nothing seemed to happen.\n\r",ch); + return; + } + + /* okay, move all the old flags into new vectors if we have to */ + if (!obj->enchanted) + { + AFFECT_DATA *af_new; + obj->enchanted = TRUE; + + for (paf = obj->pIndexData->affected; paf != NULL; paf = paf->next) + { + af_new = new_affect(); + + af_new->next = obj->affected; + obj->affected = af_new; + + af_new->where = paf->where; + af_new->type = UMAX(0,paf->type); + af_new->level = paf->level; + af_new->duration = paf->duration; + af_new->location = paf->location; + af_new->modifier = paf->modifier; + af_new->bitvector = paf->bitvector; + } + } + + if (result <= (90 - level/5)) /* success! */ + { + act("$p shimmers with a gold aura.",ch,obj,NULL,TO_CHAR); + act("$p shimmers with a gold aura.",ch,obj,NULL,TO_ROOM); + SET_BIT(obj->extra_flags, ITEM_MAGIC); + added = -1; + } + + else /* exceptional enchant */ + { + act("$p glows a brillant gold!",ch,obj,NULL,TO_CHAR); + act("$p glows a brillant gold!",ch,obj,NULL,TO_ROOM); + SET_BIT(obj->extra_flags,ITEM_MAGIC); + SET_BIT(obj->extra_flags,ITEM_GLOW); + added = -2; + } + + /* now add the enchantments */ + + if (obj->level < LEVEL_HERO) + obj->level = UMIN(LEVEL_HERO - 1,obj->level + 1); + + if (ac_found) + { + for ( paf = obj->affected; paf != NULL; paf = paf->next) + { + if ( paf->location == APPLY_AC) + { + paf->type = sn; + paf->modifier += added; + paf->level = UMAX(paf->level,level); + } + } + } + else /* add a new affect */ + { + paf = new_affect(); + + paf->where = TO_OBJECT; + paf->type = sn; + paf->level = level; + paf->duration = -1; + paf->location = APPLY_AC; + paf->modifier = added; + paf->bitvector = 0; + paf->next = obj->affected; + obj->affected = paf; + } + +} + + + + +void spell_enchant_weapon(int sn,int level,CHAR_DATA *ch, void *vo,int target) +{ + OBJ_DATA *obj = (OBJ_DATA *) vo; + AFFECT_DATA *paf; + int result, fail; + int hit_bonus, dam_bonus, added; + bool hit_found = FALSE, dam_found = FALSE; + + if (obj->item_type != ITEM_WEAPON) + { + send_to_char("That isn't a weapon.\n\r",ch); + return; + } + + if (obj->wear_loc != -1) + { + send_to_char("The item must be carried to be enchanted.\n\r",ch); + return; + } + + /* this means they have no bonus */ + hit_bonus = 0; + dam_bonus = 0; + fail = 25; /* base 25% chance of failure */ + + /* find the bonuses */ + + if (!obj->enchanted) + for ( paf = obj->pIndexData->affected; paf != NULL; paf = paf->next ) + { + if ( paf->location == APPLY_HITROLL ) + { + hit_bonus = paf->modifier; + hit_found = TRUE; + fail += 2 * (hit_bonus * hit_bonus); + } + + else if (paf->location == APPLY_DAMROLL ) + { + dam_bonus = paf->modifier; + dam_found = TRUE; + fail += 2 * (dam_bonus * dam_bonus); + } + + else /* things get a little harder */ + fail += 25; + } + + for ( paf = obj->affected; paf != NULL; paf = paf->next ) + { + if ( paf->location == APPLY_HITROLL ) + { + hit_bonus = paf->modifier; + hit_found = TRUE; + fail += 2 * (hit_bonus * hit_bonus); + } + + else if (paf->location == APPLY_DAMROLL ) + { + dam_bonus = paf->modifier; + dam_found = TRUE; + fail += 2 * (dam_bonus * dam_bonus); + } + + else /* things get a little harder */ + fail += 25; + } + + /* apply other modifiers */ + fail -= 3 * level/2; + + if (IS_OBJ_STAT(obj,ITEM_BLESS)) + fail -= 15; + if (IS_OBJ_STAT(obj,ITEM_GLOW)) + fail -= 5; + + fail = URANGE(5,fail,95); + + result = number_percent(); + + /* the moment of truth */ + if (result < (fail / 5)) /* item destroyed */ + { + act("$p shivers violently and explodes!",ch,obj,NULL,TO_CHAR); + act("$p shivers violently and explodeds!",ch,obj,NULL,TO_ROOM); + extract_obj(obj); + return; + } + + if (result < (fail / 2)) /* item disenchanted */ + { + AFFECT_DATA *paf_next; + + act("$p glows brightly, then fades...oops.",ch,obj,NULL,TO_CHAR); + act("$p glows brightly, then fades.",ch,obj,NULL,TO_ROOM); + obj->enchanted = TRUE; + + /* remove all affects */ + for (paf = obj->affected; paf != NULL; paf = paf_next) + { + paf_next = paf->next; + free_affect(paf); + } + obj->affected = NULL; + + /* clear all flags */ + obj->extra_flags = 0; + return; + } + + if ( result <= fail ) /* failed, no bad result */ + { + send_to_char("Nothing seemed to happen.\n\r",ch); + return; + } + + /* okay, move all the old flags into new vectors if we have to */ + if (!obj->enchanted) + { + AFFECT_DATA *af_new; + obj->enchanted = TRUE; + + for (paf = obj->pIndexData->affected; paf != NULL; paf = paf->next) + { + af_new = new_affect(); + + af_new->next = obj->affected; + obj->affected = af_new; + + af_new->where = paf->where; + af_new->type = UMAX(0,paf->type); + af_new->level = paf->level; + af_new->duration = paf->duration; + af_new->location = paf->location; + af_new->modifier = paf->modifier; + af_new->bitvector = paf->bitvector; + } + } + + if (result <= (100 - level/5)) /* success! */ + { + act("$p glows blue.",ch,obj,NULL,TO_CHAR); + act("$p glows blue.",ch,obj,NULL,TO_ROOM); + SET_BIT(obj->extra_flags, ITEM_MAGIC); + added = 1; + } + + else /* exceptional enchant */ + { + act("$p glows a brillant blue!",ch,obj,NULL,TO_CHAR); + act("$p glows a brillant blue!",ch,obj,NULL,TO_ROOM); + SET_BIT(obj->extra_flags,ITEM_MAGIC); + SET_BIT(obj->extra_flags,ITEM_GLOW); + added = 2; + } + + /* now add the enchantments */ + + if (obj->level < LEVEL_HERO - 1) + obj->level = UMIN(LEVEL_HERO - 1,obj->level + 1); + + if (dam_found) + { + for ( paf = obj->affected; paf != NULL; paf = paf->next) + { + if ( paf->location == APPLY_DAMROLL) + { + paf->type = sn; + paf->modifier += added; + paf->level = UMAX(paf->level,level); + if (paf->modifier > 4) + SET_BIT(obj->extra_flags,ITEM_HUM); + } + } + } + else /* add a new affect */ + { + paf = new_affect(); + + paf->where = TO_OBJECT; + paf->type = sn; + paf->level = level; + paf->duration = -1; + paf->location = APPLY_DAMROLL; + paf->modifier = added; + paf->bitvector = 0; + paf->next = obj->affected; + obj->affected = paf; + } + + if (hit_found) + { + for ( paf = obj->affected; paf != NULL; paf = paf->next) + { + if ( paf->location == APPLY_HITROLL) + { + paf->type = sn; + paf->modifier += added; + paf->level = UMAX(paf->level,level); + if (paf->modifier > 4) + SET_BIT(obj->extra_flags,ITEM_HUM); + } + } + } + else /* add a new affect */ + { + paf = new_affect(); + + paf->type = sn; + paf->level = level; + paf->duration = -1; + paf->location = APPLY_HITROLL; + paf->modifier = added; + paf->bitvector = 0; + paf->next = obj->affected; + obj->affected = paf; + } + +} + + + +/* + * Drain XP, MANA, HP. + * Caster gains HP. + */ +void spell_energy_drain( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + int dam; + + if (victim != ch) + ch->alignment = UMAX(-1000, ch->alignment - 50); + + if ( saves_spell( level, victim,DAM_NEGATIVE) ) + { + send_to_char("You feel a momentary chill.\n\r",victim); + return; + } + + + if ( victim->level <= 2 ) + { + dam = ch->hit + 1; + } + else + { + gain_exp( victim, 0 - number_range( level/2, 3 * level / 2 ) ); + victim->mana /= 2; + victim->move /= 2; + dam = dice(1, level); + ch->hit += dam; + } + + send_to_char("You feel your life slipping away!\n\r",victim); + send_to_char("Wow....what a rush!\n\r",ch); + damage( ch, victim, dam, sn, DAM_NEGATIVE ,TRUE); + + return; +} + + + +void spell_fireball( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + static const sh_int dam_each[] = + { + 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 30, 35, 40, 45, 50, 55, + 60, 65, 70, 75, 80, 82, 84, 86, 88, 90, + 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, + 112, 114, 116, 118, 120, 122, 124, 126, 128, 130 + }; + int dam; + + level = UMIN(level, sizeof(dam_each)/sizeof(dam_each[0]) - 1); + level = UMAX(0, level); + dam = number_range( dam_each[level] / 2, dam_each[level] * 2 ); + if ( saves_spell( level, victim, DAM_FIRE) ) + dam /= 2; + damage( ch, victim, dam, sn, DAM_FIRE ,TRUE); + return; +} + + +void spell_fireproof(int sn, int level, CHAR_DATA *ch, void *vo,int target) +{ + OBJ_DATA *obj = (OBJ_DATA *) vo; + AFFECT_DATA af; + + if (IS_OBJ_STAT(obj,ITEM_BURN_PROOF)) + { + act("$p is already protected from burning.",ch,obj,NULL,TO_CHAR); + return; + } + + af.where = TO_OBJECT; + af.type = sn; + af.level = level; + af.duration = number_fuzzy(level / 4); + af.location = APPLY_NONE; + af.modifier = 0; + af.bitvector = ITEM_BURN_PROOF; + + affect_to_obj(obj,&af); + + act("You protect $p from fire.",ch,obj,NULL,TO_CHAR); + act("$p is surrounded by a protective aura.",ch,obj,NULL,TO_ROOM); +} + + + +void spell_flamestrike( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + int dam; + + dam = dice(6 + level / 2, 8); + if ( saves_spell( level, victim,DAM_FIRE) ) + dam /= 2; + damage( ch, victim, dam, sn, DAM_FIRE ,TRUE); + return; +} + + + +void spell_faerie_fire( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + AFFECT_DATA af; + + if ( IS_AFFECTED(victim, AFF_FAERIE_FIRE) ) + return; + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.duration = level; + af.location = APPLY_AC; + af.modifier = 2 * level; + af.bitvector = AFF_FAERIE_FIRE; + affect_to_char( victim, &af ); + send_to_char( "You are surrounded by a pink outline.\n\r", victim ); + act( "$n is surrounded by a pink outline.", victim, NULL, NULL, TO_ROOM ); + return; +} + + + +void spell_faerie_fog( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *ich; + + act( "$n conjures a cloud of purple smoke.", ch, NULL, NULL, TO_ROOM ); + send_to_char( "You conjure a cloud of purple smoke.\n\r", ch ); + + for ( ich = ch->in_room->people; ich != NULL; ich = ich->next_in_room ) + { + if (ich->invis_level > 0) + continue; + + if ( ich == ch || saves_spell( level, ich,DAM_OTHER) ) + continue; + + affect_strip ( ich, gsn_invis ); + affect_strip ( ich, gsn_mass_invis ); + affect_strip ( ich, gsn_sneak ); + REMOVE_BIT ( ich->affected_by, AFF_HIDE ); + REMOVE_BIT ( ich->affected_by, AFF_INVISIBLE ); + REMOVE_BIT ( ich->affected_by, AFF_SNEAK ); + act( "$n is revealed!", ich, NULL, NULL, TO_ROOM ); + send_to_char( "You are revealed!\n\r", ich ); + } + + return; +} + +void spell_floating_disc( int sn, int level,CHAR_DATA *ch,void *vo,int target ) +{ + OBJ_DATA *disc, *floating; + + floating = get_eq_char(ch,WEAR_FLOAT); + if (floating != NULL && IS_OBJ_STAT(floating,ITEM_NOREMOVE)) + { + act("You can't remove $p.",ch,floating,NULL,TO_CHAR); + return; + } + + disc = create_object(get_obj_index(OBJ_VNUM_DISC), 0); + disc->value[0] = ch->level * 10; /* 10 pounds per level capacity */ + disc->value[3] = ch->level * 5; /* 5 pounds per level max per item */ + disc->timer = ch->level * 2 - number_range(0,level / 2); + + act("$n has created a floating black disc.",ch,NULL,NULL,TO_ROOM); + send_to_char("You create a floating disc.\n\r",ch); + obj_to_char(disc,ch); + wear_obj(ch,disc,TRUE); + return; +} + + +void spell_fly( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + AFFECT_DATA af; + + if ( IS_AFFECTED(victim, AFF_FLYING) ) + { + if (victim == ch) + send_to_char("You are already airborne.\n\r",ch); + else + act("$N doesn't need your help to fly.",ch,NULL,victim,TO_CHAR); + return; + } + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.duration = level + 3; + af.location = 0; + af.modifier = 0; + af.bitvector = AFF_FLYING; + affect_to_char( victim, &af ); + send_to_char( "Your feet rise off the ground.\n\r", victim ); + act( "$n's feet rise off the ground.", victim, NULL, NULL, TO_ROOM ); + return; +} + +/* RT clerical berserking spell */ + +void spell_frenzy(int sn, int level, CHAR_DATA *ch, void *vo,int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + AFFECT_DATA af; + + if (is_affected(victim,sn) || IS_AFFECTED(victim,AFF_BERSERK)) + { + if (victim == ch) + send_to_char("You are already in a frenzy.\n\r",ch); + else + act("$N is already in a frenzy.",ch,NULL,victim,TO_CHAR); + return; + } + + if (is_affected(victim,skill_lookup("calm"))) + { + if (victim == ch) + send_to_char("Why don't you just relax for a while?\n\r",ch); + else + act("$N doesn't look like $e wants to fight anymore.", + ch,NULL,victim,TO_CHAR); + return; + } + + if ((IS_GOOD(ch) && !IS_GOOD(victim)) || + (IS_NEUTRAL(ch) && !IS_NEUTRAL(victim)) || + (IS_EVIL(ch) && !IS_EVIL(victim)) + ) + { + act("Your god doesn't seem to like $N",ch,NULL,victim,TO_CHAR); + return; + } + + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.duration = level / 3; + af.modifier = level / 6; + af.bitvector = 0; + + af.location = APPLY_HITROLL; + affect_to_char(victim,&af); + + af.location = APPLY_DAMROLL; + affect_to_char(victim,&af); + + af.modifier = 10 * (level / 12); + af.location = APPLY_AC; + affect_to_char(victim,&af); + + send_to_char("You are filled with holy wrath!\n\r",victim); + act("$n gets a wild look in $s eyes!",victim,NULL,NULL,TO_ROOM); +} + +/* RT ROM-style gate */ + +void spell_gate( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim; + bool gate_pet; + + if ( ( victim = get_char_world( ch, target_name ) ) == NULL + || victim == ch + || victim->in_room == NULL + || !can_see_room(ch,victim->in_room) + || IS_SET(victim->in_room->room_flags, ROOM_SAFE) + || IS_SET(victim->in_room->room_flags, ROOM_PRIVATE) + || IS_SET(victim->in_room->room_flags, ROOM_SOLITARY) + || IS_SET(victim->in_room->room_flags, ROOM_NO_RECALL) + || IS_SET(ch->in_room->room_flags, ROOM_NO_RECALL) + || victim->level >= level + 3 + || (is_clan(victim) && !is_same_clan(ch,victim)) + || (!IS_NPC(victim) && victim->level >= LEVEL_HERO) /* NOT trust */ + || (IS_NPC(victim) && IS_SET(victim->imm_flags,IMM_SUMMON)) + || (IS_NPC(victim) && saves_spell( level, victim,DAM_OTHER) ) ) + { + send_to_char( "You failed.\n\r", ch ); + return; + } + if (ch->pet != NULL && ch->in_room == ch->pet->in_room) + gate_pet = TRUE; + else + gate_pet = FALSE; + + act("$n steps through a gate and vanishes.",ch,NULL,NULL,TO_ROOM); + send_to_char("You step through a gate and vanish.\n\r",ch); + char_from_room(ch); + char_to_room(ch,victim->in_room); + + act("$n has arrived through a gate.",ch,NULL,NULL,TO_ROOM); + do_function(ch, &do_look, "auto"); + + if (gate_pet) + { + act("$n steps through a gate and vanishes.",ch->pet,NULL,NULL,TO_ROOM); + send_to_char("You step through a gate and vanish.\n\r",ch->pet); + char_from_room(ch->pet); + char_to_room(ch->pet,victim->in_room); + act("$n has arrived through a gate.",ch->pet,NULL,NULL,TO_ROOM); + do_function(ch->pet, &do_look, "auto"); + } +} + + + +void spell_giant_strength(int sn,int level,CHAR_DATA *ch,void *vo,int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + AFFECT_DATA af; + + if ( is_affected( victim, sn ) ) + { + if (victim == ch) + send_to_char("You are already as strong as you can get!\n\r",ch); + else + act("$N can't get any stronger.",ch,NULL,victim,TO_CHAR); + return; + } + + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.duration = level; + af.location = APPLY_STR; + af.modifier = 1 + (level >= 18) + (level >= 25) + (level >= 32); + af.bitvector = 0; + affect_to_char( victim, &af ); + send_to_char( "Your muscles surge with heightened power!\n\r", victim ); + act("$n's muscles surge with heightened power.",victim,NULL,NULL,TO_ROOM); + return; +} + + + +void spell_harm( int sn, int level, CHAR_DATA *ch, void *vo,int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + int dam; + + dam = UMAX( 20, victim->hit - dice(1,4) ); + if ( saves_spell( level, victim,DAM_HARM) ) + dam = UMIN( 50, dam / 2 ); + dam = UMIN( 100, dam ); + damage( ch, victim, dam, sn, DAM_HARM ,TRUE); + return; +} + +/* RT haste spell */ + +void spell_haste( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + AFFECT_DATA af; + + if ( is_affected( victim, sn ) || IS_AFFECTED(victim,AFF_HASTE) + || IS_SET(victim->off_flags,OFF_FAST)) + { + if (victim == ch) + send_to_char("You can't move any faster!\n\r",ch); + else + act("$N is already moving as fast as $E can.", + ch,NULL,victim,TO_CHAR); + return; + } + + if (IS_AFFECTED(victim,AFF_SLOW)) + { + if (!check_dispel(level,victim,skill_lookup("slow"))) + { + if (victim != ch) + send_to_char("Spell failed.\n\r",ch); + send_to_char("You feel momentarily faster.\n\r",victim); + return; + } + act("$n is moving less slowly.",victim,NULL,NULL,TO_ROOM); + return; + } + + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + if (victim == ch) + af.duration = level/2; + else + af.duration = level/4; + af.location = APPLY_DEX; + af.modifier = 1 + (level >= 18) + (level >= 25) + (level >= 32); + af.bitvector = AFF_HASTE; + affect_to_char( victim, &af ); + send_to_char( "You feel yourself moving more quickly.\n\r", victim ); + act("$n is moving more quickly.",victim,NULL,NULL,TO_ROOM); + if ( ch != victim ) + send_to_char( "Ok.\n\r", ch ); + return; +} + + + +void spell_heal( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + victim->hit = UMIN( victim->hit + 100, victim->max_hit ); + update_pos( victim ); + send_to_char( "A warm feeling fills your body.\n\r", victim ); + if ( ch != victim ) + send_to_char( "Ok.\n\r", ch ); + return; +} + +void spell_heat_metal( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + OBJ_DATA *obj_lose, *obj_next; + int dam = 0; + bool fail = TRUE; + + if (!saves_spell(level + 2,victim,DAM_FIRE) + && !IS_SET(victim->imm_flags,IMM_FIRE)) + { + for ( obj_lose = victim->carrying; + obj_lose != NULL; + obj_lose = obj_next) + { + obj_next = obj_lose->next_content; + if ( number_range(1,2 * level) > obj_lose->level + && !saves_spell(level,victim,DAM_FIRE) + && !IS_OBJ_STAT(obj_lose,ITEM_NONMETAL) + && !IS_OBJ_STAT(obj_lose,ITEM_BURN_PROOF)) + { + switch ( obj_lose->item_type ) + { + case ITEM_ARMOR: + if (obj_lose->wear_loc != -1) /* remove the item */ + { + if (can_drop_obj(victim,obj_lose) + && (obj_lose->weight / 10) < + number_range(1,2 * get_curr_stat(victim,STAT_DEX)) + && remove_obj( victim, obj_lose->wear_loc, TRUE )) + { + act("$n yelps and throws $p to the ground!", + victim,obj_lose,NULL,TO_ROOM); + act("You remove and drop $p before it burns you.", + victim,obj_lose,NULL,TO_CHAR); + dam += (number_range(1,obj_lose->level) / 3); + obj_from_char(obj_lose); + obj_to_room(obj_lose, victim->in_room); + fail = FALSE; + } + else /* stuck on the body! ouch! */ + { + act("Your skin is seared by $p!", + victim,obj_lose,NULL,TO_CHAR); + dam += (number_range(1,obj_lose->level)); + fail = FALSE; + } + + } + else /* drop it if we can */ + { + if (can_drop_obj(victim,obj_lose)) + { + act("$n yelps and throws $p to the ground!", + victim,obj_lose,NULL,TO_ROOM); + act("You and drop $p before it burns you.", + victim,obj_lose,NULL,TO_CHAR); + dam += (number_range(1,obj_lose->level) / 6); + obj_from_char(obj_lose); + obj_to_room(obj_lose, victim->in_room); + fail = FALSE; + } + else /* cannot drop */ + { + act("Your skin is seared by $p!", + victim,obj_lose,NULL,TO_CHAR); + dam += (number_range(1,obj_lose->level) / 2); + fail = FALSE; + } + } + break; + case ITEM_WEAPON: + if (obj_lose->wear_loc != -1) /* try to drop it */ + { + if (IS_WEAPON_STAT(obj_lose,WEAPON_FLAMING)) + continue; + + if (can_drop_obj(victim,obj_lose) + && remove_obj(victim,obj_lose->wear_loc,TRUE)) + { + act("$n is burned by $p, and throws it to the ground.", + victim,obj_lose,NULL,TO_ROOM); + send_to_char( + "You throw your red-hot weapon to the ground!\n\r", + victim); + dam += 1; + obj_from_char(obj_lose); + obj_to_room(obj_lose,victim->in_room); + fail = FALSE; + } + else /* YOWCH! */ + { + send_to_char("Your weapon sears your flesh!\n\r", + victim); + dam += number_range(1,obj_lose->level); + fail = FALSE; + } + } + else /* drop it if we can */ + { + if (can_drop_obj(victim,obj_lose)) + { + act("$n throws a burning hot $p to the ground!", + victim,obj_lose,NULL,TO_ROOM); + act("You and drop $p before it burns you.", + victim,obj_lose,NULL,TO_CHAR); + dam += (number_range(1,obj_lose->level) / 6); + obj_from_char(obj_lose); + obj_to_room(obj_lose, victim->in_room); + fail = FALSE; + } + else /* cannot drop */ + { + act("Your skin is seared by $p!", + victim,obj_lose,NULL,TO_CHAR); + dam += (number_range(1,obj_lose->level) / 2); + fail = FALSE; + } + } + break; + } + } + } + } + if (fail) + { + send_to_char("Your spell had no effect.\n\r", ch); + send_to_char("You feel momentarily warmer.\n\r",victim); + } + else /* damage! */ + { + if (saves_spell(level,victim,DAM_FIRE)) + dam = 2 * dam / 3; + damage(ch,victim,dam,sn,DAM_FIRE,TRUE); + } +} + +/* RT really nasty high-level attack spell */ +void spell_holy_word(int sn, int level, CHAR_DATA *ch, void *vo,int target) +{ + CHAR_DATA *vch; + CHAR_DATA *vch_next; + int dam; + int bless_num, curse_num, frenzy_num; + + bless_num = skill_lookup("bless"); + curse_num = skill_lookup("curse"); + frenzy_num = skill_lookup("frenzy"); + + act("$n utters a word of divine power!",ch,NULL,NULL,TO_ROOM); + send_to_char("You utter a word of divine power.\n\r",ch); + + for ( vch = ch->in_room->people; vch != NULL; vch = vch_next ) + { + vch_next = vch->next_in_room; + + if ((IS_GOOD(ch) && IS_GOOD(vch)) || + (IS_EVIL(ch) && IS_EVIL(vch)) || + (IS_NEUTRAL(ch) && IS_NEUTRAL(vch)) ) + { + send_to_char("You feel full more powerful.\n\r",vch); + spell_frenzy(frenzy_num,level,ch,(void *) vch,TARGET_CHAR); + spell_bless(bless_num,level,ch,(void *) vch,TARGET_CHAR); + } + + else if ((IS_GOOD(ch) && IS_EVIL(vch)) || + (IS_EVIL(ch) && IS_GOOD(vch)) ) + { + if (!is_safe_spell(ch,vch,TRUE)) + { + spell_curse(curse_num,level,ch,(void *) vch,TARGET_CHAR); + send_to_char("You are struck down!\n\r",vch); + dam = dice(level,6); + damage(ch,vch,dam,sn,DAM_ENERGY,TRUE); + } + } + + else if (IS_NEUTRAL(ch)) + { + if (!is_safe_spell(ch,vch,TRUE)) + { + spell_curse(curse_num,level/2,ch,(void *) vch,TARGET_CHAR); + send_to_char("You are struck down!\n\r",vch); + dam = dice(level,4); + damage(ch,vch,dam,sn,DAM_ENERGY,TRUE); + } + } + } + + send_to_char("You feel drained.\n\r",ch); + ch->move = 0; + ch->hit /= 2; +} + +void spell_identify( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + OBJ_DATA *obj = (OBJ_DATA *) vo; + char buf[MAX_STRING_LENGTH]; + AFFECT_DATA *paf; + + sprintf( buf, + "Object '%s' is type %s, extra flags %s.\n\rWeight is %d, value is %d, level is %d.\n\r", + + obj->name, + item_name(obj->item_type), + extra_bit_name( obj->extra_flags ), + obj->weight / 10, + obj->cost, + obj->level + ); + send_to_char( buf, ch ); + + switch ( obj->item_type ) + { + case ITEM_SCROLL: + case ITEM_POTION: + case ITEM_PILL: + sprintf( buf, "Level %d spells of:", obj->value[0] ); + send_to_char( buf, ch ); + + if ( obj->value[1] >= 0 && obj->value[1] < MAX_SKILL ) + { + send_to_char( " '", ch ); + send_to_char( skill_table[obj->value[1]].name, ch ); + send_to_char( "'", ch ); + } + + if ( obj->value[2] >= 0 && obj->value[2] < MAX_SKILL ) + { + send_to_char( " '", ch ); + send_to_char( skill_table[obj->value[2]].name, ch ); + send_to_char( "'", ch ); + } + + if ( obj->value[3] >= 0 && obj->value[3] < MAX_SKILL ) + { + send_to_char( " '", ch ); + send_to_char( skill_table[obj->value[3]].name, ch ); + send_to_char( "'", ch ); + } + + if (obj->value[4] >= 0 && obj->value[4] < MAX_SKILL) + { + send_to_char(" '",ch); + send_to_char(skill_table[obj->value[4]].name,ch); + send_to_char("'",ch); + } + + send_to_char( ".\n\r", ch ); + break; + + case ITEM_WAND: + case ITEM_STAFF: + sprintf( buf, "Has %d charges of level %d", + obj->value[2], obj->value[0] ); + send_to_char( buf, ch ); + + if ( obj->value[3] >= 0 && obj->value[3] < MAX_SKILL ) + { + send_to_char( " '", ch ); + send_to_char( skill_table[obj->value[3]].name, ch ); + send_to_char( "'", ch ); + } + + send_to_char( ".\n\r", ch ); + break; + + case ITEM_DRINK_CON: + sprintf(buf,"It holds %s-colored %s.\n\r", + liq_table[obj->value[2]].liq_color, + liq_table[obj->value[2]].liq_name); + send_to_char(buf,ch); + break; + + case ITEM_CONTAINER: + sprintf(buf,"Capacity: %d# Maximum weight: %d# flags: %s\n\r", + obj->value[0], obj->value[3], cont_bit_name(obj->value[1])); + send_to_char(buf,ch); + if (obj->value[4] != 100) + { + sprintf(buf,"Weight multiplier: %d%%\n\r", + obj->value[4]); + send_to_char(buf,ch); + } + 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/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) + sprintf(buf,"Damage is %dd%d (average %d).\n\r", + obj->value[1],obj->value[2], + (1 + obj->value[2]) * obj->value[1] / 2); + else + sprintf( buf, "Damage is %d to %d (average %d).\n\r", + obj->value[1], obj->value[2], + ( obj->value[1] + obj->value[2] ) / 2 ); + send_to_char( buf, ch ); + if (obj->value[4]) /* weapon flags */ + { + sprintf(buf,"Weapons flags: %s\n\r",weapon_bit_name(obj->value[4])); + send_to_char(buf,ch); + } + break; + + case ITEM_ARMOR: + sprintf( buf, + "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] ); + send_to_char( buf, ch ); + break; + } + + if (!obj->enchanted) + for ( paf = obj->pIndexData->affected; paf != NULL; paf = paf->next ) + { + if ( paf->location != APPLY_NONE && paf->modifier != 0 ) + { + sprintf( buf, "Affects %s by %d.\n\r", + affect_loc_name( paf->location ), paf->modifier ); + send_to_char(buf,ch); + if (paf->bitvector) + { + switch(paf->where) + { + case TO_AFFECTS: + sprintf(buf,"Adds %s affect.\n", + affect_bit_name(paf->bitvector)); + break; + case TO_OBJECT: + sprintf(buf,"Adds %s object flag.\n", + extra_bit_name(paf->bitvector)); + break; + case TO_IMMUNE: + sprintf(buf,"Adds immunity to %s.\n", + imm_bit_name(paf->bitvector)); + break; + case TO_RESIST: + sprintf(buf,"Adds resistance to %s.\n\r", + imm_bit_name(paf->bitvector)); + break; + case TO_VULN: + sprintf(buf,"Adds vulnerability to %s.\n\r", + imm_bit_name(paf->bitvector)); + break; + default: + sprintf(buf,"Unknown bit %d: %d\n\r", + paf->where,paf->bitvector); + break; + } + send_to_char( buf, ch ); + } + } + } + + for ( paf = obj->affected; paf != NULL; paf = paf->next ) + { + if ( paf->location != APPLY_NONE && paf->modifier != 0 ) + { + sprintf( buf, "Affects %s by %d", + affect_loc_name( paf->location ), paf->modifier ); + send_to_char( buf, ch ); + if ( paf->duration > -1) + sprintf(buf,", %d hours.\n\r",paf->duration); + else + sprintf(buf,".\n\r"); + send_to_char(buf,ch); + if (paf->bitvector) + { + switch(paf->where) + { + case TO_AFFECTS: + sprintf(buf,"Adds %s affect.\n", + affect_bit_name(paf->bitvector)); + break; + case TO_OBJECT: + sprintf(buf,"Adds %s object flag.\n", + extra_bit_name(paf->bitvector)); + break; + case TO_WEAPON: + sprintf(buf,"Adds %s weapon flags.\n", + weapon_bit_name(paf->bitvector)); + break; + case TO_IMMUNE: + sprintf(buf,"Adds immunity to %s.\n", + imm_bit_name(paf->bitvector)); + break; + case TO_RESIST: + sprintf(buf,"Adds resistance to %s.\n\r", + imm_bit_name(paf->bitvector)); + break; + case TO_VULN: + sprintf(buf,"Adds vulnerability to %s.\n\r", + imm_bit_name(paf->bitvector)); + break; + default: + sprintf(buf,"Unknown bit %d: %d\n\r", + paf->where,paf->bitvector); + break; + } + send_to_char(buf,ch); + } + } + } + + return; +} + + + +void spell_infravision( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + AFFECT_DATA af; + + if ( IS_AFFECTED(victim, AFF_INFRARED) ) + { + if (victim == ch) + send_to_char("You can already see in the dark.\n\r",ch); + else + act("$N already has infravision.\n\r",ch,NULL,victim,TO_CHAR); + return; + } + act( "$n's eyes glow red.\n\r", ch, NULL, NULL, TO_ROOM ); + + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.duration = 2 * level; + af.location = APPLY_NONE; + af.modifier = 0; + af.bitvector = AFF_INFRARED; + affect_to_char( victim, &af ); + send_to_char( "Your eyes glow red.\n\r", victim ); + return; +} + + + +void spell_invis( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim; + OBJ_DATA *obj; + AFFECT_DATA af; + + /* object invisibility */ + if (target == TARGET_OBJ) + { + obj = (OBJ_DATA *) vo; + + if (IS_OBJ_STAT(obj,ITEM_INVIS)) + { + act("$p is already invisible.",ch,obj,NULL,TO_CHAR); + return; + } + + af.where = TO_OBJECT; + af.type = sn; + af.level = level; + af.duration = level + 12; + af.location = APPLY_NONE; + af.modifier = 0; + af.bitvector = ITEM_INVIS; + affect_to_obj(obj,&af); + + act("$p fades out of sight.",ch,obj,NULL,TO_ALL); + return; + } + + /* character invisibility */ + victim = (CHAR_DATA *) vo; + + if ( IS_AFFECTED(victim, AFF_INVISIBLE) ) + return; + + act( "$n fades out of existence.", victim, NULL, NULL, TO_ROOM ); + + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.duration = level + 12; + af.location = APPLY_NONE; + af.modifier = 0; + af.bitvector = AFF_INVISIBLE; + affect_to_char( victim, &af ); + send_to_char( "You fade out of existence.\n\r", victim ); + return; +} + + + +void spell_know_alignment(int sn,int level,CHAR_DATA *ch,void *vo,int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + char *msg; + int ap; + + ap = victim->alignment; + + if ( ap > 700 ) msg = "$N has a pure and good aura."; + else if ( ap > 350 ) msg = "$N is of excellent moral character."; + else if ( ap > 100 ) msg = "$N is often kind and thoughtful."; + else if ( ap > -100 ) msg = "$N doesn't have a firm moral commitment."; + else if ( ap > -350 ) msg = "$N lies to $S friends."; + else if ( ap > -700 ) msg = "$N is a black-hearted murderer."; + else msg = "$N is the embodiment of pure evil!."; + + act( msg, ch, NULL, victim, TO_CHAR ); + return; +} + + + +void spell_lightning_bolt(int sn,int level,CHAR_DATA *ch,void *vo,int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + static const sh_int dam_each[] = + { + 0, + 0, 0, 0, 0, 0, 0, 0, 0, 25, 28, + 31, 34, 37, 40, 40, 41, 42, 42, 43, 44, + 44, 45, 46, 46, 47, 48, 48, 49, 50, 50, + 51, 52, 52, 53, 54, 54, 55, 56, 56, 57, + 58, 58, 59, 60, 60, 61, 62, 62, 63, 64 + }; + int dam; + + level = UMIN(level, sizeof(dam_each)/sizeof(dam_each[0]) - 1); + level = UMAX(0, level); + dam = number_range( dam_each[level] / 2, dam_each[level] * 2 ); + if ( saves_spell( level, victim,DAM_LIGHTNING) ) + dam /= 2; + damage( ch, victim, dam, sn, DAM_LIGHTNING ,TRUE); + return; +} + + + +void spell_locate_object( int sn, int level, CHAR_DATA *ch, void *vo,int target) +{ + char buf[MAX_INPUT_LENGTH]; + BUFFER *buffer; + OBJ_DATA *obj; + OBJ_DATA *in_obj; + bool found; + int number = 0, max_found; + + found = FALSE; + number = 0; + max_found = IS_IMMORTAL(ch) ? 200 : 2 * level; + + buffer = new_buf(); + + for ( obj = object_list; obj != NULL; obj = obj->next ) + { + if ( !can_see_obj( ch, obj ) || !is_name( target_name, obj->name ) + || IS_OBJ_STAT(obj,ITEM_NOLOCATE) || number_percent() > 2 * level + || ch->level < obj->level) + continue; + + 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)) + { + sprintf( buf, "one is carried by %s\n\r", + PERS(in_obj->carried_by, ch) ); + } + else + { + if (IS_IMMORTAL(ch) && in_obj->in_room != NULL) + sprintf( buf, "one is in %s [Room %d]\n\r", + in_obj->in_room->name, in_obj->in_room->vnum); + else + sprintf( buf, "one is in %s\n\r", + in_obj->in_room == NULL + ? "somewhere" : in_obj->in_room->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); + + return; +} + + + +void spell_magic_missile( int sn, int level, CHAR_DATA *ch,void *vo,int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + static const sh_int dam_each[] = + { + 0, + 3, 3, 4, 4, 5, 6, 6, 6, 6, 6, + 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, + 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, + 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, + 13, 13, 13, 13, 13, 14, 14, 14, 14, 14 + }; + int dam; + + level = UMIN(level, sizeof(dam_each)/sizeof(dam_each[0]) - 1); + level = UMAX(0, level); + dam = number_range( dam_each[level] / 2, dam_each[level] * 2 ); + if ( saves_spell( level, victim,DAM_ENERGY) ) + dam /= 2; + damage( ch, victim, dam, sn, DAM_ENERGY ,TRUE); + return; +} + +void spell_mass_healing(int sn, int level, CHAR_DATA *ch, void *vo, int target) +{ + CHAR_DATA *gch; + int heal_num, refresh_num; + + heal_num = skill_lookup("heal"); + refresh_num = skill_lookup("refresh"); + + for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room ) + { + if ((IS_NPC(ch) && IS_NPC(gch)) || + (!IS_NPC(ch) && !IS_NPC(gch))) + { + spell_heal(heal_num,level,ch,(void *) gch,TARGET_CHAR); + spell_refresh(refresh_num,level,ch,(void *) gch,TARGET_CHAR); + } + } +} + + +void spell_mass_invis( int sn, int level, CHAR_DATA *ch, void *vo, int target ) +{ + AFFECT_DATA af; + CHAR_DATA *gch; + + for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room ) + { + if ( !is_same_group( gch, ch ) || IS_AFFECTED(gch, AFF_INVISIBLE) ) + continue; + act( "$n slowly fades out of existence.", gch, NULL, NULL, TO_ROOM ); + send_to_char( "You slowly fade out of existence.\n\r", gch ); + + af.where = TO_AFFECTS; + af.type = sn; + af.level = level/2; + af.duration = 24; + af.location = APPLY_NONE; + af.modifier = 0; + af.bitvector = AFF_INVISIBLE; + affect_to_char( gch, &af ); + } + send_to_char( "Ok.\n\r", ch ); + + return; +} + + + +void spell_null( int sn, int level, CHAR_DATA *ch, void *vo, int target ) +{ + send_to_char( "That's not a spell!\n\r", ch ); + return; +} + + + +void spell_pass_door( int sn, int level, CHAR_DATA *ch, void *vo, int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + AFFECT_DATA af; + + if ( IS_AFFECTED(victim, AFF_PASS_DOOR) ) + { + if (victim == ch) + send_to_char("You are already out of phase.\n\r",ch); + else + act("$N is already shifted out of phase.",ch,NULL,victim,TO_CHAR); + return; + } + + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.duration = number_fuzzy( level / 4 ); + af.location = APPLY_NONE; + af.modifier = 0; + af.bitvector = AFF_PASS_DOOR; + affect_to_char( victim, &af ); + act( "$n turns translucent.", victim, NULL, NULL, TO_ROOM ); + send_to_char( "You turn translucent.\n\r", victim ); + return; +} + +/* RT plague spell, very nasty */ + +void spell_plague( int sn, int level, CHAR_DATA *ch, void *vo, int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + AFFECT_DATA af; + + if (saves_spell(level,victim,DAM_DISEASE) || + (IS_NPC(victim) && IS_SET(victim->act,ACT_UNDEAD))) + { + if (ch == victim) + send_to_char("You feel momentarily ill, but it passes.\n\r",ch); + else + act("$N seems to be unaffected.",ch,NULL,victim,TO_CHAR); + return; + } + + af.where = TO_AFFECTS; + af.type = sn; + af.level = level * 3/4; + af.duration = level; + af.location = APPLY_STR; + af.modifier = -5; + af.bitvector = AFF_PLAGUE; + affect_join(victim,&af); + + send_to_char + ("You scream in agony as plague sores erupt from your skin.\n\r",victim); + act("$n screams in agony as plague sores erupt from $s skin.", + victim,NULL,NULL,TO_ROOM); +} + +void spell_poison( int sn, int level, CHAR_DATA *ch, void *vo, int target ) +{ + CHAR_DATA *victim; + OBJ_DATA *obj; + AFFECT_DATA af; + + + if (target == TARGET_OBJ) + { + obj = (OBJ_DATA *) vo; + + if (obj->item_type == ITEM_FOOD || obj->item_type == ITEM_DRINK_CON) + { + if (IS_OBJ_STAT(obj,ITEM_BLESS) || IS_OBJ_STAT(obj,ITEM_BURN_PROOF)) + { + act("Your spell fails to corrupt $p.",ch,obj,NULL,TO_CHAR); + return; + } + obj->value[3] = 1; + act("$p is infused with poisonous vapors.",ch,obj,NULL,TO_ALL); + return; + } + + if (obj->item_type == ITEM_WEAPON) + { + if (IS_WEAPON_STAT(obj,WEAPON_FLAMING) + || IS_WEAPON_STAT(obj,WEAPON_FROST) + || IS_WEAPON_STAT(obj,WEAPON_VAMPIRIC) + || IS_WEAPON_STAT(obj,WEAPON_SHARP) + || IS_WEAPON_STAT(obj,WEAPON_VORPAL) + || IS_WEAPON_STAT(obj,WEAPON_SHOCKING) + || IS_OBJ_STAT(obj,ITEM_BLESS) || IS_OBJ_STAT(obj,ITEM_BURN_PROOF)) + { + act("You can't seem to envenom $p.",ch,obj,NULL,TO_CHAR); + return; + } + + if (IS_WEAPON_STAT(obj,WEAPON_POISON)) + { + act("$p is already envenomed.",ch,obj,NULL,TO_CHAR); + return; + } + + af.where = TO_WEAPON; + af.type = sn; + af.level = level / 2; + af.duration = level/8; + af.location = 0; + af.modifier = 0; + af.bitvector = WEAPON_POISON; + affect_to_obj(obj,&af); + + act("$p is coated with deadly venom.",ch,obj,NULL,TO_ALL); + return; + } + + act("You can't poison $p.",ch,obj,NULL,TO_CHAR); + return; + } + + victim = (CHAR_DATA *) vo; + + if ( saves_spell( level, victim,DAM_POISON) ) + { + act("$n turns slightly green, but it passes.",victim,NULL,NULL,TO_ROOM); + send_to_char("You feel momentarily ill, but it passes.\n\r",victim); + return; + } + + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.duration = level; + af.location = APPLY_STR; + af.modifier = -2; + af.bitvector = AFF_POISON; + affect_join( victim, &af ); + send_to_char( "You feel very sick.\n\r", victim ); + act("$n looks very ill.",victim,NULL,NULL,TO_ROOM); + return; +} + + + +void spell_protection_evil(int sn,int level,CHAR_DATA *ch,void *vo, int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + AFFECT_DATA af; + + if ( IS_AFFECTED(victim, AFF_PROTECT_EVIL) + || IS_AFFECTED(victim, AFF_PROTECT_GOOD)) + { + if (victim == ch) + send_to_char("You are already protected.\n\r",ch); + else + act("$N is already protected.",ch,NULL,victim,TO_CHAR); + return; + } + + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.duration = 24; + af.location = APPLY_SAVING_SPELL; + af.modifier = -1; + af.bitvector = AFF_PROTECT_EVIL; + affect_to_char( victim, &af ); + send_to_char( "You feel holy and pure.\n\r", victim ); + if ( ch != victim ) + act("$N is protected from evil.",ch,NULL,victim,TO_CHAR); + return; +} + +void spell_protection_good(int sn,int level,CHAR_DATA *ch,void *vo,int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + AFFECT_DATA af; + + if ( IS_AFFECTED(victim, AFF_PROTECT_GOOD) + || IS_AFFECTED(victim, AFF_PROTECT_EVIL)) + { + if (victim == ch) + send_to_char("You are already protected.\n\r",ch); + else + act("$N is already protected.",ch,NULL,victim,TO_CHAR); + return; + } + + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.duration = 24; + af.location = APPLY_SAVING_SPELL; + af.modifier = -1; + af.bitvector = AFF_PROTECT_GOOD; + affect_to_char( victim, &af ); + send_to_char( "You feel aligned with darkness.\n\r", victim ); + if ( ch != victim ) + act("$N is protected from good.",ch,NULL,victim,TO_CHAR); + return; +} + + +void spell_ray_of_truth (int sn, int level, CHAR_DATA *ch, void *vo,int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + int dam, align; + + if (IS_EVIL(ch) ) + { + victim = ch; + send_to_char("The energy explodes inside you!\n\r",ch); + } + + if (victim != ch) + { + act("$n raises $s hand, and a blinding ray of light shoots forth!", + ch,NULL,NULL,TO_ROOM); + send_to_char( + "You raise your hand and a blinding ray of light shoots forth!\n\r", + ch); + } + + if (IS_GOOD(victim)) + { + act("$n seems unharmed by the light.",victim,NULL,victim,TO_ROOM); + send_to_char("The light seems powerless to affect you.\n\r",victim); + return; + } + + dam = dice( level, 10 ); + if ( saves_spell( level, victim,DAM_HOLY) ) + dam /= 2; + + align = victim->alignment; + align -= 350; + + if (align < -1000) + align = -1000 + (align + 1000) / 3; + + dam = (dam * align * align) / 1000000; + + damage( ch, victim, dam, sn, DAM_HOLY ,TRUE); + spell_blindness(gsn_blindness, + 3 * level / 4, ch, (void *) victim,TARGET_CHAR); +} + + +void spell_recharge( int sn, int level, CHAR_DATA *ch, void *vo,int target) +{ + OBJ_DATA *obj = (OBJ_DATA *) vo; + int chance, percent; + + if (obj->item_type != ITEM_WAND && obj->item_type != ITEM_STAFF) + { + send_to_char("That item does not carry charges.\n\r",ch); + return; + } + + if (obj->value[3] >= 3 * level / 2) + { + send_to_char("Your skills are not great enough for that.\n\r",ch); + return; + } + + if (obj->value[1] == 0) + { + send_to_char("That item has already been recharged once.\n\r",ch); + return; + } + + chance = 40 + 2 * level; + + chance -= obj->value[3]; /* harder to do high-level spells */ + chance -= (obj->value[1] - obj->value[2]) * + (obj->value[1] - obj->value[2]); + + chance = UMAX(level/2,chance); + + percent = number_percent(); + + if (percent < chance / 2) + { + act("$p glows softly.",ch,obj,NULL,TO_CHAR); + act("$p glows softly.",ch,obj,NULL,TO_ROOM); + obj->value[2] = UMAX(obj->value[1],obj->value[2]); + obj->value[1] = 0; + return; + } + + else if (percent <= chance) + { + int chargeback,chargemax; + + act("$p glows softly.",ch,obj,NULL,TO_CHAR); + act("$p glows softly.",ch,obj,NULL,TO_CHAR); + + chargemax = obj->value[1] - obj->value[2]; + + if (chargemax > 0) + chargeback = UMAX(1,chargemax * percent / 100); + else + chargeback = 0; + + obj->value[2] += chargeback; + obj->value[1] = 0; + return; + } + + else if (percent <= UMIN(95, 3 * chance / 2)) + { + send_to_char("Nothing seems to happen.\n\r",ch); + if (obj->value[1] > 1) + obj->value[1]--; + return; + } + + else /* whoops! */ + { + act("$p glows brightly and explodes!",ch,obj,NULL,TO_CHAR); + act("$p glows brightly and explodes!",ch,obj,NULL,TO_ROOM); + extract_obj(obj); + } +} + +void spell_refresh( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + victim->move = UMIN( victim->move + level, victim->max_move ); + if (victim->max_move == victim->move) + send_to_char("You feel fully refreshed!\n\r",victim); + else + send_to_char( "You feel less tired.\n\r", victim ); + if ( ch != victim ) + send_to_char( "Ok.\n\r", ch ); + return; +} + +void spell_remove_curse( int sn, int level, CHAR_DATA *ch, void *vo,int target) +{ + CHAR_DATA *victim; + OBJ_DATA *obj; + bool found = FALSE; + + /* do object cases first */ + if (target == TARGET_OBJ) + { + obj = (OBJ_DATA *) vo; + + if (IS_OBJ_STAT(obj,ITEM_NODROP) || IS_OBJ_STAT(obj,ITEM_NOREMOVE)) + { + if (!IS_OBJ_STAT(obj,ITEM_NOUNCURSE) + && !saves_dispel(level + 2,obj->level,0)) + { + REMOVE_BIT(obj->extra_flags,ITEM_NODROP); + REMOVE_BIT(obj->extra_flags,ITEM_NOREMOVE); + act("$p glows blue.",ch,obj,NULL,TO_ALL); + return; + } + + act("The curse on $p is beyond your power.",ch,obj,NULL,TO_CHAR); + return; + } + act("There doesn't seem to be a curse on $p.",ch,obj,NULL,TO_CHAR); + return; + } + + /* characters */ + victim = (CHAR_DATA *) vo; + + if (check_dispel(level,victim,gsn_curse)) + { + send_to_char("You feel better.\n\r",victim); + act("$n looks more relaxed.",victim,NULL,NULL,TO_ROOM); + } + + for (obj = victim->carrying; (obj != NULL && !found); obj = obj->next_content) + { + if ((IS_OBJ_STAT(obj,ITEM_NODROP) || IS_OBJ_STAT(obj,ITEM_NOREMOVE)) + && !IS_OBJ_STAT(obj,ITEM_NOUNCURSE)) + { /* attempt to remove curse */ + if (!saves_dispel(level,obj->level,0)) + { + found = TRUE; + REMOVE_BIT(obj->extra_flags,ITEM_NODROP); + REMOVE_BIT(obj->extra_flags,ITEM_NOREMOVE); + act("Your $p glows blue.",victim,obj,NULL,TO_CHAR); + act("$n's $p glows blue.",victim,obj,NULL,TO_ROOM); + } + } + } +} + +void spell_sanctuary( int sn, int level, CHAR_DATA *ch, void *vo,int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + AFFECT_DATA af; + + if ( IS_AFFECTED(victim, AFF_SANCTUARY) ) + { + if (victim == ch) + send_to_char("You are already in sanctuary.\n\r",ch); + else + act("$N is already in sanctuary.",ch,NULL,victim,TO_CHAR); + return; + } + + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.duration = level / 6; + af.location = APPLY_NONE; + af.modifier = 0; + af.bitvector = AFF_SANCTUARY; + affect_to_char( victim, &af ); + act( "$n is surrounded by a white aura.", victim, NULL, NULL, TO_ROOM ); + send_to_char( "You are surrounded by a white aura.\n\r", victim ); + return; +} + + + +void spell_shield( int sn, int level, CHAR_DATA *ch, void *vo,int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + AFFECT_DATA af; + + if ( is_affected( victim, sn ) ) + { + if (victim == ch) + send_to_char("You are already shielded from harm.\n\r",ch); + else + act("$N is already protected by a shield.",ch,NULL,victim,TO_CHAR); + return; + } + + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.duration = 8 + level; + af.location = APPLY_AC; + af.modifier = -20; + af.bitvector = 0; + affect_to_char( victim, &af ); + act( "$n is surrounded by a force shield.", victim, NULL, NULL, TO_ROOM ); + send_to_char( "You are surrounded by a force shield.\n\r", victim ); + return; +} + + + +void spell_shocking_grasp(int sn,int level,CHAR_DATA *ch,void *vo,int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + static const int dam_each[] = + { + 0, + 0, 0, 0, 0, 0, 0, 20, 25, 29, 33, + 36, 39, 39, 39, 40, 40, 41, 41, 42, 42, + 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, + 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, + 53, 53, 54, 54, 55, 55, 56, 56, 57, 57 + }; + int dam; + + level = UMIN(level, sizeof(dam_each)/sizeof(dam_each[0]) - 1); + level = UMAX(0, level); + dam = number_range( dam_each[level] / 2, dam_each[level] * 2 ); + if ( saves_spell( level, victim,DAM_LIGHTNING) ) + dam /= 2; + damage( ch, victim, dam, sn, DAM_LIGHTNING ,TRUE); + return; +} + + + +void spell_sleep( int sn, int level, CHAR_DATA *ch, void *vo,int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + AFFECT_DATA af; + + if ( IS_AFFECTED(victim, AFF_SLEEP) + || (IS_NPC(victim) && IS_SET(victim->act,ACT_UNDEAD)) + || (level + 2) < victim->level + || saves_spell( level-4, victim,DAM_CHARM) ) + return; + + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.duration = 4 + level; + af.location = APPLY_NONE; + af.modifier = 0; + af.bitvector = AFF_SLEEP; + affect_join( victim, &af ); + + if ( IS_AWAKE(victim) ) + { + send_to_char( "You feel very sleepy ..... zzzzzz.\n\r", victim ); + act( "$n goes to sleep.", victim, NULL, NULL, TO_ROOM ); + victim->position = POS_SLEEPING; + } + return; +} + +void spell_slow( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + AFFECT_DATA af; + + if ( is_affected( victim, sn ) || IS_AFFECTED(victim,AFF_SLOW)) + { + if (victim == ch) + send_to_char("You can't move any slower!\n\r",ch); + else + act("$N can't get any slower than that.", + ch,NULL,victim,TO_CHAR); + return; + } + + if (saves_spell(level,victim,DAM_OTHER) + || IS_SET(victim->imm_flags,IMM_MAGIC)) + { + if (victim != ch) + send_to_char("Nothing seemed to happen.\n\r",ch); + send_to_char("You feel momentarily lethargic.\n\r",victim); + return; + } + + if (IS_AFFECTED(victim,AFF_HASTE)) + { + if (!check_dispel(level,victim,skill_lookup("haste"))) + { + if (victim != ch) + send_to_char("Spell failed.\n\r",ch); + send_to_char("You feel momentarily slower.\n\r",victim); + return; + } + + act("$n is moving less quickly.",victim,NULL,NULL,TO_ROOM); + return; + } + + + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.duration = level/2; + af.location = APPLY_DEX; + af.modifier = -1 - (level >= 18) - (level >= 25) - (level >= 32); + af.bitvector = AFF_SLOW; + affect_to_char( victim, &af ); + send_to_char( "You feel yourself slowing d o w n...\n\r", victim ); + act("$n starts to move in slow motion.",victim,NULL,NULL,TO_ROOM); + return; +} + + + + +void spell_stone_skin( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + AFFECT_DATA af; + + if ( is_affected( ch, sn ) ) + { + if (victim == ch) + send_to_char("Your skin is already as hard as a rock.\n\r",ch); + else + act("$N is already as hard as can be.",ch,NULL,victim,TO_CHAR); + return; + } + + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.duration = level; + af.location = APPLY_AC; + af.modifier = -40; + af.bitvector = 0; + affect_to_char( victim, &af ); + act( "$n's skin turns to stone.", victim, NULL, NULL, TO_ROOM ); + send_to_char( "Your skin turns to stone.\n\r", victim ); + return; +} + + + +void spell_summon( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim; + + if ( ( victim = get_char_world( ch, target_name ) ) == NULL + || victim == ch + || victim->in_room == NULL + || IS_SET(ch->in_room->room_flags, ROOM_SAFE) + || IS_SET(victim->in_room->room_flags, ROOM_SAFE) + || IS_SET(victim->in_room->room_flags, ROOM_PRIVATE) + || IS_SET(victim->in_room->room_flags, ROOM_SOLITARY) + || IS_SET(victim->in_room->room_flags, ROOM_NO_RECALL) + || (IS_NPC(victim) && IS_SET(victim->act,ACT_AGGRESSIVE)) + || victim->level >= level + 3 + || (!IS_NPC(victim) && victim->level >= LEVEL_IMMORTAL) + || victim->fighting != NULL + || (IS_NPC(victim) && IS_SET(victim->imm_flags,IMM_SUMMON)) + || (IS_NPC(victim) && victim->pIndexData->pShop != NULL) + || (!IS_NPC(victim) && IS_SET(victim->act,PLR_NOSUMMON)) + || (IS_NPC(victim) && saves_spell( level, victim,DAM_OTHER)) ) + + { + send_to_char( "You failed.\n\r", ch ); + return; + } + + act( "$n disappears suddenly.", victim, NULL, NULL, TO_ROOM ); + char_from_room( victim ); + char_to_room( victim, ch->in_room ); + act( "$n arrives suddenly.", victim, NULL, NULL, TO_ROOM ); + act( "$n has summoned you!", ch, NULL, victim, TO_VICT ); + do_function(victim, &do_look, "auto" ); + return; +} + + + +void spell_teleport( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + ROOM_INDEX_DATA *pRoomIndex; + + if ( victim->in_room == NULL + || IS_SET(victim->in_room->room_flags, ROOM_NO_RECALL) + || ( victim != ch && IS_SET(victim->imm_flags,IMM_SUMMON)) + || ( !IS_NPC(ch) && victim->fighting != NULL ) + || ( victim != ch + && ( saves_spell( level - 5, victim,DAM_OTHER)))) + { + send_to_char( "You failed.\n\r", ch ); + return; + } + + pRoomIndex = get_random_room(victim); + + if (victim != ch) + send_to_char("You have been teleported!\n\r",victim); + + act( "$n vanishes!", victim, NULL, NULL, TO_ROOM ); + char_from_room( victim ); + char_to_room( victim, pRoomIndex ); + act( "$n slowly fades into existence.", victim, NULL, NULL, TO_ROOM ); + do_function(victim, &do_look, "auto" ); + return; +} + + + +void spell_ventriloquate( int sn, int level, CHAR_DATA *ch,void *vo,int target) +{ + char buf1[MAX_STRING_LENGTH]; + char buf2[MAX_STRING_LENGTH]; + char speaker[MAX_INPUT_LENGTH]; + CHAR_DATA *vch; + + target_name = one_argument( target_name, speaker ); + + sprintf( buf1, "%s says '%s'.\n\r", speaker, target_name ); + sprintf( buf2, "Someone makes %s say '%s'.\n\r", speaker, target_name ); + buf1[0] = UPPER(buf1[0]); + + for ( vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room ) + { + if (!is_exact_name( speaker, vch->name) && IS_AWAKE(vch)) + send_to_char( saves_spell(level,vch,DAM_OTHER) ? buf2 : buf1, vch ); + } + + return; +} + + + +void spell_weaken( int sn, int level, CHAR_DATA *ch, void *vo,int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + AFFECT_DATA af; + + if ( is_affected( victim, sn ) || saves_spell( level, victim,DAM_OTHER) ) + return; + + af.where = TO_AFFECTS; + af.type = sn; + af.level = level; + af.duration = level / 2; + af.location = APPLY_STR; + af.modifier = -1 * (level / 5); + af.bitvector = AFF_WEAKEN; + affect_to_char( victim, &af ); + send_to_char( "You feel your strength slip away.\n\r", victim ); + act("$n looks tired and weak.",victim,NULL,NULL,TO_ROOM); + return; +} + + + +/* RT recall spell is back */ + +void spell_word_of_recall( int sn, int level, CHAR_DATA *ch,void *vo,int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + ROOM_INDEX_DATA *location; + + if (IS_NPC(victim)) + return; + + if ((location = get_room_index( ROOM_VNUM_TEMPLE)) == NULL) + { + send_to_char("You are completely lost.\n\r",victim); + return; + } + + if (IS_SET(victim->in_room->room_flags,ROOM_NO_RECALL) || + IS_AFFECTED(victim,AFF_CURSE)) + { + send_to_char("Spell failed.\n\r",victim); + return; + } + + if (victim->fighting != NULL) + stop_fighting(victim,TRUE); + + ch->move /= 2; + act("$n disappears.",victim,NULL,NULL,TO_ROOM); + char_from_room(victim); + char_to_room(victim,location); + act("$n appears in the room.",victim,NULL,NULL,TO_ROOM); + do_function(victim, &do_look, "auto"); +} + +/* + * NPC spells. + */ +void spell_acid_breath( int sn, int level, CHAR_DATA *ch, void *vo,int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + int dam,hp_dam,dice_dam,hpch; + + act("$n spits acid at $N.",ch,NULL,victim,TO_NOTVICT); + act("$n spits a stream of corrosive acid at you.",ch,NULL,victim,TO_VICT); + act("You spit acid at $N.",ch,NULL,victim,TO_CHAR); + + hpch = UMAX(12,ch->hit); + hp_dam = number_range(hpch/11 + 1, hpch/6); + dice_dam = dice(level,16); + + dam = UMAX(hp_dam + dice_dam/10,dice_dam + hp_dam/10); + + if (saves_spell(level,victim,DAM_ACID)) + { + acid_effect(victim,level/2,dam/4,TARGET_CHAR); + damage(ch,victim,dam/2,sn,DAM_ACID,TRUE); + } + else + { + acid_effect(victim,level,dam,TARGET_CHAR); + damage(ch,victim,dam,sn,DAM_ACID,TRUE); + } +} + + + +void spell_fire_breath( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + CHAR_DATA *vch, *vch_next; + int dam,hp_dam,dice_dam; + int hpch; + + act("$n breathes forth a cone of fire.",ch,NULL,victim,TO_NOTVICT); + act("$n breathes a cone of hot fire over you!",ch,NULL,victim,TO_VICT); + act("You breath forth a cone of fire.",ch,NULL,NULL,TO_CHAR); + + hpch = UMAX( 10, ch->hit ); + hp_dam = number_range( hpch/9+1, hpch/5 ); + dice_dam = dice(level,20); + + dam = UMAX(hp_dam + dice_dam /10, dice_dam + hp_dam / 10); + fire_effect(victim->in_room,level,dam/2,TARGET_ROOM); + + for (vch = victim->in_room->people; vch != NULL; vch = vch_next) + { + vch_next = vch->next_in_room; + + if (is_safe_spell(ch,vch,TRUE) + || (IS_NPC(vch) && IS_NPC(ch) + && (ch->fighting != vch || vch->fighting != ch))) + continue; + + if (vch == victim) /* full damage */ + { + if (saves_spell(level,vch,DAM_FIRE)) + { + fire_effect(vch,level/2,dam/4,TARGET_CHAR); + damage(ch,vch,dam/2,sn,DAM_FIRE,TRUE); + } + else + { + fire_effect(vch,level,dam,TARGET_CHAR); + damage(ch,vch,dam,sn,DAM_FIRE,TRUE); + } + } + else /* partial damage */ + { + if (saves_spell(level - 2,vch,DAM_FIRE)) + { + fire_effect(vch,level/4,dam/8,TARGET_CHAR); + damage(ch,vch,dam/4,sn,DAM_FIRE,TRUE); + } + else + { + fire_effect(vch,level/2,dam/4,TARGET_CHAR); + damage(ch,vch,dam/2,sn,DAM_FIRE,TRUE); + } + } + } +} + +void spell_frost_breath( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + CHAR_DATA *vch, *vch_next; + int dam,hp_dam,dice_dam, hpch; + + act("$n breathes out a freezing cone of frost!",ch,NULL,victim,TO_NOTVICT); + act("$n breathes a freezing cone of frost over you!", + ch,NULL,victim,TO_VICT); + act("You breath out a cone of frost.",ch,NULL,NULL,TO_CHAR); + + hpch = UMAX(12,ch->hit); + hp_dam = number_range(hpch/11 + 1, hpch/6); + dice_dam = dice(level,16); + + dam = UMAX(hp_dam + dice_dam/10,dice_dam + hp_dam/10); + cold_effect(victim->in_room,level,dam/2,TARGET_ROOM); + + for (vch = victim->in_room->people; vch != NULL; vch = vch_next) + { + vch_next = vch->next_in_room; + + if (is_safe_spell(ch,vch,TRUE) + || (IS_NPC(vch) && IS_NPC(ch) + && (ch->fighting != vch || vch->fighting != ch))) + continue; + + if (vch == victim) /* full damage */ + { + if (saves_spell(level,vch,DAM_COLD)) + { + cold_effect(vch,level/2,dam/4,TARGET_CHAR); + damage(ch,vch,dam/2,sn,DAM_COLD,TRUE); + } + else + { + cold_effect(vch,level,dam,TARGET_CHAR); + damage(ch,vch,dam,sn,DAM_COLD,TRUE); + } + } + else + { + if (saves_spell(level - 2,vch,DAM_COLD)) + { + cold_effect(vch,level/4,dam/8,TARGET_CHAR); + damage(ch,vch,dam/4,sn,DAM_COLD,TRUE); + } + else + { + cold_effect(vch,level/2,dam/4,TARGET_CHAR); + damage(ch,vch,dam/2,sn,DAM_COLD,TRUE); + } + } + } +} + + +void spell_gas_breath( int sn, int level, CHAR_DATA *ch, void *vo,int target ) +{ + CHAR_DATA *vch; + CHAR_DATA *vch_next; + int dam,hp_dam,dice_dam,hpch; + + act("$n breathes out a cloud of poisonous gas!",ch,NULL,NULL,TO_ROOM); + act("You breath out a cloud of poisonous gas.",ch,NULL,NULL,TO_CHAR); + + hpch = UMAX(16,ch->hit); + hp_dam = number_range(hpch/15+1,8); + dice_dam = dice(level,12); + + dam = UMAX(hp_dam + dice_dam/10,dice_dam + hp_dam/10); + poison_effect(ch->in_room,level,dam,TARGET_ROOM); + + for (vch = ch->in_room->people; vch != NULL; vch = vch_next) + { + vch_next = vch->next_in_room; + + if (is_safe_spell(ch,vch,TRUE) + || (IS_NPC(ch) && IS_NPC(vch) + && (ch->fighting == vch || vch->fighting == ch))) + continue; + + if (saves_spell(level,vch,DAM_POISON)) + { + poison_effect(vch,level/2,dam/4,TARGET_CHAR); + damage(ch,vch,dam/2,sn,DAM_POISON,TRUE); + } + else + { + poison_effect(vch,level,dam,TARGET_CHAR); + damage(ch,vch,dam,sn,DAM_POISON,TRUE); + } + } +} + +void spell_lightning_breath(int sn,int level,CHAR_DATA *ch,void *vo,int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + int dam,hp_dam,dice_dam,hpch; + + act("$n breathes a bolt of lightning at $N.",ch,NULL,victim,TO_NOTVICT); + act("$n breathes a bolt of lightning at you!",ch,NULL,victim,TO_VICT); + act("You breathe a bolt of lightning at $N.",ch,NULL,victim,TO_CHAR); + + hpch = UMAX(10,ch->hit); + hp_dam = number_range(hpch/9+1,hpch/5); + dice_dam = dice(level,20); + + dam = UMAX(hp_dam + dice_dam/10,dice_dam + hp_dam/10); + + if (saves_spell(level,victim,DAM_LIGHTNING)) + { + shock_effect(victim,level/2,dam/4,TARGET_CHAR); + damage(ch,victim,dam/2,sn,DAM_LIGHTNING,TRUE); + } + else + { + shock_effect(victim,level,dam,TARGET_CHAR); + damage(ch,victim,dam,sn,DAM_LIGHTNING,TRUE); + } +} + +/* + * Spells for mega1.are from Glop/Erkenbrand. + */ +void spell_general_purpose(int sn,int level,CHAR_DATA *ch,void *vo,int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + int dam; + + dam = number_range( 25, 100 ); + if ( saves_spell( level, victim, DAM_PIERCE) ) + dam /= 2; + damage( ch, victim, dam, sn, DAM_PIERCE ,TRUE); + return; +} + +void spell_high_explosive(int sn,int level,CHAR_DATA *ch,void *vo,int target) +{ + CHAR_DATA *victim = (CHAR_DATA *) vo; + int dam; + + dam = number_range( 30, 120 ); + if ( saves_spell( level, victim, DAM_PIERCE) ) + dam /= 2; + damage( ch, victim, dam, sn, DAM_PIERCE ,TRUE); + return; +} diff --git a/Rom24/src/magic.h b/Rom24/src/magic.h new file mode 100644 index 0000000..240e310 --- /dev/null +++ b/Rom24/src/magic.h @@ -0,0 +1,130 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + + +/* + * Spell functions. + * Defined in magic.c. + */ +DECLARE_SPELL_FUN( spell_null ); +DECLARE_SPELL_FUN( spell_acid_blast ); +DECLARE_SPELL_FUN( spell_armor ); +DECLARE_SPELL_FUN( spell_bless ); +DECLARE_SPELL_FUN( spell_blindness ); +DECLARE_SPELL_FUN( spell_burning_hands ); +DECLARE_SPELL_FUN( spell_call_lightning ); +DECLARE_SPELL_FUN( spell_calm ); +DECLARE_SPELL_FUN( spell_cancellation ); +DECLARE_SPELL_FUN( spell_cause_critical ); +DECLARE_SPELL_FUN( spell_cause_light ); +DECLARE_SPELL_FUN( spell_cause_serious ); +DECLARE_SPELL_FUN( spell_change_sex ); +DECLARE_SPELL_FUN( spell_chain_lightning ); +DECLARE_SPELL_FUN( spell_charm_person ); +DECLARE_SPELL_FUN( spell_chill_touch ); +DECLARE_SPELL_FUN( spell_colour_spray ); +DECLARE_SPELL_FUN( spell_continual_light ); +DECLARE_SPELL_FUN( spell_control_weather ); +DECLARE_SPELL_FUN( spell_create_food ); +DECLARE_SPELL_FUN( spell_create_rose ); +DECLARE_SPELL_FUN( spell_create_spring ); +DECLARE_SPELL_FUN( spell_create_water ); +DECLARE_SPELL_FUN( spell_cure_blindness ); +DECLARE_SPELL_FUN( spell_cure_critical ); +DECLARE_SPELL_FUN( spell_cure_disease ); +DECLARE_SPELL_FUN( spell_cure_light ); +DECLARE_SPELL_FUN( spell_cure_poison ); +DECLARE_SPELL_FUN( spell_cure_serious ); +DECLARE_SPELL_FUN( spell_curse ); +DECLARE_SPELL_FUN( spell_demonfire ); +DECLARE_SPELL_FUN( spell_detect_evil ); +DECLARE_SPELL_FUN( spell_detect_good ); +DECLARE_SPELL_FUN( spell_detect_hidden ); +DECLARE_SPELL_FUN( spell_detect_invis ); +DECLARE_SPELL_FUN( spell_detect_magic ); +DECLARE_SPELL_FUN( spell_detect_poison ); +DECLARE_SPELL_FUN( spell_dispel_evil ); +DECLARE_SPELL_FUN( spell_dispel_good ); +DECLARE_SPELL_FUN( spell_dispel_magic ); +DECLARE_SPELL_FUN( spell_earthquake ); +DECLARE_SPELL_FUN( spell_enchant_armor ); +DECLARE_SPELL_FUN( spell_enchant_weapon ); +DECLARE_SPELL_FUN( spell_energy_drain ); +DECLARE_SPELL_FUN( spell_faerie_fire ); +DECLARE_SPELL_FUN( spell_faerie_fog ); +DECLARE_SPELL_FUN( spell_farsight ); +DECLARE_SPELL_FUN( spell_fireball ); +DECLARE_SPELL_FUN( spell_fireproof ); +DECLARE_SPELL_FUN( spell_flamestrike ); +DECLARE_SPELL_FUN( spell_floating_disc ); +DECLARE_SPELL_FUN( spell_fly ); +DECLARE_SPELL_FUN( spell_frenzy ); +DECLARE_SPELL_FUN( spell_gate ); +DECLARE_SPELL_FUN( spell_giant_strength ); +DECLARE_SPELL_FUN( spell_harm ); +DECLARE_SPELL_FUN( spell_haste ); +DECLARE_SPELL_FUN( spell_heal ); +DECLARE_SPELL_FUN( spell_heat_metal ); +DECLARE_SPELL_FUN( spell_holy_word ); +DECLARE_SPELL_FUN( spell_identify ); +DECLARE_SPELL_FUN( spell_infravision ); +DECLARE_SPELL_FUN( spell_invis ); +DECLARE_SPELL_FUN( spell_know_alignment ); +DECLARE_SPELL_FUN( spell_lightning_bolt ); +DECLARE_SPELL_FUN( spell_locate_object ); +DECLARE_SPELL_FUN( spell_magic_missile ); +DECLARE_SPELL_FUN( spell_mass_healing ); +DECLARE_SPELL_FUN( spell_mass_invis ); +DECLARE_SPELL_FUN( spell_nexus ); +DECLARE_SPELL_FUN( spell_pass_door ); +DECLARE_SPELL_FUN( spell_plague ); +DECLARE_SPELL_FUN( spell_poison ); +DECLARE_SPELL_FUN( spell_portal ); +DECLARE_SPELL_FUN( spell_protection_evil ); +DECLARE_SPELL_FUN( spell_protection_good ); +DECLARE_SPELL_FUN( spell_ray_of_truth ); +DECLARE_SPELL_FUN( spell_recharge ); +DECLARE_SPELL_FUN( spell_refresh ); +DECLARE_SPELL_FUN( spell_remove_curse ); +DECLARE_SPELL_FUN( spell_sanctuary ); +DECLARE_SPELL_FUN( spell_shocking_grasp ); +DECLARE_SPELL_FUN( spell_shield ); +DECLARE_SPELL_FUN( spell_sleep ); +DECLARE_SPELL_FUN( spell_slow ); +DECLARE_SPELL_FUN( spell_stone_skin ); +DECLARE_SPELL_FUN( spell_summon ); +DECLARE_SPELL_FUN( spell_teleport ); +DECLARE_SPELL_FUN( spell_ventriloquate ); +DECLARE_SPELL_FUN( spell_weaken ); +DECLARE_SPELL_FUN( spell_word_of_recall ); +DECLARE_SPELL_FUN( spell_acid_breath ); +DECLARE_SPELL_FUN( spell_fire_breath ); +DECLARE_SPELL_FUN( spell_frost_breath ); +DECLARE_SPELL_FUN( spell_gas_breath ); +DECLARE_SPELL_FUN( spell_lightning_breath ); +DECLARE_SPELL_FUN( spell_general_purpose ); +DECLARE_SPELL_FUN( spell_high_explosive ); diff --git a/Rom24/src/magic2.c b/Rom24/src/magic2.c new file mode 100644 index 0000000..caa9722 --- /dev/null +++ b/Rom24/src/magic2.c @@ -0,0 +1,174 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +#if defined(macintosh) +#include +#else +#include +#endif +#include +#include +#include +#include +#include "merc.h" +#include "interp.h" +#include "magic.h" + + +extern char *target_name; + +void spell_farsight( int sn, int level, CHAR_DATA *ch, void *vo,int target) +{ + if (IS_AFFECTED(ch,AFF_BLIND)) + { + send_to_char("Maybe it would help if you could see?\n\r",ch); + return; + } + + do_function(ch, &do_scan, target_name); +} + + +void spell_portal( int sn, int level, CHAR_DATA *ch, void *vo,int target) +{ + CHAR_DATA *victim; + OBJ_DATA *portal, *stone; + + if ( ( victim = get_char_world( ch, target_name ) ) == NULL + || victim == ch + || victim->in_room == NULL + || !can_see_room(ch,victim->in_room) + || IS_SET(victim->in_room->room_flags, ROOM_SAFE) + || IS_SET(victim->in_room->room_flags, ROOM_PRIVATE) + || IS_SET(victim->in_room->room_flags, ROOM_SOLITARY) + || IS_SET(victim->in_room->room_flags, ROOM_NO_RECALL) + || IS_SET(ch->in_room->room_flags, ROOM_NO_RECALL) + || victim->level >= level + 3 + || (!IS_NPC(victim) && victim->level >= LEVEL_HERO) /* NOT trust */ + || (IS_NPC(victim) && IS_SET(victim->imm_flags,IMM_SUMMON)) + || (IS_NPC(victim) && saves_spell( level, victim,DAM_NONE) ) + || (is_clan(victim) && !is_same_clan(ch,victim))) + { + send_to_char( "You failed.\n\r", ch ); + return; + } + + stone = get_eq_char(ch,WEAR_HOLD); + if (!IS_IMMORTAL(ch) + && (stone == NULL || stone->item_type != ITEM_WARP_STONE)) + { + send_to_char("You lack the proper component for this spell.\n\r",ch); + return; + } + + if (stone != NULL && stone->item_type == ITEM_WARP_STONE) + { + act("You draw upon the power of $p.",ch,stone,NULL,TO_CHAR); + act("It flares brightly and vanishes!",ch,stone,NULL,TO_CHAR); + extract_obj(stone); + } + + portal = create_object(get_obj_index(OBJ_VNUM_PORTAL),0); + portal->timer = 2 + level / 25; + portal->value[3] = victim->in_room->vnum; + + obj_to_room(portal,ch->in_room); + + act("$p rises up from the ground.",ch,portal,NULL,TO_ROOM); + act("$p rises up before you.",ch,portal,NULL,TO_CHAR); +} + +void spell_nexus( int sn, int level, CHAR_DATA *ch, void *vo, int target) +{ + CHAR_DATA *victim; + OBJ_DATA *portal, *stone; + ROOM_INDEX_DATA *to_room, *from_room; + + from_room = ch->in_room; + + if ( ( victim = get_char_world( ch, target_name ) ) == NULL + || victim == ch + || (to_room = victim->in_room) == NULL + || !can_see_room(ch,to_room) || !can_see_room(ch,from_room) + || IS_SET(to_room->room_flags, ROOM_SAFE) + || IS_SET(from_room->room_flags,ROOM_SAFE) + || IS_SET(to_room->room_flags, ROOM_PRIVATE) + || IS_SET(to_room->room_flags, ROOM_SOLITARY) + || IS_SET(to_room->room_flags, ROOM_NO_RECALL) + || IS_SET(from_room->room_flags,ROOM_NO_RECALL) + || victim->level >= level + 3 + || (!IS_NPC(victim) && victim->level >= LEVEL_HERO) /* NOT trust */ + || (IS_NPC(victim) && IS_SET(victim->imm_flags,IMM_SUMMON)) + || (IS_NPC(victim) && saves_spell( level, victim,DAM_NONE) ) + || (is_clan(victim) && !is_same_clan(ch,victim))) + { + send_to_char( "You failed.\n\r", ch ); + return; + } + + stone = get_eq_char(ch,WEAR_HOLD); + if (!IS_IMMORTAL(ch) + && (stone == NULL || stone->item_type != ITEM_WARP_STONE)) + { + send_to_char("You lack the proper component for this spell.\n\r",ch); + return; + } + + if (stone != NULL && stone->item_type == ITEM_WARP_STONE) + { + act("You draw upon the power of $p.",ch,stone,NULL,TO_CHAR); + act("It flares brightly and vanishes!",ch,stone,NULL,TO_CHAR); + extract_obj(stone); + } + + /* portal one */ + portal = create_object(get_obj_index(OBJ_VNUM_PORTAL),0); + portal->timer = 1 + level / 10; + portal->value[3] = to_room->vnum; + + obj_to_room(portal,from_room); + + act("$p rises up from the ground.",ch,portal,NULL,TO_ROOM); + act("$p rises up before you.",ch,portal,NULL,TO_CHAR); + + /* no second portal if rooms are the same */ + if (to_room == from_room) + return; + + /* portal two */ + portal = create_object(get_obj_index(OBJ_VNUM_PORTAL),0); + portal->timer = 1 + level/10; + portal->value[3] = from_room->vnum; + + obj_to_room(portal,to_room); + + if (to_room->people != NULL) + { + act("$p rises up from the ground.",to_room->people,portal,NULL,TO_ROOM); + act("$p rises up from the ground.",to_room->people,portal,NULL,TO_CHAR); + } +} diff --git a/Rom24/src/merc.h b/Rom24/src/merc.h new file mode 100644 index 0000000..b4ed230 --- /dev/null +++ b/Rom24/src/merc.h @@ -0,0 +1,2322 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + + +/* + * Accommodate old non-Ansi compilers. + */ +#if defined(TRADITIONAL) +#define const +#define args( list ) ( ) +#define DECLARE_DO_FUN( fun ) void fun( ) +#define DECLARE_SPEC_FUN( fun ) bool fun( ) +#define DECLARE_SPELL_FUN( fun ) void fun( ) +#else +#define args( list ) list +#define DECLARE_DO_FUN( fun ) DO_FUN fun +#define DECLARE_SPEC_FUN( fun ) SPEC_FUN fun +#define DECLARE_SPELL_FUN( fun ) SPELL_FUN fun +#endif + + +/* + * Short scalar types. + * Diavolo reports AIX compiler has bugs with short types. + */ +#if !defined(FALSE) +#define FALSE 0 +#endif + +#if !defined(TRUE) +#define TRUE 1 +#endif + +#if defined(_AIX) +#if !defined(const) +#define const +#endif +typedef int sh_int; +typedef int bool; +#define unix +#else +typedef short int sh_int; +typedef unsigned char bool; +#endif + + + +/* + * Structure types. + */ +typedef struct affect_data AFFECT_DATA; +typedef struct area_data AREA_DATA; +typedef struct ban_data BAN_DATA; +typedef struct buf_type BUFFER; +typedef struct char_data CHAR_DATA; +typedef struct descriptor_data DESCRIPTOR_DATA; +typedef struct exit_data EXIT_DATA; +typedef struct extra_descr_data EXTRA_DESCR_DATA; +typedef struct help_data HELP_DATA; +typedef struct kill_data KILL_DATA; +typedef struct mem_data MEM_DATA; +typedef struct mob_index_data MOB_INDEX_DATA; +typedef struct note_data NOTE_DATA; +typedef struct obj_data OBJ_DATA; +typedef struct obj_index_data OBJ_INDEX_DATA; +typedef struct pc_data PC_DATA; +typedef struct gen_data GEN_DATA; +typedef struct reset_data RESET_DATA; +typedef struct room_index_data ROOM_INDEX_DATA; +typedef struct shop_data SHOP_DATA; +typedef struct time_info_data TIME_INFO_DATA; +typedef struct weather_data WEATHER_DATA; + + + +/* + * Function types. + */ +typedef void DO_FUN args( ( CHAR_DATA *ch, char *argument ) ); +typedef bool SPEC_FUN args( ( CHAR_DATA *ch ) ); +typedef void SPELL_FUN args( ( int sn, int level, CHAR_DATA *ch, void *vo, + int target ) ); + + + +/* + * String and memory management parameters. + */ +#define MAX_KEY_HASH 1024 +#define MAX_STRING_LENGTH 4608 +#define MAX_INPUT_LENGTH 256 +#define PAGELEN 22 + + + +/* + * Game parameters. + * Increase the max'es if you add more of something. + * Adjust the pulse numbers to suit yourself. + */ +#define MAX_SOCIALS 256 +#define MAX_SKILL 150 +#define MAX_GROUP 30 +#define MAX_IN_GROUP 15 +#define MAX_ALIAS 5 +#define MAX_CLASS 4 +#define MAX_PC_RACE 5 +#define MAX_CLAN 3 +#define MAX_DAMAGE_MESSAGE 41 +#define MAX_LEVEL 60 +#define LEVEL_HERO (MAX_LEVEL - 9) +#define LEVEL_IMMORTAL (MAX_LEVEL - 8) + +#define PULSE_PER_SECOND 4 +#define PULSE_VIOLENCE ( 3 * PULSE_PER_SECOND) +#define PULSE_MOBILE ( 4 * PULSE_PER_SECOND) +#define PULSE_MUSIC ( 6 * PULSE_PER_SECOND) +#define PULSE_TICK (60 * PULSE_PER_SECOND) +#define PULSE_AREA (120 * PULSE_PER_SECOND) + +#define IMPLEMENTOR MAX_LEVEL +#define CREATOR (MAX_LEVEL - 1) +#define SUPREME (MAX_LEVEL - 2) +#define DEITY (MAX_LEVEL - 3) +#define GOD (MAX_LEVEL - 4) +#define IMMORTAL (MAX_LEVEL - 5) +#define DEMI (MAX_LEVEL - 6) +#define ANGEL (MAX_LEVEL - 7) +#define AVATAR (MAX_LEVEL - 8) +#define HERO LEVEL_HERO + + + +/* + * Site ban structure. + */ + +#define BAN_SUFFIX A +#define BAN_PREFIX B +#define BAN_NEWBIES C +#define BAN_ALL D +#define BAN_PERMIT E +#define BAN_PERMANENT F + +struct ban_data +{ + BAN_DATA * next; + bool valid; + sh_int ban_flags; + sh_int level; + char * name; +}; + +struct buf_type +{ + BUFFER * next; + bool valid; + sh_int state; /* error state of the buffer */ + sh_int size; /* size in k */ + char * string; /* buffer's string */ +}; + + + +/* + * Time and weather stuff. + */ +#define SUN_DARK 0 +#define SUN_RISE 1 +#define SUN_LIGHT 2 +#define SUN_SET 3 + +#define SKY_CLOUDLESS 0 +#define SKY_CLOUDY 1 +#define SKY_RAINING 2 +#define SKY_LIGHTNING 3 + +struct time_info_data +{ + int hour; + int day; + int month; + int year; +}; + +struct weather_data +{ + int mmhg; + int change; + int sky; + int sunlight; +}; + + + +/* + * Connected state for a channel. + */ +#define CON_PLAYING 0 +#define CON_GET_NAME 1 +#define CON_GET_OLD_PASSWORD 2 +#define CON_CONFIRM_NEW_NAME 3 +#define CON_GET_NEW_PASSWORD 4 +#define CON_CONFIRM_NEW_PASSWORD 5 +#define CON_GET_NEW_RACE 6 +#define CON_GET_NEW_SEX 7 +#define CON_GET_NEW_CLASS 8 +#define CON_GET_ALIGNMENT 9 +#define CON_DEFAULT_CHOICE 10 +#define CON_GEN_GROUPS 11 +#define CON_PICK_WEAPON 12 +#define CON_READ_IMOTD 13 +#define CON_READ_MOTD 14 +#define CON_BREAK_CONNECT 15 + + + +/* + * Descriptor (channel) structure. + */ +struct descriptor_data +{ + DESCRIPTOR_DATA * next; + DESCRIPTOR_DATA * snoop_by; + CHAR_DATA * character; + CHAR_DATA * original; + bool valid; + char * host; + sh_int descriptor; + sh_int connected; + bool fcommand; + char inbuf [4 * MAX_INPUT_LENGTH]; + char incomm [MAX_INPUT_LENGTH]; + char inlast [MAX_INPUT_LENGTH]; + int repeat; + char * outbuf; + int outsize; + int outtop; + char * showstr_head; + char * showstr_point; +}; + + + +/* + * Attribute bonus structures. + */ +struct str_app_type +{ + sh_int tohit; + sh_int todam; + sh_int carry; + sh_int wield; +}; + +struct int_app_type +{ + sh_int learn; +}; + +struct wis_app_type +{ + sh_int practice; +}; + +struct dex_app_type +{ + sh_int defensive; +}; + +struct con_app_type +{ + sh_int hitp; + sh_int shock; +}; + + + +/* + * TO types for act. + */ +#define TO_ROOM 0 +#define TO_NOTVICT 1 +#define TO_VICT 2 +#define TO_CHAR 3 +#define TO_ALL 4 + + + +/* + * Help table types. + */ +struct help_data +{ + HELP_DATA * next; + sh_int level; + char * keyword; + char * text; +}; + + + +/* + * Shop types. + */ +#define MAX_TRADE 5 + +struct shop_data +{ + SHOP_DATA * next; /* Next shop in list */ + sh_int keeper; /* Vnum of shop keeper mob */ + sh_int buy_type [MAX_TRADE]; /* Item types shop will buy */ + sh_int profit_buy; /* Cost multiplier for buying */ + sh_int profit_sell; /* Cost multiplier for selling */ + sh_int open_hour; /* First opening hour */ + sh_int close_hour; /* First closing hour */ +}; + + + +/* + * Per-class stuff. + */ + +#define MAX_GUILD 2 +#define MAX_STATS 5 +#define STAT_STR 0 +#define STAT_INT 1 +#define STAT_WIS 2 +#define STAT_DEX 3 +#define STAT_CON 4 + +struct class_type +{ + char * name; /* the full name of the class */ + char who_name [4]; /* Three-letter name for 'who' */ + sh_int attr_prime; /* Prime attribute */ + sh_int weapon; /* First weapon */ + sh_int guild[MAX_GUILD]; /* Vnum of guild rooms */ + sh_int skill_adept; /* Maximum skill level */ + sh_int thac0_00; /* Thac0 for level 0 */ + sh_int thac0_32; /* Thac0 for level 32 */ + sh_int hp_min; /* Min hp gained on leveling */ + sh_int hp_max; /* Max hp gained on leveling */ + bool fMana; /* Class gains mana on level */ + char * base_group; /* base skills gained */ + char * default_group; /* default skills gained */ +}; + +struct item_type +{ + int type; + char * name; +}; + +struct weapon_type +{ + char * name; + sh_int vnum; + sh_int type; + sh_int *gsn; +}; + +struct wiznet_type +{ + char * name; + long flag; + int level; +}; + +struct attack_type +{ + char * name; /* name */ + char * noun; /* message */ + int damage; /* damage class */ +}; + +struct race_type +{ + char * name; /* call name of the race */ + bool pc_race; /* can be chosen by pcs */ + long act; /* act bits for the race */ + long aff; /* aff bits for the race */ + long off; /* off bits for the race */ + long imm; /* imm bits for the race */ + long res; /* res bits for the race */ + long vuln; /* vuln bits for the race */ + long form; /* default form flag for the race */ + long parts; /* default parts for the race */ +}; + + +struct pc_race_type /* additional data for pc races */ +{ + char * name; /* MUST be in race_type */ + char who_name[6]; + sh_int points; /* cost in points of the race */ + sh_int class_mult[MAX_CLASS]; /* exp multiplier for class, * 100 */ + char * skills[5]; /* bonus skills for the race */ + sh_int stats[MAX_STATS]; /* starting stats */ + sh_int max_stats[MAX_STATS]; /* maximum stats */ + sh_int size; /* aff bits for the race */ +}; + + +struct spec_type +{ + char * name; /* special function name */ + SPEC_FUN * function; /* the function */ +}; + + + +/* + * Data structure for notes. + */ + +#define NOTE_NOTE 0 +#define NOTE_IDEA 1 +#define NOTE_PENALTY 2 +#define NOTE_NEWS 3 +#define NOTE_CHANGES 4 +struct note_data +{ + NOTE_DATA * next; + bool valid; + sh_int type; + char * sender; + char * date; + char * to_list; + char * subject; + char * text; + time_t date_stamp; +}; + + + +/* + * An affect. + */ +struct affect_data +{ + AFFECT_DATA * next; + bool valid; + sh_int where; + sh_int type; + sh_int level; + sh_int duration; + sh_int location; + sh_int modifier; + int bitvector; +}; + +/* where definitions */ +#define TO_AFFECTS 0 +#define TO_OBJECT 1 +#define TO_IMMUNE 2 +#define TO_RESIST 3 +#define TO_VULN 4 +#define TO_WEAPON 5 + + +/* + * A kill structure (indexed by level). + */ +struct kill_data +{ + sh_int number; + sh_int killed; +}; + + + +/*************************************************************************** + * * + * VALUES OF INTEREST TO AREA BUILDERS * + * (Start of section ... start here) * + * * + ***************************************************************************/ + +/* + * Well known mob virtual numbers. + * Defined in #MOBILES. + */ +#define MOB_VNUM_FIDO 3090 +#define MOB_VNUM_CITYGUARD 3060 +#define MOB_VNUM_VAMPIRE 3404 + +#define MOB_VNUM_PATROLMAN 2106 +#define GROUP_VNUM_TROLLS 2100 +#define GROUP_VNUM_OGRES 2101 + + +/* RT ASCII conversions -- used so we can have letters in this file */ + +#define A 1 +#define B 2 +#define C 4 +#define D 8 +#define E 16 +#define F 32 +#define G 64 +#define H 128 + +#define I 256 +#define J 512 +#define K 1024 +#define L 2048 +#define M 4096 +#define N 8192 +#define O 16384 +#define P 32768 + +#define Q 65536 +#define R 131072 +#define S 262144 +#define T 524288 +#define U 1048576 +#define V 2097152 +#define W 4194304 +#define X 8388608 + +#define Y 16777216 +#define Z 33554432 +#define aa 67108864 /* doubled due to conflicts */ +#define bb 134217728 +#define cc 268435456 +#define dd 536870912 +#define ee 1073741824 + +/* + * ACT bits for mobs. + * Used in #MOBILES. + */ +#define ACT_IS_NPC (A) /* Auto set for mobs */ +#define ACT_SENTINEL (B) /* Stays in one room */ +#define ACT_SCAVENGER (C) /* Picks up objects */ +#define ACT_AGGRESSIVE (F) /* Attacks PC's */ +#define ACT_STAY_AREA (G) /* Won't leave area */ +#define ACT_WIMPY (H) +#define ACT_PET (I) /* Auto set for pets */ +#define ACT_TRAIN (J) /* Can train PC's */ +#define ACT_PRACTICE (K) /* Can practice PC's */ +#define ACT_UNDEAD (O) +#define ACT_CLERIC (Q) +#define ACT_MAGE (R) +#define ACT_THIEF (S) +#define ACT_WARRIOR (T) +#define ACT_NOALIGN (U) +#define ACT_NOPURGE (V) +#define ACT_OUTDOORS (W) +#define ACT_INDOORS (Y) +#define ACT_IS_HEALER (aa) +#define ACT_GAIN (bb) +#define ACT_UPDATE_ALWAYS (cc) +#define ACT_IS_CHANGER (dd) + +/* damage classes */ +#define DAM_NONE 0 +#define DAM_BASH 1 +#define DAM_PIERCE 2 +#define DAM_SLASH 3 +#define DAM_FIRE 4 +#define DAM_COLD 5 +#define DAM_LIGHTNING 6 +#define DAM_ACID 7 +#define DAM_POISON 8 +#define DAM_NEGATIVE 9 +#define DAM_HOLY 10 +#define DAM_ENERGY 11 +#define DAM_MENTAL 12 +#define DAM_DISEASE 13 +#define DAM_DROWNING 14 +#define DAM_LIGHT 15 +#define DAM_OTHER 16 +#define DAM_HARM 17 +#define DAM_CHARM 18 +#define DAM_SOUND 19 + +/* OFF bits for mobiles */ +#define OFF_AREA_ATTACK (A) +#define OFF_BACKSTAB (B) +#define OFF_BASH (C) +#define OFF_BERSERK (D) +#define OFF_DISARM (E) +#define OFF_DODGE (F) +#define OFF_FADE (G) +#define OFF_FAST (H) +#define OFF_KICK (I) +#define OFF_KICK_DIRT (J) +#define OFF_PARRY (K) +#define OFF_RESCUE (L) +#define OFF_TAIL (M) +#define OFF_TRIP (N) +#define OFF_CRUSH (O) +#define ASSIST_ALL (P) +#define ASSIST_ALIGN (Q) +#define ASSIST_RACE (R) +#define ASSIST_PLAYERS (S) +#define ASSIST_GUARD (T) +#define ASSIST_VNUM (U) + +/* return values for check_imm */ +#define IS_NORMAL 0 +#define IS_IMMUNE 1 +#define IS_RESISTANT 2 +#define IS_VULNERABLE 3 + +/* IMM bits for mobs */ +#define IMM_SUMMON (A) +#define IMM_CHARM (B) +#define IMM_MAGIC (C) +#define IMM_WEAPON (D) +#define IMM_BASH (E) +#define IMM_PIERCE (F) +#define IMM_SLASH (G) +#define IMM_FIRE (H) +#define IMM_COLD (I) +#define IMM_LIGHTNING (J) +#define IMM_ACID (K) +#define IMM_POISON (L) +#define IMM_NEGATIVE (M) +#define IMM_HOLY (N) +#define IMM_ENERGY (O) +#define IMM_MENTAL (P) +#define IMM_DISEASE (Q) +#define IMM_DROWNING (R) +#define IMM_LIGHT (S) +#define IMM_SOUND (T) +#define IMM_WOOD (X) +#define IMM_SILVER (Y) +#define IMM_IRON (Z) + +/* RES bits for mobs */ +#define RES_SUMMON (A) +#define RES_CHARM (B) +#define RES_MAGIC (C) +#define RES_WEAPON (D) +#define RES_BASH (E) +#define RES_PIERCE (F) +#define RES_SLASH (G) +#define RES_FIRE (H) +#define RES_COLD (I) +#define RES_LIGHTNING (J) +#define RES_ACID (K) +#define RES_POISON (L) +#define RES_NEGATIVE (M) +#define RES_HOLY (N) +#define RES_ENERGY (O) +#define RES_MENTAL (P) +#define RES_DISEASE (Q) +#define RES_DROWNING (R) +#define RES_LIGHT (S) +#define RES_SOUND (T) +#define RES_WOOD (X) +#define RES_SILVER (Y) +#define RES_IRON (Z) + +/* VULN bits for mobs */ +#define VULN_SUMMON (A) +#define VULN_CHARM (B) +#define VULN_MAGIC (C) +#define VULN_WEAPON (D) +#define VULN_BASH (E) +#define VULN_PIERCE (F) +#define VULN_SLASH (G) +#define VULN_FIRE (H) +#define VULN_COLD (I) +#define VULN_LIGHTNING (J) +#define VULN_ACID (K) +#define VULN_POISON (L) +#define VULN_NEGATIVE (M) +#define VULN_HOLY (N) +#define VULN_ENERGY (O) +#define VULN_MENTAL (P) +#define VULN_DISEASE (Q) +#define VULN_DROWNING (R) +#define VULN_LIGHT (S) +#define VULN_SOUND (T) +#define VULN_WOOD (X) +#define VULN_SILVER (Y) +#define VULN_IRON (Z) + +/* body form */ +#define FORM_EDIBLE (A) +#define FORM_POISON (B) +#define FORM_MAGICAL (C) +#define FORM_INSTANT_DECAY (D) +#define FORM_OTHER (E) /* defined by material bit */ + +/* actual form */ +#define FORM_ANIMAL (G) +#define FORM_SENTIENT (H) +#define FORM_UNDEAD (I) +#define FORM_CONSTRUCT (J) +#define FORM_MIST (K) +#define FORM_INTANGIBLE (L) + +#define FORM_BIPED (M) +#define FORM_CENTAUR (N) +#define FORM_INSECT (O) +#define FORM_SPIDER (P) +#define FORM_CRUSTACEAN (Q) +#define FORM_WORM (R) +#define FORM_BLOB (S) + +#define FORM_MAMMAL (V) +#define FORM_BIRD (W) +#define FORM_REPTILE (X) +#define FORM_SNAKE (Y) +#define FORM_DRAGON (Z) +#define FORM_AMPHIBIAN (aa) +#define FORM_FISH (bb) +#define FORM_COLD_BLOOD (cc) + +/* body parts */ +#define PART_HEAD (A) +#define PART_ARMS (B) +#define PART_LEGS (C) +#define PART_HEART (D) +#define PART_BRAINS (E) +#define PART_GUTS (F) +#define PART_HANDS (G) +#define PART_FEET (H) +#define PART_FINGERS (I) +#define PART_EAR (J) +#define PART_EYE (K) +#define PART_LONG_TONGUE (L) +#define PART_EYESTALKS (M) +#define PART_TENTACLES (N) +#define PART_FINS (O) +#define PART_WINGS (P) +#define PART_TAIL (Q) +/* for combat */ +#define PART_CLAWS (U) +#define PART_FANGS (V) +#define PART_HORNS (W) +#define PART_SCALES (X) +#define PART_TUSKS (Y) + + +/* + * Bits for 'affected_by'. + * Used in #MOBILES. + */ +#define AFF_BLIND (A) +#define AFF_INVISIBLE (B) +#define AFF_DETECT_EVIL (C) +#define AFF_DETECT_INVIS (D) +#define AFF_DETECT_MAGIC (E) +#define AFF_DETECT_HIDDEN (F) +#define AFF_DETECT_GOOD (G) +#define AFF_SANCTUARY (H) +#define AFF_FAERIE_FIRE (I) +#define AFF_INFRARED (J) +#define AFF_CURSE (K) +#define AFF_UNUSED_FLAG (L) /* unused */ +#define AFF_POISON (M) +#define AFF_PROTECT_EVIL (N) +#define AFF_PROTECT_GOOD (O) +#define AFF_SNEAK (P) +#define AFF_HIDE (Q) +#define AFF_SLEEP (R) +#define AFF_CHARM (S) +#define AFF_FLYING (T) +#define AFF_PASS_DOOR (U) +#define AFF_HASTE (V) +#define AFF_CALM (W) +#define AFF_PLAGUE (X) +#define AFF_WEAKEN (Y) +#define AFF_DARK_VISION (Z) +#define AFF_BERSERK (aa) +#define AFF_SWIM (bb) +#define AFF_REGENERATION (cc) +#define AFF_SLOW (dd) + + + + +/* + * Sex. + * Used in #MOBILES. + */ +#define SEX_NEUTRAL 0 +#define SEX_MALE 1 +#define SEX_FEMALE 2 + +/* AC types */ +#define AC_PIERCE 0 +#define AC_BASH 1 +#define AC_SLASH 2 +#define AC_EXOTIC 3 + +/* dice */ +#define DICE_NUMBER 0 +#define DICE_TYPE 1 +#define DICE_BONUS 2 + +/* size */ +#define SIZE_TINY 0 +#define SIZE_SMALL 1 +#define SIZE_MEDIUM 2 +#define SIZE_LARGE 3 +#define SIZE_HUGE 4 +#define SIZE_GIANT 5 + + + +/* + * Well known object virtual numbers. + * Defined in #OBJECTS. + */ +#define OBJ_VNUM_SILVER_ONE 1 +#define OBJ_VNUM_GOLD_ONE 2 +#define OBJ_VNUM_GOLD_SOME 3 +#define OBJ_VNUM_SILVER_SOME 4 +#define OBJ_VNUM_COINS 5 + +#define OBJ_VNUM_CORPSE_NPC 10 +#define OBJ_VNUM_CORPSE_PC 11 +#define OBJ_VNUM_SEVERED_HEAD 12 +#define OBJ_VNUM_TORN_HEART 13 +#define OBJ_VNUM_SLICED_ARM 14 +#define OBJ_VNUM_SLICED_LEG 15 +#define OBJ_VNUM_GUTS 16 +#define OBJ_VNUM_BRAINS 17 + +#define OBJ_VNUM_MUSHROOM 20 +#define OBJ_VNUM_LIGHT_BALL 21 +#define OBJ_VNUM_SPRING 22 +#define OBJ_VNUM_DISC 23 +#define OBJ_VNUM_PORTAL 25 + +#define OBJ_VNUM_ROSE 1001 + +#define OBJ_VNUM_PIT 3010 + +#define OBJ_VNUM_SCHOOL_MACE 3700 +#define OBJ_VNUM_SCHOOL_DAGGER 3701 +#define OBJ_VNUM_SCHOOL_SWORD 3702 +#define OBJ_VNUM_SCHOOL_SPEAR 3717 +#define OBJ_VNUM_SCHOOL_STAFF 3718 +#define OBJ_VNUM_SCHOOL_AXE 3719 +#define OBJ_VNUM_SCHOOL_FLAIL 3720 +#define OBJ_VNUM_SCHOOL_WHIP 3721 +#define OBJ_VNUM_SCHOOL_POLEARM 3722 + +#define OBJ_VNUM_SCHOOL_VEST 3703 +#define OBJ_VNUM_SCHOOL_SHIELD 3704 +#define OBJ_VNUM_SCHOOL_BANNER 3716 +#define OBJ_VNUM_MAP 3162 + +#define OBJ_VNUM_WHISTLE 2116 + + + +/* + * Item types. + * Used in #OBJECTS. + */ +#define ITEM_LIGHT 1 +#define ITEM_SCROLL 2 +#define ITEM_WAND 3 +#define ITEM_STAFF 4 +#define ITEM_WEAPON 5 +#define ITEM_TREASURE 8 +#define ITEM_ARMOR 9 +#define ITEM_POTION 10 +#define ITEM_CLOTHING 11 +#define ITEM_FURNITURE 12 +#define ITEM_TRASH 13 +#define ITEM_CONTAINER 15 +#define ITEM_DRINK_CON 17 +#define ITEM_KEY 18 +#define ITEM_FOOD 19 +#define ITEM_MONEY 20 +#define ITEM_BOAT 22 +#define ITEM_CORPSE_NPC 23 +#define ITEM_CORPSE_PC 24 +#define ITEM_FOUNTAIN 25 +#define ITEM_PILL 26 +#define ITEM_PROTECT 27 +#define ITEM_MAP 28 +#define ITEM_PORTAL 29 +#define ITEM_WARP_STONE 30 +#define ITEM_ROOM_KEY 31 +#define ITEM_GEM 32 +#define ITEM_JEWELRY 33 +#define ITEM_JUKEBOX 34 + + + +/* + * Extra flags. + * Used in #OBJECTS. + */ +#define ITEM_GLOW (A) +#define ITEM_HUM (B) +#define ITEM_DARK (C) +#define ITEM_LOCK (D) +#define ITEM_EVIL (E) +#define ITEM_INVIS (F) +#define ITEM_MAGIC (G) +#define ITEM_NODROP (H) +#define ITEM_BLESS (I) +#define ITEM_ANTI_GOOD (J) +#define ITEM_ANTI_EVIL (K) +#define ITEM_ANTI_NEUTRAL (L) +#define ITEM_NOREMOVE (M) +#define ITEM_INVENTORY (N) +#define ITEM_NOPURGE (O) +#define ITEM_ROT_DEATH (P) +#define ITEM_VIS_DEATH (Q) +#define ITEM_NONMETAL (S) +#define ITEM_NOLOCATE (T) +#define ITEM_MELT_DROP (U) +#define ITEM_HAD_TIMER (V) +#define ITEM_SELL_EXTRACT (W) +#define ITEM_BURN_PROOF (Y) +#define ITEM_NOUNCURSE (Z) + + +/* + * Wear flags. + * Used in #OBJECTS. + */ +#define ITEM_TAKE (A) +#define ITEM_WEAR_FINGER (B) +#define ITEM_WEAR_NECK (C) +#define ITEM_WEAR_BODY (D) +#define ITEM_WEAR_HEAD (E) +#define ITEM_WEAR_LEGS (F) +#define ITEM_WEAR_FEET (G) +#define ITEM_WEAR_HANDS (H) +#define ITEM_WEAR_ARMS (I) +#define ITEM_WEAR_SHIELD (J) +#define ITEM_WEAR_ABOUT (K) +#define ITEM_WEAR_WAIST (L) +#define ITEM_WEAR_WRIST (M) +#define ITEM_WIELD (N) +#define ITEM_HOLD (O) +#define ITEM_NO_SAC (P) +#define ITEM_WEAR_FLOAT (Q) + +/* weapon class */ +#define WEAPON_EXOTIC 0 +#define WEAPON_SWORD 1 +#define WEAPON_DAGGER 2 +#define WEAPON_SPEAR 3 +#define WEAPON_MACE 4 +#define WEAPON_AXE 5 +#define WEAPON_FLAIL 6 +#define WEAPON_WHIP 7 +#define WEAPON_POLEARM 8 + +/* weapon types */ +#define WEAPON_FLAMING (A) +#define WEAPON_FROST (B) +#define WEAPON_VAMPIRIC (C) +#define WEAPON_SHARP (D) +#define WEAPON_VORPAL (E) +#define WEAPON_TWO_HANDS (F) +#define WEAPON_SHOCKING (G) +#define WEAPON_POISON (H) + +/* gate flags */ +#define GATE_NORMAL_EXIT (A) +#define GATE_NOCURSE (B) +#define GATE_GOWITH (C) +#define GATE_BUGGY (D) +#define GATE_RANDOM (E) + +/* furniture flags */ +#define STAND_AT (A) +#define STAND_ON (B) +#define STAND_IN (C) +#define SIT_AT (D) +#define SIT_ON (E) +#define SIT_IN (F) +#define REST_AT (G) +#define REST_ON (H) +#define REST_IN (I) +#define SLEEP_AT (J) +#define SLEEP_ON (K) +#define SLEEP_IN (L) +#define PUT_AT (M) +#define PUT_ON (N) +#define PUT_IN (O) +#define PUT_INSIDE (P) + + + + +/* + * Apply types (for affects). + * Used in #OBJECTS. + */ +#define APPLY_NONE 0 +#define APPLY_STR 1 +#define APPLY_DEX 2 +#define APPLY_INT 3 +#define APPLY_WIS 4 +#define APPLY_CON 5 +#define APPLY_SEX 6 +#define APPLY_CLASS 7 +#define APPLY_LEVEL 8 +#define APPLY_AGE 9 +#define APPLY_HEIGHT 10 +#define APPLY_WEIGHT 11 +#define APPLY_MANA 12 +#define APPLY_HIT 13 +#define APPLY_MOVE 14 +#define APPLY_GOLD 15 +#define APPLY_EXP 16 +#define APPLY_AC 17 +#define APPLY_HITROLL 18 +#define APPLY_DAMROLL 19 +#define APPLY_SAVES 20 +#define APPLY_SAVING_PARA 20 +#define APPLY_SAVING_ROD 21 +#define APPLY_SAVING_PETRI 22 +#define APPLY_SAVING_BREATH 23 +#define APPLY_SAVING_SPELL 24 +#define APPLY_SPELL_AFFECT 25 + +/* + * Values for containers (value[1]). + * Used in #OBJECTS. + */ +#define CONT_CLOSEABLE 1 +#define CONT_PICKPROOF 2 +#define CONT_CLOSED 4 +#define CONT_LOCKED 8 +#define CONT_PUT_ON 16 + + + +/* + * Well known room virtual numbers. + * Defined in #ROOMS. + */ +#define ROOM_VNUM_LIMBO 2 +#define ROOM_VNUM_CHAT 1200 +#define ROOM_VNUM_TEMPLE 3001 +#define ROOM_VNUM_ALTAR 3054 +#define ROOM_VNUM_SCHOOL 3700 +#define ROOM_VNUM_BALANCE 4500 +#define ROOM_VNUM_CIRCLE 4400 +#define ROOM_VNUM_DEMISE 4201 +#define ROOM_VNUM_HONOR 4300 + + + +/* + * Room flags. + * Used in #ROOMS. + */ +#define ROOM_DARK (A) +#define ROOM_NO_MOB (C) +#define ROOM_INDOORS (D) + +#define ROOM_PRIVATE (J) +#define ROOM_SAFE (K) +#define ROOM_SOLITARY (L) +#define ROOM_PET_SHOP (M) +#define ROOM_NO_RECALL (N) +#define ROOM_IMP_ONLY (O) +#define ROOM_GODS_ONLY (P) +#define ROOM_HEROES_ONLY (Q) +#define ROOM_NEWBIES_ONLY (R) +#define ROOM_LAW (S) +#define ROOM_NOWHERE (T) + + + +/* + * Directions. + * Used in #ROOMS. + */ +#define DIR_NORTH 0 +#define DIR_EAST 1 +#define DIR_SOUTH 2 +#define DIR_WEST 3 +#define DIR_UP 4 +#define DIR_DOWN 5 + + + +/* + * Exit flags. + * Used in #ROOMS. + */ +#define EX_ISDOOR (A) +#define EX_CLOSED (B) +#define EX_LOCKED (C) +#define EX_PICKPROOF (F) +#define EX_NOPASS (G) +#define EX_EASY (H) +#define EX_HARD (I) +#define EX_INFURIATING (J) +#define EX_NOCLOSE (K) +#define EX_NOLOCK (L) + + + +/* + * Sector types. + * Used in #ROOMS. + */ +#define SECT_INSIDE 0 +#define SECT_CITY 1 +#define SECT_FIELD 2 +#define SECT_FOREST 3 +#define SECT_HILLS 4 +#define SECT_MOUNTAIN 5 +#define SECT_WATER_SWIM 6 +#define SECT_WATER_NOSWIM 7 +#define SECT_UNUSED 8 +#define SECT_AIR 9 +#define SECT_DESERT 10 +#define SECT_MAX 11 + + + +/* + * Equpiment wear locations. + * Used in #RESETS. + */ +#define WEAR_NONE -1 +#define WEAR_LIGHT 0 +#define WEAR_FINGER_L 1 +#define WEAR_FINGER_R 2 +#define WEAR_NECK_1 3 +#define WEAR_NECK_2 4 +#define WEAR_BODY 5 +#define WEAR_HEAD 6 +#define WEAR_LEGS 7 +#define WEAR_FEET 8 +#define WEAR_HANDS 9 +#define WEAR_ARMS 10 +#define WEAR_SHIELD 11 +#define WEAR_ABOUT 12 +#define WEAR_WAIST 13 +#define WEAR_WRIST_L 14 +#define WEAR_WRIST_R 15 +#define WEAR_WIELD 16 +#define WEAR_HOLD 17 +#define WEAR_FLOAT 18 +#define MAX_WEAR 19 + + + +/*************************************************************************** + * * + * VALUES OF INTEREST TO AREA BUILDERS * + * (End of this section ... stop here) * + * * + ***************************************************************************/ + +/* + * Conditions. + */ +#define COND_DRUNK 0 +#define COND_FULL 1 +#define COND_THIRST 2 +#define COND_HUNGER 3 + + + +/* + * Positions. + */ +#define POS_DEAD 0 +#define POS_MORTAL 1 +#define POS_INCAP 2 +#define POS_STUNNED 3 +#define POS_SLEEPING 4 +#define POS_RESTING 5 +#define POS_SITTING 6 +#define POS_FIGHTING 7 +#define POS_STANDING 8 + + + +/* + * ACT bits for players. + */ +#define PLR_IS_NPC (A) /* Don't EVER set. */ + +/* RT auto flags */ +#define PLR_AUTOASSIST (C) +#define PLR_AUTOEXIT (D) +#define PLR_AUTOLOOT (E) +#define PLR_AUTOSAC (F) +#define PLR_AUTOGOLD (G) +#define PLR_AUTOSPLIT (H) + +/* RT personal flags */ +#define PLR_HOLYLIGHT (N) +#define PLR_CANLOOT (P) +#define PLR_NOSUMMON (Q) +#define PLR_NOFOLLOW (R) +/* 2 bits reserved, S-T */ + +/* penalty flags */ +#define PLR_PERMIT (U) +#define PLR_LOG (W) +#define PLR_DENY (X) +#define PLR_FREEZE (Y) +#define PLR_THIEF (Z) +#define PLR_KILLER (aa) + + +/* RT comm flags -- may be used on both mobs and chars */ +#define COMM_QUIET (A) +#define COMM_DEAF (B) +#define COMM_NOWIZ (C) +#define COMM_NOAUCTION (D) +#define COMM_NOGOSSIP (E) +#define COMM_NOQUESTION (F) +#define COMM_NOMUSIC (G) +#define COMM_NOCLAN (H) +#define COMM_NOQUOTE (I) +#define COMM_SHOUTSOFF (J) + +/* display flags */ +#define COMM_COMPACT (L) +#define COMM_BRIEF (M) +#define COMM_PROMPT (N) +#define COMM_COMBINE (O) +#define COMM_TELNET_GA (P) +#define COMM_SHOW_AFFECTS (Q) +#define COMM_NOGRATS (R) + +/* penalties */ +#define COMM_NOEMOTE (T) +#define COMM_NOSHOUT (U) +#define COMM_NOTELL (V) +#define COMM_NOCHANNELS (W) +#define COMM_SNOOP_PROOF (Y) +#define COMM_AFK (Z) + +/* WIZnet flags */ +#define WIZ_ON (A) +#define WIZ_TICKS (B) +#define WIZ_LOGINS (C) +#define WIZ_SITES (D) +#define WIZ_LINKS (E) +#define WIZ_DEATHS (F) +#define WIZ_RESETS (G) +#define WIZ_MOBDEATHS (H) +#define WIZ_FLAGS (I) +#define WIZ_PENALTIES (J) +#define WIZ_SACCING (K) +#define WIZ_LEVELS (L) +#define WIZ_SECURE (M) +#define WIZ_SWITCHES (N) +#define WIZ_SNOOPS (O) +#define WIZ_RESTORE (P) +#define WIZ_LOAD (Q) +#define WIZ_NEWBIE (R) +#define WIZ_PREFIX (S) +#define WIZ_SPAM (T) + +/* + * Prototype for a mob. + * This is the in-memory version of #MOBILES. + */ +struct mob_index_data +{ + MOB_INDEX_DATA * next; + SPEC_FUN * spec_fun; + SHOP_DATA * pShop; + sh_int vnum; + sh_int group; + bool new_format; + sh_int count; + sh_int killed; + char * player_name; + char * short_descr; + char * long_descr; + char * description; + long act; + long affected_by; + sh_int alignment; + sh_int level; + sh_int hitroll; + sh_int hit[3]; + sh_int mana[3]; + sh_int damage[3]; + sh_int ac[4]; + sh_int dam_type; + long off_flags; + long imm_flags; + long res_flags; + long vuln_flags; + sh_int start_pos; + sh_int default_pos; + sh_int sex; + sh_int race; + long wealth; + long form; + long parts; + sh_int size; + char * material; +}; + + + +/* memory settings */ +#define MEM_CUSTOMER A +#define MEM_SELLER B +#define MEM_HOSTILE C +#define MEM_AFRAID D + +/* memory for mobs */ +struct mem_data +{ + MEM_DATA *next; + bool valid; + int id; + int reaction; + time_t when; +}; + + +/* + * One character (PC or NPC). + */ +struct char_data +{ + CHAR_DATA * next; + CHAR_DATA * next_in_room; + CHAR_DATA * master; + CHAR_DATA * leader; + CHAR_DATA * fighting; + CHAR_DATA * reply; + CHAR_DATA * pet; + MEM_DATA * memory; + SPEC_FUN * spec_fun; + MOB_INDEX_DATA * pIndexData; + DESCRIPTOR_DATA * desc; + AFFECT_DATA * affected; + NOTE_DATA * pnote; + OBJ_DATA * carrying; + OBJ_DATA * on; + ROOM_INDEX_DATA * in_room; + ROOM_INDEX_DATA * was_in_room; + AREA_DATA * zone; + PC_DATA * pcdata; + GEN_DATA * gen_data; + bool valid; + char * name; + long id; + sh_int version; + char * short_descr; + char * long_descr; + char * description; + char * prompt; + char * prefix; + sh_int group; + sh_int clan; + sh_int sex; + sh_int class; + sh_int race; + sh_int level; + sh_int trust; + int played; + int lines; /* for the pager */ + time_t logon; + sh_int timer; + sh_int wait; + sh_int daze; + sh_int hit; + sh_int max_hit; + sh_int mana; + sh_int max_mana; + sh_int move; + sh_int max_move; + long gold; + long silver; + int exp; + long act; + long comm; /* RT added to pad the vector */ + long wiznet; /* wiz stuff */ + long imm_flags; + long res_flags; + long vuln_flags; + sh_int invis_level; + sh_int incog_level; + long affected_by; + sh_int position; + sh_int practice; + sh_int train; + sh_int carry_weight; + sh_int carry_number; + sh_int saving_throw; + sh_int alignment; + sh_int hitroll; + sh_int damroll; + sh_int armor[4]; + sh_int wimpy; + /* stats */ + sh_int perm_stat[MAX_STATS]; + sh_int mod_stat[MAX_STATS]; + /* parts stuff */ + long form; + long parts; + sh_int size; + char* material; + /* mobile stuff */ + long off_flags; + sh_int damage[3]; + sh_int dam_type; + sh_int start_pos; + sh_int default_pos; +}; + + + +/* + * Data which only PC's have. + */ +struct pc_data +{ + PC_DATA * next; + BUFFER * buffer; + bool valid; + char * pwd; + char * bamfin; + char * bamfout; + char * title; + time_t last_note; + time_t last_idea; + time_t last_penalty; + time_t last_news; + time_t last_changes; + sh_int perm_hit; + sh_int perm_mana; + sh_int perm_move; + sh_int true_sex; + int last_level; + sh_int condition [4]; + sh_int learned [MAX_SKILL]; + bool group_known [MAX_GROUP]; + sh_int points; + bool confirm_delete; + char * alias[MAX_ALIAS]; + char * alias_sub[MAX_ALIAS]; +}; + +/* Data for generating characters -- only used during generation */ +struct gen_data +{ + GEN_DATA *next; + bool valid; + bool skill_chosen[MAX_SKILL]; + bool group_chosen[MAX_GROUP]; + int points_chosen; +}; + + + +/* + * Liquids. + */ +#define LIQ_WATER 0 + +struct liq_type +{ + char * liq_name; + char * liq_color; + sh_int liq_affect[5]; +}; + + + +/* + * Extra description data for a room or object. + */ +struct extra_descr_data +{ + EXTRA_DESCR_DATA *next; /* Next in list */ + bool valid; + char *keyword; /* Keyword in look/examine */ + char *description; /* What to see */ +}; + + + +/* + * Prototype for an object. + */ +struct obj_index_data +{ + OBJ_INDEX_DATA * next; + EXTRA_DESCR_DATA * extra_descr; + AFFECT_DATA * affected; + bool new_format; + char * name; + char * short_descr; + char * description; + sh_int vnum; + sh_int reset_num; + char * material; + sh_int item_type; + int extra_flags; + int wear_flags; + sh_int level; + sh_int condition; + sh_int count; + sh_int weight; + int cost; + int value[5]; +}; + + + +/* + * One object. + */ +struct obj_data +{ + OBJ_DATA * next; + OBJ_DATA * next_content; + OBJ_DATA * contains; + OBJ_DATA * in_obj; + OBJ_DATA * on; + CHAR_DATA * carried_by; + EXTRA_DESCR_DATA * extra_descr; + AFFECT_DATA * affected; + OBJ_INDEX_DATA * pIndexData; + ROOM_INDEX_DATA * in_room; + bool valid; + bool enchanted; + char * owner; + char * name; + char * short_descr; + char * description; + sh_int item_type; + int extra_flags; + int wear_flags; + sh_int wear_loc; + sh_int weight; + int cost; + sh_int level; + sh_int condition; + char * material; + sh_int timer; + int value [5]; +}; + + + +/* + * Exit data. + */ +struct exit_data +{ + union + { + ROOM_INDEX_DATA * to_room; + sh_int vnum; + } u1; + sh_int exit_info; + sh_int key; + char * keyword; + char * description; +}; + + + +/* + * Reset commands: + * '*': comment + * 'M': read a mobile + * 'O': read an object + * 'P': put object in object + * 'G': give object to mobile + * 'E': equip object to mobile + * 'D': set state of door + * 'R': randomize room exits + * 'S': stop (end of list) + */ + +/* + * Area-reset definition. + */ +struct reset_data +{ + RESET_DATA * next; + char command; + sh_int arg1; + sh_int arg2; + sh_int arg3; + sh_int arg4; +}; + + + +/* + * Area definition. + */ +struct area_data +{ + AREA_DATA * next; + RESET_DATA * reset_first; + RESET_DATA * reset_last; + char * file_name; + char * name; + char * credits; + sh_int age; + sh_int nplayer; + sh_int low_range; + sh_int high_range; + sh_int min_vnum; + sh_int max_vnum; + bool empty; +}; + + + +/* + * Room type. + */ +struct room_index_data +{ + ROOM_INDEX_DATA * next; + CHAR_DATA * people; + OBJ_DATA * contents; + EXTRA_DESCR_DATA * extra_descr; + AREA_DATA * area; + EXIT_DATA * exit [6]; + EXIT_DATA * old_exit[6]; + char * name; + char * description; + char * owner; + sh_int vnum; + int room_flags; + sh_int light; + sh_int sector_type; + sh_int heal_rate; + sh_int mana_rate; + sh_int clan; +}; + + + +/* + * Types of attacks. + * Must be non-overlapping with spell/skill types, + * but may be arbitrary beyond that. + */ +#define TYPE_UNDEFINED -1 +#define TYPE_HIT 1000 + + + +/* + * Target types. + */ +#define TAR_IGNORE 0 +#define TAR_CHAR_OFFENSIVE 1 +#define TAR_CHAR_DEFENSIVE 2 +#define TAR_CHAR_SELF 3 +#define TAR_OBJ_INV 4 +#define TAR_OBJ_CHAR_DEF 5 +#define TAR_OBJ_CHAR_OFF 6 + +#define TARGET_CHAR 0 +#define TARGET_OBJ 1 +#define TARGET_ROOM 2 +#define TARGET_NONE 3 + + + +/* + * Skills include spells as a particular case. + */ +struct skill_type +{ + char * name; /* Name of skill */ + sh_int skill_level[MAX_CLASS]; /* Level needed by class */ + sh_int rating[MAX_CLASS]; /* How hard it is to learn */ + SPELL_FUN * spell_fun; /* Spell pointer (for spells) */ + sh_int target; /* Legal targets */ + sh_int minimum_position; /* Position for caster / user */ + sh_int * pgsn; /* Pointer to associated gsn */ + sh_int slot; /* Slot for #OBJECT loading */ + sh_int min_mana; /* Minimum mana used */ + sh_int beats; /* Waiting time after use */ + char * noun_damage; /* Damage message */ + char * msg_off; /* Wear off message */ + char * msg_obj; /* Wear off message for obects */ +}; + +struct group_type +{ + char * name; + sh_int rating[MAX_CLASS]; + char * spells[MAX_IN_GROUP]; +}; + + + +/* + * These are skill_lookup return values for common skills and spells. + */ +extern sh_int gsn_backstab; +extern sh_int gsn_dodge; +extern sh_int gsn_envenom; +extern sh_int gsn_hide; +extern sh_int gsn_peek; +extern sh_int gsn_pick_lock; +extern sh_int gsn_sneak; +extern sh_int gsn_steal; + +extern sh_int gsn_disarm; +extern sh_int gsn_enhanced_damage; +extern sh_int gsn_kick; +extern sh_int gsn_parry; +extern sh_int gsn_rescue; +extern sh_int gsn_second_attack; +extern sh_int gsn_third_attack; + +extern sh_int gsn_blindness; +extern sh_int gsn_charm_person; +extern sh_int gsn_curse; +extern sh_int gsn_invis; +extern sh_int gsn_mass_invis; +extern sh_int gsn_plague; +extern sh_int gsn_poison; +extern sh_int gsn_sleep; +extern sh_int gsn_fly; +extern sh_int gsn_sanctuary; + +/* new gsns */ +extern sh_int gsn_axe; +extern sh_int gsn_dagger; +extern sh_int gsn_flail; +extern sh_int gsn_mace; +extern sh_int gsn_polearm; +extern sh_int gsn_shield_block; +extern sh_int gsn_spear; +extern sh_int gsn_sword; +extern sh_int gsn_whip; + +extern sh_int gsn_bash; +extern sh_int gsn_berserk; +extern sh_int gsn_dirt; +extern sh_int gsn_hand_to_hand; +extern sh_int gsn_trip; + +extern sh_int gsn_fast_healing; +extern sh_int gsn_haggle; +extern sh_int gsn_lore; +extern sh_int gsn_meditation; + +extern sh_int gsn_scrolls; +extern sh_int gsn_staves; +extern sh_int gsn_wands; +extern sh_int gsn_recall; + + + +/* + * Utility macros. + */ +#define IS_VALID(data) ((data) != NULL && (data)->valid) +#define VALIDATE(data) ((data)->valid = TRUE) +#define INVALIDATE(data) ((data)->valid = FALSE) +#define UMIN(a, b) ((a) < (b) ? (a) : (b)) +#define UMAX(a, b) ((a) > (b) ? (a) : (b)) +#define URANGE(a, b, c) ((b) < (a) ? (a) : ((b) > (c) ? (c) : (b))) +#define LOWER(c) ((c) >= 'A' && (c) <= 'Z' ? (c)+'a'-'A' : (c)) +#define UPPER(c) ((c) >= 'a' && (c) <= 'z' ? (c)+'A'-'a' : (c)) +#define IS_SET(flag, bit) ((flag) & (bit)) +#define SET_BIT(var, bit) ((var) |= (bit)) +#define REMOVE_BIT(var, bit) ((var) &= ~(bit)) + + + +/* + * Character macros. + */ +#define IS_NPC(ch) (IS_SET((ch)->act, ACT_IS_NPC)) +#define IS_IMMORTAL(ch) (get_trust(ch) >= LEVEL_IMMORTAL) +#define IS_HERO(ch) (get_trust(ch) >= LEVEL_HERO) +#define IS_TRUSTED(ch,level) (get_trust((ch)) >= (level)) +#define IS_AFFECTED(ch, sn) (IS_SET((ch)->affected_by, (sn))) + +#define GET_AGE(ch) ((int) (17 + ((ch)->played \ + + current_time - (ch)->logon )/72000)) + +#define IS_GOOD(ch) (ch->alignment >= 350) +#define IS_EVIL(ch) (ch->alignment <= -350) +#define IS_NEUTRAL(ch) (!IS_GOOD(ch) && !IS_EVIL(ch)) + +#define IS_AWAKE(ch) (ch->position > POS_SLEEPING) +#define GET_AC(ch,type) ((ch)->armor[type] \ + + ( IS_AWAKE(ch) \ + ? dex_app[get_curr_stat(ch,STAT_DEX)].defensive : 0 )) +#define GET_HITROLL(ch) \ + ((ch)->hitroll+str_app[get_curr_stat(ch,STAT_STR)].tohit) +#define GET_DAMROLL(ch) \ + ((ch)->damroll+str_app[get_curr_stat(ch,STAT_STR)].todam) + +#define IS_OUTSIDE(ch) (!IS_SET( \ + (ch)->in_room->room_flags, \ + ROOM_INDOORS)) + +#define WAIT_STATE(ch, npulse) ((ch)->wait = UMAX((ch)->wait, (npulse))) +#define DAZE_STATE(ch, npulse) ((ch)->daze = UMAX((ch)->daze, (npulse))) +#define get_carry_weight(ch) ((ch)->carry_weight + (ch)->silver/10 + \ + (ch)->gold * 2 / 5) + +#define act(format,ch,arg1,arg2,type)\ + act_new((format),(ch),(arg1),(arg2),(type),POS_RESTING) + +/* + * Object macros. + */ +#define CAN_WEAR(obj, part) (IS_SET((obj)->wear_flags, (part))) +#define IS_OBJ_STAT(obj, stat) (IS_SET((obj)->extra_flags, (stat))) +#define IS_WEAPON_STAT(obj,stat)(IS_SET((obj)->value[4],(stat))) +#define WEIGHT_MULT(obj) ((obj)->item_type == ITEM_CONTAINER ? \ + (obj)->value[4] : 100) + + + +/* + * Description macros. + */ +#define PERS(ch, looker) ( can_see( looker, (ch) ) ? \ + ( IS_NPC(ch) ? (ch)->short_descr \ + : (ch)->name ) : "someone" ) + +/* + * Structure for a social in the socials table. + */ +struct social_type +{ + char name[20]; + char * char_no_arg; + char * others_no_arg; + char * char_found; + char * others_found; + char * vict_found; + char * char_not_found; + char * char_auto; + char * others_auto; +}; + + + +/* + * Global constants. + */ +extern const struct str_app_type str_app [26]; +extern const struct int_app_type int_app [26]; +extern const struct wis_app_type wis_app [26]; +extern const struct dex_app_type dex_app [26]; +extern const struct con_app_type con_app [26]; + +extern const struct class_type class_table [MAX_CLASS]; +extern const struct weapon_type weapon_table []; +extern const struct item_type item_table []; +extern const struct wiznet_type wiznet_table []; +extern const struct attack_type attack_table []; +extern const struct race_type race_table []; +extern const struct pc_race_type pc_race_table []; +extern const struct spec_type spec_table []; +extern const struct liq_type liq_table []; +extern const struct skill_type skill_table [MAX_SKILL]; +extern const struct group_type group_table [MAX_GROUP]; +extern struct social_type social_table [MAX_SOCIALS]; +extern char * const title_table [MAX_CLASS] + [MAX_LEVEL+1] + [2]; + + + +/* + * Global variables. + */ +extern HELP_DATA * help_first; +extern SHOP_DATA * shop_first; + +extern CHAR_DATA * char_list; +extern DESCRIPTOR_DATA * descriptor_list; +extern OBJ_DATA * object_list; + +extern char bug_buf []; +extern time_t current_time; +extern bool fLogAll; +extern FILE * fpReserve; +extern KILL_DATA kill_table []; +extern char log_buf []; +extern TIME_INFO_DATA time_info; +extern WEATHER_DATA weather_info; + +/* + * OS-dependent declarations. + * These are all very standard library functions, + * but some systems have incomplete or non-ansi header files. + */ +#if defined(_AIX) +char * crypt args( ( const char *key, const char *salt ) ); +#endif + +#if defined(apollo) +int atoi args( ( const char *string ) ); +void * calloc args( ( unsigned nelem, size_t size ) ); +char * crypt args( ( const char *key, const char *salt ) ); +#endif + +#if defined(hpux) +char * crypt args( ( const char *key, const char *salt ) ); +#endif + +#if defined(linux) +char * crypt args( ( const char *key, const char *salt ) ); +#endif + +#if defined(macintosh) +#define NOCRYPT +#if defined(unix) +#undef unix +#endif +#endif + +#if defined(MIPS_OS) +char * crypt args( ( const char *key, const char *salt ) ); +#endif + +#if defined(MSDOS) +#define NOCRYPT +#if defined(unix) +#undef unix +#endif +#endif + +#if defined(NeXT) +char * crypt args( ( const char *key, const char *salt ) ); +#endif + +#if defined(sequent) +char * crypt args( ( const char *key, const char *salt ) ); +int fclose args( ( FILE *stream ) ); +int fprintf args( ( FILE *stream, const char *format, ... ) ); +int fread args( ( void *ptr, int size, int n, FILE *stream ) ); +int fseek args( ( FILE *stream, long offset, int ptrname ) ); +void perror args( ( const char *s ) ); +int ungetc args( ( int c, FILE *stream ) ); +#endif + +#if defined(sun) +char * crypt args( ( const char *key, const char *salt ) ); +int fclose args( ( FILE *stream ) ); +int fprintf args( ( FILE *stream, const char *format, ... ) ); +#if defined(SYSV) +siz_t fread args( ( void *ptr, size_t size, size_t n, + FILE *stream) ); +#elif !defined(__SVR4) +int fread args( ( void *ptr, int size, int n, FILE *stream ) ); +#endif +int fseek args( ( FILE *stream, long offset, int ptrname ) ); +void perror args( ( const char *s ) ); +int ungetc args( ( int c, FILE *stream ) ); +#endif + +#if defined(ultrix) +char * crypt args( ( const char *key, const char *salt ) ); +#endif + + + +/* + * The crypt(3) function is not available on some operating systems. + * In particular, the U.S. Government prohibits its export from the + * United States to foreign countries. + * Turn on NOCRYPT to keep passwords in plain text. + */ +#if defined(NOCRYPT) +#define crypt(s1, s2) (s1) +#endif + + + +/* + * Data files used by the server. + * + * AREA_LIST contains a list of areas to boot. + * All files are read in completely at bootup. + * Most output files (bug, idea, typo, shutdown) are append-only. + * + * The NULL_FILE is held open so that we have a stream handle in reserve, + * so players can go ahead and telnet to all the other descriptors. + * Then we close it whenever we need to open a file (e.g. a save file). + */ +#if defined(macintosh) +#define PLAYER_DIR "" /* Player files */ +#define TEMP_FILE "romtmp" +#define NULL_FILE "proto.are" /* To reserve one stream */ +#endif + +#if defined(MSDOS) +#define PLAYER_DIR "" /* Player files */ +#define TEMP_FILE "romtmp" +#define NULL_FILE "nul" /* To reserve one stream */ +#endif + +#if defined(unix) +#define PLAYER_DIR "../player/" /* Player files */ +#define GOD_DIR "../gods/" /* list of gods */ +#define TEMP_FILE "../player/romtmp" +#define NULL_FILE "/dev/null" /* To reserve one stream */ +#endif + +#define AREA_LIST "area.lst" /* List of areas*/ +#define BUG_FILE "bugs.txt" /* For 'bug' and bug()*/ +#define TYPO_FILE "typos.txt" /* For 'typo'*/ +#define NOTE_FILE "notes.not"/* For 'notes'*/ +#define IDEA_FILE "ideas.not" +#define PENALTY_FILE "penal.not" +#define NEWS_FILE "news.not" +#define CHANGES_FILE "chang.not" +#define SHUTDOWN_FILE "shutdown.txt"/* For 'shutdown'*/ +#define BAN_FILE "ban.txt" +#define MUSIC_FILE "music.txt" + + + +/* + * Our function prototypes. + * One big lump ... this is every function in Merc. + */ +#define CD CHAR_DATA +#define MID MOB_INDEX_DATA +#define OD OBJ_DATA +#define OID OBJ_INDEX_DATA +#define RID ROOM_INDEX_DATA +#define SF SPEC_FUN +#define AD AFFECT_DATA + +/* act_comm.c */ +void check_sex args( ( CHAR_DATA *ch) ); +void add_follower args( ( CHAR_DATA *ch, CHAR_DATA *master ) ); +void stop_follower args( ( CHAR_DATA *ch ) ); +void nuke_pets args( ( CHAR_DATA *ch ) ); +void die_follower args( ( CHAR_DATA *ch ) ); +bool is_same_group args( ( CHAR_DATA *ach, CHAR_DATA *bch ) ); + +/* act_enter.c */ +RID *get_random_room args ( (CHAR_DATA *ch) ); + +/* act_info.c */ +void set_title args( ( CHAR_DATA *ch, char *title ) ); + +/* act_move.c */ +void move_char args( ( CHAR_DATA *ch, int door, bool follow ) ); + +/* act_obj.c */ +bool can_loot args( (CHAR_DATA *ch, OBJ_DATA *obj) ); +void get_obj args( ( CHAR_DATA *ch, OBJ_DATA *obj, + OBJ_DATA *container ) ); + +/* act_wiz.c */ +void wiznet args( (char *string, CHAR_DATA *ch, OBJ_DATA *obj, + long flag, long flag_skip, int min_level ) ); +/* alias.c */ +void substitute_alias args( (DESCRIPTOR_DATA *d, char *input) ); + +/* ban.c */ +bool check_ban args( ( char *site, int type) ); + + +/* comm.c */ +void show_string args( ( struct descriptor_data *d, char *input) ); +void close_socket args( ( DESCRIPTOR_DATA *dclose ) ); +void write_to_buffer args( ( DESCRIPTOR_DATA *d, const char *txt, + int length ) ); +void send_to_char args( ( const char *txt, CHAR_DATA *ch ) ); +void page_to_char args( ( const char *txt, CHAR_DATA *ch ) ); +void act args( ( const char *format, CHAR_DATA *ch, + const void *arg1, const void *arg2, int type ) ); +void act_new args( ( const char *format, CHAR_DATA *ch, + const void *arg1, const void *arg2, int type, + int min_pos) ); + +/* db.c */ +char * print_flags args( ( int flag )); +void boot_db args( ( void ) ); +void area_update args( ( void ) ); +CD * create_mobile args( ( MOB_INDEX_DATA *pMobIndex ) ); +void clone_mobile args( ( CHAR_DATA *parent, CHAR_DATA *clone) ); +OD * create_object args( ( OBJ_INDEX_DATA *pObjIndex, int level ) ); +void clone_object args( ( OBJ_DATA *parent, OBJ_DATA *clone ) ); +void clear_char args( ( CHAR_DATA *ch ) ); +char * get_extra_descr args( ( const char *name, EXTRA_DESCR_DATA *ed ) ); +MID * get_mob_index args( ( int vnum ) ); +OID * get_obj_index args( ( int vnum ) ); +RID * get_room_index args( ( int vnum ) ); +char fread_letter args( ( FILE *fp ) ); +int fread_number args( ( FILE *fp ) ); +long fread_flag args( ( FILE *fp ) ); +char * fread_string args( ( FILE *fp ) ); +char * fread_string_eol args(( FILE *fp ) ); +void fread_to_eol args( ( FILE *fp ) ); +char * fread_word args( ( FILE *fp ) ); +long flag_convert args( ( char letter) ); +void * alloc_mem args( ( int sMem ) ); +void * alloc_perm args( ( int sMem ) ); +void free_mem args( ( void *pMem, int sMem ) ); +char * str_dup args( ( const char *str ) ); +void free_string args( ( char *pstr ) ); +int number_fuzzy args( ( int number ) ); +int number_range args( ( int from, int to ) ); +int number_percent args( ( void ) ); +int number_door args( ( void ) ); +int number_bits args( ( int width ) ); +long number_mm args( ( void ) ); +int dice args( ( int number, int size ) ); +int interpolate args( ( int level, int value_00, int value_32 ) ); +void smash_tilde args( ( char *str ) ); +bool str_cmp args( ( const char *astr, const char *bstr ) ); +bool str_prefix args( ( const char *astr, const char *bstr ) ); +bool str_infix args( ( const char *astr, const char *bstr ) ); +bool str_suffix args( ( const char *astr, const char *bstr ) ); +char * capitalize args( ( const char *str ) ); +void append_file args( ( CHAR_DATA *ch, char *file, char *str ) ); +void bug args( ( const char *str, int param ) ); +void log_string args( ( const char *str ) ); +void tail_chain args( ( void ) ); + +/* effect.c */ +void acid_effect args( (void *vo, int level, int dam, int target) ); +void cold_effect args( (void *vo, int level, int dam, int target) ); +void fire_effect args( (void *vo, int level, int dam, int target) ); +void poison_effect args( (void *vo, int level, int dam, int target) ); +void shock_effect args( (void *vo, int level, int dam, int target) ); + + +/* fight.c */ +bool is_safe args( (CHAR_DATA *ch, CHAR_DATA *victim ) ); +bool is_safe_spell args( (CHAR_DATA *ch, CHAR_DATA *victim, bool area ) ); +void violence_update args( ( void ) ); +void multi_hit args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dt ) ); +bool damage args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dam, + int dt, int class, bool show ) ); +bool damage_old args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dam, + int dt, int class, bool show ) ); +void update_pos args( ( CHAR_DATA *victim ) ); +void stop_fighting args( ( CHAR_DATA *ch, bool fBoth ) ); +void check_killer args( ( CHAR_DATA *ch, CHAR_DATA *victim) ); + +/* handler.c */ +AD *affect_find args( (AFFECT_DATA *paf, int sn)); +void affect_check args( (CHAR_DATA *ch, int where, int vector) ); +int count_users args( (OBJ_DATA *obj) ); +void deduct_cost args( (CHAR_DATA *ch, int cost) ); +void affect_enchant args( (OBJ_DATA *obj) ); +int check_immune args( (CHAR_DATA *ch, int dam_type) ); +int liq_lookup args( ( const char *name) ); +int material_lookup args( ( const char *name) ); +int weapon_lookup args( ( const char *name) ); +int weapon_type args( ( const char *name) ); +char *weapon_name args( ( int weapon_Type) ); +int item_lookup args( ( const char *name) ); +char *item_name args( ( int item_type) ); +int attack_lookup args( ( const char *name) ); +int race_lookup args( ( const char *name) ); +long wiznet_lookup args( ( const char *name) ); +int class_lookup args( ( const char *name) ); +bool is_clan args( (CHAR_DATA *ch) ); +bool is_same_clan args( (CHAR_DATA *ch, CHAR_DATA *victim)); +bool is_old_mob args ( (CHAR_DATA *ch) ); +int get_skill args( ( CHAR_DATA *ch, int sn ) ); +int get_weapon_sn args( ( CHAR_DATA *ch ) ); +int get_weapon_skill args(( CHAR_DATA *ch, int sn ) ); +int get_age args( ( CHAR_DATA *ch ) ); +void reset_char args( ( CHAR_DATA *ch ) ); +int get_trust args( ( CHAR_DATA *ch ) ); +int get_curr_stat args( ( CHAR_DATA *ch, int stat ) ); +int get_max_train args( ( CHAR_DATA *ch, int stat ) ); +int can_carry_n args( ( CHAR_DATA *ch ) ); +int can_carry_w args( ( CHAR_DATA *ch ) ); +bool is_name args( ( char *str, char *namelist ) ); +bool is_exact_name args( ( char *str, char *namelist ) ); +void affect_to_char args( ( CHAR_DATA *ch, AFFECT_DATA *paf ) ); +void affect_to_obj args( ( OBJ_DATA *obj, AFFECT_DATA *paf ) ); +void affect_remove args( ( CHAR_DATA *ch, AFFECT_DATA *paf ) ); +void affect_remove_obj args( (OBJ_DATA *obj, AFFECT_DATA *paf ) ); +void affect_strip args( ( CHAR_DATA *ch, int sn ) ); +bool is_affected args( ( CHAR_DATA *ch, int sn ) ); +void affect_join args( ( CHAR_DATA *ch, AFFECT_DATA *paf ) ); +void char_from_room args( ( CHAR_DATA *ch ) ); +void char_to_room args( ( CHAR_DATA *ch, ROOM_INDEX_DATA *pRoomIndex ) ); +void obj_to_char args( ( OBJ_DATA *obj, CHAR_DATA *ch ) ); +void obj_from_char args( ( OBJ_DATA *obj ) ); +int apply_ac args( ( OBJ_DATA *obj, int iWear, int type ) ); +OD * get_eq_char args( ( CHAR_DATA *ch, int iWear ) ); +void equip_char args( ( CHAR_DATA *ch, OBJ_DATA *obj, int iWear ) ); +void unequip_char args( ( CHAR_DATA *ch, OBJ_DATA *obj ) ); +int count_obj_list args( ( OBJ_INDEX_DATA *obj, OBJ_DATA *list ) ); +void obj_from_room args( ( OBJ_DATA *obj ) ); +void obj_to_room args( ( OBJ_DATA *obj, ROOM_INDEX_DATA *pRoomIndex ) ); +void obj_to_obj args( ( OBJ_DATA *obj, OBJ_DATA *obj_to ) ); +void obj_from_obj args( ( OBJ_DATA *obj ) ); +void extract_obj args( ( OBJ_DATA *obj ) ); +void extract_char args( ( CHAR_DATA *ch, bool fPull ) ); +CD * get_char_room args( ( CHAR_DATA *ch, char *argument ) ); +CD * get_char_world args( ( CHAR_DATA *ch, char *argument ) ); +OD * get_obj_type args( ( OBJ_INDEX_DATA *pObjIndexData ) ); +OD * get_obj_list args( ( CHAR_DATA *ch, char *argument, + OBJ_DATA *list ) ); +OD * get_obj_carry args( ( CHAR_DATA *ch, char *argument, + CHAR_DATA *viewer ) ); +OD * get_obj_wear args( ( CHAR_DATA *ch, char *argument ) ); +OD * get_obj_here args( ( CHAR_DATA *ch, char *argument ) ); +OD * get_obj_world args( ( CHAR_DATA *ch, char *argument ) ); +OD * create_money args( ( int gold, int silver ) ); +int get_obj_number args( ( OBJ_DATA *obj ) ); +int get_obj_weight args( ( OBJ_DATA *obj ) ); +int get_true_weight args( ( OBJ_DATA *obj ) ); +bool room_is_dark args( ( ROOM_INDEX_DATA *pRoomIndex ) ); +bool is_room_owner args( ( CHAR_DATA *ch, ROOM_INDEX_DATA *room) ); +bool room_is_private args( ( ROOM_INDEX_DATA *pRoomIndex ) ); +bool can_see args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); +bool can_see_obj args( ( CHAR_DATA *ch, OBJ_DATA *obj ) ); +bool can_see_room args( ( CHAR_DATA *ch, ROOM_INDEX_DATA *pRoomIndex) ); +bool can_drop_obj args( ( CHAR_DATA *ch, OBJ_DATA *obj ) ); +char * affect_loc_name args( ( int location ) ); +char * affect_bit_name args( ( int vector ) ); +char * extra_bit_name args( ( int extra_flags ) ); +char * wear_bit_name args( ( int wear_flags ) ); +char * act_bit_name args( ( int act_flags ) ); +char * off_bit_name args( ( int off_flags ) ); +char * imm_bit_name args( ( int imm_flags ) ); +char * form_bit_name args( ( int form_flags ) ); +char * part_bit_name args( ( int part_flags ) ); +char * weapon_bit_name args( ( int weapon_flags ) ); +char * comm_bit_name args( ( int comm_flags ) ); +char * cont_bit_name args( ( int cont_flags) ); + + +/* interp.c */ +void interpret args( ( CHAR_DATA *ch, char *argument ) ); +bool is_number args( ( char *arg ) ); +int number_argument args( ( char *argument, char *arg ) ); +int mult_argument args( ( char *argument, char *arg) ); +char * one_argument args( ( char *argument, char *arg_first ) ); + +/* magic.c */ +int find_spell args( ( CHAR_DATA *ch, const char *name) ); +int mana_cost (CHAR_DATA *ch, int min_mana, int level); +int skill_lookup args( ( const char *name ) ); +int slot_lookup args( ( int slot ) ); +bool saves_spell args( ( int level, CHAR_DATA *victim, int dam_type ) ); +void obj_cast_spell args( ( int sn, int level, CHAR_DATA *ch, + CHAR_DATA *victim, OBJ_DATA *obj ) ); +/* save.c */ +void save_char_obj args( ( CHAR_DATA *ch ) ); +bool load_char_obj args( ( DESCRIPTOR_DATA *d, char *name ) ); + +/* skills.c */ +bool parse_gen_groups args( ( CHAR_DATA *ch,char *argument ) ); +void list_group_costs args( ( CHAR_DATA *ch ) ); +void list_group_known args( ( CHAR_DATA *ch ) ); +int exp_per_level args( ( CHAR_DATA *ch, int points ) ); +void check_improve args( ( CHAR_DATA *ch, int sn, bool success, + int multiplier ) ); +int group_lookup args( (const char *name) ); +void gn_add args( ( CHAR_DATA *ch, int gn) ); +void gn_remove args( ( CHAR_DATA *ch, int gn) ); +void group_add args( ( CHAR_DATA *ch, const char *name, bool deduct) ); +void group_remove args( ( CHAR_DATA *ch, const char *name) ); + +/* special.c */ +SF * spec_lookup args( ( const char *name ) ); +char * spec_name args( ( SPEC_FUN *function ) ); + +/* teleport.c */ +RID * room_by_name args( ( char *target, int level, bool error) ); + +/* update.c */ +void advance_level args( ( CHAR_DATA *ch, bool hide ) ); +void gain_exp args( ( CHAR_DATA *ch, int gain ) ); +void gain_condition args( ( CHAR_DATA *ch, int iCond, int value ) ); +void update_handler args( ( void ) ); + +#undef CD +#undef MID +#undef OD +#undef OID +#undef RID +#undef SF +#undef AD diff --git a/Rom24/src/music.c b/Rom24/src/music.c new file mode 100644 index 0000000..5883daa --- /dev/null +++ b/Rom24/src/music.c @@ -0,0 +1,350 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +#if defined(macintosh) +#include +#else +#include +#include +#endif +#include +#include +#include +#include +#include "merc.h" +#include "music.h" +#include "recycle.h" + +int channel_songs[MAX_GLOBAL + 1]; +struct song_data song_table[MAX_SONGS]; + +void song_update(void) +{ + OBJ_DATA *obj; + CHAR_DATA *victim; + ROOM_INDEX_DATA *room; + DESCRIPTOR_DATA *d; + char buf[MAX_STRING_LENGTH]; + char *line; + int i; + + /* do the global song, if any */ + if (channel_songs[1] >= MAX_SONGS) + channel_songs[1] = -1; + + if (channel_songs[1] > -1) + { + if (channel_songs[0] >= MAX_LINES + || channel_songs[0] >= song_table[channel_songs[1]].lines) + { + channel_songs[0] = -1; + + /* advance songs */ + for (i = 1; i < MAX_GLOBAL; i++) + channel_songs[i] = channel_songs[i+1]; + channel_songs[MAX_GLOBAL] = -1; + } + else + { + if (channel_songs[0] < 0) + { + sprintf(buf,"Music: %s, %s", + song_table[channel_songs[1]].group, + song_table[channel_songs[1]].name); + channel_songs[0] = 0; + } + else + { + sprintf(buf,"Music: '%s'", + song_table[channel_songs[1]].lyrics[channel_songs[0]]); + channel_songs[0]++; + } + + for (d = descriptor_list; d != NULL; d = d->next) + { + victim = d->original ? d->original : d->character; + + if ( d->connected == CON_PLAYING && + !IS_SET(victim->comm,COMM_NOMUSIC) && + !IS_SET(victim->comm,COMM_QUIET) ) + act_new("$t",d->character,buf,NULL,TO_CHAR,POS_SLEEPING); + } + } + } + + for (obj = object_list; obj != NULL; obj = obj->next) + { + if (obj->item_type != ITEM_JUKEBOX || obj->value[1] < 0) + continue; + + if (obj->value[1] >= MAX_SONGS) + { + obj->value[1] = -1; + continue; + } + + /* find which room to play in */ + + if ((room = obj->in_room) == NULL) + { + if (obj->carried_by == NULL) + continue; + else + if ((room = obj->carried_by->in_room) == NULL) + continue; + } + + if (obj->value[0] < 0) + { + sprintf(buf,"$p starts playing %s, %s.", + song_table[obj->value[1]].group,song_table[obj->value[1]].name); + if (room->people != NULL) + act(buf,room->people,obj,NULL,TO_ALL); + obj->value[0] = 0; + continue; + } + else + { + if (obj->value[0] >= MAX_LINES + || obj->value[0] >= song_table[obj->value[1]].lines) + { + + obj->value[0] = -1; + + /* scroll songs forward */ + obj->value[1] = obj->value[2]; + obj->value[2] = obj->value[3]; + obj->value[3] = obj->value[4]; + obj->value[4] = -1; + continue; + } + + line = song_table[obj->value[1]].lyrics[obj->value[0]]; + obj->value[0]++; + } + + sprintf(buf,"$p bops: '%s'",line); + if (room->people != NULL) + act(buf,room->people,obj,NULL,TO_ALL); + } +} + + + +void load_songs(void) +{ + FILE *fp; + int count = 0, lines, i; + char letter; + + /* reset global */ + for (i = 0; i <= MAX_GLOBAL; i++) + channel_songs[i] = -1; + + if ((fp = fopen(MUSIC_FILE,"r")) == NULL) + { + bug("Couldn't open music file, no songs available.",0); + fclose(fp); + return; + } + + for (count = 0; count < MAX_SONGS; count++) + { + letter = fread_letter(fp); + if (letter == '#') + { + if (count < MAX_SONGS) + song_table[count].name = NULL; + fclose(fp); + return; + } + else + ungetc(letter,fp); + + song_table[count].group = fread_string(fp); + song_table[count].name = fread_string(fp); + + /* read lyrics */ + lines = 0; + + for ( ; ;) + { + letter = fread_letter(fp); + + if (letter == '~') + { + song_table[count].lines = lines; + break; + } + else + ungetc(letter,fp); + + if (lines >= MAX_LINES) + { + bug("Too many lines in a song -- limit is %d.",MAX_LINES); + break; + } + + song_table[count].lyrics[lines] = fread_string_eol(fp); + lines++; + } + } +} + +void do_play(CHAR_DATA *ch, char *argument) +{ + OBJ_DATA *juke; + char *str,arg[MAX_INPUT_LENGTH]; + int song,i; + bool global = FALSE; + + str = one_argument(argument,arg); + + for (juke = ch->in_room->contents; juke != NULL; juke = juke->next_content) + if (juke->item_type == ITEM_JUKEBOX && can_see_obj(ch,juke)) + break; + + if (argument[0] == '\0') + { + send_to_char("Play what?\n\r",ch); + return; + } + + if (juke == NULL) + { + send_to_char("You see nothing to play.\n\r",ch); + return; + } + + if (!str_cmp(arg,"list")) + { + BUFFER *buffer; + char buf[MAX_STRING_LENGTH]; + int col = 0; + bool artist = FALSE, match = FALSE; + + buffer = new_buf(); + argument = str; + argument = one_argument(argument,arg); + + if (!str_cmp(arg,"artist")) + artist = TRUE; + + if (argument[0] != '\0') + match = TRUE; + + sprintf(buf,"%s has the following songs available:\n\r", + juke->short_descr); + add_buf(buffer,capitalize(buf)); + + for (i = 0; i < MAX_SONGS; i++) + { + if (song_table[i].name == NULL) + break; + + if (artist && (!match + || !str_prefix(argument,song_table[i].group))) + sprintf(buf,"%-39s %-39s\n\r", + song_table[i].group,song_table[i].name); + else if (!artist && (!match + || !str_prefix(argument,song_table[i].name))) + sprintf(buf,"%-35s ",song_table[i].name); + else + continue; + add_buf(buffer,buf); + if (!artist && ++col % 2 == 0) + add_buf(buffer,"\n\r"); + } + if (!artist && col % 2 != 0) + add_buf(buffer,"\n\r"); + + page_to_char(buf_string(buffer),ch); + free_buf(buffer); + return; + } + + if (!str_cmp(arg,"loud")) + { + argument = str; + global = TRUE; + } + + if (argument[0] == '\0') + { + send_to_char("Play what?\n\r",ch); + return; + } + + if ((global && channel_songs[MAX_GLOBAL] > -1) + || (!global && juke->value[4] > -1)) + { + send_to_char("The jukebox is full up right now.\n\r",ch); + return; + } + + for (song = 0; song < MAX_SONGS; song++) + { + if (song_table[song].name == NULL) + { + send_to_char("That song isn't available.\n\r",ch); + return; + } + if (!str_prefix(argument,song_table[song].name)) + break; + } + + if (song >= MAX_SONGS) + { + send_to_char("That song isn't available.\n\r",ch); + return; + } + + send_to_char("Coming right up.\n\r",ch); + + if (global) + { + for (i = 1; i <= MAX_GLOBAL; i++) + if (channel_songs[i] < 0) + { + if (i == 1) + channel_songs[0] = -1; + channel_songs[i] = song; + return; + } + } + else + { + for (i = 1; i < 5; i++) + if (juke->value[i] < 0) + { + if (i == 1) + juke->value[0] = -1; + juke->value[i] = song; + return; + } + } +} diff --git a/Rom24/src/music.h b/Rom24/src/music.h new file mode 100644 index 0000000..15bc0e1 --- /dev/null +++ b/Rom24/src/music.h @@ -0,0 +1,43 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +#define MAX_SONGS 20 +#define MAX_LINES 100 /* this boils down to about 1k per song */ +#define MAX_GLOBAL 10 /* max songs the global jukebox can hold */ + +struct song_data +{ + char *group; + char *name; + char *lyrics[MAX_LINES]; + int lines; +}; + +extern struct song_data song_table[MAX_SONGS]; + +void song_update args( (void) ); +void load_songs args( (void) ); diff --git a/Rom24/src/note.c b/Rom24/src/note.c new file mode 100644 index 0000000..ae5ebc5 --- /dev/null +++ b/Rom24/src/note.c @@ -0,0 +1,960 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +#if defined(macintosh) +#include +#else +#include +#include +#endif +#include +#include +#include +#include +#include +#include "merc.h" +#include "recycle.h" +#include "tables.h" + +/* globals from db.c for load_notes */ +#if !defined(macintosh) +extern int _filbuf args( (FILE *) ); +#endif +extern FILE * fpArea; +extern char strArea[MAX_INPUT_LENGTH]; + +/* local procedures */ +void load_thread(char *name, NOTE_DATA **list, int type, time_t free_time); +void parse_note(CHAR_DATA *ch, char *argument, int type); +bool hide_note(CHAR_DATA *ch, NOTE_DATA *pnote); + +NOTE_DATA *note_list; +NOTE_DATA *idea_list; +NOTE_DATA *penalty_list; +NOTE_DATA *news_list; +NOTE_DATA *changes_list; + +int count_spool(CHAR_DATA *ch, NOTE_DATA *spool) +{ + int count = 0; + NOTE_DATA *pnote; + + for (pnote = spool; pnote != NULL; pnote = pnote->next) + if (!hide_note(ch,pnote)) + count++; + + return count; +} + +void do_unread(CHAR_DATA *ch) +{ + char buf[MAX_STRING_LENGTH]; + int count; + bool found = FALSE; + + if (IS_NPC(ch)) + return; + + if ((count = count_spool(ch,news_list)) > 0) + { + found = TRUE; + sprintf(buf,"There %s %d new news article%s waiting.\n\r", + count > 1 ? "are" : "is",count, count > 1 ? "s" : ""); + send_to_char(buf,ch); + } + if ((count = count_spool(ch,changes_list)) > 0) + { + found = TRUE; + sprintf(buf,"There %s %d change%s waiting to be read.\n\r", + count > 1 ? "are" : "is", count, count > 1 ? "s" : ""); + send_to_char(buf,ch); + } + if ((count = count_spool(ch,note_list)) > 0) + { + found = TRUE; + sprintf(buf,"You have %d new note%s waiting.\n\r", + count, count > 1 ? "s" : ""); + send_to_char(buf,ch); + } + if ((count = count_spool(ch,idea_list)) > 0) + { + found = TRUE; + sprintf(buf,"You have %d unread idea%s to peruse.\n\r", + count, count > 1 ? "s" : ""); + send_to_char(buf,ch); + } + if (IS_TRUSTED(ch,ANGEL) && (count = count_spool(ch,penalty_list)) > 0) + { + found = TRUE; + sprintf(buf,"%d %s been added.\n\r", + count, count > 1 ? "penalties have" : "penalty has"); + send_to_char(buf,ch); + } + + if (!found) + send_to_char("You have no unread notes.\n\r",ch); +} + +void do_note(CHAR_DATA *ch,char *argument) +{ + parse_note(ch,argument,NOTE_NOTE); +} + +void do_idea(CHAR_DATA *ch,char *argument) +{ + parse_note(ch,argument,NOTE_IDEA); +} + +void do_penalty(CHAR_DATA *ch,char *argument) +{ + parse_note(ch,argument,NOTE_PENALTY); +} + +void do_news(CHAR_DATA *ch,char *argument) +{ + parse_note(ch,argument,NOTE_NEWS); +} + +void do_changes(CHAR_DATA *ch,char *argument) +{ + parse_note(ch,argument,NOTE_CHANGES); +} + +void save_notes(int type) +{ + FILE *fp; + char *name; + NOTE_DATA *pnote; + + switch (type) + { + default: + return; + case NOTE_NOTE: + name = NOTE_FILE; + pnote = note_list; + break; + case NOTE_IDEA: + name = IDEA_FILE; + pnote = idea_list; + break; + case NOTE_PENALTY: + name = PENALTY_FILE; + pnote = penalty_list; + break; + case NOTE_NEWS: + name = NEWS_FILE; + pnote = news_list; + break; + case NOTE_CHANGES: + name = CHANGES_FILE; + pnote = changes_list; + break; + } + + fclose( fpReserve ); + if ( ( fp = fopen( name, "w" ) ) == NULL ) + { + perror( name ); + } + else + { + for ( ; pnote != NULL; pnote = pnote->next ) + { + fprintf( fp, "Sender %s~\n", pnote->sender); + fprintf( fp, "Date %s~\n", pnote->date); + fprintf( fp, "Stamp %ld\n", pnote->date_stamp); + fprintf( fp, "To %s~\n", pnote->to_list); + fprintf( fp, "Subject %s~\n", pnote->subject); + fprintf( fp, "Text\n%s~\n", pnote->text); + } + fclose( fp ); + fpReserve = fopen( NULL_FILE, "r" ); + return; + } +} +void load_notes(void) +{ + load_thread(NOTE_FILE,¬e_list, NOTE_NOTE, 14*24*60*60); + load_thread(IDEA_FILE,&idea_list, NOTE_IDEA, 28*24*60*60); + load_thread(PENALTY_FILE,&penalty_list, NOTE_PENALTY, 0); + load_thread(NEWS_FILE,&news_list, NOTE_NEWS, 0); + load_thread(CHANGES_FILE,&changes_list,NOTE_CHANGES, 0); +} + +void load_thread(char *name, NOTE_DATA **list, int type, time_t free_time) +{ + FILE *fp; + NOTE_DATA *pnotelast; + + if ( ( fp = fopen( name, "r" ) ) == NULL ) + return; + + pnotelast = NULL; + for ( ; ; ) + { + NOTE_DATA *pnote; + char letter; + + do + { + letter = getc( fp ); + if ( feof(fp) ) + { + fclose( fp ); + return; + } + } + while ( isspace(letter) ); + ungetc( letter, fp ); + + pnote = alloc_perm( sizeof(*pnote) ); + + if ( str_cmp( fread_word( fp ), "sender" ) ) + break; + pnote->sender = fread_string( fp ); + + if ( str_cmp( fread_word( fp ), "date" ) ) + break; + pnote->date = fread_string( fp ); + + if ( str_cmp( fread_word( fp ), "stamp" ) ) + break; + pnote->date_stamp = fread_number(fp); + + if ( str_cmp( fread_word( fp ), "to" ) ) + break; + pnote->to_list = fread_string( fp ); + + if ( str_cmp( fread_word( fp ), "subject" ) ) + break; + pnote->subject = fread_string( fp ); + + if ( str_cmp( fread_word( fp ), "text" ) ) + break; + pnote->text = fread_string( fp ); + + if (free_time && pnote->date_stamp < current_time - free_time) + { + free_note(pnote); + continue; + } + + pnote->type = type; + + if (*list == NULL) + *list = pnote; + else + pnotelast->next = pnote; + + pnotelast = pnote; + } + + strcpy( strArea, NOTE_FILE ); + fpArea = fp; + bug( "Load_notes: bad key word.", 0 ); + exit( 1 ); + return; +} + +void append_note(NOTE_DATA *pnote) +{ + FILE *fp; + char *name; + NOTE_DATA **list; + NOTE_DATA *last; + + switch(pnote->type) + { + default: + return; + case NOTE_NOTE: + name = NOTE_FILE; + list = ¬e_list; + break; + case NOTE_IDEA: + name = IDEA_FILE; + list = &idea_list; + break; + case NOTE_PENALTY: + name = PENALTY_FILE; + list = &penalty_list; + break; + case NOTE_NEWS: + name = NEWS_FILE; + list = &news_list; + break; + case NOTE_CHANGES: + name = CHANGES_FILE; + list = &changes_list; + break; + } + + if (*list == NULL) + *list = pnote; + else + { + for ( last = *list; last->next != NULL; last = last->next); + last->next = pnote; + } + + fclose(fpReserve); + if ( ( fp = fopen(name, "a" ) ) == NULL ) + { + perror(name); + } + else + { + fprintf( fp, "Sender %s~\n", pnote->sender); + fprintf( fp, "Date %s~\n", pnote->date); + fprintf( fp, "Stamp %ld\n", pnote->date_stamp); + fprintf( fp, "To %s~\n", pnote->to_list); + fprintf( fp, "Subject %s~\n", pnote->subject); + fprintf( fp, "Text\n%s~\n", pnote->text); + fclose( fp ); + } + fpReserve = fopen( NULL_FILE, "r" ); +} + +bool is_note_to( CHAR_DATA *ch, NOTE_DATA *pnote ) +{ + if ( !str_cmp( ch->name, pnote->sender ) ) + return TRUE; + + if ( is_exact_name( "all", pnote->to_list ) ) + return TRUE; + + if ( IS_IMMORTAL(ch) && is_exact_name( "immortal", pnote->to_list ) ) + return TRUE; + + if (ch->clan && is_exact_name(clan_table[ch->clan].name,pnote->to_list)) + return TRUE; + + if (is_exact_name( ch->name, pnote->to_list ) ) + return TRUE; + + return FALSE; +} + + + +void note_attach( CHAR_DATA *ch, int type ) +{ + NOTE_DATA *pnote; + + if ( ch->pnote != NULL ) + return; + + pnote = new_note(); + + pnote->next = NULL; + pnote->sender = str_dup( ch->name ); + pnote->date = str_dup( "" ); + pnote->to_list = str_dup( "" ); + pnote->subject = str_dup( "" ); + pnote->text = str_dup( "" ); + pnote->type = type; + ch->pnote = pnote; + return; +} + + + +void note_remove( CHAR_DATA *ch, NOTE_DATA *pnote, bool delete) +{ + char to_new[MAX_INPUT_LENGTH]; + char to_one[MAX_INPUT_LENGTH]; + NOTE_DATA *prev; + NOTE_DATA **list; + char *to_list; + + if (!delete) + { + /* make a new list */ + to_new[0] = '\0'; + to_list = pnote->to_list; + while ( *to_list != '\0' ) + { + to_list = one_argument( to_list, to_one ); + if ( to_one[0] != '\0' && str_cmp( ch->name, to_one ) ) + { + strcat( to_new, " " ); + strcat( to_new, to_one ); + } + } + /* Just a simple recipient removal? */ + if ( str_cmp( ch->name, pnote->sender ) && to_new[0] != '\0' ) + { + free_string( pnote->to_list ); + pnote->to_list = str_dup( to_new + 1 ); + return; + } + } + /* nuke the whole note */ + + switch(pnote->type) + { + default: + return; + case NOTE_NOTE: + list = ¬e_list; + break; + case NOTE_IDEA: + list = &idea_list; + break; + case NOTE_PENALTY: + list = &penalty_list; + break; + case NOTE_NEWS: + list = &news_list; + break; + case NOTE_CHANGES: + list = &changes_list; + break; + } + + /* + * Remove note from linked list. + */ + if ( pnote == *list ) + { + *list = pnote->next; + } + else + { + for ( prev = *list; prev != NULL; prev = prev->next ) + { + if ( prev->next == pnote ) + break; + } + + if ( prev == NULL ) + { + bug( "Note_remove: pnote not found.", 0 ); + return; + } + + prev->next = pnote->next; + } + + save_notes(pnote->type); + free_note(pnote); + return; +} + +bool hide_note (CHAR_DATA *ch, NOTE_DATA *pnote) +{ + time_t last_read; + + if (IS_NPC(ch)) + return TRUE; + + switch (pnote->type) + { + default: + return TRUE; + case NOTE_NOTE: + last_read = ch->pcdata->last_note; + break; + case NOTE_IDEA: + last_read = ch->pcdata->last_idea; + break; + case NOTE_PENALTY: + last_read = ch->pcdata->last_penalty; + break; + case NOTE_NEWS: + last_read = ch->pcdata->last_news; + break; + case NOTE_CHANGES: + last_read = ch->pcdata->last_changes; + break; + } + + if (pnote->date_stamp <= last_read) + return TRUE; + + if (!str_cmp(ch->name,pnote->sender)) + return TRUE; + + if (!is_note_to(ch,pnote)) + return TRUE; + + return FALSE; +} + +void update_read(CHAR_DATA *ch, NOTE_DATA *pnote) +{ + time_t stamp; + + if (IS_NPC(ch)) + return; + + stamp = pnote->date_stamp; + + switch (pnote->type) + { + default: + return; + case NOTE_NOTE: + ch->pcdata->last_note = UMAX(ch->pcdata->last_note,stamp); + break; + case NOTE_IDEA: + ch->pcdata->last_idea = UMAX(ch->pcdata->last_idea,stamp); + break; + case NOTE_PENALTY: + ch->pcdata->last_penalty = UMAX(ch->pcdata->last_penalty,stamp); + break; + case NOTE_NEWS: + ch->pcdata->last_news = UMAX(ch->pcdata->last_news,stamp); + break; + case NOTE_CHANGES: + ch->pcdata->last_changes = UMAX(ch->pcdata->last_changes,stamp); + break; + } +} + +void parse_note( CHAR_DATA *ch, char *argument, int type ) +{ + BUFFER *buffer; + char buf[MAX_STRING_LENGTH]; + char arg[MAX_INPUT_LENGTH]; + NOTE_DATA *pnote; + NOTE_DATA **list; + char *list_name; + int vnum; + int anum; + + if ( IS_NPC(ch) ) + return; + + switch(type) + { + default: + return; + case NOTE_NOTE: + list = ¬e_list; + list_name = "notes"; + break; + case NOTE_IDEA: + list = &idea_list; + list_name = "ideas"; + break; + case NOTE_PENALTY: + list = &penalty_list; + list_name = "penalties"; + break; + case NOTE_NEWS: + list = &news_list; + list_name = "news"; + break; + case NOTE_CHANGES: + list = &changes_list; + list_name = "changes"; + break; + } + + argument = one_argument( argument, arg ); + smash_tilde( argument ); + + if ( arg[0] == '\0' || !str_prefix( arg, "read" ) ) + { + bool fAll; + + if ( !str_cmp( argument, "all" ) ) + { + fAll = TRUE; + anum = 0; + } + + else if ( argument[0] == '\0' || !str_prefix(argument, "next")) + /* read next unread note */ + { + vnum = 0; + for ( pnote = *list; pnote != NULL; pnote = pnote->next) + { + if (!hide_note(ch,pnote)) + { + sprintf( buf, "[%3d] %s: %s\n\r%s\n\rTo: %s\n\r", + vnum, + pnote->sender, + pnote->subject, + pnote->date, + pnote->to_list); + send_to_char( buf, ch ); + page_to_char( pnote->text, ch ); + update_read(ch,pnote); + return; + } + else if (is_note_to(ch,pnote)) + vnum++; + } + sprintf(buf,"You have no unread %s.\n\r",list_name); + send_to_char(buf,ch); + return; + } + + else if ( is_number( argument ) ) + { + fAll = FALSE; + anum = atoi( argument ); + } + else + { + send_to_char( "Read which number?\n\r", ch ); + return; + } + + vnum = 0; + for ( pnote = *list; pnote != NULL; pnote = pnote->next ) + { + if ( is_note_to( ch, pnote ) && ( vnum++ == anum || fAll ) ) + { + sprintf( buf, "[%3d] %s: %s\n\r%s\n\rTo: %s\n\r", + vnum - 1, + pnote->sender, + pnote->subject, + pnote->date, + pnote->to_list + ); + send_to_char( buf, ch ); + page_to_char( pnote->text, ch ); + update_read(ch,pnote); + return; + } + } + + sprintf(buf,"There aren't that many %s.\n\r",list_name); + send_to_char(buf,ch); + return; + } + + if ( !str_prefix( arg, "list" ) ) + { + vnum = 0; + for ( pnote = *list; pnote != NULL; pnote = pnote->next ) + { + if ( is_note_to( ch, pnote ) ) + { + sprintf( buf, "[%3d%s] %s: %s\n\r", + vnum, hide_note(ch,pnote) ? " " : "N", + pnote->sender, pnote->subject ); + send_to_char( buf, ch ); + vnum++; + } + } + if (!vnum) + { + switch(type) + { + case NOTE_NOTE: + send_to_char("There are no notes for you.\n\r",ch); + break; + case NOTE_IDEA: + send_to_char("There are no ideas for you.\n\r",ch); + break; + case NOTE_PENALTY: + send_to_char("There are no penalties for you.\n\r",ch); + break; + case NOTE_NEWS: + send_to_char("There is no news for you.\n\r",ch); + break; + case NOTE_CHANGES: + send_to_char("There are no changes for you.\n\r",ch); + break; + } + } + return; + } + + if ( !str_prefix( arg, "remove" ) ) + { + if ( !is_number( argument ) ) + { + send_to_char( "Note remove which number?\n\r", ch ); + return; + } + + anum = atoi( argument ); + vnum = 0; + for ( pnote = *list; pnote != NULL; pnote = pnote->next ) + { + if ( is_note_to( ch, pnote ) && vnum++ == anum ) + { + note_remove( ch, pnote, FALSE ); + send_to_char( "Ok.\n\r", ch ); + return; + } + } + + sprintf(buf,"There aren't that many %s.",list_name); + send_to_char(buf,ch); + return; + } + + if ( !str_prefix( arg, "delete" ) && get_trust(ch) >= MAX_LEVEL - 1) + { + if ( !is_number( argument ) ) + { + send_to_char( "Note delete which number?\n\r", ch ); + return; + } + + anum = atoi( argument ); + vnum = 0; + for ( pnote = *list; pnote != NULL; pnote = pnote->next ) + { + if ( is_note_to( ch, pnote ) && vnum++ == anum ) + { + note_remove( ch, pnote,TRUE ); + send_to_char( "Ok.\n\r", ch ); + return; + } + } + + sprintf(buf,"There aren't that many %s.",list_name); + send_to_char(buf,ch); + return; + } + + if (!str_prefix(arg,"catchup")) + { + switch(type) + { + case NOTE_NOTE: + ch->pcdata->last_note = current_time; + break; + case NOTE_IDEA: + ch->pcdata->last_idea = current_time; + break; + case NOTE_PENALTY: + ch->pcdata->last_penalty = current_time; + break; + case NOTE_NEWS: + ch->pcdata->last_news = current_time; + break; + case NOTE_CHANGES: + ch->pcdata->last_changes = current_time; + break; + } + return; + } + + /* below this point only certain people can edit notes */ + if ((type == NOTE_NEWS && !IS_TRUSTED(ch,ANGEL)) + || (type == NOTE_CHANGES && !IS_TRUSTED(ch,CREATOR))) + { + sprintf(buf,"You aren't high enough level to write %s.",list_name); + send_to_char(buf,ch); + return; + } + + if ( !str_cmp( arg, "+" ) ) + { + note_attach( ch,type ); + if (ch->pnote->type != type) + { + send_to_char( + "You already have a different note in progress.\n\r",ch); + return; + } + + if (strlen(ch->pnote->text)+strlen(argument) >= 4096) + { + send_to_char( "Note too long.\n\r", ch ); + return; + } + + buffer = new_buf(); + + add_buf(buffer,ch->pnote->text); + add_buf(buffer,argument); + add_buf(buffer,"\n\r"); + free_string( ch->pnote->text ); + ch->pnote->text = str_dup( buf_string(buffer) ); + free_buf(buffer); + send_to_char( "Ok.\n\r", ch ); + return; + } + + if (!str_cmp(arg,"-")) + { + int len; + bool found = FALSE; + + note_attach(ch,type); + if (ch->pnote->type != type) + { + send_to_char( + "You already have a different note in progress.\n\r",ch); + return; + } + + if (ch->pnote->text == NULL || ch->pnote->text[0] == '\0') + { + send_to_char("No lines left to remove.\n\r",ch); + return; + } + + strcpy(buf,ch->pnote->text); + + for (len = strlen(buf); len > 0; len--) + { + if (buf[len] == '\r') + { + if (!found) /* back it up */ + { + if (len > 0) + len--; + found = TRUE; + } + else /* found the second one */ + { + buf[len + 1] = '\0'; + free_string(ch->pnote->text); + ch->pnote->text = str_dup(buf); + return; + } + } + } + buf[0] = '\0'; + free_string(ch->pnote->text); + ch->pnote->text = str_dup(buf); + return; + } + + if ( !str_prefix( arg, "subject" ) ) + { + note_attach( ch,type ); + if (ch->pnote->type != type) + { + send_to_char( + "You already have a different note in progress.\n\r",ch); + return; + } + + free_string( ch->pnote->subject ); + ch->pnote->subject = str_dup( argument ); + send_to_char( "Ok.\n\r", ch ); + return; + } + + if ( !str_prefix( arg, "to" ) ) + { + note_attach( ch,type ); + if (ch->pnote->type != type) + { + send_to_char( + "You already have a different note in progress.\n\r",ch); + return; + } + free_string( ch->pnote->to_list ); + ch->pnote->to_list = str_dup( argument ); + send_to_char( "Ok.\n\r", ch ); + return; + } + + if ( !str_prefix( arg, "clear" ) ) + { + if ( ch->pnote != NULL ) + { + free_note(ch->pnote); + ch->pnote = NULL; + } + + send_to_char( "Ok.\n\r", ch ); + return; + } + + if ( !str_prefix( arg, "show" ) ) + { + if ( ch->pnote == NULL ) + { + send_to_char( "You have no note in progress.\n\r", ch ); + return; + } + + if (ch->pnote->type != type) + { + send_to_char("You aren't working on that kind of note.\n\r",ch); + return; + } + + sprintf( buf, "%s: %s\n\rTo: %s\n\r", + ch->pnote->sender, + ch->pnote->subject, + ch->pnote->to_list + ); + send_to_char( buf, ch ); + send_to_char( ch->pnote->text, ch ); + return; + } + + if ( !str_prefix( arg, "post" ) || !str_prefix(arg, "send")) + { + char *strtime; + + if ( ch->pnote == NULL ) + { + send_to_char( "You have no note in progress.\n\r", ch ); + return; + } + + if (ch->pnote->type != type) + { + send_to_char("You aren't working on that kind of note.\n\r",ch); + return; + } + + if (!str_cmp(ch->pnote->to_list,"")) + { + send_to_char( + "You need to provide a recipient (name, all, or immortal).\n\r", + ch); + return; + } + + if (!str_cmp(ch->pnote->subject,"")) + { + send_to_char("You need to provide a subject.\n\r",ch); + return; + } + + ch->pnote->next = NULL; + strtime = ctime( ¤t_time ); + strtime[strlen(strtime)-1] = '\0'; + ch->pnote->date = str_dup( strtime ); + ch->pnote->date_stamp = current_time; + + append_note(ch->pnote); + ch->pnote = NULL; + return; + } + + send_to_char( "You can't do that.\n\r", ch ); + return; +} + diff --git a/Rom24/src/recycle.c b/Rom24/src/recycle.c new file mode 100644 index 0000000..8239101 --- /dev/null +++ b/Rom24/src/recycle.c @@ -0,0 +1,652 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +#if defined(macintosh) +#include +#include +#else +#include +#include +#endif +#include +#include +#include +#include "merc.h" +#include "recycle.h" + +/* stuff for recyling notes */ +NOTE_DATA *note_free; + +NOTE_DATA *new_note() +{ + NOTE_DATA *note; + + if (note_free == NULL) + note = alloc_perm(sizeof(*note)); + else + { + note = note_free; + note_free = note_free->next; + } + VALIDATE(note); + return note; +} + +void free_note(NOTE_DATA *note) +{ + if (!IS_VALID(note)) + return; + + free_string( note->text ); + free_string( note->subject ); + free_string( note->to_list ); + free_string( note->date ); + free_string( note->sender ); + INVALIDATE(note); + + note->next = note_free; + note_free = note; +} + + +/* stuff for recycling ban structures */ +BAN_DATA *ban_free; + +BAN_DATA *new_ban(void) +{ + static BAN_DATA ban_zero; + BAN_DATA *ban; + + if (ban_free == NULL) + ban = alloc_perm(sizeof(*ban)); + else + { + ban = ban_free; + ban_free = ban_free->next; + } + + *ban = ban_zero; + VALIDATE(ban); + ban->name = &str_empty[0]; + return ban; +} + +void free_ban(BAN_DATA *ban) +{ + if (!IS_VALID(ban)) + return; + + free_string(ban->name); + INVALIDATE(ban); + + ban->next = ban_free; + ban_free = ban; +} + +/* stuff for recycling descriptors */ +DESCRIPTOR_DATA *descriptor_free; + +DESCRIPTOR_DATA *new_descriptor(void) +{ + static DESCRIPTOR_DATA d_zero; + DESCRIPTOR_DATA *d; + + if (descriptor_free == NULL) + d = alloc_perm(sizeof(*d)); + else + { + d = descriptor_free; + descriptor_free = descriptor_free->next; + } + + *d = d_zero; + VALIDATE(d); + return d; +} + +void free_descriptor(DESCRIPTOR_DATA *d) +{ + if (!IS_VALID(d)) + return; + + free_string( d->host ); + free_mem( d->outbuf, d->outsize ); + INVALIDATE(d); + d->next = descriptor_free; + descriptor_free = d; +} + +/* stuff for recycling gen_data */ +GEN_DATA *gen_data_free; + +GEN_DATA *new_gen_data(void) +{ + static GEN_DATA gen_zero; + GEN_DATA *gen; + + if (gen_data_free == NULL) + gen = alloc_perm(sizeof(*gen)); + else + { + gen = gen_data_free; + gen_data_free = gen_data_free->next; + } + *gen = gen_zero; + VALIDATE(gen); + return gen; +} + +void free_gen_data(GEN_DATA *gen) +{ + if (!IS_VALID(gen)) + return; + + INVALIDATE(gen); + + gen->next = gen_data_free; + gen_data_free = gen; +} + +/* stuff for recycling extended descs */ +EXTRA_DESCR_DATA *extra_descr_free; + +EXTRA_DESCR_DATA *new_extra_descr(void) +{ + EXTRA_DESCR_DATA *ed; + + if (extra_descr_free == NULL) + ed = alloc_perm(sizeof(*ed)); + else + { + ed = extra_descr_free; + extra_descr_free = extra_descr_free->next; + } + + ed->keyword = &str_empty[0]; + ed->description = &str_empty[0]; + VALIDATE(ed); + return ed; +} + +void free_extra_descr(EXTRA_DESCR_DATA *ed) +{ + if (!IS_VALID(ed)) + return; + + free_string(ed->keyword); + free_string(ed->description); + INVALIDATE(ed); + + ed->next = extra_descr_free; + extra_descr_free = ed; +} + + +/* stuff for recycling affects */ +AFFECT_DATA *affect_free; + +AFFECT_DATA *new_affect(void) +{ + static AFFECT_DATA af_zero; + AFFECT_DATA *af; + + if (affect_free == NULL) + af = alloc_perm(sizeof(*af)); + else + { + af = affect_free; + affect_free = affect_free->next; + } + + *af = af_zero; + + + VALIDATE(af); + return af; +} + +void free_affect(AFFECT_DATA *af) +{ + if (!IS_VALID(af)) + return; + + INVALIDATE(af); + af->next = affect_free; + affect_free = af; +} + +/* stuff for recycling objects */ +OBJ_DATA *obj_free; + +OBJ_DATA *new_obj(void) +{ + static OBJ_DATA obj_zero; + OBJ_DATA *obj; + + if (obj_free == NULL) + obj = alloc_perm(sizeof(*obj)); + else + { + obj = obj_free; + obj_free = obj_free->next; + } + *obj = obj_zero; + VALIDATE(obj); + + return obj; +} + +void free_obj(OBJ_DATA *obj) +{ + AFFECT_DATA *paf, *paf_next; + EXTRA_DESCR_DATA *ed, *ed_next; + + if (!IS_VALID(obj)) + return; + + for (paf = obj->affected; paf != NULL; paf = paf_next) + { + paf_next = paf->next; + free_affect(paf); + } + obj->affected = NULL; + + for (ed = obj->extra_descr; ed != NULL; ed = ed_next ) + { + ed_next = ed->next; + free_extra_descr(ed); + } + obj->extra_descr = NULL; + + free_string( obj->name ); + free_string( obj->description ); + free_string( obj->short_descr ); + free_string( obj->owner ); + INVALIDATE(obj); + + obj->next = obj_free; + obj_free = obj; +} + + +/* stuff for recyling characters */ +CHAR_DATA *char_free; + +CHAR_DATA *new_char (void) +{ + static CHAR_DATA ch_zero; + CHAR_DATA *ch; + int i; + + if (char_free == NULL) + ch = alloc_perm(sizeof(*ch)); + else + { + ch = char_free; + char_free = char_free->next; + } + + *ch = ch_zero; + VALIDATE(ch); + ch->name = &str_empty[0]; + ch->short_descr = &str_empty[0]; + ch->long_descr = &str_empty[0]; + ch->description = &str_empty[0]; + ch->prompt = &str_empty[0]; + ch->prefix = &str_empty[0]; + ch->logon = current_time; + ch->lines = PAGELEN; + for (i = 0; i < 4; i++) + ch->armor[i] = 100; + ch->position = POS_STANDING; + ch->hit = 20; + ch->max_hit = 20; + ch->mana = 100; + ch->max_mana = 100; + ch->move = 100; + ch->max_move = 100; + for (i = 0; i < MAX_STATS; i ++) + { + ch->perm_stat[i] = 13; + ch->mod_stat[i] = 0; + } + + return ch; +} + + +void free_char (CHAR_DATA *ch) +{ + OBJ_DATA *obj; + OBJ_DATA *obj_next; + AFFECT_DATA *paf; + AFFECT_DATA *paf_next; + + if (!IS_VALID(ch)) + return; + + if (IS_NPC(ch)) + mobile_count--; + + for (obj = ch->carrying; obj != NULL; obj = obj_next) + { + obj_next = obj->next_content; + extract_obj(obj); + } + + for (paf = ch->affected; paf != NULL; paf = paf_next) + { + paf_next = paf->next; + affect_remove(ch,paf); + } + + free_string(ch->name); + free_string(ch->short_descr); + free_string(ch->long_descr); + free_string(ch->description); + free_string(ch->prompt); + free_string(ch->prefix); + free_note (ch->pnote); + free_pcdata(ch->pcdata); + + ch->next = char_free; + char_free = ch; + + INVALIDATE(ch); + return; +} + +PC_DATA *pcdata_free; + +PC_DATA *new_pcdata(void) +{ + int alias; + + static PC_DATA pcdata_zero; + PC_DATA *pcdata; + + if (pcdata_free == NULL) + pcdata = alloc_perm(sizeof(*pcdata)); + else + { + pcdata = pcdata_free; + pcdata_free = pcdata_free->next; + } + + *pcdata = pcdata_zero; + + for (alias = 0; alias < MAX_ALIAS; alias++) + { + pcdata->alias[alias] = NULL; + pcdata->alias_sub[alias] = NULL; + } + + pcdata->buffer = new_buf(); + + VALIDATE(pcdata); + return pcdata; +} + + +void free_pcdata(PC_DATA *pcdata) +{ + int alias; + + if (!IS_VALID(pcdata)) + return; + + free_string(pcdata->pwd); + free_string(pcdata->bamfin); + free_string(pcdata->bamfout); + free_string(pcdata->title); + free_buf(pcdata->buffer); + + for (alias = 0; alias < MAX_ALIAS; alias++) + { + free_string(pcdata->alias[alias]); + free_string(pcdata->alias_sub[alias]); + } + INVALIDATE(pcdata); + pcdata->next = pcdata_free; + pcdata_free = pcdata; + + return; +} + + + + +/* stuff for setting ids */ +long last_pc_id; +long last_mob_id; + +long get_pc_id(void) +{ + int val; + + val = (current_time <= last_pc_id) ? last_pc_id + 1 : current_time; + last_pc_id = val; + return val; +} + +long get_mob_id(void) +{ + last_mob_id++; + return last_mob_id; +} + +MEM_DATA *mem_data_free; + +/* procedures and constants needed for buffering */ + +BUFFER *buf_free; + +MEM_DATA *new_mem_data(void) +{ + MEM_DATA *memory; + + if (mem_data_free == NULL) + memory = alloc_mem(sizeof(*memory)); + else + { + memory = mem_data_free; + mem_data_free = mem_data_free->next; + } + + memory->next = NULL; + memory->id = 0; + memory->reaction = 0; + memory->when = 0; + VALIDATE(memory); + + return memory; +} + +void free_mem_data(MEM_DATA *memory) +{ + if (!IS_VALID(memory)) + return; + + memory->next = mem_data_free; + mem_data_free = memory; + INVALIDATE(memory); +} + + + +/* buffer sizes */ +const int buf_size[MAX_BUF_LIST] = +{ + 16,32,64,128,256,1024,2048,4096,8192,16384 +}; + +/* local procedure for finding the next acceptable size */ +/* -1 indicates out-of-boundary error */ +int get_size (int val) +{ + int i; + + for (i = 0; i < MAX_BUF_LIST; i++) + if (buf_size[i] >= val) + { + return buf_size[i]; + } + + return -1; +} + +BUFFER *new_buf() +{ + BUFFER *buffer; + + if (buf_free == NULL) + buffer = alloc_perm(sizeof(*buffer)); + else + { + buffer = buf_free; + buf_free = buf_free->next; + } + + buffer->next = NULL; + buffer->state = BUFFER_SAFE; + buffer->size = get_size(BASE_BUF); + + buffer->string = alloc_mem(buffer->size); + buffer->string[0] = '\0'; + VALIDATE(buffer); + + return buffer; +} + +BUFFER *new_buf_size(int size) +{ + BUFFER *buffer; + + if (buf_free == NULL) + buffer = alloc_perm(sizeof(*buffer)); + else + { + buffer = buf_free; + buf_free = buf_free->next; + } + + buffer->next = NULL; + buffer->state = BUFFER_SAFE; + buffer->size = get_size(size); + if (buffer->size == -1) + { + bug("new_buf: buffer size %d too large.",size); + exit(1); + } + buffer->string = alloc_mem(buffer->size); + buffer->string[0] = '\0'; + VALIDATE(buffer); + + return buffer; +} + + +void free_buf(BUFFER *buffer) +{ + if (!IS_VALID(buffer)) + return; + + free_mem(buffer->string,buffer->size); + buffer->string = NULL; + buffer->size = 0; + buffer->state = BUFFER_FREED; + INVALIDATE(buffer); + + buffer->next = buf_free; + buf_free = buffer; +} + + +bool add_buf(BUFFER *buffer, char *string) +{ + int len; + char *oldstr; + int oldsize; + + oldstr = buffer->string; + oldsize = buffer->size; + + if (buffer->state == BUFFER_OVERFLOW) /* don't waste time on bad strings! */ + return FALSE; + + len = strlen(buffer->string) + strlen(string) + 1; + + while (len >= buffer->size) /* increase the buffer size */ + { + buffer->size = get_size(buffer->size + 1); + { + if (buffer->size == -1) /* overflow */ + { + buffer->size = oldsize; + buffer->state = BUFFER_OVERFLOW; + bug("buffer overflow past size %d",buffer->size); + return FALSE; + } + } + } + + if (buffer->size != oldsize) + { + buffer->string = alloc_mem(buffer->size); + + strcpy(buffer->string,oldstr); + free_mem(oldstr,oldsize); + } + + strcat(buffer->string,string); + return TRUE; +} + + +void clear_buf(BUFFER *buffer) +{ + buffer->string[0] = '\0'; + buffer->state = BUFFER_SAFE; +} + + +char *buf_string(BUFFER *buffer) +{ + return buffer->string; +} + + + + + + + + + + + + diff --git a/Rom24/src/recycle.h b/Rom24/src/recycle.h new file mode 100644 index 0000000..873b4b1 --- /dev/null +++ b/Rom24/src/recycle.h @@ -0,0 +1,112 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +/* externs */ +extern char str_empty[1]; +extern int mobile_count; + +/* stuff for providing a crash-proof buffer */ + +#define MAX_BUF 16384 +#define MAX_BUF_LIST 10 +#define BASE_BUF 1024 + +/* valid states */ +#define BUFFER_SAFE 0 +#define BUFFER_OVERFLOW 1 +#define BUFFER_FREED 2 + +/* note recycling */ +#define ND NOTE_DATA +ND *new_note args( (void) ); +void free_note args( (NOTE_DATA *note) ); +#undef ND + +/* ban data recycling */ +#define BD BAN_DATA +BD *new_ban args( (void) ); +void free_ban args( (BAN_DATA *ban) ); +#undef BD + +/* descriptor recycling */ +#define DD DESCRIPTOR_DATA +DD *new_descriptor args( (void) ); +void free_descriptor args( (DESCRIPTOR_DATA *d) ); +#undef DD + +/* char gen data recycling */ +#define GD GEN_DATA +GD *new_gen_data args( (void) ); +void free_gen_data args( (GEN_DATA * gen) ); +#undef GD + +/* extra descr recycling */ +#define ED EXTRA_DESCR_DATA +ED *new_extra_descr args( (void) ); +void free_extra_descr args( (EXTRA_DESCR_DATA *ed) ); +#undef ED + +/* affect recycling */ +#define AD AFFECT_DATA +AD *new_affect args( (void) ); +void free_affect args( (AFFECT_DATA *af) ); +#undef AD + +/* object recycling */ +#define OD OBJ_DATA +OD *new_obj args( (void) ); +void free_obj args( (OBJ_DATA *obj) ); +#undef OD + +/* character recyling */ +#define CD CHAR_DATA +#define PD PC_DATA +CD *new_char args( (void) ); +void free_char args( (CHAR_DATA *ch) ); +PD *new_pcdata args( (void) ); +void free_pcdata args( (PC_DATA *pcdata) ); +#undef PD +#undef CD + + +/* mob id and memory procedures */ +#define MD MEM_DATA +long get_pc_id args( (void) ); +long get_mob_id args( (void) ); +MD *new_mem_data args( (void) ); +void free_mem_data args( ( MEM_DATA *memory) ); +MD *find_memory args( (MEM_DATA *memory, long id) ); +#undef MD + +/* buffer procedures */ + +BUFFER *new_buf args( (void) ); +BUFFER *new_buf_size args( (int size) ); +void free_buf args( (BUFFER *buffer) ); +bool add_buf args( (BUFFER *buffer, char *string) ); +void clear_buf args( (BUFFER *buffer) ); +char *buf_string args( (BUFFER *buffer) ); diff --git a/Rom24/src/save.c b/Rom24/src/save.c new file mode 100644 index 0000000..9f9a60c --- /dev/null +++ b/Rom24/src/save.c @@ -0,0 +1,1665 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +#if defined(macintosh) +#include +#else +#include +#endif +#include +#include +#include +#include +#include +#include +#include "merc.h" +#include "recycle.h" +#include "lookup.h" +#include "tables.h" + +#if !defined(macintosh) +extern int _filbuf args( (FILE *) ); +#endif + + +int rename(const char *oldfname, const char *newfname); + +char *print_flags(int flag) +{ + int count, pos = 0; + static char buf[52]; + + + for (count = 0; count < 32; count++) + { + if (IS_SET(flag,1<desc != NULL && ch->desc->original != NULL ) + ch = ch->desc->original; + +#if defined(unix) + /* create god log */ + if (IS_IMMORTAL(ch) || ch->level >= LEVEL_IMMORTAL) + { + fclose(fpReserve); + sprintf(strsave, "%s%s",GOD_DIR, capitalize(ch->name)); + if ((fp = fopen(strsave,"w")) == NULL) + { + bug("Save_char_obj: fopen",0); + perror(strsave); + } + + fprintf(fp,"Lev %2d Trust %2d %s%s\n", + ch->level, get_trust(ch), ch->name, ch->pcdata->title); + fclose( fp ); + fpReserve = fopen( NULL_FILE, "r" ); + } +#endif + + fclose( fpReserve ); + sprintf( strsave, "%s%s", PLAYER_DIR, capitalize( ch->name ) ); + if ( ( fp = fopen( TEMP_FILE, "w" ) ) == NULL ) + { + bug( "Save_char_obj: fopen", 0 ); + perror( strsave ); + } + else + { + fwrite_char( ch, fp ); + if ( ch->carrying != NULL ) + fwrite_obj( ch, ch->carrying, fp, 0 ); + /* save the pets */ + if (ch->pet != NULL && ch->pet->in_room == ch->in_room) + fwrite_pet(ch->pet,fp); + fprintf( fp, "#END\n" ); + } + fclose( fp ); + rename(TEMP_FILE,strsave); + fpReserve = fopen( NULL_FILE, "r" ); + return; +} + + + +/* + * Write the char. + */ +void fwrite_char( CHAR_DATA *ch, FILE *fp ) +{ + AFFECT_DATA *paf; + int sn, gn, pos; + + fprintf( fp, "#%s\n", IS_NPC(ch) ? "MOB" : "PLAYER" ); + + fprintf( fp, "Name %s~\n", ch->name ); + fprintf( fp, "Id %ld\n", ch->id ); + fprintf( fp, "LogO %ld\n", current_time ); + fprintf( fp, "Vers %d\n", 5 ); + if (ch->short_descr[0] != '\0') + fprintf( fp, "ShD %s~\n", ch->short_descr ); + if( ch->long_descr[0] != '\0') + fprintf( fp, "LnD %s~\n", ch->long_descr ); + if (ch->description[0] != '\0') + fprintf( fp, "Desc %s~\n", ch->description ); + if (ch->prompt != NULL || !str_cmp(ch->prompt,"<%hhp %mm %vmv> ")) + fprintf( fp, "Prom %s~\n", ch->prompt ); + fprintf( fp, "Race %s~\n", pc_race_table[ch->race].name ); + if (ch->clan) + fprintf( fp, "Clan %s~\n",clan_table[ch->clan].name); + fprintf( fp, "Sex %d\n", ch->sex ); + fprintf( fp, "Cla %d\n", ch->class ); + fprintf( fp, "Levl %d\n", ch->level ); + if (ch->trust != 0) + fprintf( fp, "Tru %d\n", ch->trust ); + fprintf( fp, "Plyd %d\n", + ch->played + (int) (current_time - ch->logon) ); + fprintf( fp, "Not %ld %ld %ld %ld %ld\n", + ch->pcdata->last_note,ch->pcdata->last_idea,ch->pcdata->last_penalty, + ch->pcdata->last_news,ch->pcdata->last_changes ); + fprintf( fp, "Scro %d\n", ch->lines ); + fprintf( fp, "Room %d\n", + ( ch->in_room == get_room_index( ROOM_VNUM_LIMBO ) + && ch->was_in_room != NULL ) + ? ch->was_in_room->vnum + : ch->in_room == NULL ? 3001 : ch->in_room->vnum ); + + fprintf( fp, "HMV %d %d %d %d %d %d\n", + ch->hit, ch->max_hit, ch->mana, ch->max_mana, ch->move, ch->max_move ); + if (ch->gold > 0) + fprintf( fp, "Gold %ld\n", ch->gold ); + else + fprintf( fp, "Gold %d\n", 0 ); + if (ch->silver > 0) + fprintf( fp, "Silv %ld\n",ch->silver ); + else + fprintf( fp, "Silv %d\n",0 ); + fprintf( fp, "Exp %d\n", ch->exp ); + if (ch->act != 0) + fprintf( fp, "Act %s\n", print_flags(ch->act)); + if (ch->affected_by != 0) + fprintf( fp, "AfBy %s\n", print_flags(ch->affected_by)); + fprintf( fp, "Comm %s\n", print_flags(ch->comm)); + if (ch->wiznet) + fprintf( fp, "Wizn %s\n", print_flags(ch->wiznet)); + if (ch->invis_level) + fprintf( fp, "Invi %d\n", ch->invis_level ); + if (ch->incog_level) + fprintf(fp,"Inco %d\n",ch->incog_level); + fprintf( fp, "Pos %d\n", + ch->position == POS_FIGHTING ? POS_STANDING : ch->position ); + if (ch->practice != 0) + fprintf( fp, "Prac %d\n", ch->practice ); + if (ch->train != 0) + fprintf( fp, "Trai %d\n", ch->train ); + if (ch->saving_throw != 0) + fprintf( fp, "Save %d\n", ch->saving_throw); + fprintf( fp, "Alig %d\n", ch->alignment ); + if (ch->hitroll != 0) + fprintf( fp, "Hit %d\n", ch->hitroll ); + if (ch->damroll != 0) + fprintf( fp, "Dam %d\n", ch->damroll ); + fprintf( fp, "ACs %d %d %d %d\n", + ch->armor[0],ch->armor[1],ch->armor[2],ch->armor[3]); + if (ch->wimpy !=0 ) + fprintf( fp, "Wimp %d\n", ch->wimpy ); + fprintf( fp, "Attr %d %d %d %d %d\n", + ch->perm_stat[STAT_STR], + ch->perm_stat[STAT_INT], + ch->perm_stat[STAT_WIS], + ch->perm_stat[STAT_DEX], + ch->perm_stat[STAT_CON] ); + + fprintf (fp, "AMod %d %d %d %d %d\n", + ch->mod_stat[STAT_STR], + ch->mod_stat[STAT_INT], + ch->mod_stat[STAT_WIS], + ch->mod_stat[STAT_DEX], + ch->mod_stat[STAT_CON] ); + + if ( IS_NPC(ch) ) + { + fprintf( fp, "Vnum %d\n", ch->pIndexData->vnum ); + } + else + { + fprintf( fp, "Pass %s~\n", ch->pcdata->pwd ); + if (ch->pcdata->bamfin[0] != '\0') + fprintf( fp, "Bin %s~\n", ch->pcdata->bamfin); + if (ch->pcdata->bamfout[0] != '\0') + fprintf( fp, "Bout %s~\n", ch->pcdata->bamfout); + fprintf( fp, "Titl %s~\n", ch->pcdata->title ); + fprintf( fp, "Pnts %d\n", ch->pcdata->points ); + fprintf( fp, "TSex %d\n", ch->pcdata->true_sex ); + fprintf( fp, "LLev %d\n", ch->pcdata->last_level ); + fprintf( fp, "HMVP %d %d %d\n", ch->pcdata->perm_hit, + ch->pcdata->perm_mana, + ch->pcdata->perm_move); + fprintf( fp, "Cnd %d %d %d %d\n", + ch->pcdata->condition[0], + ch->pcdata->condition[1], + ch->pcdata->condition[2], + ch->pcdata->condition[3] ); + + /* write alias */ + for (pos = 0; pos < MAX_ALIAS; pos++) + { + if (ch->pcdata->alias[pos] == NULL + || ch->pcdata->alias_sub[pos] == NULL) + break; + + fprintf(fp,"Alias %s %s~\n",ch->pcdata->alias[pos], + ch->pcdata->alias_sub[pos]); + } + + for ( sn = 0; sn < MAX_SKILL; sn++ ) + { + if ( skill_table[sn].name != NULL && ch->pcdata->learned[sn] > 0 ) + { + fprintf( fp, "Sk %d '%s'\n", + ch->pcdata->learned[sn], skill_table[sn].name ); + } + } + + for ( gn = 0; gn < MAX_GROUP; gn++ ) + { + if ( group_table[gn].name != NULL && ch->pcdata->group_known[gn]) + { + fprintf( fp, "Gr '%s'\n",group_table[gn].name); + } + } + } + + for ( paf = ch->affected; paf != NULL; paf = paf->next ) + { + if (paf->type < 0 || paf->type>= MAX_SKILL) + continue; + + fprintf( fp, "Affc '%s' %3d %3d %3d %3d %3d %10d\n", + skill_table[paf->type].name, + paf->where, + paf->level, + paf->duration, + paf->modifier, + paf->location, + paf->bitvector + ); + } + + fprintf( fp, "End\n\n" ); + return; +} + +/* write a pet */ +void fwrite_pet( CHAR_DATA *pet, FILE *fp) +{ + AFFECT_DATA *paf; + + fprintf(fp,"#PET\n"); + + fprintf(fp,"Vnum %d\n",pet->pIndexData->vnum); + + fprintf(fp,"Name %s~\n", pet->name); + fprintf(fp,"LogO %ld\n", current_time); + if (pet->short_descr != pet->pIndexData->short_descr) + fprintf(fp,"ShD %s~\n", pet->short_descr); + if (pet->long_descr != pet->pIndexData->long_descr) + fprintf(fp,"LnD %s~\n", pet->long_descr); + if (pet->description != pet->pIndexData->description) + fprintf(fp,"Desc %s~\n", pet->description); + if (pet->race != pet->pIndexData->race) + fprintf(fp,"Race %s~\n", race_table[pet->race].name); + if (pet->clan) + fprintf( fp, "Clan %s~\n",clan_table[pet->clan].name); + fprintf(fp,"Sex %d\n", pet->sex); + if (pet->level != pet->pIndexData->level) + fprintf(fp,"Levl %d\n", pet->level); + fprintf(fp, "HMV %d %d %d %d %d %d\n", + pet->hit, pet->max_hit, pet->mana, pet->max_mana, pet->move, pet->max_move); + if (pet->gold > 0) + fprintf(fp,"Gold %ld\n",pet->gold); + if (pet->silver > 0) + fprintf(fp,"Silv %ld\n",pet->silver); + if (pet->exp > 0) + fprintf(fp, "Exp %d\n", pet->exp); + if (pet->act != pet->pIndexData->act) + fprintf(fp, "Act %s\n", print_flags(pet->act)); + if (pet->affected_by != pet->pIndexData->affected_by) + fprintf(fp, "AfBy %s\n", print_flags(pet->affected_by)); + if (pet->comm != 0) + fprintf(fp, "Comm %s\n", print_flags(pet->comm)); + fprintf(fp,"Pos %d\n", pet->position = POS_FIGHTING ? POS_STANDING : pet->position); + if (pet->saving_throw != 0) + fprintf(fp, "Save %d\n", pet->saving_throw); + if (pet->alignment != pet->pIndexData->alignment) + fprintf(fp, "Alig %d\n", pet->alignment); + if (pet->hitroll != pet->pIndexData->hitroll) + fprintf(fp, "Hit %d\n", pet->hitroll); + if (pet->damroll != pet->pIndexData->damage[DICE_BONUS]) + fprintf(fp, "Dam %d\n", pet->damroll); + fprintf(fp, "ACs %d %d %d %d\n", + pet->armor[0],pet->armor[1],pet->armor[2],pet->armor[3]); + fprintf(fp, "Attr %d %d %d %d %d\n", + pet->perm_stat[STAT_STR], pet->perm_stat[STAT_INT], + pet->perm_stat[STAT_WIS], pet->perm_stat[STAT_DEX], + pet->perm_stat[STAT_CON]); + fprintf(fp, "AMod %d %d %d %d %d\n", + pet->mod_stat[STAT_STR], pet->mod_stat[STAT_INT], + pet->mod_stat[STAT_WIS], pet->mod_stat[STAT_DEX], + pet->mod_stat[STAT_CON]); + + for ( paf = pet->affected; paf != NULL; paf = paf->next ) + { + if (paf->type < 0 || paf->type >= MAX_SKILL) + continue; + + fprintf(fp, "Affc '%s' %3d %3d %3d %3d %3d %10d\n", + skill_table[paf->type].name, + paf->where, paf->level, paf->duration, paf->modifier,paf->location, + paf->bitvector); + } + + fprintf(fp,"End\n"); + return; +} + +/* + * Write an object and its contents. + */ +void fwrite_obj( CHAR_DATA *ch, OBJ_DATA *obj, FILE *fp, int iNest ) +{ + EXTRA_DESCR_DATA *ed; + AFFECT_DATA *paf; + + /* + * Slick recursion to write lists backwards, + * so loading them will load in forwards order. + */ + if ( obj->next_content != NULL ) + fwrite_obj( ch, obj->next_content, fp, iNest ); + + /* + * Castrate storage characters. + */ + if ( (ch->level < obj->level - 2 && obj->item_type != ITEM_CONTAINER) + || obj->item_type == ITEM_KEY + || (obj->item_type == ITEM_MAP && !obj->value[0])) + return; + + fprintf( fp, "#O\n" ); + fprintf( fp, "Vnum %d\n", obj->pIndexData->vnum ); + if (!obj->pIndexData->new_format) + fprintf( fp, "Oldstyle\n"); + if (obj->enchanted) + fprintf( fp,"Enchanted\n"); + fprintf( fp, "Nest %d\n", iNest ); + + /* these data are only used if they do not match the defaults */ + + if ( obj->name != obj->pIndexData->name) + fprintf( fp, "Name %s~\n", obj->name ); + if ( obj->short_descr != obj->pIndexData->short_descr) + fprintf( fp, "ShD %s~\n", obj->short_descr ); + if ( obj->description != obj->pIndexData->description) + fprintf( fp, "Desc %s~\n", obj->description ); + if ( obj->extra_flags != obj->pIndexData->extra_flags) + fprintf( fp, "ExtF %d\n", obj->extra_flags ); + if ( obj->wear_flags != obj->pIndexData->wear_flags) + fprintf( fp, "WeaF %d\n", obj->wear_flags ); + if ( obj->item_type != obj->pIndexData->item_type) + fprintf( fp, "Ityp %d\n", obj->item_type ); + if ( obj->weight != obj->pIndexData->weight) + fprintf( fp, "Wt %d\n", obj->weight ); + if ( obj->condition != obj->pIndexData->condition) + fprintf( fp, "Cond %d\n", obj->condition ); + + /* variable data */ + + fprintf( fp, "Wear %d\n", obj->wear_loc ); + if (obj->level != obj->pIndexData->level) + fprintf( fp, "Lev %d\n", obj->level ); + if (obj->timer != 0) + fprintf( fp, "Time %d\n", obj->timer ); + fprintf( fp, "Cost %d\n", obj->cost ); + if (obj->value[0] != obj->pIndexData->value[0] + || obj->value[1] != obj->pIndexData->value[1] + || obj->value[2] != obj->pIndexData->value[2] + || obj->value[3] != obj->pIndexData->value[3] + || obj->value[4] != obj->pIndexData->value[4]) + fprintf( fp, "Val %d %d %d %d %d\n", + obj->value[0], obj->value[1], obj->value[2], obj->value[3], + obj->value[4] ); + + switch ( obj->item_type ) + { + case ITEM_POTION: + case ITEM_SCROLL: + case ITEM_PILL: + if ( obj->value[1] > 0 ) + { + fprintf( fp, "Spell 1 '%s'\n", + skill_table[obj->value[1]].name ); + } + + if ( obj->value[2] > 0 ) + { + fprintf( fp, "Spell 2 '%s'\n", + skill_table[obj->value[2]].name ); + } + + if ( obj->value[3] > 0 ) + { + fprintf( fp, "Spell 3 '%s'\n", + skill_table[obj->value[3]].name ); + } + + break; + + case ITEM_STAFF: + case ITEM_WAND: + if ( obj->value[3] > 0 ) + { + fprintf( fp, "Spell 3 '%s'\n", + skill_table[obj->value[3]].name ); + } + + break; + } + + for ( paf = obj->affected; paf != NULL; paf = paf->next ) + { + if (paf->type < 0 || paf->type >= MAX_SKILL) + continue; + fprintf( fp, "Affc '%s' %3d %3d %3d %3d %3d %10d\n", + skill_table[paf->type].name, + paf->where, + paf->level, + paf->duration, + paf->modifier, + paf->location, + paf->bitvector + ); + } + + for ( ed = obj->extra_descr; ed != NULL; ed = ed->next ) + { + fprintf( fp, "ExDe %s~ %s~\n", + ed->keyword, ed->description ); + } + + fprintf( fp, "End\n\n" ); + + if ( obj->contains != NULL ) + fwrite_obj( ch, obj->contains, fp, iNest + 1 ); + + return; +} + + + +/* + * Load a char and inventory into a new ch structure. + */ +bool load_char_obj( DESCRIPTOR_DATA *d, char *name ) +{ + char strsave[MAX_INPUT_LENGTH]; + char buf[100]; + CHAR_DATA *ch; + FILE *fp; + bool found; + int stat; + + ch = new_char(); + ch->pcdata = new_pcdata(); + + d->character = ch; + ch->desc = d; + ch->name = str_dup( name ); + ch->id = get_pc_id(); + ch->race = race_lookup("human"); + ch->act = PLR_NOSUMMON; + ch->comm = COMM_COMBINE + | COMM_PROMPT; + ch->prompt = str_dup("<%hhp %mm %vmv> "); + ch->pcdata->confirm_delete = FALSE; + ch->pcdata->pwd = str_dup( "" ); + ch->pcdata->bamfin = str_dup( "" ); + ch->pcdata->bamfout = str_dup( "" ); + ch->pcdata->title = str_dup( "" ); + for (stat =0; stat < MAX_STATS; stat++) + ch->perm_stat[stat] = 13; + ch->pcdata->condition[COND_THIRST] = 48; + ch->pcdata->condition[COND_FULL] = 48; + ch->pcdata->condition[COND_HUNGER] = 48; + + found = FALSE; + fclose( fpReserve ); + + #if defined(unix) + /* decompress if .gz file exists */ + sprintf( strsave, "%s%s%s", PLAYER_DIR, capitalize(name),".gz"); + if ( ( fp = fopen( strsave, "r" ) ) != NULL ) + { + fclose(fp); + sprintf(buf,"gzip -dfq %s",strsave); + system(buf); + } + #endif + + sprintf( strsave, "%s%s", PLAYER_DIR, capitalize( name ) ); + if ( ( fp = fopen( strsave, "r" ) ) != NULL ) + { + int iNest; + + for ( iNest = 0; iNest < MAX_NEST; iNest++ ) + rgObjNest[iNest] = NULL; + + found = TRUE; + for ( ; ; ) + { + char letter; + char *word; + + letter = fread_letter( fp ); + if ( letter == '*' ) + { + fread_to_eol( fp ); + continue; + } + + if ( letter != '#' ) + { + bug( "Load_char_obj: # not found.", 0 ); + break; + } + + word = fread_word( fp ); + if ( !str_cmp( word, "PLAYER" ) ) fread_char ( ch, fp ); + else if ( !str_cmp( word, "OBJECT" ) ) fread_obj ( ch, fp ); + else if ( !str_cmp( word, "O" ) ) fread_obj ( ch, fp ); + else if ( !str_cmp( word, "PET" ) ) fread_pet ( ch, fp ); + else if ( !str_cmp( word, "END" ) ) break; + else + { + bug( "Load_char_obj: bad section.", 0 ); + break; + } + } + fclose( fp ); + } + + fpReserve = fopen( NULL_FILE, "r" ); + + + /* initialize race */ + if (found) + { + int i; + + if (ch->race == 0) + ch->race = race_lookup("human"); + + ch->size = pc_race_table[ch->race].size; + ch->dam_type = 17; /*punch */ + + for (i = 0; i < 5; i++) + { + if (pc_race_table[ch->race].skills[i] == NULL) + break; + group_add(ch,pc_race_table[ch->race].skills[i],FALSE); + } + ch->affected_by = ch->affected_by|race_table[ch->race].aff; + ch->imm_flags = ch->imm_flags | race_table[ch->race].imm; + ch->res_flags = ch->res_flags | race_table[ch->race].res; + ch->vuln_flags = ch->vuln_flags | race_table[ch->race].vuln; + ch->form = race_table[ch->race].form; + ch->parts = race_table[ch->race].parts; + } + + + /* RT initialize skills */ + + if (found && ch->version < 2) /* need to add the new skills */ + { + group_add(ch,"rom basics",FALSE); + group_add(ch,class_table[ch->class].base_group,FALSE); + group_add(ch,class_table[ch->class].default_group,TRUE); + ch->pcdata->learned[gsn_recall] = 50; + } + + /* fix levels */ + if (found && ch->version < 3 && (ch->level > 35 || ch->trust > 35)) + { + switch (ch->level) + { + case(40) : ch->level = 60; break; /* imp -> imp */ + case(39) : ch->level = 58; break; /* god -> supreme */ + case(38) : ch->level = 56; break; /* deity -> god */ + case(37) : ch->level = 53; break; /* angel -> demigod */ + } + + switch (ch->trust) + { + case(40) : ch->trust = 60; break; /* imp -> imp */ + case(39) : ch->trust = 58; break; /* god -> supreme */ + case(38) : ch->trust = 56; break; /* deity -> god */ + case(37) : ch->trust = 53; break; /* angel -> demigod */ + case(36) : ch->trust = 51; break; /* hero -> hero */ + } + } + + /* ream gold */ + if (found && ch->version < 4) + { + ch->gold /= 100; + } + return found; +} + + + +/* + * Read in a char. + */ + +#if defined(KEY) +#undef KEY +#endif + +#define KEY( literal, field, value ) \ + if ( !str_cmp( word, literal ) ) \ + { \ + field = value; \ + fMatch = TRUE; \ + break; \ + } + +/* provided to free strings */ +#if defined(KEYS) +#undef KEYS +#endif + +#define KEYS( literal, field, value ) \ + if ( !str_cmp( word, literal ) ) \ + { \ + free_string(field); \ + field = value; \ + fMatch = TRUE; \ + break; \ + } + +void fread_char( CHAR_DATA *ch, FILE *fp ) +{ + char buf[MAX_STRING_LENGTH]; + char *word; + bool fMatch; + int count = 0; + int lastlogoff = current_time; + int percent; + + sprintf(buf,"Loading %s.",ch->name); + log_string(buf); + + for ( ; ; ) + { + word = feof( fp ) ? "End" : fread_word( fp ); + fMatch = FALSE; + + switch ( UPPER(word[0]) ) + { + case '*': + fMatch = TRUE; + fread_to_eol( fp ); + break; + + case 'A': + KEY( "Act", ch->act, fread_flag( fp ) ); + KEY( "AffectedBy", ch->affected_by, fread_flag( fp ) ); + KEY( "AfBy", ch->affected_by, fread_flag( fp ) ); + KEY( "Alignment", ch->alignment, fread_number( fp ) ); + KEY( "Alig", ch->alignment, fread_number( fp ) ); + + if (!str_cmp( word, "Alia")) + { + if (count >= MAX_ALIAS) + { + fread_to_eol(fp); + fMatch = TRUE; + break; + } + + ch->pcdata->alias[count] = str_dup(fread_word(fp)); + ch->pcdata->alias_sub[count] = str_dup(fread_word(fp)); + count++; + fMatch = TRUE; + break; + } + + if (!str_cmp( word, "Alias")) + { + if (count >= MAX_ALIAS) + { + fread_to_eol(fp); + fMatch = TRUE; + break; + } + + ch->pcdata->alias[count] = str_dup(fread_word(fp)); + ch->pcdata->alias_sub[count] = fread_string(fp); + count++; + fMatch = TRUE; + break; + } + + if (!str_cmp( word, "AC") || !str_cmp(word,"Armor")) + { + fread_to_eol(fp); + fMatch = TRUE; + break; + } + + if (!str_cmp(word,"ACs")) + { + int i; + + for (i = 0; i < 4; i++) + ch->armor[i] = fread_number(fp); + fMatch = TRUE; + break; + } + + if (!str_cmp(word, "AffD")) + { + AFFECT_DATA *paf; + int sn; + + paf = new_affect(); + + sn = skill_lookup(fread_word(fp)); + if (sn < 0) + bug("Fread_char: unknown skill.",0); + else + paf->type = sn; + + paf->level = fread_number( fp ); + paf->duration = fread_number( fp ); + paf->modifier = fread_number( fp ); + paf->location = fread_number( fp ); + paf->bitvector = fread_number( fp ); + paf->next = ch->affected; + ch->affected = paf; + fMatch = TRUE; + break; + } + + if (!str_cmp(word, "Affc")) + { + AFFECT_DATA *paf; + int sn; + + paf = new_affect(); + + sn = skill_lookup(fread_word(fp)); + if (sn < 0) + bug("Fread_char: unknown skill.",0); + else + paf->type = sn; + + paf->where = fread_number(fp); + paf->level = fread_number( fp ); + paf->duration = fread_number( fp ); + paf->modifier = fread_number( fp ); + paf->location = fread_number( fp ); + paf->bitvector = fread_number( fp ); + paf->next = ch->affected; + ch->affected = paf; + fMatch = TRUE; + break; + } + + if ( !str_cmp( word, "AttrMod" ) || !str_cmp(word,"AMod")) + { + int stat; + for (stat = 0; stat < MAX_STATS; stat ++) + ch->mod_stat[stat] = fread_number(fp); + fMatch = TRUE; + break; + } + + if ( !str_cmp( word, "AttrPerm" ) || !str_cmp(word,"Attr")) + { + int stat; + + for (stat = 0; stat < MAX_STATS; stat++) + ch->perm_stat[stat] = fread_number(fp); + fMatch = TRUE; + break; + } + break; + + case 'B': + KEY( "Bamfin", ch->pcdata->bamfin, fread_string( fp ) ); + KEY( "Bamfout", ch->pcdata->bamfout, fread_string( fp ) ); + KEY( "Bin", ch->pcdata->bamfin, fread_string( fp ) ); + KEY( "Bout", ch->pcdata->bamfout, fread_string( fp ) ); + break; + + case 'C': + KEY( "Class", ch->class, fread_number( fp ) ); + KEY( "Cla", ch->class, fread_number( fp ) ); + KEY( "Clan", ch->clan, clan_lookup(fread_string(fp))); + + if ( !str_cmp( word, "Condition" ) || !str_cmp(word,"Cond")) + { + ch->pcdata->condition[0] = fread_number( fp ); + ch->pcdata->condition[1] = fread_number( fp ); + ch->pcdata->condition[2] = fread_number( fp ); + fMatch = TRUE; + break; + } + if (!str_cmp(word,"Cnd")) + { + ch->pcdata->condition[0] = fread_number( fp ); + ch->pcdata->condition[1] = fread_number( fp ); + ch->pcdata->condition[2] = fread_number( fp ); + ch->pcdata->condition[3] = fread_number( fp ); + fMatch = TRUE; + break; + } + KEY("Comm", ch->comm, fread_flag( fp ) ); + + break; + + case 'D': + KEY( "Damroll", ch->damroll, fread_number( fp ) ); + KEY( "Dam", ch->damroll, fread_number( fp ) ); + KEY( "Description", ch->description, fread_string( fp ) ); + KEY( "Desc", ch->description, fread_string( fp ) ); + break; + + case 'E': + if ( !str_cmp( word, "End" ) ) + { + /* adjust hp mana move up -- here for speed's sake */ + percent = (current_time - lastlogoff) * 25 / ( 2 * 60 * 60); + + percent = UMIN(percent,100); + + if (percent > 0 && !IS_AFFECTED(ch,AFF_POISON) + && !IS_AFFECTED(ch,AFF_PLAGUE)) + { + ch->hit += (ch->max_hit - ch->hit) * percent / 100; + ch->mana += (ch->max_mana - ch->mana) * percent / 100; + ch->move += (ch->max_move - ch->move)* percent / 100; + } + return; + } + KEY( "Exp", ch->exp, fread_number( fp ) ); + break; + + case 'G': + KEY( "Gold", ch->gold, fread_number( fp ) ); + if ( !str_cmp( word, "Group" ) || !str_cmp(word,"Gr")) + { + int gn; + char *temp; + + temp = fread_word( fp ) ; + gn = group_lookup(temp); + /* gn = group_lookup( fread_word( fp ) ); */ + if ( gn < 0 ) + { + fprintf(stderr,"%s",temp); + bug( "Fread_char: unknown group. ", 0 ); + } + else + gn_add(ch,gn); + fMatch = TRUE; + } + break; + + case 'H': + KEY( "Hitroll", ch->hitroll, fread_number( fp ) ); + KEY( "Hit", ch->hitroll, fread_number( fp ) ); + + if ( !str_cmp( word, "HpManaMove" ) || !str_cmp(word,"HMV")) + { + ch->hit = fread_number( fp ); + ch->max_hit = fread_number( fp ); + ch->mana = fread_number( fp ); + ch->max_mana = fread_number( fp ); + ch->move = fread_number( fp ); + ch->max_move = fread_number( fp ); + fMatch = TRUE; + break; + } + + if ( !str_cmp( word, "HpManaMovePerm" ) || !str_cmp(word,"HMVP")) + { + ch->pcdata->perm_hit = fread_number( fp ); + ch->pcdata->perm_mana = fread_number( fp ); + ch->pcdata->perm_move = fread_number( fp ); + fMatch = TRUE; + break; + } + + break; + + case 'I': + KEY( "Id", ch->id, fread_number( fp ) ); + KEY( "InvisLevel", ch->invis_level, fread_number( fp ) ); + KEY( "Inco", ch->incog_level, fread_number( fp ) ); + KEY( "Invi", ch->invis_level, fread_number( fp ) ); + break; + + case 'L': + KEY( "LastLevel", ch->pcdata->last_level, fread_number( fp ) ); + KEY( "LLev", ch->pcdata->last_level, fread_number( fp ) ); + KEY( "Level", ch->level, fread_number( fp ) ); + KEY( "Lev", ch->level, fread_number( fp ) ); + KEY( "Levl", ch->level, fread_number( fp ) ); + KEY( "LogO", lastlogoff, fread_number( fp ) ); + KEY( "LongDescr", ch->long_descr, fread_string( fp ) ); + KEY( "LnD", ch->long_descr, fread_string( fp ) ); + break; + + case 'N': + KEYS( "Name", ch->name, fread_string( fp ) ); + KEY( "Note", ch->pcdata->last_note, fread_number( fp ) ); + if (!str_cmp(word,"Not")) + { + ch->pcdata->last_note = fread_number(fp); + ch->pcdata->last_idea = fread_number(fp); + ch->pcdata->last_penalty = fread_number(fp); + ch->pcdata->last_news = fread_number(fp); + ch->pcdata->last_changes = fread_number(fp); + fMatch = TRUE; + break; + } + break; + + case 'P': + KEY( "Password", ch->pcdata->pwd, fread_string( fp ) ); + KEY( "Pass", ch->pcdata->pwd, fread_string( fp ) ); + KEY( "Played", ch->played, fread_number( fp ) ); + KEY( "Plyd", ch->played, fread_number( fp ) ); + KEY( "Points", ch->pcdata->points, fread_number( fp ) ); + KEY( "Pnts", ch->pcdata->points, fread_number( fp ) ); + KEY( "Position", ch->position, fread_number( fp ) ); + KEY( "Pos", ch->position, fread_number( fp ) ); + KEY( "Practice", ch->practice, fread_number( fp ) ); + KEY( "Prac", ch->practice, fread_number( fp ) ); + KEYS( "Prompt", ch->prompt, fread_string( fp ) ); + KEY( "Prom", ch->prompt, fread_string( fp ) ); + break; + + case 'R': + KEY( "Race", ch->race, + race_lookup(fread_string( fp )) ); + + if ( !str_cmp( word, "Room" ) ) + { + ch->in_room = get_room_index( fread_number( fp ) ); + if ( ch->in_room == NULL ) + ch->in_room = get_room_index( ROOM_VNUM_LIMBO ); + fMatch = TRUE; + break; + } + + break; + + case 'S': + KEY( "SavingThrow", ch->saving_throw, fread_number( fp ) ); + KEY( "Save", ch->saving_throw, fread_number( fp ) ); + KEY( "Scro", ch->lines, fread_number( fp ) ); + KEY( "Sex", ch->sex, fread_number( fp ) ); + KEY( "ShortDescr", ch->short_descr, fread_string( fp ) ); + KEY( "ShD", ch->short_descr, fread_string( fp ) ); + KEY( "Silv", ch->silver, fread_number( fp ) ); + + + if ( !str_cmp( word, "Skill" ) || !str_cmp(word,"Sk")) + { + int sn; + int value; + char *temp; + + value = fread_number( fp ); + temp = fread_word( fp ) ; + sn = skill_lookup(temp); + /* sn = skill_lookup( fread_word( fp ) ); */ + if ( sn < 0 ) + { + fprintf(stderr,"%s",temp); + bug( "Fread_char: unknown skill. ", 0 ); + } + else + ch->pcdata->learned[sn] = value; + fMatch = TRUE; + } + + break; + + case 'T': + KEY( "TrueSex", ch->pcdata->true_sex, fread_number( fp ) ); + KEY( "TSex", ch->pcdata->true_sex, fread_number( fp ) ); + KEY( "Trai", ch->train, fread_number( fp ) ); + KEY( "Trust", ch->trust, fread_number( fp ) ); + KEY( "Tru", ch->trust, fread_number( fp ) ); + + if ( !str_cmp( word, "Title" ) || !str_cmp( word, "Titl")) + { + ch->pcdata->title = fread_string( fp ); + if (ch->pcdata->title[0] != '.' && ch->pcdata->title[0] != ',' + && ch->pcdata->title[0] != '!' && ch->pcdata->title[0] != '?') + { + sprintf( buf, " %s", ch->pcdata->title ); + free_string( ch->pcdata->title ); + ch->pcdata->title = str_dup( buf ); + } + fMatch = TRUE; + break; + } + + break; + + case 'V': + KEY( "Version", ch->version, fread_number ( fp ) ); + KEY( "Vers", ch->version, fread_number ( fp ) ); + if ( !str_cmp( word, "Vnum" ) ) + { + ch->pIndexData = get_mob_index( fread_number( fp ) ); + fMatch = TRUE; + break; + } + break; + + case 'W': + KEY( "Wimpy", ch->wimpy, fread_number( fp ) ); + KEY( "Wimp", ch->wimpy, fread_number( fp ) ); + KEY( "Wizn", ch->wiznet, fread_flag( fp ) ); + break; + } + + if ( !fMatch ) + { + bug( "Fread_char: no match.", 0 ); + fread_to_eol( fp ); + } + } +} + +/* load a pet from the forgotten reaches */ +void fread_pet( CHAR_DATA *ch, FILE *fp ) +{ + char *word; + CHAR_DATA *pet; + bool fMatch; + int lastlogoff = current_time; + int percent; + + /* first entry had BETTER be the vnum or we barf */ + word = feof(fp) ? "END" : fread_word(fp); + if (!str_cmp(word,"Vnum")) + { + int vnum; + + vnum = fread_number(fp); + if (get_mob_index(vnum) == NULL) + { + bug("Fread_pet: bad vnum %d.",vnum); + pet = create_mobile(get_mob_index(MOB_VNUM_FIDO)); + } + else + pet = create_mobile(get_mob_index(vnum)); + } + else + { + bug("Fread_pet: no vnum in file.",0); + pet = create_mobile(get_mob_index(MOB_VNUM_FIDO)); + } + + for ( ; ; ) + { + word = feof(fp) ? "END" : fread_word(fp); + fMatch = FALSE; + + switch (UPPER(word[0])) + { + case '*': + fMatch = TRUE; + fread_to_eol(fp); + break; + + case 'A': + KEY( "Act", pet->act, fread_flag(fp)); + KEY( "AfBy", pet->affected_by, fread_flag(fp)); + KEY( "Alig", pet->alignment, fread_number(fp)); + + if (!str_cmp(word,"ACs")) + { + int i; + + for (i = 0; i < 4; i++) + pet->armor[i] = fread_number(fp); + fMatch = TRUE; + break; + } + + if (!str_cmp(word,"AffD")) + { + AFFECT_DATA *paf; + int sn; + + paf = new_affect(); + + sn = skill_lookup(fread_word(fp)); + if (sn < 0) + bug("Fread_char: unknown skill.",0); + else + paf->type = sn; + + paf->level = fread_number(fp); + paf->duration = fread_number(fp); + paf->modifier = fread_number(fp); + paf->location = fread_number(fp); + paf->bitvector = fread_number(fp); + paf->next = pet->affected; + pet->affected = paf; + fMatch = TRUE; + break; + } + + if (!str_cmp(word,"Affc")) + { + AFFECT_DATA *paf; + int sn; + + paf = new_affect(); + + sn = skill_lookup(fread_word(fp)); + if (sn < 0) + bug("Fread_char: unknown skill.",0); + else + paf->type = sn; + + paf->where = fread_number(fp); + paf->level = fread_number(fp); + paf->duration = fread_number(fp); + paf->modifier = fread_number(fp); + paf->location = fread_number(fp); + paf->bitvector = fread_number(fp); + paf->next = pet->affected; + pet->affected = paf; + fMatch = TRUE; + break; + } + + if (!str_cmp(word,"AMod")) + { + int stat; + + for (stat = 0; stat < MAX_STATS; stat++) + pet->mod_stat[stat] = fread_number(fp); + fMatch = TRUE; + break; + } + + if (!str_cmp(word,"Attr")) + { + int stat; + + for (stat = 0; stat < MAX_STATS; stat++) + pet->perm_stat[stat] = fread_number(fp); + fMatch = TRUE; + break; + } + break; + + case 'C': + KEY( "Clan", pet->clan, clan_lookup(fread_string(fp))); + KEY( "Comm", pet->comm, fread_flag(fp)); + break; + + case 'D': + KEY( "Dam", pet->damroll, fread_number(fp)); + KEY( "Desc", pet->description, fread_string(fp)); + break; + + case 'E': + if (!str_cmp(word,"End")) + { + pet->leader = ch; + pet->master = ch; + ch->pet = pet; + /* adjust hp mana move up -- here for speed's sake */ + percent = (current_time - lastlogoff) * 25 / ( 2 * 60 * 60); + + if (percent > 0 && !IS_AFFECTED(ch,AFF_POISON) + && !IS_AFFECTED(ch,AFF_PLAGUE)) + { + percent = UMIN(percent,100); + pet->hit += (pet->max_hit - pet->hit) * percent / 100; + pet->mana += (pet->max_mana - pet->mana) * percent / 100; + pet->move += (pet->max_move - pet->move)* percent / 100; + } + return; + } + KEY( "Exp", pet->exp, fread_number(fp)); + break; + + case 'G': + KEY( "Gold", pet->gold, fread_number(fp)); + break; + + case 'H': + KEY( "Hit", pet->hitroll, fread_number(fp)); + + if (!str_cmp(word,"HMV")) + { + pet->hit = fread_number(fp); + pet->max_hit = fread_number(fp); + pet->mana = fread_number(fp); + pet->max_mana = fread_number(fp); + pet->move = fread_number(fp); + pet->max_move = fread_number(fp); + fMatch = TRUE; + break; + } + break; + + case 'L': + KEY( "Levl", pet->level, fread_number(fp)); + KEY( "LnD", pet->long_descr, fread_string(fp)); + KEY( "LogO", lastlogoff, fread_number(fp)); + break; + + case 'N': + KEY( "Name", pet->name, fread_string(fp)); + break; + + case 'P': + KEY( "Pos", pet->position, fread_number(fp)); + break; + + case 'R': + KEY( "Race", pet->race, race_lookup(fread_string(fp))); + break; + + case 'S' : + KEY( "Save", pet->saving_throw, fread_number(fp)); + KEY( "Sex", pet->sex, fread_number(fp)); + KEY( "ShD", pet->short_descr, fread_string(fp)); + KEY( "Silv", pet->silver, fread_number( fp ) ); + break; + + if ( !fMatch ) + { + bug("Fread_pet: no match.",0); + fread_to_eol(fp); + } + + } + } +} + + + +void fread_obj( CHAR_DATA *ch, FILE *fp ) +{ + OBJ_DATA *obj; + char *word; + int iNest; + bool fMatch; + bool fNest; + bool fVnum; + bool first; + bool new_format; /* to prevent errors */ + bool make_new; /* update object */ + + fVnum = FALSE; + obj = NULL; + first = TRUE; /* used to counter fp offset */ + new_format = FALSE; + make_new = FALSE; + + word = feof( fp ) ? "End" : fread_word( fp ); + if (!str_cmp(word,"Vnum" )) + { + int vnum; + first = FALSE; /* fp will be in right place */ + + vnum = fread_number( fp ); + if ( get_obj_index( vnum ) == NULL ) + { + bug( "Fread_obj: bad vnum %d.", vnum ); + } + else + { + obj = create_object(get_obj_index(vnum),-1); + new_format = TRUE; + } + + } + + if (obj == NULL) /* either not found or old style */ + { + obj = new_obj(); + obj->name = str_dup( "" ); + obj->short_descr = str_dup( "" ); + obj->description = str_dup( "" ); + } + + fNest = FALSE; + fVnum = TRUE; + iNest = 0; + + for ( ; ; ) + { + if (first) + first = FALSE; + else + word = feof( fp ) ? "End" : fread_word( fp ); + fMatch = FALSE; + + switch ( UPPER(word[0]) ) + { + case '*': + fMatch = TRUE; + fread_to_eol( fp ); + break; + + case 'A': + if (!str_cmp(word,"AffD")) + { + AFFECT_DATA *paf; + int sn; + + paf = new_affect(); + + sn = skill_lookup(fread_word(fp)); + if (sn < 0) + bug("Fread_obj: unknown skill.",0); + else + paf->type = sn; + + paf->level = fread_number( fp ); + paf->duration = fread_number( fp ); + paf->modifier = fread_number( fp ); + paf->location = fread_number( fp ); + paf->bitvector = fread_number( fp ); + paf->next = obj->affected; + obj->affected = paf; + fMatch = TRUE; + break; + } + if (!str_cmp(word,"Affc")) + { + AFFECT_DATA *paf; + int sn; + + paf = new_affect(); + + sn = skill_lookup(fread_word(fp)); + if (sn < 0) + bug("Fread_obj: unknown skill.",0); + else + paf->type = sn; + + paf->where = fread_number( fp ); + paf->level = fread_number( fp ); + paf->duration = fread_number( fp ); + paf->modifier = fread_number( fp ); + paf->location = fread_number( fp ); + paf->bitvector = fread_number( fp ); + paf->next = obj->affected; + obj->affected = paf; + fMatch = TRUE; + break; + } + break; + + case 'C': + KEY( "Cond", obj->condition, fread_number( fp ) ); + KEY( "Cost", obj->cost, fread_number( fp ) ); + break; + + case 'D': + KEY( "Description", obj->description, fread_string( fp ) ); + KEY( "Desc", obj->description, fread_string( fp ) ); + break; + + case 'E': + + if ( !str_cmp( word, "Enchanted")) + { + obj->enchanted = TRUE; + fMatch = TRUE; + break; + } + + KEY( "ExtraFlags", obj->extra_flags, fread_number( fp ) ); + KEY( "ExtF", obj->extra_flags, fread_number( fp ) ); + + if ( !str_cmp( word, "ExtraDescr" ) || !str_cmp(word,"ExDe")) + { + EXTRA_DESCR_DATA *ed; + + ed = new_extra_descr(); + + ed->keyword = fread_string( fp ); + ed->description = fread_string( fp ); + ed->next = obj->extra_descr; + obj->extra_descr = ed; + fMatch = TRUE; + } + + if ( !str_cmp( word, "End" ) ) + { + if ( !fNest || !fVnum || obj->pIndexData == NULL) + { + bug( "Fread_obj: incomplete object.", 0 ); + free_obj(obj); + return; + } + else + { + if (!new_format) + { + obj->next = object_list; + object_list = obj; + obj->pIndexData->count++; + } + + if (!obj->pIndexData->new_format + && obj->item_type == ITEM_ARMOR + && obj->value[1] == 0) + { + obj->value[1] = obj->value[0]; + obj->value[2] = obj->value[0]; + } + if (make_new) + { + int wear; + + wear = obj->wear_loc; + extract_obj(obj); + + obj = create_object(obj->pIndexData,0); + obj->wear_loc = wear; + } + if ( iNest == 0 || rgObjNest[iNest] == NULL ) + obj_to_char( obj, ch ); + else + obj_to_obj( obj, rgObjNest[iNest-1] ); + return; + } + } + break; + + case 'I': + KEY( "ItemType", obj->item_type, fread_number( fp ) ); + KEY( "Ityp", obj->item_type, fread_number( fp ) ); + break; + + case 'L': + KEY( "Level", obj->level, fread_number( fp ) ); + KEY( "Lev", obj->level, fread_number( fp ) ); + break; + + case 'N': + KEY( "Name", obj->name, fread_string( fp ) ); + + if ( !str_cmp( word, "Nest" ) ) + { + iNest = fread_number( fp ); + if ( iNest < 0 || iNest >= MAX_NEST ) + { + bug( "Fread_obj: bad nest %d.", iNest ); + } + else + { + rgObjNest[iNest] = obj; + fNest = TRUE; + } + fMatch = TRUE; + } + break; + + case 'O': + if ( !str_cmp( word,"Oldstyle" ) ) + { + if (obj->pIndexData != NULL && obj->pIndexData->new_format) + make_new = TRUE; + fMatch = TRUE; + } + break; + + + case 'S': + KEY( "ShortDescr", obj->short_descr, fread_string( fp ) ); + KEY( "ShD", obj->short_descr, fread_string( fp ) ); + + if ( !str_cmp( word, "Spell" ) ) + { + int iValue; + int sn; + + iValue = fread_number( fp ); + sn = skill_lookup( fread_word( fp ) ); + if ( iValue < 0 || iValue > 3 ) + { + bug( "Fread_obj: bad iValue %d.", iValue ); + } + else if ( sn < 0 ) + { + bug( "Fread_obj: unknown skill.", 0 ); + } + else + { + obj->value[iValue] = sn; + } + fMatch = TRUE; + break; + } + + break; + + case 'T': + KEY( "Timer", obj->timer, fread_number( fp ) ); + KEY( "Time", obj->timer, fread_number( fp ) ); + break; + + case 'V': + if ( !str_cmp( word, "Values" ) || !str_cmp(word,"Vals")) + { + obj->value[0] = fread_number( fp ); + obj->value[1] = fread_number( fp ); + obj->value[2] = fread_number( fp ); + obj->value[3] = fread_number( fp ); + if (obj->item_type == ITEM_WEAPON && obj->value[0] == 0) + obj->value[0] = obj->pIndexData->value[0]; + fMatch = TRUE; + break; + } + + if ( !str_cmp( word, "Val" ) ) + { + obj->value[0] = fread_number( fp ); + obj->value[1] = fread_number( fp ); + obj->value[2] = fread_number( fp ); + obj->value[3] = fread_number( fp ); + obj->value[4] = fread_number( fp ); + fMatch = TRUE; + break; + } + + if ( !str_cmp( word, "Vnum" ) ) + { + int vnum; + + vnum = fread_number( fp ); + if ( ( obj->pIndexData = get_obj_index( vnum ) ) == NULL ) + bug( "Fread_obj: bad vnum %d.", vnum ); + else + fVnum = TRUE; + fMatch = TRUE; + break; + } + break; + + case 'W': + KEY( "WearFlags", obj->wear_flags, fread_number( fp ) ); + KEY( "WeaF", obj->wear_flags, fread_number( fp ) ); + KEY( "WearLoc", obj->wear_loc, fread_number( fp ) ); + KEY( "Wear", obj->wear_loc, fread_number( fp ) ); + KEY( "Weight", obj->weight, fread_number( fp ) ); + KEY( "Wt", obj->weight, fread_number( fp ) ); + break; + + } + + if ( !fMatch ) + { + bug( "Fread_obj: no match.", 0 ); + fread_to_eol( fp ); + } + } +} diff --git a/Rom24/src/scan.c b/Rom24/src/scan.c new file mode 100644 index 0000000..0ab17a5 --- /dev/null +++ b/Rom24/src/scan.c @@ -0,0 +1,127 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +#if defined(macintosh) +#include +#else +#include +#endif +#include +#include +#include +#include +#include "merc.h" + +char *const distance[4]= +{ +"right here.", "nearby to the %s.", "not far %s.", "off in the distance %s." +}; + +void scan_list args((ROOM_INDEX_DATA *scan_room, CHAR_DATA *ch, + sh_int depth, sh_int door)); +void scan_char args((CHAR_DATA *victim, CHAR_DATA *ch, + sh_int depth, sh_int door)); +void do_scan(CHAR_DATA *ch, char *argument) +{ + extern char *const dir_name[]; + char arg1[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH]; + ROOM_INDEX_DATA *scan_room; + EXIT_DATA *pExit; + sh_int door, depth; + + argument = one_argument(argument, arg1); + + if (arg1[0] == '\0') + { + act("$n looks all around.", ch, NULL, NULL, TO_ROOM); + send_to_char("Looking around you see:\n\r", ch); + scan_list(ch->in_room, ch, 0, -1); + + for (door=0;door<6;door++) + { + if ((pExit = ch ->in_room->exit[door]) != NULL) + scan_list(pExit->u1.to_room, ch, 1, door); + } + return; + } + else if (!str_cmp(arg1, "n") || !str_cmp(arg1, "north")) door = 0; + else if (!str_cmp(arg1, "e") || !str_cmp(arg1, "east")) door = 1; + else if (!str_cmp(arg1, "s") || !str_cmp(arg1, "south")) door = 2; + else if (!str_cmp(arg1, "w") || !str_cmp(arg1, "west")) door = 3; + else if (!str_cmp(arg1, "u") || !str_cmp(arg1, "up" )) door = 4; + else if (!str_cmp(arg1, "d") || !str_cmp(arg1, "down")) door = 5; + else { send_to_char("Which way do you want to scan?\n\r", ch); return; } + + act("You peer intently $T.", ch, NULL, dir_name[door], TO_CHAR); + act("$n peers intently $T.", ch, NULL, dir_name[door], TO_ROOM); + sprintf(buf, "Looking %s you see:\n\r", dir_name[door]); + + scan_room = ch->in_room; + + for (depth = 1; depth < 4; depth++) + { + if ((pExit = scan_room->exit[door]) != NULL) + { + scan_room = pExit->u1.to_room; + scan_list(pExit->u1.to_room, ch, depth, door); + } + } + return; +} + +void scan_list(ROOM_INDEX_DATA *scan_room, CHAR_DATA *ch, sh_int depth, + sh_int door) +{ + CHAR_DATA *rch; + + if (scan_room == NULL) return; + for (rch=scan_room->people; rch != NULL; rch=rch->next_in_room) + { + if (rch == ch) continue; + if (!IS_NPC(rch) && rch->invis_level > get_trust(ch)) continue; + if (can_see(ch, rch)) scan_char(rch, ch, depth, door); + } + return; +} + +void scan_char(CHAR_DATA *victim, CHAR_DATA *ch, sh_int depth, sh_int door) +{ + extern char *const dir_name[]; + extern char *const distance[]; + char buf[MAX_INPUT_LENGTH], buf2[MAX_INPUT_LENGTH]; + + buf[0] = '\0'; + + strcat(buf, PERS(victim, ch)); + strcat(buf, ", "); + sprintf(buf2, distance[depth], dir_name[door]); + strcat(buf, buf2); + strcat(buf, "\n\r"); + + send_to_char(buf, ch); + return; +} diff --git a/Rom24/src/skills.c b/Rom24/src/skills.c new file mode 100644 index 0000000..37fe86a --- /dev/null +++ b/Rom24/src/skills.c @@ -0,0 +1,1069 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +#if defined(macintosh) +#include +#include +#else +#include +#include +#endif +#include +#include +#include +#include "merc.h" +#include "interp.h" +#include "magic.h" +#include "recycle.h" + +/* used to get new skills */ +void do_gain(CHAR_DATA *ch, char *argument) +{ + char buf[MAX_STRING_LENGTH]; + char arg[MAX_INPUT_LENGTH]; + CHAR_DATA *trainer; + int gn = 0, sn = 0; + + if (IS_NPC(ch)) + return; + + /* find a trainer */ + for ( trainer = ch->in_room->people; + trainer != NULL; + trainer = trainer->next_in_room) + if (IS_NPC(trainer) && IS_SET(trainer->act,ACT_GAIN)) + break; + + if (trainer == NULL || !can_see(ch,trainer)) + { + send_to_char("You can't do that here.\n\r",ch); + return; + } + + one_argument(argument,arg); + + if (arg[0] == '\0') + { + do_function(trainer, &do_say, "Pardon me?"); + return; + } + + if (!str_prefix(arg,"list")) + { + int col; + + col = 0; + + sprintf(buf, "%-18s %-5s %-18s %-5s %-18s %-5s\n\r", + "group","cost","group","cost","group","cost"); + send_to_char(buf,ch); + + for (gn = 0; gn < MAX_GROUP; gn++) + { + if (group_table[gn].name == NULL) + break; + + if (!ch->pcdata->group_known[gn] + && group_table[gn].rating[ch->class] > 0) + { + sprintf(buf,"%-18s %-5d ", + group_table[gn].name,group_table[gn].rating[ch->class]); + send_to_char(buf,ch); + if (++col % 3 == 0) + send_to_char("\n\r",ch); + } + } + if (col % 3 != 0) + send_to_char("\n\r",ch); + + send_to_char("\n\r",ch); + + col = 0; + + sprintf(buf, "%-18s %-5s %-18s %-5s %-18s %-5s\n\r", + "skill","cost","skill","cost","skill","cost"); + send_to_char(buf,ch); + + for (sn = 0; sn < MAX_SKILL; sn++) + { + if (skill_table[sn].name == NULL) + break; + + if (!ch->pcdata->learned[sn] + && skill_table[sn].rating[ch->class] > 0 + && skill_table[sn].spell_fun == spell_null) + { + sprintf(buf,"%-18s %-5d ", + skill_table[sn].name,skill_table[sn].rating[ch->class]); + send_to_char(buf,ch); + if (++col % 3 == 0) + send_to_char("\n\r",ch); + } + } + if (col % 3 != 0) + send_to_char("\n\r",ch); + return; + } + + if (!str_prefix(arg,"convert")) + { + if (ch->practice < 10) + { + act("$N tells you 'You are not yet ready.'", + ch,NULL,trainer,TO_CHAR); + return; + } + + act("$N helps you apply your practice to training", + ch,NULL,trainer,TO_CHAR); + ch->practice -= 10; + ch->train +=1 ; + return; + } + + if (!str_prefix(arg,"points")) + { + if (ch->train < 2) + { + act("$N tells you 'You are not yet ready.'", + ch,NULL,trainer,TO_CHAR); + return; + } + + if (ch->pcdata->points <= 40) + { + act("$N tells you 'There would be no point in that.'", + ch,NULL,trainer,TO_CHAR); + return; + } + + act("$N trains you, and you feel more at ease with your skills.", + ch,NULL,trainer,TO_CHAR); + + ch->train -= 2; + ch->pcdata->points -= 1; + ch->exp = exp_per_level(ch,ch->pcdata->points) * ch->level; + return; + } + + /* else add a group/skill */ + + gn = group_lookup(argument); + if (gn > 0) + { + if (ch->pcdata->group_known[gn]) + { + act("$N tells you 'You already know that group!'", + ch,NULL,trainer,TO_CHAR); + return; + } + + if (group_table[gn].rating[ch->class] <= 0) + { + act("$N tells you 'That group is beyond your powers.'", + ch,NULL,trainer,TO_CHAR); + return; + } + + if (ch->train < group_table[gn].rating[ch->class]) + { + act("$N tells you 'You are not yet ready for that group.'", + ch,NULL,trainer,TO_CHAR); + return; + } + + /* add the group */ + gn_add(ch,gn); + act("$N trains you in the art of $t", + ch,group_table[gn].name,trainer,TO_CHAR); + ch->train -= group_table[gn].rating[ch->class]; + return; + } + + sn = skill_lookup(argument); + if (sn > -1) + { + if (skill_table[sn].spell_fun != spell_null) + { + act("$N tells you 'You must learn the full group.'", + ch,NULL,trainer,TO_CHAR); + return; + } + + + if (ch->pcdata->learned[sn]) + { + act("$N tells you 'You already know that skill!'", + ch,NULL,trainer,TO_CHAR); + return; + } + + if (skill_table[sn].rating[ch->class] <= 0) + { + act("$N tells you 'That skill is beyond your powers.'", + ch,NULL,trainer,TO_CHAR); + return; + } + + if (ch->train < skill_table[sn].rating[ch->class]) + { + act("$N tells you 'You are not yet ready for that skill.'", + ch,NULL,trainer,TO_CHAR); + return; + } + + /* add the skill */ + ch->pcdata->learned[sn] = 1; + act("$N trains you in the art of $t", + ch,skill_table[sn].name,trainer,TO_CHAR); + ch->train -= skill_table[sn].rating[ch->class]; + return; + } + + act("$N tells you 'I do not understand...'",ch,NULL,trainer,TO_CHAR); +} + + + + +/* RT spells and skills show the players spells (or skills) */ + +void do_spells(CHAR_DATA *ch, char *argument) +{ + BUFFER *buffer; + char arg[MAX_INPUT_LENGTH]; + char spell_list[LEVEL_HERO + 1][MAX_STRING_LENGTH]; + char spell_columns[LEVEL_HERO + 1]; + int sn, level, min_lev = 1, max_lev = LEVEL_HERO, mana; + bool fAll = FALSE, found = FALSE; + char buf[MAX_STRING_LENGTH]; + + if (IS_NPC(ch)) + return; + + if (argument[0] != '\0') + { + fAll = TRUE; + + if (str_prefix(argument,"all")) + { + argument = one_argument(argument,arg); + if (!is_number(arg)) + { + send_to_char("Arguments must be numerical or all.\n\r",ch); + return; + } + max_lev = atoi(arg); + + if (max_lev < 1 || max_lev > LEVEL_HERO) + { + sprintf(buf,"Levels must be between 1 and %d.\n\r",LEVEL_HERO); + send_to_char(buf,ch); + return; + } + + if (argument[0] != '\0') + { + argument = one_argument(argument,arg); + if (!is_number(arg)) + { + send_to_char("Arguments must be numerical or all.\n\r",ch); + return; + } + min_lev = max_lev; + max_lev = atoi(arg); + + if (max_lev < 1 || max_lev > LEVEL_HERO) + { + sprintf(buf, + "Levels must be between 1 and %d.\n\r",LEVEL_HERO); + send_to_char(buf,ch); + return; + } + + if (min_lev > max_lev) + { + send_to_char("That would be silly.\n\r",ch); + return; + } + } + } + } + + + /* initialize data */ + for (level = 0; level < LEVEL_HERO + 1; level++) + { + spell_columns[level] = 0; + spell_list[level][0] = '\0'; + } + + for (sn = 0; sn < MAX_SKILL; sn++) + { + if (skill_table[sn].name == NULL ) + break; + + if ((level = skill_table[sn].skill_level[ch->class]) < LEVEL_HERO + 1 + && (fAll || level <= ch->level) + && level >= min_lev && level <= max_lev + && skill_table[sn].spell_fun != spell_null + && ch->pcdata->learned[sn] > 0) + { + found = TRUE; + level = skill_table[sn].skill_level[ch->class]; + if (ch->level < level) + sprintf(buf,"%-18s n/a ", skill_table[sn].name); + else + { + mana = UMAX(skill_table[sn].min_mana, + 100/(2 + ch->level - level)); + sprintf(buf,"%-18s %3d mana ",skill_table[sn].name,mana); + } + + if (spell_list[level][0] == '\0') + sprintf(spell_list[level],"\n\rLevel %2d: %s",level,buf); + else /* append */ + { + if ( ++spell_columns[level] % 2 == 0) + strcat(spell_list[level],"\n\r "); + strcat(spell_list[level],buf); + } + } + } + + /* return results */ + + if (!found) + { + send_to_char("No spells found.\n\r",ch); + return; + } + + buffer = new_buf(); + for (level = 0; level < LEVEL_HERO + 1; level++) + if (spell_list[level][0] != '\0') + add_buf(buffer,spell_list[level]); + add_buf(buffer,"\n\r"); + page_to_char(buf_string(buffer),ch); + free_buf(buffer); +} + +void do_skills(CHAR_DATA *ch, char *argument) +{ + BUFFER *buffer; + char arg[MAX_INPUT_LENGTH]; + char skill_list[LEVEL_HERO + 1][MAX_STRING_LENGTH]; + char skill_columns[LEVEL_HERO + 1]; + int sn, level, min_lev = 1, max_lev = LEVEL_HERO; + bool fAll = FALSE, found = FALSE; + char buf[MAX_STRING_LENGTH]; + + if (IS_NPC(ch)) + return; + + if (argument[0] != '\0') + { + fAll = TRUE; + + if (str_prefix(argument,"all")) + { + argument = one_argument(argument,arg); + if (!is_number(arg)) + { + send_to_char("Arguments must be numerical or all.\n\r",ch); + return; + } + max_lev = atoi(arg); + + if (max_lev < 1 || max_lev > LEVEL_HERO) + { + sprintf(buf,"Levels must be between 1 and %d.\n\r",LEVEL_HERO); + send_to_char(buf,ch); + return; + } + + if (argument[0] != '\0') + { + argument = one_argument(argument,arg); + if (!is_number(arg)) + { + send_to_char("Arguments must be numerical or all.\n\r",ch); + return; + } + min_lev = max_lev; + max_lev = atoi(arg); + + if (max_lev < 1 || max_lev > LEVEL_HERO) + { + sprintf(buf, + "Levels must be between 1 and %d.\n\r",LEVEL_HERO); + send_to_char(buf,ch); + return; + } + + if (min_lev > max_lev) + { + send_to_char("That would be silly.\n\r",ch); + return; + } + } + } + } + + + /* initialize data */ + for (level = 0; level < LEVEL_HERO + 1; level++) + { + skill_columns[level] = 0; + skill_list[level][0] = '\0'; + } + + for (sn = 0; sn < MAX_SKILL; sn++) + { + if (skill_table[sn].name == NULL ) + break; + + if ((level = skill_table[sn].skill_level[ch->class]) < LEVEL_HERO + 1 + && (fAll || level <= ch->level) + && level >= min_lev && level <= max_lev + && skill_table[sn].spell_fun == spell_null + && ch->pcdata->learned[sn] > 0) + { + found = TRUE; + level = skill_table[sn].skill_level[ch->class]; + if (ch->level < level) + sprintf(buf,"%-18s n/a ", skill_table[sn].name); + else + sprintf(buf,"%-18s %3d%% ",skill_table[sn].name, + ch->pcdata->learned[sn]); + + if (skill_list[level][0] == '\0') + sprintf(skill_list[level],"\n\rLevel %2d: %s",level,buf); + else /* append */ + { + if ( ++skill_columns[level] % 2 == 0) + strcat(skill_list[level],"\n\r "); + strcat(skill_list[level],buf); + } + } + } + + /* return results */ + + if (!found) + { + send_to_char("No skills found.\n\r",ch); + return; + } + + buffer = new_buf(); + for (level = 0; level < LEVEL_HERO + 1; level++) + if (skill_list[level][0] != '\0') + add_buf(buffer,skill_list[level]); + add_buf(buffer,"\n\r"); + page_to_char(buf_string(buffer),ch); + free_buf(buffer); +} + +/* shows skills, groups and costs (only if not bought) */ +void list_group_costs(CHAR_DATA *ch) +{ + char buf[100]; + int gn,sn,col; + + if (IS_NPC(ch)) + return; + + col = 0; + + sprintf(buf,"%-18s %-5s %-18s %-5s %-18s %-5s\n\r","group","cp","group","cp","group","cp"); + send_to_char(buf,ch); + + for (gn = 0; gn < MAX_GROUP; gn++) + { + if (group_table[gn].name == NULL) + break; + + if (!ch->gen_data->group_chosen[gn] + && !ch->pcdata->group_known[gn] + && group_table[gn].rating[ch->class] > 0) + { + sprintf(buf,"%-18s %-5d ",group_table[gn].name, + group_table[gn].rating[ch->class]); + send_to_char(buf,ch); + if (++col % 3 == 0) + send_to_char("\n\r",ch); + } + } + if ( col % 3 != 0 ) + send_to_char( "\n\r", ch ); + send_to_char("\n\r",ch); + + col = 0; + + sprintf(buf,"%-18s %-5s %-18s %-5s %-18s %-5s\n\r","skill","cp","skill","cp","skill","cp"); + send_to_char(buf,ch); + + for (sn = 0; sn < MAX_SKILL; sn++) + { + if (skill_table[sn].name == NULL) + break; + + if (!ch->gen_data->skill_chosen[sn] + && ch->pcdata->learned[sn] == 0 + && skill_table[sn].spell_fun == spell_null + && skill_table[sn].rating[ch->class] > 0) + { + sprintf(buf,"%-18s %-5d ",skill_table[sn].name, + skill_table[sn].rating[ch->class]); + send_to_char(buf,ch); + if (++col % 3 == 0) + send_to_char("\n\r",ch); + } + } + if ( col % 3 != 0 ) + send_to_char( "\n\r", ch ); + send_to_char("\n\r",ch); + + sprintf(buf,"Creation points: %d\n\r",ch->pcdata->points); + send_to_char(buf,ch); + sprintf(buf,"Experience per level: %d\n\r", + exp_per_level(ch,ch->gen_data->points_chosen)); + send_to_char(buf,ch); + return; +} + + +void list_group_chosen(CHAR_DATA *ch) +{ + char buf[100]; + int gn,sn,col; + + if (IS_NPC(ch)) + return; + + col = 0; + + sprintf(buf,"%-18s %-5s %-18s %-5s %-18s %-5s","group","cp","group","cp","group","cp\n\r"); + send_to_char(buf,ch); + + for (gn = 0; gn < MAX_GROUP; gn++) + { + if (group_table[gn].name == NULL) + break; + + if (ch->gen_data->group_chosen[gn] + && group_table[gn].rating[ch->class] > 0) + { + sprintf(buf,"%-18s %-5d ",group_table[gn].name, + group_table[gn].rating[ch->class]); + send_to_char(buf,ch); + if (++col % 3 == 0) + send_to_char("\n\r",ch); + } + } + if ( col % 3 != 0 ) + send_to_char( "\n\r", ch ); + send_to_char("\n\r",ch); + + col = 0; + + sprintf(buf,"%-18s %-5s %-18s %-5s %-18s %-5s","skill","cp","skill","cp","skill","cp\n\r"); + send_to_char(buf,ch); + + for (sn = 0; sn < MAX_SKILL; sn++) + { + if (skill_table[sn].name == NULL) + break; + + if (ch->gen_data->skill_chosen[sn] + && skill_table[sn].rating[ch->class] > 0) + { + sprintf(buf,"%-18s %-5d ",skill_table[sn].name, + skill_table[sn].rating[ch->class]); + send_to_char(buf,ch); + if (++col % 3 == 0) + send_to_char("\n\r",ch); + } + } + if ( col % 3 != 0 ) + send_to_char( "\n\r", ch ); + send_to_char("\n\r",ch); + + sprintf(buf,"Creation points: %d\n\r",ch->gen_data->points_chosen); + send_to_char(buf,ch); + sprintf(buf,"Experience per level: %d\n\r", + exp_per_level(ch,ch->gen_data->points_chosen)); + send_to_char(buf,ch); + return; +} + +int exp_per_level(CHAR_DATA *ch, int points) +{ + int expl,inc; + + if (IS_NPC(ch)) + return 1000; + + expl = 1000; + inc = 500; + + if (points < 40) + return 1000 * (pc_race_table[ch->race].class_mult[ch->class] ? + pc_race_table[ch->race].class_mult[ch->class]/100 : 1); + + /* processing */ + points -= 40; + + while (points > 9) + { + expl += inc; + points -= 10; + if (points > 9) + { + expl += inc; + inc *= 2; + points -= 10; + } + } + + expl += points * inc / 10; + + return expl * pc_race_table[ch->race].class_mult[ch->class]/100; +} + +/* this procedure handles the input parsing for the skill generator */ +bool parse_gen_groups(CHAR_DATA *ch,char *argument) +{ + char arg[MAX_INPUT_LENGTH]; + char buf[100]; + int gn,sn,i; + + if (argument[0] == '\0') + return FALSE; + + argument = one_argument(argument,arg); + + if (!str_prefix(arg,"help")) + { + if (argument[0] == '\0') + { + do_function(ch, &do_help, "group help"); + return TRUE; + } + + do_function(ch, &do_help, argument); + return TRUE; + } + + if (!str_prefix(arg,"add")) + { + if (argument[0] == '\0') + { + send_to_char("You must provide a skill name.\n\r",ch); + return TRUE; + } + + gn = group_lookup(argument); + if (gn != -1) + { + if (ch->gen_data->group_chosen[gn] + || ch->pcdata->group_known[gn]) + { + send_to_char("You already know that group!\n\r",ch); + return TRUE; + } + + if (group_table[gn].rating[ch->class] < 1) + { + send_to_char("That group is not available.\n\r",ch); + return TRUE; + } + + /* Close security hole */ + if (ch->gen_data->points_chosen + group_table[gn].rating[ch->class] + > 300) + { + send_to_char( + "You cannot take more than 300 creation points.\n\r", ch); + return TRUE; + } + + sprintf(buf,"%s group added\n\r",group_table[gn].name); + send_to_char(buf,ch); + ch->gen_data->group_chosen[gn] = TRUE; + ch->gen_data->points_chosen += group_table[gn].rating[ch->class]; + gn_add(ch,gn); + ch->pcdata->points += group_table[gn].rating[ch->class]; + return TRUE; + } + + sn = skill_lookup(argument); + if (sn != -1) + { + if (ch->gen_data->skill_chosen[sn] + || ch->pcdata->learned[sn] > 0) + { + send_to_char("You already know that skill!\n\r",ch); + return TRUE; + } + + if (skill_table[sn].rating[ch->class] < 1 + || skill_table[sn].spell_fun != spell_null) + { + send_to_char("That skill is not available.\n\r",ch); + return TRUE; + } + + /* Close security hole */ + if (ch->gen_data->points_chosen + skill_table[sn].rating[ch->class] + > 300) + { + send_to_char( + "You cannot take more than 300 creation points.\n\r", ch); + return TRUE; + } + sprintf(buf, "%s skill added\n\r",skill_table[sn].name); + send_to_char(buf,ch); + ch->gen_data->skill_chosen[sn] = TRUE; + ch->gen_data->points_chosen += skill_table[sn].rating[ch->class]; + ch->pcdata->learned[sn] = 1; + ch->pcdata->points += skill_table[sn].rating[ch->class]; + return TRUE; + } + + send_to_char("No skills or groups by that name...\n\r",ch); + return TRUE; + } + + if (!strcmp(arg,"drop")) + { + if (argument[0] == '\0') + { + send_to_char("You must provide a skill to drop.\n\r",ch); + return TRUE; + } + + gn = group_lookup(argument); + if (gn != -1 && ch->gen_data->group_chosen[gn]) + { + send_to_char("Group dropped.\n\r",ch); + ch->gen_data->group_chosen[gn] = FALSE; + ch->gen_data->points_chosen -= group_table[gn].rating[ch->class]; + gn_remove(ch,gn); + for (i = 0; i < MAX_GROUP; i++) + { + if (ch->gen_data->group_chosen[gn]) + gn_add(ch,gn); + } + ch->pcdata->points -= group_table[gn].rating[ch->class]; + return TRUE; + } + + sn = skill_lookup(argument); + if (sn != -1 && ch->gen_data->skill_chosen[sn]) + { + send_to_char("Skill dropped.\n\r",ch); + ch->gen_data->skill_chosen[sn] = FALSE; + ch->gen_data->points_chosen -= skill_table[sn].rating[ch->class]; + ch->pcdata->learned[sn] = 0; + ch->pcdata->points -= skill_table[sn].rating[ch->class]; + return TRUE; + } + + send_to_char("You haven't bought any such skill or group.\n\r",ch); + return TRUE; + } + + if (!str_prefix(arg,"premise")) + { + do_function(ch, &do_help, "premise"); + return TRUE; + } + + if (!str_prefix(arg,"list")) + { + list_group_costs(ch); + return TRUE; + } + + if (!str_prefix(arg,"learned")) + { + list_group_chosen(ch); + return TRUE; + } + + if (!str_prefix(arg,"info")) + { + do_function(ch, &do_groups, argument); + return TRUE; + } + + return FALSE; +} + + + + + + +/* shows all groups, or the sub-members of a group */ +void do_groups(CHAR_DATA *ch, char *argument) +{ + char buf[100]; + int gn,sn,col; + + if (IS_NPC(ch)) + return; + + col = 0; + + if (argument[0] == '\0') + { /* show all groups */ + + for (gn = 0; gn < MAX_GROUP; gn++) + { + if (group_table[gn].name == NULL) + break; + if (ch->pcdata->group_known[gn]) + { + sprintf(buf,"%-20s ",group_table[gn].name); + send_to_char(buf,ch); + if (++col % 3 == 0) + send_to_char("\n\r",ch); + } + } + if ( col % 3 != 0 ) + send_to_char( "\n\r", ch ); + sprintf(buf,"Creation points: %d\n\r",ch->pcdata->points); + send_to_char(buf,ch); + return; + } + + if (!str_cmp(argument,"all")) /* show all groups */ + { + for (gn = 0; gn < MAX_GROUP; gn++) + { + if (group_table[gn].name == NULL) + break; + sprintf(buf,"%-20s ",group_table[gn].name); + send_to_char(buf,ch); + if (++col % 3 == 0) + send_to_char("\n\r",ch); + } + if ( col % 3 != 0 ) + send_to_char( "\n\r", ch ); + return; + } + + + /* show the sub-members of a group */ + gn = group_lookup(argument); + if (gn == -1) + { + send_to_char("No group of that name exist.\n\r",ch); + send_to_char( + "Type 'groups all' or 'info all' for a full listing.\n\r",ch); + return; + } + + for (sn = 0; sn < MAX_IN_GROUP; sn++) + { + if (group_table[gn].spells[sn] == NULL) + break; + sprintf(buf,"%-20s ",group_table[gn].spells[sn]); + send_to_char(buf,ch); + if (++col % 3 == 0) + send_to_char("\n\r",ch); + } + if ( col % 3 != 0 ) + send_to_char( "\n\r", ch ); +} + +/* checks for skill improvement */ +void check_improve( CHAR_DATA *ch, int sn, bool success, int multiplier ) +{ + int chance; + char buf[100]; + + if (IS_NPC(ch)) + return; + + if (ch->level < skill_table[sn].skill_level[ch->class] + || skill_table[sn].rating[ch->class] == 0 + || ch->pcdata->learned[sn] == 0 + || ch->pcdata->learned[sn] == 100) + return; /* skill is not known */ + + /* check to see if the character has a chance to learn */ + chance = 10 * int_app[get_curr_stat(ch,STAT_INT)].learn; + chance /= ( multiplier + * skill_table[sn].rating[ch->class] + * 4); + chance += ch->level; + + if (number_range(1,1000) > chance) + return; + + /* now that the character has a CHANCE to learn, see if they really have */ + + if (success) + { + chance = URANGE(5,100 - ch->pcdata->learned[sn], 95); + if (number_percent() < chance) + { + sprintf(buf,"You have become better at %s!\n\r", + skill_table[sn].name); + send_to_char(buf,ch); + ch->pcdata->learned[sn]++; + gain_exp(ch,2 * skill_table[sn].rating[ch->class]); + } + } + + else + { + chance = URANGE(5,ch->pcdata->learned[sn]/2,30); + if (number_percent() < chance) + { + sprintf(buf, + "You learn from your mistakes, and your %s skill improves.\n\r", + skill_table[sn].name); + send_to_char(buf,ch); + ch->pcdata->learned[sn] += number_range(1,3); + ch->pcdata->learned[sn] = UMIN(ch->pcdata->learned[sn],100); + gain_exp(ch,2 * skill_table[sn].rating[ch->class]); + } + } +} + +/* returns a group index number given the name */ +int group_lookup( const char *name ) +{ + int gn; + + for ( gn = 0; gn < MAX_GROUP; gn++ ) + { + if ( group_table[gn].name == NULL ) + break; + if ( LOWER(name[0]) == LOWER(group_table[gn].name[0]) + && !str_prefix( name, group_table[gn].name ) ) + return gn; + } + + return -1; +} + +/* recursively adds a group given its number -- uses group_add */ +void gn_add( CHAR_DATA *ch, int gn) +{ + int i; + + ch->pcdata->group_known[gn] = TRUE; + for ( i = 0; i < MAX_IN_GROUP; i++) + { + if (group_table[gn].spells[i] == NULL) + break; + group_add(ch,group_table[gn].spells[i],FALSE); + } +} + +/* recusively removes a group given its number -- uses group_remove */ +void gn_remove( CHAR_DATA *ch, int gn) +{ + int i; + + ch->pcdata->group_known[gn] = FALSE; + + for ( i = 0; i < MAX_IN_GROUP; i ++) + { + if (group_table[gn].spells[i] == NULL) + break; + group_remove(ch,group_table[gn].spells[i]); + } +} + +/* use for processing a skill or group for addition */ +void group_add( CHAR_DATA *ch, const char *name, bool deduct) +{ + int sn,gn; + + if (IS_NPC(ch)) /* NPCs do not have skills */ + return; + + sn = skill_lookup(name); + + if (sn != -1) + { + if (ch->pcdata->learned[sn] == 0) /* i.e. not known */ + { + ch->pcdata->learned[sn] = 1; + if (deduct) + ch->pcdata->points += skill_table[sn].rating[ch->class]; + } + return; + } + + /* now check groups */ + + gn = group_lookup(name); + + if (gn != -1) + { + if (ch->pcdata->group_known[gn] == FALSE) + { + ch->pcdata->group_known[gn] = TRUE; + if (deduct) + ch->pcdata->points += group_table[gn].rating[ch->class]; + } + gn_add(ch,gn); /* make sure all skills in the group are known */ + } +} + +/* used for processing a skill or group for deletion -- no points back! */ + +void group_remove(CHAR_DATA *ch, const char *name) +{ + int sn, gn; + + sn = skill_lookup(name); + + if (sn != -1) + { + ch->pcdata->learned[sn] = 0; + return; + } + + /* now check groups */ + + gn = group_lookup(name); + + if (gn != -1 && ch->pcdata->group_known[gn] == TRUE) + { + ch->pcdata->group_known[gn] = FALSE; + gn_remove(ch,gn); /* be sure to call gn_add on all remaining groups */ + } +} diff --git a/Rom24/src/special.c b/Rom24/src/special.c new file mode 100644 index 0000000..c067408 --- /dev/null +++ b/Rom24/src/special.c @@ -0,0 +1,1042 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +#if defined(macintosh) +#include +#include +#else +#include +#endif +#include +#include +#include +#include +#include "merc.h" +#include "interp.h" +#include "magic.h" + +/* + * The following special functions are available for mobiles. + */ +DECLARE_SPEC_FUN( spec_breath_any ); +DECLARE_SPEC_FUN( spec_breath_acid ); +DECLARE_SPEC_FUN( spec_breath_fire ); +DECLARE_SPEC_FUN( spec_breath_frost ); +DECLARE_SPEC_FUN( spec_breath_gas ); +DECLARE_SPEC_FUN( spec_breath_lightning ); +DECLARE_SPEC_FUN( spec_cast_adept ); +DECLARE_SPEC_FUN( spec_cast_cleric ); +DECLARE_SPEC_FUN( spec_cast_judge ); +DECLARE_SPEC_FUN( spec_cast_mage ); +DECLARE_SPEC_FUN( spec_cast_undead ); +DECLARE_SPEC_FUN( spec_executioner ); +DECLARE_SPEC_FUN( spec_fido ); +DECLARE_SPEC_FUN( spec_guard ); +DECLARE_SPEC_FUN( spec_janitor ); +DECLARE_SPEC_FUN( spec_mayor ); +DECLARE_SPEC_FUN( spec_poison ); +DECLARE_SPEC_FUN( spec_thief ); +DECLARE_SPEC_FUN( spec_nasty ); +DECLARE_SPEC_FUN( spec_troll_member ); +DECLARE_SPEC_FUN( spec_ogre_member ); +DECLARE_SPEC_FUN( spec_patrolman ); + +/* the function table */ +const struct spec_type spec_table[] = +{ + { "spec_breath_any", spec_breath_any }, + { "spec_breath_acid", spec_breath_acid }, + { "spec_breath_fire", spec_breath_fire }, + { "spec_breath_frost", spec_breath_frost }, + { "spec_breath_gas", spec_breath_gas }, + { "spec_breath_lightning", spec_breath_lightning }, + { "spec_cast_adept", spec_cast_adept }, + { "spec_cast_cleric", spec_cast_cleric }, + { "spec_cast_judge", spec_cast_judge }, + { "spec_cast_mage", spec_cast_mage }, + { "spec_cast_undead", spec_cast_undead }, + { "spec_executioner", spec_executioner }, + { "spec_fido", spec_fido }, + { "spec_guard", spec_guard }, + { "spec_janitor", spec_janitor }, + { "spec_mayor", spec_mayor }, + { "spec_poison", spec_poison }, + { "spec_thief", spec_thief }, + { "spec_nasty", spec_nasty }, + { "spec_troll_member", spec_troll_member }, + { "spec_ogre_member", spec_ogre_member }, + { "spec_patrolman", spec_patrolman }, + { NULL, NULL } +}; + +/* + * Given a name, return the appropriate spec fun. + */ +SPEC_FUN *spec_lookup( const char *name ) +{ + int i; + + for ( i = 0; spec_table[i].name != NULL; i++) + { + if (LOWER(name[0]) == LOWER(spec_table[i].name[0]) + && !str_prefix( name,spec_table[i].name)) + return spec_table[i].function; + } + + return 0; +} + +char *spec_name( SPEC_FUN *function) +{ + int i; + + for (i = 0; spec_table[i].function != NULL; i++) + { + if (function == spec_table[i].function) + return spec_table[i].name; + } + + return NULL; +} + +bool spec_troll_member( CHAR_DATA *ch) +{ + CHAR_DATA *vch, *victim = NULL; + int count = 0; + char *message; + + if (!IS_AWAKE(ch) || IS_AFFECTED(ch,AFF_CALM) || ch->in_room == NULL + || IS_AFFECTED(ch,AFF_CHARM) || ch->fighting != NULL) + return FALSE; + + /* find an ogre to beat up */ + for (vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room) + { + if (!IS_NPC(vch) || ch == vch) + continue; + + if (vch->pIndexData->vnum == MOB_VNUM_PATROLMAN) + return FALSE; + + if (vch->pIndexData->group == GROUP_VNUM_OGRES + && ch->level > vch->level - 2 && !is_safe(ch,vch)) + { + if (number_range(0,count) == 0) + victim = vch; + + count++; + } + } + + if (victim == NULL) + return FALSE; + + /* say something, then raise hell */ + switch (number_range(0,6)) + { + default: message = NULL; break; + case 0: message = "$n yells 'I've been looking for you, punk!'"; + break; + case 1: message = "With a scream of rage, $n attacks $N."; + break; + case 2: message = + "$n says 'What's slimy Ogre trash like you doing around here?'"; + break; + case 3: message = "$n cracks his knuckles and says 'Do ya feel lucky?'"; + break; + case 4: message = "$n says 'There's no cops to save you this time!'"; + break; + case 5: message = "$n says 'Time to join your brother, spud.'"; + break; + case 6: message = "$n says 'Let's rock.'"; + break; + } + + if (message != NULL) + act(message,ch,NULL,victim,TO_ALL); + multi_hit( ch, victim, TYPE_UNDEFINED ); + return TRUE; +} + +bool spec_ogre_member( CHAR_DATA *ch) +{ + CHAR_DATA *vch, *victim = NULL; + int count = 0; + char *message; + + if (!IS_AWAKE(ch) || IS_AFFECTED(ch,AFF_CALM) || ch->in_room == NULL + || IS_AFFECTED(ch,AFF_CHARM) || ch->fighting != NULL) + return FALSE; + + /* find an troll to beat up */ + for (vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room) + { + if (!IS_NPC(vch) || ch == vch) + continue; + + if (vch->pIndexData->vnum == MOB_VNUM_PATROLMAN) + return FALSE; + + if (vch->pIndexData->group == GROUP_VNUM_TROLLS + && ch->level > vch->level - 2 && !is_safe(ch,vch)) + { + if (number_range(0,count) == 0) + victim = vch; + + count++; + } + } + + if (victim == NULL) + return FALSE; + + /* say something, then raise hell */ + switch (number_range(0,6)) + { + default: message = NULL; break; + case 0: message = "$n yells 'I've been looking for you, punk!'"; + break; + case 1: message = "With a scream of rage, $n attacks $N.'"; + break; + case 2: message = + "$n says 'What's Troll filth like you doing around here?'"; + break; + case 3: message = "$n cracks his knuckles and says 'Do ya feel lucky?'"; + break; + case 4: message = "$n says 'There's no cops to save you this time!'"; + break; + case 5: message = "$n says 'Time to join your brother, spud.'"; + break; + case 6: message = "$n says 'Let's rock.'"; + break; + } + + if (message != NULL) + act(message,ch,NULL,victim,TO_ALL); + multi_hit( ch, victim, TYPE_UNDEFINED ); + return TRUE; +} + +bool spec_patrolman(CHAR_DATA *ch) +{ + CHAR_DATA *vch,*victim = NULL; + OBJ_DATA *obj; + char *message; + int count = 0; + + if (!IS_AWAKE(ch) || IS_AFFECTED(ch,AFF_CALM) || ch->in_room == NULL + || IS_AFFECTED(ch,AFF_CHARM) || ch->fighting != NULL) + return FALSE; + + /* look for a fight in the room */ + for (vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room) + { + if (vch == ch) + continue; + + if (vch->fighting != NULL) /* break it up! */ + { + if (number_range(0,count) == 0) + victim = (vch->level > vch->fighting->level) + ? vch : vch->fighting; + count++; + } + } + + if (victim == NULL || (IS_NPC(victim) && victim->spec_fun == ch->spec_fun)) + return FALSE; + + if (((obj = get_eq_char(ch,WEAR_NECK_1)) != NULL + && obj->pIndexData->vnum == OBJ_VNUM_WHISTLE) + || ((obj = get_eq_char(ch,WEAR_NECK_2)) != NULL + && obj->pIndexData->vnum == OBJ_VNUM_WHISTLE)) + { + act("You blow down hard on $p.",ch,obj,NULL,TO_CHAR); + act("$n blows on $p, ***WHEEEEEEEEEEEET***",ch,obj,NULL,TO_ROOM); + + for ( vch = char_list; vch != NULL; vch = vch->next ) + { + if ( vch->in_room == NULL ) + continue; + + if (vch->in_room != ch->in_room + && vch->in_room->area == ch->in_room->area) + send_to_char( "You hear a shrill whistling sound.\n\r", vch ); + } + } + + switch (number_range(0,6)) + { + default: message = NULL; break; + case 0: message = "$n yells 'All roit! All roit! break it up!'"; + break; + case 1: message = + "$n says 'Society's to blame, but what's a bloke to do?'"; + break; + case 2: message = + "$n mumbles 'bloody kids will be the death of us all.'"; + break; + case 3: message = "$n shouts 'Stop that! Stop that!' and attacks."; + break; + case 4: message = "$n pulls out his billy and goes to work."; + break; + case 5: message = + "$n sighs in resignation and proceeds to break up the fight."; + break; + case 6: message = "$n says 'Settle down, you hooligans!'"; + break; + } + + if (message != NULL) + act(message,ch,NULL,NULL,TO_ALL); + + multi_hit(ch,victim,TYPE_UNDEFINED); + + return TRUE; +} + + +bool spec_nasty( CHAR_DATA *ch ) +{ + CHAR_DATA *victim, *v_next; + long gold; + + if (!IS_AWAKE(ch)) { + return FALSE; + } + + if (ch->position != POS_FIGHTING) { + for ( victim = ch->in_room->people; victim != NULL; victim = v_next) + { + v_next = victim->next_in_room; + if (!IS_NPC(victim) + && (victim->level > ch->level) + && (victim->level < ch->level + 10)) + { + do_function(ch, &do_backstab, victim->name); + if (ch->position != POS_FIGHTING) + { + do_function(ch, &do_murder, victim->name); + } + + /* should steal some coins right away? :) */ + return TRUE; + } + } + return FALSE; /* No one to attack */ + } + + /* okay, we must be fighting.... steal some coins and flee */ + if ( (victim = ch->fighting) == NULL) + return FALSE; /* let's be paranoid.... */ + + switch ( number_bits(2) ) + { + case 0: act( "$n rips apart your coin purse, spilling your gold!", + ch, NULL, victim, TO_VICT); + act( "You slash apart $N's coin purse and gather his gold.", + ch, NULL, victim, TO_CHAR); + act( "$N's coin purse is ripped apart!", + ch, NULL, victim, TO_NOTVICT); + gold = victim->gold / 10; /* steal 10% of his gold */ + victim->gold -= gold; + ch->gold += gold; + return TRUE; + + case 1: do_function(ch, &do_flee, ""); + return TRUE; + + default: return FALSE; + } +} + +/* + * Core procedure for dragons. + */ +bool dragon( CHAR_DATA *ch, char *spell_name ) +{ + CHAR_DATA *victim; + CHAR_DATA *v_next; + int sn; + + if ( ch->position != POS_FIGHTING ) + return FALSE; + + for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) + { + v_next = victim->next_in_room; + if ( victim->fighting == ch && number_bits( 3 ) == 0 ) + break; + } + + if ( victim == NULL ) + return FALSE; + + if ( ( sn = skill_lookup( spell_name ) ) < 0 ) + return FALSE; + (*skill_table[sn].spell_fun) ( sn, ch->level, ch, victim, TARGET_CHAR); + return TRUE; +} + + + +/* + * Special procedures for mobiles. + */ +bool spec_breath_any( CHAR_DATA *ch ) +{ + if ( ch->position != POS_FIGHTING ) + return FALSE; + + switch ( number_bits( 3 ) ) + { + case 0: return spec_breath_fire ( ch ); + case 1: + case 2: return spec_breath_lightning ( ch ); + case 3: return spec_breath_gas ( ch ); + case 4: return spec_breath_acid ( ch ); + case 5: + case 6: + case 7: return spec_breath_frost ( ch ); + } + + return FALSE; +} + + + +bool spec_breath_acid( CHAR_DATA *ch ) +{ + return dragon( ch, "acid breath" ); +} + + + +bool spec_breath_fire( CHAR_DATA *ch ) +{ + return dragon( ch, "fire breath" ); +} + + + +bool spec_breath_frost( CHAR_DATA *ch ) +{ + return dragon( ch, "frost breath" ); +} + + + +bool spec_breath_gas( CHAR_DATA *ch ) +{ + int sn; + + if ( ch->position != POS_FIGHTING ) + return FALSE; + + if ( ( sn = skill_lookup( "gas breath" ) ) < 0 ) + return FALSE; + (*skill_table[sn].spell_fun) ( sn, ch->level, ch, NULL,TARGET_CHAR); + return TRUE; +} + + + +bool spec_breath_lightning( CHAR_DATA *ch ) +{ + return dragon( ch, "lightning breath" ); +} + + + +bool spec_cast_adept( CHAR_DATA *ch ) +{ + CHAR_DATA *victim; + CHAR_DATA *v_next; + + if ( !IS_AWAKE(ch) ) + return FALSE; + + for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) + { + v_next = victim->next_in_room; + if ( victim != ch && can_see( ch, victim ) && number_bits( 1 ) == 0 + && !IS_NPC(victim) && victim->level < 11) + break; + } + + if ( victim == NULL ) + return FALSE; + + switch ( number_bits( 4 ) ) + { + case 0: + act( "$n utters the word 'abrazak'.", ch, NULL, NULL, TO_ROOM ); + spell_armor( skill_lookup( "armor" ), ch->level,ch,victim,TARGET_CHAR); + return TRUE; + + case 1: + act( "$n utters the word 'fido'.", ch, NULL, NULL, TO_ROOM ); + spell_bless( skill_lookup( "bless" ), ch->level,ch,victim,TARGET_CHAR); + return TRUE; + + case 2: + act("$n utters the words 'judicandus noselacri'.",ch,NULL,NULL,TO_ROOM); + spell_cure_blindness( skill_lookup( "cure blindness" ), + ch->level, ch, victim,TARGET_CHAR); + return TRUE; + + case 3: + act("$n utters the words 'judicandus dies'.", ch,NULL, NULL, TO_ROOM ); + spell_cure_light( skill_lookup( "cure light" ), + ch->level, ch, victim,TARGET_CHAR); + return TRUE; + + case 4: + act( "$n utters the words 'judicandus sausabru'.",ch,NULL,NULL,TO_ROOM); + spell_cure_poison( skill_lookup( "cure poison" ), + ch->level, ch, victim,TARGET_CHAR); + return TRUE; + + case 5: + act("$n utters the word 'candusima'.", ch, NULL, NULL, TO_ROOM ); + spell_refresh( skill_lookup("refresh"),ch->level,ch,victim,TARGET_CHAR); + return TRUE; + + case 6: + act("$n utters the words 'judicandus eugzagz'.",ch,NULL,NULL,TO_ROOM); + spell_cure_disease(skill_lookup("cure disease"), + ch->level,ch,victim,TARGET_CHAR); + } + + return FALSE; +} + + + +bool spec_cast_cleric( CHAR_DATA *ch ) +{ + CHAR_DATA *victim; + CHAR_DATA *v_next; + char *spell; + int sn; + + if ( ch->position != POS_FIGHTING ) + return FALSE; + + for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) + { + v_next = victim->next_in_room; + if ( victim->fighting == ch && number_bits( 2 ) == 0 ) + break; + } + + if ( victim == NULL ) + return FALSE; + + for ( ;; ) + { + int min_level; + + switch ( number_bits( 4 ) ) + { + case 0: min_level = 0; spell = "blindness"; break; + case 1: min_level = 3; spell = "cause serious"; break; + case 2: min_level = 7; spell = "earthquake"; break; + case 3: min_level = 9; spell = "cause critical"; break; + case 4: min_level = 10; spell = "dispel evil"; break; + case 5: min_level = 12; spell = "curse"; break; + case 6: min_level = 12; spell = "change sex"; break; + case 7: min_level = 13; spell = "flamestrike"; break; + case 8: + case 9: + case 10: min_level = 15; spell = "harm"; break; + case 11: min_level = 15; spell = "plague"; break; + default: min_level = 16; spell = "dispel magic"; break; + } + + if ( ch->level >= min_level ) + break; + } + + if ( ( sn = skill_lookup( spell ) ) < 0 ) + return FALSE; + (*skill_table[sn].spell_fun) ( sn, ch->level, ch, victim,TARGET_CHAR); + return TRUE; +} + +bool spec_cast_judge( CHAR_DATA *ch ) +{ + CHAR_DATA *victim; + CHAR_DATA *v_next; + char *spell; + int sn; + + if ( ch->position != POS_FIGHTING ) + return FALSE; + + for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) + { + v_next = victim->next_in_room; + if ( victim->fighting == ch && number_bits( 2 ) == 0 ) + break; + } + + if ( victim == NULL ) + return FALSE; + + spell = "high explosive"; + if ( ( sn = skill_lookup( spell ) ) < 0 ) + return FALSE; + (*skill_table[sn].spell_fun) ( sn, ch->level, ch, victim,TARGET_CHAR); + return TRUE; +} + + + +bool spec_cast_mage( CHAR_DATA *ch ) +{ + CHAR_DATA *victim; + CHAR_DATA *v_next; + char *spell; + int sn; + + if ( ch->position != POS_FIGHTING ) + return FALSE; + + for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) + { + v_next = victim->next_in_room; + if ( victim->fighting == ch && number_bits( 2 ) == 0 ) + break; + } + + if ( victim == NULL ) + return FALSE; + + for ( ;; ) + { + int min_level; + + switch ( number_bits( 4 ) ) + { + case 0: min_level = 0; spell = "blindness"; break; + case 1: min_level = 3; spell = "chill touch"; break; + case 2: min_level = 7; spell = "weaken"; break; + case 3: min_level = 8; spell = "teleport"; break; + case 4: min_level = 11; spell = "colour spray"; break; + case 5: min_level = 12; spell = "change sex"; break; + case 6: min_level = 13; spell = "energy drain"; break; + case 7: + case 8: + case 9: min_level = 15; spell = "fireball"; break; + case 10: min_level = 20; spell = "plague"; break; + default: min_level = 20; spell = "acid blast"; break; + } + + if ( ch->level >= min_level ) + break; + } + + if ( ( sn = skill_lookup( spell ) ) < 0 ) + return FALSE; + (*skill_table[sn].spell_fun) ( sn, ch->level, ch, victim,TARGET_CHAR); + return TRUE; +} + + + +bool spec_cast_undead( CHAR_DATA *ch ) +{ + CHAR_DATA *victim; + CHAR_DATA *v_next; + char *spell; + int sn; + + if ( ch->position != POS_FIGHTING ) + return FALSE; + + for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) + { + v_next = victim->next_in_room; + if ( victim->fighting == ch && number_bits( 2 ) == 0 ) + break; + } + + if ( victim == NULL ) + return FALSE; + + for ( ;; ) + { + int min_level; + + switch ( number_bits( 4 ) ) + { + case 0: min_level = 0; spell = "curse"; break; + case 1: min_level = 3; spell = "weaken"; break; + case 2: min_level = 6; spell = "chill touch"; break; + case 3: min_level = 9; spell = "blindness"; break; + case 4: min_level = 12; spell = "poison"; break; + case 5: min_level = 15; spell = "energy drain"; break; + case 6: min_level = 18; spell = "harm"; break; + case 7: min_level = 21; spell = "teleport"; break; + case 8: min_level = 20; spell = "plague"; break; + default: min_level = 18; spell = "harm"; break; + } + + if ( ch->level >= min_level ) + break; + } + + if ( ( sn = skill_lookup( spell ) ) < 0 ) + return FALSE; + (*skill_table[sn].spell_fun) ( sn, ch->level, ch, victim,TARGET_CHAR); + return TRUE; +} + + +bool spec_executioner( CHAR_DATA *ch ) +{ + char buf[MAX_STRING_LENGTH]; + CHAR_DATA *victim; + CHAR_DATA *v_next; + char *crime; + + if ( !IS_AWAKE(ch) || ch->fighting != NULL ) + return FALSE; + + crime = ""; + for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) + { + v_next = victim->next_in_room; + + if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_KILLER) + && can_see(ch,victim)) + { crime = "KILLER"; break; } + + if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_THIEF) + && can_see(ch,victim)) + { crime = "THIEF"; break; } + } + + if ( victim == NULL ) + return FALSE; + + sprintf( buf, "%s is a %s! PROTECT THE INNOCENT! MORE BLOOOOD!!!", + victim->name, crime ); + REMOVE_BIT(ch->comm,COMM_NOSHOUT); + do_function(ch, &do_yell, buf ); + multi_hit( ch, victim, TYPE_UNDEFINED ); + return TRUE; +} + + + +bool spec_fido( CHAR_DATA *ch ) +{ + OBJ_DATA *corpse; + OBJ_DATA *c_next; + OBJ_DATA *obj; + OBJ_DATA *obj_next; + + if ( !IS_AWAKE(ch) ) + return FALSE; + + for ( corpse = ch->in_room->contents; corpse != NULL; corpse = c_next ) + { + c_next = corpse->next_content; + if ( corpse->item_type != ITEM_CORPSE_NPC ) + continue; + + act( "$n savagely devours a corpse.", ch, NULL, NULL, TO_ROOM ); + for ( obj = corpse->contains; obj; obj = obj_next ) + { + obj_next = obj->next_content; + obj_from_obj( obj ); + obj_to_room( obj, ch->in_room ); + } + extract_obj( corpse ); + return TRUE; + } + + return FALSE; +} + + + +bool spec_guard( CHAR_DATA *ch ) +{ + char buf[MAX_STRING_LENGTH]; + CHAR_DATA *victim; + CHAR_DATA *v_next; + CHAR_DATA *ech; + char *crime; + int max_evil; + + if ( !IS_AWAKE(ch) || ch->fighting != NULL ) + return FALSE; + + max_evil = 300; + ech = NULL; + crime = ""; + + for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) + { + v_next = victim->next_in_room; + + if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_KILLER) + && can_see(ch,victim)) + { crime = "KILLER"; break; } + + if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_THIEF) + && can_see(ch,victim)) + { crime = "THIEF"; break; } + + if ( victim->fighting != NULL + && victim->fighting != ch + && victim->alignment < max_evil ) + { + max_evil = victim->alignment; + ech = victim; + } + } + + if ( victim != NULL ) + { + sprintf( buf, "%s is a %s! PROTECT THE INNOCENT!! BANZAI!!", + victim->name, crime ); + REMOVE_BIT(ch->comm,COMM_NOSHOUT); + do_function(ch, &do_yell, buf ); + multi_hit( ch, victim, TYPE_UNDEFINED ); + return TRUE; + } + + if ( ech != NULL ) + { + act( "$n screams 'PROTECT THE INNOCENT!! BANZAI!!", + ch, NULL, NULL, TO_ROOM ); + multi_hit( ch, ech, TYPE_UNDEFINED ); + return TRUE; + } + + return FALSE; +} + + + +bool spec_janitor( CHAR_DATA *ch ) +{ + OBJ_DATA *trash; + OBJ_DATA *trash_next; + + if ( !IS_AWAKE(ch) ) + return FALSE; + + for ( trash = ch->in_room->contents; trash != NULL; trash = trash_next ) + { + trash_next = trash->next_content; + if ( !IS_SET( trash->wear_flags, ITEM_TAKE ) || !can_loot(ch,trash)) + continue; + if ( trash->item_type == ITEM_DRINK_CON + || trash->item_type == ITEM_TRASH + || trash->cost < 10 ) + { + act( "$n picks up some trash.", ch, NULL, NULL, TO_ROOM ); + obj_from_room( trash ); + obj_to_char( trash, ch ); + return TRUE; + } + } + + return FALSE; +} + + + +bool spec_mayor( CHAR_DATA *ch ) +{ + static const char open_path[] = + "W3a3003b33000c111d0d111Oe333333Oe22c222112212111a1S."; + + static const char close_path[] = + "W3a3003b33000c111d0d111CE333333CE22c222112212111a1S."; + + static const char *path; + static int pos; + static bool move; + + if ( !move ) + { + if ( time_info.hour == 6 ) + { + path = open_path; + move = TRUE; + pos = 0; + } + + if ( time_info.hour == 20 ) + { + path = close_path; + move = TRUE; + pos = 0; + } + } + + if ( ch->fighting != NULL ) + return spec_cast_mage( ch ); + if ( !move || ch->position < POS_SLEEPING ) + return FALSE; + + switch ( path[pos] ) + { + case '0': + case '1': + case '2': + case '3': + move_char( ch, path[pos] - '0', FALSE ); + break; + + case 'W': + ch->position = POS_STANDING; + act( "$n awakens and groans loudly.", ch, NULL, NULL, TO_ROOM ); + break; + + case 'S': + ch->position = POS_SLEEPING; + act( "$n lies down and falls asleep.", ch, NULL, NULL, TO_ROOM ); + break; + + case 'a': + act( "$n says 'Hello Honey!'", ch, NULL, NULL, TO_ROOM ); + break; + + case 'b': + act( "$n says 'What a view! I must do something about that dump!'", + ch, NULL, NULL, TO_ROOM ); + break; + + case 'c': + act( "$n says 'Vandals! Youngsters have no respect for anything!'", + ch, NULL, NULL, TO_ROOM ); + break; + + case 'd': + act( "$n says 'Good day, citizens!'", ch, NULL, NULL, TO_ROOM ); + break; + + case 'e': + act( "$n says 'I hereby declare the city of Midgaard open!'", + ch, NULL, NULL, TO_ROOM ); + break; + + case 'E': + act( "$n says 'I hereby declare the city of Midgaard closed!'", + ch, NULL, NULL, TO_ROOM ); + break; + + case 'O': +/* do_function(ch, &do_unlock, "gate" ); */ + do_function(ch, &do_open, "gate" ); + break; + + case 'C': + do_function(ch, &do_close, "gate" ); +/* do_function(ch, &do_lock, "gate" ); */ + break; + + case '.' : + move = FALSE; + break; + } + + pos++; + return FALSE; +} + + + +bool spec_poison( CHAR_DATA *ch ) +{ + CHAR_DATA *victim; + + if ( ch->position != POS_FIGHTING + || ( victim = ch->fighting ) == NULL + || number_percent( ) > 2 * ch->level ) + return FALSE; + + act( "You bite $N!", ch, NULL, victim, TO_CHAR ); + act( "$n bites $N!", ch, NULL, victim, TO_NOTVICT ); + act( "$n bites you!", ch, NULL, victim, TO_VICT ); + spell_poison( gsn_poison, ch->level, ch, victim,TARGET_CHAR); + return TRUE; +} + + + +bool spec_thief( CHAR_DATA *ch ) +{ + CHAR_DATA *victim; + CHAR_DATA *v_next; + long gold,silver; + + if ( ch->position != POS_STANDING ) + return FALSE; + + for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) + { + v_next = victim->next_in_room; + + if ( IS_NPC(victim) + || victim->level >= LEVEL_IMMORTAL + || number_bits( 5 ) != 0 + || !can_see(ch,victim)) + continue; + + if ( IS_AWAKE(victim) && number_range( 0, ch->level ) == 0 ) + { + act( "You discover $n's hands in your wallet!", + ch, NULL, victim, TO_VICT ); + act( "$N discovers $n's hands in $S wallet!", + ch, NULL, victim, TO_NOTVICT ); + return TRUE; + } + else + { + gold = victim->gold * UMIN(number_range(1,20),ch->level / 2) / 100; + gold = UMIN(gold, ch->level * ch->level * 10 ); + ch->gold += gold; + victim->gold -= gold; + silver = victim->silver * UMIN(number_range(1,20),ch->level/2)/100; + silver = UMIN(silver,ch->level*ch->level * 25); + ch->silver += silver; + victim->silver -= silver; + return TRUE; + } + } + + return FALSE; +} + diff --git a/Rom24/src/tables.c b/Rom24/src/tables.c new file mode 100644 index 0000000..aa2f326 --- /dev/null +++ b/Rom24/src/tables.c @@ -0,0 +1,322 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +#if defined(macintosh) +#include +#else +#include +#endif +#include +#include +#include "merc.h" +#include "tables.h" + +/* for clans */ +const struct clan_type clan_table[MAX_CLAN] = +{ + /* name, who entry, death-transfer room, independent */ + /* independent should be FALSE if is a real clan */ + { "", "", ROOM_VNUM_ALTAR, TRUE }, + { "loner", "[ Loner ] ", ROOM_VNUM_ALTAR, TRUE }, + { "rom", "[ ROM ] ", ROOM_VNUM_ALTAR, FALSE } +}; + +/* for position */ +const struct position_type position_table[] = +{ + { "dead", "dead" }, + { "mortally wounded", "mort" }, + { "incapacitated", "incap" }, + { "stunned", "stun" }, + { "sleeping", "sleep" }, + { "resting", "rest" }, + { "sitting", "sit" }, + { "fighting", "fight" }, + { "standing", "stand" }, + { NULL, NULL } +}; + +/* for sex */ +const struct sex_type sex_table[] = +{ + { "none" }, + { "male" }, + { "female" }, + { "either" }, + { NULL } +}; + +/* for sizes */ +const struct size_type size_table[] = +{ + { "tiny" }, + { "small" }, + { "medium" }, + { "large" }, + { "huge", }, + { "giant" }, + { NULL } +}; + +/* various flag tables */ +const struct flag_type act_flags[] = +{ + { "npc", A, FALSE }, + { "sentinel", B, TRUE }, + { "scavenger", C, TRUE }, + { "aggressive", F, TRUE }, + { "stay_area", G, TRUE }, + { "wimpy", H, TRUE }, + { "pet", I, TRUE }, + { "train", J, TRUE }, + { "practice", K, TRUE }, + { "undead", O, TRUE }, + { "cleric", Q, TRUE }, + { "mage", R, TRUE }, + { "thief", S, TRUE }, + { "warrior", T, TRUE }, + { "noalign", U, TRUE }, + { "nopurge", V, TRUE }, + { "outdoors", W, TRUE }, + { "indoors", Y, TRUE }, + { "healer", aa, TRUE }, + { "gain", bb, TRUE }, + { "update_always", cc, TRUE }, + { "changer", dd, TRUE }, + { NULL, 0, FALSE } +}; + +const struct flag_type plr_flags[] = +{ + { "npc", A, FALSE }, + { "autoassist", C, FALSE }, + { "autoexit", D, FALSE }, + { "autoloot", E, FALSE }, + { "autosac", F, FALSE }, + { "autogold", G, FALSE }, + { "autosplit", H, FALSE }, + { "holylight", N, FALSE }, + { "can_loot", P, FALSE }, + { "nosummon", Q, FALSE }, + { "nofollow", R, FALSE }, + { "permit", U, TRUE }, + { "log", W, FALSE }, + { "deny", X, FALSE }, + { "freeze", Y, FALSE }, + { "thief", Z, FALSE }, + { "killer", aa, FALSE }, + { NULL, 0, 0 } +}; + +const struct flag_type affect_flags[] = +{ + { "blind", A, TRUE }, + { "invisible", B, TRUE }, + { "detect_evil", C, TRUE }, + { "detect_invis", D, TRUE }, + { "detect_magic", E, TRUE }, + { "detect_hidden", F, TRUE }, + { "detect_good", G, TRUE }, + { "sanctuary", H, TRUE }, + { "faerie_fire", I, TRUE }, + { "infrared", J, TRUE }, + { "curse", K, TRUE }, + { "poison", M, TRUE }, + { "protect_evil", N, TRUE }, + { "protect_good", O, TRUE }, + { "sneak", P, TRUE }, + { "hide", Q, TRUE }, + { "sleep", R, TRUE }, + { "charm", S, TRUE }, + { "flying", T, TRUE }, + { "pass_door", U, TRUE }, + { "haste", V, TRUE }, + { "calm", W, TRUE }, + { "plague", X, TRUE }, + { "weaken", Y, TRUE }, + { "dark_vision", Z, TRUE }, + { "berserk", aa, TRUE }, + { "swim", bb, TRUE }, + { "regeneration", cc, TRUE }, + { "slow", dd, TRUE }, + { NULL, 0, 0 } +}; + +const struct flag_type off_flags[] = +{ + { "area_attack", A, TRUE }, + { "backstab", B, TRUE }, + { "bash", C, TRUE }, + { "berserk", D, TRUE }, + { "disarm", E, TRUE }, + { "dodge", F, TRUE }, + { "fade", G, TRUE }, + { "fast", H, TRUE }, + { "kick", I, TRUE }, + { "dirt_kick", J, TRUE }, + { "parry", K, TRUE }, + { "rescue", L, TRUE }, + { "tail", M, TRUE }, + { "trip", N, TRUE }, + { "crush", O, TRUE }, + { "assist_all", P, TRUE }, + { "assist_align", Q, TRUE }, + { "assist_race", R, TRUE }, + { "assist_players", S, TRUE }, + { "assist_guard", T, TRUE }, + { "assist_vnum", U, TRUE }, + { NULL, 0, 0 } +}; + +const struct flag_type imm_flags[] = +{ + { "summon", A, TRUE }, + { "charm", B, TRUE }, + { "magic", C, TRUE }, + { "weapon", D, TRUE }, + { "bash", E, TRUE }, + { "pierce", F, TRUE }, + { "slash", G, TRUE }, + { "fire", H, TRUE }, + { "cold", I, TRUE }, + { "lightning", J, TRUE }, + { "acid", K, TRUE }, + { "poison", L, TRUE }, + { "negative", M, TRUE }, + { "holy", N, TRUE }, + { "energy", O, TRUE }, + { "mental", P, TRUE }, + { "disease", Q, TRUE }, + { "drowning", R, TRUE }, + { "light", S, TRUE }, + { "sound", T, TRUE }, + { "wood", X, TRUE }, + { "silver", Y, TRUE }, + { "iron", Z, TRUE }, + { NULL, 0, 0 } +}; + +const struct flag_type form_flags[] = +{ + { "edible", FORM_EDIBLE, TRUE }, + { "poison", FORM_POISON, TRUE }, + { "magical", FORM_MAGICAL, TRUE }, + { "instant_decay", FORM_INSTANT_DECAY, TRUE }, + { "other", FORM_OTHER, TRUE }, + { "animal", FORM_ANIMAL, TRUE }, + { "sentient", FORM_SENTIENT, TRUE }, + { "undead", FORM_UNDEAD, TRUE }, + { "construct", FORM_CONSTRUCT, TRUE }, + { "mist", FORM_MIST, TRUE }, + { "intangible", FORM_INTANGIBLE, TRUE }, + { "biped", FORM_BIPED, TRUE }, + { "centaur", FORM_CENTAUR, TRUE }, + { "insect", FORM_INSECT, TRUE }, + { "spider", FORM_SPIDER, TRUE }, + { "crustacean", FORM_CRUSTACEAN, TRUE }, + { "worm", FORM_WORM, TRUE }, + { "blob", FORM_BLOB, TRUE }, + { "mammal", FORM_MAMMAL, TRUE }, + { "bird", FORM_BIRD, TRUE }, + { "reptile", FORM_REPTILE, TRUE }, + { "snake", FORM_SNAKE, TRUE }, + { "dragon", FORM_DRAGON, TRUE }, + { "amphibian", FORM_AMPHIBIAN, TRUE }, + { "fish", FORM_FISH , TRUE }, + { "cold_blood", FORM_COLD_BLOOD, TRUE }, + { NULL, 0, 0 } +}; + +const struct flag_type part_flags[] = +{ + { "head", PART_HEAD, TRUE }, + { "arms", PART_ARMS, TRUE }, + { "legs", PART_LEGS, TRUE }, + { "heart", PART_HEART, TRUE }, + { "brains", PART_BRAINS, TRUE }, + { "guts", PART_GUTS, TRUE }, + { "hands", PART_HANDS, TRUE }, + { "feet", PART_FEET, TRUE }, + { "fingers", PART_FINGERS, TRUE }, + { "ear", PART_EAR, TRUE }, + { "eye", PART_EYE, TRUE }, + { "long_tongue", PART_LONG_TONGUE, TRUE }, + { "eyestalks", PART_EYESTALKS, TRUE }, + { "tentacles", PART_TENTACLES, TRUE }, + { "fins", PART_FINS, TRUE }, + { "wings", PART_WINGS, TRUE }, + { "tail", PART_TAIL, TRUE }, + { "claws", PART_CLAWS, TRUE }, + { "fangs", PART_FANGS, TRUE }, + { "horns", PART_HORNS, TRUE }, + { "scales", PART_SCALES, TRUE }, + { "tusks", PART_TUSKS, TRUE }, + { NULL, 0, 0 } +}; + +const struct flag_type comm_flags[] = +{ + { "quiet", COMM_QUIET, TRUE }, + { "deaf", COMM_DEAF, TRUE }, + { "nowiz", COMM_NOWIZ, TRUE }, + { "noclangossip", COMM_NOAUCTION, TRUE }, + { "nogossip", COMM_NOGOSSIP, TRUE }, + { "noquestion", COMM_NOQUESTION, TRUE }, + { "nomusic", COMM_NOMUSIC, TRUE }, + { "noclan", COMM_NOCLAN, TRUE }, + { "noquote", COMM_NOQUOTE, TRUE }, + { "shoutsoff", COMM_SHOUTSOFF, TRUE }, + { "compact", COMM_COMPACT, TRUE }, + { "brief", COMM_BRIEF, TRUE }, + { "prompt", COMM_PROMPT, TRUE }, + { "combine", COMM_COMBINE, TRUE }, + { "telnet_ga", COMM_TELNET_GA, TRUE }, + { "show_affects", COMM_SHOW_AFFECTS, TRUE }, + { "nograts", COMM_NOGRATS, TRUE }, + { "noemote", COMM_NOEMOTE, FALSE }, + { "noshout", COMM_NOSHOUT, FALSE }, + { "notell", COMM_NOTELL, FALSE }, + { "nochannels", COMM_NOCHANNELS, FALSE }, + { "snoop_proof", COMM_SNOOP_PROOF, FALSE }, + { "afk", COMM_AFK, TRUE }, + { NULL, 0, 0 } +}; + + + + + + + + + + + + + + + diff --git a/Rom24/src/tables.h b/Rom24/src/tables.h new file mode 100644 index 0000000..acddf6c --- /dev/null +++ b/Rom24/src/tables.h @@ -0,0 +1,81 @@ +/*************************************************************************** + * 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-1998 Russ Taylor * +* ROM has been brought to you by the ROM consortium * +* Russ Taylor (rtaylor@efn.org) * +* Russ Taylor (rtaylor@hypercube.org) * +* Gabrielle Taylor (gtaylor@hypercube.org) * +* By using this code, you have agreed to follow the terms of the * +* ROM license, in the file Rom24/doc/rom.license * +***************************************************************************/ + +struct flag_type +{ + char *name; + int bit; + bool settable; +}; + +struct clan_type +{ + char *name; + char *who_name; + sh_int hall; + bool independent; /* true for loners */ +}; + +struct position_type +{ + char *name; + char *short_name; +}; + +struct sex_type +{ + char *name; +}; + +struct size_type +{ + char *name; +}; + +/* game tables */ +extern const struct clan_type clan_table[MAX_CLAN]; +extern const struct position_type position_table[]; +extern const struct sex_type sex_table[]; +extern const struct size_type size_table[]; + +/* flag tables */ +extern const struct flag_type act_flags[]; +extern const struct flag_type plr_flags[]; +extern const struct flag_type affect_flags[]; +extern const struct flag_type off_flags[]; +extern const struct flag_type imm_flags[]; +extern const struct flag_type form_flags[]; +extern const struct flag_type part_flags[]; +extern const struct flag_type comm_flags[]; +extern const struct flag_type extra_flags[]; +extern const struct flag_type wear_flags[]; +extern const struct flag_type weapon_flags[]; +extern const struct flag_type container_flags[]; +extern const struct flag_type portal_flags[]; +extern const struct flag_type room_flags[]; +extern const struct flag_type exit_flags[]; + diff --git a/Rom24/src/telnet.h b/Rom24/src/telnet.h new file mode 100644 index 0000000..94a7330 --- /dev/null +++ b/Rom24/src/telnet.h @@ -0,0 +1,87 @@ +/* @(#)telnet.h 1.7 88/08/19 SMI; from UCB 5.1 5/30/85 */ +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +/* + * Definitions for the TELNET protocol. + */ + +#ifndef _arpa_telnet_h +#define _arpa_telnet_h + +#define IAC 255 /* interpret as command: */ +#define DONT 254 /* you are not to use option */ +#define DO 253 /* please, you use option */ +#define WONT 252 /* I won't use option */ +#define WILL 251 /* I will use option */ +#define SB 250 /* interpret as subnegotiation */ +#define GA 249 /* you may reverse the line */ +#define EL 248 /* erase the current line */ +#define EC 247 /* erase the current character */ +#define AYT 246 /* are you there */ +#define AO 245 /* abort output--but let prog finish */ +#define IP 244 /* interrupt process--permanently */ +#define BREAK 243 /* break */ +#define DM 242 /* data mark--for connect. cleaning */ +#define NOP 241 /* nop */ +#define SE 240 /* end sub negotiation */ +#define EOR 239 /* end of record (transparent mode) */ + +#define SYNCH 242 /* for telfunc calls */ + +#ifdef TELCMDS +char *telcmds[] = { + "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", + "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", +}; +#endif + +/* telnet options */ +#define TELOPT_BINARY 0 /* 8-bit data path */ +#define TELOPT_ECHO 1 /* echo */ +#define TELOPT_RCP 2 /* prepare to reconnect */ +#define TELOPT_SGA 3 /* suppress go ahead */ +#define TELOPT_NAMS 4 /* approximate message size */ +#define TELOPT_STATUS 5 /* give status */ +#define TELOPT_TM 6 /* timing mark */ +#define TELOPT_RCTE 7 /* remote controlled transmission and echo */ +#define TELOPT_NAOL 8 /* negotiate about output line width */ +#define TELOPT_NAOP 9 /* negotiate about output page size */ +#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */ +#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */ +#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */ +#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */ +#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */ +#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */ +#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */ +#define TELOPT_XASCII 17 /* extended ascic character set */ +#define TELOPT_LOGOUT 18 /* force logout */ +#define TELOPT_BM 19 /* byte macro */ +#define TELOPT_DET 20 /* data entry terminal */ +#define TELOPT_SUPDUP 21 /* supdup protocol */ +#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */ +#define TELOPT_SNDLOC 23 /* send location */ +#define TELOPT_TTYPE 24 /* terminal type */ +#define TELOPT_EOR 25 /* end or record */ +#define TELOPT_EXOPL 255 /* extended-options-list */ + +#ifdef TELOPTS +#define NTELOPTS (1+TELOPT_EOR) +char *telopts[NTELOPTS] = { + "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", + "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP", + "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", + "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", + "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT", + "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", +}; +#endif + +/* sub-option qualifiers */ +#define TELQUAL_IS 0 /* option is... */ +#define TELQUAL_SEND 1 /* send option */ + +#endif /*!_arpa_telnet_h*/ diff --git a/Rom24/src/update.c b/Rom24/src/update.c new file mode 100644 index 0000000..c17d348 --- /dev/null +++ b/Rom24/src/update.c @@ -0,0 +1,1127 @@ +/*************************************************************************** + * 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-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 * +***************************************************************************/ + +#if defined(macintosh) +#include +#else +#include +#endif +#include +#include +#include +#include "merc.h" +#include "interp.h" +#include "music.h" + +/* + * Local functions. + */ +int hit_gain args( ( CHAR_DATA *ch ) ); +int mana_gain args( ( CHAR_DATA *ch ) ); +int move_gain args( ( CHAR_DATA *ch ) ); +void mobile_update args( ( void ) ); +void weather_update args( ( void ) ); +void char_update args( ( void ) ); +void obj_update args( ( void ) ); +void aggr_update args( ( void ) ); + +/* used for saving */ + +int save_number = 0; + + + +/* + * Advancement stuff. + */ +void advance_level( CHAR_DATA *ch, bool hide ) +{ + char buf[MAX_STRING_LENGTH]; + int add_hp; + int add_mana; + int add_move; + int add_prac; + + ch->pcdata->last_level = + ( ch->played + (int) (current_time - ch->logon) ) / 3600; + + sprintf( buf, "the %s", + title_table [ch->class] [ch->level] [ch->sex == SEX_FEMALE ? 1 : 0] ); + set_title( ch, buf ); + + add_hp = con_app[get_curr_stat(ch,STAT_CON)].hitp + number_range( + class_table[ch->class].hp_min, + class_table[ch->class].hp_max ); + add_mana = number_range(2,(2*get_curr_stat(ch,STAT_INT) + + get_curr_stat(ch,STAT_WIS))/5); + if (!class_table[ch->class].fMana) + add_mana /= 2; + add_move = number_range( 1, (get_curr_stat(ch,STAT_CON) + + get_curr_stat(ch,STAT_DEX))/6 ); + add_prac = wis_app[get_curr_stat(ch,STAT_WIS)].practice; + + add_hp = add_hp * 9/10; + add_mana = add_mana * 9/10; + add_move = add_move * 9/10; + + add_hp = UMAX( 2, add_hp ); + add_mana = UMAX( 2, add_mana ); + add_move = UMAX( 6, add_move ); + + ch->max_hit += add_hp; + ch->max_mana += add_mana; + ch->max_move += add_move; + ch->practice += add_prac; + ch->train += 1; + + ch->pcdata->perm_hit += add_hp; + ch->pcdata->perm_mana += add_mana; + ch->pcdata->perm_move += add_move; + + if (!hide) + { + sprintf(buf, + "You gain %d hit point%s, %d mana, %d move, and %d practice%s.\n\r", + add_hp, add_hp == 1 ? "" : "s", add_mana, add_move, + add_prac, add_prac == 1 ? "" : "s"); + send_to_char( buf, ch ); + } + return; +} + + + +void gain_exp( CHAR_DATA *ch, int gain ) +{ + char buf[MAX_STRING_LENGTH]; + + if ( IS_NPC(ch) || ch->level >= LEVEL_HERO ) + return; + + ch->exp = UMAX( exp_per_level(ch,ch->pcdata->points), ch->exp + gain ); + while ( ch->level < LEVEL_HERO && ch->exp >= + exp_per_level(ch,ch->pcdata->points) * (ch->level+1) ) + { + send_to_char( "You raise a level!! ", ch ); + ch->level += 1; + sprintf(buf,"%s gained level %d",ch->name,ch->level); + log_string(buf); + sprintf(buf,"$N has attained level %d!",ch->level); + wiznet(buf,ch,NULL,WIZ_LEVELS,0,0); + advance_level(ch,FALSE); + save_char_obj(ch); + } + + return; +} + + + +/* + * Regeneration stuff. + */ +int hit_gain( CHAR_DATA *ch ) +{ + int gain; + int number; + + if (ch->in_room == NULL) + return 0; + + if ( IS_NPC(ch) ) + { + gain = 5 + ch->level; + if (IS_AFFECTED(ch,AFF_REGENERATION)) + gain *= 2; + + switch(ch->position) + { + default : gain /= 2; break; + case POS_SLEEPING: gain = 3 * gain/2; break; + case POS_RESTING: break; + case POS_FIGHTING: gain /= 3; break; + } + + + } + else + { + gain = UMAX(3,get_curr_stat(ch,STAT_CON) - 3 + ch->level/2); + gain += class_table[ch->class].hp_max - 10; + number = number_percent(); + if (number < get_skill(ch,gsn_fast_healing)) + { + gain += number * gain / 100; + if (ch->hit < ch->max_hit) + check_improve(ch,gsn_fast_healing,TRUE,8); + } + + switch ( ch->position ) + { + default: gain /= 4; break; + case POS_SLEEPING: break; + case POS_RESTING: gain /= 2; break; + case POS_FIGHTING: gain /= 6; break; + } + + if ( ch->pcdata->condition[COND_HUNGER] == 0 ) + gain /= 2; + + if ( ch->pcdata->condition[COND_THIRST] == 0 ) + gain /= 2; + + } + + gain = gain * ch->in_room->heal_rate / 100; + + if (ch->on != NULL && ch->on->item_type == ITEM_FURNITURE) + gain = gain * ch->on->value[3] / 100; + + if ( IS_AFFECTED(ch, AFF_POISON) ) + gain /= 4; + + if (IS_AFFECTED(ch, AFF_PLAGUE)) + gain /= 8; + + if (IS_AFFECTED(ch,AFF_HASTE) || IS_AFFECTED(ch,AFF_SLOW)) + gain /=2 ; + + return UMIN(gain, ch->max_hit - ch->hit); +} + + + +int mana_gain( CHAR_DATA *ch ) +{ + int gain; + int number; + + if (ch->in_room == NULL) + return 0; + + if ( IS_NPC(ch) ) + { + gain = 5 + ch->level; + switch (ch->position) + { + default: gain /= 2; break; + case POS_SLEEPING: gain = 3 * gain/2; break; + case POS_RESTING: break; + case POS_FIGHTING: gain /= 3; break; + } + } + else + { + gain = (get_curr_stat(ch,STAT_WIS) + + get_curr_stat(ch,STAT_INT) + ch->level) / 2; + number = number_percent(); + if (number < get_skill(ch,gsn_meditation)) + { + gain += number * gain / 100; + if (ch->mana < ch->max_mana) + check_improve(ch,gsn_meditation,TRUE,8); + } + if (!class_table[ch->class].fMana) + gain /= 2; + + switch ( ch->position ) + { + default: gain /= 4; break; + case POS_SLEEPING: break; + case POS_RESTING: gain /= 2; break; + case POS_FIGHTING: gain /= 6; break; + } + + if ( ch->pcdata->condition[COND_HUNGER] == 0 ) + gain /= 2; + + if ( ch->pcdata->condition[COND_THIRST] == 0 ) + gain /= 2; + + } + + gain = gain * ch->in_room->mana_rate / 100; + + if (ch->on != NULL && ch->on->item_type == ITEM_FURNITURE) + gain = gain * ch->on->value[4] / 100; + + if ( IS_AFFECTED( ch, AFF_POISON ) ) + gain /= 4; + + if (IS_AFFECTED(ch, AFF_PLAGUE)) + gain /= 8; + + if (IS_AFFECTED(ch,AFF_HASTE) || IS_AFFECTED(ch,AFF_SLOW)) + gain /=2 ; + + return UMIN(gain, ch->max_mana - ch->mana); +} + + + +int move_gain( CHAR_DATA *ch ) +{ + int gain; + + if (ch->in_room == NULL) + return 0; + + if ( IS_NPC(ch) ) + { + gain = ch->level; + } + else + { + gain = UMAX( 15, ch->level ); + + switch ( ch->position ) + { + case POS_SLEEPING: gain += get_curr_stat(ch,STAT_DEX); break; + case POS_RESTING: gain += get_curr_stat(ch,STAT_DEX) / 2; break; + } + + if ( ch->pcdata->condition[COND_HUNGER] == 0 ) + gain /= 2; + + if ( ch->pcdata->condition[COND_THIRST] == 0 ) + gain /= 2; + } + + gain = gain * ch->in_room->heal_rate/100; + + if (ch->on != NULL && ch->on->item_type == ITEM_FURNITURE) + gain = gain * ch->on->value[3] / 100; + + if ( IS_AFFECTED(ch, AFF_POISON) ) + gain /= 4; + + if (IS_AFFECTED(ch, AFF_PLAGUE)) + gain /= 8; + + if (IS_AFFECTED(ch,AFF_HASTE) || IS_AFFECTED(ch,AFF_SLOW)) + gain /=2 ; + + return UMIN(gain, ch->max_move - ch->move); +} + + + +void gain_condition( CHAR_DATA *ch, int iCond, int value ) +{ + int condition; + + if ( value == 0 || IS_NPC(ch) || ch->level >= LEVEL_IMMORTAL) + return; + + condition = ch->pcdata->condition[iCond]; + if (condition == -1) + return; + ch->pcdata->condition[iCond] = URANGE( 0, condition + value, 48 ); + + if ( ch->pcdata->condition[iCond] == 0 ) + { + switch ( iCond ) + { + case COND_HUNGER: + send_to_char( "You are hungry.\n\r", ch ); + break; + + case COND_THIRST: + send_to_char( "You are thirsty.\n\r", ch ); + break; + + case COND_DRUNK: + if ( condition != 0 ) + send_to_char( "You are sober.\n\r", ch ); + break; + } + } + + return; +} + + + +/* + * Mob autonomous action. + * This function takes 25% to 35% of ALL Merc cpu time. + * -- Furey + */ +void mobile_update( void ) +{ + CHAR_DATA *ch; + CHAR_DATA *ch_next; + EXIT_DATA *pexit; + int door; + + /* Examine all mobs. */ + for ( ch = char_list; ch != NULL; ch = ch_next ) + { + ch_next = ch->next; + + if ( !IS_NPC(ch) || ch->in_room == NULL || IS_AFFECTED(ch,AFF_CHARM)) + continue; + + if (ch->in_room->area->empty && !IS_SET(ch->act,ACT_UPDATE_ALWAYS)) + continue; + + /* Examine call for special procedure */ + if ( ch->spec_fun != 0 ) + { + if ( (*ch->spec_fun) ( ch ) ) + continue; + } + + if (ch->pIndexData->pShop != NULL) /* give him some gold */ + if ((ch->gold * 100 + ch->silver) < ch->pIndexData->wealth) + { + ch->gold += ch->pIndexData->wealth * number_range(1,20)/5000000; + ch->silver += ch->pIndexData->wealth * number_range(1,20)/50000; + } + + + /* That's all for sleeping / busy monster, and empty zones */ + if ( ch->position != POS_STANDING ) + continue; + + /* Scavenge */ + if ( IS_SET(ch->act, ACT_SCAVENGER) + && ch->in_room->contents != NULL + && number_bits( 6 ) == 0 ) + { + OBJ_DATA *obj; + OBJ_DATA *obj_best; + int max; + + max = 1; + obj_best = 0; + for ( obj = ch->in_room->contents; obj; obj = obj->next_content ) + { + if ( CAN_WEAR(obj, ITEM_TAKE) && can_loot(ch, obj) + && obj->cost > max && obj->cost > 0) + { + obj_best = obj; + max = obj->cost; + } + } + + if ( obj_best ) + { + obj_from_room( obj_best ); + obj_to_char( obj_best, ch ); + act( "$n gets $p.", ch, obj_best, NULL, TO_ROOM ); + } + } + + /* Wander */ + if ( !IS_SET(ch->act, ACT_SENTINEL) + && number_bits(3) == 0 + && ( door = number_bits( 5 ) ) <= 5 + && ( pexit = ch->in_room->exit[door] ) != NULL + && pexit->u1.to_room != NULL + && !IS_SET(pexit->exit_info, EX_CLOSED) + && !IS_SET(pexit->u1.to_room->room_flags, ROOM_NO_MOB) + && ( !IS_SET(ch->act, ACT_STAY_AREA) + || pexit->u1.to_room->area == ch->in_room->area ) + && ( !IS_SET(ch->act, ACT_OUTDOORS) + || !IS_SET(pexit->u1.to_room->room_flags,ROOM_INDOORS)) + && ( !IS_SET(ch->act, ACT_INDOORS) + || IS_SET(pexit->u1.to_room->room_flags,ROOM_INDOORS))) + { + move_char( ch, door, FALSE ); + } + } + + return; +} + + + +/* + * Update the weather. + */ +void weather_update( void ) +{ + char buf[MAX_STRING_LENGTH]; + DESCRIPTOR_DATA *d; + int diff; + + buf[0] = '\0'; + + switch ( ++time_info.hour ) + { + case 5: + weather_info.sunlight = SUN_LIGHT; + strcat( buf, "The day has begun.\n\r" ); + break; + + case 6: + weather_info.sunlight = SUN_RISE; + strcat( buf, "The sun rises in the east.\n\r" ); + break; + + case 19: + weather_info.sunlight = SUN_SET; + strcat( buf, "The sun slowly disappears in the west.\n\r" ); + break; + + case 20: + weather_info.sunlight = SUN_DARK; + strcat( buf, "The night has begun.\n\r" ); + break; + + case 24: + time_info.hour = 0; + time_info.day++; + break; + } + + if ( time_info.day >= 35 ) + { + time_info.day = 0; + time_info.month++; + } + + if ( time_info.month >= 17 ) + { + time_info.month = 0; + time_info.year++; + } + + /* + * Weather change. + */ + if ( time_info.month >= 9 && time_info.month <= 16 ) + diff = weather_info.mmhg > 985 ? -2 : 2; + else + diff = weather_info.mmhg > 1015 ? -2 : 2; + + weather_info.change += diff * dice(1, 4) + dice(2, 6) - dice(2, 6); + weather_info.change = UMAX(weather_info.change, -12); + weather_info.change = UMIN(weather_info.change, 12); + + weather_info.mmhg += weather_info.change; + weather_info.mmhg = UMAX(weather_info.mmhg, 960); + weather_info.mmhg = UMIN(weather_info.mmhg, 1040); + + switch ( weather_info.sky ) + { + default: + bug( "Weather_update: bad sky %d.", weather_info.sky ); + weather_info.sky = SKY_CLOUDLESS; + break; + + case SKY_CLOUDLESS: + if ( weather_info.mmhg < 990 + || ( weather_info.mmhg < 1010 && number_bits( 2 ) == 0 ) ) + { + strcat( buf, "The sky is getting cloudy.\n\r" ); + weather_info.sky = SKY_CLOUDY; + } + break; + + case SKY_CLOUDY: + if ( weather_info.mmhg < 970 + || ( weather_info.mmhg < 990 && number_bits( 2 ) == 0 ) ) + { + strcat( buf, "It starts to rain.\n\r" ); + weather_info.sky = SKY_RAINING; + } + + if ( weather_info.mmhg > 1030 && number_bits( 2 ) == 0 ) + { + strcat( buf, "The clouds disappear.\n\r" ); + weather_info.sky = SKY_CLOUDLESS; + } + break; + + case SKY_RAINING: + if ( weather_info.mmhg < 970 && number_bits( 2 ) == 0 ) + { + strcat( buf, "Lightning flashes in the sky.\n\r" ); + weather_info.sky = SKY_LIGHTNING; + } + + if ( weather_info.mmhg > 1030 + || ( weather_info.mmhg > 1010 && number_bits( 2 ) == 0 ) ) + { + strcat( buf, "The rain stopped.\n\r" ); + weather_info.sky = SKY_CLOUDY; + } + break; + + case SKY_LIGHTNING: + if ( weather_info.mmhg > 1010 + || ( weather_info.mmhg > 990 && number_bits( 2 ) == 0 ) ) + { + strcat( buf, "The lightning has stopped.\n\r" ); + weather_info.sky = SKY_RAINING; + break; + } + break; + } + + if ( buf[0] != '\0' ) + { + for ( d = descriptor_list; d != NULL; d = d->next ) + { + if ( d->connected == CON_PLAYING + && IS_OUTSIDE(d->character) + && IS_AWAKE(d->character) ) + send_to_char( buf, d->character ); + } + } + + return; +} + + + +/* + * Update all chars, including mobs. +*/ +void char_update( void ) +{ + CHAR_DATA *ch; + CHAR_DATA *ch_next; + CHAR_DATA *ch_quit; + + ch_quit = NULL; + + /* update save counter */ + save_number++; + + if (save_number > 29) + save_number = 0; + + for ( ch = char_list; ch != NULL; ch = ch_next ) + { + AFFECT_DATA *paf; + AFFECT_DATA *paf_next; + + ch_next = ch->next; + + if ( ch->timer > 30 ) + ch_quit = ch; + + if ( ch->position >= POS_STUNNED ) + { + /* check to see if we need to go home */ + if (IS_NPC(ch) && ch->zone != NULL && ch->zone != ch->in_room->area + && ch->desc == NULL && ch->fighting == NULL + && !IS_AFFECTED(ch,AFF_CHARM) && number_percent() < 5) + { + act("$n wanders on home.",ch,NULL,NULL,TO_ROOM); + extract_char(ch,TRUE); + continue; + } + + if ( ch->hit < ch->max_hit ) + ch->hit += hit_gain(ch); + else + ch->hit = ch->max_hit; + + if ( ch->mana < ch->max_mana ) + ch->mana += mana_gain(ch); + else + ch->mana = ch->max_mana; + + if ( ch->move < ch->max_move ) + ch->move += move_gain(ch); + else + ch->move = ch->max_move; + } + + if ( ch->position == POS_STUNNED ) + update_pos( ch ); + + if ( !IS_NPC(ch) && ch->level < LEVEL_IMMORTAL ) + { + OBJ_DATA *obj; + + if ( ( obj = get_eq_char( ch, WEAR_LIGHT ) ) != NULL + && obj->item_type == ITEM_LIGHT + && obj->value[2] > 0 ) + { + if ( --obj->value[2] == 0 && ch->in_room != NULL ) + { + --ch->in_room->light; + act( "$p goes out.", ch, obj, NULL, TO_ROOM ); + act( "$p flickers and goes out.", ch, obj, NULL, TO_CHAR ); + extract_obj( obj ); + } + else if ( obj->value[2] <= 5 && ch->in_room != NULL) + act("$p flickers.",ch,obj,NULL,TO_CHAR); + } + + if (IS_IMMORTAL(ch)) + ch->timer = 0; + + if ( ++ch->timer >= 12 ) + { + if ( ch->was_in_room == NULL && ch->in_room != NULL ) + { + ch->was_in_room = ch->in_room; + if ( ch->fighting != NULL ) + stop_fighting( ch, TRUE ); + act( "$n disappears into the void.", + ch, NULL, NULL, TO_ROOM ); + send_to_char( "You disappear into the void.\n\r", ch ); + if (ch->level > 1) + save_char_obj( ch ); + char_from_room( ch ); + char_to_room( ch, get_room_index( ROOM_VNUM_LIMBO ) ); + } + } + + gain_condition( ch, COND_DRUNK, -1 ); + gain_condition( ch, COND_FULL, ch->size > SIZE_MEDIUM ? -4 : -2 ); + gain_condition( ch, COND_THIRST, -1 ); + gain_condition( ch, COND_HUNGER, ch->size > SIZE_MEDIUM ? -2 : -1); + } + + for ( paf = ch->affected; paf != NULL; paf = paf_next ) + { + paf_next = paf->next; + if ( paf->duration > 0 ) + { + paf->duration--; + if (number_range(0,4) == 0 && paf->level > 0) + paf->level--; /* spell strength fades with time */ + } + else if ( paf->duration < 0 ) + ; + else + { + if ( paf_next == NULL + || paf_next->type != paf->type + || paf_next->duration > 0 ) + { + if ( paf->type > 0 && skill_table[paf->type].msg_off ) + { + send_to_char( skill_table[paf->type].msg_off, ch ); + send_to_char( "\n\r", ch ); + } + } + + affect_remove( ch, paf ); + } + } + + /* + * Careful with the damages here, + * MUST NOT refer to ch after damage taken, + * as it may be lethal damage (on NPC). + */ + + if (is_affected(ch, gsn_plague) && ch != NULL) + { + AFFECT_DATA *af, plague; + CHAR_DATA *vch; + int dam; + + if (ch->in_room == NULL) + continue; + + act("$n writhes in agony as plague sores erupt from $s skin.", + ch,NULL,NULL,TO_ROOM); + send_to_char("You writhe in agony from the plague.\n\r",ch); + for ( af = ch->affected; af != NULL; af = af->next ) + { + if (af->type == gsn_plague) + break; + } + + if (af == NULL) + { + REMOVE_BIT(ch->affected_by,AFF_PLAGUE); + continue; + } + + if (af->level == 1) + continue; + + plague.where = TO_AFFECTS; + plague.type = gsn_plague; + plague.level = af->level - 1; + plague.duration = number_range(1,2 * plague.level); + plague.location = APPLY_STR; + plague.modifier = -5; + plague.bitvector = AFF_PLAGUE; + + for ( vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room) + { + if (!saves_spell(plague.level - 2,vch,DAM_DISEASE) + && !IS_IMMORTAL(vch) + && !IS_AFFECTED(vch,AFF_PLAGUE) && number_bits(4) == 0) + { + send_to_char("You feel hot and feverish.\n\r",vch); + act("$n shivers and looks very ill.",vch,NULL,NULL,TO_ROOM); + affect_join(vch,&plague); + } + } + + dam = UMIN(ch->level,af->level/5+1); + ch->mana -= dam; + ch->move -= dam; + damage( ch, ch, dam, gsn_plague,DAM_DISEASE,FALSE); + } + else if ( IS_AFFECTED(ch, AFF_POISON) && ch != NULL + && !IS_AFFECTED(ch,AFF_SLOW)) + + { + AFFECT_DATA *poison; + + poison = affect_find(ch->affected,gsn_poison); + + if (poison != NULL) + { + act( "$n shivers and suffers.", ch, NULL, NULL, TO_ROOM ); + send_to_char( "You shiver and suffer.\n\r", ch ); + damage(ch,ch,poison->level/10 + 1,gsn_poison, + DAM_POISON,FALSE); + } + } + + else if ( ch->position == POS_INCAP && number_range(0,1) == 0) + { + damage( ch, ch, 1, TYPE_UNDEFINED, DAM_NONE,FALSE); + } + else if ( ch->position == POS_MORTAL ) + { + damage( ch, ch, 1, TYPE_UNDEFINED, DAM_NONE,FALSE); + } + } + + /* + * Autosave and autoquit. + * Check that these chars still exist. + */ + for ( ch = char_list; ch != NULL; ch = ch_next ) + { + ch_next = ch->next; + + if (ch->desc != NULL && ch->desc->descriptor % 30 == save_number) + { + save_char_obj(ch); + } + + if (ch == ch_quit) + { + do_function(ch, &do_quit, "" ); + } + } + + return; +} + + + + +/* + * Update all objs. + * This function is performance sensitive. + */ +void obj_update( void ) +{ + OBJ_DATA *obj; + OBJ_DATA *obj_next; + AFFECT_DATA *paf, *paf_next; + + for ( obj = object_list; obj != NULL; obj = obj_next ) + { + CHAR_DATA *rch; + char *message; + + obj_next = obj->next; + + /* go through affects and decrement */ + for ( paf = obj->affected; paf != NULL; paf = paf_next ) + { + paf_next = paf->next; + if ( paf->duration > 0 ) + { + paf->duration--; + if (number_range(0,4) == 0 && paf->level > 0) + paf->level--; /* spell strength fades with time */ + } + else if ( paf->duration < 0 ) + ; + else + { + if ( paf_next == NULL + || paf_next->type != paf->type + || paf_next->duration > 0 ) + { + if ( paf->type > 0 && skill_table[paf->type].msg_obj ) + { + if (obj->carried_by != NULL) + { + rch = obj->carried_by; + act(skill_table[paf->type].msg_obj, + rch,obj,NULL,TO_CHAR); + } + if (obj->in_room != NULL + && obj->in_room->people != NULL) + { + rch = obj->in_room->people; + act(skill_table[paf->type].msg_obj, + rch,obj,NULL,TO_ALL); + } + } + } + + affect_remove_obj( obj, paf ); + } + } + + + if ( obj->timer <= 0 || --obj->timer > 0 ) + continue; + + switch ( obj->item_type ) + { + default: message = "$p crumbles into dust."; break; + case ITEM_FOUNTAIN: message = "$p dries up."; break; + case ITEM_CORPSE_NPC: message = "$p decays into dust."; break; + case ITEM_CORPSE_PC: message = "$p decays into dust."; break; + case ITEM_FOOD: message = "$p decomposes."; break; + case ITEM_POTION: message = "$p has evaporated from disuse."; + break; + case ITEM_PORTAL: message = "$p fades out of existence."; break; + case ITEM_CONTAINER: + if (CAN_WEAR(obj,ITEM_WEAR_FLOAT)) + if (obj->contains) + message = + "$p flickers and vanishes, spilling its contents on the floor."; + else + message = "$p flickers and vanishes."; + else + message = "$p crumbles into dust."; + break; + } + + if ( obj->carried_by != NULL ) + { + if (IS_NPC(obj->carried_by) + && obj->carried_by->pIndexData->pShop != NULL) + obj->carried_by->silver += obj->cost/5; + else + { + act( message, obj->carried_by, obj, NULL, TO_CHAR ); + if ( obj->wear_loc == WEAR_FLOAT) + act(message,obj->carried_by,obj,NULL,TO_ROOM); + } + } + else if ( obj->in_room != NULL + && ( rch = obj->in_room->people ) != NULL ) + { + if (! (obj->in_obj && obj->in_obj->pIndexData->vnum == OBJ_VNUM_PIT + && !CAN_WEAR(obj->in_obj,ITEM_TAKE))) + { + act( message, rch, obj, NULL, TO_ROOM ); + act( message, rch, obj, NULL, TO_CHAR ); + } + } + + if ((obj->item_type == ITEM_CORPSE_PC || obj->wear_loc == WEAR_FLOAT) + && obj->contains) + { /* save the contents */ + OBJ_DATA *t_obj, *next_obj; + + for (t_obj = obj->contains; t_obj != NULL; t_obj = next_obj) + { + next_obj = t_obj->next_content; + obj_from_obj(t_obj); + + if (obj->in_obj) /* in another object */ + obj_to_obj(t_obj,obj->in_obj); + + else if (obj->carried_by) /* carried */ + if (obj->wear_loc == WEAR_FLOAT) + if (obj->carried_by->in_room == NULL) + extract_obj(t_obj); + else + obj_to_room(t_obj,obj->carried_by->in_room); + else + obj_to_char(t_obj,obj->carried_by); + + else if (obj->in_room == NULL) /* destroy it */ + extract_obj(t_obj); + + else /* to a room */ + obj_to_room(t_obj,obj->in_room); + } + } + + extract_obj( obj ); + } + + return; +} + + + +/* + * Aggress. + * + * for each mortal PC + * for each mob in room + * aggress on some random PC + * + * This function takes 25% to 35% of ALL Merc cpu time. + * Unfortunately, checking on each PC move is too tricky, + * because we don't the mob to just attack the first PC + * who leads the party into the room. + * + * -- Furey + */ +void aggr_update( void ) +{ + CHAR_DATA *wch; + CHAR_DATA *wch_next; + CHAR_DATA *ch; + CHAR_DATA *ch_next; + CHAR_DATA *vch; + CHAR_DATA *vch_next; + CHAR_DATA *victim; + + for ( wch = char_list; wch != NULL; wch = wch_next ) + { + wch_next = wch->next; + if ( IS_NPC(wch) + || wch->level >= LEVEL_IMMORTAL + || wch->in_room == NULL + || wch->in_room->area->empty) + continue; + + for ( ch = wch->in_room->people; ch != NULL; ch = ch_next ) + { + int count; + + ch_next = ch->next_in_room; + + if ( !IS_NPC(ch) + || !IS_SET(ch->act, ACT_AGGRESSIVE) + || IS_SET(ch->in_room->room_flags,ROOM_SAFE) + || IS_AFFECTED(ch,AFF_CALM) + || ch->fighting != NULL + || IS_AFFECTED(ch, AFF_CHARM) + || !IS_AWAKE(ch) + || ( IS_SET(ch->act, ACT_WIMPY) && IS_AWAKE(wch) ) + || !can_see( ch, wch ) + || number_bits(1) == 0) + continue; + + /* + * Ok we have a 'wch' player character and a 'ch' npc aggressor. + * Now make the aggressor fight a RANDOM pc victim in the room, + * giving each 'vch' an equal chance of selection. + */ + count = 0; + victim = NULL; + for ( vch = wch->in_room->people; vch != NULL; vch = vch_next ) + { + vch_next = vch->next_in_room; + + if ( !IS_NPC(vch) + && vch->level < LEVEL_IMMORTAL + && ch->level >= vch->level - 5 + && ( !IS_SET(ch->act, ACT_WIMPY) || !IS_AWAKE(vch) ) + && can_see( ch, vch ) ) + { + if ( number_range( 0, count ) == 0 ) + victim = vch; + count++; + } + } + + if ( victim == NULL ) + continue; + + multi_hit( ch, victim, TYPE_UNDEFINED ); + } + } + + return; +} + + + +/* + * Handle all kinds of updates. + * Called once per pulse from game loop. + * Random times to defeat tick-timing clients and players. + */ + +void update_handler( void ) +{ + static int pulse_area; + static int pulse_mobile; + static int pulse_violence; + static int pulse_point; + static int pulse_music; + + if ( --pulse_area <= 0 ) + { + pulse_area = PULSE_AREA; + /* number_range( PULSE_AREA / 2, 3 * PULSE_AREA / 2 ); */ + area_update ( ); + } + + if ( --pulse_music <= 0 ) + { + pulse_music = PULSE_MUSIC; + song_update(); + } + + if ( --pulse_mobile <= 0 ) + { + pulse_mobile = PULSE_MOBILE; + mobile_update ( ); + } + + if ( --pulse_violence <= 0 ) + { + pulse_violence = PULSE_VIOLENCE; + violence_update ( ); + } + + if ( --pulse_point <= 0 ) + { + wiznet("TICK!",NULL,NULL,WIZ_TICKS,0,0); + pulse_point = PULSE_TICK; +/* number_range( PULSE_TICK / 2, 3 * PULSE_TICK / 2 ); */ + weather_update ( ); + char_update ( ); + obj_update ( ); + } + + aggr_update( ); + tail_chain( ); + return; +} From 755291e7ed0947bc02b974bead474dad372438be Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Tue, 30 Nov 2021 23:21:23 -0800 Subject: [PATCH 05/40] Restructuring and updated logging call --- Rom24/data/act_flags.json | 112 -- Rom24/data/affect_flags.json | 147 --- Rom24/data/attack_table.json | 202 ---- Rom24/data/clan_table.json | 20 - Rom24/data/comm_flags.json | 117 --- Rom24/data/con_app.json | 106 -- Rom24/data/dex_app.json | 80 -- Rom24/data/exit_flags.json | 52 - Rom24/data/form_flags.json | 132 --- Rom24/data/group_table.json | 457 -------- Rom24/data/guild_table.json | 74 -- Rom24/data/imm_flags.json | 117 --- Rom24/data/int_app.json | 80 -- Rom24/data/liq_table.json | 326 ------ Rom24/data/off_flags.json | 107 -- Rom24/data/part_flags.json | 112 -- Rom24/data/pc_race_table.json | 120 --- Rom24/data/plr_flags.json | 87 -- Rom24/data/position_table.json | 38 - Rom24/data/race_table.json | 350 ------- Rom24/data/sex_table.json | 5 - Rom24/data/size_table.json | 8 - Rom24/data/skill_table.json | 952 ----------------- Rom24/data/str_app.json | 158 --- Rom24/data/title_table.json | 986 ------------------ Rom24/data/weapon_table.json | 50 - Rom24/data/wis_app.json | 80 -- Rom24/data/wiznet_table.json | 102 -- {Rom24 => archive}/README | 0 {Rom24 => archive}/README.rom | 0 {Rom24 => archive}/README.version | 0 {Rom24 => archive}/src/Makefile | 0 {Rom24 => archive}/src/Makefile.linux | 0 {Rom24 => archive}/src/Makefile.normal | 0 {Rom24 => archive}/src/Makefile.solaris | 0 {Rom24 => archive}/src/act_comm.c | 0 {Rom24 => archive}/src/act_enter.c | 0 {Rom24 => archive}/src/act_info.c | 0 {Rom24 => archive}/src/act_move.c | 0 {Rom24 => archive}/src/act_obj.c | 0 {Rom24 => archive}/src/act_wiz.c | 0 {Rom24 => archive}/src/alias.c | 0 {Rom24 => archive}/src/ban.c | 0 {Rom24 => archive}/src/comm.c | 0 {Rom24 => archive}/src/const.c | 0 {Rom24 => archive}/src/db.c | 0 {Rom24 => archive}/src/db.h | 0 {Rom24 => archive}/src/db2.c | 0 {Rom24 => archive}/src/effects.c | 0 {Rom24 => archive}/src/fight.c | 0 {Rom24 => archive}/src/flags.c | 0 {Rom24 => archive}/src/handler.c | 0 {Rom24 => archive}/src/healer.c | 0 {Rom24 => archive}/src/interp.c | 0 {Rom24 => archive}/src/interp.h | 0 {Rom24 => archive}/src/lookup.c | 0 {Rom24 => archive}/src/lookup.h | 0 {Rom24 => archive}/src/magic.c | 0 {Rom24 => archive}/src/magic.h | 0 {Rom24 => archive}/src/magic2.c | 0 {Rom24 => archive}/src/merc.h | 0 {Rom24 => archive}/src/music.c | 0 {Rom24 => archive}/src/music.h | 0 {Rom24 => archive}/src/note.c | 0 {Rom24 => archive}/src/recycle.c | 0 {Rom24 => archive}/src/recycle.h | 0 {Rom24 => archive}/src/save.c | 0 {Rom24 => archive}/src/scan.c | 0 {Rom24 => archive}/src/skills.c | 0 {Rom24 => archive}/src/special.c | 0 {Rom24 => archive}/src/tables.c | 0 {Rom24 => archive}/src/tables.h | 0 {Rom24 => archive}/src/telnet.h | 0 {Rom24 => archive}/src/update.c | 0 {Rom24/area => area}/air.are | 0 {Rom24/area => area}/arachnos.are | 0 {Rom24/area => area}/area.lst | 0 {Rom24/area => area}/astral.are | 0 {Rom24/area => area}/canyon.are | 0 {Rom24/area => area}/catacomb.are | 0 {Rom24/area => area}/chapel.are | 0 {Rom24/area => area}/daycare.are | 0 {Rom24/area => area}/draconia.are | 0 {Rom24/area => area}/dream.are | 0 {Rom24/area => area}/drow.are | 0 {Rom24/area => area}/dwarven.are | 0 {Rom24/area => area}/dylan.are | 0 {Rom24/area => area}/eastern.are | 0 {Rom24/area => area}/galaxy.are | 0 {Rom24/area => area}/gnome.are | 0 {Rom24/area => area}/grave.are | 0 {Rom24/area => area}/group.are | 0 {Rom24/area => area}/grove.are | 0 {Rom24/area => area}/haon.are | 0 {Rom24/area => area}/help.are | 0 {Rom24/area => area}/hitower.are | 0 {Rom24/area => area}/hood.are | 0 {Rom24/area => area}/immort.are | 0 {Rom24/area => area}/limbo.are | 0 {Rom24/area => area}/mahntor.are | 0 {Rom24/area => area}/marsh.are | 0 {Rom24/area => area}/mega1.are | 0 {Rom24/area => area}/midennir.are | 0 {Rom24/area => area}/midgaard.are | 0 {Rom24/area => area}/mirror.are | 0 {Rom24/area => area}/mobfact.are | 0 {Rom24/area => area}/moria.are | 0 {Rom24/area => area}/music.txt | 0 {Rom24/area => area}/newthalos.are | 0 {Rom24/area => area}/nirvana.are | 0 {Rom24/area => area}/ofcol.are | 0 {Rom24/area => area}/ofcol2.are | 0 {Rom24/area => area}/olympus.are | 0 {Rom24/area => area}/plains.are | 0 {Rom24/area => area}/proto.are | 0 {Rom24/area => area}/pyramid.are | 0 {Rom24/area => area}/quifael.are | 0 {Rom24/area => area}/redferne.are | 0 {Rom24/area => area}/rom.are | 0 {Rom24/area => area}/school.are | 0 {Rom24/area => area}/sewer.are | 0 {Rom24/area => area}/shire.are | 0 {Rom24/area => area}/smurf.are | 0 {Rom24/area => area}/social.are | 0 {Rom24/area => area}/startup | 0 {Rom24/area => area}/thalos.are | 0 {Rom24/area => area}/tohell.are | 0 {Rom24/area => area}/trollden.are | 0 {Rom24/area => area}/valley.are | 0 {Rom24/area => area}/wyvern.are | 0 {Rom24/doc => doc}/Rom2.4.doc | 0 {Rom24/doc => doc}/act.txt | 0 {Rom24/doc => doc}/area.txt | 0 {Rom24/doc => doc}/class.txt | 0 {Rom24/doc => doc}/command.txt | 0 {Rom24/doc => doc}/contrib.txt | 0 {Rom24/doc => doc}/drool.txt | 0 {Rom24/doc => doc}/equipment-system | 0 {Rom24/doc => doc}/hacker.txt | 0 {Rom24/doc => doc}/license.doc | 0 {Rom24/doc => doc}/license.txt | 0 {Rom24/doc => doc}/memory.txt | 0 {Rom24/doc => doc}/new.txt | 0 {Rom24/doc => doc}/pfile.txt | 0 {Rom24/doc => doc}/port.txt | 0 {Rom24/doc => doc}/pyTiming.txt | 0 {Rom24/doc => doc}/rom.credits | 0 {Rom24/doc => doc}/rom.license | 0 {Rom24/doc => doc}/security.txt | 0 {Rom24/doc => doc}/sites.txt | 0 {Rom24/doc => doc}/skill.txt | 0 {Rom24/doc => doc}/sky.txt | 0 {Rom24/doc => doc}/trad.txt | 0 {Rom24/doc => doc}/vnum.txt | 0 {Rom24/projects => projects}/todo | 0 requirements.txt | 1 + {Rom24/pysrc => src}/CONCEPTS | 0 {Rom24/pysrc => src}/affects.py | 0 {Rom24/pysrc => src}/auth.py | 2 +- {Rom24/pysrc => src}/bit.py | 2 +- {Rom24/pysrc => src}/comm.py | 2 +- {Rom24/pysrc => src}/commands/__init__.py | 0 {Rom24/pysrc => src}/commands/do_advance.py | 2 +- {Rom24/pysrc => src}/commands/do_affects.py | 2 +- {Rom24/pysrc => src}/commands/do_afk.py | 2 +- {Rom24/pysrc => src}/commands/do_alias.py | 2 +- {Rom24/pysrc => src}/commands/do_answer.py | 2 +- {Rom24/pysrc => src}/commands/do_apickle.py | 2 +- {Rom24/pysrc => src}/commands/do_areas.py | 2 +- {Rom24/pysrc => src}/commands/do_at.py | 2 +- {Rom24/pysrc => src}/commands/do_auction.py | 2 +- .../commands/do_authenticator.py | 2 +- .../pysrc => src}/commands/do_autoassist.py | 2 +- {Rom24/pysrc => src}/commands/do_autoexit.py | 2 +- {Rom24/pysrc => src}/commands/do_autogold.py | 2 +- {Rom24/pysrc => src}/commands/do_autolist.py | 2 +- {Rom24/pysrc => src}/commands/do_autoloot.py | 2 +- {Rom24/pysrc => src}/commands/do_autosac.py | 2 +- {Rom24/pysrc => src}/commands/do_autosplit.py | 2 +- {Rom24/pysrc => src}/commands/do_backstab.py | 2 +- {Rom24/pysrc => src}/commands/do_bamfin.py | 2 +- {Rom24/pysrc => src}/commands/do_bamfout.py | 2 +- {Rom24/pysrc => src}/commands/do_bash.py | 2 +- {Rom24/pysrc => src}/commands/do_berserk.py | 2 +- {Rom24/pysrc => src}/commands/do_brandish.py | 2 +- {Rom24/pysrc => src}/commands/do_brief.py | 2 +- {Rom24/pysrc => src}/commands/do_bug.py | 2 +- {Rom24/pysrc => src}/commands/do_buy.py | 2 +- {Rom24/pysrc => src}/commands/do_cast.py | 2 +- {Rom24/pysrc => src}/commands/do_channels.py | 2 +- {Rom24/pysrc => src}/commands/do_clantalk.py | 2 +- {Rom24/pysrc => src}/commands/do_clone.py | 2 +- {Rom24/pysrc => src}/commands/do_close.py | 2 +- {Rom24/pysrc => src}/commands/do_combine.py | 2 +- {Rom24/pysrc => src}/commands/do_commands.py | 2 +- {Rom24/pysrc => src}/commands/do_compact.py | 2 +- {Rom24/pysrc => src}/commands/do_compare.py | 2 +- {Rom24/pysrc => src}/commands/do_consider.py | 2 +- {Rom24/pysrc => src}/commands/do_count.py | 2 +- {Rom24/pysrc => src}/commands/do_deaf.py | 2 +- {Rom24/pysrc => src}/commands/do_debug.py | 2 +- {Rom24/pysrc => src}/commands/do_delete.py | 2 +- {Rom24/pysrc => src}/commands/do_deny.py | 2 +- .../pysrc => src}/commands/do_description.py | 2 +- {Rom24/pysrc => src}/commands/do_dirt.py | 2 +- {Rom24/pysrc => src}/commands/do_disarm.py | 2 +- .../pysrc => src}/commands/do_disconnect.py | 2 +- {Rom24/pysrc => src}/commands/do_down.py | 2 +- {Rom24/pysrc => src}/commands/do_drink.py | 2 +- {Rom24/pysrc => src}/commands/do_drop.py | 2 +- {Rom24/pysrc => src}/commands/do_dump.py | 2 +- {Rom24/pysrc => src}/commands/do_east.py | 2 +- {Rom24/pysrc => src}/commands/do_eat.py | 2 +- {Rom24/pysrc => src}/commands/do_echo.py | 2 +- {Rom24/pysrc => src}/commands/do_emote.py | 2 +- {Rom24/pysrc => src}/commands/do_enter.py | 2 +- {Rom24/pysrc => src}/commands/do_envenom.py | 2 +- {Rom24/pysrc => src}/commands/do_equipment.py | 2 +- {Rom24/pysrc => src}/commands/do_examine.py | 2 +- {Rom24/pysrc => src}/commands/do_exits.py | 2 +- {Rom24/pysrc => src}/commands/do_fill.py | 2 +- {Rom24/pysrc => src}/commands/do_flags.py | 2 +- {Rom24/pysrc => src}/commands/do_flee.py | 2 +- {Rom24/pysrc => src}/commands/do_follow.py | 2 +- {Rom24/pysrc => src}/commands/do_force.py | 2 +- {Rom24/pysrc => src}/commands/do_freeze.py | 2 +- {Rom24/pysrc => src}/commands/do_freset.py | 2 +- {Rom24/pysrc => src}/commands/do_gain.py | 2 +- {Rom24/pysrc => src}/commands/do_gdstate.py | 2 +- {Rom24/pysrc => src}/commands/do_get.py | 2 +- {Rom24/pysrc => src}/commands/do_give.py | 2 +- {Rom24/pysrc => src}/commands/do_gossip.py | 2 +- {Rom24/pysrc => src}/commands/do_goto.py | 2 +- {Rom24/pysrc => src}/commands/do_grats.py | 2 +- {Rom24/pysrc => src}/commands/do_group.py | 2 +- {Rom24/pysrc => src}/commands/do_groups.py | 2 +- {Rom24/pysrc => src}/commands/do_gtell.py | 2 +- {Rom24/pysrc => src}/commands/do_guild.py | 2 +- {Rom24/pysrc => src}/commands/do_heal.py | 2 +- {Rom24/pysrc => src}/commands/do_help.py | 2 +- {Rom24/pysrc => src}/commands/do_hide.py | 2 +- {Rom24/pysrc => src}/commands/do_holylight.py | 2 +- {Rom24/pysrc => src}/commands/do_immtalk.py | 2 +- {Rom24/pysrc => src}/commands/do_incognito.py | 2 +- {Rom24/pysrc => src}/commands/do_inventory.py | 2 +- {Rom24/pysrc => src}/commands/do_invis.py | 2 +- {Rom24/pysrc => src}/commands/do_kick.py | 2 +- {Rom24/pysrc => src}/commands/do_kill.py | 2 +- {Rom24/pysrc => src}/commands/do_list.py | 2 +- {Rom24/pysrc => src}/commands/do_load.py | 2 +- {Rom24/pysrc => src}/commands/do_lock.py | 2 +- {Rom24/pysrc => src}/commands/do_log.py | 2 +- {Rom24/pysrc => src}/commands/do_look.py | 2 +- {Rom24/pysrc => src}/commands/do_memory.py | 2 +- {Rom24/pysrc => src}/commands/do_mfind.py | 2 +- {Rom24/pysrc => src}/commands/do_mload.py | 2 +- {Rom24/pysrc => src}/commands/do_mset.py | 2 +- {Rom24/pysrc => src}/commands/do_mstat.py | 2 +- {Rom24/pysrc => src}/commands/do_murder.py | 2 +- {Rom24/pysrc => src}/commands/do_music.py | 2 +- {Rom24/pysrc => src}/commands/do_mwhere.py | 2 +- {Rom24/pysrc => src}/commands/do_newlock.py | 2 +- .../pysrc => src}/commands/do_nochannels.py | 2 +- {Rom24/pysrc => src}/commands/do_noemote.py | 2 +- {Rom24/pysrc => src}/commands/do_nofollow.py | 2 +- {Rom24/pysrc => src}/commands/do_noloot.py | 2 +- {Rom24/pysrc => src}/commands/do_north.py | 2 +- {Rom24/pysrc => src}/commands/do_noshout.py | 2 +- {Rom24/pysrc => src}/commands/do_nosummon.py | 2 +- {Rom24/pysrc => src}/commands/do_notell.py | 2 +- {Rom24/pysrc => src}/commands/do_ofind.py | 2 +- {Rom24/pysrc => src}/commands/do_oload.py | 2 +- {Rom24/pysrc => src}/commands/do_omni.py | 2 +- {Rom24/pysrc => src}/commands/do_open.py | 2 +- {Rom24/pysrc => src}/commands/do_order.py | 2 +- {Rom24/pysrc => src}/commands/do_oset.py | 2 +- {Rom24/pysrc => src}/commands/do_ostat.py | 2 +- {Rom24/pysrc => src}/commands/do_outfit.py | 2 +- {Rom24/pysrc => src}/commands/do_owhere.py | 2 +- {Rom24/pysrc => src}/commands/do_pardon.py | 2 +- {Rom24/pysrc => src}/commands/do_password.py | 2 +- {Rom24/pysrc => src}/commands/do_peace.py | 2 +- {Rom24/pysrc => src}/commands/do_pecho.py | 2 +- {Rom24/pysrc => src}/commands/do_pick.py | 2 +- {Rom24/pysrc => src}/commands/do_pmote.py | 2 +- {Rom24/pysrc => src}/commands/do_pose.py | 2 +- {Rom24/pysrc => src}/commands/do_pour.py | 2 +- {Rom24/pysrc => src}/commands/do_practice.py | 2 +- {Rom24/pysrc => src}/commands/do_prefix.py | 2 +- {Rom24/pysrc => src}/commands/do_prompt.py | 2 +- {Rom24/pysrc => src}/commands/do_protect.py | 2 +- {Rom24/pysrc => src}/commands/do_purge.py | 2 +- {Rom24/pysrc => src}/commands/do_put.py | 2 +- {Rom24/pysrc => src}/commands/do_quaff.py | 2 +- {Rom24/pysrc => src}/commands/do_question.py | 2 +- {Rom24/pysrc => src}/commands/do_quiet.py | 2 +- {Rom24/pysrc => src}/commands/do_quit.py | 2 +- {Rom24/pysrc => src}/commands/do_quote.py | 2 +- {Rom24/pysrc => src}/commands/do_reboot.py | 2 +- {Rom24/pysrc => src}/commands/do_recall.py | 2 +- {Rom24/pysrc => src}/commands/do_recho.py | 2 +- {Rom24/pysrc => src}/commands/do_recite.py | 2 +- {Rom24/pysrc => src}/commands/do_reload.py | 2 +- {Rom24/pysrc => src}/commands/do_remove.py | 2 +- {Rom24/pysrc => src}/commands/do_rent.py | 2 +- {Rom24/pysrc => src}/commands/do_replay.py | 2 +- {Rom24/pysrc => src}/commands/do_reply.py | 2 +- {Rom24/pysrc => src}/commands/do_report.py | 2 +- {Rom24/pysrc => src}/commands/do_rescue.py | 2 +- {Rom24/pysrc => src}/commands/do_rest.py | 2 +- {Rom24/pysrc => src}/commands/do_restore.py | 2 +- {Rom24/pysrc => src}/commands/do_return.py | 2 +- {Rom24/pysrc => src}/commands/do_rstat.py | 2 +- {Rom24/pysrc => src}/commands/do_sacrifice.py | 2 +- {Rom24/pysrc => src}/commands/do_save.py | 2 +- {Rom24/pysrc => src}/commands/do_say.py | 2 +- {Rom24/pysrc => src}/commands/do_score.py | 2 +- {Rom24/pysrc => src}/commands/do_scroll.py | 2 +- {Rom24/pysrc => src}/commands/do_sell.py | 2 +- {Rom24/pysrc => src}/commands/do_set.py | 2 +- {Rom24/pysrc => src}/commands/do_shout.py | 2 +- {Rom24/pysrc => src}/commands/do_show.py | 2 +- {Rom24/pysrc => src}/commands/do_shutdown.py | 2 +- {Rom24/pysrc => src}/commands/do_sit.py | 2 +- {Rom24/pysrc => src}/commands/do_skills.py | 2 +- {Rom24/pysrc => src}/commands/do_slay.py | 2 +- {Rom24/pysrc => src}/commands/do_sleep.py | 2 +- {Rom24/pysrc => src}/commands/do_slookup.py | 2 +- {Rom24/pysrc => src}/commands/do_smote.py | 2 +- {Rom24/pysrc => src}/commands/do_sneak.py | 2 +- {Rom24/pysrc => src}/commands/do_snoop.py | 2 +- {Rom24/pysrc => src}/commands/do_socials.py | 2 +- {Rom24/pysrc => src}/commands/do_sockets.py | 2 +- {Rom24/pysrc => src}/commands/do_south.py | 2 +- {Rom24/pysrc => src}/commands/do_spells.py | 2 +- {Rom24/pysrc => src}/commands/do_split.py | 2 +- {Rom24/pysrc => src}/commands/do_sset.py | 2 +- {Rom24/pysrc => src}/commands/do_stand.py | 2 +- {Rom24/pysrc => src}/commands/do_stat.py | 2 +- {Rom24/pysrc => src}/commands/do_steal.py | 2 +- {Rom24/pysrc => src}/commands/do_string.py | 2 +- {Rom24/pysrc => src}/commands/do_switch.py | 2 +- {Rom24/pysrc => src}/commands/do_tabledump.py | 2 +- {Rom24/pysrc => src}/commands/do_tableload.py | 2 +- {Rom24/pysrc => src}/commands/do_tell.py | 2 +- {Rom24/pysrc => src}/commands/do_term.py | 2 +- {Rom24/pysrc => src}/commands/do_time.py | 2 +- {Rom24/pysrc => src}/commands/do_title.py | 2 +- {Rom24/pysrc => src}/commands/do_train.py | 2 +- {Rom24/pysrc => src}/commands/do_transfer.py | 2 +- {Rom24/pysrc => src}/commands/do_trip.py | 2 +- {Rom24/pysrc => src}/commands/do_trust.py | 2 +- {Rom24/pysrc => src}/commands/do_typo.py | 2 +- {Rom24/pysrc => src}/commands/do_unalias.py | 2 +- {Rom24/pysrc => src}/commands/do_unlock.py | 2 +- {Rom24/pysrc => src}/commands/do_up.py | 2 +- {Rom24/pysrc => src}/commands/do_value.py | 2 +- {Rom24/pysrc => src}/commands/do_violate.py | 2 +- {Rom24/pysrc => src}/commands/do_visible.py | 2 +- {Rom24/pysrc => src}/commands/do_vnum.py | 2 +- {Rom24/pysrc => src}/commands/do_wake.py | 2 +- {Rom24/pysrc => src}/commands/do_wear.py | 2 +- {Rom24/pysrc => src}/commands/do_weather.py | 2 +- {Rom24/pysrc => src}/commands/do_west.py | 2 +- {Rom24/pysrc => src}/commands/do_where.py | 2 +- {Rom24/pysrc => src}/commands/do_who.py | 2 +- {Rom24/pysrc => src}/commands/do_whois.py | 2 +- {Rom24/pysrc => src}/commands/do_wimpy.py | 2 +- {Rom24/pysrc => src}/commands/do_wizhelp.py | 2 +- {Rom24/pysrc => src}/commands/do_wizlock.py | 2 +- {Rom24/pysrc => src}/commands/do_wiznet.py | 2 +- {Rom24/pysrc => src}/commands/do_worth.py | 2 +- {Rom24/pysrc => src}/commands/do_yell.py | 2 +- {Rom24/pysrc => src}/commands/do_zap.py | 2 +- {Rom24/pysrc => src}/commands/do_zecho.py | 2 +- {Rom24/pysrc => src}/const.py | 2 +- {Rom24/pysrc => src}/data_loader.py | 2 +- {Rom24/pysrc => src}/database/__init__.py | 0 .../pysrc => src}/database/read/__init__.py | 0 .../database/read/read_tables.py | 2 +- {Rom24/pysrc => src}/database/tracker.py | 0 .../pysrc => src}/database/write/__init__.py | 0 .../database/write/write_tables.py | 2 +- {Rom24/pysrc => src}/db.py | 2 +- {Rom24/pysrc => src}/effects.py | 2 +- {Rom24/pysrc => src}/environment.py | 2 +- {Rom24/pysrc => src}/equipment.py | 2 +- {Rom24/pysrc => src}/fight.py | 2 +- {Rom24/pysrc => src}/game_utils.py | 2 +- {Rom24/pysrc => src}/handler_ch.py | 2 +- {Rom24/pysrc => src}/handler_game.py | 2 +- {Rom24/pysrc => src}/handler_item.py | 2 +- {Rom24/pysrc => src}/handler_log.py | 2 +- {Rom24/pysrc => src}/handler_magic.py | 2 +- {Rom24/pysrc => src}/handler_npc.py | 2 +- {Rom24/pysrc => src}/handler_pc.py | 2 +- {Rom24/pysrc => src}/handler_room.py | 2 +- {Rom24/pysrc => src}/hotfix.py | 2 +- {Rom24/pysrc => src}/immortal.py | 2 +- {Rom24/pysrc => src}/instance.py | 2 +- {Rom24/pysrc => src}/interp.py | 2 +- {Rom24/pysrc => src}/inventory.py | 2 +- {Rom24/pysrc => src}/item_flags.py | 2 +- {Rom24/pysrc => src}/living.py | 2 +- {Rom24/pysrc => src}/magic.py | 0 {Rom24/pysrc => src}/merc.py | 2 +- {Rom24/pysrc => src}/miniboa/LICENSE.TXT | 0 {Rom24/pysrc => src}/miniboa/README.TXT | 0 {Rom24/pysrc => src}/miniboa/__init__.py | 0 {Rom24/pysrc => src}/miniboa/asyncio.py | 2 +- {Rom24/pysrc => src}/miniboa/colors.py | 2 +- {Rom24/pysrc => src}/miniboa/telnet.py | 2 +- {Rom24/pysrc => src}/miniboa/terminal.py | 2 +- {Rom24/pysrc => src}/nanny.py | 2 +- {Rom24/pysrc => src}/object_creator.py | 2 +- {Rom24/pysrc => src}/physical.py | 2 +- {Rom24/pysrc => src}/pyom.py | 2 +- {Rom24/pysrc => src}/pyprogs.py | 2 +- {Rom24/pysrc => src}/save.py | 2 +- {Rom24/pysrc => src}/settings.py | 2 +- {Rom24/pysrc => src}/shell.py | 2 +- {Rom24/pysrc => src}/shop_utils.py | 2 +- {Rom24/pysrc => src}/skills.py | 2 +- {Rom24/pysrc => src}/special.py | 2 +- {Rom24/pysrc => src}/spells/__init__.py | 0 .../pysrc => src}/spells/spell_acid_blast.py | 0 .../pysrc => src}/spells/spell_acid_breath.py | 0 {Rom24/pysrc => src}/spells/spell_armor.py | 0 {Rom24/pysrc => src}/spells/spell_bless.py | 0 .../pysrc => src}/spells/spell_blindness.py | 0 .../spells/spell_burning_hands.py | 0 .../spells/spell_call_lightning.py | 0 {Rom24/pysrc => src}/spells/spell_calm.py | 0 .../spells/spell_cancellation.py | 0 .../spells/spell_cause_critical.py | 0 .../pysrc => src}/spells/spell_cause_light.py | 0 .../spells/spell_cause_serious.py | 0 .../spells/spell_chain_lightning.py | 0 .../pysrc => src}/spells/spell_change_sex.py | 0 .../spells/spell_charm_person.py | 0 .../pysrc => src}/spells/spell_chill_touch.py | 0 .../spells/spell_colour_spray.py | 0 .../spells/spell_continual_light.py | 0 .../spells/spell_control_weather.py | 0 .../pysrc => src}/spells/spell_create_food.py | 0 .../pysrc => src}/spells/spell_create_rose.py | 0 .../spells/spell_create_spring.py | 0 .../spells/spell_create_water.py | 0 .../spells/spell_cure_blindness.py | 0 .../spells/spell_cure_critical.py | 0 .../spells/spell_cure_disease.py | 0 .../pysrc => src}/spells/spell_cure_light.py | 0 .../pysrc => src}/spells/spell_cure_poison.py | 0 .../spells/spell_cure_serious.py | 0 {Rom24/pysrc => src}/spells/spell_curse.py | 0 .../pysrc => src}/spells/spell_demonfire.py | 0 .../pysrc => src}/spells/spell_detect_evil.py | 0 .../pysrc => src}/spells/spell_detect_good.py | 0 .../spells/spell_detect_hidden.py | 0 .../spells/spell_detect_invis.py | 0 .../spells/spell_detect_magic.py | 0 .../spells/spell_detect_poison.py | 0 .../pysrc => src}/spells/spell_dispel_evil.py | 0 .../pysrc => src}/spells/spell_dispel_good.py | 0 .../spells/spell_dispel_magic.py | 0 .../pysrc => src}/spells/spell_earthquake.py | 0 .../spells/spell_enchant_armor.py | 0 .../spells/spell_enchant_weapon.py | 0 .../spells/spell_energy_drain.py | 0 .../pysrc => src}/spells/spell_faerie_fire.py | 0 .../pysrc => src}/spells/spell_faerie_fog.py | 0 {Rom24/pysrc => src}/spells/spell_farsight.py | 0 .../pysrc => src}/spells/spell_fire_breath.py | 0 {Rom24/pysrc => src}/spells/spell_fireball.py | 0 .../pysrc => src}/spells/spell_fireproof.py | 0 .../pysrc => src}/spells/spell_flamestrike.py | 0 .../spells/spell_floating_disc.py | 0 {Rom24/pysrc => src}/spells/spell_fly.py | 0 {Rom24/pysrc => src}/spells/spell_frenzy.py | 0 .../spells/spell_frost_breath.py | 0 .../pysrc => src}/spells/spell_gas_breath.py | 0 {Rom24/pysrc => src}/spells/spell_gate.py | 0 .../spells/spell_general_purpose.py | 0 .../spells/spell_giant_strength.py | 0 {Rom24/pysrc => src}/spells/spell_harm.py | 0 {Rom24/pysrc => src}/spells/spell_haste.py | 0 {Rom24/pysrc => src}/spells/spell_heal.py | 0 .../pysrc => src}/spells/spell_heat_metal.py | 0 .../spells/spell_high_explosive.py | 0 .../pysrc => src}/spells/spell_holy_word.py | 0 {Rom24/pysrc => src}/spells/spell_identify.py | 0 .../pysrc => src}/spells/spell_infravision.py | 0 {Rom24/pysrc => src}/spells/spell_invis.py | 0 .../spells/spell_know_alignment.py | 0 .../spells/spell_lightning_bolt.py | 0 .../spells/spell_lightning_breath.py | 0 .../spells/spell_locate_object.py | 0 .../spells/spell_magic_missile.py | 0 .../spells/spell_mass_healing.py | 0 .../pysrc => src}/spells/spell_mass_invis.py | 0 {Rom24/pysrc => src}/spells/spell_nexus.py | 0 .../pysrc => src}/spells/spell_pass_door.py | 0 {Rom24/pysrc => src}/spells/spell_plague.py | 0 {Rom24/pysrc => src}/spells/spell_poison.py | 0 {Rom24/pysrc => src}/spells/spell_portal.py | 0 .../spells/spell_protection_evil.py | 0 .../spells/spell_protection_good.py | 0 .../spells/spell_ray_of_truth.py | 0 {Rom24/pysrc => src}/spells/spell_recharge.py | 0 {Rom24/pysrc => src}/spells/spell_refresh.py | 0 .../spells/spell_remove_curse.py | 0 .../pysrc => src}/spells/spell_sanctuary.py | 0 {Rom24/pysrc => src}/spells/spell_shield.py | 0 .../spells/spell_shocking_grasp.py | 0 {Rom24/pysrc => src}/spells/spell_sleep.py | 0 {Rom24/pysrc => src}/spells/spell_slow.py | 0 .../pysrc => src}/spells/spell_stone_skin.py | 0 {Rom24/pysrc => src}/spells/spell_summon.py | 0 {Rom24/pysrc => src}/spells/spell_teleport.py | 0 .../spells/spell_ventriloquate.py | 0 {Rom24/pysrc => src}/spells/spell_weaken.py | 0 .../spells/spell_word_of_recall.py | 0 {Rom24/pysrc => src}/state_checks.py | 2 +- {Rom24/pysrc => src}/sys_utils.py | 2 +- {Rom24/pysrc => src}/tables.py | 2 +- {Rom24/pysrc => src}/type_bypass.py | 2 +- {Rom24/pysrc => src}/uait/legacy_loads.py | 2 +- {Rom24/pysrc => src}/update.py | 2 +- {Rom24/pysrc => src}/world_classes.py | 2 +- 529 files changed, 265 insertions(+), 5441 deletions(-) delete mode 100644 Rom24/data/act_flags.json delete mode 100644 Rom24/data/affect_flags.json delete mode 100644 Rom24/data/attack_table.json delete mode 100644 Rom24/data/clan_table.json delete mode 100644 Rom24/data/comm_flags.json delete mode 100644 Rom24/data/con_app.json delete mode 100644 Rom24/data/dex_app.json delete mode 100644 Rom24/data/exit_flags.json delete mode 100644 Rom24/data/form_flags.json delete mode 100644 Rom24/data/group_table.json delete mode 100644 Rom24/data/guild_table.json delete mode 100644 Rom24/data/imm_flags.json delete mode 100644 Rom24/data/int_app.json delete mode 100644 Rom24/data/liq_table.json delete mode 100644 Rom24/data/off_flags.json delete mode 100644 Rom24/data/part_flags.json delete mode 100644 Rom24/data/pc_race_table.json delete mode 100644 Rom24/data/plr_flags.json delete mode 100644 Rom24/data/position_table.json delete mode 100644 Rom24/data/race_table.json delete mode 100644 Rom24/data/sex_table.json delete mode 100644 Rom24/data/size_table.json delete mode 100644 Rom24/data/skill_table.json delete mode 100644 Rom24/data/str_app.json delete mode 100644 Rom24/data/title_table.json delete mode 100644 Rom24/data/weapon_table.json delete mode 100644 Rom24/data/wis_app.json delete mode 100644 Rom24/data/wiznet_table.json rename {Rom24 => archive}/README (100%) rename {Rom24 => archive}/README.rom (100%) rename {Rom24 => archive}/README.version (100%) rename {Rom24 => archive}/src/Makefile (100%) rename {Rom24 => archive}/src/Makefile.linux (100%) rename {Rom24 => archive}/src/Makefile.normal (100%) rename {Rom24 => archive}/src/Makefile.solaris (100%) rename {Rom24 => archive}/src/act_comm.c (100%) rename {Rom24 => archive}/src/act_enter.c (100%) rename {Rom24 => archive}/src/act_info.c (100%) rename {Rom24 => archive}/src/act_move.c (100%) rename {Rom24 => archive}/src/act_obj.c (100%) rename {Rom24 => archive}/src/act_wiz.c (100%) rename {Rom24 => archive}/src/alias.c (100%) rename {Rom24 => archive}/src/ban.c (100%) rename {Rom24 => archive}/src/comm.c (100%) rename {Rom24 => archive}/src/const.c (100%) rename {Rom24 => archive}/src/db.c (100%) rename {Rom24 => archive}/src/db.h (100%) rename {Rom24 => archive}/src/db2.c (100%) rename {Rom24 => archive}/src/effects.c (100%) rename {Rom24 => archive}/src/fight.c (100%) rename {Rom24 => archive}/src/flags.c (100%) rename {Rom24 => archive}/src/handler.c (100%) rename {Rom24 => archive}/src/healer.c (100%) rename {Rom24 => archive}/src/interp.c (100%) rename {Rom24 => archive}/src/interp.h (100%) rename {Rom24 => archive}/src/lookup.c (100%) rename {Rom24 => archive}/src/lookup.h (100%) rename {Rom24 => archive}/src/magic.c (100%) rename {Rom24 => archive}/src/magic.h (100%) rename {Rom24 => archive}/src/magic2.c (100%) rename {Rom24 => archive}/src/merc.h (100%) rename {Rom24 => archive}/src/music.c (100%) rename {Rom24 => archive}/src/music.h (100%) rename {Rom24 => archive}/src/note.c (100%) rename {Rom24 => archive}/src/recycle.c (100%) rename {Rom24 => archive}/src/recycle.h (100%) rename {Rom24 => archive}/src/save.c (100%) rename {Rom24 => archive}/src/scan.c (100%) rename {Rom24 => archive}/src/skills.c (100%) rename {Rom24 => archive}/src/special.c (100%) rename {Rom24 => archive}/src/tables.c (100%) rename {Rom24 => archive}/src/tables.h (100%) rename {Rom24 => archive}/src/telnet.h (100%) rename {Rom24 => archive}/src/update.c (100%) rename {Rom24/area => area}/air.are (100%) rename {Rom24/area => area}/arachnos.are (100%) rename {Rom24/area => area}/area.lst (100%) rename {Rom24/area => area}/astral.are (100%) rename {Rom24/area => area}/canyon.are (100%) rename {Rom24/area => area}/catacomb.are (100%) rename {Rom24/area => area}/chapel.are (100%) rename {Rom24/area => area}/daycare.are (100%) rename {Rom24/area => area}/draconia.are (100%) rename {Rom24/area => area}/dream.are (100%) rename {Rom24/area => area}/drow.are (100%) rename {Rom24/area => area}/dwarven.are (100%) rename {Rom24/area => area}/dylan.are (100%) rename {Rom24/area => area}/eastern.are (100%) rename {Rom24/area => area}/galaxy.are (100%) rename {Rom24/area => area}/gnome.are (100%) rename {Rom24/area => area}/grave.are (100%) rename {Rom24/area => area}/group.are (100%) rename {Rom24/area => area}/grove.are (100%) rename {Rom24/area => area}/haon.are (100%) rename {Rom24/area => area}/help.are (100%) rename {Rom24/area => area}/hitower.are (100%) rename {Rom24/area => area}/hood.are (100%) rename {Rom24/area => area}/immort.are (100%) rename {Rom24/area => area}/limbo.are (100%) rename {Rom24/area => area}/mahntor.are (100%) rename {Rom24/area => area}/marsh.are (100%) rename {Rom24/area => area}/mega1.are (100%) rename {Rom24/area => area}/midennir.are (100%) rename {Rom24/area => area}/midgaard.are (100%) rename {Rom24/area => area}/mirror.are (100%) rename {Rom24/area => area}/mobfact.are (100%) rename {Rom24/area => area}/moria.are (100%) rename {Rom24/area => area}/music.txt (100%) rename {Rom24/area => area}/newthalos.are (100%) rename {Rom24/area => area}/nirvana.are (100%) rename {Rom24/area => area}/ofcol.are (100%) rename {Rom24/area => area}/ofcol2.are (100%) rename {Rom24/area => area}/olympus.are (100%) rename {Rom24/area => area}/plains.are (100%) rename {Rom24/area => area}/proto.are (100%) rename {Rom24/area => area}/pyramid.are (100%) rename {Rom24/area => area}/quifael.are (100%) rename {Rom24/area => area}/redferne.are (100%) rename {Rom24/area => area}/rom.are (100%) rename {Rom24/area => area}/school.are (100%) rename {Rom24/area => area}/sewer.are (100%) rename {Rom24/area => area}/shire.are (100%) rename {Rom24/area => area}/smurf.are (100%) rename {Rom24/area => area}/social.are (100%) rename {Rom24/area => area}/startup (100%) rename {Rom24/area => area}/thalos.are (100%) rename {Rom24/area => area}/tohell.are (100%) rename {Rom24/area => area}/trollden.are (100%) rename {Rom24/area => area}/valley.are (100%) rename {Rom24/area => area}/wyvern.are (100%) rename {Rom24/doc => doc}/Rom2.4.doc (100%) rename {Rom24/doc => doc}/act.txt (100%) rename {Rom24/doc => doc}/area.txt (100%) rename {Rom24/doc => doc}/class.txt (100%) rename {Rom24/doc => doc}/command.txt (100%) rename {Rom24/doc => doc}/contrib.txt (100%) rename {Rom24/doc => doc}/drool.txt (100%) rename {Rom24/doc => doc}/equipment-system (100%) rename {Rom24/doc => doc}/hacker.txt (100%) rename {Rom24/doc => doc}/license.doc (100%) rename {Rom24/doc => doc}/license.txt (100%) rename {Rom24/doc => doc}/memory.txt (100%) rename {Rom24/doc => doc}/new.txt (100%) rename {Rom24/doc => doc}/pfile.txt (100%) rename {Rom24/doc => doc}/port.txt (100%) rename {Rom24/doc => doc}/pyTiming.txt (100%) rename {Rom24/doc => doc}/rom.credits (100%) rename {Rom24/doc => doc}/rom.license (100%) rename {Rom24/doc => doc}/security.txt (100%) rename {Rom24/doc => doc}/sites.txt (100%) rename {Rom24/doc => doc}/skill.txt (100%) rename {Rom24/doc => doc}/sky.txt (100%) rename {Rom24/doc => doc}/trad.txt (100%) rename {Rom24/doc => doc}/vnum.txt (100%) rename {Rom24/projects => projects}/todo (100%) create mode 100644 requirements.txt rename {Rom24/pysrc => src}/CONCEPTS (100%) rename {Rom24/pysrc => src}/affects.py (100%) rename {Rom24/pysrc => src}/auth.py (99%) rename {Rom24/pysrc => src}/bit.py (99%) rename {Rom24/pysrc => src}/comm.py (99%) rename {Rom24/pysrc => src}/commands/__init__.py (100%) rename {Rom24/pysrc => src}/commands/do_advance.py (98%) rename {Rom24/pysrc => src}/commands/do_affects.py (96%) rename {Rom24/pysrc => src}/commands/do_afk.py (91%) rename {Rom24/pysrc => src}/commands/do_alias.py (97%) rename {Rom24/pysrc => src}/commands/do_answer.py (97%) rename {Rom24/pysrc => src}/commands/do_apickle.py (96%) rename {Rom24/pysrc => src}/commands/do_areas.py (92%) rename {Rom24/pysrc => src}/commands/do_at.py (96%) rename {Rom24/pysrc => src}/commands/do_auction.py (97%) rename {Rom24/pysrc => src}/commands/do_authenticator.py (98%) rename {Rom24/pysrc => src}/commands/do_autoassist.py (92%) rename {Rom24/pysrc => src}/commands/do_autoexit.py (92%) rename {Rom24/pysrc => src}/commands/do_autogold.py (92%) rename {Rom24/pysrc => src}/commands/do_autolist.py (98%) rename {Rom24/pysrc => src}/commands/do_autoloot.py (92%) rename {Rom24/pysrc => src}/commands/do_autosac.py (92%) rename {Rom24/pysrc => src}/commands/do_autosplit.py (92%) rename {Rom24/pysrc => src}/commands/do_backstab.py (98%) rename {Rom24/pysrc => src}/commands/do_bamfin.py (93%) rename {Rom24/pysrc => src}/commands/do_bamfout.py (93%) rename {Rom24/pysrc => src}/commands/do_bash.py (99%) rename {Rom24/pysrc => src}/commands/do_berserk.py (98%) rename {Rom24/pysrc => src}/commands/do_brandish.py (98%) rename {Rom24/pysrc => src}/commands/do_brief.py (91%) rename {Rom24/pysrc => src}/commands/do_bug.py (89%) rename {Rom24/pysrc => src}/commands/do_buy.py (99%) rename {Rom24/pysrc => src}/commands/do_cast.py (99%) rename {Rom24/pysrc => src}/commands/do_channels.py (98%) rename {Rom24/pysrc => src}/commands/do_clantalk.py (97%) rename {Rom24/pysrc => src}/commands/do_clone.py (98%) rename {Rom24/pysrc => src}/commands/do_close.py (98%) rename {Rom24/pysrc => src}/commands/do_combine.py (91%) rename {Rom24/pysrc => src}/commands/do_commands.py (92%) rename {Rom24/pysrc => src}/commands/do_compact.py (91%) rename {Rom24/pysrc => src}/commands/do_compare.py (98%) rename {Rom24/pysrc => src}/commands/do_consider.py (96%) rename {Rom24/pysrc => src}/commands/do_count.py (94%) rename {Rom24/pysrc => src}/commands/do_deaf.py (92%) rename {Rom24/pysrc => src}/commands/do_debug.py (94%) rename {Rom24/pysrc => src}/commands/do_delete.py (97%) rename {Rom24/pysrc => src}/commands/do_deny.py (96%) rename {Rom24/pysrc => src}/commands/do_description.py (96%) rename {Rom24/pysrc => src}/commands/do_dirt.py (99%) rename {Rom24/pysrc => src}/commands/do_disarm.py (98%) rename {Rom24/pysrc => src}/commands/do_disconnect.py (96%) rename {Rom24/pysrc => src}/commands/do_down.py (87%) rename {Rom24/pysrc => src}/commands/do_drink.py (98%) rename {Rom24/pysrc => src}/commands/do_drop.py (99%) rename {Rom24/pysrc => src}/commands/do_dump.py (84%) rename {Rom24/pysrc => src}/commands/do_east.py (87%) rename {Rom24/pysrc => src}/commands/do_eat.py (98%) rename {Rom24/pysrc => src}/commands/do_echo.py (92%) rename {Rom24/pysrc => src}/commands/do_emote.py (94%) rename {Rom24/pysrc => src}/commands/do_enter.py (99%) rename {Rom24/pysrc => src}/commands/do_envenom.py (98%) rename {Rom24/pysrc => src}/commands/do_equipment.py (95%) rename {Rom24/pysrc => src}/commands/do_examine.py (97%) rename {Rom24/pysrc => src}/commands/do_exits.py (97%) rename {Rom24/pysrc => src}/commands/do_fill.py (97%) rename {Rom24/pysrc => src}/commands/do_flags.py (99%) rename {Rom24/pysrc => src}/commands/do_flee.py (97%) rename {Rom24/pysrc => src}/commands/do_follow.py (97%) rename {Rom24/pysrc => src}/commands/do_force.py (98%) rename {Rom24/pysrc => src}/commands/do_freeze.py (97%) rename {Rom24/pysrc => src}/commands/do_freset.py (90%) rename {Rom24/pysrc => src}/commands/do_gain.py (99%) rename {Rom24/pysrc => src}/commands/do_gdstate.py (96%) rename {Rom24/pysrc => src}/commands/do_get.py (98%) rename {Rom24/pysrc => src}/commands/do_give.py (99%) rename {Rom24/pysrc => src}/commands/do_gossip.py (97%) rename {Rom24/pysrc => src}/commands/do_goto.py (97%) rename {Rom24/pysrc => src}/commands/do_grats.py (97%) rename {Rom24/pysrc => src}/commands/do_group.py (98%) rename {Rom24/pysrc => src}/commands/do_groups.py (97%) rename {Rom24/pysrc => src}/commands/do_gtell.py (96%) rename {Rom24/pysrc => src}/commands/do_guild.py (97%) rename {Rom24/pysrc => src}/commands/do_heal.py (99%) rename {Rom24/pysrc => src}/commands/do_help.py (97%) rename {Rom24/pysrc => src}/commands/do_hide.py (93%) rename {Rom24/pysrc => src}/commands/do_holylight.py (92%) rename {Rom24/pysrc => src}/commands/do_immtalk.py (96%) rename {Rom24/pysrc => src}/commands/do_incognito.py (97%) rename {Rom24/pysrc => src}/commands/do_inventory.py (89%) rename {Rom24/pysrc => src}/commands/do_invis.py (97%) rename {Rom24/pysrc => src}/commands/do_kick.py (96%) rename {Rom24/pysrc => src}/commands/do_kill.py (97%) rename {Rom24/pysrc => src}/commands/do_list.py (98%) rename {Rom24/pysrc => src}/commands/do_load.py (94%) rename {Rom24/pysrc => src}/commands/do_lock.py (98%) rename {Rom24/pysrc => src}/commands/do_log.py (96%) rename {Rom24/pysrc => src}/commands/do_look.py (99%) rename {Rom24/pysrc => src}/commands/do_memory.py (85%) rename {Rom24/pysrc => src}/commands/do_mfind.py (95%) rename {Rom24/pysrc => src}/commands/do_mload.py (95%) rename {Rom24/pysrc => src}/commands/do_mset.py (99%) rename {Rom24/pysrc => src}/commands/do_mstat.py (99%) rename {Rom24/pysrc => src}/commands/do_murder.py (97%) rename {Rom24/pysrc => src}/commands/do_music.py (97%) rename {Rom24/pysrc => src}/commands/do_mwhere.py (97%) rename {Rom24/pysrc => src}/commands/do_newlock.py (94%) rename {Rom24/pysrc => src}/commands/do_nochannels.py (97%) rename {Rom24/pysrc => src}/commands/do_noemote.py (96%) rename {Rom24/pysrc => src}/commands/do_nofollow.py (93%) rename {Rom24/pysrc => src}/commands/do_noloot.py (92%) rename {Rom24/pysrc => src}/commands/do_north.py (87%) rename {Rom24/pysrc => src}/commands/do_noshout.py (97%) rename {Rom24/pysrc => src}/commands/do_nosummon.py (95%) rename {Rom24/pysrc => src}/commands/do_notell.py (96%) rename {Rom24/pysrc => src}/commands/do_ofind.py (96%) rename {Rom24/pysrc => src}/commands/do_oload.py (97%) rename {Rom24/pysrc => src}/commands/do_omni.py (91%) rename {Rom24/pysrc => src}/commands/do_open.py (98%) rename {Rom24/pysrc => src}/commands/do_order.py (97%) rename {Rom24/pysrc => src}/commands/do_oset.py (98%) rename {Rom24/pysrc => src}/commands/do_ostat.py (99%) rename {Rom24/pysrc => src}/commands/do_outfit.py (97%) rename {Rom24/pysrc => src}/commands/do_owhere.py (97%) rename {Rom24/pysrc => src}/commands/do_pardon.py (96%) rename {Rom24/pysrc => src}/commands/do_password.py (97%) rename {Rom24/pysrc => src}/commands/do_peace.py (93%) rename {Rom24/pysrc => src}/commands/do_pecho.py (94%) rename {Rom24/pysrc => src}/commands/do_pick.py (99%) rename {Rom24/pysrc => src}/commands/do_pmote.py (96%) rename {Rom24/pysrc => src}/commands/do_pose.py (99%) rename {Rom24/pysrc => src}/commands/do_pour.py (98%) rename {Rom24/pysrc => src}/commands/do_practice.py (98%) rename {Rom24/pysrc => src}/commands/do_prefix.py (95%) rename {Rom24/pysrc => src}/commands/do_prompt.py (95%) rename {Rom24/pysrc => src}/commands/do_protect.py (96%) rename {Rom24/pysrc => src}/commands/do_purge.py (97%) rename {Rom24/pysrc => src}/commands/do_put.py (99%) rename {Rom24/pysrc => src}/commands/do_quaff.py (96%) rename {Rom24/pysrc => src}/commands/do_question.py (97%) rename {Rom24/pysrc => src}/commands/do_quiet.py (92%) rename {Rom24/pysrc => src}/commands/do_quit.py (97%) rename {Rom24/pysrc => src}/commands/do_quote.py (97%) rename {Rom24/pysrc => src}/commands/do_reboot.py (94%) rename {Rom24/pysrc => src}/commands/do_recall.py (97%) rename {Rom24/pysrc => src}/commands/do_recho.py (93%) rename {Rom24/pysrc => src}/commands/do_recite.py (97%) rename {Rom24/pysrc => src}/commands/do_reload.py (87%) rename {Rom24/pysrc => src}/commands/do_remove.py (94%) rename {Rom24/pysrc => src}/commands/do_rent.py (86%) rename {Rom24/pysrc => src}/commands/do_replay.py (91%) rename {Rom24/pysrc => src}/commands/do_reply.py (98%) rename {Rom24/pysrc => src}/commands/do_report.py (94%) rename {Rom24/pysrc => src}/commands/do_rescue.py (97%) rename {Rom24/pysrc => src}/commands/do_rest.py (99%) rename {Rom24/pysrc => src}/commands/do_restore.py (98%) rename {Rom24/pysrc => src}/commands/do_return.py (95%) rename {Rom24/pysrc => src}/commands/do_rstat.py (98%) rename {Rom24/pysrc => src}/commands/do_sacrifice.py (98%) rename {Rom24/pysrc => src}/commands/do_save.py (91%) rename {Rom24/pysrc => src}/commands/do_say.py (94%) rename {Rom24/pysrc => src}/commands/do_score.py (99%) rename {Rom24/pysrc => src}/commands/do_scroll.py (96%) rename {Rom24/pysrc => src}/commands/do_sell.py (98%) rename {Rom24/pysrc => src}/commands/do_set.py (96%) rename {Rom24/pysrc => src}/commands/do_shout.py (97%) rename {Rom24/pysrc => src}/commands/do_show.py (92%) rename {Rom24/pysrc => src}/commands/do_shutdown.py (94%) rename {Rom24/pysrc => src}/commands/do_sit.py (99%) rename {Rom24/pysrc => src}/commands/do_skills.py (98%) rename {Rom24/pysrc => src}/commands/do_slay.py (96%) rename {Rom24/pysrc => src}/commands/do_sleep.py (98%) rename {Rom24/pysrc => src}/commands/do_slookup.py (95%) rename {Rom24/pysrc => src}/commands/do_smote.py (96%) rename {Rom24/pysrc => src}/commands/do_sneak.py (95%) rename {Rom24/pysrc => src}/commands/do_snoop.py (97%) rename {Rom24/pysrc => src}/commands/do_socials.py (91%) rename {Rom24/pysrc => src}/commands/do_sockets.py (95%) rename {Rom24/pysrc => src}/commands/do_south.py (87%) rename {Rom24/pysrc => src}/commands/do_spells.py (98%) rename {Rom24/pysrc => src}/commands/do_split.py (98%) rename {Rom24/pysrc => src}/commands/do_sset.py (97%) rename {Rom24/pysrc => src}/commands/do_stand.py (98%) rename {Rom24/pysrc => src}/commands/do_stat.py (96%) rename {Rom24/pysrc => src}/commands/do_steal.py (99%) rename {Rom24/pysrc => src}/commands/do_string.py (98%) rename {Rom24/pysrc => src}/commands/do_switch.py (97%) rename {Rom24/pysrc => src}/commands/do_tabledump.py (89%) rename {Rom24/pysrc => src}/commands/do_tableload.py (89%) rename {Rom24/pysrc => src}/commands/do_tell.py (98%) rename {Rom24/pysrc => src}/commands/do_term.py (98%) rename {Rom24/pysrc => src}/commands/do_time.py (97%) rename {Rom24/pysrc => src}/commands/do_title.py (92%) rename {Rom24/pysrc => src}/commands/do_train.py (98%) rename {Rom24/pysrc => src}/commands/do_transfer.py (98%) rename {Rom24/pysrc => src}/commands/do_trip.py (98%) rename {Rom24/pysrc => src}/commands/do_trust.py (95%) rename {Rom24/pysrc => src}/commands/do_typo.py (89%) rename {Rom24/pysrc => src}/commands/do_unalias.py (94%) rename {Rom24/pysrc => src}/commands/do_unlock.py (98%) rename {Rom24/pysrc => src}/commands/do_up.py (86%) rename {Rom24/pysrc => src}/commands/do_value.py (97%) rename {Rom24/pysrc => src}/commands/do_violate.py (97%) rename {Rom24/pysrc => src}/commands/do_visible.py (92%) rename {Rom24/pysrc => src}/commands/do_vnum.py (95%) rename {Rom24/pysrc => src}/commands/do_wake.py (96%) rename {Rom24/pysrc => src}/commands/do_wear.py (96%) rename {Rom24/pysrc => src}/commands/do_weather.py (94%) rename {Rom24/pysrc => src}/commands/do_west.py (87%) rename {Rom24/pysrc => src}/commands/do_where.py (97%) rename {Rom24/pysrc => src}/commands/do_who.py (99%) rename {Rom24/pysrc => src}/commands/do_whois.py (98%) rename {Rom24/pysrc => src}/commands/do_wimpy.py (94%) rename {Rom24/pysrc => src}/commands/do_wizhelp.py (92%) rename {Rom24/pysrc => src}/commands/do_wizlock.py (93%) rename {Rom24/pysrc => src}/commands/do_wiznet.py (98%) rename {Rom24/pysrc => src}/commands/do_worth.py (92%) rename {Rom24/pysrc => src}/commands/do_yell.py (95%) rename {Rom24/pysrc => src}/commands/do_zap.py (98%) rename {Rom24/pysrc => src}/commands/do_zecho.py (93%) rename {Rom24/pysrc => src}/const.py (99%) rename {Rom24/pysrc => src}/data_loader.py (99%) rename {Rom24/pysrc => src}/database/__init__.py (100%) rename {Rom24/pysrc => src}/database/read/__init__.py (100%) rename {Rom24/pysrc => src}/database/read/read_tables.py (97%) rename {Rom24/pysrc => src}/database/tracker.py (100%) rename {Rom24/pysrc => src}/database/write/__init__.py (100%) rename {Rom24/pysrc => src}/database/write/write_tables.py (95%) rename {Rom24/pysrc => src}/db.py (99%) rename {Rom24/pysrc => src}/effects.py (99%) rename {Rom24/pysrc => src}/environment.py (99%) rename {Rom24/pysrc => src}/equipment.py (99%) rename {Rom24/pysrc => src}/fight.py (99%) rename {Rom24/pysrc => src}/game_utils.py (99%) rename {Rom24/pysrc => src}/handler_ch.py (99%) rename {Rom24/pysrc => src}/handler_game.py (99%) rename {Rom24/pysrc => src}/handler_item.py (99%) rename {Rom24/pysrc => src}/handler_log.py (99%) rename {Rom24/pysrc => src}/handler_magic.py (99%) rename {Rom24/pysrc => src}/handler_npc.py (99%) rename {Rom24/pysrc => src}/handler_pc.py (99%) rename {Rom24/pysrc => src}/handler_room.py (99%) rename {Rom24/pysrc => src}/hotfix.py (99%) rename {Rom24/pysrc => src}/immortal.py (96%) rename {Rom24/pysrc => src}/instance.py (99%) rename {Rom24/pysrc => src}/interp.py (98%) rename {Rom24/pysrc => src}/inventory.py (96%) rename {Rom24/pysrc => src}/item_flags.py (99%) rename {Rom24/pysrc => src}/living.py (99%) rename {Rom24/pysrc => src}/magic.py (100%) rename {Rom24/pysrc => src}/merc.py (99%) rename {Rom24/pysrc => src}/miniboa/LICENSE.TXT (100%) rename {Rom24/pysrc => src}/miniboa/README.TXT (100%) rename {Rom24/pysrc => src}/miniboa/__init__.py (100%) rename {Rom24/pysrc => src}/miniboa/asyncio.py (99%) rename {Rom24/pysrc => src}/miniboa/colors.py (99%) rename {Rom24/pysrc => src}/miniboa/telnet.py (99%) rename {Rom24/pysrc => src}/miniboa/terminal.py (99%) rename {Rom24/pysrc => src}/nanny.py (99%) rename {Rom24/pysrc => src}/object_creator.py (99%) rename {Rom24/pysrc => src}/physical.py (91%) rename {Rom24/pysrc => src}/pyom.py (98%) rename {Rom24/pysrc => src}/pyprogs.py (99%) rename {Rom24/pysrc => src}/save.py (99%) rename {Rom24/pysrc => src}/settings.py (96%) rename {Rom24/pysrc => src}/shell.py (90%) rename {Rom24/pysrc => src}/shop_utils.py (99%) rename {Rom24/pysrc => src}/skills.py (99%) rename {Rom24/pysrc => src}/special.py (99%) rename {Rom24/pysrc => src}/spells/__init__.py (100%) rename {Rom24/pysrc => src}/spells/spell_acid_blast.py (100%) rename {Rom24/pysrc => src}/spells/spell_acid_breath.py (100%) rename {Rom24/pysrc => src}/spells/spell_armor.py (100%) rename {Rom24/pysrc => src}/spells/spell_bless.py (100%) rename {Rom24/pysrc => src}/spells/spell_blindness.py (100%) rename {Rom24/pysrc => src}/spells/spell_burning_hands.py (100%) rename {Rom24/pysrc => src}/spells/spell_call_lightning.py (100%) rename {Rom24/pysrc => src}/spells/spell_calm.py (100%) rename {Rom24/pysrc => src}/spells/spell_cancellation.py (100%) rename {Rom24/pysrc => src}/spells/spell_cause_critical.py (100%) rename {Rom24/pysrc => src}/spells/spell_cause_light.py (100%) rename {Rom24/pysrc => src}/spells/spell_cause_serious.py (100%) rename {Rom24/pysrc => src}/spells/spell_chain_lightning.py (100%) rename {Rom24/pysrc => src}/spells/spell_change_sex.py (100%) rename {Rom24/pysrc => src}/spells/spell_charm_person.py (100%) rename {Rom24/pysrc => src}/spells/spell_chill_touch.py (100%) rename {Rom24/pysrc => src}/spells/spell_colour_spray.py (100%) rename {Rom24/pysrc => src}/spells/spell_continual_light.py (100%) rename {Rom24/pysrc => src}/spells/spell_control_weather.py (100%) rename {Rom24/pysrc => src}/spells/spell_create_food.py (100%) rename {Rom24/pysrc => src}/spells/spell_create_rose.py (100%) rename {Rom24/pysrc => src}/spells/spell_create_spring.py (100%) rename {Rom24/pysrc => src}/spells/spell_create_water.py (100%) rename {Rom24/pysrc => src}/spells/spell_cure_blindness.py (100%) rename {Rom24/pysrc => src}/spells/spell_cure_critical.py (100%) rename {Rom24/pysrc => src}/spells/spell_cure_disease.py (100%) rename {Rom24/pysrc => src}/spells/spell_cure_light.py (100%) rename {Rom24/pysrc => src}/spells/spell_cure_poison.py (100%) rename {Rom24/pysrc => src}/spells/spell_cure_serious.py (100%) rename {Rom24/pysrc => src}/spells/spell_curse.py (100%) rename {Rom24/pysrc => src}/spells/spell_demonfire.py (100%) rename {Rom24/pysrc => src}/spells/spell_detect_evil.py (100%) rename {Rom24/pysrc => src}/spells/spell_detect_good.py (100%) rename {Rom24/pysrc => src}/spells/spell_detect_hidden.py (100%) rename {Rom24/pysrc => src}/spells/spell_detect_invis.py (100%) rename {Rom24/pysrc => src}/spells/spell_detect_magic.py (100%) rename {Rom24/pysrc => src}/spells/spell_detect_poison.py (100%) rename {Rom24/pysrc => src}/spells/spell_dispel_evil.py (100%) rename {Rom24/pysrc => src}/spells/spell_dispel_good.py (100%) rename {Rom24/pysrc => src}/spells/spell_dispel_magic.py (100%) rename {Rom24/pysrc => src}/spells/spell_earthquake.py (100%) rename {Rom24/pysrc => src}/spells/spell_enchant_armor.py (100%) rename {Rom24/pysrc => src}/spells/spell_enchant_weapon.py (100%) rename {Rom24/pysrc => src}/spells/spell_energy_drain.py (100%) rename {Rom24/pysrc => src}/spells/spell_faerie_fire.py (100%) rename {Rom24/pysrc => src}/spells/spell_faerie_fog.py (100%) rename {Rom24/pysrc => src}/spells/spell_farsight.py (100%) rename {Rom24/pysrc => src}/spells/spell_fire_breath.py (100%) rename {Rom24/pysrc => src}/spells/spell_fireball.py (100%) rename {Rom24/pysrc => src}/spells/spell_fireproof.py (100%) rename {Rom24/pysrc => src}/spells/spell_flamestrike.py (100%) rename {Rom24/pysrc => src}/spells/spell_floating_disc.py (100%) rename {Rom24/pysrc => src}/spells/spell_fly.py (100%) rename {Rom24/pysrc => src}/spells/spell_frenzy.py (100%) rename {Rom24/pysrc => src}/spells/spell_frost_breath.py (100%) rename {Rom24/pysrc => src}/spells/spell_gas_breath.py (100%) rename {Rom24/pysrc => src}/spells/spell_gate.py (100%) rename {Rom24/pysrc => src}/spells/spell_general_purpose.py (100%) rename {Rom24/pysrc => src}/spells/spell_giant_strength.py (100%) rename {Rom24/pysrc => src}/spells/spell_harm.py (100%) rename {Rom24/pysrc => src}/spells/spell_haste.py (100%) rename {Rom24/pysrc => src}/spells/spell_heal.py (100%) rename {Rom24/pysrc => src}/spells/spell_heat_metal.py (100%) rename {Rom24/pysrc => src}/spells/spell_high_explosive.py (100%) rename {Rom24/pysrc => src}/spells/spell_holy_word.py (100%) rename {Rom24/pysrc => src}/spells/spell_identify.py (100%) rename {Rom24/pysrc => src}/spells/spell_infravision.py (100%) rename {Rom24/pysrc => src}/spells/spell_invis.py (100%) rename {Rom24/pysrc => src}/spells/spell_know_alignment.py (100%) rename {Rom24/pysrc => src}/spells/spell_lightning_bolt.py (100%) rename {Rom24/pysrc => src}/spells/spell_lightning_breath.py (100%) rename {Rom24/pysrc => src}/spells/spell_locate_object.py (100%) rename {Rom24/pysrc => src}/spells/spell_magic_missile.py (100%) rename {Rom24/pysrc => src}/spells/spell_mass_healing.py (100%) rename {Rom24/pysrc => src}/spells/spell_mass_invis.py (100%) rename {Rom24/pysrc => src}/spells/spell_nexus.py (100%) rename {Rom24/pysrc => src}/spells/spell_pass_door.py (100%) rename {Rom24/pysrc => src}/spells/spell_plague.py (100%) rename {Rom24/pysrc => src}/spells/spell_poison.py (100%) rename {Rom24/pysrc => src}/spells/spell_portal.py (100%) rename {Rom24/pysrc => src}/spells/spell_protection_evil.py (100%) rename {Rom24/pysrc => src}/spells/spell_protection_good.py (100%) rename {Rom24/pysrc => src}/spells/spell_ray_of_truth.py (100%) rename {Rom24/pysrc => src}/spells/spell_recharge.py (100%) rename {Rom24/pysrc => src}/spells/spell_refresh.py (100%) rename {Rom24/pysrc => src}/spells/spell_remove_curse.py (100%) rename {Rom24/pysrc => src}/spells/spell_sanctuary.py (100%) rename {Rom24/pysrc => src}/spells/spell_shield.py (100%) rename {Rom24/pysrc => src}/spells/spell_shocking_grasp.py (100%) rename {Rom24/pysrc => src}/spells/spell_sleep.py (100%) rename {Rom24/pysrc => src}/spells/spell_slow.py (100%) rename {Rom24/pysrc => src}/spells/spell_stone_skin.py (100%) rename {Rom24/pysrc => src}/spells/spell_summon.py (100%) rename {Rom24/pysrc => src}/spells/spell_teleport.py (100%) rename {Rom24/pysrc => src}/spells/spell_ventriloquate.py (100%) rename {Rom24/pysrc => src}/spells/spell_weaken.py (100%) rename {Rom24/pysrc => src}/spells/spell_word_of_recall.py (100%) rename {Rom24/pysrc => src}/state_checks.py (99%) rename {Rom24/pysrc => src}/sys_utils.py (99%) rename {Rom24/pysrc => src}/tables.py (98%) rename {Rom24/pysrc => src}/type_bypass.py (88%) rename {Rom24/pysrc => src}/uait/legacy_loads.py (99%) rename {Rom24/pysrc => src}/update.py (99%) rename {Rom24/pysrc => src}/world_classes.py (99%) diff --git a/Rom24/data/act_flags.json b/Rom24/data/act_flags.json deleted file mode 100644 index 3feddc3..0000000 --- a/Rom24/data/act_flags.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "npc": [ - "npc", - 1, - false - ], - "sentinel": [ - "sentinel", - 2, - true - ], - "scavenger": [ - "scavenger", - 4, - true - ], - "aggressive": [ - "aggressive", - 32, - true - ], - "stay_area": [ - "stay_area", - 64, - true - ], - "wimpy": [ - "wimpy", - 128, - true - ], - "pet": [ - "pet", - 256, - true - ], - "train": [ - "train", - 512, - true - ], - "practice": [ - "practice", - 1024, - true - ], - "undead": [ - "undead", - 16384, - true - ], - "cleric": [ - "cleric", - 65536, - true - ], - "mage": [ - "mage", - 131072, - true - ], - "thief": [ - "thief", - 262144, - true - ], - "warrior": [ - "warrior", - 524288, - true - ], - "noalign": [ - "noalign", - 1048576, - true - ], - "nopurge": [ - "nopurge", - 2097152, - true - ], - "outdoors": [ - "outdoors", - 4194304, - true - ], - "indoors": [ - "indoors", - 16777216, - true - ], - "healer": [ - "healer", - 67108864, - true - ], - "gain": [ - "gain", - 134217728, - true - ], - "update_always": [ - "update_always", - 268435456, - true - ], - "changer": [ - "changer", - 536870912, - true - ] -} \ No newline at end of file diff --git a/Rom24/data/affect_flags.json b/Rom24/data/affect_flags.json deleted file mode 100644 index 0f0866d..0000000 --- a/Rom24/data/affect_flags.json +++ /dev/null @@ -1,147 +0,0 @@ -{ - "blind": [ - "blind", - 1, - true - ], - "invisible": [ - "invisible", - 2, - true - ], - "detect_evil": [ - "detect_evil", - 4, - true - ], - "detect_invis": [ - "detect_invis", - 8, - true - ], - "detect_magic": [ - "detect_magic", - 16, - true - ], - "detect_hidden": [ - "detect_hidden", - 32, - true - ], - "detect_good": [ - "detect_good", - 64, - true - ], - "sanctuary": [ - "sanctuary", - 128, - true - ], - "faerie_fire": [ - "faerie_fire", - 256, - true - ], - "infrared": [ - "infrared", - 512, - true - ], - "curse": [ - "curse", - 1024, - true - ], - "poison": [ - "poison", - 4096, - true - ], - "protect_evil": [ - "protect_evil", - 8192, - true - ], - "protect_good": [ - "protect_good", - 16384, - true - ], - "sneak": [ - "sneak", - 32768, - true - ], - "hide": [ - "hide", - 65536, - true - ], - "sleep": [ - "sleep", - 131072, - true - ], - "charm": [ - "charm", - 262144, - true - ], - "flying": [ - "flying", - 524288, - true - ], - "pass_door": [ - "pass_door", - 1048576, - true - ], - "haste": [ - "haste", - 2097152, - true - ], - "calm": [ - "calm", - 4194304, - true - ], - "plague": [ - "plague", - 8388608, - true - ], - "weaken": [ - "weaken", - 16777216, - true - ], - "dark_vision": [ - "dark_vision", - 33554432, - true - ], - "berserk": [ - "berserk", - 67108864, - true - ], - "swim": [ - "swim", - 134217728, - true - ], - "regeneration": [ - "regeneration", - 268435456, - true - ], - "slow": [ - "slow", - 536870912, - true - ] -} \ No newline at end of file diff --git a/Rom24/data/attack_table.json b/Rom24/data/attack_table.json deleted file mode 100644 index aba154b..0000000 --- a/Rom24/data/attack_table.json +++ /dev/null @@ -1,202 +0,0 @@ -{ - "0": [ - "none", - "hit", - -1 - ], - "1": [ - "slice", - "slice", - 3 - ], - "2": [ - "stab", - "stab", - 2 - ], - "3": [ - "slash", - "slash", - 3 - ], - "4": [ - "whip", - "whip", - 3 - ], - "5": [ - "claw", - "claw", - 3 - ], - "6": [ - "blast", - "blast", - 1 - ], - "7": [ - "pound", - "pound", - 1 - ], - "8": [ - "crush", - "crush", - 1 - ], - "9": [ - "grep", - "grep", - 3 - ], - "10": [ - "bite", - "bite", - 2 - ], - "11": [ - "pierce", - "pierce", - 2 - ], - "12": [ - "suction", - "suction", - 1 - ], - "13": [ - "beating", - "beating", - 1 - ], - "14": [ - "digestion", - "digestion", - 7 - ], - "15": [ - "charge", - "charge", - 1 - ], - "16": [ - "slap", - "slap", - 1 - ], - "17": [ - "punch", - "punch", - 1 - ], - "18": [ - "wrath", - "wrath", - 11 - ], - "19": [ - "magic", - "magic", - 11 - ], - "20": [ - "divine", - "divine power", - 10 - ], - "21": [ - "cleave", - "cleave", - 3 - ], - "22": [ - "scratch", - "scratch", - 2 - ], - "23": [ - "peck", - "peck", - 2 - ], - "24": [ - "peckb", - "peck", - 1 - ], - "25": [ - "chop", - "chop", - 3 - ], - "26": [ - "sting", - "sting", - 2 - ], - "27": [ - "smash", - "smash", - 1 - ], - "28": [ - "shbite", - "shocking bite", - 6 - ], - "29": [ - "flbite", - "flaming bite", - 4 - ], - "30": [ - "frbite", - "freezing bite", - 5 - ], - "31": [ - "acbite", - "acidic bite", - 7 - ], - "32": [ - "chomp", - "chomp", - 2 - ], - "33": [ - "drain", - "life drain", - 9 - ], - "34": [ - "thrust", - "thrust", - 2 - ], - "35": [ - "slime", - "slime", - 7 - ], - "36": [ - "shock", - "shock", - 6 - ], - "37": [ - "thwack", - "thwack", - 1 - ], - "38": [ - "flame", - "flame", - 4 - ], - "39": [ - "chill", - "chill", - 5 - ] -} \ No newline at end of file diff --git a/Rom24/data/clan_table.json b/Rom24/data/clan_table.json deleted file mode 100644 index 340b719..0000000 --- a/Rom24/data/clan_table.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "": [ - "", - "", - 3054, - true - ], - "loner": [ - "loner", - "[ Loner ] ", - 3054, - true - ], - "rom": [ - "rom", - "[ ROM ] ", - 3054, - false - ] -} \ No newline at end of file diff --git a/Rom24/data/comm_flags.json b/Rom24/data/comm_flags.json deleted file mode 100644 index 5fe8700..0000000 --- a/Rom24/data/comm_flags.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "quiet": [ - "quiet", - 1, - true - ], - "deaf": [ - "deaf", - 2, - true - ], - "nowiz": [ - "nowiz", - 4, - true - ], - "noclangossip": [ - "noclangossip", - 8, - true - ], - "nogossip": [ - "nogossip", - 16, - true - ], - "noquestion": [ - "noquestion", - 32, - true - ], - "nomusic": [ - "nomusic", - 64, - true - ], - "noclan": [ - "noclan", - 128, - true - ], - "noquote": [ - "noquote", - 256, - true - ], - "shoutsoff": [ - "shoutsoff", - 512, - true - ], - "compact": [ - "compact", - 2048, - true - ], - "brief": [ - "brief", - 4096, - true - ], - "prompt": [ - "prompt", - 8192, - true - ], - "combine": [ - "combine", - 16384, - true - ], - "telnet_ga": [ - "telnet_ga", - 32768, - true - ], - "show_affects": [ - "show_affects", - 65536, - true - ], - "nograts": [ - "nograts", - 131072, - true - ], - "noemote": [ - "noemote", - 524288, - false - ], - "noshout": [ - "noshout", - 1048576, - false - ], - "notell": [ - "notell", - 2097152, - false - ], - "nochannels": [ - "nochannels", - 4194304, - false - ], - "snoop_proof": [ - "snoop_proof", - 16777216, - false - ], - "afk": [ - "afk", - 33554432, - true - ] -} \ No newline at end of file diff --git a/Rom24/data/con_app.json b/Rom24/data/con_app.json deleted file mode 100644 index 1603275..0000000 --- a/Rom24/data/con_app.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "0": [ - -4, - 20 - ], - "1": [ - -3, - 25 - ], - "2": [ - -2, - 30 - ], - "3": [ - -2, - 35 - ], - "4": [ - -1, - 40 - ], - "5": [ - -1, - 45 - ], - "6": [ - -1, - 50 - ], - "7": [ - 0, - 55 - ], - "8": [ - 0, - 60 - ], - "9": [ - 0, - 65 - ], - "10": [ - 0, - 70 - ], - "11": [ - 0, - 75 - ], - "12": [ - 0, - 80 - ], - "13": [ - 0, - 85 - ], - "14": [ - 0, - 88 - ], - "15": [ - 1, - 90 - ], - "16": [ - 2, - 95 - ], - "17": [ - 2, - 97 - ], - "18": [ - 3, - 99 - ], - "19": [ - 3, - 99 - ], - "20": [ - 4, - 99 - ], - "21": [ - 4, - 99 - ], - "22": [ - 5, - 99 - ], - "23": [ - 6, - 99 - ], - "24": [ - 7, - 99 - ], - "25": [ - 8, - 99 - ] -} \ No newline at end of file diff --git a/Rom24/data/dex_app.json b/Rom24/data/dex_app.json deleted file mode 100644 index e89d37d..0000000 --- a/Rom24/data/dex_app.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "0": [ - 60 - ], - "1": [ - 50 - ], - "2": [ - 50 - ], - "3": [ - 40 - ], - "4": [ - 30 - ], - "5": [ - 20 - ], - "6": [ - 10 - ], - "7": [ - 0 - ], - "8": [ - 0 - ], - "9": [ - 0 - ], - "10": [ - 0 - ], - "11": [ - 0 - ], - "12": [ - 0 - ], - "13": [ - 0 - ], - "14": [ - 0 - ], - "15": [ - -10 - ], - "16": [ - -15 - ], - "17": [ - -20 - ], - "18": [ - -30 - ], - "19": [ - -40 - ], - "20": [ - -50 - ], - "21": [ - -60 - ], - "22": [ - -75 - ], - "23": [ - -90 - ], - "24": [ - -105 - ], - "25": [ - -120 - ] -} \ No newline at end of file diff --git a/Rom24/data/exit_flags.json b/Rom24/data/exit_flags.json deleted file mode 100644 index db58dcc..0000000 --- a/Rom24/data/exit_flags.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "isdoor": [ - "isdoor", - 1, - false - ], - "closed": [ - "closed", - 4, - false - ], - "locked": [ - "locked", - 8, - false - ], - "pickproof": [ - "pickproof", - 16, - false - ], - "nopass": [ - "nopass", - 32, - false - ], - "easy": [ - "easy", - 64, - false - ], - "hard": [ - "hard", - 128, - false - ], - "infuriating": [ - "infuriating", - 8192, - false - ], - "noclose": [ - "noclose", - 32768, - false - ], - "nolock": [ - "nolock", - 65536, - false - ] -} diff --git a/Rom24/data/form_flags.json b/Rom24/data/form_flags.json deleted file mode 100644 index 6f34161..0000000 --- a/Rom24/data/form_flags.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "edible": [ - "edible", - 1, - true - ], - "poison": [ - "poison", - 2, - true - ], - "magical": [ - "magical", - 4, - true - ], - "instant_decay": [ - "instant_decay", - 8, - true - ], - "other": [ - "other", - 16, - true - ], - "animal": [ - "animal", - 64, - true - ], - "sentient": [ - "sentient", - 128, - true - ], - "undead": [ - "undead", - 256, - true - ], - "construct": [ - "construct", - 512, - true - ], - "mist": [ - "mist", - 1024, - true - ], - "intangible": [ - "intangible", - 2048, - true - ], - "biped": [ - "biped", - 4096, - true - ], - "centaur": [ - "centaur", - 8192, - true - ], - "insect": [ - "insect", - 16384, - true - ], - "spider": [ - "spider", - 32768, - true - ], - "crustacean": [ - "crustacean", - 65536, - true - ], - "worm": [ - "worm", - 131072, - true - ], - "blob": [ - "blob", - 262144, - true - ], - "mammal": [ - "mammal", - 2097152, - true - ], - "bird": [ - "bird", - 4194304, - true - ], - "reptile": [ - "reptile", - 8388608, - true - ], - "snake": [ - "snake", - 16777216, - true - ], - "dragon": [ - "dragon", - 33554432, - true - ], - "amphibian": [ - "amphibian", - 67108864, - true - ], - "fish": [ - "fish", - 134217728, - true - ], - "cold_blood": [ - "cold_blood", - 268435456, - true - ] -} \ No newline at end of file diff --git a/Rom24/data/group_table.json b/Rom24/data/group_table.json deleted file mode 100644 index 325e3f1..0000000 --- a/Rom24/data/group_table.json +++ /dev/null @@ -1,457 +0,0 @@ -{ - "rom basics": [ - "rom basics", - { - "cleric": 0, - "thief": 0, - "mage": 0, - "warrior": 0 - }, - [ - "scrolls", - "staves", - "wands", - "recall" - ] - ], - "mage basics": [ - "mage basics", - { - "cleric": -1, - "thief": -1, - "mage": 0, - "warrior": -1 - }, - [ - "dagger" - ] - ], - "cleric basics": [ - "cleric basics", - { - "cleric": 0, - "thief": -1, - "mage": -1, - "warrior": -1 - }, - [ - "mace" - ] - ], - "thief basics": [ - "thief basics", - { - "cleric": -1, - "thief": 0, - "mage": -1, - "warrior": -1 - }, - [ - "dagger", - "steal" - ] - ], - "warrior basics": [ - "warrior basics", - { - "cleric": -1, - "thief": -1, - "mage": -1, - "warrior": 0 - }, - [ - "sword", - "second attack" - ] - ], - "mage default": [ - "mage default", - { - "cleric": -1, - "thief": -1, - "mage": 40, - "warrior": -1 - }, - [ - "lore", - "beguiling", - "combat", - "detection", - "enhancement", - "illusion", - "maladictions", - "protective", - "transportation", - "weather" - ] - ], - "cleric default": [ - "cleric default", - { - "cleric": 40, - "thief": -1, - "mage": -1, - "warrior": -1 - }, - [ - "flail", - "attack", - "creation", - "curative", - "benedictions", - "detection", - "healing", - "maladictions", - "protective", - "shield block", - "transportation", - "weather" - ] - ], - "thief default": [ - "thief default", - { - "cleric": -1, - "thief": 40, - "mage": -1, - "warrior": -1 - }, - [ - "mace", - "sword", - "backstab", - "disarm", - "dodge", - "second attack", - "trip", - "hide", - "peek", - "pick lock", - "sneak" - ] - ], - "warrior default": [ - "warrior default", - { - "cleric": -1, - "thief": -1, - "mage": -1, - "warrior": 40 - }, - [ - "weaponsmaster", - "shield block", - "bash", - "disarm", - "enhanced damage", - "parry", - "rescue", - "third attack" - ] - ], - "weaponsmaster": [ - "weaponsmaster", - { - "cleric": 40, - "thief": 40, - "mage": 40, - "warrior": 20 - }, - [ - "axe", - "dagger", - "flail", - "mace", - "polearm", - "spear", - "sword", - "whip" - ] - ], - "attack": [ - "attack", - { - "cleric": 5, - "thief": -1, - "mage": -1, - "warrior": 8 - }, - [ - "demonfire", - "dispel evil", - "dispel good", - "earthquake", - "flamestrike", - "heat metal", - "ray of truth" - ] - ], - "beguiling": [ - "beguiling", - { - "cleric": -1, - "thief": 6, - "mage": 4, - "warrior": -1 - }, - [ - "calm", - "charm person", - "sleep" - ] - ], - "benedictions": [ - "benedictions", - { - "cleric": 4, - "thief": -1, - "mage": -1, - "warrior": 8 - }, - [ - "bless", - "calm", - "frenzy", - "holy word", - "remove curse" - ] - ], - "combat": [ - "combat", - { - "cleric": -1, - "thief": 10, - "mage": 6, - "warrior": 9 - }, - [ - "acid blast", - "burning hands", - "chain lightning", - "chill touch", - "colour spray", - "fireball", - "lightning bolt", - "magic missile", - "shocking grasp" - ] - ], - "creation": [ - "creation", - { - "cleric": 4, - "thief": 8, - "mage": 4, - "warrior": 8 - }, - [ - "continual light", - "create food", - "create spring", - "create water", - "create rose", - "floating disc" - ] - ], - "curative": [ - "curative", - { - "cleric": 4, - "thief": -1, - "mage": -1, - "warrior": 8 - }, - [ - "cure blindness", - "cure disease", - "cure poison" - ] - ], - "detection": [ - "detection", - { - "cleric": 3, - "thief": 6, - "mage": 4, - "warrior": -1 - }, - [ - "detect evil", - "detect good", - "detect hidden", - "detect invis", - "detect magic", - "detect poison", - "farsight", - "identify", - "know alignment", - "locate object" - ] - ], - "draconian": [ - "draconian", - { - "cleric": -1, - "thief": -1, - "mage": 8, - "warrior": -1 - }, - [ - "acid breath", - "fire breath", - "frost breath", - "gas breath", - "lightning breath" - ] - ], - "enchantment": [ - "enchantment", - { - "cleric": -1, - "thief": -1, - "mage": 6, - "warrior": -1 - }, - [ - "enchant armor", - "enchant weapon", - "fireproof", - "recharge" - ] - ], - "enhancement": [ - "enhancement", - { - "cleric": -1, - "thief": 9, - "mage": 5, - "warrior": 9 - }, - [ - "giant strength", - "haste", - "infravision", - "refresh" - ] - ], - "harmful": [ - "harmful", - { - "cleric": 3, - "thief": -1, - "mage": -1, - "warrior": 6 - }, - [ - "cause critical", - "cause light", - "cause serious", - "harm" - ] - ], - "healing": [ - "healing", - { - "cleric": 3, - "thief": -1, - "mage": -1, - "warrior": 6 - }, - [ - "cure critical", - "cure light", - "cure serious", - "heal", - "mass healing", - "refresh" - ] - ], - "illusion": [ - "illusion", - { - "cleric": -1, - "thief": 7, - "mage": 4, - "warrior": -1 - }, - [ - "invis", - "mass invis", - "ventriloquate" - ] - ], - "maladictions": [ - "maladictions", - { - "cleric": 5, - "thief": 9, - "mage": 5, - "warrior": 9 - }, - [ - "blindness", - "change sex", - "curse", - "energy drain", - "plague", - "poison", - "slow", - "weaken" - ] - ], - "protective": [ - "protective", - { - "cleric": 4, - "thief": 7, - "mage": 4, - "warrior": 8 - }, - [ - "armor", - "cancellation", - "dispel magic", - "fireproof", - "protection evil", - "protection good", - "sanctuary", - "shield", - "stone skin" - ] - ], - "transportation": [ - "transportation", - { - "cleric": 4, - "thief": 8, - "mage": 4, - "warrior": 9 - }, - [ - "fly", - "gate", - "nexus", - "pass door", - "portal", - "summon", - "teleport", - "word of recall" - ] - ], - "weather": [ - "weather", - { - "cleric": 4, - "thief": 8, - "mage": 4, - "warrior": 8 - }, - [ - "call lightning", - "control weather", - "faerie fire", - "faerie fog", - "lightning bolt" - ] - ] -} \ No newline at end of file diff --git a/Rom24/data/guild_table.json b/Rom24/data/guild_table.json deleted file mode 100644 index a03c19b..0000000 --- a/Rom24/data/guild_table.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "mage": [ - "mage", - "Mag", - 1, - 3701, - [ - 3018, - 9618 - ], - 75, - 20, - 6, - 6, - 8, - true, - "mage basics", - "mage default" - ], - "cleric": [ - "cleric", - "Cle", - 2, - 3700, - [ - 3003, - 9619 - ], - 75, - 20, - 2, - 7, - 10, - true, - "cleric basics", - "cleric default" - ], - "thief": [ - "thief", - "Thi", - 3, - 3701, - [ - 3028, - 9639 - ], - 75, - 20, - -4, - 8, - 13, - false, - "thief basics", - "thief default" - ], - "warrior": [ - "warrior", - "War", - 0, - 3702, - [ - 3022, - 9633 - ], - 75, - 20, - -10, - 11, - 15, - false, - "warrior basics", - "warrior default" - ] -} \ No newline at end of file diff --git a/Rom24/data/imm_flags.json b/Rom24/data/imm_flags.json deleted file mode 100644 index 0f63214..0000000 --- a/Rom24/data/imm_flags.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "summon": [ - "summon", - 1, - true - ], - "charm": [ - "charm", - 2, - true - ], - "magic": [ - "magic", - 4, - true - ], - "weapon": [ - "weapon", - 8, - true - ], - "bash": [ - "bash", - 16, - true - ], - "pierce": [ - "pierce", - 32, - true - ], - "slash": [ - "slash", - 64, - true - ], - "fire": [ - "fire", - 128, - true - ], - "cold": [ - "cold", - 256, - true - ], - "lightning": [ - "lightning", - 512, - true - ], - "acid": [ - "acid", - 1024, - true - ], - "poison": [ - "poison", - 2048, - true - ], - "negative": [ - "negative", - 4096, - true - ], - "holy": [ - "holy", - 8192, - true - ], - "energy": [ - "energy", - 16384, - true - ], - "mental": [ - "mental", - 32768, - true - ], - "disease": [ - "disease", - 65536, - true - ], - "drowning": [ - "drowning", - 131072, - true - ], - "light": [ - "light", - 262144, - true - ], - "sound": [ - "sound", - 524288, - true - ], - "wood": [ - "wood", - 8388608, - true - ], - "silver": [ - "silver", - 16777216, - true - ], - "iron": [ - "iron", - 33554432, - true - ] -} \ No newline at end of file diff --git a/Rom24/data/int_app.json b/Rom24/data/int_app.json deleted file mode 100644 index ae145b7..0000000 --- a/Rom24/data/int_app.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "0": [ - 3 - ], - "1": [ - 5 - ], - "2": [ - 7 - ], - "3": [ - 8 - ], - "4": [ - 9 - ], - "5": [ - 10 - ], - "6": [ - 11 - ], - "7": [ - 12 - ], - "8": [ - 13 - ], - "9": [ - 15 - ], - "10": [ - 17 - ], - "11": [ - 19 - ], - "12": [ - 22 - ], - "13": [ - 25 - ], - "14": [ - 28 - ], - "15": [ - 31 - ], - "16": [ - 34 - ], - "17": [ - 37 - ], - "18": [ - 40 - ], - "19": [ - 44 - ], - "20": [ - 49 - ], - "21": [ - 55 - ], - "22": [ - 60 - ], - "23": [ - 70 - ], - "24": [ - 80 - ], - "25": [ - 85 - ] -} \ No newline at end of file diff --git a/Rom24/data/liq_table.json b/Rom24/data/liq_table.json deleted file mode 100644 index 7bb3572..0000000 --- a/Rom24/data/liq_table.json +++ /dev/null @@ -1,326 +0,0 @@ -{ - "water": [ - "water", - "clear", - 0, - 1, - 10, - 0, - 16 - ], - "beer": [ - "beer", - "amber", - 12, - 1, - 8, - 1, - 12 - ], - "red wine": [ - "red wine", - "burgundy", - 30, - 1, - 8, - 1, - 5 - ], - "ale": [ - "ale", - "brown", - 15, - 1, - 8, - 1, - 12 - ], - "dark ale": [ - "dark ale", - "dark", - 16, - 1, - 8, - 1, - 12 - ], - "whisky": [ - "whisky", - "golden", - 120, - 1, - 5, - 0, - 2 - ], - "lemonade": [ - "lemonade", - "pink", - 0, - 1, - 9, - 2, - 12 - ], - "firebreather": [ - "firebreather", - "boiling", - 190, - 0, - 4, - 0, - 2 - ], - "local specialty": [ - "local specialty", - "clear", - 151, - 1, - 3, - 0, - 2 - ], - "slime mold juice": [ - "slime mold juice", - "green", - 0, - 2, - -8, - 1, - 2 - ], - "milk": [ - "milk", - "white", - 0, - 2, - 9, - 3, - 12 - ], - "tea": [ - "tea", - "tan", - 0, - 1, - 8, - 0, - 6 - ], - "coffee": [ - "coffee", - "black", - 0, - 1, - 8, - 0, - 6 - ], - "blood": [ - "blood", - "red", - 0, - 2, - -1, - 2, - 6 - ], - "salt water": [ - "salt water", - "clear", - 0, - 1, - -2, - 0, - 1 - ], - "coke": [ - "coke", - "brown", - 0, - 2, - 9, - 2, - 12 - ], - "root beer": [ - "root beer", - "brown", - 0, - 2, - 9, - 2, - 12 - ], - "elvish wine": [ - "elvish wine", - "green", - 35, - 2, - 8, - 1, - 5 - ], - "white wine": [ - "white wine", - "golden", - 28, - 1, - 8, - 1, - 5 - ], - "champagne": [ - "champagne", - "golden", - 32, - 1, - 8, - 1, - 5 - ], - "mead": [ - "mead", - "honey-colored", - 34, - 2, - 8, - 2, - 12 - ], - "rose wine": [ - "rose wine", - "pink", - 26, - 1, - 8, - 1, - 5 - ], - "benedictine wine": [ - "benedictine wine", - "burgundy", - 40, - 1, - 8, - 1, - 5 - ], - "vodka": [ - "vodka", - "clear", - 130, - 1, - 5, - 0, - 2 - ], - "cranberry juice": [ - "cranberry juice", - "red", - 0, - 1, - 9, - 2, - 12 - ], - "orange juice": [ - "orange juice", - "orange", - 0, - 2, - 9, - 3, - 12 - ], - "absinthe": [ - "absinthe", - "green", - 200, - 1, - 4, - 0, - 2 - ], - "brandy": [ - "brandy", - "golden", - 80, - 1, - 5, - 0, - 4 - ], - "aquavit": [ - "aquavit", - "clear", - 140, - 1, - 5, - 0, - 2 - ], - "schnapps": [ - "schnapps", - "clear", - 90, - 1, - 5, - 0, - 2 - ], - "icewine": [ - "icewine", - "purple", - 50, - 2, - 6, - 1, - 5 - ], - "amontillado": [ - "amontillado", - "burgundy", - 35, - 2, - 8, - 1, - 5 - ], - "sherry": [ - "sherry", - "red", - 38, - 2, - 7, - 1, - 5 - ], - "framboise": [ - "framboise", - "red", - 50, - 1, - 7, - 1, - 5 - ], - "rum": [ - "rum", - "amber", - 151, - 1, - 4, - 0, - 2 - ], - "cordial": [ - "cordial", - "clear", - 100, - 1, - 5, - 0, - 2 - ] -} \ No newline at end of file diff --git a/Rom24/data/off_flags.json b/Rom24/data/off_flags.json deleted file mode 100644 index 727ad3d..0000000 --- a/Rom24/data/off_flags.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "area_attack": [ - "area_attack", - 1, - true - ], - "backstab": [ - "backstab", - 2, - true - ], - "bash": [ - "bash", - 4, - true - ], - "berserk": [ - "berserk", - 8, - true - ], - "disarm": [ - "disarm", - 16, - true - ], - "dodge": [ - "dodge", - 32, - true - ], - "fade": [ - "fade", - 64, - true - ], - "fast": [ - "fast", - 128, - true - ], - "kick": [ - "kick", - 256, - true - ], - "dirt_kick": [ - "dirt_kick", - 512, - true - ], - "parry": [ - "parry", - 1024, - true - ], - "rescue": [ - "rescue", - 2048, - true - ], - "tail": [ - "tail", - 4096, - true - ], - "trip": [ - "trip", - 8192, - true - ], - "crush": [ - "crush", - 16384, - true - ], - "assist_all": [ - "assist_all", - 32768, - true - ], - "assist_align": [ - "assist_align", - 65536, - true - ], - "assist_race": [ - "assist_race", - 131072, - true - ], - "assist_players": [ - "assist_players", - 262144, - true - ], - "assist_guard": [ - "assist_guard", - 524288, - true - ], - "assist_vnum": [ - "assist_vnum", - 1048576, - true - ] -} \ No newline at end of file diff --git a/Rom24/data/part_flags.json b/Rom24/data/part_flags.json deleted file mode 100644 index 9299fd3..0000000 --- a/Rom24/data/part_flags.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "head": [ - "head", - 1, - true - ], - "arms": [ - "arms", - 2, - true - ], - "legs": [ - "legs", - 4, - true - ], - "heart": [ - "heart", - 8, - true - ], - "brains": [ - "brains", - 16, - true - ], - "guts": [ - "guts", - 32, - true - ], - "hands": [ - "hands", - 64, - true - ], - "feet": [ - "feet", - 128, - true - ], - "fingers": [ - "fingers", - 256, - true - ], - "ear": [ - "ear", - 512, - true - ], - "eye": [ - "eye", - 1024, - true - ], - "long_tongue": [ - "long_tongue", - 2048, - true - ], - "eyestalks": [ - "eyestalks", - 4096, - true - ], - "tentacles": [ - "tentacles", - 8192, - true - ], - "fins": [ - "fins", - 16384, - true - ], - "wings": [ - "wings", - 32768, - true - ], - "tail": [ - "tail", - 65536, - true - ], - "claws": [ - "claws", - 1048576, - true - ], - "fangs": [ - "fangs", - 2097152, - true - ], - "horns": [ - "horns", - 4194304, - true - ], - "scales": [ - "scales", - 8388608, - true - ], - "tusks": [ - "tusks", - 16777216, - true - ] -} \ No newline at end of file diff --git a/Rom24/data/pc_race_table.json b/Rom24/data/pc_race_table.json deleted file mode 100644 index 61ef6ed..0000000 --- a/Rom24/data/pc_race_table.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "human": [ - "human", - "Human", - 0, - { - "cleric": 100, - "thief": 100, - "mage": 100, - "warrior": 100 - }, - [ - "" - ], - [ - 13, - 13, - 13, - 13, - 13 - ], - [ - 18, - 18, - 18, - 18, - 18 - ], - 2 - ], - "elf": [ - "elf", - " Elf ", - 5, - { - "cleric": 125, - "thief": 100, - "mage": 100, - "warrior": 120 - }, - [ - "sneak", - "hide" - ], - [ - 12, - 14, - 13, - 15, - 11 - ], - [ - 16, - 20, - 18, - 21, - 15 - ], - 1 - ], - "dwarf": [ - "dwarf", - "Dwarf", - 8, - { - "cleric": 100, - "thief": 125, - "mage": 150, - "warrior": 100 - }, - [ - "berserk" - ], - [ - 14, - 12, - 14, - 10, - 15 - ], - [ - 20, - 16, - 19, - 14, - 21 - ], - 2 - ], - "giant": [ - "giant", - "Giant", - 6, - { - "cleric": 150, - "thief": 150, - "mage": 200, - "warrior": 105 - }, - [ - "bash", - "fast healing" - ], - [ - 16, - 11, - 13, - 11, - 14 - ], - [ - 22, - 15, - 18, - 15, - 20 - ], - 3 - ] -} \ No newline at end of file diff --git a/Rom24/data/plr_flags.json b/Rom24/data/plr_flags.json deleted file mode 100644 index 5e036d9..0000000 --- a/Rom24/data/plr_flags.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "npc": [ - "npc", - 1, - false - ], - "autoassist": [ - "autoassist", - 4, - false - ], - "autoexit": [ - "autoexit", - 8, - false - ], - "autoloot": [ - "autoloot", - 16, - false - ], - "autosac": [ - "autosac", - 32, - false - ], - "autogold": [ - "autogold", - 64, - false - ], - "autosplit": [ - "autosplit", - 128, - false - ], - "holylight": [ - "holylight", - 8192, - false - ], - "can_loot": [ - "can_loot", - 32768, - false - ], - "nosummon": [ - "nosummon", - 65536, - false - ], - "nofollow": [ - "nofollow", - 131072, - false - ], - "permit": [ - "permit", - 1048576, - true - ], - "log": [ - "log", - 4194304, - false - ], - "deny": [ - "deny", - 8388608, - false - ], - "freeze": [ - "freeze", - 16777216, - false - ], - "thief": [ - "thief", - 33554432, - false - ], - "killer": [ - "killer", - 67108864, - false - ] -} \ No newline at end of file diff --git a/Rom24/data/position_table.json b/Rom24/data/position_table.json deleted file mode 100644 index 97da107..0000000 --- a/Rom24/data/position_table.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "0": [ - "dead", - "dead" - ], - "1": [ - "mortally wounded", - "mort" - ], - "2": [ - "incapacitated", - "incap" - ], - "3": [ - "stunned", - "stun" - ], - "4": [ - "sleeping", - "sleep" - ], - "5": [ - "resting", - "rest" - ], - "6": [ - "sitting", - "sit" - ], - "7": [ - "fighting", - "fight" - ], - "8": [ - "standing", - "stand" - ] -} \ No newline at end of file diff --git a/Rom24/data/race_table.json b/Rom24/data/race_table.json deleted file mode 100644 index 9f660a8..0000000 --- a/Rom24/data/race_table.json +++ /dev/null @@ -1,350 +0,0 @@ -{ - "unique": [ - "unique", - false, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "human": [ - "human", - true, - 0, - 0, - 0, - 0, - 0, - 0, - 2101377, - 2047 - ], - "elf": [ - "elf", - true, - 0, - 512, - 0, - 0, - 2, - 33554432, - 2101377, - 2047 - ], - "dwarf": [ - "dwarf", - true, - 0, - 512, - 0, - 0, - 67584, - 131072, - 2101377, - 2047 - ], - "giant": [ - "giant", - true, - 0, - 0, - 0, - 0, - 384, - 33280, - 2101377, - 2047 - ], - "bat": [ - "bat", - false, - 0, - 34078720, - 160, - 0, - 0, - 262144, - 2097217, - 34493 - ], - "bear": [ - "bear", - false, - 0, - 0, - 16408, - 0, - 272, - 0, - 2097217, - 3147455 - ], - "cat": [ - "cat", - false, - 0, - 33554432, - 160, - 0, - 0, - 0, - 2097217, - 3212989 - ], - "centipede": [ - "centipede", - false, - 0, - 33554432, - 0, - 0, - 288, - 16, - 16451, - 1029 - ], - "dog": [ - "dog", - false, - 0, - 0, - 128, - 0, - 0, - 0, - 2097217, - 3147453 - ], - "doll": [ - "doll", - false, - 0, - 0, - 0, - 243968, - 262160, - 18112, - 268440080, - 1223 - ], - "dragon": [ - "dragon", - false, - 0, - 524800, - 0, - 0, - 146, - 288, - 33554561, - 11634685 - ], - "fido": [ - "fido", - false, - 0, - 0, - 131104, - 0, - 0, - 4, - 2097219, - 2164413 - ], - "fox": [ - "fox", - false, - 0, - 33554432, - 160, - 0, - 0, - 0, - 2097217, - 2164413 - ], - "goblin": [ - "goblin", - false, - 0, - 512, - 0, - 0, - 65536, - 4, - 2101377, - 2047 - ], - "hobgoblin": [ - "hobgoblin", - false, - 0, - 512, - 0, - 0, - 67584, - 0, - 2101377, - 16779263 - ], - "kobold": [ - "kobold", - false, - 0, - 512, - 0, - 0, - 2048, - 4, - 2101379, - 67583 - ], - "lizard": [ - "lizard", - false, - 0, - 0, - 0, - 0, - 2048, - 256, - 276824129, - 2163901 - ], - "modron": [ - "modron", - false, - 0, - 512, - 196608, - 110594, - 1408, - 0, - 128, - 1735 - ], - "orc": [ - "orc", - false, - 0, - 512, - 0, - 0, - 65536, - 262144, - 2101377, - 2047 - ], - "pig": [ - "pig", - false, - 0, - 0, - 0, - 0, - 0, - 0, - 2097217, - 1725 - ], - "rabbit": [ - "rabbit", - false, - 0, - 0, - 160, - 0, - 0, - 0, - 2097217, - 1725 - ], - "school monster": [ - "school monster", - false, - 1048576, - 0, - 0, - 3, - 0, - 4, - 2101249, - 1115839 - ], - "snake": [ - "snake", - false, - 0, - 0, - 0, - 0, - 2048, - 256, - 293601345, - 10554425 - ], - "song bird": [ - "song bird", - false, - 0, - 524288, - 160, - 0, - 0, - 0, - 4194369, - 33981 - ], - "troll": [ - "troll", - false, - 0, - 268436000, - 8, - 0, - 18, - 1152, - 2101379, - 3147775 - ], - "water fowl": [ - "water fowl", - false, - 0, - 134742016, - 0, - 0, - 131072, - 0, - 4194369, - 33981 - ], - "wolf": [ - "wolf", - false, - 0, - 33554432, - 160, - 0, - 0, - 0, - 2097217, - 2164285 - ], - "wyvern": [ - "wyvern", - false, - 0, - 524328, - 164, - 2048, - 0, - 262144, - 33554499, - 10553021 - ] -} \ No newline at end of file diff --git a/Rom24/data/sex_table.json b/Rom24/data/sex_table.json deleted file mode 100644 index 97e8894..0000000 --- a/Rom24/data/sex_table.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "1": "male", - "2": "female", - "0": "either" -} \ No newline at end of file diff --git a/Rom24/data/size_table.json b/Rom24/data/size_table.json deleted file mode 100644 index 883a797..0000000 --- a/Rom24/data/size_table.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "tiny", - "small", - "medium", - "large", - "huge", - "giant" -] \ No newline at end of file diff --git a/Rom24/data/skill_table.json b/Rom24/data/skill_table.json deleted file mode 100644 index 9209202..0000000 --- a/Rom24/data/skill_table.json +++ /dev/null @@ -1,952 +0,0 @@ -{ - "mace": [ - "mace", - { - "cleric": 1, - "thief": 1, - "mage": 1, - "warrior": 1 - }, - { - "cleric": 2, - "thief": 3, - "mage": 5, - "warrior": 3 - }, - null, - 0, - 7, - null, - 0, - 0, - 0, - "", - "!Mace!", - "" - ], - "axe": [ - "axe", - { - "cleric": 1, - "thief": 1, - "mage": 1, - "warrior": 1 - }, - { - "cleric": 6, - "thief": 5, - "mage": 6, - "warrior": 4 - }, - null, - 0, - 7, - null, - 0, - 0, - 0, - "", - "!Axe!", - "" - ], - "trip": [ - "trip", - { - "cleric": 53, - "thief": 1, - "mage": 53, - "warrior": 15 - }, - { - "cleric": 0, - "thief": 4, - "mage": 0, - "warrior": 8 - }, - null, - 0, - 7, - null, - 0, - 0, - 24, - "trip", - "!Trip!", - "" - ], - "backstab": [ - "backstab", - { - "cleric": 53, - "thief": 1, - "mage": 53, - "warrior": 53 - }, - { - "cleric": 0, - "thief": 5, - "mage": 0, - "warrior": 0 - }, - null, - 0, - 8, - null, - 0, - 0, - 24, - "backstab", - "!Backstab!", - "" - ], - "envenom": [ - "envenom", - { - "cleric": 53, - "thief": 10, - "mage": 53, - "warrior": 53 - }, - { - "cleric": 0, - "thief": 4, - "mage": 0, - "warrior": 0 - }, - null, - 0, - 5, - null, - 0, - 0, - 36, - "", - "!Envenom!", - "" - ], - "steal": [ - "steal", - { - "cleric": 53, - "thief": 5, - "mage": 53, - "warrior": 53 - }, - { - "cleric": 0, - "thief": 4, - "mage": 0, - "warrior": 0 - }, - null, - 0, - 8, - null, - 0, - 0, - 24, - "", - "!Steal!", - "" - ], - "fast healing": [ - "fast healing", - { - "cleric": 9, - "thief": 16, - "mage": 15, - "warrior": 6 - }, - { - "cleric": 5, - "thief": 6, - "mage": 8, - "warrior": 4 - }, - null, - 0, - 4, - null, - 0, - 0, - 0, - "", - "!Fast Healing!", - "" - ], - "wands": [ - "wands", - { - "cleric": 1, - "thief": 1, - "mage": 1, - "warrior": 1 - }, - { - "cleric": 3, - "thief": 5, - "mage": 2, - "warrior": 8 - }, - null, - 0, - 8, - null, - 0, - 0, - 12, - "", - "!Wands!", - "" - ], - "dodge": [ - "dodge", - { - "cleric": 22, - "thief": 1, - "mage": 20, - "warrior": 13 - }, - { - "cleric": 8, - "thief": 4, - "mage": 8, - "warrior": 6 - }, - null, - 0, - 7, - null, - 0, - 0, - 0, - "", - "!Dodge!", - "" - ], - "peek": [ - "peek", - { - "cleric": 21, - "thief": 1, - "mage": 8, - "warrior": 14 - }, - { - "cleric": 7, - "thief": 3, - "mage": 5, - "warrior": 6 - }, - null, - 0, - 8, - null, - 0, - 0, - 0, - "", - "!Peek!", - "" - ], - "polearm": [ - "polearm", - { - "cleric": 1, - "thief": 1, - "mage": 1, - "warrior": 1 - }, - { - "cleric": 6, - "thief": 6, - "mage": 6, - "warrior": 4 - }, - null, - 0, - 7, - null, - 0, - 0, - 0, - "", - "!Polearm!", - "" - ], - "recall": [ - "recall", - { - "cleric": 1, - "thief": 1, - "mage": 1, - "warrior": 1 - }, - { - "cleric": 2, - "thief": 2, - "mage": 2, - "warrior": 2 - }, - null, - 0, - 8, - null, - 0, - 0, - 12, - "", - "!Recall!", - "" - ], - "dagger": [ - "dagger", - { - "cleric": 1, - "thief": 1, - "mage": 1, - "warrior": 1 - }, - { - "cleric": 3, - "thief": 2, - "mage": 2, - "warrior": 2 - }, - null, - 0, - 7, - null, - 0, - 0, - 0, - "", - "!Dagger!", - "" - ], - "haggle": [ - "haggle", - { - "cleric": 18, - "thief": 1, - "mage": 7, - "warrior": 14 - }, - { - "cleric": 8, - "thief": 3, - "mage": 5, - "warrior": 6 - }, - null, - 0, - 5, - null, - 0, - 0, - 0, - "", - "!Haggle!", - "" - ], - "lore": [ - "lore", - { - "cleric": 10, - "thief": 6, - "mage": 10, - "warrior": 20 - }, - { - "cleric": 6, - "thief": 4, - "mage": 6, - "warrior": 8 - }, - null, - 0, - 5, - null, - 0, - 0, - 36, - "", - "!Lore!", - "" - ], - "third attack": [ - "third attack", - { - "cleric": 53, - "thief": 24, - "mage": 53, - "warrior": 12 - }, - { - "cleric": 0, - "thief": 10, - "mage": 0, - "warrior": 4 - }, - null, - 0, - 7, - null, - 0, - 0, - 0, - "", - "!Third Attack!", - "" - ], - "reserved": [ - "reserved", - { - "cleric": 99, - "thief": 99, - "mage": 99, - "warrior": 99 - }, - { - "cleric": 99, - "thief": 99, - "mage": 99, - "warrior": 99 - }, - null, - 0, - 8, - null, - 0, - 0, - 0, - "", - "", - "" - ], - "dirt kicking": [ - "dirt kicking", - { - "cleric": 53, - "thief": 3, - "mage": 53, - "warrior": 3 - }, - { - "cleric": 0, - "thief": 4, - "mage": 0, - "warrior": 4 - }, - null, - 0, - 7, - null, - 0, - 0, - 24, - "kicked dirt", - "You rub the dirt out of your eyes.", - "" - ], - "kick": [ - "kick", - { - "cleric": 12, - "thief": 14, - "mage": 53, - "warrior": 8 - }, - { - "cleric": 4, - "thief": 6, - "mage": 0, - "warrior": 3 - }, - null, - 1, - 7, - null, - 0, - 0, - 12, - "kick", - "!Kick!", - "" - ], - "hand to hand": [ - "hand to hand", - { - "cleric": 10, - "thief": 15, - "mage": 25, - "warrior": 6 - }, - { - "cleric": 5, - "thief": 6, - "mage": 8, - "warrior": 4 - }, - null, - 0, - 7, - null, - 0, - 0, - 0, - "", - "!Hand to Hand!", - "" - ], - "rescue": [ - "rescue", - { - "cleric": 53, - "thief": 53, - "mage": 53, - "warrior": 1 - }, - { - "cleric": 0, - "thief": 0, - "mage": 0, - "warrior": 4 - }, - null, - 0, - 7, - null, - 0, - 0, - 12, - "", - "!Rescue!", - "" - ], - "second attack": [ - "second attack", - { - "cleric": 24, - "thief": 12, - "mage": 30, - "warrior": 5 - }, - { - "cleric": 8, - "thief": 5, - "mage": 10, - "warrior": 3 - }, - null, - 0, - 7, - null, - 0, - 0, - 0, - "", - "!Second Attack!", - "" - ], - "parry": [ - "parry", - { - "cleric": 20, - "thief": 13, - "mage": 22, - "warrior": 1 - }, - { - "cleric": 8, - "thief": 6, - "mage": 8, - "warrior": 4 - }, - null, - 0, - 7, - null, - 0, - 0, - 0, - "", - "!Parry!", - "" - ], - "shield block": [ - "shield block", - { - "cleric": 1, - "thief": 1, - "mage": 1, - "warrior": 1 - }, - { - "cleric": 4, - "thief": 6, - "mage": 6, - "warrior": 2 - }, - null, - 0, - 7, - null, - 0, - 0, - 0, - "", - "!Shield!", - "" - ], - "spear": [ - "spear", - { - "cleric": 1, - "thief": 1, - "mage": 1, - "warrior": 1 - }, - { - "cleric": 4, - "thief": 4, - "mage": 4, - "warrior": 3 - }, - null, - 0, - 7, - null, - 0, - 0, - 0, - "", - "!Spear!", - "" - ], - "disarm": [ - "disarm", - { - "cleric": 53, - "thief": 12, - "mage": 53, - "warrior": 11 - }, - { - "cleric": 0, - "thief": 6, - "mage": 0, - "warrior": 4 - }, - null, - 0, - 7, - null, - 0, - 0, - 24, - "", - "!Disarm!", - "" - ], - "sword": [ - "sword", - { - "cleric": 1, - "thief": 1, - "mage": 1, - "warrior": 1 - }, - { - "cleric": 6, - "thief": 3, - "mage": 5, - "warrior": 2 - }, - null, - 0, - 7, - null, - 0, - 0, - 0, - "", - "!sword!", - "" - ], - "pick lock": [ - "pick lock", - { - "cleric": 25, - "thief": 7, - "mage": 25, - "warrior": 25 - }, - { - "cleric": 8, - "thief": 4, - "mage": 8, - "warrior": 8 - }, - null, - 0, - 8, - null, - 0, - 0, - 12, - "", - "!Pick!", - "" - ], - "meditation": [ - "meditation", - { - "cleric": 6, - "thief": 15, - "mage": 6, - "warrior": 15 - }, - { - "cleric": 5, - "thief": 8, - "mage": 5, - "warrior": 8 - }, - null, - 0, - 4, - null, - 0, - 0, - 0, - "", - "Meditation", - "" - ], - "whip": [ - "whip", - { - "cleric": 1, - "thief": 1, - "mage": 1, - "warrior": 1 - }, - { - "cleric": 5, - "thief": 5, - "mage": 6, - "warrior": 4 - }, - null, - 0, - 7, - null, - 0, - 0, - 0, - "", - "!Whip!", - "" - ], - "flail": [ - "flail", - { - "cleric": 1, - "thief": 1, - "mage": 1, - "warrior": 1 - }, - { - "cleric": 3, - "thief": 6, - "mage": 6, - "warrior": 4 - }, - null, - 0, - 7, - null, - 0, - 0, - 0, - "", - "!Flail!", - "" - ], - "scrolls": [ - "scrolls", - { - "cleric": 1, - "thief": 1, - "mage": 1, - "warrior": 1 - }, - { - "cleric": 3, - "thief": 5, - "mage": 2, - "warrior": 8 - }, - null, - 0, - 8, - null, - 0, - 0, - 24, - "", - "!Scrolls!", - "" - ], - "enhanced damage": [ - "enhanced damage", - { - "cleric": 30, - "thief": 25, - "mage": 45, - "warrior": 1 - }, - { - "cleric": 9, - "thief": 5, - "mage": 10, - "warrior": 3 - }, - null, - 0, - 7, - null, - 0, - 0, - 0, - "", - "!Enhanced Damage!", - "" - ], - "berserk": [ - "berserk", - { - "cleric": 53, - "thief": 53, - "mage": 53, - "warrior": 18 - }, - { - "cleric": 0, - "thief": 0, - "mage": 0, - "warrior": 5 - }, - null, - 0, - 7, - null, - 0, - 0, - 24, - "", - "You feel your pulse slow down.", - "" - ], - "staves": [ - "staves", - { - "cleric": 1, - "thief": 1, - "mage": 1, - "warrior": 1 - }, - { - "cleric": 3, - "thief": 5, - "mage": 2, - "warrior": 8 - }, - null, - 0, - 8, - null, - 0, - 0, - 12, - "", - "!Staves!", - "" - ], - "sneak": [ - "sneak", - { - "cleric": 53, - "thief": 4, - "mage": 53, - "warrior": 10 - }, - { - "cleric": 0, - "thief": 4, - "mage": 0, - "warrior": 6 - }, - null, - 0, - 8, - null, - 0, - 0, - 12, - "", - "You no longer feel stealthy.", - "" - ], - "bash": [ - "bash", - { - "cleric": 53, - "thief": 53, - "mage": 53, - "warrior": 1 - }, - { - "cleric": 0, - "thief": 0, - "mage": 0, - "warrior": 4 - }, - null, - 0, - 7, - null, - 0, - 0, - 24, - "bash", - "!Bash!", - "" - ], - "hide": [ - "hide", - { - "cleric": 53, - "thief": 1, - "mage": 53, - "warrior": 12 - }, - { - "cleric": 0, - "thief": 4, - "mage": 0, - "warrior": 6 - }, - null, - 0, - 5, - null, - 0, - 0, - 12, - "", - "!Hide!", - "" - ] -} \ No newline at end of file diff --git a/Rom24/data/str_app.json b/Rom24/data/str_app.json deleted file mode 100644 index 7596add..0000000 --- a/Rom24/data/str_app.json +++ /dev/null @@ -1,158 +0,0 @@ -{ - "0": [ - -5, - -4, - 0, - 0 - ], - "1": [ - -5, - -4, - 3, - 1 - ], - "2": [ - -3, - -2, - 3, - 2 - ], - "3": [ - -3, - -1, - 10, - 3 - ], - "4": [ - -2, - -1, - 25, - 4 - ], - "5": [ - -2, - -1, - 55, - 5 - ], - "6": [ - -1, - 0, - 80, - 6 - ], - "7": [ - -1, - 0, - 90, - 7 - ], - "8": [ - 0, - 0, - 100, - 8 - ], - "9": [ - 0, - 0, - 100, - 9 - ], - "10": [ - 0, - 0, - 115, - 10 - ], - "11": [ - 0, - 0, - 115, - 11 - ], - "12": [ - 0, - 0, - 130, - 12 - ], - "13": [ - 0, - 0, - 130, - 13 - ], - "14": [ - 0, - 1, - 140, - 14 - ], - "15": [ - 1, - 1, - 150, - 15 - ], - "16": [ - 1, - 2, - 165, - 16 - ], - "17": [ - 2, - 3, - 180, - 22 - ], - "18": [ - 2, - 3, - 200, - 25 - ], - "19": [ - 3, - 4, - 225, - 30 - ], - "20": [ - 3, - 5, - 250, - 35 - ], - "21": [ - 4, - 6, - 300, - 40 - ], - "22": [ - 4, - 6, - 350, - 45 - ], - "23": [ - 5, - 7, - 400, - 50 - ], - "24": [ - 5, - 8, - 450, - 55 - ], - "25": [ - 6, - 9, - 500, - 60 - ] -} \ No newline at end of file diff --git a/Rom24/data/title_table.json b/Rom24/data/title_table.json deleted file mode 100644 index 7875bfc..0000000 --- a/Rom24/data/title_table.json +++ /dev/null @@ -1,986 +0,0 @@ -{ - "cleric": [ - [ - "Man", - "Woman" - ], - [ - "Believer", - "Believer" - ], - [ - "Attendant", - "Attendant" - ], - [ - "Acolyte", - "Acolyte" - ], - [ - "Novice", - "Novice" - ], - [ - "Missionary", - "Missionary" - ], - [ - "Adept", - "Adept" - ], - [ - "Deacon", - "Deaconess" - ], - [ - "Vicar", - "Vicaress" - ], - [ - "Priest", - "Priestess" - ], - [ - "Minister", - "Lady Minister" - ], - [ - "Canon", - "Canon" - ], - [ - "Levite", - "Levitess" - ], - [ - "Curate", - "Curess" - ], - [ - "Monk", - "Nun" - ], - [ - "Healer", - "Healess" - ], - [ - "Chaplain", - "Chaplain" - ], - [ - "Expositor", - "Expositress" - ], - [ - "Bishop", - "Bishop" - ], - [ - "Arch Bishop", - "Arch Lady of the Church" - ], - [ - "Patriarch", - "Matriarch" - ], - [ - "Elder Patriarch", - "Elder Matriarch" - ], - [ - "Grand Patriarch", - "Grand Matriarch" - ], - [ - "Great Patriarch", - "Great Matriarch" - ], - [ - "Demon Killer", - "Demon Killer" - ], - [ - "Greater Demon Killer", - "Greater Demon Killer" - ], - [ - "Cardinal of the Sea", - "Cardinal of the Sea" - ], - [ - "Cardinal of the Earth", - "Cardinal of the Earth" - ], - [ - "Cardinal of the Air", - "Cardinal of the Air" - ], - [ - "Cardinal of the Ether", - "Cardinal of the Ether" - ], - [ - "Cardinal of the Heavens", - "Cardinal of the Heavens" - ], - [ - "Avatar of an Immortal", - "Avatar of an Immortal" - ], - [ - "Avatar of a Deity", - "Avatar of a Deity" - ], - [ - "Avatar of a Supremity", - "Avatar of a Supremity" - ], - [ - "Avatar of an Implementor", - "Avatar of an Implementor" - ], - [ - "Master of all Divinity", - "Mistress of all Divinity" - ], - [ - "Master Cleric", - "Master Cleric" - ], - [ - "Master Cleric", - "Master Cleric" - ], - [ - "Master Cleric", - "Master Cleric" - ], - [ - "Master Cleric", - "Master Cleric" - ], - [ - "Master Cleric", - "Master Cleric" - ], - [ - "Master Cleric", - "Master Cleric" - ], - [ - "Master Cleric", - "Master Cleric" - ], - [ - "Master Cleric", - "Master Cleric" - ], - [ - "Master Cleric", - "Master Cleric" - ], - [ - "Master Cleric", - "Master Cleric" - ], - [ - "Master Cleric", - "Master Cleric" - ], - [ - "Master Cleric", - "Master Cleric" - ], - [ - "Master Cleric", - "Master Cleric" - ], - [ - "Master Cleric", - "Master Cleric" - ], - [ - "Master Cleric", - "Master Cleric" - ], - [ - "Holy Hero", - "Holy Heroine" - ], - [ - "Holy Avatar", - "Holy Avatar" - ], - [ - "Angel", - "Angel" - ], - [ - "Demigod", - "Demigoddess" - ], - [ - "Immortal", - "Immortal" - ], - [ - "God", - "Goddess" - ], - [ - "Deity", - "Deity" - ], - [ - "Supreme Master", - "Supreme Mistress" - ], - [ - "Creator", - "Creator" - ], - [ - "Implementor", - "Implementress" - ] - ], - "thief": [ - [ - "Man", - "Woman" - ], - [ - "Pilferer", - "Pilferess" - ], - [ - "Footpad", - "Footpad" - ], - [ - "Filcher", - "Filcheress" - ], - [ - "Pick-Pocket", - "Pick-Pocket" - ], - [ - "Sneak", - "Sneak" - ], - [ - "Pincher", - "Pincheress" - ], - [ - "Cut-Purse", - "Cut-Purse" - ], - [ - "Snatcher", - "Snatcheress" - ], - [ - "Sharper", - "Sharpress" - ], - [ - "Rogue", - "Rogue" - ], - [ - "Robber", - "Robber" - ], - [ - "Magsman", - "Magswoman" - ], - [ - "Highwayman", - "Highwaywoman" - ], - [ - "Burglar", - "Burglaress" - ], - [ - "Thief", - "Thief" - ], - [ - "Knifer", - "Knifer" - ], - [ - "Quick-Blade", - "Quick-Blade" - ], - [ - "Killer", - "Murderess" - ], - [ - "Brigand", - "Brigand" - ], - [ - "Cut-Throat", - "Cut-Throat" - ], - [ - "Spy", - "Spy" - ], - [ - "Grand Spy", - "Grand Spy" - ], - [ - "Master Spy", - "Master Spy" - ], - [ - "Assassin", - "Assassin" - ], - [ - "Greater Assassin", - "Greater Assassin" - ], - [ - "Master of Vision", - "Mistress of Vision" - ], - [ - "Master of Hearing", - "Mistress of Hearing" - ], - [ - "Master of Smell", - "Mistress of Smell" - ], - [ - "Master of Taste", - "Mistress of Taste" - ], - [ - "Master of Touch", - "Mistress of Touch" - ], - [ - "Crime Lord", - "Crime Mistress" - ], - [ - "Infamous Crime Lord", - "Infamous Crime Mistress" - ], - [ - "Greater Crime Lord", - "Greater Crime Mistress" - ], - [ - "Master Crime Lord", - "Master Crime Mistress" - ], - [ - "Godfather", - "Godmother" - ], - [ - "Master Thief", - "Master Thief" - ], - [ - "Master Thief", - "Master Thief" - ], - [ - "Master Thief", - "Master Thief" - ], - [ - "Master Thief", - "Master Thief" - ], - [ - "Master Thief", - "Master Thief" - ], - [ - "Master Thief", - "Master Thief" - ], - [ - "Master Thief", - "Master Thief" - ], - [ - "Master Thief", - "Master Thief" - ], - [ - "Master Thief", - "Master Thief" - ], - [ - "Master Thief", - "Master Thief" - ], - [ - "Master Thief", - "Master Thief" - ], - [ - "Master Thief", - "Master Thief" - ], - [ - "Master Thief", - "Master Thief" - ], - [ - "Master Thief", - "Master Thief" - ], - [ - "Master Thief", - "Master Thief" - ], - [ - "Assassin Hero", - "Assassin Heroine" - ], - [ - "Avatar of Death", - "Avatar of Death" - ], - [ - "Angel of Death", - "Angel of Death" - ], - [ - "Demigod of Assassins", - "Demigoddess of Assassins" - ], - [ - "Immortal Assasin", - "Immortal Assassin" - ], - [ - "God of Assassins", - "God of Assassins" - ], - [ - "Deity of Assassins", - "Deity of Assassins" - ], - [ - "Supreme Master", - "Supreme Mistress" - ], - [ - "Creator", - "Creator" - ], - [ - "Implementor", - "Implementress" - ] - ], - "mage": [ - [ - "Man", - "Woman" - ], - [ - "Apprentice of Magic", - "Apprentice of Magic" - ], - [ - "Spell Student", - "Spell Student" - ], - [ - "Scholar of Magic", - "Scholar of Magic" - ], - [ - "Delver in Spells", - "Delveress in Spells" - ], - [ - "Medium of Magic", - "Medium of Magic" - ], - [ - "Scribe of Magic", - "Scribess of Magic" - ], - [ - "Seer", - "Seeress" - ], - [ - "Sage", - "Sage" - ], - [ - "Illusionist", - "Illusionist" - ], - [ - "Abjurer", - "Abjuress" - ], - [ - "Invoker", - "Invoker" - ], - [ - "Enchanter", - "Enchantress" - ], - [ - "Conjurer", - "Conjuress" - ], - [ - "Magician", - "Witch" - ], - [ - "Creator", - "Creator" - ], - [ - "Savant", - "Savant" - ], - [ - "Magus", - "Craftess" - ], - [ - "Wizard", - "Wizard" - ], - [ - "Warlock", - "War Witch" - ], - [ - "Sorcerer", - "Sorceress" - ], - [ - "Elder Sorcerer", - "Elder Sorceress" - ], - [ - "Grand Sorcerer", - "Grand Sorceress" - ], - [ - "Great Sorcerer", - "Great Sorceress" - ], - [ - "Golem Maker", - "Golem Maker" - ], - [ - "Greater Golem Maker", - "Greater Golem Maker" - ], - [ - "Maker of Stones", - "Maker of Stones" - ], - [ - "Maker of Potions", - "Maker of Potions" - ], - [ - "Maker of Scrolls", - "Maker of Scrolls" - ], - [ - "Maker of Wands", - "Maker of Wands" - ], - [ - "Maker of Staves", - "Maker of Staves" - ], - [ - "Demon Summoner", - "Demon Summoner" - ], - [ - "Greater Demon Summoner", - "Greater Demon Summoner" - ], - [ - "Dragon Charmer", - "Dragon Charmer" - ], - [ - "Greater Dragon Charmer", - "Greater Dragon Charmer" - ], - [ - "Master of all Magic", - "Master of all Magic" - ], - [ - "Master Mage", - "Master Mage" - ], - [ - "Master Mage", - "Master Mage" - ], - [ - "Master Mage", - "Master Mage" - ], - [ - "Master Mage", - "Master Mage" - ], - [ - "Master Mage", - "Master Mage" - ], - [ - "Master Mage", - "Master Mage" - ], - [ - "Master Mage", - "Master Mage" - ], - [ - "Master Mage", - "Master Mage" - ], - [ - "Master Mage", - "Master Mage" - ], - [ - "Master Mage", - "Master Mage" - ], - [ - "Master Mage", - "Master Mage" - ], - [ - "Master Mage", - "Master Mage" - ], - [ - "Master Mage", - "Master Mage" - ], - [ - "Master Mage", - "Master Mage" - ], - [ - "Master Mage", - "Master Mage" - ], - [ - "Mage Hero", - "Mage Heroine" - ], - [ - "Avatar of Magic", - "Avatar of Magic" - ], - [ - "Angel of Magic", - "Angel of Magic" - ], - [ - "Demigod of Magic", - "Demigoddess of Magic" - ], - [ - "Immortal of Magic", - "Immortal of Magic" - ], - [ - "God of Magic", - "Goddess of Magic" - ], - [ - "Deity of Magic", - "Deity of Magic" - ], - [ - "Supremity of Magic", - "Supremity of Magic" - ], - [ - "Creator", - "Creator" - ], - [ - "Implementor", - "Implementress" - ] - ], - "warrior": [ - [ - "Man", - "Woman" - ], - [ - "Swordpupil", - "Swordpupil" - ], - [ - "Recruit", - "Recruit" - ], - [ - "Sentry", - "Sentress" - ], - [ - "Fighter", - "Fighter" - ], - [ - "Soldier", - "Soldier" - ], - [ - "Warrior", - "Warrior" - ], - [ - "Veteran", - "Veteran" - ], - [ - "Swordsman", - "Swordswoman" - ], - [ - "Fencer", - "Fenceress" - ], - [ - "Combatant", - "Combatess" - ], - [ - "Hero", - "Heroine" - ], - [ - "Myrmidon", - "Myrmidon" - ], - [ - "Swashbuckler", - "Swashbuckleress" - ], - [ - "Mercenary", - "Mercenaress" - ], - [ - "Swordmaster", - "Swordmistress" - ], - [ - "Lieutenant", - "Lieutenant" - ], - [ - "Champion", - "Lady Champion" - ], - [ - "Dragoon", - "Lady Dragoon" - ], - [ - "Cavalier", - "Lady Cavalier" - ], - [ - "Knight", - "Lady Knight" - ], - [ - "Grand Knight", - "Grand Knight" - ], - [ - "Master Knight", - "Master Knight" - ], - [ - "Paladin", - "Paladin" - ], - [ - "Grand Paladin", - "Grand Paladin" - ], - [ - "Demon Slayer", - "Demon Slayer" - ], - [ - "Greater Demon Slayer", - "Greater Demon Slayer" - ], - [ - "Dragon Slayer", - "Dragon Slayer" - ], - [ - "Greater Dragon Slayer", - "Greater Dragon Slayer" - ], - [ - "Underlord", - "Underlord" - ], - [ - "Overlord", - "Overlord" - ], - [ - "Baron of Thunder", - "Baroness of Thunder" - ], - [ - "Baron of Storms", - "Baroness of Storms" - ], - [ - "Baron of Tornadoes", - "Baroness of Tornadoes" - ], - [ - "Baron of Hurricanes", - "Baroness of Hurricanes" - ], - [ - "Baron of Meteors", - "Baroness of Meteors" - ], - [ - "Master Warrior", - "Master Warrior" - ], - [ - "Master Warrior", - "Master Warrior" - ], - [ - "Master Warrior", - "Master Warrior" - ], - [ - "Master Warrior", - "Master Warrior" - ], - [ - "Master Warrior", - "Master Warrior" - ], - [ - "Master Warrior", - "Master Warrior" - ], - [ - "Master Warrior", - "Master Warrior" - ], - [ - "Master Warrior", - "Master Warrior" - ], - [ - "Master Warrior", - "Master Warrior" - ], - [ - "Master Warrior", - "Master Warrior" - ], - [ - "Master Warrior", - "Master Warrior" - ], - [ - "Master Warrior", - "Master Warrior" - ], - [ - "Master Warrior", - "Master Warrior" - ], - [ - "Master Warrior", - "Master Warrior" - ], - [ - "Master Warrior", - "Master Warrior" - ], - [ - "Knight Hero", - "Knight Heroine" - ], - [ - "Avatar of War", - "Avatar of War" - ], - [ - "Angel of War", - "Angel of War" - ], - [ - "Demigod of War", - "Demigoddess of War" - ], - [ - "Immortal Warlord", - "Immortal Warlord" - ], - [ - "God of War", - "God of War" - ], - [ - "Deity of War", - "Deity of War" - ], - [ - "Supreme Master of War", - "Supreme Mistress of War" - ], - [ - "Creator", - "Creator" - ], - [ - "Implementor", - "Implementress" - ] - ] -} \ No newline at end of file diff --git a/Rom24/data/weapon_table.json b/Rom24/data/weapon_table.json deleted file mode 100644 index 37a2357..0000000 --- a/Rom24/data/weapon_table.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "sword": [ - "sword", - 3702, - 1, - "sword" - ], - "mace": [ - "mace", - 3700, - 4, - "mace" - ], - "dagger": [ - "dagger", - 3701, - 2, - "dagger" - ], - "axe": [ - "axe", - 3719, - 5, - "axe" - ], - "staff": [ - "staff", - 3718, - 3, - "spear" - ], - "flail": [ - "flail", - 3720, - 6, - "flail" - ], - "whip": [ - "whip", - 3721, - 7, - "whip" - ], - "polearm": [ - "polearm", - 3722, - 8, - "polearm" - ] -} \ No newline at end of file diff --git a/Rom24/data/wis_app.json b/Rom24/data/wis_app.json deleted file mode 100644 index cc8fd07..0000000 --- a/Rom24/data/wis_app.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "0": [ - 0 - ], - "1": [ - 0 - ], - "2": [ - 0 - ], - "3": [ - 0 - ], - "4": [ - 0 - ], - "5": [ - 1 - ], - "6": [ - 1 - ], - "7": [ - 1 - ], - "8": [ - 1 - ], - "9": [ - 1 - ], - "10": [ - 1 - ], - "11": [ - 1 - ], - "12": [ - 1 - ], - "13": [ - 1 - ], - "14": [ - 1 - ], - "15": [ - 2 - ], - "16": [ - 2 - ], - "17": [ - 2 - ], - "18": [ - 3 - ], - "19": [ - 3 - ], - "20": [ - 3 - ], - "21": [ - 3 - ], - "22": [ - 4 - ], - "23": [ - 4 - ], - "24": [ - 4 - ], - "25": [ - 5 - ] -} \ No newline at end of file diff --git a/Rom24/data/wiznet_table.json b/Rom24/data/wiznet_table.json deleted file mode 100644 index ddbc256..0000000 --- a/Rom24/data/wiznet_table.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "on": [ - "on", - 1, - 52 - ], - "prefix": [ - "prefix", - 262144, - 52 - ], - "ticks": [ - "ticks", - 2, - 52 - ], - "logins": [ - "logins", - 4, - 52 - ], - "sites": [ - "sites", - 8, - 56 - ], - "links": [ - "links", - 16, - 53 - ], - "newbies": [ - "newbies", - 131072, - 52 - ], - "spam": [ - "spam", - 524288, - 55 - ], - "deaths": [ - "deaths", - 32, - 52 - ], - "resets": [ - "resets", - 64, - 56 - ], - "mobdeaths": [ - "mobdeaths", - 128, - 56 - ], - "flags": [ - "flags", - 256, - 55 - ], - "penalties": [ - "penalties", - 512, - 55 - ], - "saccing": [ - "saccing", - 1024, - 55 - ], - "levels": [ - "levels", - 2048, - 52 - ], - "load": [ - "load", - 65536, - 58 - ], - "restore": [ - "restore", - 32768, - 58 - ], - "snoops": [ - "snoops", - 16384, - 58 - ], - "switches": [ - "switches", - 8192, - 58 - ], - "secure": [ - "secure", - 4096, - 59 - ] -} \ No newline at end of file diff --git a/Rom24/README b/archive/README similarity index 100% rename from Rom24/README rename to archive/README diff --git a/Rom24/README.rom b/archive/README.rom similarity index 100% rename from Rom24/README.rom rename to archive/README.rom diff --git a/Rom24/README.version b/archive/README.version similarity index 100% rename from Rom24/README.version rename to archive/README.version diff --git a/Rom24/src/Makefile b/archive/src/Makefile similarity index 100% rename from Rom24/src/Makefile rename to archive/src/Makefile diff --git a/Rom24/src/Makefile.linux b/archive/src/Makefile.linux similarity index 100% rename from Rom24/src/Makefile.linux rename to archive/src/Makefile.linux diff --git a/Rom24/src/Makefile.normal b/archive/src/Makefile.normal similarity index 100% rename from Rom24/src/Makefile.normal rename to archive/src/Makefile.normal diff --git a/Rom24/src/Makefile.solaris b/archive/src/Makefile.solaris similarity index 100% rename from Rom24/src/Makefile.solaris rename to archive/src/Makefile.solaris diff --git a/Rom24/src/act_comm.c b/archive/src/act_comm.c similarity index 100% rename from Rom24/src/act_comm.c rename to archive/src/act_comm.c diff --git a/Rom24/src/act_enter.c b/archive/src/act_enter.c similarity index 100% rename from Rom24/src/act_enter.c rename to archive/src/act_enter.c diff --git a/Rom24/src/act_info.c b/archive/src/act_info.c similarity index 100% rename from Rom24/src/act_info.c rename to archive/src/act_info.c diff --git a/Rom24/src/act_move.c b/archive/src/act_move.c similarity index 100% rename from Rom24/src/act_move.c rename to archive/src/act_move.c diff --git a/Rom24/src/act_obj.c b/archive/src/act_obj.c similarity index 100% rename from Rom24/src/act_obj.c rename to archive/src/act_obj.c diff --git a/Rom24/src/act_wiz.c b/archive/src/act_wiz.c similarity index 100% rename from Rom24/src/act_wiz.c rename to archive/src/act_wiz.c diff --git a/Rom24/src/alias.c b/archive/src/alias.c similarity index 100% rename from Rom24/src/alias.c rename to archive/src/alias.c diff --git a/Rom24/src/ban.c b/archive/src/ban.c similarity index 100% rename from Rom24/src/ban.c rename to archive/src/ban.c diff --git a/Rom24/src/comm.c b/archive/src/comm.c similarity index 100% rename from Rom24/src/comm.c rename to archive/src/comm.c diff --git a/Rom24/src/const.c b/archive/src/const.c similarity index 100% rename from Rom24/src/const.c rename to archive/src/const.c diff --git a/Rom24/src/db.c b/archive/src/db.c similarity index 100% rename from Rom24/src/db.c rename to archive/src/db.c diff --git a/Rom24/src/db.h b/archive/src/db.h similarity index 100% rename from Rom24/src/db.h rename to archive/src/db.h diff --git a/Rom24/src/db2.c b/archive/src/db2.c similarity index 100% rename from Rom24/src/db2.c rename to archive/src/db2.c diff --git a/Rom24/src/effects.c b/archive/src/effects.c similarity index 100% rename from Rom24/src/effects.c rename to archive/src/effects.c diff --git a/Rom24/src/fight.c b/archive/src/fight.c similarity index 100% rename from Rom24/src/fight.c rename to archive/src/fight.c diff --git a/Rom24/src/flags.c b/archive/src/flags.c similarity index 100% rename from Rom24/src/flags.c rename to archive/src/flags.c diff --git a/Rom24/src/handler.c b/archive/src/handler.c similarity index 100% rename from Rom24/src/handler.c rename to archive/src/handler.c diff --git a/Rom24/src/healer.c b/archive/src/healer.c similarity index 100% rename from Rom24/src/healer.c rename to archive/src/healer.c diff --git a/Rom24/src/interp.c b/archive/src/interp.c similarity index 100% rename from Rom24/src/interp.c rename to archive/src/interp.c diff --git a/Rom24/src/interp.h b/archive/src/interp.h similarity index 100% rename from Rom24/src/interp.h rename to archive/src/interp.h diff --git a/Rom24/src/lookup.c b/archive/src/lookup.c similarity index 100% rename from Rom24/src/lookup.c rename to archive/src/lookup.c diff --git a/Rom24/src/lookup.h b/archive/src/lookup.h similarity index 100% rename from Rom24/src/lookup.h rename to archive/src/lookup.h diff --git a/Rom24/src/magic.c b/archive/src/magic.c similarity index 100% rename from Rom24/src/magic.c rename to archive/src/magic.c diff --git a/Rom24/src/magic.h b/archive/src/magic.h similarity index 100% rename from Rom24/src/magic.h rename to archive/src/magic.h diff --git a/Rom24/src/magic2.c b/archive/src/magic2.c similarity index 100% rename from Rom24/src/magic2.c rename to archive/src/magic2.c diff --git a/Rom24/src/merc.h b/archive/src/merc.h similarity index 100% rename from Rom24/src/merc.h rename to archive/src/merc.h diff --git a/Rom24/src/music.c b/archive/src/music.c similarity index 100% rename from Rom24/src/music.c rename to archive/src/music.c diff --git a/Rom24/src/music.h b/archive/src/music.h similarity index 100% rename from Rom24/src/music.h rename to archive/src/music.h diff --git a/Rom24/src/note.c b/archive/src/note.c similarity index 100% rename from Rom24/src/note.c rename to archive/src/note.c diff --git a/Rom24/src/recycle.c b/archive/src/recycle.c similarity index 100% rename from Rom24/src/recycle.c rename to archive/src/recycle.c diff --git a/Rom24/src/recycle.h b/archive/src/recycle.h similarity index 100% rename from Rom24/src/recycle.h rename to archive/src/recycle.h diff --git a/Rom24/src/save.c b/archive/src/save.c similarity index 100% rename from Rom24/src/save.c rename to archive/src/save.c diff --git a/Rom24/src/scan.c b/archive/src/scan.c similarity index 100% rename from Rom24/src/scan.c rename to archive/src/scan.c diff --git a/Rom24/src/skills.c b/archive/src/skills.c similarity index 100% rename from Rom24/src/skills.c rename to archive/src/skills.c diff --git a/Rom24/src/special.c b/archive/src/special.c similarity index 100% rename from Rom24/src/special.c rename to archive/src/special.c diff --git a/Rom24/src/tables.c b/archive/src/tables.c similarity index 100% rename from Rom24/src/tables.c rename to archive/src/tables.c diff --git a/Rom24/src/tables.h b/archive/src/tables.h similarity index 100% rename from Rom24/src/tables.h rename to archive/src/tables.h diff --git a/Rom24/src/telnet.h b/archive/src/telnet.h similarity index 100% rename from Rom24/src/telnet.h rename to archive/src/telnet.h diff --git a/Rom24/src/update.c b/archive/src/update.c similarity index 100% rename from Rom24/src/update.c rename to archive/src/update.c diff --git a/Rom24/area/air.are b/area/air.are similarity index 100% rename from Rom24/area/air.are rename to area/air.are diff --git a/Rom24/area/arachnos.are b/area/arachnos.are similarity index 100% rename from Rom24/area/arachnos.are rename to area/arachnos.are diff --git a/Rom24/area/area.lst b/area/area.lst similarity index 100% rename from Rom24/area/area.lst rename to area/area.lst diff --git a/Rom24/area/astral.are b/area/astral.are similarity index 100% rename from Rom24/area/astral.are rename to area/astral.are diff --git a/Rom24/area/canyon.are b/area/canyon.are similarity index 100% rename from Rom24/area/canyon.are rename to area/canyon.are diff --git a/Rom24/area/catacomb.are b/area/catacomb.are similarity index 100% rename from Rom24/area/catacomb.are rename to area/catacomb.are diff --git a/Rom24/area/chapel.are b/area/chapel.are similarity index 100% rename from Rom24/area/chapel.are rename to area/chapel.are diff --git a/Rom24/area/daycare.are b/area/daycare.are similarity index 100% rename from Rom24/area/daycare.are rename to area/daycare.are diff --git a/Rom24/area/draconia.are b/area/draconia.are similarity index 100% rename from Rom24/area/draconia.are rename to area/draconia.are diff --git a/Rom24/area/dream.are b/area/dream.are similarity index 100% rename from Rom24/area/dream.are rename to area/dream.are diff --git a/Rom24/area/drow.are b/area/drow.are similarity index 100% rename from Rom24/area/drow.are rename to area/drow.are diff --git a/Rom24/area/dwarven.are b/area/dwarven.are similarity index 100% rename from Rom24/area/dwarven.are rename to area/dwarven.are diff --git a/Rom24/area/dylan.are b/area/dylan.are similarity index 100% rename from Rom24/area/dylan.are rename to area/dylan.are diff --git a/Rom24/area/eastern.are b/area/eastern.are similarity index 100% rename from Rom24/area/eastern.are rename to area/eastern.are diff --git a/Rom24/area/galaxy.are b/area/galaxy.are similarity index 100% rename from Rom24/area/galaxy.are rename to area/galaxy.are diff --git a/Rom24/area/gnome.are b/area/gnome.are similarity index 100% rename from Rom24/area/gnome.are rename to area/gnome.are diff --git a/Rom24/area/grave.are b/area/grave.are similarity index 100% rename from Rom24/area/grave.are rename to area/grave.are diff --git a/Rom24/area/group.are b/area/group.are similarity index 100% rename from Rom24/area/group.are rename to area/group.are diff --git a/Rom24/area/grove.are b/area/grove.are similarity index 100% rename from Rom24/area/grove.are rename to area/grove.are diff --git a/Rom24/area/haon.are b/area/haon.are similarity index 100% rename from Rom24/area/haon.are rename to area/haon.are diff --git a/Rom24/area/help.are b/area/help.are similarity index 100% rename from Rom24/area/help.are rename to area/help.are diff --git a/Rom24/area/hitower.are b/area/hitower.are similarity index 100% rename from Rom24/area/hitower.are rename to area/hitower.are diff --git a/Rom24/area/hood.are b/area/hood.are similarity index 100% rename from Rom24/area/hood.are rename to area/hood.are diff --git a/Rom24/area/immort.are b/area/immort.are similarity index 100% rename from Rom24/area/immort.are rename to area/immort.are diff --git a/Rom24/area/limbo.are b/area/limbo.are similarity index 100% rename from Rom24/area/limbo.are rename to area/limbo.are diff --git a/Rom24/area/mahntor.are b/area/mahntor.are similarity index 100% rename from Rom24/area/mahntor.are rename to area/mahntor.are diff --git a/Rom24/area/marsh.are b/area/marsh.are similarity index 100% rename from Rom24/area/marsh.are rename to area/marsh.are diff --git a/Rom24/area/mega1.are b/area/mega1.are similarity index 100% rename from Rom24/area/mega1.are rename to area/mega1.are diff --git a/Rom24/area/midennir.are b/area/midennir.are similarity index 100% rename from Rom24/area/midennir.are rename to area/midennir.are diff --git a/Rom24/area/midgaard.are b/area/midgaard.are similarity index 100% rename from Rom24/area/midgaard.are rename to area/midgaard.are diff --git a/Rom24/area/mirror.are b/area/mirror.are similarity index 100% rename from Rom24/area/mirror.are rename to area/mirror.are diff --git a/Rom24/area/mobfact.are b/area/mobfact.are similarity index 100% rename from Rom24/area/mobfact.are rename to area/mobfact.are diff --git a/Rom24/area/moria.are b/area/moria.are similarity index 100% rename from Rom24/area/moria.are rename to area/moria.are diff --git a/Rom24/area/music.txt b/area/music.txt similarity index 100% rename from Rom24/area/music.txt rename to area/music.txt diff --git a/Rom24/area/newthalos.are b/area/newthalos.are similarity index 100% rename from Rom24/area/newthalos.are rename to area/newthalos.are diff --git a/Rom24/area/nirvana.are b/area/nirvana.are similarity index 100% rename from Rom24/area/nirvana.are rename to area/nirvana.are diff --git a/Rom24/area/ofcol.are b/area/ofcol.are similarity index 100% rename from Rom24/area/ofcol.are rename to area/ofcol.are diff --git a/Rom24/area/ofcol2.are b/area/ofcol2.are similarity index 100% rename from Rom24/area/ofcol2.are rename to area/ofcol2.are diff --git a/Rom24/area/olympus.are b/area/olympus.are similarity index 100% rename from Rom24/area/olympus.are rename to area/olympus.are diff --git a/Rom24/area/plains.are b/area/plains.are similarity index 100% rename from Rom24/area/plains.are rename to area/plains.are diff --git a/Rom24/area/proto.are b/area/proto.are similarity index 100% rename from Rom24/area/proto.are rename to area/proto.are diff --git a/Rom24/area/pyramid.are b/area/pyramid.are similarity index 100% rename from Rom24/area/pyramid.are rename to area/pyramid.are diff --git a/Rom24/area/quifael.are b/area/quifael.are similarity index 100% rename from Rom24/area/quifael.are rename to area/quifael.are diff --git a/Rom24/area/redferne.are b/area/redferne.are similarity index 100% rename from Rom24/area/redferne.are rename to area/redferne.are diff --git a/Rom24/area/rom.are b/area/rom.are similarity index 100% rename from Rom24/area/rom.are rename to area/rom.are diff --git a/Rom24/area/school.are b/area/school.are similarity index 100% rename from Rom24/area/school.are rename to area/school.are diff --git a/Rom24/area/sewer.are b/area/sewer.are similarity index 100% rename from Rom24/area/sewer.are rename to area/sewer.are diff --git a/Rom24/area/shire.are b/area/shire.are similarity index 100% rename from Rom24/area/shire.are rename to area/shire.are diff --git a/Rom24/area/smurf.are b/area/smurf.are similarity index 100% rename from Rom24/area/smurf.are rename to area/smurf.are diff --git a/Rom24/area/social.are b/area/social.are similarity index 100% rename from Rom24/area/social.are rename to area/social.are diff --git a/Rom24/area/startup b/area/startup similarity index 100% rename from Rom24/area/startup rename to area/startup diff --git a/Rom24/area/thalos.are b/area/thalos.are similarity index 100% rename from Rom24/area/thalos.are rename to area/thalos.are diff --git a/Rom24/area/tohell.are b/area/tohell.are similarity index 100% rename from Rom24/area/tohell.are rename to area/tohell.are diff --git a/Rom24/area/trollden.are b/area/trollden.are similarity index 100% rename from Rom24/area/trollden.are rename to area/trollden.are diff --git a/Rom24/area/valley.are b/area/valley.are similarity index 100% rename from Rom24/area/valley.are rename to area/valley.are diff --git a/Rom24/area/wyvern.are b/area/wyvern.are similarity index 100% rename from Rom24/area/wyvern.are rename to area/wyvern.are diff --git a/Rom24/doc/Rom2.4.doc b/doc/Rom2.4.doc similarity index 100% rename from Rom24/doc/Rom2.4.doc rename to doc/Rom2.4.doc diff --git a/Rom24/doc/act.txt b/doc/act.txt similarity index 100% rename from Rom24/doc/act.txt rename to doc/act.txt diff --git a/Rom24/doc/area.txt b/doc/area.txt similarity index 100% rename from Rom24/doc/area.txt rename to doc/area.txt diff --git a/Rom24/doc/class.txt b/doc/class.txt similarity index 100% rename from Rom24/doc/class.txt rename to doc/class.txt diff --git a/Rom24/doc/command.txt b/doc/command.txt similarity index 100% rename from Rom24/doc/command.txt rename to doc/command.txt diff --git a/Rom24/doc/contrib.txt b/doc/contrib.txt similarity index 100% rename from Rom24/doc/contrib.txt rename to doc/contrib.txt diff --git a/Rom24/doc/drool.txt b/doc/drool.txt similarity index 100% rename from Rom24/doc/drool.txt rename to doc/drool.txt diff --git a/Rom24/doc/equipment-system b/doc/equipment-system similarity index 100% rename from Rom24/doc/equipment-system rename to doc/equipment-system diff --git a/Rom24/doc/hacker.txt b/doc/hacker.txt similarity index 100% rename from Rom24/doc/hacker.txt rename to doc/hacker.txt diff --git a/Rom24/doc/license.doc b/doc/license.doc similarity index 100% rename from Rom24/doc/license.doc rename to doc/license.doc diff --git a/Rom24/doc/license.txt b/doc/license.txt similarity index 100% rename from Rom24/doc/license.txt rename to doc/license.txt diff --git a/Rom24/doc/memory.txt b/doc/memory.txt similarity index 100% rename from Rom24/doc/memory.txt rename to doc/memory.txt diff --git a/Rom24/doc/new.txt b/doc/new.txt similarity index 100% rename from Rom24/doc/new.txt rename to doc/new.txt diff --git a/Rom24/doc/pfile.txt b/doc/pfile.txt similarity index 100% rename from Rom24/doc/pfile.txt rename to doc/pfile.txt diff --git a/Rom24/doc/port.txt b/doc/port.txt similarity index 100% rename from Rom24/doc/port.txt rename to doc/port.txt diff --git a/Rom24/doc/pyTiming.txt b/doc/pyTiming.txt similarity index 100% rename from Rom24/doc/pyTiming.txt rename to doc/pyTiming.txt diff --git a/Rom24/doc/rom.credits b/doc/rom.credits similarity index 100% rename from Rom24/doc/rom.credits rename to doc/rom.credits diff --git a/Rom24/doc/rom.license b/doc/rom.license similarity index 100% rename from Rom24/doc/rom.license rename to doc/rom.license diff --git a/Rom24/doc/security.txt b/doc/security.txt similarity index 100% rename from Rom24/doc/security.txt rename to doc/security.txt diff --git a/Rom24/doc/sites.txt b/doc/sites.txt similarity index 100% rename from Rom24/doc/sites.txt rename to doc/sites.txt diff --git a/Rom24/doc/skill.txt b/doc/skill.txt similarity index 100% rename from Rom24/doc/skill.txt rename to doc/skill.txt diff --git a/Rom24/doc/sky.txt b/doc/sky.txt similarity index 100% rename from Rom24/doc/sky.txt rename to doc/sky.txt diff --git a/Rom24/doc/trad.txt b/doc/trad.txt similarity index 100% rename from Rom24/doc/trad.txt rename to doc/trad.txt diff --git a/Rom24/doc/vnum.txt b/doc/vnum.txt similarity index 100% rename from Rom24/doc/vnum.txt rename to doc/vnum.txt diff --git a/Rom24/projects/todo b/projects/todo similarity index 100% rename from Rom24/projects/todo rename to projects/todo diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..0b574b5 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +psutil \ No newline at end of file diff --git a/Rom24/pysrc/CONCEPTS b/src/CONCEPTS similarity index 100% rename from Rom24/pysrc/CONCEPTS rename to src/CONCEPTS diff --git a/Rom24/pysrc/affects.py b/src/affects.py similarity index 100% rename from Rom24/pysrc/affects.py rename to src/affects.py diff --git a/Rom24/pysrc/auth.py b/src/auth.py similarity index 99% rename from Rom24/pysrc/auth.py rename to src/auth.py index 330a1e8..6aedc6a 100644 --- a/Rom24/pysrc/auth.py +++ b/src/auth.py @@ -33,7 +33,7 @@ import json import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import instance diff --git a/Rom24/pysrc/bit.py b/src/bit.py similarity index 99% rename from Rom24/pysrc/bit.py rename to src/bit.py index 2b3f2c0..a386362 100644 --- a/Rom24/pysrc/bit.py +++ b/src/bit.py @@ -1,7 +1,7 @@ import json from collections import OrderedDict import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import game_utils import state_checks diff --git a/Rom24/pysrc/comm.py b/src/comm.py similarity index 99% rename from Rom24/pysrc/comm.py rename to src/comm.py index 026c248..16b75f8 100644 --- a/Rom24/pysrc/comm.py +++ b/src/comm.py @@ -37,7 +37,7 @@ import time import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import db import game_utils diff --git a/Rom24/pysrc/commands/__init__.py b/src/commands/__init__.py similarity index 100% rename from Rom24/pysrc/commands/__init__.py rename to src/commands/__init__.py diff --git a/Rom24/pysrc/commands/do_advance.py b/src/commands/do_advance.py similarity index 98% rename from Rom24/pysrc/commands/do_advance.py rename to src/commands/do_advance.py index 3ca5bed..d5b8dc9 100644 --- a/Rom24/pysrc/commands/do_advance.py +++ b/src/commands/do_advance.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import game_utils diff --git a/Rom24/pysrc/commands/do_affects.py b/src/commands/do_affects.py similarity index 96% rename from Rom24/pysrc/commands/do_affects.py rename to src/commands/do_affects.py index 848d721..894623a 100644 --- a/Rom24/pysrc/commands/do_affects.py +++ b/src/commands/do_affects.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_afk.py b/src/commands/do_afk.py similarity index 91% rename from Rom24/pysrc/commands/do_afk.py rename to src/commands/do_afk.py index 3750be8..112e0f2 100644 --- a/Rom24/pysrc/commands/do_afk.py +++ b/src/commands/do_afk.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_alias.py b/src/commands/do_alias.py similarity index 97% rename from Rom24/pysrc/commands/do_alias.py rename to src/commands/do_alias.py index c60dc83..2c4ec52 100644 --- a/Rom24/pysrc/commands/do_alias.py +++ b/src/commands/do_alias.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_answer.py b/src/commands/do_answer.py similarity index 97% rename from Rom24/pysrc/commands/do_answer.py rename to src/commands/do_answer.py index b988104..19ac8f2 100644 --- a/Rom24/pysrc/commands/do_answer.py +++ b/src/commands/do_answer.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_ch import merc diff --git a/Rom24/pysrc/commands/do_apickle.py b/src/commands/do_apickle.py similarity index 96% rename from Rom24/pysrc/commands/do_apickle.py rename to src/commands/do_apickle.py index 63e4a7f..7cab0a2 100644 --- a/Rom24/pysrc/commands/do_apickle.py +++ b/src/commands/do_apickle.py @@ -2,7 +2,7 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import os import interp diff --git a/Rom24/pysrc/commands/do_areas.py b/src/commands/do_areas.py similarity index 92% rename from Rom24/pysrc/commands/do_areas.py rename to src/commands/do_areas.py index c771db8..082f278 100644 --- a/Rom24/pysrc/commands/do_areas.py +++ b/src/commands/do_areas.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_at.py b/src/commands/do_at.py similarity index 96% rename from Rom24/pysrc/commands/do_at.py rename to src/commands/do_at.py index 87b8168..da6c3f9 100644 --- a/Rom24/pysrc/commands/do_at.py +++ b/src/commands/do_at.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import game_utils import merc diff --git a/Rom24/pysrc/commands/do_auction.py b/src/commands/do_auction.py similarity index 97% rename from Rom24/pysrc/commands/do_auction.py rename to src/commands/do_auction.py index d098e47..56fbc0f 100644 --- a/Rom24/pysrc/commands/do_auction.py +++ b/src/commands/do_auction.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_authenticator.py b/src/commands/do_authenticator.py similarity index 98% rename from Rom24/pysrc/commands/do_authenticator.py rename to src/commands/do_authenticator.py index aa6b51d..d5bad92 100644 --- a/Rom24/pysrc/commands/do_authenticator.py +++ b/src/commands/do_authenticator.py @@ -2,7 +2,7 @@ import hashlib import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import auth import game_utils diff --git a/Rom24/pysrc/commands/do_autoassist.py b/src/commands/do_autoassist.py similarity index 92% rename from Rom24/pysrc/commands/do_autoassist.py rename to src/commands/do_autoassist.py index 275a58a..7d086eb 100644 --- a/Rom24/pysrc/commands/do_autoassist.py +++ b/src/commands/do_autoassist.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_autoexit.py b/src/commands/do_autoexit.py similarity index 92% rename from Rom24/pysrc/commands/do_autoexit.py rename to src/commands/do_autoexit.py index ed15f61..5258346 100644 --- a/Rom24/pysrc/commands/do_autoexit.py +++ b/src/commands/do_autoexit.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_autogold.py b/src/commands/do_autogold.py similarity index 92% rename from Rom24/pysrc/commands/do_autogold.py rename to src/commands/do_autogold.py index 34ee291..d59f222 100644 --- a/Rom24/pysrc/commands/do_autogold.py +++ b/src/commands/do_autogold.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_autolist.py b/src/commands/do_autolist.py similarity index 98% rename from Rom24/pysrc/commands/do_autolist.py rename to src/commands/do_autolist.py index ec9498b..c64de2f 100644 --- a/Rom24/pysrc/commands/do_autolist.py +++ b/src/commands/do_autolist.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_autoloot.py b/src/commands/do_autoloot.py similarity index 92% rename from Rom24/pysrc/commands/do_autoloot.py rename to src/commands/do_autoloot.py index 81f0ed0..cdf9205 100644 --- a/Rom24/pysrc/commands/do_autoloot.py +++ b/src/commands/do_autoloot.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_autosac.py b/src/commands/do_autosac.py similarity index 92% rename from Rom24/pysrc/commands/do_autosac.py rename to src/commands/do_autosac.py index 5fba9a9..ed6bfd9 100644 --- a/Rom24/pysrc/commands/do_autosac.py +++ b/src/commands/do_autosac.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_autosplit.py b/src/commands/do_autosplit.py similarity index 92% rename from Rom24/pysrc/commands/do_autosplit.py rename to src/commands/do_autosplit.py index 9b3303c..529c9fc 100644 --- a/Rom24/pysrc/commands/do_autosplit.py +++ b/src/commands/do_autosplit.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_backstab.py b/src/commands/do_backstab.py similarity index 98% rename from Rom24/pysrc/commands/do_backstab.py rename to src/commands/do_backstab.py index 024c41d..4b2e9d4 100644 --- a/Rom24/pysrc/commands/do_backstab.py +++ b/src/commands/do_backstab.py @@ -1,7 +1,7 @@ import random import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import game_utils import merc diff --git a/Rom24/pysrc/commands/do_bamfin.py b/src/commands/do_bamfin.py similarity index 93% rename from Rom24/pysrc/commands/do_bamfin.py rename to src/commands/do_bamfin.py index 44024e2..1070015 100644 --- a/Rom24/pysrc/commands/do_bamfin.py +++ b/src/commands/do_bamfin.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_bamfout.py b/src/commands/do_bamfout.py similarity index 93% rename from Rom24/pysrc/commands/do_bamfout.py rename to src/commands/do_bamfout.py index 927d12b..d347e01 100644 --- a/Rom24/pysrc/commands/do_bamfout.py +++ b/src/commands/do_bamfout.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_bash.py b/src/commands/do_bash.py similarity index 99% rename from Rom24/pysrc/commands/do_bash.py rename to src/commands/do_bash.py index cd8e7e6..157c2d7 100644 --- a/Rom24/pysrc/commands/do_bash.py +++ b/src/commands/do_bash.py @@ -1,7 +1,7 @@ import random import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import game_utils import handler_game diff --git a/Rom24/pysrc/commands/do_berserk.py b/src/commands/do_berserk.py similarity index 98% rename from Rom24/pysrc/commands/do_berserk.py rename to src/commands/do_berserk.py index 1bec031..b79684d 100644 --- a/Rom24/pysrc/commands/do_berserk.py +++ b/src/commands/do_berserk.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import random import merc diff --git a/Rom24/pysrc/commands/do_brandish.py b/src/commands/do_brandish.py similarity index 98% rename from Rom24/pysrc/commands/do_brandish.py rename to src/commands/do_brandish.py index 48ef759..df5555b 100644 --- a/Rom24/pysrc/commands/do_brandish.py +++ b/src/commands/do_brandish.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import random import merc diff --git a/Rom24/pysrc/commands/do_brief.py b/src/commands/do_brief.py similarity index 91% rename from Rom24/pysrc/commands/do_brief.py rename to src/commands/do_brief.py index 8b1e112..29e58bc 100644 --- a/Rom24/pysrc/commands/do_brief.py +++ b/src/commands/do_brief.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_bug.py b/src/commands/do_bug.py similarity index 89% rename from Rom24/pysrc/commands/do_bug.py rename to src/commands/do_bug.py index b3c5cd8..82b0776 100644 --- a/Rom24/pysrc/commands/do_bug.py +++ b/src/commands/do_bug.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import game_utils diff --git a/Rom24/pysrc/commands/do_buy.py b/src/commands/do_buy.py similarity index 99% rename from Rom24/pysrc/commands/do_buy.py rename to src/commands/do_buy.py index 01f2ea6..80f6b85 100644 --- a/Rom24/pysrc/commands/do_buy.py +++ b/src/commands/do_buy.py @@ -1,7 +1,7 @@ import random import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import game_utils diff --git a/Rom24/pysrc/commands/do_cast.py b/src/commands/do_cast.py similarity index 99% rename from Rom24/pysrc/commands/do_cast.py rename to src/commands/do_cast.py index b0e33bf..02ec249 100644 --- a/Rom24/pysrc/commands/do_cast.py +++ b/src/commands/do_cast.py @@ -1,7 +1,7 @@ import random import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import game_utils import handler_magic diff --git a/Rom24/pysrc/commands/do_channels.py b/src/commands/do_channels.py similarity index 98% rename from Rom24/pysrc/commands/do_channels.py rename to src/commands/do_channels.py index 537c9f0..7bbf12b 100644 --- a/Rom24/pysrc/commands/do_channels.py +++ b/src/commands/do_channels.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_clantalk.py b/src/commands/do_clantalk.py similarity index 97% rename from Rom24/pysrc/commands/do_clantalk.py rename to src/commands/do_clantalk.py index e6a3a8d..b9fb867 100644 --- a/Rom24/pysrc/commands/do_clantalk.py +++ b/src/commands/do_clantalk.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_clone.py b/src/commands/do_clone.py similarity index 98% rename from Rom24/pysrc/commands/do_clone.py rename to src/commands/do_clone.py index d7d24da..b58c43b 100644 --- a/Rom24/pysrc/commands/do_clone.py +++ b/src/commands/do_clone.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_close.py b/src/commands/do_close.py similarity index 98% rename from Rom24/pysrc/commands/do_close.py rename to src/commands/do_close.py index 236c61b..c0cc364 100644 --- a/Rom24/pysrc/commands/do_close.py +++ b/src/commands/do_close.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import interp import handler_room diff --git a/Rom24/pysrc/commands/do_combine.py b/src/commands/do_combine.py similarity index 91% rename from Rom24/pysrc/commands/do_combine.py rename to src/commands/do_combine.py index 503847f..4ac05b6 100644 --- a/Rom24/pysrc/commands/do_combine.py +++ b/src/commands/do_combine.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_commands.py b/src/commands/do_commands.py similarity index 92% rename from Rom24/pysrc/commands/do_commands.py rename to src/commands/do_commands.py index 78fe2ba..8444c22 100644 --- a/Rom24/pysrc/commands/do_commands.py +++ b/src/commands/do_commands.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_compact.py b/src/commands/do_compact.py similarity index 91% rename from Rom24/pysrc/commands/do_compact.py rename to src/commands/do_compact.py index fc39fb1..dd8857b 100644 --- a/Rom24/pysrc/commands/do_compact.py +++ b/src/commands/do_compact.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_compare.py b/src/commands/do_compare.py similarity index 98% rename from Rom24/pysrc/commands/do_compare.py rename to src/commands/do_compare.py index 6c28534..cbed672 100644 --- a/Rom24/pysrc/commands/do_compare.py +++ b/src/commands/do_compare.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import game_utils import merc diff --git a/Rom24/pysrc/commands/do_consider.py b/src/commands/do_consider.py similarity index 96% rename from Rom24/pysrc/commands/do_consider.py rename to src/commands/do_consider.py index 56e731b..21d89a1 100644 --- a/Rom24/pysrc/commands/do_consider.py +++ b/src/commands/do_consider.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import game_utils import merc diff --git a/Rom24/pysrc/commands/do_count.py b/src/commands/do_count.py similarity index 94% rename from Rom24/pysrc/commands/do_count.py rename to src/commands/do_count.py index a664fc7..a059fb6 100644 --- a/Rom24/pysrc/commands/do_count.py +++ b/src/commands/do_count.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_ch import merc diff --git a/Rom24/pysrc/commands/do_deaf.py b/src/commands/do_deaf.py similarity index 92% rename from Rom24/pysrc/commands/do_deaf.py rename to src/commands/do_deaf.py index a098305..f6976e2 100644 --- a/Rom24/pysrc/commands/do_deaf.py +++ b/src/commands/do_deaf.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_debug.py b/src/commands/do_debug.py similarity index 94% rename from Rom24/pysrc/commands/do_debug.py rename to src/commands/do_debug.py index c4ede39..90446db 100644 --- a/Rom24/pysrc/commands/do_debug.py +++ b/src/commands/do_debug.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_pc import game_utils diff --git a/Rom24/pysrc/commands/do_delete.py b/src/commands/do_delete.py similarity index 97% rename from Rom24/pysrc/commands/do_delete.py rename to src/commands/do_delete.py index 75a9a1e..0ba19f1 100644 --- a/Rom24/pysrc/commands/do_delete.py +++ b/src/commands/do_delete.py @@ -1,7 +1,7 @@ import os import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_game import merc diff --git a/Rom24/pysrc/commands/do_deny.py b/src/commands/do_deny.py similarity index 96% rename from Rom24/pysrc/commands/do_deny.py rename to src/commands/do_deny.py index ff6e711..e26abd2 100644 --- a/Rom24/pysrc/commands/do_deny.py +++ b/src/commands/do_deny.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_description.py b/src/commands/do_description.py similarity index 96% rename from Rom24/pysrc/commands/do_description.py rename to src/commands/do_description.py index 50a0fed..03d87ab 100644 --- a/Rom24/pysrc/commands/do_description.py +++ b/src/commands/do_description.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_dirt.py b/src/commands/do_dirt.py similarity index 99% rename from Rom24/pysrc/commands/do_dirt.py rename to src/commands/do_dirt.py index 37670aa..c1f170c 100644 --- a/Rom24/pysrc/commands/do_dirt.py +++ b/src/commands/do_dirt.py @@ -1,7 +1,7 @@ import random import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import game_utils import handler_game diff --git a/Rom24/pysrc/commands/do_disarm.py b/src/commands/do_disarm.py similarity index 98% rename from Rom24/pysrc/commands/do_disarm.py rename to src/commands/do_disarm.py index 0054969..29a89cf 100644 --- a/Rom24/pysrc/commands/do_disarm.py +++ b/src/commands/do_disarm.py @@ -1,7 +1,7 @@ import random import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_game import state_checks diff --git a/Rom24/pysrc/commands/do_disconnect.py b/src/commands/do_disconnect.py similarity index 96% rename from Rom24/pysrc/commands/do_disconnect.py rename to src/commands/do_disconnect.py index d426e32..2535b71 100644 --- a/Rom24/pysrc/commands/do_disconnect.py +++ b/src/commands/do_disconnect.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_down.py b/src/commands/do_down.py similarity index 87% rename from Rom24/pysrc/commands/do_down.py rename to src/commands/do_down.py index 678fe9b..9118aa3 100644 --- a/Rom24/pysrc/commands/do_down.py +++ b/src/commands/do_down.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_ch import interp diff --git a/Rom24/pysrc/commands/do_drink.py b/src/commands/do_drink.py similarity index 98% rename from Rom24/pysrc/commands/do_drink.py rename to src/commands/do_drink.py index e96b79d..3cca5c9 100644 --- a/Rom24/pysrc/commands/do_drink.py +++ b/src/commands/do_drink.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import const diff --git a/Rom24/pysrc/commands/do_drop.py b/src/commands/do_drop.py similarity index 99% rename from Rom24/pysrc/commands/do_drop.py rename to src/commands/do_drop.py index d40f0cf..2821105 100644 --- a/Rom24/pysrc/commands/do_drop.py +++ b/src/commands/do_drop.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import object_creator import handler_game diff --git a/Rom24/pysrc/commands/do_dump.py b/src/commands/do_dump.py similarity index 84% rename from Rom24/pysrc/commands/do_dump.py rename to src/commands/do_dump.py index 548f739..82b4831 100644 --- a/Rom24/pysrc/commands/do_dump.py +++ b/src/commands/do_dump.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_east.py b/src/commands/do_east.py similarity index 87% rename from Rom24/pysrc/commands/do_east.py rename to src/commands/do_east.py index 2227d13..15b9862 100644 --- a/Rom24/pysrc/commands/do_east.py +++ b/src/commands/do_east.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_ch import interp diff --git a/Rom24/pysrc/commands/do_eat.py b/src/commands/do_eat.py similarity index 98% rename from Rom24/pysrc/commands/do_eat.py rename to src/commands/do_eat.py index 54080f6..82a4579 100644 --- a/Rom24/pysrc/commands/do_eat.py +++ b/src/commands/do_eat.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_echo.py b/src/commands/do_echo.py similarity index 92% rename from Rom24/pysrc/commands/do_echo.py rename to src/commands/do_echo.py index 2effa85..c17c613 100644 --- a/Rom24/pysrc/commands/do_echo.py +++ b/src/commands/do_echo.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_emote.py b/src/commands/do_emote.py similarity index 94% rename from Rom24/pysrc/commands/do_emote.py rename to src/commands/do_emote.py index f5b82b2..540bef2 100644 --- a/Rom24/pysrc/commands/do_emote.py +++ b/src/commands/do_emote.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_game import merc diff --git a/Rom24/pysrc/commands/do_enter.py b/src/commands/do_enter.py similarity index 99% rename from Rom24/pysrc/commands/do_enter.py rename to src/commands/do_enter.py index eb752b6..baab472 100644 --- a/Rom24/pysrc/commands/do_enter.py +++ b/src/commands/do_enter.py @@ -1,7 +1,7 @@ import random import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_game import merc diff --git a/Rom24/pysrc/commands/do_envenom.py b/src/commands/do_envenom.py similarity index 98% rename from Rom24/pysrc/commands/do_envenom.py rename to src/commands/do_envenom.py index 3b78a97..7ea61b4 100644 --- a/Rom24/pysrc/commands/do_envenom.py +++ b/src/commands/do_envenom.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import random import merc diff --git a/Rom24/pysrc/commands/do_equipment.py b/src/commands/do_equipment.py similarity index 95% rename from Rom24/pysrc/commands/do_equipment.py rename to src/commands/do_equipment.py index 9d3436a..56a1c90 100644 --- a/Rom24/pysrc/commands/do_equipment.py +++ b/src/commands/do_equipment.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_examine.py b/src/commands/do_examine.py similarity index 97% rename from Rom24/pysrc/commands/do_examine.py rename to src/commands/do_examine.py index b84b516..683bedd 100644 --- a/Rom24/pysrc/commands/do_examine.py +++ b/src/commands/do_examine.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_exits.py b/src/commands/do_exits.py similarity index 97% rename from Rom24/pysrc/commands/do_exits.py rename to src/commands/do_exits.py index 2c15fb5..9a5e1dc 100644 --- a/Rom24/pysrc/commands/do_exits.py +++ b/src/commands/do_exits.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_fill.py b/src/commands/do_fill.py similarity index 97% rename from Rom24/pysrc/commands/do_fill.py rename to src/commands/do_fill.py index 4c1d652..cd3ae17 100644 --- a/Rom24/pysrc/commands/do_fill.py +++ b/src/commands/do_fill.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import const diff --git a/Rom24/pysrc/commands/do_flags.py b/src/commands/do_flags.py similarity index 99% rename from Rom24/pysrc/commands/do_flags.py rename to src/commands/do_flags.py index 643f7b2..4a8cf0f 100644 --- a/Rom24/pysrc/commands/do_flags.py +++ b/src/commands/do_flags.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import interp import merc diff --git a/Rom24/pysrc/commands/do_flee.py b/src/commands/do_flee.py similarity index 97% rename from Rom24/pysrc/commands/do_flee.py rename to src/commands/do_flee.py index a748d15..7bc84d6 100644 --- a/Rom24/pysrc/commands/do_flee.py +++ b/src/commands/do_flee.py @@ -1,7 +1,7 @@ import random import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_game import handler_room diff --git a/Rom24/pysrc/commands/do_follow.py b/src/commands/do_follow.py similarity index 97% rename from Rom24/pysrc/commands/do_follow.py rename to src/commands/do_follow.py index ed9c1ea..7d5f011 100644 --- a/Rom24/pysrc/commands/do_follow.py +++ b/src/commands/do_follow.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_force.py b/src/commands/do_force.py similarity index 98% rename from Rom24/pysrc/commands/do_force.py rename to src/commands/do_force.py index a1adf23..56d2d4b 100644 --- a/Rom24/pysrc/commands/do_force.py +++ b/src/commands/do_force.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_freeze.py b/src/commands/do_freeze.py similarity index 97% rename from Rom24/pysrc/commands/do_freeze.py rename to src/commands/do_freeze.py index 8ff7a38..3604e56 100644 --- a/Rom24/pysrc/commands/do_freeze.py +++ b/src/commands/do_freeze.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_freset.py b/src/commands/do_freset.py similarity index 90% rename from Rom24/pysrc/commands/do_freset.py rename to src/commands/do_freset.py index c6f1964..cda92d7 100644 --- a/Rom24/pysrc/commands/do_freset.py +++ b/src/commands/do_freset.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_gain.py b/src/commands/do_gain.py similarity index 99% rename from Rom24/pysrc/commands/do_gain.py rename to src/commands/do_gain.py index 9613301..15e3e4a 100644 --- a/Rom24/pysrc/commands/do_gain.py +++ b/src/commands/do_gain.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_gdstate.py b/src/commands/do_gdstate.py similarity index 96% rename from Rom24/pysrc/commands/do_gdstate.py rename to src/commands/do_gdstate.py index 59958a9..e46d530 100644 --- a/Rom24/pysrc/commands/do_gdstate.py +++ b/src/commands/do_gdstate.py @@ -1,7 +1,7 @@ __author__ = 'syn' import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import interp import merc diff --git a/Rom24/pysrc/commands/do_get.py b/src/commands/do_get.py similarity index 98% rename from Rom24/pysrc/commands/do_get.py rename to src/commands/do_get.py index 249fb9a..681db07 100644 --- a/Rom24/pysrc/commands/do_get.py +++ b/src/commands/do_get.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_game import merc diff --git a/Rom24/pysrc/commands/do_give.py b/src/commands/do_give.py similarity index 99% rename from Rom24/pysrc/commands/do_give.py rename to src/commands/do_give.py index 80a493b..8d193c7 100644 --- a/Rom24/pysrc/commands/do_give.py +++ b/src/commands/do_give.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_gossip.py b/src/commands/do_gossip.py similarity index 97% rename from Rom24/pysrc/commands/do_gossip.py rename to src/commands/do_gossip.py index fcbf7bc..78836eb 100644 --- a/Rom24/pysrc/commands/do_gossip.py +++ b/src/commands/do_gossip.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_goto.py b/src/commands/do_goto.py similarity index 97% rename from Rom24/pysrc/commands/do_goto.py rename to src/commands/do_goto.py index 4340d42..7d3c6dd 100644 --- a/Rom24/pysrc/commands/do_goto.py +++ b/src/commands/do_goto.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_game import merc diff --git a/Rom24/pysrc/commands/do_grats.py b/src/commands/do_grats.py similarity index 97% rename from Rom24/pysrc/commands/do_grats.py rename to src/commands/do_grats.py index 605ae91..ba6e03d 100644 --- a/Rom24/pysrc/commands/do_grats.py +++ b/src/commands/do_grats.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_group.py b/src/commands/do_group.py similarity index 98% rename from Rom24/pysrc/commands/do_group.py rename to src/commands/do_group.py index 544e632..f2be8b9 100644 --- a/Rom24/pysrc/commands/do_group.py +++ b/src/commands/do_group.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_groups.py b/src/commands/do_groups.py similarity index 97% rename from Rom24/pysrc/commands/do_groups.py rename to src/commands/do_groups.py index ed56ebd..f70fed2 100644 --- a/Rom24/pysrc/commands/do_groups.py +++ b/src/commands/do_groups.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import const diff --git a/Rom24/pysrc/commands/do_gtell.py b/src/commands/do_gtell.py similarity index 96% rename from Rom24/pysrc/commands/do_gtell.py rename to src/commands/do_gtell.py index 866e7e2..d0a7925 100644 --- a/Rom24/pysrc/commands/do_gtell.py +++ b/src/commands/do_gtell.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_guild.py b/src/commands/do_guild.py similarity index 97% rename from Rom24/pysrc/commands/do_guild.py rename to src/commands/do_guild.py index a0b6115..f2bd5c2 100644 --- a/Rom24/pysrc/commands/do_guild.py +++ b/src/commands/do_guild.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_heal.py b/src/commands/do_heal.py similarity index 99% rename from Rom24/pysrc/commands/do_heal.py rename to src/commands/do_heal.py index 5a21bb2..ab6f1a5 100644 --- a/Rom24/pysrc/commands/do_heal.py +++ b/src/commands/do_heal.py @@ -1,7 +1,7 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import game_utils import handler_game diff --git a/Rom24/pysrc/commands/do_help.py b/src/commands/do_help.py similarity index 97% rename from Rom24/pysrc/commands/do_help.py rename to src/commands/do_help.py index 7c142f3..3a85f47 100644 --- a/Rom24/pysrc/commands/do_help.py +++ b/src/commands/do_help.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_hide.py b/src/commands/do_hide.py similarity index 93% rename from Rom24/pysrc/commands/do_hide.py rename to src/commands/do_hide.py index 52d5958..3357d3c 100644 --- a/Rom24/pysrc/commands/do_hide.py +++ b/src/commands/do_hide.py @@ -1,7 +1,7 @@ import random import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_holylight.py b/src/commands/do_holylight.py similarity index 92% rename from Rom24/pysrc/commands/do_holylight.py rename to src/commands/do_holylight.py index 8b76109..376e9d9 100644 --- a/Rom24/pysrc/commands/do_holylight.py +++ b/src/commands/do_holylight.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_immtalk.py b/src/commands/do_immtalk.py similarity index 96% rename from Rom24/pysrc/commands/do_immtalk.py rename to src/commands/do_immtalk.py index c4ed11c..3338e07 100644 --- a/Rom24/pysrc/commands/do_immtalk.py +++ b/src/commands/do_immtalk.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_incognito.py b/src/commands/do_incognito.py similarity index 97% rename from Rom24/pysrc/commands/do_incognito.py rename to src/commands/do_incognito.py index 59fb93f..4853234 100644 --- a/Rom24/pysrc/commands/do_incognito.py +++ b/src/commands/do_incognito.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_inventory.py b/src/commands/do_inventory.py similarity index 89% rename from Rom24/pysrc/commands/do_inventory.py rename to src/commands/do_inventory.py index 11638c3..0c0109a 100644 --- a/Rom24/pysrc/commands/do_inventory.py +++ b/src/commands/do_inventory.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_invis.py b/src/commands/do_invis.py similarity index 97% rename from Rom24/pysrc/commands/do_invis.py rename to src/commands/do_invis.py index 7d40eca..9564b47 100644 --- a/Rom24/pysrc/commands/do_invis.py +++ b/src/commands/do_invis.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_kick.py b/src/commands/do_kick.py similarity index 96% rename from Rom24/pysrc/commands/do_kick.py rename to src/commands/do_kick.py index e45ed86..e001ff0 100644 --- a/Rom24/pysrc/commands/do_kick.py +++ b/src/commands/do_kick.py @@ -1,7 +1,7 @@ import random import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import state_checks import merc diff --git a/Rom24/pysrc/commands/do_kill.py b/src/commands/do_kill.py similarity index 97% rename from Rom24/pysrc/commands/do_kill.py rename to src/commands/do_kill.py index ca9c3af..1b5825c 100644 --- a/Rom24/pysrc/commands/do_kill.py +++ b/src/commands/do_kill.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import fight diff --git a/Rom24/pysrc/commands/do_list.py b/src/commands/do_list.py similarity index 98% rename from Rom24/pysrc/commands/do_list.py rename to src/commands/do_list.py index e460e6e..58ca85e 100644 --- a/Rom24/pysrc/commands/do_list.py +++ b/src/commands/do_list.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import game_utils import shop_utils diff --git a/Rom24/pysrc/commands/do_load.py b/src/commands/do_load.py similarity index 94% rename from Rom24/pysrc/commands/do_load.py rename to src/commands/do_load.py index ab5f455..3ffbc48 100644 --- a/Rom24/pysrc/commands/do_load.py +++ b/src/commands/do_load.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_lock.py b/src/commands/do_lock.py similarity index 98% rename from Rom24/pysrc/commands/do_lock.py rename to src/commands/do_lock.py index 1717ad5..389c1f7 100644 --- a/Rom24/pysrc/commands/do_lock.py +++ b/src/commands/do_lock.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import game_utils import handler_game diff --git a/Rom24/pysrc/commands/do_log.py b/src/commands/do_log.py similarity index 96% rename from Rom24/pysrc/commands/do_log.py rename to src/commands/do_log.py index 889d4a2..8f34c7e 100644 --- a/Rom24/pysrc/commands/do_log.py +++ b/src/commands/do_log.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_look.py b/src/commands/do_look.py similarity index 99% rename from Rom24/pysrc/commands/do_look.py rename to src/commands/do_look.py index 3db75b9..6d61256 100644 --- a/Rom24/pysrc/commands/do_look.py +++ b/src/commands/do_look.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import game_utils diff --git a/Rom24/pysrc/commands/do_memory.py b/src/commands/do_memory.py similarity index 85% rename from Rom24/pysrc/commands/do_memory.py rename to src/commands/do_memory.py index cfc27c2..2a4d567 100644 --- a/Rom24/pysrc/commands/do_memory.py +++ b/src/commands/do_memory.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_mfind.py b/src/commands/do_mfind.py similarity index 95% rename from Rom24/pysrc/commands/do_mfind.py rename to src/commands/do_mfind.py index 22730fb..2ef9373 100644 --- a/Rom24/pysrc/commands/do_mfind.py +++ b/src/commands/do_mfind.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_mload.py b/src/commands/do_mload.py similarity index 95% rename from Rom24/pysrc/commands/do_mload.py rename to src/commands/do_mload.py index e94adb1..e702019 100644 --- a/Rom24/pysrc/commands/do_mload.py +++ b/src/commands/do_mload.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_mset.py b/src/commands/do_mset.py similarity index 99% rename from Rom24/pysrc/commands/do_mset.py rename to src/commands/do_mset.py index 63b1400..0a25307 100644 --- a/Rom24/pysrc/commands/do_mset.py +++ b/src/commands/do_mset.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import const diff --git a/Rom24/pysrc/commands/do_mstat.py b/src/commands/do_mstat.py similarity index 99% rename from Rom24/pysrc/commands/do_mstat.py rename to src/commands/do_mstat.py index 21b15b3..1f56d4c 100644 --- a/Rom24/pysrc/commands/do_mstat.py +++ b/src/commands/do_mstat.py @@ -1,7 +1,7 @@ import time import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_murder.py b/src/commands/do_murder.py similarity index 97% rename from Rom24/pysrc/commands/do_murder.py rename to src/commands/do_murder.py index 6d92382..84eb878 100644 --- a/Rom24/pysrc/commands/do_murder.py +++ b/src/commands/do_murder.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_music.py b/src/commands/do_music.py similarity index 97% rename from Rom24/pysrc/commands/do_music.py rename to src/commands/do_music.py index dcd5c37..b20fec0 100644 --- a/Rom24/pysrc/commands/do_music.py +++ b/src/commands/do_music.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_mwhere.py b/src/commands/do_mwhere.py similarity index 97% rename from Rom24/pysrc/commands/do_mwhere.py rename to src/commands/do_mwhere.py index 8aa3cf0..389fb83 100644 --- a/Rom24/pysrc/commands/do_mwhere.py +++ b/src/commands/do_mwhere.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_game import merc diff --git a/Rom24/pysrc/commands/do_newlock.py b/src/commands/do_newlock.py similarity index 94% rename from Rom24/pysrc/commands/do_newlock.py rename to src/commands/do_newlock.py index 25b9c76..8db4d06 100644 --- a/Rom24/pysrc/commands/do_newlock.py +++ b/src/commands/do_newlock.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_nochannels.py b/src/commands/do_nochannels.py similarity index 97% rename from Rom24/pysrc/commands/do_nochannels.py rename to src/commands/do_nochannels.py index cfbc175..87402b9 100644 --- a/Rom24/pysrc/commands/do_nochannels.py +++ b/src/commands/do_nochannels.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_noemote.py b/src/commands/do_noemote.py similarity index 96% rename from Rom24/pysrc/commands/do_noemote.py rename to src/commands/do_noemote.py index bb3030e..0c51821 100644 --- a/Rom24/pysrc/commands/do_noemote.py +++ b/src/commands/do_noemote.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_nofollow.py b/src/commands/do_nofollow.py similarity index 93% rename from Rom24/pysrc/commands/do_nofollow.py rename to src/commands/do_nofollow.py index 2ca2d9e..15c9408 100644 --- a/Rom24/pysrc/commands/do_nofollow.py +++ b/src/commands/do_nofollow.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_noloot.py b/src/commands/do_noloot.py similarity index 92% rename from Rom24/pysrc/commands/do_noloot.py rename to src/commands/do_noloot.py index a314b2e..da484af 100644 --- a/Rom24/pysrc/commands/do_noloot.py +++ b/src/commands/do_noloot.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_north.py b/src/commands/do_north.py similarity index 87% rename from Rom24/pysrc/commands/do_north.py rename to src/commands/do_north.py index 540a8e3..0bcfd26 100644 --- a/Rom24/pysrc/commands/do_north.py +++ b/src/commands/do_north.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_ch import interp diff --git a/Rom24/pysrc/commands/do_noshout.py b/src/commands/do_noshout.py similarity index 97% rename from Rom24/pysrc/commands/do_noshout.py rename to src/commands/do_noshout.py index d7008eb..750bba4 100644 --- a/Rom24/pysrc/commands/do_noshout.py +++ b/src/commands/do_noshout.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_nosummon.py b/src/commands/do_nosummon.py similarity index 95% rename from Rom24/pysrc/commands/do_nosummon.py rename to src/commands/do_nosummon.py index 552935d..74d9ecd 100644 --- a/Rom24/pysrc/commands/do_nosummon.py +++ b/src/commands/do_nosummon.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_notell.py b/src/commands/do_notell.py similarity index 96% rename from Rom24/pysrc/commands/do_notell.py rename to src/commands/do_notell.py index 532aa6e..b57e4dd 100644 --- a/Rom24/pysrc/commands/do_notell.py +++ b/src/commands/do_notell.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_ofind.py b/src/commands/do_ofind.py similarity index 96% rename from Rom24/pysrc/commands/do_ofind.py rename to src/commands/do_ofind.py index a8485bf..136f95b 100644 --- a/Rom24/pysrc/commands/do_ofind.py +++ b/src/commands/do_ofind.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_oload.py b/src/commands/do_oload.py similarity index 97% rename from Rom24/pysrc/commands/do_oload.py rename to src/commands/do_oload.py index 2fb353d..7d810d3 100644 --- a/Rom24/pysrc/commands/do_oload.py +++ b/src/commands/do_oload.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import object_creator diff --git a/Rom24/pysrc/commands/do_omni.py b/src/commands/do_omni.py similarity index 91% rename from Rom24/pysrc/commands/do_omni.py rename to src/commands/do_omni.py index fab82c3..4edc934 100644 --- a/Rom24/pysrc/commands/do_omni.py +++ b/src/commands/do_omni.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_open.py b/src/commands/do_open.py similarity index 98% rename from Rom24/pysrc/commands/do_open.py rename to src/commands/do_open.py index c0f7d49..95f0180 100644 --- a/Rom24/pysrc/commands/do_open.py +++ b/src/commands/do_open.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import interp import merc diff --git a/Rom24/pysrc/commands/do_order.py b/src/commands/do_order.py similarity index 97% rename from Rom24/pysrc/commands/do_order.py rename to src/commands/do_order.py index e16fad0..0a7520f 100644 --- a/Rom24/pysrc/commands/do_order.py +++ b/src/commands/do_order.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_oset.py b/src/commands/do_oset.py similarity index 98% rename from Rom24/pysrc/commands/do_oset.py rename to src/commands/do_oset.py index bb3f278..562e7ef 100644 --- a/Rom24/pysrc/commands/do_oset.py +++ b/src/commands/do_oset.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_ostat.py b/src/commands/do_ostat.py similarity index 99% rename from Rom24/pysrc/commands/do_ostat.py rename to src/commands/do_ostat.py index b9bffeb..36b4399 100644 --- a/Rom24/pysrc/commands/do_ostat.py +++ b/src/commands/do_ostat.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import game_utils import merc diff --git a/Rom24/pysrc/commands/do_outfit.py b/src/commands/do_outfit.py similarity index 97% rename from Rom24/pysrc/commands/do_outfit.py rename to src/commands/do_outfit.py index 4f00237..aa416fa 100644 --- a/Rom24/pysrc/commands/do_outfit.py +++ b/src/commands/do_outfit.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_owhere.py b/src/commands/do_owhere.py similarity index 97% rename from Rom24/pysrc/commands/do_owhere.py rename to src/commands/do_owhere.py index 3d7cd9f..4353060 100644 --- a/Rom24/pysrc/commands/do_owhere.py +++ b/src/commands/do_owhere.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_pardon.py b/src/commands/do_pardon.py similarity index 96% rename from Rom24/pysrc/commands/do_pardon.py rename to src/commands/do_pardon.py index 5041c71..fe90778 100644 --- a/Rom24/pysrc/commands/do_pardon.py +++ b/src/commands/do_pardon.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_password.py b/src/commands/do_password.py similarity index 97% rename from Rom24/pysrc/commands/do_password.py rename to src/commands/do_password.py index 020d7dc..0d141fb 100644 --- a/Rom24/pysrc/commands/do_password.py +++ b/src/commands/do_password.py @@ -1,7 +1,7 @@ import hashlib import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import game_utils import state_checks diff --git a/Rom24/pysrc/commands/do_peace.py b/src/commands/do_peace.py similarity index 93% rename from Rom24/pysrc/commands/do_peace.py rename to src/commands/do_peace.py index 337c2e5..346b004 100644 --- a/Rom24/pysrc/commands/do_peace.py +++ b/src/commands/do_peace.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import fight diff --git a/Rom24/pysrc/commands/do_pecho.py b/src/commands/do_pecho.py similarity index 94% rename from Rom24/pysrc/commands/do_pecho.py rename to src/commands/do_pecho.py index 73afb9f..e4f84de 100644 --- a/Rom24/pysrc/commands/do_pecho.py +++ b/src/commands/do_pecho.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_pick.py b/src/commands/do_pick.py similarity index 99% rename from Rom24/pysrc/commands/do_pick.py rename to src/commands/do_pick.py index a20c74f..6aaf75b 100644 --- a/Rom24/pysrc/commands/do_pick.py +++ b/src/commands/do_pick.py @@ -1,7 +1,7 @@ import random import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import interp import merc diff --git a/Rom24/pysrc/commands/do_pmote.py b/src/commands/do_pmote.py similarity index 96% rename from Rom24/pysrc/commands/do_pmote.py rename to src/commands/do_pmote.py index ab1f56d..53bdbcb 100644 --- a/Rom24/pysrc/commands/do_pmote.py +++ b/src/commands/do_pmote.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_game import merc diff --git a/Rom24/pysrc/commands/do_pose.py b/src/commands/do_pose.py similarity index 99% rename from Rom24/pysrc/commands/do_pose.py rename to src/commands/do_pose.py index 4d98cf3..8634c73 100644 --- a/Rom24/pysrc/commands/do_pose.py +++ b/src/commands/do_pose.py @@ -1,7 +1,7 @@ import random import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_pour.py b/src/commands/do_pour.py similarity index 98% rename from Rom24/pysrc/commands/do_pour.py rename to src/commands/do_pour.py index 21b3e1b..b8009d7 100644 --- a/Rom24/pysrc/commands/do_pour.py +++ b/src/commands/do_pour.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import const diff --git a/Rom24/pysrc/commands/do_practice.py b/src/commands/do_practice.py similarity index 98% rename from Rom24/pysrc/commands/do_practice.py rename to src/commands/do_practice.py index 6df2aa8..83e19c5 100644 --- a/Rom24/pysrc/commands/do_practice.py +++ b/src/commands/do_practice.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import game_utils import handler_game diff --git a/Rom24/pysrc/commands/do_prefix.py b/src/commands/do_prefix.py similarity index 95% rename from Rom24/pysrc/commands/do_prefix.py rename to src/commands/do_prefix.py index a94a018..cf8f285 100644 --- a/Rom24/pysrc/commands/do_prefix.py +++ b/src/commands/do_prefix.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_prompt.py b/src/commands/do_prompt.py similarity index 95% rename from Rom24/pysrc/commands/do_prompt.py rename to src/commands/do_prompt.py index 2714d0b..5239a80 100644 --- a/Rom24/pysrc/commands/do_prompt.py +++ b/src/commands/do_prompt.py @@ -1,7 +1,7 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_protect.py b/src/commands/do_protect.py similarity index 96% rename from Rom24/pysrc/commands/do_protect.py rename to src/commands/do_protect.py index 70778cd..1149b40 100644 --- a/Rom24/pysrc/commands/do_protect.py +++ b/src/commands/do_protect.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_purge.py b/src/commands/do_purge.py similarity index 97% rename from Rom24/pysrc/commands/do_purge.py rename to src/commands/do_purge.py index 3978580..1514940 100644 --- a/Rom24/pysrc/commands/do_purge.py +++ b/src/commands/do_purge.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_game import merc diff --git a/Rom24/pysrc/commands/do_put.py b/src/commands/do_put.py similarity index 99% rename from Rom24/pysrc/commands/do_put.py rename to src/commands/do_put.py index 9c9848b..c1d4e7a 100644 --- a/Rom24/pysrc/commands/do_put.py +++ b/src/commands/do_put.py @@ -1,7 +1,7 @@ import random import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_quaff.py b/src/commands/do_quaff.py similarity index 96% rename from Rom24/pysrc/commands/do_quaff.py rename to src/commands/do_quaff.py index d0fa702..52a0ab9 100644 --- a/Rom24/pysrc/commands/do_quaff.py +++ b/src/commands/do_quaff.py @@ -1,7 +1,7 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_question.py b/src/commands/do_question.py similarity index 97% rename from Rom24/pysrc/commands/do_question.py rename to src/commands/do_question.py index d671775..2d0c31d 100644 --- a/Rom24/pysrc/commands/do_question.py +++ b/src/commands/do_question.py @@ -1,7 +1,7 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_quiet.py b/src/commands/do_quiet.py similarity index 92% rename from Rom24/pysrc/commands/do_quiet.py rename to src/commands/do_quiet.py index 973be56..fb1d795 100644 --- a/Rom24/pysrc/commands/do_quiet.py +++ b/src/commands/do_quiet.py @@ -1,7 +1,7 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_quit.py b/src/commands/do_quit.py similarity index 97% rename from Rom24/pysrc/commands/do_quit.py rename to src/commands/do_quit.py index 21022ba..30f9d4f 100644 --- a/Rom24/pysrc/commands/do_quit.py +++ b/src/commands/do_quit.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_quote.py b/src/commands/do_quote.py similarity index 97% rename from Rom24/pysrc/commands/do_quote.py rename to src/commands/do_quote.py index d18c5e6..4d72f06 100644 --- a/Rom24/pysrc/commands/do_quote.py +++ b/src/commands/do_quote.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_reboot.py b/src/commands/do_reboot.py similarity index 94% rename from Rom24/pysrc/commands/do_reboot.py rename to src/commands/do_reboot.py index 6841080..482b935 100644 --- a/Rom24/pysrc/commands/do_reboot.py +++ b/src/commands/do_reboot.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_recall.py b/src/commands/do_recall.py similarity index 97% rename from Rom24/pysrc/commands/do_recall.py rename to src/commands/do_recall.py index 5beb0bc..ec4023e 100644 --- a/Rom24/pysrc/commands/do_recall.py +++ b/src/commands/do_recall.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_game import interp diff --git a/Rom24/pysrc/commands/do_recho.py b/src/commands/do_recho.py similarity index 93% rename from Rom24/pysrc/commands/do_recho.py rename to src/commands/do_recho.py index 1b694d2..a4ef2b0 100644 --- a/Rom24/pysrc/commands/do_recho.py +++ b/src/commands/do_recho.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_recite.py b/src/commands/do_recite.py similarity index 97% rename from Rom24/pysrc/commands/do_recite.py rename to src/commands/do_recite.py index eb078ee..c1770a9 100644 --- a/Rom24/pysrc/commands/do_recite.py +++ b/src/commands/do_recite.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import random import merc diff --git a/Rom24/pysrc/commands/do_reload.py b/src/commands/do_reload.py similarity index 87% rename from Rom24/pysrc/commands/do_reload.py rename to src/commands/do_reload.py index 2e47145..449bd63 100644 --- a/Rom24/pysrc/commands/do_reload.py +++ b/src/commands/do_reload.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import hotfix diff --git a/Rom24/pysrc/commands/do_remove.py b/src/commands/do_remove.py similarity index 94% rename from Rom24/pysrc/commands/do_remove.py rename to src/commands/do_remove.py index 02da8b6..8f8b630 100644 --- a/Rom24/pysrc/commands/do_remove.py +++ b/src/commands/do_remove.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_rent.py b/src/commands/do_rent.py similarity index 86% rename from Rom24/pysrc/commands/do_rent.py rename to src/commands/do_rent.py index 0aff51a..8c521e1 100644 --- a/Rom24/pysrc/commands/do_rent.py +++ b/src/commands/do_rent.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_replay.py b/src/commands/do_replay.py similarity index 91% rename from Rom24/pysrc/commands/do_replay.py rename to src/commands/do_replay.py index d3712b2..1c66823 100644 --- a/Rom24/pysrc/commands/do_replay.py +++ b/src/commands/do_replay.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_reply.py b/src/commands/do_reply.py similarity index 98% rename from Rom24/pysrc/commands/do_reply.py rename to src/commands/do_reply.py index 43b91e9..7cb16d9 100644 --- a/Rom24/pysrc/commands/do_reply.py +++ b/src/commands/do_reply.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_report.py b/src/commands/do_report.py similarity index 94% rename from Rom24/pysrc/commands/do_report.py rename to src/commands/do_report.py index 8e4034e..1587444 100644 --- a/Rom24/pysrc/commands/do_report.py +++ b/src/commands/do_report.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_rescue.py b/src/commands/do_rescue.py similarity index 97% rename from Rom24/pysrc/commands/do_rescue.py rename to src/commands/do_rescue.py index 4b5fa93..914e20a 100644 --- a/Rom24/pysrc/commands/do_rescue.py +++ b/src/commands/do_rescue.py @@ -1,7 +1,7 @@ import random import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import const diff --git a/Rom24/pysrc/commands/do_rest.py b/src/commands/do_rest.py similarity index 99% rename from Rom24/pysrc/commands/do_rest.py rename to src/commands/do_rest.py index d26a049..5826660 100644 --- a/Rom24/pysrc/commands/do_rest.py +++ b/src/commands/do_rest.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_game import interp diff --git a/Rom24/pysrc/commands/do_restore.py b/src/commands/do_restore.py similarity index 98% rename from Rom24/pysrc/commands/do_restore.py rename to src/commands/do_restore.py index a9d995a..dfaa788 100644 --- a/Rom24/pysrc/commands/do_restore.py +++ b/src/commands/do_restore.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_return.py b/src/commands/do_return.py similarity index 95% rename from Rom24/pysrc/commands/do_return.py rename to src/commands/do_return.py index 78c817e..f1496b6 100644 --- a/Rom24/pysrc/commands/do_return.py +++ b/src/commands/do_return.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_rstat.py b/src/commands/do_rstat.py similarity index 98% rename from Rom24/pysrc/commands/do_rstat.py rename to src/commands/do_rstat.py index e9f7996..40066a4 100644 --- a/Rom24/pysrc/commands/do_rstat.py +++ b/src/commands/do_rstat.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_sacrifice.py b/src/commands/do_sacrifice.py similarity index 98% rename from Rom24/pysrc/commands/do_sacrifice.py rename to src/commands/do_sacrifice.py index b71a5b7..39b8da2 100644 --- a/Rom24/pysrc/commands/do_sacrifice.py +++ b/src/commands/do_sacrifice.py @@ -1,7 +1,7 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_save.py b/src/commands/do_save.py similarity index 91% rename from Rom24/pysrc/commands/do_save.py rename to src/commands/do_save.py index 1c0d3e8..bfd1371 100644 --- a/Rom24/pysrc/commands/do_save.py +++ b/src/commands/do_save.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_say.py b/src/commands/do_say.py similarity index 94% rename from Rom24/pysrc/commands/do_say.py rename to src/commands/do_say.py index bc3f64f..df3a5d5 100644 --- a/Rom24/pysrc/commands/do_say.py +++ b/src/commands/do_say.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_score.py b/src/commands/do_score.py similarity index 99% rename from Rom24/pysrc/commands/do_score.py rename to src/commands/do_score.py index 0d8e1da..29cf81e 100644 --- a/Rom24/pysrc/commands/do_score.py +++ b/src/commands/do_score.py @@ -1,7 +1,7 @@ import time import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import state_checks import merc diff --git a/Rom24/pysrc/commands/do_scroll.py b/src/commands/do_scroll.py similarity index 96% rename from Rom24/pysrc/commands/do_scroll.py rename to src/commands/do_scroll.py index 169222d..b8235a3 100644 --- a/Rom24/pysrc/commands/do_scroll.py +++ b/src/commands/do_scroll.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) # changes your scroll import merc diff --git a/Rom24/pysrc/commands/do_sell.py b/src/commands/do_sell.py similarity index 98% rename from Rom24/pysrc/commands/do_sell.py rename to src/commands/do_sell.py index 7e17f48..12b9554 100644 --- a/Rom24/pysrc/commands/do_sell.py +++ b/src/commands/do_sell.py @@ -1,7 +1,7 @@ import random import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_set.py b/src/commands/do_set.py similarity index 96% rename from Rom24/pysrc/commands/do_set.py rename to src/commands/do_set.py index da214ff..87e9c36 100644 --- a/Rom24/pysrc/commands/do_set.py +++ b/src/commands/do_set.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_shout.py b/src/commands/do_shout.py similarity index 97% rename from Rom24/pysrc/commands/do_shout.py rename to src/commands/do_shout.py index f23f89e..56ff88c 100644 --- a/Rom24/pysrc/commands/do_shout.py +++ b/src/commands/do_shout.py @@ -1,7 +1,7 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_show.py b/src/commands/do_show.py similarity index 92% rename from Rom24/pysrc/commands/do_show.py rename to src/commands/do_show.py index 85f122a..1d690c6 100644 --- a/Rom24/pysrc/commands/do_show.py +++ b/src/commands/do_show.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_shutdown.py b/src/commands/do_shutdown.py similarity index 94% rename from Rom24/pysrc/commands/do_shutdown.py rename to src/commands/do_shutdown.py index 31c7e1f..ddf9c6a 100644 --- a/Rom24/pysrc/commands/do_shutdown.py +++ b/src/commands/do_shutdown.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import comm import handler_ch diff --git a/Rom24/pysrc/commands/do_sit.py b/src/commands/do_sit.py similarity index 99% rename from Rom24/pysrc/commands/do_sit.py rename to src/commands/do_sit.py index d166507..5d5b3e4 100644 --- a/Rom24/pysrc/commands/do_sit.py +++ b/src/commands/do_sit.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_game import interp diff --git a/Rom24/pysrc/commands/do_skills.py b/src/commands/do_skills.py similarity index 98% rename from Rom24/pysrc/commands/do_skills.py rename to src/commands/do_skills.py index f1ccfeb..72c37b8 100644 --- a/Rom24/pysrc/commands/do_skills.py +++ b/src/commands/do_skills.py @@ -1,7 +1,7 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_slay.py b/src/commands/do_slay.py similarity index 96% rename from Rom24/pysrc/commands/do_slay.py rename to src/commands/do_slay.py index ab582d9..ac680c9 100644 --- a/Rom24/pysrc/commands/do_slay.py +++ b/src/commands/do_slay.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_sleep.py b/src/commands/do_sleep.py similarity index 98% rename from Rom24/pysrc/commands/do_sleep.py rename to src/commands/do_sleep.py index 5c220ad..ac76a8c 100644 --- a/Rom24/pysrc/commands/do_sleep.py +++ b/src/commands/do_sleep.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_game import interp diff --git a/Rom24/pysrc/commands/do_slookup.py b/src/commands/do_slookup.py similarity index 95% rename from Rom24/pysrc/commands/do_slookup.py rename to src/commands/do_slookup.py index 2e8fafc..4ac1e5b 100644 --- a/Rom24/pysrc/commands/do_slookup.py +++ b/src/commands/do_slookup.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import const diff --git a/Rom24/pysrc/commands/do_smote.py b/src/commands/do_smote.py similarity index 96% rename from Rom24/pysrc/commands/do_smote.py rename to src/commands/do_smote.py index 3298c02..5058448 100644 --- a/Rom24/pysrc/commands/do_smote.py +++ b/src/commands/do_smote.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_sneak.py b/src/commands/do_sneak.py similarity index 95% rename from Rom24/pysrc/commands/do_sneak.py rename to src/commands/do_sneak.py index db56c81..dc1bad4 100644 --- a/Rom24/pysrc/commands/do_sneak.py +++ b/src/commands/do_sneak.py @@ -1,7 +1,7 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import random import handler_game diff --git a/Rom24/pysrc/commands/do_snoop.py b/src/commands/do_snoop.py similarity index 97% rename from Rom24/pysrc/commands/do_snoop.py rename to src/commands/do_snoop.py index d88ae23..4906e02 100644 --- a/Rom24/pysrc/commands/do_snoop.py +++ b/src/commands/do_snoop.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_socials.py b/src/commands/do_socials.py similarity index 91% rename from Rom24/pysrc/commands/do_socials.py rename to src/commands/do_socials.py index 4d510d6..bd45fbb 100644 --- a/Rom24/pysrc/commands/do_socials.py +++ b/src/commands/do_socials.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_sockets.py b/src/commands/do_sockets.py similarity index 95% rename from Rom24/pysrc/commands/do_sockets.py rename to src/commands/do_sockets.py index 4551050..587b67d 100644 --- a/Rom24/pysrc/commands/do_sockets.py +++ b/src/commands/do_sockets.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_south.py b/src/commands/do_south.py similarity index 87% rename from Rom24/pysrc/commands/do_south.py rename to src/commands/do_south.py index 5aee925..ccdbc07 100644 --- a/Rom24/pysrc/commands/do_south.py +++ b/src/commands/do_south.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_ch import interp diff --git a/Rom24/pysrc/commands/do_spells.py b/src/commands/do_spells.py similarity index 98% rename from Rom24/pysrc/commands/do_spells.py rename to src/commands/do_spells.py index 4dac2d7..23a92bd 100644 --- a/Rom24/pysrc/commands/do_spells.py +++ b/src/commands/do_spells.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import const diff --git a/Rom24/pysrc/commands/do_split.py b/src/commands/do_split.py similarity index 98% rename from Rom24/pysrc/commands/do_split.py rename to src/commands/do_split.py index e5d6b65..574b8ce 100644 --- a/Rom24/pysrc/commands/do_split.py +++ b/src/commands/do_split.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_sset.py b/src/commands/do_sset.py similarity index 97% rename from Rom24/pysrc/commands/do_sset.py rename to src/commands/do_sset.py index 7a41369..d7d9e94 100644 --- a/Rom24/pysrc/commands/do_sset.py +++ b/src/commands/do_sset.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_stand.py b/src/commands/do_stand.py similarity index 98% rename from Rom24/pysrc/commands/do_stand.py rename to src/commands/do_stand.py index 7c45c98..740d3fe 100644 --- a/Rom24/pysrc/commands/do_stand.py +++ b/src/commands/do_stand.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_game import interp diff --git a/Rom24/pysrc/commands/do_stat.py b/src/commands/do_stat.py similarity index 96% rename from Rom24/pysrc/commands/do_stat.py rename to src/commands/do_stat.py index 1704b89..ffc6960 100644 --- a/Rom24/pysrc/commands/do_stat.py +++ b/src/commands/do_stat.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_steal.py b/src/commands/do_steal.py similarity index 99% rename from Rom24/pysrc/commands/do_steal.py rename to src/commands/do_steal.py index ba3270a..e5c564c 100644 --- a/Rom24/pysrc/commands/do_steal.py +++ b/src/commands/do_steal.py @@ -1,7 +1,7 @@ import random import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_string.py b/src/commands/do_string.py similarity index 98% rename from Rom24/pysrc/commands/do_string.py rename to src/commands/do_string.py index 1f19130..c795c45 100644 --- a/Rom24/pysrc/commands/do_string.py +++ b/src/commands/do_string.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_switch.py b/src/commands/do_switch.py similarity index 97% rename from Rom24/pysrc/commands/do_switch.py rename to src/commands/do_switch.py index 973e264..9781c18 100644 --- a/Rom24/pysrc/commands/do_switch.py +++ b/src/commands/do_switch.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_tabledump.py b/src/commands/do_tabledump.py similarity index 89% rename from Rom24/pysrc/commands/do_tabledump.py rename to src/commands/do_tabledump.py index 05c77bd..c83e94f 100644 --- a/Rom24/pysrc/commands/do_tabledump.py +++ b/src/commands/do_tabledump.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import database import merc diff --git a/Rom24/pysrc/commands/do_tableload.py b/src/commands/do_tableload.py similarity index 89% rename from Rom24/pysrc/commands/do_tableload.py rename to src/commands/do_tableload.py index a805081..79fde93 100644 --- a/Rom24/pysrc/commands/do_tableload.py +++ b/src/commands/do_tableload.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import interp import merc diff --git a/Rom24/pysrc/commands/do_tell.py b/src/commands/do_tell.py similarity index 98% rename from Rom24/pysrc/commands/do_tell.py rename to src/commands/do_tell.py index 66b36b5..6769351 100644 --- a/Rom24/pysrc/commands/do_tell.py +++ b/src/commands/do_tell.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_term.py b/src/commands/do_term.py similarity index 98% rename from Rom24/pysrc/commands/do_term.py rename to src/commands/do_term.py index f8932f2..a018abb 100644 --- a/Rom24/pysrc/commands/do_term.py +++ b/src/commands/do_term.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_time.py b/src/commands/do_time.py similarity index 97% rename from Rom24/pysrc/commands/do_time.py rename to src/commands/do_time.py index 153540d..728e7f9 100644 --- a/Rom24/pysrc/commands/do_time.py +++ b/src/commands/do_time.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_title.py b/src/commands/do_title.py similarity index 92% rename from Rom24/pysrc/commands/do_title.py rename to src/commands/do_title.py index 654d5f7..8dbe4fc 100644 --- a/Rom24/pysrc/commands/do_title.py +++ b/src/commands/do_title.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_train.py b/src/commands/do_train.py similarity index 98% rename from Rom24/pysrc/commands/do_train.py rename to src/commands/do_train.py index 0280dd0..edff3d1 100644 --- a/Rom24/pysrc/commands/do_train.py +++ b/src/commands/do_train.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_game import merc diff --git a/Rom24/pysrc/commands/do_transfer.py b/src/commands/do_transfer.py similarity index 98% rename from Rom24/pysrc/commands/do_transfer.py rename to src/commands/do_transfer.py index 992f3d2..f40fe60 100644 --- a/Rom24/pysrc/commands/do_transfer.py +++ b/src/commands/do_transfer.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_game import merc diff --git a/Rom24/pysrc/commands/do_trip.py b/src/commands/do_trip.py similarity index 98% rename from Rom24/pysrc/commands/do_trip.py rename to src/commands/do_trip.py index 58ec262..26d0a09 100644 --- a/Rom24/pysrc/commands/do_trip.py +++ b/src/commands/do_trip.py @@ -1,7 +1,7 @@ import random import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import game_utils import merc diff --git a/Rom24/pysrc/commands/do_trust.py b/src/commands/do_trust.py similarity index 95% rename from Rom24/pysrc/commands/do_trust.py rename to src/commands/do_trust.py index 2bfa85c..3d03b8f 100644 --- a/Rom24/pysrc/commands/do_trust.py +++ b/src/commands/do_trust.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_typo.py b/src/commands/do_typo.py similarity index 89% rename from Rom24/pysrc/commands/do_typo.py rename to src/commands/do_typo.py index 842e46c..472083d 100644 --- a/Rom24/pysrc/commands/do_typo.py +++ b/src/commands/do_typo.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_unalias.py b/src/commands/do_unalias.py similarity index 94% rename from Rom24/pysrc/commands/do_unalias.py rename to src/commands/do_unalias.py index df9bcd0..33cb36d 100644 --- a/Rom24/pysrc/commands/do_unalias.py +++ b/src/commands/do_unalias.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_unlock.py b/src/commands/do_unlock.py similarity index 98% rename from Rom24/pysrc/commands/do_unlock.py rename to src/commands/do_unlock.py index 256ef09..4ea3c31 100644 --- a/Rom24/pysrc/commands/do_unlock.py +++ b/src/commands/do_unlock.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_game import handler_room diff --git a/Rom24/pysrc/commands/do_up.py b/src/commands/do_up.py similarity index 86% rename from Rom24/pysrc/commands/do_up.py rename to src/commands/do_up.py index 837d960..f825e2b 100644 --- a/Rom24/pysrc/commands/do_up.py +++ b/src/commands/do_up.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_ch import interp diff --git a/Rom24/pysrc/commands/do_value.py b/src/commands/do_value.py similarity index 97% rename from Rom24/pysrc/commands/do_value.py rename to src/commands/do_value.py index 7e8fb17..e68aaad 100644 --- a/Rom24/pysrc/commands/do_value.py +++ b/src/commands/do_value.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_violate.py b/src/commands/do_violate.py similarity index 97% rename from Rom24/pysrc/commands/do_violate.py rename to src/commands/do_violate.py index a1515cb..a9cebc2 100644 --- a/Rom24/pysrc/commands/do_violate.py +++ b/src/commands/do_violate.py @@ -3,7 +3,7 @@ import handler_game -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_visible.py b/src/commands/do_visible.py similarity index 92% rename from Rom24/pysrc/commands/do_visible.py rename to src/commands/do_visible.py index bf09596..2c5fdde 100644 --- a/Rom24/pysrc/commands/do_visible.py +++ b/src/commands/do_visible.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import interp import merc diff --git a/Rom24/pysrc/commands/do_vnum.py b/src/commands/do_vnum.py similarity index 95% rename from Rom24/pysrc/commands/do_vnum.py rename to src/commands/do_vnum.py index dc59199..2283b03 100644 --- a/Rom24/pysrc/commands/do_vnum.py +++ b/src/commands/do_vnum.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_wake.py b/src/commands/do_wake.py similarity index 96% rename from Rom24/pysrc/commands/do_wake.py rename to src/commands/do_wake.py index d07bb20..60d2d07 100644 --- a/Rom24/pysrc/commands/do_wake.py +++ b/src/commands/do_wake.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import game_utils import merc diff --git a/Rom24/pysrc/commands/do_wear.py b/src/commands/do_wear.py similarity index 96% rename from Rom24/pysrc/commands/do_wear.py rename to src/commands/do_wear.py index 1ec36ba..da04680 100644 --- a/Rom24/pysrc/commands/do_wear.py +++ b/src/commands/do_wear.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import game_utils import merc diff --git a/Rom24/pysrc/commands/do_weather.py b/src/commands/do_weather.py similarity index 94% rename from Rom24/pysrc/commands/do_weather.py rename to src/commands/do_weather.py index a2f92c9..7918261 100644 --- a/Rom24/pysrc/commands/do_weather.py +++ b/src/commands/do_weather.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_game import merc diff --git a/Rom24/pysrc/commands/do_west.py b/src/commands/do_west.py similarity index 87% rename from Rom24/pysrc/commands/do_west.py rename to src/commands/do_west.py index 7d1cbd7..1c0ded4 100644 --- a/Rom24/pysrc/commands/do_west.py +++ b/src/commands/do_west.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_ch import interp diff --git a/Rom24/pysrc/commands/do_where.py b/src/commands/do_where.py similarity index 97% rename from Rom24/pysrc/commands/do_where.py rename to src/commands/do_where.py index d7bd646..35de31b 100644 --- a/Rom24/pysrc/commands/do_where.py +++ b/src/commands/do_where.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import game_utils import merc diff --git a/Rom24/pysrc/commands/do_who.py b/src/commands/do_who.py similarity index 99% rename from Rom24/pysrc/commands/do_who.py rename to src/commands/do_who.py index 4538b70..ea304d2 100644 --- a/Rom24/pysrc/commands/do_who.py +++ b/src/commands/do_who.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import game_utils import merc diff --git a/Rom24/pysrc/commands/do_whois.py b/src/commands/do_whois.py similarity index 98% rename from Rom24/pysrc/commands/do_whois.py rename to src/commands/do_whois.py index 60e5cf2..ef8fdbf 100644 --- a/Rom24/pysrc/commands/do_whois.py +++ b/src/commands/do_whois.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import game_utils import merc diff --git a/Rom24/pysrc/commands/do_wimpy.py b/src/commands/do_wimpy.py similarity index 94% rename from Rom24/pysrc/commands/do_wimpy.py rename to src/commands/do_wimpy.py index 86f70a7..2154e99 100644 --- a/Rom24/pysrc/commands/do_wimpy.py +++ b/src/commands/do_wimpy.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import game_utils import merc diff --git a/Rom24/pysrc/commands/do_wizhelp.py b/src/commands/do_wizhelp.py similarity index 92% rename from Rom24/pysrc/commands/do_wizhelp.py rename to src/commands/do_wizhelp.py index 0456c7e..21b3f87 100644 --- a/Rom24/pysrc/commands/do_wizhelp.py +++ b/src/commands/do_wizhelp.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_wizlock.py b/src/commands/do_wizlock.py similarity index 93% rename from Rom24/pysrc/commands/do_wizlock.py rename to src/commands/do_wizlock.py index bffa39a..db23178 100644 --- a/Rom24/pysrc/commands/do_wizlock.py +++ b/src/commands/do_wizlock.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_wiznet.py b/src/commands/do_wiznet.py similarity index 98% rename from Rom24/pysrc/commands/do_wiznet.py rename to src/commands/do_wiznet.py index 25aca9a..bd41ce0 100644 --- a/Rom24/pysrc/commands/do_wiznet.py +++ b/src/commands/do_wiznet.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_worth.py b/src/commands/do_worth.py similarity index 92% rename from Rom24/pysrc/commands/do_worth.py rename to src/commands/do_worth.py index f7be45d..748b682 100644 --- a/Rom24/pysrc/commands/do_worth.py +++ b/src/commands/do_worth.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_yell.py b/src/commands/do_yell.py similarity index 95% rename from Rom24/pysrc/commands/do_yell.py rename to src/commands/do_yell.py index 3383446..c21359c 100644 --- a/Rom24/pysrc/commands/do_yell.py +++ b/src/commands/do_yell.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/commands/do_zap.py b/src/commands/do_zap.py similarity index 98% rename from Rom24/pysrc/commands/do_zap.py rename to src/commands/do_zap.py index 4dcebe2..9e7d941 100644 --- a/Rom24/pysrc/commands/do_zap.py +++ b/src/commands/do_zap.py @@ -2,7 +2,7 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import game_utils import handler_game diff --git a/Rom24/pysrc/commands/do_zecho.py b/src/commands/do_zecho.py similarity index 93% rename from Rom24/pysrc/commands/do_zecho.py rename to src/commands/do_zecho.py index 99a228e..89d06b0 100644 --- a/Rom24/pysrc/commands/do_zecho.py +++ b/src/commands/do_zecho.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import interp diff --git a/Rom24/pysrc/const.py b/src/const.py similarity index 99% rename from Rom24/pysrc/const.py rename to src/const.py index 71f5603..dd10519 100644 --- a/Rom24/pysrc/const.py +++ b/src/const.py @@ -34,7 +34,7 @@ from collections import OrderedDict, namedtuple import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) spell_lookup_dict = {} diff --git a/Rom24/pysrc/data_loader.py b/src/data_loader.py similarity index 99% rename from Rom24/pysrc/data_loader.py rename to src/data_loader.py index 93f10a8..efc7bc5 100644 --- a/Rom24/pysrc/data_loader.py +++ b/src/data_loader.py @@ -3,7 +3,7 @@ import collections import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import const import object_creator diff --git a/Rom24/pysrc/database/__init__.py b/src/database/__init__.py similarity index 100% rename from Rom24/pysrc/database/__init__.py rename to src/database/__init__.py diff --git a/Rom24/pysrc/database/read/__init__.py b/src/database/read/__init__.py similarity index 100% rename from Rom24/pysrc/database/read/__init__.py rename to src/database/read/__init__.py diff --git a/Rom24/pysrc/database/read/read_tables.py b/src/database/read/read_tables.py similarity index 97% rename from Rom24/pysrc/database/read/read_tables.py rename to src/database/read/read_tables.py index 9251cfb..89bca74 100644 --- a/Rom24/pysrc/database/read/read_tables.py +++ b/src/database/read/read_tables.py @@ -5,7 +5,7 @@ from settings import DATA_DIR, DATA_EXTN -logger = logging.getLogger() +logger = logging.getLogger(__name__) from database.tracker import tables diff --git a/Rom24/pysrc/database/tracker.py b/src/database/tracker.py similarity index 100% rename from Rom24/pysrc/database/tracker.py rename to src/database/tracker.py diff --git a/Rom24/pysrc/database/write/__init__.py b/src/database/write/__init__.py similarity index 100% rename from Rom24/pysrc/database/write/__init__.py rename to src/database/write/__init__.py diff --git a/Rom24/pysrc/database/write/write_tables.py b/src/database/write/write_tables.py similarity index 95% rename from Rom24/pysrc/database/write/write_tables.py rename to src/database/write/write_tables.py index b0484ae..4d1e5fd 100644 --- a/Rom24/pysrc/database/write/write_tables.py +++ b/src/database/write/write_tables.py @@ -2,7 +2,7 @@ import os import json -logger = logging.getLogger() +logger = logging.getLogger(__name__) from database.tracker import tables from settings import DATA_EXTN, DATA_DIR diff --git a/Rom24/pysrc/db.py b/src/db.py similarity index 99% rename from Rom24/pysrc/db.py rename to src/db.py index 6add1af..d8abb7c 100644 --- a/Rom24/pysrc/db.py +++ b/src/db.py @@ -37,7 +37,7 @@ import time import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import update diff --git a/Rom24/pysrc/effects.py b/src/effects.py similarity index 99% rename from Rom24/pysrc/effects.py rename to src/effects.py index 5691273..9c01c1d 100644 --- a/Rom24/pysrc/effects.py +++ b/src/effects.py @@ -34,7 +34,7 @@ import random import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import handler_game diff --git a/Rom24/pysrc/environment.py b/src/environment.py similarity index 99% rename from Rom24/pysrc/environment.py rename to src/environment.py index f1ad675..fef3c87 100644 --- a/Rom24/pysrc/environment.py +++ b/src/environment.py @@ -1,7 +1,7 @@ import random import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import handler_game diff --git a/Rom24/pysrc/equipment.py b/src/equipment.py similarity index 99% rename from Rom24/pysrc/equipment.py rename to src/equipment.py index 3d092fa..ffe2eea 100644 --- a/Rom24/pysrc/equipment.py +++ b/src/equipment.py @@ -5,7 +5,7 @@ import collections import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import instance diff --git a/Rom24/pysrc/fight.py b/src/fight.py similarity index 99% rename from Rom24/pysrc/fight.py rename to src/fight.py index 0ff9914..07bc7b4 100644 --- a/Rom24/pysrc/fight.py +++ b/src/fight.py @@ -34,7 +34,7 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) from merc import * import handler_ch diff --git a/Rom24/pysrc/game_utils.py b/src/game_utils.py similarity index 99% rename from Rom24/pysrc/game_utils.py rename to src/game_utils.py index a7e7251..077868f 100644 --- a/Rom24/pysrc/game_utils.py +++ b/src/game_utils.py @@ -7,7 +7,7 @@ import random import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import settings import merc diff --git a/Rom24/pysrc/handler_ch.py b/src/handler_ch.py similarity index 99% rename from Rom24/pysrc/handler_ch.py rename to src/handler_ch.py index eb3847e..eccc132 100644 --- a/Rom24/pysrc/handler_ch.py +++ b/src/handler_ch.py @@ -35,7 +35,7 @@ import random import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import handler_game diff --git a/Rom24/pysrc/handler_game.py b/src/handler_game.py similarity index 99% rename from Rom24/pysrc/handler_game.py rename to src/handler_game.py index f11b466..7e29f24 100644 --- a/Rom24/pysrc/handler_game.py +++ b/src/handler_game.py @@ -37,7 +37,7 @@ import json import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_ch import handler_item diff --git a/Rom24/pysrc/handler_item.py b/src/handler_item.py similarity index 99% rename from Rom24/pysrc/handler_item.py rename to src/handler_item.py index 1be25c1..78948ca 100644 --- a/Rom24/pysrc/handler_item.py +++ b/src/handler_item.py @@ -38,7 +38,7 @@ import time import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import instance import settings diff --git a/Rom24/pysrc/handler_log.py b/src/handler_log.py similarity index 99% rename from Rom24/pysrc/handler_log.py rename to src/handler_log.py index dbc5172..eb24a5f 100644 --- a/Rom24/pysrc/handler_log.py +++ b/src/handler_log.py @@ -37,7 +37,7 @@ import inspect import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import handler_pc diff --git a/Rom24/pysrc/handler_magic.py b/src/handler_magic.py similarity index 99% rename from Rom24/pysrc/handler_magic.py rename to src/handler_magic.py index 4aac832..b9a1cd2 100644 --- a/Rom24/pysrc/handler_magic.py +++ b/src/handler_magic.py @@ -36,7 +36,7 @@ import random import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import handler_game diff --git a/Rom24/pysrc/handler_npc.py b/src/handler_npc.py similarity index 99% rename from Rom24/pysrc/handler_npc.py rename to src/handler_npc.py index 75c2312..25b5016 100644 --- a/Rom24/pysrc/handler_npc.py +++ b/src/handler_npc.py @@ -37,7 +37,7 @@ import time import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import living import pyprogs diff --git a/Rom24/pysrc/handler_pc.py b/src/handler_pc.py similarity index 99% rename from Rom24/pysrc/handler_pc.py rename to src/handler_pc.py index 47ea6a6..ff4e3d6 100644 --- a/Rom24/pysrc/handler_pc.py +++ b/src/handler_pc.py @@ -6,7 +6,7 @@ import hashlib import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import game_utils import handler_log diff --git a/Rom24/pysrc/handler_room.py b/src/handler_room.py similarity index 99% rename from Rom24/pysrc/handler_room.py rename to src/handler_room.py index 5b37a5c..462aea3 100644 --- a/Rom24/pysrc/handler_room.py +++ b/src/handler_room.py @@ -39,7 +39,7 @@ import time import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import handler_game diff --git a/Rom24/pysrc/hotfix.py b/src/hotfix.py similarity index 99% rename from Rom24/pysrc/hotfix.py rename to src/hotfix.py index cc45807..3bd2cba 100644 --- a/Rom24/pysrc/hotfix.py +++ b/src/hotfix.py @@ -36,7 +36,7 @@ import traceback import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) # dictionary of files to track. will be key'd by file name and the value will be modified unix timestamp tracked_files = {} diff --git a/Rom24/pysrc/immortal.py b/src/immortal.py similarity index 96% rename from Rom24/pysrc/immortal.py rename to src/immortal.py index ba22373..e7574bf 100644 --- a/Rom24/pysrc/immortal.py +++ b/src/immortal.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import bit import const diff --git a/Rom24/pysrc/instance.py b/src/instance.py similarity index 99% rename from Rom24/pysrc/instance.py rename to src/instance.py index a69a885..b518f94 100644 --- a/Rom24/pysrc/instance.py +++ b/src/instance.py @@ -39,7 +39,7 @@ import re import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import settings diff --git a/Rom24/pysrc/interp.py b/src/interp.py similarity index 98% rename from Rom24/pysrc/interp.py rename to src/interp.py index 9b9fd64..46971de 100644 --- a/Rom24/pysrc/interp.py +++ b/src/interp.py @@ -34,7 +34,7 @@ from collections import OrderedDict import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import living diff --git a/Rom24/pysrc/inventory.py b/src/inventory.py similarity index 96% rename from Rom24/pysrc/inventory.py rename to src/inventory.py index dcb6d38..5f7bc4a 100644 --- a/Rom24/pysrc/inventory.py +++ b/src/inventory.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import const import merc diff --git a/Rom24/pysrc/item_flags.py b/src/item_flags.py similarity index 99% rename from Rom24/pysrc/item_flags.py rename to src/item_flags.py index 8949b3b..f43c317 100644 --- a/Rom24/pysrc/item_flags.py +++ b/src/item_flags.py @@ -3,7 +3,7 @@ import json import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) class ItemFlags: diff --git a/Rom24/pysrc/living.py b/src/living.py similarity index 99% rename from Rom24/pysrc/living.py rename to src/living.py index 1b703cc..b6d699e 100644 --- a/Rom24/pysrc/living.py +++ b/src/living.py @@ -34,7 +34,7 @@ import random import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import equipment diff --git a/Rom24/pysrc/magic.py b/src/magic.py similarity index 100% rename from Rom24/pysrc/magic.py rename to src/magic.py diff --git a/Rom24/pysrc/merc.py b/src/merc.py similarity index 99% rename from Rom24/pysrc/merc.py rename to src/merc.py index b80518b..ea5e8d5 100644 --- a/Rom24/pysrc/merc.py +++ b/src/merc.py @@ -36,7 +36,7 @@ import collections import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import state_checks diff --git a/Rom24/pysrc/miniboa/LICENSE.TXT b/src/miniboa/LICENSE.TXT similarity index 100% rename from Rom24/pysrc/miniboa/LICENSE.TXT rename to src/miniboa/LICENSE.TXT diff --git a/Rom24/pysrc/miniboa/README.TXT b/src/miniboa/README.TXT similarity index 100% rename from Rom24/pysrc/miniboa/README.TXT rename to src/miniboa/README.TXT diff --git a/Rom24/pysrc/miniboa/__init__.py b/src/miniboa/__init__.py similarity index 100% rename from Rom24/pysrc/miniboa/__init__.py rename to src/miniboa/__init__.py diff --git a/Rom24/pysrc/miniboa/asyncio.py b/src/miniboa/asyncio.py similarity index 99% rename from Rom24/pysrc/miniboa/asyncio.py rename to src/miniboa/asyncio.py index 870a212..6649864 100644 --- a/Rom24/pysrc/miniboa/asyncio.py +++ b/src/miniboa/asyncio.py @@ -32,7 +32,7 @@ import sys import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) from miniboa.telnet import TelnetClient from miniboa.telnet import ConnectionLost diff --git a/Rom24/pysrc/miniboa/colors.py b/src/miniboa/colors.py similarity index 99% rename from Rom24/pysrc/miniboa/colors.py rename to src/miniboa/colors.py index 3fafebb..08317f4 100644 --- a/Rom24/pysrc/miniboa/colors.py +++ b/src/miniboa/colors.py @@ -47,7 +47,7 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) from collections import namedtuple diff --git a/Rom24/pysrc/miniboa/telnet.py b/src/miniboa/telnet.py similarity index 99% rename from Rom24/pysrc/miniboa/telnet.py rename to src/miniboa/telnet.py index 3c160b9..30fcca7 100644 --- a/Rom24/pysrc/miniboa/telnet.py +++ b/src/miniboa/telnet.py @@ -32,7 +32,7 @@ import time import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) from miniboa.terminal import color_convert from miniboa.terminal import word_wrap diff --git a/Rom24/pysrc/miniboa/terminal.py b/src/miniboa/terminal.py similarity index 99% rename from Rom24/pysrc/miniboa/terminal.py rename to src/miniboa/terminal.py index a06733b..e49ed95 100644 --- a/Rom24/pysrc/miniboa/terminal.py +++ b/src/miniboa/terminal.py @@ -51,7 +51,7 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import re diff --git a/Rom24/pysrc/nanny.py b/src/nanny.py similarity index 99% rename from Rom24/pysrc/nanny.py rename to src/nanny.py index 4ece865..d28f52f 100644 --- a/Rom24/pysrc/nanny.py +++ b/src/nanny.py @@ -35,7 +35,7 @@ import os import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import const import object_creator diff --git a/Rom24/pysrc/object_creator.py b/src/object_creator.py similarity index 99% rename from Rom24/pysrc/object_creator.py rename to src/object_creator.py index c66fb54..6959753 100644 --- a/Rom24/pysrc/object_creator.py +++ b/src/object_creator.py @@ -4,7 +4,7 @@ import sys import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import game_utils import handler_game diff --git a/Rom24/pysrc/physical.py b/src/physical.py similarity index 91% rename from Rom24/pysrc/physical.py rename to src/physical.py index eaba9ac..21d95f6 100644 --- a/Rom24/pysrc/physical.py +++ b/src/physical.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import bit import tables diff --git a/Rom24/pysrc/pyom.py b/src/pyom.py similarity index 98% rename from Rom24/pysrc/pyom.py rename to src/pyom.py index 2b33455..daca304 100644 --- a/Rom24/pysrc/pyom.py +++ b/src/pyom.py @@ -53,7 +53,7 @@ def trace_log(self, message, *args, **kws): logging.addLevelName(5, 'TRACE') logging.Logger.trace = trace_log logging.basicConfig(format='%(asctime)s %(levelname)-8s %(module)16s| %(message)s', level=21) -logger = logging.getLogger() +logger = logging.getLogger(__name__) from miniboa import TelnetServer from settings import PORT diff --git a/Rom24/pysrc/pyprogs.py b/src/pyprogs.py similarity index 99% rename from Rom24/pysrc/pyprogs.py rename to src/pyprogs.py index 5b45666..995bbb0 100644 --- a/Rom24/pysrc/pyprogs.py +++ b/src/pyprogs.py @@ -7,7 +7,7 @@ import io import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import settings diff --git a/Rom24/pysrc/save.py b/src/save.py similarity index 99% rename from Rom24/pysrc/save.py rename to src/save.py index 3f8fcbd..d2372bd 100644 --- a/Rom24/pysrc/save.py +++ b/src/save.py @@ -3,7 +3,7 @@ from collections import OrderedDict import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import object_creator import instance diff --git a/Rom24/pysrc/settings.py b/src/settings.py similarity index 96% rename from Rom24/pysrc/settings.py rename to src/settings.py index 15cc57e..a9d7ea7 100644 --- a/Rom24/pysrc/settings.py +++ b/src/settings.py @@ -1,7 +1,7 @@ import os import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) #Game settings PORT = 1337 diff --git a/Rom24/pysrc/shell.py b/src/shell.py similarity index 90% rename from Rom24/pysrc/shell.py rename to src/shell.py index 9be48c0..7fbe657 100644 --- a/Rom24/pysrc/shell.py +++ b/src/shell.py @@ -4,7 +4,7 @@ import code import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import db diff --git a/Rom24/pysrc/shop_utils.py b/src/shop_utils.py similarity index 99% rename from Rom24/pysrc/shop_utils.py rename to src/shop_utils.py index 56b7a4c..306e763 100644 --- a/Rom24/pysrc/shop_utils.py +++ b/src/shop_utils.py @@ -1,7 +1,7 @@ __author__ = 'syn' import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import handler_game diff --git a/Rom24/pysrc/skills.py b/src/skills.py similarity index 99% rename from Rom24/pysrc/skills.py rename to src/skills.py index 76a321c..a161317 100644 --- a/Rom24/pysrc/skills.py +++ b/src/skills.py @@ -34,7 +34,7 @@ import random import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) from merc import * import const diff --git a/Rom24/pysrc/special.py b/src/special.py similarity index 99% rename from Rom24/pysrc/special.py rename to src/special.py index 358e8e5..32b3fc1 100644 --- a/Rom24/pysrc/special.py +++ b/src/special.py @@ -34,7 +34,7 @@ import random import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import handler_ch import const diff --git a/Rom24/pysrc/spells/__init__.py b/src/spells/__init__.py similarity index 100% rename from Rom24/pysrc/spells/__init__.py rename to src/spells/__init__.py diff --git a/Rom24/pysrc/spells/spell_acid_blast.py b/src/spells/spell_acid_blast.py similarity index 100% rename from Rom24/pysrc/spells/spell_acid_blast.py rename to src/spells/spell_acid_blast.py diff --git a/Rom24/pysrc/spells/spell_acid_breath.py b/src/spells/spell_acid_breath.py similarity index 100% rename from Rom24/pysrc/spells/spell_acid_breath.py rename to src/spells/spell_acid_breath.py diff --git a/Rom24/pysrc/spells/spell_armor.py b/src/spells/spell_armor.py similarity index 100% rename from Rom24/pysrc/spells/spell_armor.py rename to src/spells/spell_armor.py diff --git a/Rom24/pysrc/spells/spell_bless.py b/src/spells/spell_bless.py similarity index 100% rename from Rom24/pysrc/spells/spell_bless.py rename to src/spells/spell_bless.py diff --git a/Rom24/pysrc/spells/spell_blindness.py b/src/spells/spell_blindness.py similarity index 100% rename from Rom24/pysrc/spells/spell_blindness.py rename to src/spells/spell_blindness.py diff --git a/Rom24/pysrc/spells/spell_burning_hands.py b/src/spells/spell_burning_hands.py similarity index 100% rename from Rom24/pysrc/spells/spell_burning_hands.py rename to src/spells/spell_burning_hands.py diff --git a/Rom24/pysrc/spells/spell_call_lightning.py b/src/spells/spell_call_lightning.py similarity index 100% rename from Rom24/pysrc/spells/spell_call_lightning.py rename to src/spells/spell_call_lightning.py diff --git a/Rom24/pysrc/spells/spell_calm.py b/src/spells/spell_calm.py similarity index 100% rename from Rom24/pysrc/spells/spell_calm.py rename to src/spells/spell_calm.py diff --git a/Rom24/pysrc/spells/spell_cancellation.py b/src/spells/spell_cancellation.py similarity index 100% rename from Rom24/pysrc/spells/spell_cancellation.py rename to src/spells/spell_cancellation.py diff --git a/Rom24/pysrc/spells/spell_cause_critical.py b/src/spells/spell_cause_critical.py similarity index 100% rename from Rom24/pysrc/spells/spell_cause_critical.py rename to src/spells/spell_cause_critical.py diff --git a/Rom24/pysrc/spells/spell_cause_light.py b/src/spells/spell_cause_light.py similarity index 100% rename from Rom24/pysrc/spells/spell_cause_light.py rename to src/spells/spell_cause_light.py diff --git a/Rom24/pysrc/spells/spell_cause_serious.py b/src/spells/spell_cause_serious.py similarity index 100% rename from Rom24/pysrc/spells/spell_cause_serious.py rename to src/spells/spell_cause_serious.py diff --git a/Rom24/pysrc/spells/spell_chain_lightning.py b/src/spells/spell_chain_lightning.py similarity index 100% rename from Rom24/pysrc/spells/spell_chain_lightning.py rename to src/spells/spell_chain_lightning.py diff --git a/Rom24/pysrc/spells/spell_change_sex.py b/src/spells/spell_change_sex.py similarity index 100% rename from Rom24/pysrc/spells/spell_change_sex.py rename to src/spells/spell_change_sex.py diff --git a/Rom24/pysrc/spells/spell_charm_person.py b/src/spells/spell_charm_person.py similarity index 100% rename from Rom24/pysrc/spells/spell_charm_person.py rename to src/spells/spell_charm_person.py diff --git a/Rom24/pysrc/spells/spell_chill_touch.py b/src/spells/spell_chill_touch.py similarity index 100% rename from Rom24/pysrc/spells/spell_chill_touch.py rename to src/spells/spell_chill_touch.py diff --git a/Rom24/pysrc/spells/spell_colour_spray.py b/src/spells/spell_colour_spray.py similarity index 100% rename from Rom24/pysrc/spells/spell_colour_spray.py rename to src/spells/spell_colour_spray.py diff --git a/Rom24/pysrc/spells/spell_continual_light.py b/src/spells/spell_continual_light.py similarity index 100% rename from Rom24/pysrc/spells/spell_continual_light.py rename to src/spells/spell_continual_light.py diff --git a/Rom24/pysrc/spells/spell_control_weather.py b/src/spells/spell_control_weather.py similarity index 100% rename from Rom24/pysrc/spells/spell_control_weather.py rename to src/spells/spell_control_weather.py diff --git a/Rom24/pysrc/spells/spell_create_food.py b/src/spells/spell_create_food.py similarity index 100% rename from Rom24/pysrc/spells/spell_create_food.py rename to src/spells/spell_create_food.py diff --git a/Rom24/pysrc/spells/spell_create_rose.py b/src/spells/spell_create_rose.py similarity index 100% rename from Rom24/pysrc/spells/spell_create_rose.py rename to src/spells/spell_create_rose.py diff --git a/Rom24/pysrc/spells/spell_create_spring.py b/src/spells/spell_create_spring.py similarity index 100% rename from Rom24/pysrc/spells/spell_create_spring.py rename to src/spells/spell_create_spring.py diff --git a/Rom24/pysrc/spells/spell_create_water.py b/src/spells/spell_create_water.py similarity index 100% rename from Rom24/pysrc/spells/spell_create_water.py rename to src/spells/spell_create_water.py diff --git a/Rom24/pysrc/spells/spell_cure_blindness.py b/src/spells/spell_cure_blindness.py similarity index 100% rename from Rom24/pysrc/spells/spell_cure_blindness.py rename to src/spells/spell_cure_blindness.py diff --git a/Rom24/pysrc/spells/spell_cure_critical.py b/src/spells/spell_cure_critical.py similarity index 100% rename from Rom24/pysrc/spells/spell_cure_critical.py rename to src/spells/spell_cure_critical.py diff --git a/Rom24/pysrc/spells/spell_cure_disease.py b/src/spells/spell_cure_disease.py similarity index 100% rename from Rom24/pysrc/spells/spell_cure_disease.py rename to src/spells/spell_cure_disease.py diff --git a/Rom24/pysrc/spells/spell_cure_light.py b/src/spells/spell_cure_light.py similarity index 100% rename from Rom24/pysrc/spells/spell_cure_light.py rename to src/spells/spell_cure_light.py diff --git a/Rom24/pysrc/spells/spell_cure_poison.py b/src/spells/spell_cure_poison.py similarity index 100% rename from Rom24/pysrc/spells/spell_cure_poison.py rename to src/spells/spell_cure_poison.py diff --git a/Rom24/pysrc/spells/spell_cure_serious.py b/src/spells/spell_cure_serious.py similarity index 100% rename from Rom24/pysrc/spells/spell_cure_serious.py rename to src/spells/spell_cure_serious.py diff --git a/Rom24/pysrc/spells/spell_curse.py b/src/spells/spell_curse.py similarity index 100% rename from Rom24/pysrc/spells/spell_curse.py rename to src/spells/spell_curse.py diff --git a/Rom24/pysrc/spells/spell_demonfire.py b/src/spells/spell_demonfire.py similarity index 100% rename from Rom24/pysrc/spells/spell_demonfire.py rename to src/spells/spell_demonfire.py diff --git a/Rom24/pysrc/spells/spell_detect_evil.py b/src/spells/spell_detect_evil.py similarity index 100% rename from Rom24/pysrc/spells/spell_detect_evil.py rename to src/spells/spell_detect_evil.py diff --git a/Rom24/pysrc/spells/spell_detect_good.py b/src/spells/spell_detect_good.py similarity index 100% rename from Rom24/pysrc/spells/spell_detect_good.py rename to src/spells/spell_detect_good.py diff --git a/Rom24/pysrc/spells/spell_detect_hidden.py b/src/spells/spell_detect_hidden.py similarity index 100% rename from Rom24/pysrc/spells/spell_detect_hidden.py rename to src/spells/spell_detect_hidden.py diff --git a/Rom24/pysrc/spells/spell_detect_invis.py b/src/spells/spell_detect_invis.py similarity index 100% rename from Rom24/pysrc/spells/spell_detect_invis.py rename to src/spells/spell_detect_invis.py diff --git a/Rom24/pysrc/spells/spell_detect_magic.py b/src/spells/spell_detect_magic.py similarity index 100% rename from Rom24/pysrc/spells/spell_detect_magic.py rename to src/spells/spell_detect_magic.py diff --git a/Rom24/pysrc/spells/spell_detect_poison.py b/src/spells/spell_detect_poison.py similarity index 100% rename from Rom24/pysrc/spells/spell_detect_poison.py rename to src/spells/spell_detect_poison.py diff --git a/Rom24/pysrc/spells/spell_dispel_evil.py b/src/spells/spell_dispel_evil.py similarity index 100% rename from Rom24/pysrc/spells/spell_dispel_evil.py rename to src/spells/spell_dispel_evil.py diff --git a/Rom24/pysrc/spells/spell_dispel_good.py b/src/spells/spell_dispel_good.py similarity index 100% rename from Rom24/pysrc/spells/spell_dispel_good.py rename to src/spells/spell_dispel_good.py diff --git a/Rom24/pysrc/spells/spell_dispel_magic.py b/src/spells/spell_dispel_magic.py similarity index 100% rename from Rom24/pysrc/spells/spell_dispel_magic.py rename to src/spells/spell_dispel_magic.py diff --git a/Rom24/pysrc/spells/spell_earthquake.py b/src/spells/spell_earthquake.py similarity index 100% rename from Rom24/pysrc/spells/spell_earthquake.py rename to src/spells/spell_earthquake.py diff --git a/Rom24/pysrc/spells/spell_enchant_armor.py b/src/spells/spell_enchant_armor.py similarity index 100% rename from Rom24/pysrc/spells/spell_enchant_armor.py rename to src/spells/spell_enchant_armor.py diff --git a/Rom24/pysrc/spells/spell_enchant_weapon.py b/src/spells/spell_enchant_weapon.py similarity index 100% rename from Rom24/pysrc/spells/spell_enchant_weapon.py rename to src/spells/spell_enchant_weapon.py diff --git a/Rom24/pysrc/spells/spell_energy_drain.py b/src/spells/spell_energy_drain.py similarity index 100% rename from Rom24/pysrc/spells/spell_energy_drain.py rename to src/spells/spell_energy_drain.py diff --git a/Rom24/pysrc/spells/spell_faerie_fire.py b/src/spells/spell_faerie_fire.py similarity index 100% rename from Rom24/pysrc/spells/spell_faerie_fire.py rename to src/spells/spell_faerie_fire.py diff --git a/Rom24/pysrc/spells/spell_faerie_fog.py b/src/spells/spell_faerie_fog.py similarity index 100% rename from Rom24/pysrc/spells/spell_faerie_fog.py rename to src/spells/spell_faerie_fog.py diff --git a/Rom24/pysrc/spells/spell_farsight.py b/src/spells/spell_farsight.py similarity index 100% rename from Rom24/pysrc/spells/spell_farsight.py rename to src/spells/spell_farsight.py diff --git a/Rom24/pysrc/spells/spell_fire_breath.py b/src/spells/spell_fire_breath.py similarity index 100% rename from Rom24/pysrc/spells/spell_fire_breath.py rename to src/spells/spell_fire_breath.py diff --git a/Rom24/pysrc/spells/spell_fireball.py b/src/spells/spell_fireball.py similarity index 100% rename from Rom24/pysrc/spells/spell_fireball.py rename to src/spells/spell_fireball.py diff --git a/Rom24/pysrc/spells/spell_fireproof.py b/src/spells/spell_fireproof.py similarity index 100% rename from Rom24/pysrc/spells/spell_fireproof.py rename to src/spells/spell_fireproof.py diff --git a/Rom24/pysrc/spells/spell_flamestrike.py b/src/spells/spell_flamestrike.py similarity index 100% rename from Rom24/pysrc/spells/spell_flamestrike.py rename to src/spells/spell_flamestrike.py diff --git a/Rom24/pysrc/spells/spell_floating_disc.py b/src/spells/spell_floating_disc.py similarity index 100% rename from Rom24/pysrc/spells/spell_floating_disc.py rename to src/spells/spell_floating_disc.py diff --git a/Rom24/pysrc/spells/spell_fly.py b/src/spells/spell_fly.py similarity index 100% rename from Rom24/pysrc/spells/spell_fly.py rename to src/spells/spell_fly.py diff --git a/Rom24/pysrc/spells/spell_frenzy.py b/src/spells/spell_frenzy.py similarity index 100% rename from Rom24/pysrc/spells/spell_frenzy.py rename to src/spells/spell_frenzy.py diff --git a/Rom24/pysrc/spells/spell_frost_breath.py b/src/spells/spell_frost_breath.py similarity index 100% rename from Rom24/pysrc/spells/spell_frost_breath.py rename to src/spells/spell_frost_breath.py diff --git a/Rom24/pysrc/spells/spell_gas_breath.py b/src/spells/spell_gas_breath.py similarity index 100% rename from Rom24/pysrc/spells/spell_gas_breath.py rename to src/spells/spell_gas_breath.py diff --git a/Rom24/pysrc/spells/spell_gate.py b/src/spells/spell_gate.py similarity index 100% rename from Rom24/pysrc/spells/spell_gate.py rename to src/spells/spell_gate.py diff --git a/Rom24/pysrc/spells/spell_general_purpose.py b/src/spells/spell_general_purpose.py similarity index 100% rename from Rom24/pysrc/spells/spell_general_purpose.py rename to src/spells/spell_general_purpose.py diff --git a/Rom24/pysrc/spells/spell_giant_strength.py b/src/spells/spell_giant_strength.py similarity index 100% rename from Rom24/pysrc/spells/spell_giant_strength.py rename to src/spells/spell_giant_strength.py diff --git a/Rom24/pysrc/spells/spell_harm.py b/src/spells/spell_harm.py similarity index 100% rename from Rom24/pysrc/spells/spell_harm.py rename to src/spells/spell_harm.py diff --git a/Rom24/pysrc/spells/spell_haste.py b/src/spells/spell_haste.py similarity index 100% rename from Rom24/pysrc/spells/spell_haste.py rename to src/spells/spell_haste.py diff --git a/Rom24/pysrc/spells/spell_heal.py b/src/spells/spell_heal.py similarity index 100% rename from Rom24/pysrc/spells/spell_heal.py rename to src/spells/spell_heal.py diff --git a/Rom24/pysrc/spells/spell_heat_metal.py b/src/spells/spell_heat_metal.py similarity index 100% rename from Rom24/pysrc/spells/spell_heat_metal.py rename to src/spells/spell_heat_metal.py diff --git a/Rom24/pysrc/spells/spell_high_explosive.py b/src/spells/spell_high_explosive.py similarity index 100% rename from Rom24/pysrc/spells/spell_high_explosive.py rename to src/spells/spell_high_explosive.py diff --git a/Rom24/pysrc/spells/spell_holy_word.py b/src/spells/spell_holy_word.py similarity index 100% rename from Rom24/pysrc/spells/spell_holy_word.py rename to src/spells/spell_holy_word.py diff --git a/Rom24/pysrc/spells/spell_identify.py b/src/spells/spell_identify.py similarity index 100% rename from Rom24/pysrc/spells/spell_identify.py rename to src/spells/spell_identify.py diff --git a/Rom24/pysrc/spells/spell_infravision.py b/src/spells/spell_infravision.py similarity index 100% rename from Rom24/pysrc/spells/spell_infravision.py rename to src/spells/spell_infravision.py diff --git a/Rom24/pysrc/spells/spell_invis.py b/src/spells/spell_invis.py similarity index 100% rename from Rom24/pysrc/spells/spell_invis.py rename to src/spells/spell_invis.py diff --git a/Rom24/pysrc/spells/spell_know_alignment.py b/src/spells/spell_know_alignment.py similarity index 100% rename from Rom24/pysrc/spells/spell_know_alignment.py rename to src/spells/spell_know_alignment.py diff --git a/Rom24/pysrc/spells/spell_lightning_bolt.py b/src/spells/spell_lightning_bolt.py similarity index 100% rename from Rom24/pysrc/spells/spell_lightning_bolt.py rename to src/spells/spell_lightning_bolt.py diff --git a/Rom24/pysrc/spells/spell_lightning_breath.py b/src/spells/spell_lightning_breath.py similarity index 100% rename from Rom24/pysrc/spells/spell_lightning_breath.py rename to src/spells/spell_lightning_breath.py diff --git a/Rom24/pysrc/spells/spell_locate_object.py b/src/spells/spell_locate_object.py similarity index 100% rename from Rom24/pysrc/spells/spell_locate_object.py rename to src/spells/spell_locate_object.py diff --git a/Rom24/pysrc/spells/spell_magic_missile.py b/src/spells/spell_magic_missile.py similarity index 100% rename from Rom24/pysrc/spells/spell_magic_missile.py rename to src/spells/spell_magic_missile.py diff --git a/Rom24/pysrc/spells/spell_mass_healing.py b/src/spells/spell_mass_healing.py similarity index 100% rename from Rom24/pysrc/spells/spell_mass_healing.py rename to src/spells/spell_mass_healing.py diff --git a/Rom24/pysrc/spells/spell_mass_invis.py b/src/spells/spell_mass_invis.py similarity index 100% rename from Rom24/pysrc/spells/spell_mass_invis.py rename to src/spells/spell_mass_invis.py diff --git a/Rom24/pysrc/spells/spell_nexus.py b/src/spells/spell_nexus.py similarity index 100% rename from Rom24/pysrc/spells/spell_nexus.py rename to src/spells/spell_nexus.py diff --git a/Rom24/pysrc/spells/spell_pass_door.py b/src/spells/spell_pass_door.py similarity index 100% rename from Rom24/pysrc/spells/spell_pass_door.py rename to src/spells/spell_pass_door.py diff --git a/Rom24/pysrc/spells/spell_plague.py b/src/spells/spell_plague.py similarity index 100% rename from Rom24/pysrc/spells/spell_plague.py rename to src/spells/spell_plague.py diff --git a/Rom24/pysrc/spells/spell_poison.py b/src/spells/spell_poison.py similarity index 100% rename from Rom24/pysrc/spells/spell_poison.py rename to src/spells/spell_poison.py diff --git a/Rom24/pysrc/spells/spell_portal.py b/src/spells/spell_portal.py similarity index 100% rename from Rom24/pysrc/spells/spell_portal.py rename to src/spells/spell_portal.py diff --git a/Rom24/pysrc/spells/spell_protection_evil.py b/src/spells/spell_protection_evil.py similarity index 100% rename from Rom24/pysrc/spells/spell_protection_evil.py rename to src/spells/spell_protection_evil.py diff --git a/Rom24/pysrc/spells/spell_protection_good.py b/src/spells/spell_protection_good.py similarity index 100% rename from Rom24/pysrc/spells/spell_protection_good.py rename to src/spells/spell_protection_good.py diff --git a/Rom24/pysrc/spells/spell_ray_of_truth.py b/src/spells/spell_ray_of_truth.py similarity index 100% rename from Rom24/pysrc/spells/spell_ray_of_truth.py rename to src/spells/spell_ray_of_truth.py diff --git a/Rom24/pysrc/spells/spell_recharge.py b/src/spells/spell_recharge.py similarity index 100% rename from Rom24/pysrc/spells/spell_recharge.py rename to src/spells/spell_recharge.py diff --git a/Rom24/pysrc/spells/spell_refresh.py b/src/spells/spell_refresh.py similarity index 100% rename from Rom24/pysrc/spells/spell_refresh.py rename to src/spells/spell_refresh.py diff --git a/Rom24/pysrc/spells/spell_remove_curse.py b/src/spells/spell_remove_curse.py similarity index 100% rename from Rom24/pysrc/spells/spell_remove_curse.py rename to src/spells/spell_remove_curse.py diff --git a/Rom24/pysrc/spells/spell_sanctuary.py b/src/spells/spell_sanctuary.py similarity index 100% rename from Rom24/pysrc/spells/spell_sanctuary.py rename to src/spells/spell_sanctuary.py diff --git a/Rom24/pysrc/spells/spell_shield.py b/src/spells/spell_shield.py similarity index 100% rename from Rom24/pysrc/spells/spell_shield.py rename to src/spells/spell_shield.py diff --git a/Rom24/pysrc/spells/spell_shocking_grasp.py b/src/spells/spell_shocking_grasp.py similarity index 100% rename from Rom24/pysrc/spells/spell_shocking_grasp.py rename to src/spells/spell_shocking_grasp.py diff --git a/Rom24/pysrc/spells/spell_sleep.py b/src/spells/spell_sleep.py similarity index 100% rename from Rom24/pysrc/spells/spell_sleep.py rename to src/spells/spell_sleep.py diff --git a/Rom24/pysrc/spells/spell_slow.py b/src/spells/spell_slow.py similarity index 100% rename from Rom24/pysrc/spells/spell_slow.py rename to src/spells/spell_slow.py diff --git a/Rom24/pysrc/spells/spell_stone_skin.py b/src/spells/spell_stone_skin.py similarity index 100% rename from Rom24/pysrc/spells/spell_stone_skin.py rename to src/spells/spell_stone_skin.py diff --git a/Rom24/pysrc/spells/spell_summon.py b/src/spells/spell_summon.py similarity index 100% rename from Rom24/pysrc/spells/spell_summon.py rename to src/spells/spell_summon.py diff --git a/Rom24/pysrc/spells/spell_teleport.py b/src/spells/spell_teleport.py similarity index 100% rename from Rom24/pysrc/spells/spell_teleport.py rename to src/spells/spell_teleport.py diff --git a/Rom24/pysrc/spells/spell_ventriloquate.py b/src/spells/spell_ventriloquate.py similarity index 100% rename from Rom24/pysrc/spells/spell_ventriloquate.py rename to src/spells/spell_ventriloquate.py diff --git a/Rom24/pysrc/spells/spell_weaken.py b/src/spells/spell_weaken.py similarity index 100% rename from Rom24/pysrc/spells/spell_weaken.py rename to src/spells/spell_weaken.py diff --git a/Rom24/pysrc/spells/spell_word_of_recall.py b/src/spells/spell_word_of_recall.py similarity index 100% rename from Rom24/pysrc/spells/spell_word_of_recall.py rename to src/spells/spell_word_of_recall.py diff --git a/Rom24/pysrc/state_checks.py b/src/state_checks.py similarity index 99% rename from Rom24/pysrc/state_checks.py rename to src/state_checks.py index 52017af..97512e3 100644 --- a/Rom24/pysrc/state_checks.py +++ b/src/state_checks.py @@ -35,7 +35,7 @@ import time import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc diff --git a/Rom24/pysrc/sys_utils.py b/src/sys_utils.py similarity index 99% rename from Rom24/pysrc/sys_utils.py rename to src/sys_utils.py index e62232d..50abe30 100644 --- a/Rom24/pysrc/sys_utils.py +++ b/src/sys_utils.py @@ -6,7 +6,7 @@ from collections import Iterable import itertools import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) def sysTimeStamp(timeval): diff --git a/Rom24/pysrc/tables.py b/src/tables.py similarity index 98% rename from Rom24/pysrc/tables.py rename to src/tables.py index ae52fbe..be1f977 100644 --- a/Rom24/pysrc/tables.py +++ b/src/tables.py @@ -34,7 +34,7 @@ from collections import OrderedDict, namedtuple import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) clan_type = namedtuple('clan_type', 'name, who_name, hall, independent') clan_table = OrderedDict() diff --git a/Rom24/pysrc/type_bypass.py b/src/type_bypass.py similarity index 88% rename from Rom24/pysrc/type_bypass.py rename to src/type_bypass.py index dbf0745..5971bcd 100644 --- a/Rom24/pysrc/type_bypass.py +++ b/src/type_bypass.py @@ -2,7 +2,7 @@ import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) class ObjectType: def __init__(self): diff --git a/Rom24/pysrc/uait/legacy_loads.py b/src/uait/legacy_loads.py similarity index 99% rename from Rom24/pysrc/uait/legacy_loads.py rename to src/uait/legacy_loads.py index a482482..8f6cec6 100644 --- a/Rom24/pysrc/uait/legacy_loads.py +++ b/src/uait/legacy_loads.py @@ -5,7 +5,7 @@ import interp import save -logger = logging.getLogger() +logger = logging.getLogger(__name__) import const import handler_item diff --git a/Rom24/pysrc/update.py b/src/update.py similarity index 99% rename from Rom24/pysrc/update.py rename to src/update.py index 3e4c348..5feb300 100644 --- a/Rom24/pysrc/update.py +++ b/src/update.py @@ -37,7 +37,7 @@ import time import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import merc import db diff --git a/Rom24/pysrc/world_classes.py b/src/world_classes.py similarity index 99% rename from Rom24/pysrc/world_classes.py rename to src/world_classes.py index 1347a12..0c13fc8 100644 --- a/Rom24/pysrc/world_classes.py +++ b/src/world_classes.py @@ -5,7 +5,7 @@ import time import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import environment import tables From e0aa89990df33269a669fa7b232c6e339b6e85f4 Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Tue, 30 Nov 2021 23:23:10 -0800 Subject: [PATCH 06/40] Moving into better directory structure --- src/{ => rom24}/CONCEPTS | 0 src/{ => rom24}/affects.py | 0 src/{ => rom24}/auth.py | 0 src/{ => rom24}/bit.py | 0 src/{ => rom24}/comm.py | 0 src/{ => rom24}/commands/__init__.py | 0 src/{ => rom24}/commands/do_advance.py | 0 src/{ => rom24}/commands/do_affects.py | 0 src/{ => rom24}/commands/do_afk.py | 0 src/{ => rom24}/commands/do_alias.py | 0 src/{ => rom24}/commands/do_answer.py | 0 src/{ => rom24}/commands/do_apickle.py | 0 src/{ => rom24}/commands/do_areas.py | 0 src/{ => rom24}/commands/do_at.py | 0 src/{ => rom24}/commands/do_auction.py | 0 src/{ => rom24}/commands/do_authenticator.py | 0 src/{ => rom24}/commands/do_autoassist.py | 0 src/{ => rom24}/commands/do_autoexit.py | 0 src/{ => rom24}/commands/do_autogold.py | 0 src/{ => rom24}/commands/do_autolist.py | 0 src/{ => rom24}/commands/do_autoloot.py | 0 src/{ => rom24}/commands/do_autosac.py | 0 src/{ => rom24}/commands/do_autosplit.py | 0 src/{ => rom24}/commands/do_backstab.py | 0 src/{ => rom24}/commands/do_bamfin.py | 0 src/{ => rom24}/commands/do_bamfout.py | 0 src/{ => rom24}/commands/do_bash.py | 0 src/{ => rom24}/commands/do_berserk.py | 0 src/{ => rom24}/commands/do_brandish.py | 0 src/{ => rom24}/commands/do_brief.py | 0 src/{ => rom24}/commands/do_bug.py | 0 src/{ => rom24}/commands/do_buy.py | 0 src/{ => rom24}/commands/do_cast.py | 0 src/{ => rom24}/commands/do_channels.py | 0 src/{ => rom24}/commands/do_clantalk.py | 0 src/{ => rom24}/commands/do_clone.py | 0 src/{ => rom24}/commands/do_close.py | 0 src/{ => rom24}/commands/do_combine.py | 0 src/{ => rom24}/commands/do_commands.py | 0 src/{ => rom24}/commands/do_compact.py | 0 src/{ => rom24}/commands/do_compare.py | 0 src/{ => rom24}/commands/do_consider.py | 0 src/{ => rom24}/commands/do_count.py | 0 src/{ => rom24}/commands/do_deaf.py | 0 src/{ => rom24}/commands/do_debug.py | 0 src/{ => rom24}/commands/do_delete.py | 0 src/{ => rom24}/commands/do_deny.py | 0 src/{ => rom24}/commands/do_description.py | 0 src/{ => rom24}/commands/do_dirt.py | 0 src/{ => rom24}/commands/do_disarm.py | 0 src/{ => rom24}/commands/do_disconnect.py | 0 src/{ => rom24}/commands/do_down.py | 0 src/{ => rom24}/commands/do_drink.py | 0 src/{ => rom24}/commands/do_drop.py | 0 src/{ => rom24}/commands/do_dump.py | 0 src/{ => rom24}/commands/do_east.py | 0 src/{ => rom24}/commands/do_eat.py | 0 src/{ => rom24}/commands/do_echo.py | 0 src/{ => rom24}/commands/do_emote.py | 0 src/{ => rom24}/commands/do_enter.py | 0 src/{ => rom24}/commands/do_envenom.py | 0 src/{ => rom24}/commands/do_equipment.py | 0 src/{ => rom24}/commands/do_examine.py | 0 src/{ => rom24}/commands/do_exits.py | 0 src/{ => rom24}/commands/do_fill.py | 0 src/{ => rom24}/commands/do_flags.py | 0 src/{ => rom24}/commands/do_flee.py | 0 src/{ => rom24}/commands/do_follow.py | 0 src/{ => rom24}/commands/do_force.py | 0 src/{ => rom24}/commands/do_freeze.py | 0 src/{ => rom24}/commands/do_freset.py | 0 src/{ => rom24}/commands/do_gain.py | 0 src/{ => rom24}/commands/do_gdstate.py | 0 src/{ => rom24}/commands/do_get.py | 0 src/{ => rom24}/commands/do_give.py | 0 src/{ => rom24}/commands/do_gossip.py | 0 src/{ => rom24}/commands/do_goto.py | 0 src/{ => rom24}/commands/do_grats.py | 0 src/{ => rom24}/commands/do_group.py | 0 src/{ => rom24}/commands/do_groups.py | 0 src/{ => rom24}/commands/do_gtell.py | 0 src/{ => rom24}/commands/do_guild.py | 0 src/{ => rom24}/commands/do_heal.py | 0 src/{ => rom24}/commands/do_help.py | 0 src/{ => rom24}/commands/do_hide.py | 0 src/{ => rom24}/commands/do_holylight.py | 0 src/{ => rom24}/commands/do_immtalk.py | 0 src/{ => rom24}/commands/do_incognito.py | 0 src/{ => rom24}/commands/do_inventory.py | 0 src/{ => rom24}/commands/do_invis.py | 0 src/{ => rom24}/commands/do_kick.py | 0 src/{ => rom24}/commands/do_kill.py | 0 src/{ => rom24}/commands/do_list.py | 0 src/{ => rom24}/commands/do_load.py | 0 src/{ => rom24}/commands/do_lock.py | 0 src/{ => rom24}/commands/do_log.py | 0 src/{ => rom24}/commands/do_look.py | 0 src/{ => rom24}/commands/do_memory.py | 0 src/{ => rom24}/commands/do_mfind.py | 0 src/{ => rom24}/commands/do_mload.py | 0 src/{ => rom24}/commands/do_mset.py | 0 src/{ => rom24}/commands/do_mstat.py | 0 src/{ => rom24}/commands/do_murder.py | 0 src/{ => rom24}/commands/do_music.py | 0 src/{ => rom24}/commands/do_mwhere.py | 0 src/{ => rom24}/commands/do_newlock.py | 0 src/{ => rom24}/commands/do_nochannels.py | 0 src/{ => rom24}/commands/do_noemote.py | 0 src/{ => rom24}/commands/do_nofollow.py | 0 src/{ => rom24}/commands/do_noloot.py | 0 src/{ => rom24}/commands/do_north.py | 0 src/{ => rom24}/commands/do_noshout.py | 0 src/{ => rom24}/commands/do_nosummon.py | 0 src/{ => rom24}/commands/do_notell.py | 0 src/{ => rom24}/commands/do_ofind.py | 0 src/{ => rom24}/commands/do_oload.py | 0 src/{ => rom24}/commands/do_omni.py | 0 src/{ => rom24}/commands/do_open.py | 0 src/{ => rom24}/commands/do_order.py | 0 src/{ => rom24}/commands/do_oset.py | 0 src/{ => rom24}/commands/do_ostat.py | 0 src/{ => rom24}/commands/do_outfit.py | 0 src/{ => rom24}/commands/do_owhere.py | 0 src/{ => rom24}/commands/do_pardon.py | 0 src/{ => rom24}/commands/do_password.py | 0 src/{ => rom24}/commands/do_peace.py | 0 src/{ => rom24}/commands/do_pecho.py | 0 src/{ => rom24}/commands/do_pick.py | 0 src/{ => rom24}/commands/do_pmote.py | 0 src/{ => rom24}/commands/do_pose.py | 0 src/{ => rom24}/commands/do_pour.py | 0 src/{ => rom24}/commands/do_practice.py | 0 src/{ => rom24}/commands/do_prefix.py | 0 src/{ => rom24}/commands/do_prompt.py | 0 src/{ => rom24}/commands/do_protect.py | 0 src/{ => rom24}/commands/do_purge.py | 0 src/{ => rom24}/commands/do_put.py | 0 src/{ => rom24}/commands/do_quaff.py | 0 src/{ => rom24}/commands/do_question.py | 0 src/{ => rom24}/commands/do_quiet.py | 0 src/{ => rom24}/commands/do_quit.py | 0 src/{ => rom24}/commands/do_quote.py | 0 src/{ => rom24}/commands/do_reboot.py | 0 src/{ => rom24}/commands/do_recall.py | 0 src/{ => rom24}/commands/do_recho.py | 0 src/{ => rom24}/commands/do_recite.py | 0 src/{ => rom24}/commands/do_reload.py | 0 src/{ => rom24}/commands/do_remove.py | 0 src/{ => rom24}/commands/do_rent.py | 0 src/{ => rom24}/commands/do_replay.py | 0 src/{ => rom24}/commands/do_reply.py | 0 src/{ => rom24}/commands/do_report.py | 0 src/{ => rom24}/commands/do_rescue.py | 0 src/{ => rom24}/commands/do_rest.py | 0 src/{ => rom24}/commands/do_restore.py | 0 src/{ => rom24}/commands/do_return.py | 0 src/{ => rom24}/commands/do_rstat.py | 0 src/{ => rom24}/commands/do_sacrifice.py | 0 src/{ => rom24}/commands/do_save.py | 0 src/{ => rom24}/commands/do_say.py | 0 src/{ => rom24}/commands/do_score.py | 0 src/{ => rom24}/commands/do_scroll.py | 0 src/{ => rom24}/commands/do_sell.py | 0 src/{ => rom24}/commands/do_set.py | 0 src/{ => rom24}/commands/do_shout.py | 0 src/{ => rom24}/commands/do_show.py | 0 src/{ => rom24}/commands/do_shutdown.py | 0 src/{ => rom24}/commands/do_sit.py | 0 src/{ => rom24}/commands/do_skills.py | 0 src/{ => rom24}/commands/do_slay.py | 0 src/{ => rom24}/commands/do_sleep.py | 0 src/{ => rom24}/commands/do_slookup.py | 0 src/{ => rom24}/commands/do_smote.py | 0 src/{ => rom24}/commands/do_sneak.py | 0 src/{ => rom24}/commands/do_snoop.py | 0 src/{ => rom24}/commands/do_socials.py | 0 src/{ => rom24}/commands/do_sockets.py | 0 src/{ => rom24}/commands/do_south.py | 0 src/{ => rom24}/commands/do_spells.py | 0 src/{ => rom24}/commands/do_split.py | 0 src/{ => rom24}/commands/do_sset.py | 0 src/{ => rom24}/commands/do_stand.py | 0 src/{ => rom24}/commands/do_stat.py | 0 src/{ => rom24}/commands/do_steal.py | 0 src/{ => rom24}/commands/do_string.py | 0 src/{ => rom24}/commands/do_switch.py | 0 src/{ => rom24}/commands/do_tabledump.py | 0 src/{ => rom24}/commands/do_tableload.py | 0 src/{ => rom24}/commands/do_tell.py | 0 src/{ => rom24}/commands/do_term.py | 0 src/{ => rom24}/commands/do_time.py | 0 src/{ => rom24}/commands/do_title.py | 0 src/{ => rom24}/commands/do_train.py | 0 src/{ => rom24}/commands/do_transfer.py | 0 src/{ => rom24}/commands/do_trip.py | 0 src/{ => rom24}/commands/do_trust.py | 0 src/{ => rom24}/commands/do_typo.py | 0 src/{ => rom24}/commands/do_unalias.py | 0 src/{ => rom24}/commands/do_unlock.py | 0 src/{ => rom24}/commands/do_up.py | 0 src/{ => rom24}/commands/do_value.py | 0 src/{ => rom24}/commands/do_violate.py | 0 src/{ => rom24}/commands/do_visible.py | 0 src/{ => rom24}/commands/do_vnum.py | 0 src/{ => rom24}/commands/do_wake.py | 0 src/{ => rom24}/commands/do_wear.py | 0 src/{ => rom24}/commands/do_weather.py | 0 src/{ => rom24}/commands/do_west.py | 0 src/{ => rom24}/commands/do_where.py | 0 src/{ => rom24}/commands/do_who.py | 0 src/{ => rom24}/commands/do_whois.py | 0 src/{ => rom24}/commands/do_wimpy.py | 0 src/{ => rom24}/commands/do_wizhelp.py | 0 src/{ => rom24}/commands/do_wizlock.py | 0 src/{ => rom24}/commands/do_wiznet.py | 0 src/{ => rom24}/commands/do_worth.py | 0 src/{ => rom24}/commands/do_yell.py | 0 src/{ => rom24}/commands/do_zap.py | 0 src/{ => rom24}/commands/do_zecho.py | 0 src/{ => rom24}/const.py | 0 src/{ => rom24}/data_loader.py | 0 src/{ => rom24}/database/__init__.py | 0 src/{ => rom24}/database/read/__init__.py | 0 src/{ => rom24}/database/read/read_tables.py | 0 src/{ => rom24}/database/tracker.py | 0 src/{ => rom24}/database/write/__init__.py | 0 src/{ => rom24}/database/write/write_tables.py | 0 src/{ => rom24}/db.py | 0 src/{ => rom24}/effects.py | 0 src/{ => rom24}/environment.py | 0 src/{ => rom24}/equipment.py | 0 src/{ => rom24}/fight.py | 0 src/{ => rom24}/game_utils.py | 0 src/{ => rom24}/handler_ch.py | 0 src/{ => rom24}/handler_game.py | 0 src/{ => rom24}/handler_item.py | 0 src/{ => rom24}/handler_log.py | 0 src/{ => rom24}/handler_magic.py | 0 src/{ => rom24}/handler_npc.py | 0 src/{ => rom24}/handler_pc.py | 0 src/{ => rom24}/handler_room.py | 0 src/{ => rom24}/hotfix.py | 0 src/{ => rom24}/immortal.py | 0 src/{ => rom24}/instance.py | 0 src/{ => rom24}/interp.py | 0 src/{ => rom24}/inventory.py | 0 src/{ => rom24}/item_flags.py | 0 src/{ => rom24}/living.py | 0 src/{ => rom24}/magic.py | 0 src/{ => rom24}/merc.py | 0 src/{ => rom24}/miniboa/LICENSE.TXT | 0 src/{ => rom24}/miniboa/README.TXT | 0 src/{ => rom24}/miniboa/__init__.py | 0 src/{ => rom24}/miniboa/asyncio.py | 0 src/{ => rom24}/miniboa/colors.py | 0 src/{ => rom24}/miniboa/telnet.py | 0 src/{ => rom24}/miniboa/terminal.py | 0 src/{ => rom24}/nanny.py | 0 src/{ => rom24}/object_creator.py | 0 src/{ => rom24}/physical.py | 0 src/{ => rom24}/pyom.py | 0 src/{ => rom24}/pyprogs.py | 0 src/{ => rom24}/save.py | 0 src/{ => rom24}/settings.py | 0 src/{ => rom24}/shell.py | 0 src/{ => rom24}/shop_utils.py | 0 src/{ => rom24}/skills.py | 0 src/{ => rom24}/special.py | 0 src/{ => rom24}/spells/__init__.py | 0 src/{ => rom24}/spells/spell_acid_blast.py | 0 src/{ => rom24}/spells/spell_acid_breath.py | 0 src/{ => rom24}/spells/spell_armor.py | 0 src/{ => rom24}/spells/spell_bless.py | 0 src/{ => rom24}/spells/spell_blindness.py | 0 src/{ => rom24}/spells/spell_burning_hands.py | 0 src/{ => rom24}/spells/spell_call_lightning.py | 0 src/{ => rom24}/spells/spell_calm.py | 0 src/{ => rom24}/spells/spell_cancellation.py | 0 src/{ => rom24}/spells/spell_cause_critical.py | 0 src/{ => rom24}/spells/spell_cause_light.py | 0 src/{ => rom24}/spells/spell_cause_serious.py | 0 src/{ => rom24}/spells/spell_chain_lightning.py | 0 src/{ => rom24}/spells/spell_change_sex.py | 0 src/{ => rom24}/spells/spell_charm_person.py | 0 src/{ => rom24}/spells/spell_chill_touch.py | 0 src/{ => rom24}/spells/spell_colour_spray.py | 0 src/{ => rom24}/spells/spell_continual_light.py | 0 src/{ => rom24}/spells/spell_control_weather.py | 0 src/{ => rom24}/spells/spell_create_food.py | 0 src/{ => rom24}/spells/spell_create_rose.py | 0 src/{ => rom24}/spells/spell_create_spring.py | 0 src/{ => rom24}/spells/spell_create_water.py | 0 src/{ => rom24}/spells/spell_cure_blindness.py | 0 src/{ => rom24}/spells/spell_cure_critical.py | 0 src/{ => rom24}/spells/spell_cure_disease.py | 0 src/{ => rom24}/spells/spell_cure_light.py | 0 src/{ => rom24}/spells/spell_cure_poison.py | 0 src/{ => rom24}/spells/spell_cure_serious.py | 0 src/{ => rom24}/spells/spell_curse.py | 0 src/{ => rom24}/spells/spell_demonfire.py | 0 src/{ => rom24}/spells/spell_detect_evil.py | 0 src/{ => rom24}/spells/spell_detect_good.py | 0 src/{ => rom24}/spells/spell_detect_hidden.py | 0 src/{ => rom24}/spells/spell_detect_invis.py | 0 src/{ => rom24}/spells/spell_detect_magic.py | 0 src/{ => rom24}/spells/spell_detect_poison.py | 0 src/{ => rom24}/spells/spell_dispel_evil.py | 0 src/{ => rom24}/spells/spell_dispel_good.py | 0 src/{ => rom24}/spells/spell_dispel_magic.py | 0 src/{ => rom24}/spells/spell_earthquake.py | 0 src/{ => rom24}/spells/spell_enchant_armor.py | 0 src/{ => rom24}/spells/spell_enchant_weapon.py | 0 src/{ => rom24}/spells/spell_energy_drain.py | 0 src/{ => rom24}/spells/spell_faerie_fire.py | 0 src/{ => rom24}/spells/spell_faerie_fog.py | 0 src/{ => rom24}/spells/spell_farsight.py | 0 src/{ => rom24}/spells/spell_fire_breath.py | 0 src/{ => rom24}/spells/spell_fireball.py | 0 src/{ => rom24}/spells/spell_fireproof.py | 0 src/{ => rom24}/spells/spell_flamestrike.py | 0 src/{ => rom24}/spells/spell_floating_disc.py | 0 src/{ => rom24}/spells/spell_fly.py | 0 src/{ => rom24}/spells/spell_frenzy.py | 0 src/{ => rom24}/spells/spell_frost_breath.py | 0 src/{ => rom24}/spells/spell_gas_breath.py | 0 src/{ => rom24}/spells/spell_gate.py | 0 src/{ => rom24}/spells/spell_general_purpose.py | 0 src/{ => rom24}/spells/spell_giant_strength.py | 0 src/{ => rom24}/spells/spell_harm.py | 0 src/{ => rom24}/spells/spell_haste.py | 0 src/{ => rom24}/spells/spell_heal.py | 0 src/{ => rom24}/spells/spell_heat_metal.py | 0 src/{ => rom24}/spells/spell_high_explosive.py | 0 src/{ => rom24}/spells/spell_holy_word.py | 0 src/{ => rom24}/spells/spell_identify.py | 0 src/{ => rom24}/spells/spell_infravision.py | 0 src/{ => rom24}/spells/spell_invis.py | 0 src/{ => rom24}/spells/spell_know_alignment.py | 0 src/{ => rom24}/spells/spell_lightning_bolt.py | 0 src/{ => rom24}/spells/spell_lightning_breath.py | 0 src/{ => rom24}/spells/spell_locate_object.py | 0 src/{ => rom24}/spells/spell_magic_missile.py | 0 src/{ => rom24}/spells/spell_mass_healing.py | 0 src/{ => rom24}/spells/spell_mass_invis.py | 0 src/{ => rom24}/spells/spell_nexus.py | 0 src/{ => rom24}/spells/spell_pass_door.py | 0 src/{ => rom24}/spells/spell_plague.py | 0 src/{ => rom24}/spells/spell_poison.py | 0 src/{ => rom24}/spells/spell_portal.py | 0 src/{ => rom24}/spells/spell_protection_evil.py | 0 src/{ => rom24}/spells/spell_protection_good.py | 0 src/{ => rom24}/spells/spell_ray_of_truth.py | 0 src/{ => rom24}/spells/spell_recharge.py | 0 src/{ => rom24}/spells/spell_refresh.py | 0 src/{ => rom24}/spells/spell_remove_curse.py | 0 src/{ => rom24}/spells/spell_sanctuary.py | 0 src/{ => rom24}/spells/spell_shield.py | 0 src/{ => rom24}/spells/spell_shocking_grasp.py | 0 src/{ => rom24}/spells/spell_sleep.py | 0 src/{ => rom24}/spells/spell_slow.py | 0 src/{ => rom24}/spells/spell_stone_skin.py | 0 src/{ => rom24}/spells/spell_summon.py | 0 src/{ => rom24}/spells/spell_teleport.py | 0 src/{ => rom24}/spells/spell_ventriloquate.py | 0 src/{ => rom24}/spells/spell_weaken.py | 0 src/{ => rom24}/spells/spell_word_of_recall.py | 0 src/{ => rom24}/state_checks.py | 0 src/{ => rom24}/sys_utils.py | 0 src/{ => rom24}/tables.py | 0 src/{ => rom24}/type_bypass.py | 0 src/{ => rom24}/uait/legacy_loads.py | 0 src/{ => rom24}/update.py | 0 src/{ => rom24}/world_classes.py | 0 373 files changed, 0 insertions(+), 0 deletions(-) rename src/{ => rom24}/CONCEPTS (100%) rename src/{ => rom24}/affects.py (100%) rename src/{ => rom24}/auth.py (100%) rename src/{ => rom24}/bit.py (100%) rename src/{ => rom24}/comm.py (100%) rename src/{ => rom24}/commands/__init__.py (100%) rename src/{ => rom24}/commands/do_advance.py (100%) rename src/{ => rom24}/commands/do_affects.py (100%) rename src/{ => rom24}/commands/do_afk.py (100%) rename src/{ => rom24}/commands/do_alias.py (100%) rename src/{ => rom24}/commands/do_answer.py (100%) rename src/{ => rom24}/commands/do_apickle.py (100%) rename src/{ => rom24}/commands/do_areas.py (100%) rename src/{ => rom24}/commands/do_at.py (100%) rename src/{ => rom24}/commands/do_auction.py (100%) rename src/{ => rom24}/commands/do_authenticator.py (100%) rename src/{ => rom24}/commands/do_autoassist.py (100%) rename src/{ => rom24}/commands/do_autoexit.py (100%) rename src/{ => rom24}/commands/do_autogold.py (100%) rename src/{ => rom24}/commands/do_autolist.py (100%) rename src/{ => rom24}/commands/do_autoloot.py (100%) rename src/{ => rom24}/commands/do_autosac.py (100%) rename src/{ => rom24}/commands/do_autosplit.py (100%) rename src/{ => rom24}/commands/do_backstab.py (100%) rename src/{ => rom24}/commands/do_bamfin.py (100%) rename src/{ => rom24}/commands/do_bamfout.py (100%) rename src/{ => rom24}/commands/do_bash.py (100%) rename src/{ => rom24}/commands/do_berserk.py (100%) rename src/{ => rom24}/commands/do_brandish.py (100%) rename src/{ => rom24}/commands/do_brief.py (100%) rename src/{ => rom24}/commands/do_bug.py (100%) rename src/{ => rom24}/commands/do_buy.py (100%) rename src/{ => rom24}/commands/do_cast.py (100%) rename src/{ => rom24}/commands/do_channels.py (100%) rename src/{ => rom24}/commands/do_clantalk.py (100%) rename src/{ => rom24}/commands/do_clone.py (100%) rename src/{ => rom24}/commands/do_close.py (100%) rename src/{ => rom24}/commands/do_combine.py (100%) rename src/{ => rom24}/commands/do_commands.py (100%) rename src/{ => rom24}/commands/do_compact.py (100%) rename src/{ => rom24}/commands/do_compare.py (100%) rename src/{ => rom24}/commands/do_consider.py (100%) rename src/{ => rom24}/commands/do_count.py (100%) rename src/{ => rom24}/commands/do_deaf.py (100%) rename src/{ => rom24}/commands/do_debug.py (100%) rename src/{ => rom24}/commands/do_delete.py (100%) rename src/{ => rom24}/commands/do_deny.py (100%) rename src/{ => rom24}/commands/do_description.py (100%) rename src/{ => rom24}/commands/do_dirt.py (100%) rename src/{ => rom24}/commands/do_disarm.py (100%) rename src/{ => rom24}/commands/do_disconnect.py (100%) rename src/{ => rom24}/commands/do_down.py (100%) rename src/{ => rom24}/commands/do_drink.py (100%) rename src/{ => rom24}/commands/do_drop.py (100%) rename src/{ => rom24}/commands/do_dump.py (100%) rename src/{ => rom24}/commands/do_east.py (100%) rename src/{ => rom24}/commands/do_eat.py (100%) rename src/{ => rom24}/commands/do_echo.py (100%) rename src/{ => rom24}/commands/do_emote.py (100%) rename src/{ => rom24}/commands/do_enter.py (100%) rename src/{ => rom24}/commands/do_envenom.py (100%) rename src/{ => rom24}/commands/do_equipment.py (100%) rename src/{ => rom24}/commands/do_examine.py (100%) rename src/{ => rom24}/commands/do_exits.py (100%) rename src/{ => rom24}/commands/do_fill.py (100%) rename src/{ => rom24}/commands/do_flags.py (100%) rename src/{ => rom24}/commands/do_flee.py (100%) rename src/{ => rom24}/commands/do_follow.py (100%) rename src/{ => rom24}/commands/do_force.py (100%) rename src/{ => rom24}/commands/do_freeze.py (100%) rename src/{ => rom24}/commands/do_freset.py (100%) rename src/{ => rom24}/commands/do_gain.py (100%) rename src/{ => rom24}/commands/do_gdstate.py (100%) rename src/{ => rom24}/commands/do_get.py (100%) rename src/{ => rom24}/commands/do_give.py (100%) rename src/{ => rom24}/commands/do_gossip.py (100%) rename src/{ => rom24}/commands/do_goto.py (100%) rename src/{ => rom24}/commands/do_grats.py (100%) rename src/{ => rom24}/commands/do_group.py (100%) rename src/{ => rom24}/commands/do_groups.py (100%) rename src/{ => rom24}/commands/do_gtell.py (100%) rename src/{ => rom24}/commands/do_guild.py (100%) rename src/{ => rom24}/commands/do_heal.py (100%) rename src/{ => rom24}/commands/do_help.py (100%) rename src/{ => rom24}/commands/do_hide.py (100%) rename src/{ => rom24}/commands/do_holylight.py (100%) rename src/{ => rom24}/commands/do_immtalk.py (100%) rename src/{ => rom24}/commands/do_incognito.py (100%) rename src/{ => rom24}/commands/do_inventory.py (100%) rename src/{ => rom24}/commands/do_invis.py (100%) rename src/{ => rom24}/commands/do_kick.py (100%) rename src/{ => rom24}/commands/do_kill.py (100%) rename src/{ => rom24}/commands/do_list.py (100%) rename src/{ => rom24}/commands/do_load.py (100%) rename src/{ => rom24}/commands/do_lock.py (100%) rename src/{ => rom24}/commands/do_log.py (100%) rename src/{ => rom24}/commands/do_look.py (100%) rename src/{ => rom24}/commands/do_memory.py (100%) rename src/{ => rom24}/commands/do_mfind.py (100%) rename src/{ => rom24}/commands/do_mload.py (100%) rename src/{ => rom24}/commands/do_mset.py (100%) rename src/{ => rom24}/commands/do_mstat.py (100%) rename src/{ => rom24}/commands/do_murder.py (100%) rename src/{ => rom24}/commands/do_music.py (100%) rename src/{ => rom24}/commands/do_mwhere.py (100%) rename src/{ => rom24}/commands/do_newlock.py (100%) rename src/{ => rom24}/commands/do_nochannels.py (100%) rename src/{ => rom24}/commands/do_noemote.py (100%) rename src/{ => rom24}/commands/do_nofollow.py (100%) rename src/{ => rom24}/commands/do_noloot.py (100%) rename src/{ => rom24}/commands/do_north.py (100%) rename src/{ => rom24}/commands/do_noshout.py (100%) rename src/{ => rom24}/commands/do_nosummon.py (100%) rename src/{ => rom24}/commands/do_notell.py (100%) rename src/{ => rom24}/commands/do_ofind.py (100%) rename src/{ => rom24}/commands/do_oload.py (100%) rename src/{ => rom24}/commands/do_omni.py (100%) rename src/{ => rom24}/commands/do_open.py (100%) rename src/{ => rom24}/commands/do_order.py (100%) rename src/{ => rom24}/commands/do_oset.py (100%) rename src/{ => rom24}/commands/do_ostat.py (100%) rename src/{ => rom24}/commands/do_outfit.py (100%) rename src/{ => rom24}/commands/do_owhere.py (100%) rename src/{ => rom24}/commands/do_pardon.py (100%) rename src/{ => rom24}/commands/do_password.py (100%) rename src/{ => rom24}/commands/do_peace.py (100%) rename src/{ => rom24}/commands/do_pecho.py (100%) rename src/{ => rom24}/commands/do_pick.py (100%) rename src/{ => rom24}/commands/do_pmote.py (100%) rename src/{ => rom24}/commands/do_pose.py (100%) rename src/{ => rom24}/commands/do_pour.py (100%) rename src/{ => rom24}/commands/do_practice.py (100%) rename src/{ => rom24}/commands/do_prefix.py (100%) rename src/{ => rom24}/commands/do_prompt.py (100%) rename src/{ => rom24}/commands/do_protect.py (100%) rename src/{ => rom24}/commands/do_purge.py (100%) rename src/{ => rom24}/commands/do_put.py (100%) rename src/{ => rom24}/commands/do_quaff.py (100%) rename src/{ => rom24}/commands/do_question.py (100%) rename src/{ => rom24}/commands/do_quiet.py (100%) rename src/{ => rom24}/commands/do_quit.py (100%) rename src/{ => rom24}/commands/do_quote.py (100%) rename src/{ => rom24}/commands/do_reboot.py (100%) rename src/{ => rom24}/commands/do_recall.py (100%) rename src/{ => rom24}/commands/do_recho.py (100%) rename src/{ => rom24}/commands/do_recite.py (100%) rename src/{ => rom24}/commands/do_reload.py (100%) rename src/{ => rom24}/commands/do_remove.py (100%) rename src/{ => rom24}/commands/do_rent.py (100%) rename src/{ => rom24}/commands/do_replay.py (100%) rename src/{ => rom24}/commands/do_reply.py (100%) rename src/{ => rom24}/commands/do_report.py (100%) rename src/{ => rom24}/commands/do_rescue.py (100%) rename src/{ => rom24}/commands/do_rest.py (100%) rename src/{ => rom24}/commands/do_restore.py (100%) rename src/{ => rom24}/commands/do_return.py (100%) rename src/{ => rom24}/commands/do_rstat.py (100%) rename src/{ => rom24}/commands/do_sacrifice.py (100%) rename src/{ => rom24}/commands/do_save.py (100%) rename src/{ => rom24}/commands/do_say.py (100%) rename src/{ => rom24}/commands/do_score.py (100%) rename src/{ => rom24}/commands/do_scroll.py (100%) rename src/{ => rom24}/commands/do_sell.py (100%) rename src/{ => rom24}/commands/do_set.py (100%) rename src/{ => rom24}/commands/do_shout.py (100%) rename src/{ => rom24}/commands/do_show.py (100%) rename src/{ => rom24}/commands/do_shutdown.py (100%) rename src/{ => rom24}/commands/do_sit.py (100%) rename src/{ => rom24}/commands/do_skills.py (100%) rename src/{ => rom24}/commands/do_slay.py (100%) rename src/{ => rom24}/commands/do_sleep.py (100%) rename src/{ => rom24}/commands/do_slookup.py (100%) rename src/{ => rom24}/commands/do_smote.py (100%) rename src/{ => rom24}/commands/do_sneak.py (100%) rename src/{ => rom24}/commands/do_snoop.py (100%) rename src/{ => rom24}/commands/do_socials.py (100%) rename src/{ => rom24}/commands/do_sockets.py (100%) rename src/{ => rom24}/commands/do_south.py (100%) rename src/{ => rom24}/commands/do_spells.py (100%) rename src/{ => rom24}/commands/do_split.py (100%) rename src/{ => rom24}/commands/do_sset.py (100%) rename src/{ => rom24}/commands/do_stand.py (100%) rename src/{ => rom24}/commands/do_stat.py (100%) rename src/{ => rom24}/commands/do_steal.py (100%) rename src/{ => rom24}/commands/do_string.py (100%) rename src/{ => rom24}/commands/do_switch.py (100%) rename src/{ => rom24}/commands/do_tabledump.py (100%) rename src/{ => rom24}/commands/do_tableload.py (100%) rename src/{ => rom24}/commands/do_tell.py (100%) rename src/{ => rom24}/commands/do_term.py (100%) rename src/{ => rom24}/commands/do_time.py (100%) rename src/{ => rom24}/commands/do_title.py (100%) rename src/{ => rom24}/commands/do_train.py (100%) rename src/{ => rom24}/commands/do_transfer.py (100%) rename src/{ => rom24}/commands/do_trip.py (100%) rename src/{ => rom24}/commands/do_trust.py (100%) rename src/{ => rom24}/commands/do_typo.py (100%) rename src/{ => rom24}/commands/do_unalias.py (100%) rename src/{ => rom24}/commands/do_unlock.py (100%) rename src/{ => rom24}/commands/do_up.py (100%) rename src/{ => rom24}/commands/do_value.py (100%) rename src/{ => rom24}/commands/do_violate.py (100%) rename src/{ => rom24}/commands/do_visible.py (100%) rename src/{ => rom24}/commands/do_vnum.py (100%) rename src/{ => rom24}/commands/do_wake.py (100%) rename src/{ => rom24}/commands/do_wear.py (100%) rename src/{ => rom24}/commands/do_weather.py (100%) rename src/{ => rom24}/commands/do_west.py (100%) rename src/{ => rom24}/commands/do_where.py (100%) rename src/{ => rom24}/commands/do_who.py (100%) rename src/{ => rom24}/commands/do_whois.py (100%) rename src/{ => rom24}/commands/do_wimpy.py (100%) rename src/{ => rom24}/commands/do_wizhelp.py (100%) rename src/{ => rom24}/commands/do_wizlock.py (100%) rename src/{ => rom24}/commands/do_wiznet.py (100%) rename src/{ => rom24}/commands/do_worth.py (100%) rename src/{ => rom24}/commands/do_yell.py (100%) rename src/{ => rom24}/commands/do_zap.py (100%) rename src/{ => rom24}/commands/do_zecho.py (100%) rename src/{ => rom24}/const.py (100%) rename src/{ => rom24}/data_loader.py (100%) rename src/{ => rom24}/database/__init__.py (100%) rename src/{ => rom24}/database/read/__init__.py (100%) rename src/{ => rom24}/database/read/read_tables.py (100%) rename src/{ => rom24}/database/tracker.py (100%) rename src/{ => rom24}/database/write/__init__.py (100%) rename src/{ => rom24}/database/write/write_tables.py (100%) rename src/{ => rom24}/db.py (100%) rename src/{ => rom24}/effects.py (100%) rename src/{ => rom24}/environment.py (100%) rename src/{ => rom24}/equipment.py (100%) rename src/{ => rom24}/fight.py (100%) rename src/{ => rom24}/game_utils.py (100%) rename src/{ => rom24}/handler_ch.py (100%) rename src/{ => rom24}/handler_game.py (100%) rename src/{ => rom24}/handler_item.py (100%) rename src/{ => rom24}/handler_log.py (100%) rename src/{ => rom24}/handler_magic.py (100%) rename src/{ => rom24}/handler_npc.py (100%) rename src/{ => rom24}/handler_pc.py (100%) rename src/{ => rom24}/handler_room.py (100%) rename src/{ => rom24}/hotfix.py (100%) rename src/{ => rom24}/immortal.py (100%) rename src/{ => rom24}/instance.py (100%) rename src/{ => rom24}/interp.py (100%) rename src/{ => rom24}/inventory.py (100%) rename src/{ => rom24}/item_flags.py (100%) rename src/{ => rom24}/living.py (100%) rename src/{ => rom24}/magic.py (100%) rename src/{ => rom24}/merc.py (100%) rename src/{ => rom24}/miniboa/LICENSE.TXT (100%) rename src/{ => rom24}/miniboa/README.TXT (100%) rename src/{ => rom24}/miniboa/__init__.py (100%) rename src/{ => rom24}/miniboa/asyncio.py (100%) rename src/{ => rom24}/miniboa/colors.py (100%) rename src/{ => rom24}/miniboa/telnet.py (100%) rename src/{ => rom24}/miniboa/terminal.py (100%) rename src/{ => rom24}/nanny.py (100%) rename src/{ => rom24}/object_creator.py (100%) rename src/{ => rom24}/physical.py (100%) rename src/{ => rom24}/pyom.py (100%) rename src/{ => rom24}/pyprogs.py (100%) rename src/{ => rom24}/save.py (100%) rename src/{ => rom24}/settings.py (100%) rename src/{ => rom24}/shell.py (100%) rename src/{ => rom24}/shop_utils.py (100%) rename src/{ => rom24}/skills.py (100%) rename src/{ => rom24}/special.py (100%) rename src/{ => rom24}/spells/__init__.py (100%) rename src/{ => rom24}/spells/spell_acid_blast.py (100%) rename src/{ => rom24}/spells/spell_acid_breath.py (100%) rename src/{ => rom24}/spells/spell_armor.py (100%) rename src/{ => rom24}/spells/spell_bless.py (100%) rename src/{ => rom24}/spells/spell_blindness.py (100%) rename src/{ => rom24}/spells/spell_burning_hands.py (100%) rename src/{ => rom24}/spells/spell_call_lightning.py (100%) rename src/{ => rom24}/spells/spell_calm.py (100%) rename src/{ => rom24}/spells/spell_cancellation.py (100%) rename src/{ => rom24}/spells/spell_cause_critical.py (100%) rename src/{ => rom24}/spells/spell_cause_light.py (100%) rename src/{ => rom24}/spells/spell_cause_serious.py (100%) rename src/{ => rom24}/spells/spell_chain_lightning.py (100%) rename src/{ => rom24}/spells/spell_change_sex.py (100%) rename src/{ => rom24}/spells/spell_charm_person.py (100%) rename src/{ => rom24}/spells/spell_chill_touch.py (100%) rename src/{ => rom24}/spells/spell_colour_spray.py (100%) rename src/{ => rom24}/spells/spell_continual_light.py (100%) rename src/{ => rom24}/spells/spell_control_weather.py (100%) rename src/{ => rom24}/spells/spell_create_food.py (100%) rename src/{ => rom24}/spells/spell_create_rose.py (100%) rename src/{ => rom24}/spells/spell_create_spring.py (100%) rename src/{ => rom24}/spells/spell_create_water.py (100%) rename src/{ => rom24}/spells/spell_cure_blindness.py (100%) rename src/{ => rom24}/spells/spell_cure_critical.py (100%) rename src/{ => rom24}/spells/spell_cure_disease.py (100%) rename src/{ => rom24}/spells/spell_cure_light.py (100%) rename src/{ => rom24}/spells/spell_cure_poison.py (100%) rename src/{ => rom24}/spells/spell_cure_serious.py (100%) rename src/{ => rom24}/spells/spell_curse.py (100%) rename src/{ => rom24}/spells/spell_demonfire.py (100%) rename src/{ => rom24}/spells/spell_detect_evil.py (100%) rename src/{ => rom24}/spells/spell_detect_good.py (100%) rename src/{ => rom24}/spells/spell_detect_hidden.py (100%) rename src/{ => rom24}/spells/spell_detect_invis.py (100%) rename src/{ => rom24}/spells/spell_detect_magic.py (100%) rename src/{ => rom24}/spells/spell_detect_poison.py (100%) rename src/{ => rom24}/spells/spell_dispel_evil.py (100%) rename src/{ => rom24}/spells/spell_dispel_good.py (100%) rename src/{ => rom24}/spells/spell_dispel_magic.py (100%) rename src/{ => rom24}/spells/spell_earthquake.py (100%) rename src/{ => rom24}/spells/spell_enchant_armor.py (100%) rename src/{ => rom24}/spells/spell_enchant_weapon.py (100%) rename src/{ => rom24}/spells/spell_energy_drain.py (100%) rename src/{ => rom24}/spells/spell_faerie_fire.py (100%) rename src/{ => rom24}/spells/spell_faerie_fog.py (100%) rename src/{ => rom24}/spells/spell_farsight.py (100%) rename src/{ => rom24}/spells/spell_fire_breath.py (100%) rename src/{ => rom24}/spells/spell_fireball.py (100%) rename src/{ => rom24}/spells/spell_fireproof.py (100%) rename src/{ => rom24}/spells/spell_flamestrike.py (100%) rename src/{ => rom24}/spells/spell_floating_disc.py (100%) rename src/{ => rom24}/spells/spell_fly.py (100%) rename src/{ => rom24}/spells/spell_frenzy.py (100%) rename src/{ => rom24}/spells/spell_frost_breath.py (100%) rename src/{ => rom24}/spells/spell_gas_breath.py (100%) rename src/{ => rom24}/spells/spell_gate.py (100%) rename src/{ => rom24}/spells/spell_general_purpose.py (100%) rename src/{ => rom24}/spells/spell_giant_strength.py (100%) rename src/{ => rom24}/spells/spell_harm.py (100%) rename src/{ => rom24}/spells/spell_haste.py (100%) rename src/{ => rom24}/spells/spell_heal.py (100%) rename src/{ => rom24}/spells/spell_heat_metal.py (100%) rename src/{ => rom24}/spells/spell_high_explosive.py (100%) rename src/{ => rom24}/spells/spell_holy_word.py (100%) rename src/{ => rom24}/spells/spell_identify.py (100%) rename src/{ => rom24}/spells/spell_infravision.py (100%) rename src/{ => rom24}/spells/spell_invis.py (100%) rename src/{ => rom24}/spells/spell_know_alignment.py (100%) rename src/{ => rom24}/spells/spell_lightning_bolt.py (100%) rename src/{ => rom24}/spells/spell_lightning_breath.py (100%) rename src/{ => rom24}/spells/spell_locate_object.py (100%) rename src/{ => rom24}/spells/spell_magic_missile.py (100%) rename src/{ => rom24}/spells/spell_mass_healing.py (100%) rename src/{ => rom24}/spells/spell_mass_invis.py (100%) rename src/{ => rom24}/spells/spell_nexus.py (100%) rename src/{ => rom24}/spells/spell_pass_door.py (100%) rename src/{ => rom24}/spells/spell_plague.py (100%) rename src/{ => rom24}/spells/spell_poison.py (100%) rename src/{ => rom24}/spells/spell_portal.py (100%) rename src/{ => rom24}/spells/spell_protection_evil.py (100%) rename src/{ => rom24}/spells/spell_protection_good.py (100%) rename src/{ => rom24}/spells/spell_ray_of_truth.py (100%) rename src/{ => rom24}/spells/spell_recharge.py (100%) rename src/{ => rom24}/spells/spell_refresh.py (100%) rename src/{ => rom24}/spells/spell_remove_curse.py (100%) rename src/{ => rom24}/spells/spell_sanctuary.py (100%) rename src/{ => rom24}/spells/spell_shield.py (100%) rename src/{ => rom24}/spells/spell_shocking_grasp.py (100%) rename src/{ => rom24}/spells/spell_sleep.py (100%) rename src/{ => rom24}/spells/spell_slow.py (100%) rename src/{ => rom24}/spells/spell_stone_skin.py (100%) rename src/{ => rom24}/spells/spell_summon.py (100%) rename src/{ => rom24}/spells/spell_teleport.py (100%) rename src/{ => rom24}/spells/spell_ventriloquate.py (100%) rename src/{ => rom24}/spells/spell_weaken.py (100%) rename src/{ => rom24}/spells/spell_word_of_recall.py (100%) rename src/{ => rom24}/state_checks.py (100%) rename src/{ => rom24}/sys_utils.py (100%) rename src/{ => rom24}/tables.py (100%) rename src/{ => rom24}/type_bypass.py (100%) rename src/{ => rom24}/uait/legacy_loads.py (100%) rename src/{ => rom24}/update.py (100%) rename src/{ => rom24}/world_classes.py (100%) diff --git a/src/CONCEPTS b/src/rom24/CONCEPTS similarity index 100% rename from src/CONCEPTS rename to src/rom24/CONCEPTS diff --git a/src/affects.py b/src/rom24/affects.py similarity index 100% rename from src/affects.py rename to src/rom24/affects.py diff --git a/src/auth.py b/src/rom24/auth.py similarity index 100% rename from src/auth.py rename to src/rom24/auth.py diff --git a/src/bit.py b/src/rom24/bit.py similarity index 100% rename from src/bit.py rename to src/rom24/bit.py diff --git a/src/comm.py b/src/rom24/comm.py similarity index 100% rename from src/comm.py rename to src/rom24/comm.py diff --git a/src/commands/__init__.py b/src/rom24/commands/__init__.py similarity index 100% rename from src/commands/__init__.py rename to src/rom24/commands/__init__.py diff --git a/src/commands/do_advance.py b/src/rom24/commands/do_advance.py similarity index 100% rename from src/commands/do_advance.py rename to src/rom24/commands/do_advance.py diff --git a/src/commands/do_affects.py b/src/rom24/commands/do_affects.py similarity index 100% rename from src/commands/do_affects.py rename to src/rom24/commands/do_affects.py diff --git a/src/commands/do_afk.py b/src/rom24/commands/do_afk.py similarity index 100% rename from src/commands/do_afk.py rename to src/rom24/commands/do_afk.py diff --git a/src/commands/do_alias.py b/src/rom24/commands/do_alias.py similarity index 100% rename from src/commands/do_alias.py rename to src/rom24/commands/do_alias.py diff --git a/src/commands/do_answer.py b/src/rom24/commands/do_answer.py similarity index 100% rename from src/commands/do_answer.py rename to src/rom24/commands/do_answer.py diff --git a/src/commands/do_apickle.py b/src/rom24/commands/do_apickle.py similarity index 100% rename from src/commands/do_apickle.py rename to src/rom24/commands/do_apickle.py diff --git a/src/commands/do_areas.py b/src/rom24/commands/do_areas.py similarity index 100% rename from src/commands/do_areas.py rename to src/rom24/commands/do_areas.py diff --git a/src/commands/do_at.py b/src/rom24/commands/do_at.py similarity index 100% rename from src/commands/do_at.py rename to src/rom24/commands/do_at.py diff --git a/src/commands/do_auction.py b/src/rom24/commands/do_auction.py similarity index 100% rename from src/commands/do_auction.py rename to src/rom24/commands/do_auction.py diff --git a/src/commands/do_authenticator.py b/src/rom24/commands/do_authenticator.py similarity index 100% rename from src/commands/do_authenticator.py rename to src/rom24/commands/do_authenticator.py diff --git a/src/commands/do_autoassist.py b/src/rom24/commands/do_autoassist.py similarity index 100% rename from src/commands/do_autoassist.py rename to src/rom24/commands/do_autoassist.py diff --git a/src/commands/do_autoexit.py b/src/rom24/commands/do_autoexit.py similarity index 100% rename from src/commands/do_autoexit.py rename to src/rom24/commands/do_autoexit.py diff --git a/src/commands/do_autogold.py b/src/rom24/commands/do_autogold.py similarity index 100% rename from src/commands/do_autogold.py rename to src/rom24/commands/do_autogold.py diff --git a/src/commands/do_autolist.py b/src/rom24/commands/do_autolist.py similarity index 100% rename from src/commands/do_autolist.py rename to src/rom24/commands/do_autolist.py diff --git a/src/commands/do_autoloot.py b/src/rom24/commands/do_autoloot.py similarity index 100% rename from src/commands/do_autoloot.py rename to src/rom24/commands/do_autoloot.py diff --git a/src/commands/do_autosac.py b/src/rom24/commands/do_autosac.py similarity index 100% rename from src/commands/do_autosac.py rename to src/rom24/commands/do_autosac.py diff --git a/src/commands/do_autosplit.py b/src/rom24/commands/do_autosplit.py similarity index 100% rename from src/commands/do_autosplit.py rename to src/rom24/commands/do_autosplit.py diff --git a/src/commands/do_backstab.py b/src/rom24/commands/do_backstab.py similarity index 100% rename from src/commands/do_backstab.py rename to src/rom24/commands/do_backstab.py diff --git a/src/commands/do_bamfin.py b/src/rom24/commands/do_bamfin.py similarity index 100% rename from src/commands/do_bamfin.py rename to src/rom24/commands/do_bamfin.py diff --git a/src/commands/do_bamfout.py b/src/rom24/commands/do_bamfout.py similarity index 100% rename from src/commands/do_bamfout.py rename to src/rom24/commands/do_bamfout.py diff --git a/src/commands/do_bash.py b/src/rom24/commands/do_bash.py similarity index 100% rename from src/commands/do_bash.py rename to src/rom24/commands/do_bash.py diff --git a/src/commands/do_berserk.py b/src/rom24/commands/do_berserk.py similarity index 100% rename from src/commands/do_berserk.py rename to src/rom24/commands/do_berserk.py diff --git a/src/commands/do_brandish.py b/src/rom24/commands/do_brandish.py similarity index 100% rename from src/commands/do_brandish.py rename to src/rom24/commands/do_brandish.py diff --git a/src/commands/do_brief.py b/src/rom24/commands/do_brief.py similarity index 100% rename from src/commands/do_brief.py rename to src/rom24/commands/do_brief.py diff --git a/src/commands/do_bug.py b/src/rom24/commands/do_bug.py similarity index 100% rename from src/commands/do_bug.py rename to src/rom24/commands/do_bug.py diff --git a/src/commands/do_buy.py b/src/rom24/commands/do_buy.py similarity index 100% rename from src/commands/do_buy.py rename to src/rom24/commands/do_buy.py diff --git a/src/commands/do_cast.py b/src/rom24/commands/do_cast.py similarity index 100% rename from src/commands/do_cast.py rename to src/rom24/commands/do_cast.py diff --git a/src/commands/do_channels.py b/src/rom24/commands/do_channels.py similarity index 100% rename from src/commands/do_channels.py rename to src/rom24/commands/do_channels.py diff --git a/src/commands/do_clantalk.py b/src/rom24/commands/do_clantalk.py similarity index 100% rename from src/commands/do_clantalk.py rename to src/rom24/commands/do_clantalk.py diff --git a/src/commands/do_clone.py b/src/rom24/commands/do_clone.py similarity index 100% rename from src/commands/do_clone.py rename to src/rom24/commands/do_clone.py diff --git a/src/commands/do_close.py b/src/rom24/commands/do_close.py similarity index 100% rename from src/commands/do_close.py rename to src/rom24/commands/do_close.py diff --git a/src/commands/do_combine.py b/src/rom24/commands/do_combine.py similarity index 100% rename from src/commands/do_combine.py rename to src/rom24/commands/do_combine.py diff --git a/src/commands/do_commands.py b/src/rom24/commands/do_commands.py similarity index 100% rename from src/commands/do_commands.py rename to src/rom24/commands/do_commands.py diff --git a/src/commands/do_compact.py b/src/rom24/commands/do_compact.py similarity index 100% rename from src/commands/do_compact.py rename to src/rom24/commands/do_compact.py diff --git a/src/commands/do_compare.py b/src/rom24/commands/do_compare.py similarity index 100% rename from src/commands/do_compare.py rename to src/rom24/commands/do_compare.py diff --git a/src/commands/do_consider.py b/src/rom24/commands/do_consider.py similarity index 100% rename from src/commands/do_consider.py rename to src/rom24/commands/do_consider.py diff --git a/src/commands/do_count.py b/src/rom24/commands/do_count.py similarity index 100% rename from src/commands/do_count.py rename to src/rom24/commands/do_count.py diff --git a/src/commands/do_deaf.py b/src/rom24/commands/do_deaf.py similarity index 100% rename from src/commands/do_deaf.py rename to src/rom24/commands/do_deaf.py diff --git a/src/commands/do_debug.py b/src/rom24/commands/do_debug.py similarity index 100% rename from src/commands/do_debug.py rename to src/rom24/commands/do_debug.py diff --git a/src/commands/do_delete.py b/src/rom24/commands/do_delete.py similarity index 100% rename from src/commands/do_delete.py rename to src/rom24/commands/do_delete.py diff --git a/src/commands/do_deny.py b/src/rom24/commands/do_deny.py similarity index 100% rename from src/commands/do_deny.py rename to src/rom24/commands/do_deny.py diff --git a/src/commands/do_description.py b/src/rom24/commands/do_description.py similarity index 100% rename from src/commands/do_description.py rename to src/rom24/commands/do_description.py diff --git a/src/commands/do_dirt.py b/src/rom24/commands/do_dirt.py similarity index 100% rename from src/commands/do_dirt.py rename to src/rom24/commands/do_dirt.py diff --git a/src/commands/do_disarm.py b/src/rom24/commands/do_disarm.py similarity index 100% rename from src/commands/do_disarm.py rename to src/rom24/commands/do_disarm.py diff --git a/src/commands/do_disconnect.py b/src/rom24/commands/do_disconnect.py similarity index 100% rename from src/commands/do_disconnect.py rename to src/rom24/commands/do_disconnect.py diff --git a/src/commands/do_down.py b/src/rom24/commands/do_down.py similarity index 100% rename from src/commands/do_down.py rename to src/rom24/commands/do_down.py diff --git a/src/commands/do_drink.py b/src/rom24/commands/do_drink.py similarity index 100% rename from src/commands/do_drink.py rename to src/rom24/commands/do_drink.py diff --git a/src/commands/do_drop.py b/src/rom24/commands/do_drop.py similarity index 100% rename from src/commands/do_drop.py rename to src/rom24/commands/do_drop.py diff --git a/src/commands/do_dump.py b/src/rom24/commands/do_dump.py similarity index 100% rename from src/commands/do_dump.py rename to src/rom24/commands/do_dump.py diff --git a/src/commands/do_east.py b/src/rom24/commands/do_east.py similarity index 100% rename from src/commands/do_east.py rename to src/rom24/commands/do_east.py diff --git a/src/commands/do_eat.py b/src/rom24/commands/do_eat.py similarity index 100% rename from src/commands/do_eat.py rename to src/rom24/commands/do_eat.py diff --git a/src/commands/do_echo.py b/src/rom24/commands/do_echo.py similarity index 100% rename from src/commands/do_echo.py rename to src/rom24/commands/do_echo.py diff --git a/src/commands/do_emote.py b/src/rom24/commands/do_emote.py similarity index 100% rename from src/commands/do_emote.py rename to src/rom24/commands/do_emote.py diff --git a/src/commands/do_enter.py b/src/rom24/commands/do_enter.py similarity index 100% rename from src/commands/do_enter.py rename to src/rom24/commands/do_enter.py diff --git a/src/commands/do_envenom.py b/src/rom24/commands/do_envenom.py similarity index 100% rename from src/commands/do_envenom.py rename to src/rom24/commands/do_envenom.py diff --git a/src/commands/do_equipment.py b/src/rom24/commands/do_equipment.py similarity index 100% rename from src/commands/do_equipment.py rename to src/rom24/commands/do_equipment.py diff --git a/src/commands/do_examine.py b/src/rom24/commands/do_examine.py similarity index 100% rename from src/commands/do_examine.py rename to src/rom24/commands/do_examine.py diff --git a/src/commands/do_exits.py b/src/rom24/commands/do_exits.py similarity index 100% rename from src/commands/do_exits.py rename to src/rom24/commands/do_exits.py diff --git a/src/commands/do_fill.py b/src/rom24/commands/do_fill.py similarity index 100% rename from src/commands/do_fill.py rename to src/rom24/commands/do_fill.py diff --git a/src/commands/do_flags.py b/src/rom24/commands/do_flags.py similarity index 100% rename from src/commands/do_flags.py rename to src/rom24/commands/do_flags.py diff --git a/src/commands/do_flee.py b/src/rom24/commands/do_flee.py similarity index 100% rename from src/commands/do_flee.py rename to src/rom24/commands/do_flee.py diff --git a/src/commands/do_follow.py b/src/rom24/commands/do_follow.py similarity index 100% rename from src/commands/do_follow.py rename to src/rom24/commands/do_follow.py diff --git a/src/commands/do_force.py b/src/rom24/commands/do_force.py similarity index 100% rename from src/commands/do_force.py rename to src/rom24/commands/do_force.py diff --git a/src/commands/do_freeze.py b/src/rom24/commands/do_freeze.py similarity index 100% rename from src/commands/do_freeze.py rename to src/rom24/commands/do_freeze.py diff --git a/src/commands/do_freset.py b/src/rom24/commands/do_freset.py similarity index 100% rename from src/commands/do_freset.py rename to src/rom24/commands/do_freset.py diff --git a/src/commands/do_gain.py b/src/rom24/commands/do_gain.py similarity index 100% rename from src/commands/do_gain.py rename to src/rom24/commands/do_gain.py diff --git a/src/commands/do_gdstate.py b/src/rom24/commands/do_gdstate.py similarity index 100% rename from src/commands/do_gdstate.py rename to src/rom24/commands/do_gdstate.py diff --git a/src/commands/do_get.py b/src/rom24/commands/do_get.py similarity index 100% rename from src/commands/do_get.py rename to src/rom24/commands/do_get.py diff --git a/src/commands/do_give.py b/src/rom24/commands/do_give.py similarity index 100% rename from src/commands/do_give.py rename to src/rom24/commands/do_give.py diff --git a/src/commands/do_gossip.py b/src/rom24/commands/do_gossip.py similarity index 100% rename from src/commands/do_gossip.py rename to src/rom24/commands/do_gossip.py diff --git a/src/commands/do_goto.py b/src/rom24/commands/do_goto.py similarity index 100% rename from src/commands/do_goto.py rename to src/rom24/commands/do_goto.py diff --git a/src/commands/do_grats.py b/src/rom24/commands/do_grats.py similarity index 100% rename from src/commands/do_grats.py rename to src/rom24/commands/do_grats.py diff --git a/src/commands/do_group.py b/src/rom24/commands/do_group.py similarity index 100% rename from src/commands/do_group.py rename to src/rom24/commands/do_group.py diff --git a/src/commands/do_groups.py b/src/rom24/commands/do_groups.py similarity index 100% rename from src/commands/do_groups.py rename to src/rom24/commands/do_groups.py diff --git a/src/commands/do_gtell.py b/src/rom24/commands/do_gtell.py similarity index 100% rename from src/commands/do_gtell.py rename to src/rom24/commands/do_gtell.py diff --git a/src/commands/do_guild.py b/src/rom24/commands/do_guild.py similarity index 100% rename from src/commands/do_guild.py rename to src/rom24/commands/do_guild.py diff --git a/src/commands/do_heal.py b/src/rom24/commands/do_heal.py similarity index 100% rename from src/commands/do_heal.py rename to src/rom24/commands/do_heal.py diff --git a/src/commands/do_help.py b/src/rom24/commands/do_help.py similarity index 100% rename from src/commands/do_help.py rename to src/rom24/commands/do_help.py diff --git a/src/commands/do_hide.py b/src/rom24/commands/do_hide.py similarity index 100% rename from src/commands/do_hide.py rename to src/rom24/commands/do_hide.py diff --git a/src/commands/do_holylight.py b/src/rom24/commands/do_holylight.py similarity index 100% rename from src/commands/do_holylight.py rename to src/rom24/commands/do_holylight.py diff --git a/src/commands/do_immtalk.py b/src/rom24/commands/do_immtalk.py similarity index 100% rename from src/commands/do_immtalk.py rename to src/rom24/commands/do_immtalk.py diff --git a/src/commands/do_incognito.py b/src/rom24/commands/do_incognito.py similarity index 100% rename from src/commands/do_incognito.py rename to src/rom24/commands/do_incognito.py diff --git a/src/commands/do_inventory.py b/src/rom24/commands/do_inventory.py similarity index 100% rename from src/commands/do_inventory.py rename to src/rom24/commands/do_inventory.py diff --git a/src/commands/do_invis.py b/src/rom24/commands/do_invis.py similarity index 100% rename from src/commands/do_invis.py rename to src/rom24/commands/do_invis.py diff --git a/src/commands/do_kick.py b/src/rom24/commands/do_kick.py similarity index 100% rename from src/commands/do_kick.py rename to src/rom24/commands/do_kick.py diff --git a/src/commands/do_kill.py b/src/rom24/commands/do_kill.py similarity index 100% rename from src/commands/do_kill.py rename to src/rom24/commands/do_kill.py diff --git a/src/commands/do_list.py b/src/rom24/commands/do_list.py similarity index 100% rename from src/commands/do_list.py rename to src/rom24/commands/do_list.py diff --git a/src/commands/do_load.py b/src/rom24/commands/do_load.py similarity index 100% rename from src/commands/do_load.py rename to src/rom24/commands/do_load.py diff --git a/src/commands/do_lock.py b/src/rom24/commands/do_lock.py similarity index 100% rename from src/commands/do_lock.py rename to src/rom24/commands/do_lock.py diff --git a/src/commands/do_log.py b/src/rom24/commands/do_log.py similarity index 100% rename from src/commands/do_log.py rename to src/rom24/commands/do_log.py diff --git a/src/commands/do_look.py b/src/rom24/commands/do_look.py similarity index 100% rename from src/commands/do_look.py rename to src/rom24/commands/do_look.py diff --git a/src/commands/do_memory.py b/src/rom24/commands/do_memory.py similarity index 100% rename from src/commands/do_memory.py rename to src/rom24/commands/do_memory.py diff --git a/src/commands/do_mfind.py b/src/rom24/commands/do_mfind.py similarity index 100% rename from src/commands/do_mfind.py rename to src/rom24/commands/do_mfind.py diff --git a/src/commands/do_mload.py b/src/rom24/commands/do_mload.py similarity index 100% rename from src/commands/do_mload.py rename to src/rom24/commands/do_mload.py diff --git a/src/commands/do_mset.py b/src/rom24/commands/do_mset.py similarity index 100% rename from src/commands/do_mset.py rename to src/rom24/commands/do_mset.py diff --git a/src/commands/do_mstat.py b/src/rom24/commands/do_mstat.py similarity index 100% rename from src/commands/do_mstat.py rename to src/rom24/commands/do_mstat.py diff --git a/src/commands/do_murder.py b/src/rom24/commands/do_murder.py similarity index 100% rename from src/commands/do_murder.py rename to src/rom24/commands/do_murder.py diff --git a/src/commands/do_music.py b/src/rom24/commands/do_music.py similarity index 100% rename from src/commands/do_music.py rename to src/rom24/commands/do_music.py diff --git a/src/commands/do_mwhere.py b/src/rom24/commands/do_mwhere.py similarity index 100% rename from src/commands/do_mwhere.py rename to src/rom24/commands/do_mwhere.py diff --git a/src/commands/do_newlock.py b/src/rom24/commands/do_newlock.py similarity index 100% rename from src/commands/do_newlock.py rename to src/rom24/commands/do_newlock.py diff --git a/src/commands/do_nochannels.py b/src/rom24/commands/do_nochannels.py similarity index 100% rename from src/commands/do_nochannels.py rename to src/rom24/commands/do_nochannels.py diff --git a/src/commands/do_noemote.py b/src/rom24/commands/do_noemote.py similarity index 100% rename from src/commands/do_noemote.py rename to src/rom24/commands/do_noemote.py diff --git a/src/commands/do_nofollow.py b/src/rom24/commands/do_nofollow.py similarity index 100% rename from src/commands/do_nofollow.py rename to src/rom24/commands/do_nofollow.py diff --git a/src/commands/do_noloot.py b/src/rom24/commands/do_noloot.py similarity index 100% rename from src/commands/do_noloot.py rename to src/rom24/commands/do_noloot.py diff --git a/src/commands/do_north.py b/src/rom24/commands/do_north.py similarity index 100% rename from src/commands/do_north.py rename to src/rom24/commands/do_north.py diff --git a/src/commands/do_noshout.py b/src/rom24/commands/do_noshout.py similarity index 100% rename from src/commands/do_noshout.py rename to src/rom24/commands/do_noshout.py diff --git a/src/commands/do_nosummon.py b/src/rom24/commands/do_nosummon.py similarity index 100% rename from src/commands/do_nosummon.py rename to src/rom24/commands/do_nosummon.py diff --git a/src/commands/do_notell.py b/src/rom24/commands/do_notell.py similarity index 100% rename from src/commands/do_notell.py rename to src/rom24/commands/do_notell.py diff --git a/src/commands/do_ofind.py b/src/rom24/commands/do_ofind.py similarity index 100% rename from src/commands/do_ofind.py rename to src/rom24/commands/do_ofind.py diff --git a/src/commands/do_oload.py b/src/rom24/commands/do_oload.py similarity index 100% rename from src/commands/do_oload.py rename to src/rom24/commands/do_oload.py diff --git a/src/commands/do_omni.py b/src/rom24/commands/do_omni.py similarity index 100% rename from src/commands/do_omni.py rename to src/rom24/commands/do_omni.py diff --git a/src/commands/do_open.py b/src/rom24/commands/do_open.py similarity index 100% rename from src/commands/do_open.py rename to src/rom24/commands/do_open.py diff --git a/src/commands/do_order.py b/src/rom24/commands/do_order.py similarity index 100% rename from src/commands/do_order.py rename to src/rom24/commands/do_order.py diff --git a/src/commands/do_oset.py b/src/rom24/commands/do_oset.py similarity index 100% rename from src/commands/do_oset.py rename to src/rom24/commands/do_oset.py diff --git a/src/commands/do_ostat.py b/src/rom24/commands/do_ostat.py similarity index 100% rename from src/commands/do_ostat.py rename to src/rom24/commands/do_ostat.py diff --git a/src/commands/do_outfit.py b/src/rom24/commands/do_outfit.py similarity index 100% rename from src/commands/do_outfit.py rename to src/rom24/commands/do_outfit.py diff --git a/src/commands/do_owhere.py b/src/rom24/commands/do_owhere.py similarity index 100% rename from src/commands/do_owhere.py rename to src/rom24/commands/do_owhere.py diff --git a/src/commands/do_pardon.py b/src/rom24/commands/do_pardon.py similarity index 100% rename from src/commands/do_pardon.py rename to src/rom24/commands/do_pardon.py diff --git a/src/commands/do_password.py b/src/rom24/commands/do_password.py similarity index 100% rename from src/commands/do_password.py rename to src/rom24/commands/do_password.py diff --git a/src/commands/do_peace.py b/src/rom24/commands/do_peace.py similarity index 100% rename from src/commands/do_peace.py rename to src/rom24/commands/do_peace.py diff --git a/src/commands/do_pecho.py b/src/rom24/commands/do_pecho.py similarity index 100% rename from src/commands/do_pecho.py rename to src/rom24/commands/do_pecho.py diff --git a/src/commands/do_pick.py b/src/rom24/commands/do_pick.py similarity index 100% rename from src/commands/do_pick.py rename to src/rom24/commands/do_pick.py diff --git a/src/commands/do_pmote.py b/src/rom24/commands/do_pmote.py similarity index 100% rename from src/commands/do_pmote.py rename to src/rom24/commands/do_pmote.py diff --git a/src/commands/do_pose.py b/src/rom24/commands/do_pose.py similarity index 100% rename from src/commands/do_pose.py rename to src/rom24/commands/do_pose.py diff --git a/src/commands/do_pour.py b/src/rom24/commands/do_pour.py similarity index 100% rename from src/commands/do_pour.py rename to src/rom24/commands/do_pour.py diff --git a/src/commands/do_practice.py b/src/rom24/commands/do_practice.py similarity index 100% rename from src/commands/do_practice.py rename to src/rom24/commands/do_practice.py diff --git a/src/commands/do_prefix.py b/src/rom24/commands/do_prefix.py similarity index 100% rename from src/commands/do_prefix.py rename to src/rom24/commands/do_prefix.py diff --git a/src/commands/do_prompt.py b/src/rom24/commands/do_prompt.py similarity index 100% rename from src/commands/do_prompt.py rename to src/rom24/commands/do_prompt.py diff --git a/src/commands/do_protect.py b/src/rom24/commands/do_protect.py similarity index 100% rename from src/commands/do_protect.py rename to src/rom24/commands/do_protect.py diff --git a/src/commands/do_purge.py b/src/rom24/commands/do_purge.py similarity index 100% rename from src/commands/do_purge.py rename to src/rom24/commands/do_purge.py diff --git a/src/commands/do_put.py b/src/rom24/commands/do_put.py similarity index 100% rename from src/commands/do_put.py rename to src/rom24/commands/do_put.py diff --git a/src/commands/do_quaff.py b/src/rom24/commands/do_quaff.py similarity index 100% rename from src/commands/do_quaff.py rename to src/rom24/commands/do_quaff.py diff --git a/src/commands/do_question.py b/src/rom24/commands/do_question.py similarity index 100% rename from src/commands/do_question.py rename to src/rom24/commands/do_question.py diff --git a/src/commands/do_quiet.py b/src/rom24/commands/do_quiet.py similarity index 100% rename from src/commands/do_quiet.py rename to src/rom24/commands/do_quiet.py diff --git a/src/commands/do_quit.py b/src/rom24/commands/do_quit.py similarity index 100% rename from src/commands/do_quit.py rename to src/rom24/commands/do_quit.py diff --git a/src/commands/do_quote.py b/src/rom24/commands/do_quote.py similarity index 100% rename from src/commands/do_quote.py rename to src/rom24/commands/do_quote.py diff --git a/src/commands/do_reboot.py b/src/rom24/commands/do_reboot.py similarity index 100% rename from src/commands/do_reboot.py rename to src/rom24/commands/do_reboot.py diff --git a/src/commands/do_recall.py b/src/rom24/commands/do_recall.py similarity index 100% rename from src/commands/do_recall.py rename to src/rom24/commands/do_recall.py diff --git a/src/commands/do_recho.py b/src/rom24/commands/do_recho.py similarity index 100% rename from src/commands/do_recho.py rename to src/rom24/commands/do_recho.py diff --git a/src/commands/do_recite.py b/src/rom24/commands/do_recite.py similarity index 100% rename from src/commands/do_recite.py rename to src/rom24/commands/do_recite.py diff --git a/src/commands/do_reload.py b/src/rom24/commands/do_reload.py similarity index 100% rename from src/commands/do_reload.py rename to src/rom24/commands/do_reload.py diff --git a/src/commands/do_remove.py b/src/rom24/commands/do_remove.py similarity index 100% rename from src/commands/do_remove.py rename to src/rom24/commands/do_remove.py diff --git a/src/commands/do_rent.py b/src/rom24/commands/do_rent.py similarity index 100% rename from src/commands/do_rent.py rename to src/rom24/commands/do_rent.py diff --git a/src/commands/do_replay.py b/src/rom24/commands/do_replay.py similarity index 100% rename from src/commands/do_replay.py rename to src/rom24/commands/do_replay.py diff --git a/src/commands/do_reply.py b/src/rom24/commands/do_reply.py similarity index 100% rename from src/commands/do_reply.py rename to src/rom24/commands/do_reply.py diff --git a/src/commands/do_report.py b/src/rom24/commands/do_report.py similarity index 100% rename from src/commands/do_report.py rename to src/rom24/commands/do_report.py diff --git a/src/commands/do_rescue.py b/src/rom24/commands/do_rescue.py similarity index 100% rename from src/commands/do_rescue.py rename to src/rom24/commands/do_rescue.py diff --git a/src/commands/do_rest.py b/src/rom24/commands/do_rest.py similarity index 100% rename from src/commands/do_rest.py rename to src/rom24/commands/do_rest.py diff --git a/src/commands/do_restore.py b/src/rom24/commands/do_restore.py similarity index 100% rename from src/commands/do_restore.py rename to src/rom24/commands/do_restore.py diff --git a/src/commands/do_return.py b/src/rom24/commands/do_return.py similarity index 100% rename from src/commands/do_return.py rename to src/rom24/commands/do_return.py diff --git a/src/commands/do_rstat.py b/src/rom24/commands/do_rstat.py similarity index 100% rename from src/commands/do_rstat.py rename to src/rom24/commands/do_rstat.py diff --git a/src/commands/do_sacrifice.py b/src/rom24/commands/do_sacrifice.py similarity index 100% rename from src/commands/do_sacrifice.py rename to src/rom24/commands/do_sacrifice.py diff --git a/src/commands/do_save.py b/src/rom24/commands/do_save.py similarity index 100% rename from src/commands/do_save.py rename to src/rom24/commands/do_save.py diff --git a/src/commands/do_say.py b/src/rom24/commands/do_say.py similarity index 100% rename from src/commands/do_say.py rename to src/rom24/commands/do_say.py diff --git a/src/commands/do_score.py b/src/rom24/commands/do_score.py similarity index 100% rename from src/commands/do_score.py rename to src/rom24/commands/do_score.py diff --git a/src/commands/do_scroll.py b/src/rom24/commands/do_scroll.py similarity index 100% rename from src/commands/do_scroll.py rename to src/rom24/commands/do_scroll.py diff --git a/src/commands/do_sell.py b/src/rom24/commands/do_sell.py similarity index 100% rename from src/commands/do_sell.py rename to src/rom24/commands/do_sell.py diff --git a/src/commands/do_set.py b/src/rom24/commands/do_set.py similarity index 100% rename from src/commands/do_set.py rename to src/rom24/commands/do_set.py diff --git a/src/commands/do_shout.py b/src/rom24/commands/do_shout.py similarity index 100% rename from src/commands/do_shout.py rename to src/rom24/commands/do_shout.py diff --git a/src/commands/do_show.py b/src/rom24/commands/do_show.py similarity index 100% rename from src/commands/do_show.py rename to src/rom24/commands/do_show.py diff --git a/src/commands/do_shutdown.py b/src/rom24/commands/do_shutdown.py similarity index 100% rename from src/commands/do_shutdown.py rename to src/rom24/commands/do_shutdown.py diff --git a/src/commands/do_sit.py b/src/rom24/commands/do_sit.py similarity index 100% rename from src/commands/do_sit.py rename to src/rom24/commands/do_sit.py diff --git a/src/commands/do_skills.py b/src/rom24/commands/do_skills.py similarity index 100% rename from src/commands/do_skills.py rename to src/rom24/commands/do_skills.py diff --git a/src/commands/do_slay.py b/src/rom24/commands/do_slay.py similarity index 100% rename from src/commands/do_slay.py rename to src/rom24/commands/do_slay.py diff --git a/src/commands/do_sleep.py b/src/rom24/commands/do_sleep.py similarity index 100% rename from src/commands/do_sleep.py rename to src/rom24/commands/do_sleep.py diff --git a/src/commands/do_slookup.py b/src/rom24/commands/do_slookup.py similarity index 100% rename from src/commands/do_slookup.py rename to src/rom24/commands/do_slookup.py diff --git a/src/commands/do_smote.py b/src/rom24/commands/do_smote.py similarity index 100% rename from src/commands/do_smote.py rename to src/rom24/commands/do_smote.py diff --git a/src/commands/do_sneak.py b/src/rom24/commands/do_sneak.py similarity index 100% rename from src/commands/do_sneak.py rename to src/rom24/commands/do_sneak.py diff --git a/src/commands/do_snoop.py b/src/rom24/commands/do_snoop.py similarity index 100% rename from src/commands/do_snoop.py rename to src/rom24/commands/do_snoop.py diff --git a/src/commands/do_socials.py b/src/rom24/commands/do_socials.py similarity index 100% rename from src/commands/do_socials.py rename to src/rom24/commands/do_socials.py diff --git a/src/commands/do_sockets.py b/src/rom24/commands/do_sockets.py similarity index 100% rename from src/commands/do_sockets.py rename to src/rom24/commands/do_sockets.py diff --git a/src/commands/do_south.py b/src/rom24/commands/do_south.py similarity index 100% rename from src/commands/do_south.py rename to src/rom24/commands/do_south.py diff --git a/src/commands/do_spells.py b/src/rom24/commands/do_spells.py similarity index 100% rename from src/commands/do_spells.py rename to src/rom24/commands/do_spells.py diff --git a/src/commands/do_split.py b/src/rom24/commands/do_split.py similarity index 100% rename from src/commands/do_split.py rename to src/rom24/commands/do_split.py diff --git a/src/commands/do_sset.py b/src/rom24/commands/do_sset.py similarity index 100% rename from src/commands/do_sset.py rename to src/rom24/commands/do_sset.py diff --git a/src/commands/do_stand.py b/src/rom24/commands/do_stand.py similarity index 100% rename from src/commands/do_stand.py rename to src/rom24/commands/do_stand.py diff --git a/src/commands/do_stat.py b/src/rom24/commands/do_stat.py similarity index 100% rename from src/commands/do_stat.py rename to src/rom24/commands/do_stat.py diff --git a/src/commands/do_steal.py b/src/rom24/commands/do_steal.py similarity index 100% rename from src/commands/do_steal.py rename to src/rom24/commands/do_steal.py diff --git a/src/commands/do_string.py b/src/rom24/commands/do_string.py similarity index 100% rename from src/commands/do_string.py rename to src/rom24/commands/do_string.py diff --git a/src/commands/do_switch.py b/src/rom24/commands/do_switch.py similarity index 100% rename from src/commands/do_switch.py rename to src/rom24/commands/do_switch.py diff --git a/src/commands/do_tabledump.py b/src/rom24/commands/do_tabledump.py similarity index 100% rename from src/commands/do_tabledump.py rename to src/rom24/commands/do_tabledump.py diff --git a/src/commands/do_tableload.py b/src/rom24/commands/do_tableload.py similarity index 100% rename from src/commands/do_tableload.py rename to src/rom24/commands/do_tableload.py diff --git a/src/commands/do_tell.py b/src/rom24/commands/do_tell.py similarity index 100% rename from src/commands/do_tell.py rename to src/rom24/commands/do_tell.py diff --git a/src/commands/do_term.py b/src/rom24/commands/do_term.py similarity index 100% rename from src/commands/do_term.py rename to src/rom24/commands/do_term.py diff --git a/src/commands/do_time.py b/src/rom24/commands/do_time.py similarity index 100% rename from src/commands/do_time.py rename to src/rom24/commands/do_time.py diff --git a/src/commands/do_title.py b/src/rom24/commands/do_title.py similarity index 100% rename from src/commands/do_title.py rename to src/rom24/commands/do_title.py diff --git a/src/commands/do_train.py b/src/rom24/commands/do_train.py similarity index 100% rename from src/commands/do_train.py rename to src/rom24/commands/do_train.py diff --git a/src/commands/do_transfer.py b/src/rom24/commands/do_transfer.py similarity index 100% rename from src/commands/do_transfer.py rename to src/rom24/commands/do_transfer.py diff --git a/src/commands/do_trip.py b/src/rom24/commands/do_trip.py similarity index 100% rename from src/commands/do_trip.py rename to src/rom24/commands/do_trip.py diff --git a/src/commands/do_trust.py b/src/rom24/commands/do_trust.py similarity index 100% rename from src/commands/do_trust.py rename to src/rom24/commands/do_trust.py diff --git a/src/commands/do_typo.py b/src/rom24/commands/do_typo.py similarity index 100% rename from src/commands/do_typo.py rename to src/rom24/commands/do_typo.py diff --git a/src/commands/do_unalias.py b/src/rom24/commands/do_unalias.py similarity index 100% rename from src/commands/do_unalias.py rename to src/rom24/commands/do_unalias.py diff --git a/src/commands/do_unlock.py b/src/rom24/commands/do_unlock.py similarity index 100% rename from src/commands/do_unlock.py rename to src/rom24/commands/do_unlock.py diff --git a/src/commands/do_up.py b/src/rom24/commands/do_up.py similarity index 100% rename from src/commands/do_up.py rename to src/rom24/commands/do_up.py diff --git a/src/commands/do_value.py b/src/rom24/commands/do_value.py similarity index 100% rename from src/commands/do_value.py rename to src/rom24/commands/do_value.py diff --git a/src/commands/do_violate.py b/src/rom24/commands/do_violate.py similarity index 100% rename from src/commands/do_violate.py rename to src/rom24/commands/do_violate.py diff --git a/src/commands/do_visible.py b/src/rom24/commands/do_visible.py similarity index 100% rename from src/commands/do_visible.py rename to src/rom24/commands/do_visible.py diff --git a/src/commands/do_vnum.py b/src/rom24/commands/do_vnum.py similarity index 100% rename from src/commands/do_vnum.py rename to src/rom24/commands/do_vnum.py diff --git a/src/commands/do_wake.py b/src/rom24/commands/do_wake.py similarity index 100% rename from src/commands/do_wake.py rename to src/rom24/commands/do_wake.py diff --git a/src/commands/do_wear.py b/src/rom24/commands/do_wear.py similarity index 100% rename from src/commands/do_wear.py rename to src/rom24/commands/do_wear.py diff --git a/src/commands/do_weather.py b/src/rom24/commands/do_weather.py similarity index 100% rename from src/commands/do_weather.py rename to src/rom24/commands/do_weather.py diff --git a/src/commands/do_west.py b/src/rom24/commands/do_west.py similarity index 100% rename from src/commands/do_west.py rename to src/rom24/commands/do_west.py diff --git a/src/commands/do_where.py b/src/rom24/commands/do_where.py similarity index 100% rename from src/commands/do_where.py rename to src/rom24/commands/do_where.py diff --git a/src/commands/do_who.py b/src/rom24/commands/do_who.py similarity index 100% rename from src/commands/do_who.py rename to src/rom24/commands/do_who.py diff --git a/src/commands/do_whois.py b/src/rom24/commands/do_whois.py similarity index 100% rename from src/commands/do_whois.py rename to src/rom24/commands/do_whois.py diff --git a/src/commands/do_wimpy.py b/src/rom24/commands/do_wimpy.py similarity index 100% rename from src/commands/do_wimpy.py rename to src/rom24/commands/do_wimpy.py diff --git a/src/commands/do_wizhelp.py b/src/rom24/commands/do_wizhelp.py similarity index 100% rename from src/commands/do_wizhelp.py rename to src/rom24/commands/do_wizhelp.py diff --git a/src/commands/do_wizlock.py b/src/rom24/commands/do_wizlock.py similarity index 100% rename from src/commands/do_wizlock.py rename to src/rom24/commands/do_wizlock.py diff --git a/src/commands/do_wiznet.py b/src/rom24/commands/do_wiznet.py similarity index 100% rename from src/commands/do_wiznet.py rename to src/rom24/commands/do_wiznet.py diff --git a/src/commands/do_worth.py b/src/rom24/commands/do_worth.py similarity index 100% rename from src/commands/do_worth.py rename to src/rom24/commands/do_worth.py diff --git a/src/commands/do_yell.py b/src/rom24/commands/do_yell.py similarity index 100% rename from src/commands/do_yell.py rename to src/rom24/commands/do_yell.py diff --git a/src/commands/do_zap.py b/src/rom24/commands/do_zap.py similarity index 100% rename from src/commands/do_zap.py rename to src/rom24/commands/do_zap.py diff --git a/src/commands/do_zecho.py b/src/rom24/commands/do_zecho.py similarity index 100% rename from src/commands/do_zecho.py rename to src/rom24/commands/do_zecho.py diff --git a/src/const.py b/src/rom24/const.py similarity index 100% rename from src/const.py rename to src/rom24/const.py diff --git a/src/data_loader.py b/src/rom24/data_loader.py similarity index 100% rename from src/data_loader.py rename to src/rom24/data_loader.py diff --git a/src/database/__init__.py b/src/rom24/database/__init__.py similarity index 100% rename from src/database/__init__.py rename to src/rom24/database/__init__.py diff --git a/src/database/read/__init__.py b/src/rom24/database/read/__init__.py similarity index 100% rename from src/database/read/__init__.py rename to src/rom24/database/read/__init__.py diff --git a/src/database/read/read_tables.py b/src/rom24/database/read/read_tables.py similarity index 100% rename from src/database/read/read_tables.py rename to src/rom24/database/read/read_tables.py diff --git a/src/database/tracker.py b/src/rom24/database/tracker.py similarity index 100% rename from src/database/tracker.py rename to src/rom24/database/tracker.py diff --git a/src/database/write/__init__.py b/src/rom24/database/write/__init__.py similarity index 100% rename from src/database/write/__init__.py rename to src/rom24/database/write/__init__.py diff --git a/src/database/write/write_tables.py b/src/rom24/database/write/write_tables.py similarity index 100% rename from src/database/write/write_tables.py rename to src/rom24/database/write/write_tables.py diff --git a/src/db.py b/src/rom24/db.py similarity index 100% rename from src/db.py rename to src/rom24/db.py diff --git a/src/effects.py b/src/rom24/effects.py similarity index 100% rename from src/effects.py rename to src/rom24/effects.py diff --git a/src/environment.py b/src/rom24/environment.py similarity index 100% rename from src/environment.py rename to src/rom24/environment.py diff --git a/src/equipment.py b/src/rom24/equipment.py similarity index 100% rename from src/equipment.py rename to src/rom24/equipment.py diff --git a/src/fight.py b/src/rom24/fight.py similarity index 100% rename from src/fight.py rename to src/rom24/fight.py diff --git a/src/game_utils.py b/src/rom24/game_utils.py similarity index 100% rename from src/game_utils.py rename to src/rom24/game_utils.py diff --git a/src/handler_ch.py b/src/rom24/handler_ch.py similarity index 100% rename from src/handler_ch.py rename to src/rom24/handler_ch.py diff --git a/src/handler_game.py b/src/rom24/handler_game.py similarity index 100% rename from src/handler_game.py rename to src/rom24/handler_game.py diff --git a/src/handler_item.py b/src/rom24/handler_item.py similarity index 100% rename from src/handler_item.py rename to src/rom24/handler_item.py diff --git a/src/handler_log.py b/src/rom24/handler_log.py similarity index 100% rename from src/handler_log.py rename to src/rom24/handler_log.py diff --git a/src/handler_magic.py b/src/rom24/handler_magic.py similarity index 100% rename from src/handler_magic.py rename to src/rom24/handler_magic.py diff --git a/src/handler_npc.py b/src/rom24/handler_npc.py similarity index 100% rename from src/handler_npc.py rename to src/rom24/handler_npc.py diff --git a/src/handler_pc.py b/src/rom24/handler_pc.py similarity index 100% rename from src/handler_pc.py rename to src/rom24/handler_pc.py diff --git a/src/handler_room.py b/src/rom24/handler_room.py similarity index 100% rename from src/handler_room.py rename to src/rom24/handler_room.py diff --git a/src/hotfix.py b/src/rom24/hotfix.py similarity index 100% rename from src/hotfix.py rename to src/rom24/hotfix.py diff --git a/src/immortal.py b/src/rom24/immortal.py similarity index 100% rename from src/immortal.py rename to src/rom24/immortal.py diff --git a/src/instance.py b/src/rom24/instance.py similarity index 100% rename from src/instance.py rename to src/rom24/instance.py diff --git a/src/interp.py b/src/rom24/interp.py similarity index 100% rename from src/interp.py rename to src/rom24/interp.py diff --git a/src/inventory.py b/src/rom24/inventory.py similarity index 100% rename from src/inventory.py rename to src/rom24/inventory.py diff --git a/src/item_flags.py b/src/rom24/item_flags.py similarity index 100% rename from src/item_flags.py rename to src/rom24/item_flags.py diff --git a/src/living.py b/src/rom24/living.py similarity index 100% rename from src/living.py rename to src/rom24/living.py diff --git a/src/magic.py b/src/rom24/magic.py similarity index 100% rename from src/magic.py rename to src/rom24/magic.py diff --git a/src/merc.py b/src/rom24/merc.py similarity index 100% rename from src/merc.py rename to src/rom24/merc.py diff --git a/src/miniboa/LICENSE.TXT b/src/rom24/miniboa/LICENSE.TXT similarity index 100% rename from src/miniboa/LICENSE.TXT rename to src/rom24/miniboa/LICENSE.TXT diff --git a/src/miniboa/README.TXT b/src/rom24/miniboa/README.TXT similarity index 100% rename from src/miniboa/README.TXT rename to src/rom24/miniboa/README.TXT diff --git a/src/miniboa/__init__.py b/src/rom24/miniboa/__init__.py similarity index 100% rename from src/miniboa/__init__.py rename to src/rom24/miniboa/__init__.py diff --git a/src/miniboa/asyncio.py b/src/rom24/miniboa/asyncio.py similarity index 100% rename from src/miniboa/asyncio.py rename to src/rom24/miniboa/asyncio.py diff --git a/src/miniboa/colors.py b/src/rom24/miniboa/colors.py similarity index 100% rename from src/miniboa/colors.py rename to src/rom24/miniboa/colors.py diff --git a/src/miniboa/telnet.py b/src/rom24/miniboa/telnet.py similarity index 100% rename from src/miniboa/telnet.py rename to src/rom24/miniboa/telnet.py diff --git a/src/miniboa/terminal.py b/src/rom24/miniboa/terminal.py similarity index 100% rename from src/miniboa/terminal.py rename to src/rom24/miniboa/terminal.py diff --git a/src/nanny.py b/src/rom24/nanny.py similarity index 100% rename from src/nanny.py rename to src/rom24/nanny.py diff --git a/src/object_creator.py b/src/rom24/object_creator.py similarity index 100% rename from src/object_creator.py rename to src/rom24/object_creator.py diff --git a/src/physical.py b/src/rom24/physical.py similarity index 100% rename from src/physical.py rename to src/rom24/physical.py diff --git a/src/pyom.py b/src/rom24/pyom.py similarity index 100% rename from src/pyom.py rename to src/rom24/pyom.py diff --git a/src/pyprogs.py b/src/rom24/pyprogs.py similarity index 100% rename from src/pyprogs.py rename to src/rom24/pyprogs.py diff --git a/src/save.py b/src/rom24/save.py similarity index 100% rename from src/save.py rename to src/rom24/save.py diff --git a/src/settings.py b/src/rom24/settings.py similarity index 100% rename from src/settings.py rename to src/rom24/settings.py diff --git a/src/shell.py b/src/rom24/shell.py similarity index 100% rename from src/shell.py rename to src/rom24/shell.py diff --git a/src/shop_utils.py b/src/rom24/shop_utils.py similarity index 100% rename from src/shop_utils.py rename to src/rom24/shop_utils.py diff --git a/src/skills.py b/src/rom24/skills.py similarity index 100% rename from src/skills.py rename to src/rom24/skills.py diff --git a/src/special.py b/src/rom24/special.py similarity index 100% rename from src/special.py rename to src/rom24/special.py diff --git a/src/spells/__init__.py b/src/rom24/spells/__init__.py similarity index 100% rename from src/spells/__init__.py rename to src/rom24/spells/__init__.py diff --git a/src/spells/spell_acid_blast.py b/src/rom24/spells/spell_acid_blast.py similarity index 100% rename from src/spells/spell_acid_blast.py rename to src/rom24/spells/spell_acid_blast.py diff --git a/src/spells/spell_acid_breath.py b/src/rom24/spells/spell_acid_breath.py similarity index 100% rename from src/spells/spell_acid_breath.py rename to src/rom24/spells/spell_acid_breath.py diff --git a/src/spells/spell_armor.py b/src/rom24/spells/spell_armor.py similarity index 100% rename from src/spells/spell_armor.py rename to src/rom24/spells/spell_armor.py diff --git a/src/spells/spell_bless.py b/src/rom24/spells/spell_bless.py similarity index 100% rename from src/spells/spell_bless.py rename to src/rom24/spells/spell_bless.py diff --git a/src/spells/spell_blindness.py b/src/rom24/spells/spell_blindness.py similarity index 100% rename from src/spells/spell_blindness.py rename to src/rom24/spells/spell_blindness.py diff --git a/src/spells/spell_burning_hands.py b/src/rom24/spells/spell_burning_hands.py similarity index 100% rename from src/spells/spell_burning_hands.py rename to src/rom24/spells/spell_burning_hands.py diff --git a/src/spells/spell_call_lightning.py b/src/rom24/spells/spell_call_lightning.py similarity index 100% rename from src/spells/spell_call_lightning.py rename to src/rom24/spells/spell_call_lightning.py diff --git a/src/spells/spell_calm.py b/src/rom24/spells/spell_calm.py similarity index 100% rename from src/spells/spell_calm.py rename to src/rom24/spells/spell_calm.py diff --git a/src/spells/spell_cancellation.py b/src/rom24/spells/spell_cancellation.py similarity index 100% rename from src/spells/spell_cancellation.py rename to src/rom24/spells/spell_cancellation.py diff --git a/src/spells/spell_cause_critical.py b/src/rom24/spells/spell_cause_critical.py similarity index 100% rename from src/spells/spell_cause_critical.py rename to src/rom24/spells/spell_cause_critical.py diff --git a/src/spells/spell_cause_light.py b/src/rom24/spells/spell_cause_light.py similarity index 100% rename from src/spells/spell_cause_light.py rename to src/rom24/spells/spell_cause_light.py diff --git a/src/spells/spell_cause_serious.py b/src/rom24/spells/spell_cause_serious.py similarity index 100% rename from src/spells/spell_cause_serious.py rename to src/rom24/spells/spell_cause_serious.py diff --git a/src/spells/spell_chain_lightning.py b/src/rom24/spells/spell_chain_lightning.py similarity index 100% rename from src/spells/spell_chain_lightning.py rename to src/rom24/spells/spell_chain_lightning.py diff --git a/src/spells/spell_change_sex.py b/src/rom24/spells/spell_change_sex.py similarity index 100% rename from src/spells/spell_change_sex.py rename to src/rom24/spells/spell_change_sex.py diff --git a/src/spells/spell_charm_person.py b/src/rom24/spells/spell_charm_person.py similarity index 100% rename from src/spells/spell_charm_person.py rename to src/rom24/spells/spell_charm_person.py diff --git a/src/spells/spell_chill_touch.py b/src/rom24/spells/spell_chill_touch.py similarity index 100% rename from src/spells/spell_chill_touch.py rename to src/rom24/spells/spell_chill_touch.py diff --git a/src/spells/spell_colour_spray.py b/src/rom24/spells/spell_colour_spray.py similarity index 100% rename from src/spells/spell_colour_spray.py rename to src/rom24/spells/spell_colour_spray.py diff --git a/src/spells/spell_continual_light.py b/src/rom24/spells/spell_continual_light.py similarity index 100% rename from src/spells/spell_continual_light.py rename to src/rom24/spells/spell_continual_light.py diff --git a/src/spells/spell_control_weather.py b/src/rom24/spells/spell_control_weather.py similarity index 100% rename from src/spells/spell_control_weather.py rename to src/rom24/spells/spell_control_weather.py diff --git a/src/spells/spell_create_food.py b/src/rom24/spells/spell_create_food.py similarity index 100% rename from src/spells/spell_create_food.py rename to src/rom24/spells/spell_create_food.py diff --git a/src/spells/spell_create_rose.py b/src/rom24/spells/spell_create_rose.py similarity index 100% rename from src/spells/spell_create_rose.py rename to src/rom24/spells/spell_create_rose.py diff --git a/src/spells/spell_create_spring.py b/src/rom24/spells/spell_create_spring.py similarity index 100% rename from src/spells/spell_create_spring.py rename to src/rom24/spells/spell_create_spring.py diff --git a/src/spells/spell_create_water.py b/src/rom24/spells/spell_create_water.py similarity index 100% rename from src/spells/spell_create_water.py rename to src/rom24/spells/spell_create_water.py diff --git a/src/spells/spell_cure_blindness.py b/src/rom24/spells/spell_cure_blindness.py similarity index 100% rename from src/spells/spell_cure_blindness.py rename to src/rom24/spells/spell_cure_blindness.py diff --git a/src/spells/spell_cure_critical.py b/src/rom24/spells/spell_cure_critical.py similarity index 100% rename from src/spells/spell_cure_critical.py rename to src/rom24/spells/spell_cure_critical.py diff --git a/src/spells/spell_cure_disease.py b/src/rom24/spells/spell_cure_disease.py similarity index 100% rename from src/spells/spell_cure_disease.py rename to src/rom24/spells/spell_cure_disease.py diff --git a/src/spells/spell_cure_light.py b/src/rom24/spells/spell_cure_light.py similarity index 100% rename from src/spells/spell_cure_light.py rename to src/rom24/spells/spell_cure_light.py diff --git a/src/spells/spell_cure_poison.py b/src/rom24/spells/spell_cure_poison.py similarity index 100% rename from src/spells/spell_cure_poison.py rename to src/rom24/spells/spell_cure_poison.py diff --git a/src/spells/spell_cure_serious.py b/src/rom24/spells/spell_cure_serious.py similarity index 100% rename from src/spells/spell_cure_serious.py rename to src/rom24/spells/spell_cure_serious.py diff --git a/src/spells/spell_curse.py b/src/rom24/spells/spell_curse.py similarity index 100% rename from src/spells/spell_curse.py rename to src/rom24/spells/spell_curse.py diff --git a/src/spells/spell_demonfire.py b/src/rom24/spells/spell_demonfire.py similarity index 100% rename from src/spells/spell_demonfire.py rename to src/rom24/spells/spell_demonfire.py diff --git a/src/spells/spell_detect_evil.py b/src/rom24/spells/spell_detect_evil.py similarity index 100% rename from src/spells/spell_detect_evil.py rename to src/rom24/spells/spell_detect_evil.py diff --git a/src/spells/spell_detect_good.py b/src/rom24/spells/spell_detect_good.py similarity index 100% rename from src/spells/spell_detect_good.py rename to src/rom24/spells/spell_detect_good.py diff --git a/src/spells/spell_detect_hidden.py b/src/rom24/spells/spell_detect_hidden.py similarity index 100% rename from src/spells/spell_detect_hidden.py rename to src/rom24/spells/spell_detect_hidden.py diff --git a/src/spells/spell_detect_invis.py b/src/rom24/spells/spell_detect_invis.py similarity index 100% rename from src/spells/spell_detect_invis.py rename to src/rom24/spells/spell_detect_invis.py diff --git a/src/spells/spell_detect_magic.py b/src/rom24/spells/spell_detect_magic.py similarity index 100% rename from src/spells/spell_detect_magic.py rename to src/rom24/spells/spell_detect_magic.py diff --git a/src/spells/spell_detect_poison.py b/src/rom24/spells/spell_detect_poison.py similarity index 100% rename from src/spells/spell_detect_poison.py rename to src/rom24/spells/spell_detect_poison.py diff --git a/src/spells/spell_dispel_evil.py b/src/rom24/spells/spell_dispel_evil.py similarity index 100% rename from src/spells/spell_dispel_evil.py rename to src/rom24/spells/spell_dispel_evil.py diff --git a/src/spells/spell_dispel_good.py b/src/rom24/spells/spell_dispel_good.py similarity index 100% rename from src/spells/spell_dispel_good.py rename to src/rom24/spells/spell_dispel_good.py diff --git a/src/spells/spell_dispel_magic.py b/src/rom24/spells/spell_dispel_magic.py similarity index 100% rename from src/spells/spell_dispel_magic.py rename to src/rom24/spells/spell_dispel_magic.py diff --git a/src/spells/spell_earthquake.py b/src/rom24/spells/spell_earthquake.py similarity index 100% rename from src/spells/spell_earthquake.py rename to src/rom24/spells/spell_earthquake.py diff --git a/src/spells/spell_enchant_armor.py b/src/rom24/spells/spell_enchant_armor.py similarity index 100% rename from src/spells/spell_enchant_armor.py rename to src/rom24/spells/spell_enchant_armor.py diff --git a/src/spells/spell_enchant_weapon.py b/src/rom24/spells/spell_enchant_weapon.py similarity index 100% rename from src/spells/spell_enchant_weapon.py rename to src/rom24/spells/spell_enchant_weapon.py diff --git a/src/spells/spell_energy_drain.py b/src/rom24/spells/spell_energy_drain.py similarity index 100% rename from src/spells/spell_energy_drain.py rename to src/rom24/spells/spell_energy_drain.py diff --git a/src/spells/spell_faerie_fire.py b/src/rom24/spells/spell_faerie_fire.py similarity index 100% rename from src/spells/spell_faerie_fire.py rename to src/rom24/spells/spell_faerie_fire.py diff --git a/src/spells/spell_faerie_fog.py b/src/rom24/spells/spell_faerie_fog.py similarity index 100% rename from src/spells/spell_faerie_fog.py rename to src/rom24/spells/spell_faerie_fog.py diff --git a/src/spells/spell_farsight.py b/src/rom24/spells/spell_farsight.py similarity index 100% rename from src/spells/spell_farsight.py rename to src/rom24/spells/spell_farsight.py diff --git a/src/spells/spell_fire_breath.py b/src/rom24/spells/spell_fire_breath.py similarity index 100% rename from src/spells/spell_fire_breath.py rename to src/rom24/spells/spell_fire_breath.py diff --git a/src/spells/spell_fireball.py b/src/rom24/spells/spell_fireball.py similarity index 100% rename from src/spells/spell_fireball.py rename to src/rom24/spells/spell_fireball.py diff --git a/src/spells/spell_fireproof.py b/src/rom24/spells/spell_fireproof.py similarity index 100% rename from src/spells/spell_fireproof.py rename to src/rom24/spells/spell_fireproof.py diff --git a/src/spells/spell_flamestrike.py b/src/rom24/spells/spell_flamestrike.py similarity index 100% rename from src/spells/spell_flamestrike.py rename to src/rom24/spells/spell_flamestrike.py diff --git a/src/spells/spell_floating_disc.py b/src/rom24/spells/spell_floating_disc.py similarity index 100% rename from src/spells/spell_floating_disc.py rename to src/rom24/spells/spell_floating_disc.py diff --git a/src/spells/spell_fly.py b/src/rom24/spells/spell_fly.py similarity index 100% rename from src/spells/spell_fly.py rename to src/rom24/spells/spell_fly.py diff --git a/src/spells/spell_frenzy.py b/src/rom24/spells/spell_frenzy.py similarity index 100% rename from src/spells/spell_frenzy.py rename to src/rom24/spells/spell_frenzy.py diff --git a/src/spells/spell_frost_breath.py b/src/rom24/spells/spell_frost_breath.py similarity index 100% rename from src/spells/spell_frost_breath.py rename to src/rom24/spells/spell_frost_breath.py diff --git a/src/spells/spell_gas_breath.py b/src/rom24/spells/spell_gas_breath.py similarity index 100% rename from src/spells/spell_gas_breath.py rename to src/rom24/spells/spell_gas_breath.py diff --git a/src/spells/spell_gate.py b/src/rom24/spells/spell_gate.py similarity index 100% rename from src/spells/spell_gate.py rename to src/rom24/spells/spell_gate.py diff --git a/src/spells/spell_general_purpose.py b/src/rom24/spells/spell_general_purpose.py similarity index 100% rename from src/spells/spell_general_purpose.py rename to src/rom24/spells/spell_general_purpose.py diff --git a/src/spells/spell_giant_strength.py b/src/rom24/spells/spell_giant_strength.py similarity index 100% rename from src/spells/spell_giant_strength.py rename to src/rom24/spells/spell_giant_strength.py diff --git a/src/spells/spell_harm.py b/src/rom24/spells/spell_harm.py similarity index 100% rename from src/spells/spell_harm.py rename to src/rom24/spells/spell_harm.py diff --git a/src/spells/spell_haste.py b/src/rom24/spells/spell_haste.py similarity index 100% rename from src/spells/spell_haste.py rename to src/rom24/spells/spell_haste.py diff --git a/src/spells/spell_heal.py b/src/rom24/spells/spell_heal.py similarity index 100% rename from src/spells/spell_heal.py rename to src/rom24/spells/spell_heal.py diff --git a/src/spells/spell_heat_metal.py b/src/rom24/spells/spell_heat_metal.py similarity index 100% rename from src/spells/spell_heat_metal.py rename to src/rom24/spells/spell_heat_metal.py diff --git a/src/spells/spell_high_explosive.py b/src/rom24/spells/spell_high_explosive.py similarity index 100% rename from src/spells/spell_high_explosive.py rename to src/rom24/spells/spell_high_explosive.py diff --git a/src/spells/spell_holy_word.py b/src/rom24/spells/spell_holy_word.py similarity index 100% rename from src/spells/spell_holy_word.py rename to src/rom24/spells/spell_holy_word.py diff --git a/src/spells/spell_identify.py b/src/rom24/spells/spell_identify.py similarity index 100% rename from src/spells/spell_identify.py rename to src/rom24/spells/spell_identify.py diff --git a/src/spells/spell_infravision.py b/src/rom24/spells/spell_infravision.py similarity index 100% rename from src/spells/spell_infravision.py rename to src/rom24/spells/spell_infravision.py diff --git a/src/spells/spell_invis.py b/src/rom24/spells/spell_invis.py similarity index 100% rename from src/spells/spell_invis.py rename to src/rom24/spells/spell_invis.py diff --git a/src/spells/spell_know_alignment.py b/src/rom24/spells/spell_know_alignment.py similarity index 100% rename from src/spells/spell_know_alignment.py rename to src/rom24/spells/spell_know_alignment.py diff --git a/src/spells/spell_lightning_bolt.py b/src/rom24/spells/spell_lightning_bolt.py similarity index 100% rename from src/spells/spell_lightning_bolt.py rename to src/rom24/spells/spell_lightning_bolt.py diff --git a/src/spells/spell_lightning_breath.py b/src/rom24/spells/spell_lightning_breath.py similarity index 100% rename from src/spells/spell_lightning_breath.py rename to src/rom24/spells/spell_lightning_breath.py diff --git a/src/spells/spell_locate_object.py b/src/rom24/spells/spell_locate_object.py similarity index 100% rename from src/spells/spell_locate_object.py rename to src/rom24/spells/spell_locate_object.py diff --git a/src/spells/spell_magic_missile.py b/src/rom24/spells/spell_magic_missile.py similarity index 100% rename from src/spells/spell_magic_missile.py rename to src/rom24/spells/spell_magic_missile.py diff --git a/src/spells/spell_mass_healing.py b/src/rom24/spells/spell_mass_healing.py similarity index 100% rename from src/spells/spell_mass_healing.py rename to src/rom24/spells/spell_mass_healing.py diff --git a/src/spells/spell_mass_invis.py b/src/rom24/spells/spell_mass_invis.py similarity index 100% rename from src/spells/spell_mass_invis.py rename to src/rom24/spells/spell_mass_invis.py diff --git a/src/spells/spell_nexus.py b/src/rom24/spells/spell_nexus.py similarity index 100% rename from src/spells/spell_nexus.py rename to src/rom24/spells/spell_nexus.py diff --git a/src/spells/spell_pass_door.py b/src/rom24/spells/spell_pass_door.py similarity index 100% rename from src/spells/spell_pass_door.py rename to src/rom24/spells/spell_pass_door.py diff --git a/src/spells/spell_plague.py b/src/rom24/spells/spell_plague.py similarity index 100% rename from src/spells/spell_plague.py rename to src/rom24/spells/spell_plague.py diff --git a/src/spells/spell_poison.py b/src/rom24/spells/spell_poison.py similarity index 100% rename from src/spells/spell_poison.py rename to src/rom24/spells/spell_poison.py diff --git a/src/spells/spell_portal.py b/src/rom24/spells/spell_portal.py similarity index 100% rename from src/spells/spell_portal.py rename to src/rom24/spells/spell_portal.py diff --git a/src/spells/spell_protection_evil.py b/src/rom24/spells/spell_protection_evil.py similarity index 100% rename from src/spells/spell_protection_evil.py rename to src/rom24/spells/spell_protection_evil.py diff --git a/src/spells/spell_protection_good.py b/src/rom24/spells/spell_protection_good.py similarity index 100% rename from src/spells/spell_protection_good.py rename to src/rom24/spells/spell_protection_good.py diff --git a/src/spells/spell_ray_of_truth.py b/src/rom24/spells/spell_ray_of_truth.py similarity index 100% rename from src/spells/spell_ray_of_truth.py rename to src/rom24/spells/spell_ray_of_truth.py diff --git a/src/spells/spell_recharge.py b/src/rom24/spells/spell_recharge.py similarity index 100% rename from src/spells/spell_recharge.py rename to src/rom24/spells/spell_recharge.py diff --git a/src/spells/spell_refresh.py b/src/rom24/spells/spell_refresh.py similarity index 100% rename from src/spells/spell_refresh.py rename to src/rom24/spells/spell_refresh.py diff --git a/src/spells/spell_remove_curse.py b/src/rom24/spells/spell_remove_curse.py similarity index 100% rename from src/spells/spell_remove_curse.py rename to src/rom24/spells/spell_remove_curse.py diff --git a/src/spells/spell_sanctuary.py b/src/rom24/spells/spell_sanctuary.py similarity index 100% rename from src/spells/spell_sanctuary.py rename to src/rom24/spells/spell_sanctuary.py diff --git a/src/spells/spell_shield.py b/src/rom24/spells/spell_shield.py similarity index 100% rename from src/spells/spell_shield.py rename to src/rom24/spells/spell_shield.py diff --git a/src/spells/spell_shocking_grasp.py b/src/rom24/spells/spell_shocking_grasp.py similarity index 100% rename from src/spells/spell_shocking_grasp.py rename to src/rom24/spells/spell_shocking_grasp.py diff --git a/src/spells/spell_sleep.py b/src/rom24/spells/spell_sleep.py similarity index 100% rename from src/spells/spell_sleep.py rename to src/rom24/spells/spell_sleep.py diff --git a/src/spells/spell_slow.py b/src/rom24/spells/spell_slow.py similarity index 100% rename from src/spells/spell_slow.py rename to src/rom24/spells/spell_slow.py diff --git a/src/spells/spell_stone_skin.py b/src/rom24/spells/spell_stone_skin.py similarity index 100% rename from src/spells/spell_stone_skin.py rename to src/rom24/spells/spell_stone_skin.py diff --git a/src/spells/spell_summon.py b/src/rom24/spells/spell_summon.py similarity index 100% rename from src/spells/spell_summon.py rename to src/rom24/spells/spell_summon.py diff --git a/src/spells/spell_teleport.py b/src/rom24/spells/spell_teleport.py similarity index 100% rename from src/spells/spell_teleport.py rename to src/rom24/spells/spell_teleport.py diff --git a/src/spells/spell_ventriloquate.py b/src/rom24/spells/spell_ventriloquate.py similarity index 100% rename from src/spells/spell_ventriloquate.py rename to src/rom24/spells/spell_ventriloquate.py diff --git a/src/spells/spell_weaken.py b/src/rom24/spells/spell_weaken.py similarity index 100% rename from src/spells/spell_weaken.py rename to src/rom24/spells/spell_weaken.py diff --git a/src/spells/spell_word_of_recall.py b/src/rom24/spells/spell_word_of_recall.py similarity index 100% rename from src/spells/spell_word_of_recall.py rename to src/rom24/spells/spell_word_of_recall.py diff --git a/src/state_checks.py b/src/rom24/state_checks.py similarity index 100% rename from src/state_checks.py rename to src/rom24/state_checks.py diff --git a/src/sys_utils.py b/src/rom24/sys_utils.py similarity index 100% rename from src/sys_utils.py rename to src/rom24/sys_utils.py diff --git a/src/tables.py b/src/rom24/tables.py similarity index 100% rename from src/tables.py rename to src/rom24/tables.py diff --git a/src/type_bypass.py b/src/rom24/type_bypass.py similarity index 100% rename from src/type_bypass.py rename to src/rom24/type_bypass.py diff --git a/src/uait/legacy_loads.py b/src/rom24/uait/legacy_loads.py similarity index 100% rename from src/uait/legacy_loads.py rename to src/rom24/uait/legacy_loads.py diff --git a/src/update.py b/src/rom24/update.py similarity index 100% rename from src/update.py rename to src/rom24/update.py diff --git a/src/world_classes.py b/src/rom24/world_classes.py similarity index 100% rename from src/world_classes.py rename to src/rom24/world_classes.py From 78179132f9ce28062e11908d37f39cb02bdc56da Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Tue, 30 Nov 2021 23:27:49 -0800 Subject: [PATCH 07/40] Updated so you can run it from src/rom24/pyom.py instead now that updated package directory exists --- archive/src/merc.h | 6 +++--- area/startup | 2 +- src/rom24/affects.py | 2 +- src/rom24/settings.py | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/archive/src/merc.h b/archive/src/merc.h index b4ed230..b20e342 100644 --- a/archive/src/merc.h +++ b/archive/src/merc.h @@ -2035,9 +2035,9 @@ char * crypt args( ( const char *key, const char *salt ) ); #endif #if defined(unix) -#define PLAYER_DIR "../player/" /* Player files */ -#define GOD_DIR "../gods/" /* list of gods */ -#define TEMP_FILE "../player/romtmp" +#define PLAYER_DIR "../../player/" /* Player files */ +#define GOD_DIR "../../gods/" /* list of gods */ +#define TEMP_FILE "../../player/romtmp" #define NULL_FILE "/dev/null" /* To reserve one stream */ #endif diff --git a/area/startup b/area/startup index 3bf0e48..fef8214 100644 --- a/area/startup +++ b/area/startup @@ -7,7 +7,7 @@ set port = 9000 if ( "$1" != "" ) set port="$1" # Change to area directory. -cd ../area +cd ../../area # Set limits. if ( -e shutdown.txt ) rm -f shutdown.txt diff --git a/src/rom24/affects.py b/src/rom24/affects.py index 60dcc15..7ff89fa 100644 --- a/src/rom24/affects.py +++ b/src/rom24/affects.py @@ -35,7 +35,7 @@ import json import logging -logger = logging.getLogger() +logger = logging.getLogger(__name__) import bit import const diff --git a/src/rom24/settings.py b/src/rom24/settings.py index a9d7ea7..49f1b25 100644 --- a/src/rom24/settings.py +++ b/src/rom24/settings.py @@ -23,13 +23,13 @@ PKL_EXTN = '.pickle' #Folders -LEGACY_AREA_DIR = os.path.join('..', 'area') -LEGACY_PLAYER_DIR = os.path.join('..', 'player') +LEGACY_AREA_DIR = os.path.join('../..', 'area') +LEGACY_PLAYER_DIR = os.path.join('../..', 'player') SOCIAL_DIR = os.path.join(LEGACY_AREA_DIR, 'socials') HELP_DIR = os.path.join(LEGACY_AREA_DIR, 'help_files') #New structure -DATA_DIR = os.path.join('..', 'data') +DATA_DIR = os.path.join('../..', 'data') WORLD_DIR = os.path.join(DATA_DIR, 'world') PLAYER_DIR = os.path.join(DATA_DIR, 'players') From 57dbbd777340dbfc3669e9d4cd087db9195b9c6a Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Wed, 1 Dec 2021 14:17:16 -0800 Subject: [PATCH 08/40] Functional libary with pip install --- requirements.txt | 3 +- setup.py | 28 ++ {area => src/area}/air.are | 0 {area => src/area}/arachnos.are | 0 {area => src/area}/area.lst | 0 {area => src/area}/astral.are | 0 {area => src/area}/canyon.are | 0 {area => src/area}/catacomb.are | 0 {area => src/area}/chapel.are | 0 {area => src/area}/daycare.are | 0 {area => src/area}/draconia.are | 0 {area => src/area}/dream.are | 0 {area => src/area}/drow.are | 0 {area => src/area}/dwarven.are | 0 {area => src/area}/dylan.are | 0 {area => src/area}/eastern.are | 0 {area => src/area}/galaxy.are | 0 {area => src/area}/gnome.are | 0 {area => src/area}/grave.are | 0 {area => src/area}/group.are | 0 {area => src/area}/grove.are | 0 {area => src/area}/haon.are | 0 {area => src/area}/help.are | 0 {area => src/area}/hitower.are | 0 {area => src/area}/hood.are | 0 {area => src/area}/immort.are | 0 {area => src/area}/limbo.are | 0 {area => src/area}/mahntor.are | 0 {area => src/area}/marsh.are | 0 {area => src/area}/mega1.are | 0 {area => src/area}/midennir.are | 0 {area => src/area}/midgaard.are | 0 {area => src/area}/mirror.are | 0 {area => src/area}/mobfact.are | 0 {area => src/area}/moria.are | 0 {area => src/area}/music.txt | 0 {area => src/area}/newthalos.are | 0 {area => src/area}/nirvana.are | 0 {area => src/area}/ofcol.are | 0 {area => src/area}/ofcol2.are | 0 {area => src/area}/olympus.are | 0 {area => src/area}/plains.are | 0 {area => src/area}/proto.are | 0 {area => src/area}/pyramid.are | 0 {area => src/area}/quifael.are | 0 {area => src/area}/redferne.are | 0 {area => src/area}/rom.are | 0 {area => src/area}/school.are | 0 {area => src/area}/sewer.are | 0 {area => src/area}/shire.are | 0 {area => src/area}/smurf.are | 0 {area => src/area}/social.are | 0 {area => src/area}/startup | 0 {area => src/area}/thalos.are | 0 {area => src/area}/tohell.are | 0 {area => src/area}/trollden.are | 0 {area => src/area}/valley.are | 0 {area => src/area}/wyvern.are | 0 src/rom24.egg-info/PKG-INFO | 11 + src/rom24.egg-info/SOURCES.txt | 377 +++++++++++++++++++++ src/rom24.egg-info/dependency_links.txt | 1 + src/rom24.egg-info/entry_points.txt | 3 + src/rom24.egg-info/requires.txt | 2 + src/rom24.egg-info/top_level.txt | 1 + src/rom24/__init__.py | 126 +++++++ src/rom24/affects.py | 44 +-- src/rom24/auth.py | 2 +- src/rom24/bit.py | 4 +- src/rom24/comm.py | 69 ++-- src/rom24/commands/__init__.py | 33 -- src/rom24/commands/do_advance.py | 8 +- src/rom24/commands/do_affects.py | 4 +- src/rom24/commands/do_afk.py | 4 +- src/rom24/commands/do_alias.py | 6 +- src/rom24/commands/do_answer.py | 10 +- src/rom24/commands/do_apickle.py | 8 +- src/rom24/commands/do_areas.py | 6 +- src/rom24/commands/do_at.py | 8 +- src/rom24/commands/do_auction.py | 10 +- src/rom24/commands/do_authenticator.py | 8 +- src/rom24/commands/do_autoassist.py | 4 +- src/rom24/commands/do_autoexit.py | 4 +- src/rom24/commands/do_autogold.py | 6 +- src/rom24/commands/do_autolist.py | 4 +- src/rom24/commands/do_autoloot.py | 4 +- src/rom24/commands/do_autosac.py | 4 +- src/rom24/commands/do_autosplit.py | 4 +- src/rom24/commands/do_backstab.py | 18 +- src/rom24/commands/do_bamfin.py | 4 +- src/rom24/commands/do_bamfout.py | 4 +- src/rom24/commands/do_bash.py | 18 +- src/rom24/commands/do_berserk.py | 16 +- src/rom24/commands/do_brandish.py | 16 +- src/rom24/commands/do_brief.py | 4 +- src/rom24/commands/do_bug.py | 8 +- src/rom24/commands/do_buy.py | 22 +- src/rom24/commands/do_cast.py | 16 +- src/rom24/commands/do_channels.py | 6 +- src/rom24/commands/do_clantalk.py | 8 +- src/rom24/commands/do_clone.py | 14 +- src/rom24/commands/do_close.py | 14 +- src/rom24/commands/do_combine.py | 4 +- src/rom24/commands/do_commands.py | 4 +- src/rom24/commands/do_compact.py | 4 +- src/rom24/commands/do_compare.py | 8 +- src/rom24/commands/do_consider.py | 10 +- src/rom24/commands/do_count.py | 8 +- src/rom24/commands/do_deaf.py | 4 +- src/rom24/commands/do_debug.py | 10 +- src/rom24/commands/do_delete.py | 10 +- src/rom24/commands/do_deny.py | 12 +- src/rom24/commands/do_description.py | 4 +- src/rom24/commands/do_dirt.py | 18 +- src/rom24/commands/do_disarm.py | 16 +- src/rom24/commands/do_disconnect.py | 10 +- src/rom24/commands/do_down.py | 6 +- src/rom24/commands/do_drink.py | 12 +- src/rom24/commands/do_drop.py | 10 +- src/rom24/commands/do_dump.py | 4 +- src/rom24/commands/do_east.py | 6 +- src/rom24/commands/do_eat.py | 12 +- src/rom24/commands/do_echo.py | 6 +- src/rom24/commands/do_emote.py | 6 +- src/rom24/commands/do_enter.py | 10 +- src/rom24/commands/do_envenom.py | 18 +- src/rom24/commands/do_equipment.py | 6 +- src/rom24/commands/do_examine.py | 6 +- src/rom24/commands/do_exits.py | 6 +- src/rom24/commands/do_fill.py | 12 +- src/rom24/commands/do_flags.py | 8 +- src/rom24/commands/do_flee.py | 18 +- src/rom24/commands/do_follow.py | 10 +- src/rom24/commands/do_force.py | 10 +- src/rom24/commands/do_freeze.py | 10 +- src/rom24/commands/do_freset.py | 6 +- src/rom24/commands/do_gain.py | 14 +- src/rom24/commands/do_gdstate.py | 36 -- src/rom24/commands/do_get.py | 12 +- src/rom24/commands/do_give.py | 10 +- src/rom24/commands/do_gossip.py | 10 +- src/rom24/commands/do_goto.py | 12 +- src/rom24/commands/do_grats.py | 10 +- src/rom24/commands/do_group.py | 12 +- src/rom24/commands/do_groups.py | 6 +- src/rom24/commands/do_gtell.py | 8 +- src/rom24/commands/do_guild.py | 10 +- src/rom24/commands/do_heal.py | 14 +- src/rom24/commands/do_help.py | 6 +- src/rom24/commands/do_hide.py | 8 +- src/rom24/commands/do_holylight.py | 4 +- src/rom24/commands/do_immtalk.py | 10 +- src/rom24/commands/do_incognito.py | 8 +- src/rom24/commands/do_inventory.py | 6 +- src/rom24/commands/do_invis.py | 8 +- src/rom24/commands/do_kick.py | 14 +- src/rom24/commands/do_kill.py | 12 +- src/rom24/commands/do_list.py | 14 +- src/rom24/commands/do_load.py | 6 +- src/rom24/commands/do_lock.py | 12 +- src/rom24/commands/do_log.py | 8 +- src/rom24/commands/do_look.py | 19 +- src/rom24/commands/do_memory.py | 4 +- src/rom24/commands/do_mfind.py | 8 +- src/rom24/commands/do_mload.py | 12 +- src/rom24/commands/do_mset.py | 12 +- src/rom24/commands/do_mstat.py | 12 +- src/rom24/commands/do_murder.py | 12 +- src/rom24/commands/do_music.py | 12 +- src/rom24/commands/do_mwhere.py | 10 +- src/rom24/commands/do_newlock.py | 8 +- src/rom24/commands/do_nochannels.py | 10 +- src/rom24/commands/do_noemote.py | 10 +- src/rom24/commands/do_nofollow.py | 6 +- src/rom24/commands/do_noloot.py | 4 +- src/rom24/commands/do_north.py | 6 +- src/rom24/commands/do_noshout.py | 10 +- src/rom24/commands/do_nosummon.py | 6 +- src/rom24/commands/do_notell.py | 10 +- src/rom24/commands/do_ofind.py | 8 +- src/rom24/commands/do_oload.py | 12 +- src/rom24/commands/do_omni.py | 4 +- src/rom24/commands/do_open.py | 12 +- src/rom24/commands/do_order.py | 10 +- src/rom24/commands/do_oset.py | 6 +- src/rom24/commands/do_ostat.py | 8 +- src/rom24/commands/do_outfit.py | 10 +- src/rom24/commands/do_owhere.py | 10 +- src/rom24/commands/do_pardon.py | 6 +- src/rom24/commands/do_password.py | 10 +- src/rom24/commands/do_peace.py | 10 +- src/rom24/commands/do_pecho.py | 6 +- src/rom24/commands/do_pick.py | 22 +- src/rom24/commands/do_pmote.py | 10 +- src/rom24/commands/do_pose.py | 6 +- src/rom24/commands/do_pour.py | 10 +- src/rom24/commands/do_practice.py | 12 +- src/rom24/commands/do_prefix.py | 4 +- src/rom24/commands/do_prompt.py | 4 +- src/rom24/commands/do_protect.py | 8 +- src/rom24/commands/do_purge.py | 12 +- src/rom24/commands/do_put.py | 10 +- src/rom24/commands/do_quaff.py | 10 +- src/rom24/commands/do_question.py | 12 +- src/rom24/commands/do_quiet.py | 4 +- src/rom24/commands/do_quit.py | 10 +- src/rom24/commands/do_quote.py | 12 +- src/rom24/commands/do_reboot.py | 8 +- src/rom24/commands/do_recall.py | 18 +- src/rom24/commands/do_recho.py | 6 +- src/rom24/commands/do_recite.py | 14 +- src/rom24/commands/do_reload.py | 6 +- src/rom24/commands/do_remove.py | 6 +- src/rom24/commands/do_rent.py | 4 +- src/rom24/commands/do_replay.py | 4 +- src/rom24/commands/do_reply.py | 8 +- src/rom24/commands/do_report.py | 6 +- src/rom24/commands/do_rescue.py | 18 +- src/rom24/commands/do_rest.py | 8 +- src/rom24/commands/do_restore.py | 10 +- src/rom24/commands/do_return.py | 6 +- src/rom24/commands/do_rstat.py | 10 +- src/rom24/commands/do_sacrifice.py | 8 +- src/rom24/commands/do_save.py | 6 +- src/rom24/commands/do_say.py | 8 +- src/rom24/commands/do_score.py | 6 +- src/rom24/commands/do_scroll.py | 6 +- src/rom24/commands/do_sell.py | 12 +- src/rom24/commands/do_set.py | 6 +- src/rom24/commands/do_shout.py | 12 +- src/rom24/commands/do_show.py | 4 +- src/rom24/commands/do_shutdown.py | 8 +- src/rom24/commands/do_sit.py | 8 +- src/rom24/commands/do_skills.py | 8 +- src/rom24/commands/do_slay.py | 10 +- src/rom24/commands/do_sleep.py | 8 +- src/rom24/commands/do_slookup.py | 10 +- src/rom24/commands/do_smote.py | 6 +- src/rom24/commands/do_sneak.py | 10 +- src/rom24/commands/do_snoop.py | 10 +- src/rom24/commands/do_socials.py | 4 +- src/rom24/commands/do_sockets.py | 6 +- src/rom24/commands/do_south.py | 6 +- src/rom24/commands/do_spells.py | 8 +- src/rom24/commands/do_split.py | 10 +- src/rom24/commands/do_sset.py | 10 +- src/rom24/commands/do_stand.py | 8 +- src/rom24/commands/do_stat.py | 6 +- src/rom24/commands/do_steal.py | 20 +- src/rom24/commands/do_string.py | 12 +- src/rom24/commands/do_switch.py | 10 +- src/rom24/commands/do_tabledump.py | 6 +- src/rom24/commands/do_tableload.py | 6 +- src/rom24/commands/do_tell.py | 10 +- src/rom24/commands/do_term.py | 8 +- src/rom24/commands/do_time.py | 6 +- src/rom24/commands/do_title.py | 6 +- src/rom24/commands/do_train.py | 6 +- src/rom24/commands/do_transfer.py | 12 +- src/rom24/commands/do_trip.py | 18 +- src/rom24/commands/do_trust.py | 6 +- src/rom24/commands/do_typo.py | 8 +- src/rom24/commands/do_unalias.py | 6 +- src/rom24/commands/do_unlock.py | 12 +- src/rom24/commands/do_up.py | 6 +- src/rom24/commands/do_value.py | 10 +- src/rom24/commands/do_violate.py | 10 +- src/rom24/commands/do_visible.py | 4 +- src/rom24/commands/do_vnum.py | 6 +- src/rom24/commands/do_wake.py | 10 +- src/rom24/commands/do_wear.py | 8 +- src/rom24/commands/do_weather.py | 8 +- src/rom24/commands/do_west.py | 6 +- src/rom24/commands/do_where.py | 16 +- src/rom24/commands/do_who.py | 14 +- src/rom24/commands/do_whois.py | 12 +- src/rom24/commands/do_wimpy.py | 6 +- src/rom24/commands/do_wizhelp.py | 4 +- src/rom24/commands/do_wizlock.py | 8 +- src/rom24/commands/do_wiznet.py | 8 +- src/rom24/commands/do_worth.py | 4 +- src/rom24/commands/do_yell.py | 10 +- src/rom24/commands/do_zap.py | 16 +- src/rom24/commands/do_zecho.py | 6 +- src/rom24/const.py | 34 +- src/rom24/data_loader.py | 46 +-- src/rom24/database/read/read_tables.py | 4 +- src/rom24/database/tracker.py | 4 +- src/rom24/db.py | 69 +--- src/rom24/effects.py | 12 +- src/rom24/environment.py | 12 +- src/rom24/equipment.py | 2 +- src/rom24/fight.py | 72 ++-- src/rom24/game_utils.py | 6 +- src/rom24/handler_ch.py | 48 +-- src/rom24/handler_game.py | 50 +-- src/rom24/handler_item.py | 64 +--- src/rom24/handler_log.py | 40 +-- src/rom24/handler_magic.py | 46 +-- src/rom24/handler_npc.py | 56 +-- src/rom24/handler_pc.py | 33 +- src/rom24/handler_room.py | 52 +-- src/rom24/hotfix.py | 131 ++++--- src/rom24/immortal.py | 6 +- src/rom24/instance.py | 42 +-- src/rom24/interp.py | 34 +- src/rom24/inventory.py | 6 +- src/rom24/living.py | 86 ++--- src/rom24/magic.py | 32 -- src/rom24/merc.py | 36 +- src/rom24/miniboa/__init__.py | 2 +- src/rom24/miniboa/asyncio.py | 4 +- src/rom24/miniboa/telnet.py | 4 +- src/rom24/miniboa/terminal.py | 2 +- src/rom24/nanny.py | 62 +--- src/rom24/object_creator.py | 20 +- src/rom24/physical.py | 4 +- src/rom24/pyom.py | 67 +--- src/rom24/pyprogs.py | 6 +- src/rom24/save.py | 16 +- src/rom24/settings.py | 41 ++- src/rom24/shell.py | 2 +- src/rom24/shop_utils.py | 8 +- src/rom24/skills.py | 46 +-- src/rom24/special.py | 46 +-- src/rom24/spells/__init__.py | 33 -- src/rom24/spells/spell_acid_blast.py | 10 +- src/rom24/spells/spell_acid_breath.py | 14 +- src/rom24/spells/spell_armor.py | 8 +- src/rom24/spells/spell_bless.py | 10 +- src/rom24/spells/spell_blindness.py | 8 +- src/rom24/spells/spell_burning_hands.py | 8 +- src/rom24/spells/spell_call_lightning.py | 14 +- src/rom24/spells/spell_calm.py | 10 +- src/rom24/spells/spell_cancellation.py | 8 +- src/rom24/spells/spell_cause_critical.py | 8 +- src/rom24/spells/spell_cause_light.py | 8 +- src/rom24/spells/spell_cause_serious.py | 8 +- src/rom24/spells/spell_chain_lightning.py | 12 +- src/rom24/spells/spell_change_sex.py | 10 +- src/rom24/spells/spell_charm_person.py | 16 +- src/rom24/spells/spell_chill_touch.py | 10 +- src/rom24/spells/spell_colour_spray.py | 8 +- src/rom24/spells/spell_continual_light.py | 10 +- src/rom24/spells/spell_control_weather.py | 8 +- src/rom24/spells/spell_create_food.py | 8 +- src/rom24/spells/spell_create_rose.py | 8 +- src/rom24/spells/spell_create_spring.py | 8 +- src/rom24/spells/spell_create_water.py | 6 +- src/rom24/spells/spell_cure_blindness.py | 10 +- src/rom24/spells/spell_cure_critical.py | 8 +- src/rom24/spells/spell_cure_disease.py | 10 +- src/rom24/spells/spell_cure_light.py | 8 +- src/rom24/spells/spell_cure_poison.py | 10 +- src/rom24/spells/spell_cure_serious.py | 8 +- src/rom24/spells/spell_curse.py | 10 +- src/rom24/spells/spell_demonfire.py | 12 +- src/rom24/spells/spell_detect_evil.py | 6 +- src/rom24/spells/spell_detect_good.py | 6 +- src/rom24/spells/spell_detect_hidden.py | 6 +- src/rom24/spells/spell_detect_invis.py | 6 +- src/rom24/spells/spell_detect_magic.py | 6 +- src/rom24/spells/spell_detect_poison.py | 4 +- src/rom24/spells/spell_dispel_evil.py | 14 +- src/rom24/spells/spell_dispel_good.py | 14 +- src/rom24/spells/spell_dispel_magic.py | 10 +- src/rom24/spells/spell_earthquake.py | 12 +- src/rom24/spells/spell_enchant_armor.py | 8 +- src/rom24/spells/spell_enchant_weapon.py | 8 +- src/rom24/spells/spell_energy_drain.py | 12 +- src/rom24/spells/spell_faerie_fire.py | 6 +- src/rom24/spells/spell_faerie_fog.py | 10 +- src/rom24/spells/spell_farsight.py | 6 +- src/rom24/spells/spell_fire_breath.py | 14 +- src/rom24/spells/spell_fireball.py | 8 +- src/rom24/spells/spell_fireproof.py | 10 +- src/rom24/spells/spell_flamestrike.py | 10 +- src/rom24/spells/spell_floating_disc.py | 10 +- src/rom24/spells/spell_fly.py | 6 +- src/rom24/spells/spell_frenzy.py | 8 +- src/rom24/spells/spell_frost_breath.py | 14 +- src/rom24/spells/spell_gas_breath.py | 14 +- src/rom24/spells/spell_gate.py | 10 +- src/rom24/spells/spell_general_purpose.py | 8 +- src/rom24/spells/spell_giant_strength.py | 8 +- src/rom24/spells/spell_harm.py | 10 +- src/rom24/spells/spell_haste.py | 10 +- src/rom24/spells/spell_heal.py | 6 +- src/rom24/spells/spell_heat_metal.py | 12 +- src/rom24/spells/spell_high_explosive.py | 8 +- src/rom24/spells/spell_holy_word.py | 12 +- src/rom24/spells/spell_identify.py | 6 +- src/rom24/spells/spell_infravision.py | 6 +- src/rom24/spells/spell_invis.py | 8 +- src/rom24/spells/spell_know_alignment.py | 6 +- src/rom24/spells/spell_lightning_bolt.py | 8 +- src/rom24/spells/spell_lightning_breath.py | 14 +- src/rom24/spells/spell_locate_object.py | 10 +- src/rom24/spells/spell_magic_missile.py | 8 +- src/rom24/spells/spell_mass_healing.py | 6 +- src/rom24/spells/spell_mass_invis.py | 8 +- src/rom24/spells/spell_nexus.py | 12 +- src/rom24/spells/spell_pass_door.py | 8 +- src/rom24/spells/spell_plague.py | 8 +- src/rom24/spells/spell_poison.py | 10 +- src/rom24/spells/spell_portal.py | 12 +- src/rom24/spells/spell_protection_evil.py | 6 +- src/rom24/spells/spell_protection_good.py | 6 +- src/rom24/spells/spell_ray_of_truth.py | 14 +- src/rom24/spells/spell_recharge.py | 6 +- src/rom24/spells/spell_refresh.py | 4 +- src/rom24/spells/spell_remove_curse.py | 10 +- src/rom24/spells/spell_sanctuary.py | 6 +- src/rom24/spells/spell_shield.py | 8 +- src/rom24/spells/spell_shocking_grasp.py | 8 +- src/rom24/spells/spell_sleep.py | 10 +- src/rom24/spells/spell_slow.py | 10 +- src/rom24/spells/spell_stone_skin.py | 8 +- src/rom24/spells/spell_summon.py | 10 +- src/rom24/spells/spell_teleport.py | 12 +- src/rom24/spells/spell_ventriloquate.py | 8 +- src/rom24/spells/spell_weaken.py | 10 +- src/rom24/spells/spell_word_of_recall.py | 12 +- src/rom24/state_checks.py | 36 +- src/rom24/tables.py | 32 -- src/rom24/uait/legacy_loads.py | 29 +- src/rom24/update.py | 64 +--- src/rom24/world_classes.py | 14 +- 427 files changed, 2378 insertions(+), 2704 deletions(-) create mode 100644 setup.py rename {area => src/area}/air.are (100%) rename {area => src/area}/arachnos.are (100%) rename {area => src/area}/area.lst (100%) rename {area => src/area}/astral.are (100%) rename {area => src/area}/canyon.are (100%) rename {area => src/area}/catacomb.are (100%) rename {area => src/area}/chapel.are (100%) rename {area => src/area}/daycare.are (100%) rename {area => src/area}/draconia.are (100%) rename {area => src/area}/dream.are (100%) rename {area => src/area}/drow.are (100%) rename {area => src/area}/dwarven.are (100%) rename {area => src/area}/dylan.are (100%) rename {area => src/area}/eastern.are (100%) rename {area => src/area}/galaxy.are (100%) rename {area => src/area}/gnome.are (100%) rename {area => src/area}/grave.are (100%) rename {area => src/area}/group.are (100%) rename {area => src/area}/grove.are (100%) rename {area => src/area}/haon.are (100%) rename {area => src/area}/help.are (100%) rename {area => src/area}/hitower.are (100%) rename {area => src/area}/hood.are (100%) rename {area => src/area}/immort.are (100%) rename {area => src/area}/limbo.are (100%) rename {area => src/area}/mahntor.are (100%) rename {area => src/area}/marsh.are (100%) rename {area => src/area}/mega1.are (100%) rename {area => src/area}/midennir.are (100%) rename {area => src/area}/midgaard.are (100%) rename {area => src/area}/mirror.are (100%) rename {area => src/area}/mobfact.are (100%) rename {area => src/area}/moria.are (100%) rename {area => src/area}/music.txt (100%) rename {area => src/area}/newthalos.are (100%) rename {area => src/area}/nirvana.are (100%) rename {area => src/area}/ofcol.are (100%) rename {area => src/area}/ofcol2.are (100%) rename {area => src/area}/olympus.are (100%) rename {area => src/area}/plains.are (100%) rename {area => src/area}/proto.are (100%) rename {area => src/area}/pyramid.are (100%) rename {area => src/area}/quifael.are (100%) rename {area => src/area}/redferne.are (100%) rename {area => src/area}/rom.are (100%) rename {area => src/area}/school.are (100%) rename {area => src/area}/sewer.are (100%) rename {area => src/area}/shire.are (100%) rename {area => src/area}/smurf.are (100%) rename {area => src/area}/social.are (100%) rename {area => src/area}/startup (100%) rename {area => src/area}/thalos.are (100%) rename {area => src/area}/tohell.are (100%) rename {area => src/area}/trollden.are (100%) rename {area => src/area}/valley.are (100%) rename {area => src/area}/wyvern.are (100%) create mode 100644 src/rom24.egg-info/PKG-INFO create mode 100644 src/rom24.egg-info/SOURCES.txt create mode 100644 src/rom24.egg-info/dependency_links.txt create mode 100644 src/rom24.egg-info/entry_points.txt create mode 100644 src/rom24.egg-info/requires.txt create mode 100644 src/rom24.egg-info/top_level.txt create mode 100644 src/rom24/__init__.py delete mode 100644 src/rom24/commands/do_gdstate.py diff --git a/requirements.txt b/requirements.txt index 0b574b5..755a1d2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ -psutil \ No newline at end of file +psutil +ipdb diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..36e23fa --- /dev/null +++ b/setup.py @@ -0,0 +1,28 @@ +"""Setup configuration and dependencies for rom24.""" + +from setuptools import find_packages +from setuptools import setup + + +REQUIREMENTS = [requirement for requirement in open("requirements.txt").readlines()] + +COMMANDS = [ + "rom24=rom24.pyom:pyom", +] + +setup( + name="rom24", + version="0.0.0.alpha0", + author="Micheal Taylor", + author_email="bubthegreat@gmail.com", + url="", + include_package_data=True, + description="Attempt at properly packaging rom24 python.", + packages=find_packages('src'), + package_dir={ + '': 'src', + }, + python_requires=">=3.6.6", + entry_points={"console_scripts": COMMANDS}, + install_requires=REQUIREMENTS, +) diff --git a/area/air.are b/src/area/air.are similarity index 100% rename from area/air.are rename to src/area/air.are diff --git a/area/arachnos.are b/src/area/arachnos.are similarity index 100% rename from area/arachnos.are rename to src/area/arachnos.are diff --git a/area/area.lst b/src/area/area.lst similarity index 100% rename from area/area.lst rename to src/area/area.lst diff --git a/area/astral.are b/src/area/astral.are similarity index 100% rename from area/astral.are rename to src/area/astral.are diff --git a/area/canyon.are b/src/area/canyon.are similarity index 100% rename from area/canyon.are rename to src/area/canyon.are diff --git a/area/catacomb.are b/src/area/catacomb.are similarity index 100% rename from area/catacomb.are rename to src/area/catacomb.are diff --git a/area/chapel.are b/src/area/chapel.are similarity index 100% rename from area/chapel.are rename to src/area/chapel.are diff --git a/area/daycare.are b/src/area/daycare.are similarity index 100% rename from area/daycare.are rename to src/area/daycare.are diff --git a/area/draconia.are b/src/area/draconia.are similarity index 100% rename from area/draconia.are rename to src/area/draconia.are diff --git a/area/dream.are b/src/area/dream.are similarity index 100% rename from area/dream.are rename to src/area/dream.are diff --git a/area/drow.are b/src/area/drow.are similarity index 100% rename from area/drow.are rename to src/area/drow.are diff --git a/area/dwarven.are b/src/area/dwarven.are similarity index 100% rename from area/dwarven.are rename to src/area/dwarven.are diff --git a/area/dylan.are b/src/area/dylan.are similarity index 100% rename from area/dylan.are rename to src/area/dylan.are diff --git a/area/eastern.are b/src/area/eastern.are similarity index 100% rename from area/eastern.are rename to src/area/eastern.are diff --git a/area/galaxy.are b/src/area/galaxy.are similarity index 100% rename from area/galaxy.are rename to src/area/galaxy.are diff --git a/area/gnome.are b/src/area/gnome.are similarity index 100% rename from area/gnome.are rename to src/area/gnome.are diff --git a/area/grave.are b/src/area/grave.are similarity index 100% rename from area/grave.are rename to src/area/grave.are diff --git a/area/group.are b/src/area/group.are similarity index 100% rename from area/group.are rename to src/area/group.are diff --git a/area/grove.are b/src/area/grove.are similarity index 100% rename from area/grove.are rename to src/area/grove.are diff --git a/area/haon.are b/src/area/haon.are similarity index 100% rename from area/haon.are rename to src/area/haon.are diff --git a/area/help.are b/src/area/help.are similarity index 100% rename from area/help.are rename to src/area/help.are diff --git a/area/hitower.are b/src/area/hitower.are similarity index 100% rename from area/hitower.are rename to src/area/hitower.are diff --git a/area/hood.are b/src/area/hood.are similarity index 100% rename from area/hood.are rename to src/area/hood.are diff --git a/area/immort.are b/src/area/immort.are similarity index 100% rename from area/immort.are rename to src/area/immort.are diff --git a/area/limbo.are b/src/area/limbo.are similarity index 100% rename from area/limbo.are rename to src/area/limbo.are diff --git a/area/mahntor.are b/src/area/mahntor.are similarity index 100% rename from area/mahntor.are rename to src/area/mahntor.are diff --git a/area/marsh.are b/src/area/marsh.are similarity index 100% rename from area/marsh.are rename to src/area/marsh.are diff --git a/area/mega1.are b/src/area/mega1.are similarity index 100% rename from area/mega1.are rename to src/area/mega1.are diff --git a/area/midennir.are b/src/area/midennir.are similarity index 100% rename from area/midennir.are rename to src/area/midennir.are diff --git a/area/midgaard.are b/src/area/midgaard.are similarity index 100% rename from area/midgaard.are rename to src/area/midgaard.are diff --git a/area/mirror.are b/src/area/mirror.are similarity index 100% rename from area/mirror.are rename to src/area/mirror.are diff --git a/area/mobfact.are b/src/area/mobfact.are similarity index 100% rename from area/mobfact.are rename to src/area/mobfact.are diff --git a/area/moria.are b/src/area/moria.are similarity index 100% rename from area/moria.are rename to src/area/moria.are diff --git a/area/music.txt b/src/area/music.txt similarity index 100% rename from area/music.txt rename to src/area/music.txt diff --git a/area/newthalos.are b/src/area/newthalos.are similarity index 100% rename from area/newthalos.are rename to src/area/newthalos.are diff --git a/area/nirvana.are b/src/area/nirvana.are similarity index 100% rename from area/nirvana.are rename to src/area/nirvana.are diff --git a/area/ofcol.are b/src/area/ofcol.are similarity index 100% rename from area/ofcol.are rename to src/area/ofcol.are diff --git a/area/ofcol2.are b/src/area/ofcol2.are similarity index 100% rename from area/ofcol2.are rename to src/area/ofcol2.are diff --git a/area/olympus.are b/src/area/olympus.are similarity index 100% rename from area/olympus.are rename to src/area/olympus.are diff --git a/area/plains.are b/src/area/plains.are similarity index 100% rename from area/plains.are rename to src/area/plains.are diff --git a/area/proto.are b/src/area/proto.are similarity index 100% rename from area/proto.are rename to src/area/proto.are diff --git a/area/pyramid.are b/src/area/pyramid.are similarity index 100% rename from area/pyramid.are rename to src/area/pyramid.are diff --git a/area/quifael.are b/src/area/quifael.are similarity index 100% rename from area/quifael.are rename to src/area/quifael.are diff --git a/area/redferne.are b/src/area/redferne.are similarity index 100% rename from area/redferne.are rename to src/area/redferne.are diff --git a/area/rom.are b/src/area/rom.are similarity index 100% rename from area/rom.are rename to src/area/rom.are diff --git a/area/school.are b/src/area/school.are similarity index 100% rename from area/school.are rename to src/area/school.are diff --git a/area/sewer.are b/src/area/sewer.are similarity index 100% rename from area/sewer.are rename to src/area/sewer.are diff --git a/area/shire.are b/src/area/shire.are similarity index 100% rename from area/shire.are rename to src/area/shire.are diff --git a/area/smurf.are b/src/area/smurf.are similarity index 100% rename from area/smurf.are rename to src/area/smurf.are diff --git a/area/social.are b/src/area/social.are similarity index 100% rename from area/social.are rename to src/area/social.are diff --git a/area/startup b/src/area/startup similarity index 100% rename from area/startup rename to src/area/startup diff --git a/area/thalos.are b/src/area/thalos.are similarity index 100% rename from area/thalos.are rename to src/area/thalos.are diff --git a/area/tohell.are b/src/area/tohell.are similarity index 100% rename from area/tohell.are rename to src/area/tohell.are diff --git a/area/trollden.are b/src/area/trollden.are similarity index 100% rename from area/trollden.are rename to src/area/trollden.are diff --git a/area/valley.are b/src/area/valley.are similarity index 100% rename from area/valley.are rename to src/area/valley.are diff --git a/area/wyvern.are b/src/area/wyvern.are similarity index 100% rename from area/wyvern.are rename to src/area/wyvern.are diff --git a/src/rom24.egg-info/PKG-INFO b/src/rom24.egg-info/PKG-INFO new file mode 100644 index 0000000..afb724d --- /dev/null +++ b/src/rom24.egg-info/PKG-INFO @@ -0,0 +1,11 @@ +Metadata-Version: 1.2 +Name: rom24 +Version: 0.0.0a0 +Summary: Attempt at properly packaging rom24 python. +Home-page: UNKNOWN +Author: Micheal Taylor +Author-email: bubthegreat@gmail.com +License: UNKNOWN +Description: UNKNOWN +Platform: UNKNOWN +Requires-Python: >=3.6.6 diff --git a/src/rom24.egg-info/SOURCES.txt b/src/rom24.egg-info/SOURCES.txt new file mode 100644 index 0000000..0218d63 --- /dev/null +++ b/src/rom24.egg-info/SOURCES.txt @@ -0,0 +1,377 @@ +README.md +setup.py +src/rom24/__init__.py +src/rom24/affects.py +src/rom24/auth.py +src/rom24/bit.py +src/rom24/comm.py +src/rom24/const.py +src/rom24/data_loader.py +src/rom24/db.py +src/rom24/effects.py +src/rom24/environment.py +src/rom24/equipment.py +src/rom24/fight.py +src/rom24/game_utils.py +src/rom24/handler_ch.py +src/rom24/handler_game.py +src/rom24/handler_item.py +src/rom24/handler_log.py +src/rom24/handler_magic.py +src/rom24/handler_npc.py +src/rom24/handler_pc.py +src/rom24/handler_room.py +src/rom24/hotfix.py +src/rom24/immortal.py +src/rom24/instance.py +src/rom24/interp.py +src/rom24/inventory.py +src/rom24/item_flags.py +src/rom24/living.py +src/rom24/magic.py +src/rom24/merc.py +src/rom24/nanny.py +src/rom24/object_creator.py +src/rom24/physical.py +src/rom24/pyom.py +src/rom24/pyprogs.py +src/rom24/save.py +src/rom24/settings.py +src/rom24/shell.py +src/rom24/shop_utils.py +src/rom24/skills.py +src/rom24/special.py +src/rom24/state_checks.py +src/rom24/sys_utils.py +src/rom24/tables.py +src/rom24/type_bypass.py +src/rom24/update.py +src/rom24/world_classes.py +src/rom24.egg-info/PKG-INFO +src/rom24.egg-info/SOURCES.txt +src/rom24.egg-info/dependency_links.txt +src/rom24.egg-info/entry_points.txt +src/rom24.egg-info/requires.txt +src/rom24.egg-info/top_level.txt +src/rom24/commands/__init__.py +src/rom24/commands/do_advance.py +src/rom24/commands/do_affects.py +src/rom24/commands/do_afk.py +src/rom24/commands/do_alias.py +src/rom24/commands/do_answer.py +src/rom24/commands/do_apickle.py +src/rom24/commands/do_areas.py +src/rom24/commands/do_at.py +src/rom24/commands/do_auction.py +src/rom24/commands/do_authenticator.py +src/rom24/commands/do_autoassist.py +src/rom24/commands/do_autoexit.py +src/rom24/commands/do_autogold.py +src/rom24/commands/do_autolist.py +src/rom24/commands/do_autoloot.py +src/rom24/commands/do_autosac.py +src/rom24/commands/do_autosplit.py +src/rom24/commands/do_backstab.py +src/rom24/commands/do_bamfin.py +src/rom24/commands/do_bamfout.py +src/rom24/commands/do_bash.py +src/rom24/commands/do_berserk.py +src/rom24/commands/do_brandish.py +src/rom24/commands/do_brief.py +src/rom24/commands/do_bug.py +src/rom24/commands/do_buy.py +src/rom24/commands/do_cast.py +src/rom24/commands/do_channels.py +src/rom24/commands/do_clantalk.py +src/rom24/commands/do_clone.py +src/rom24/commands/do_close.py +src/rom24/commands/do_combine.py +src/rom24/commands/do_commands.py +src/rom24/commands/do_compact.py +src/rom24/commands/do_compare.py +src/rom24/commands/do_consider.py +src/rom24/commands/do_count.py +src/rom24/commands/do_deaf.py +src/rom24/commands/do_debug.py +src/rom24/commands/do_delete.py +src/rom24/commands/do_deny.py +src/rom24/commands/do_description.py +src/rom24/commands/do_dirt.py +src/rom24/commands/do_disarm.py +src/rom24/commands/do_disconnect.py +src/rom24/commands/do_down.py +src/rom24/commands/do_drink.py +src/rom24/commands/do_drop.py +src/rom24/commands/do_dump.py +src/rom24/commands/do_east.py +src/rom24/commands/do_eat.py +src/rom24/commands/do_echo.py +src/rom24/commands/do_emote.py +src/rom24/commands/do_enter.py +src/rom24/commands/do_envenom.py +src/rom24/commands/do_equipment.py +src/rom24/commands/do_examine.py +src/rom24/commands/do_exits.py +src/rom24/commands/do_fill.py +src/rom24/commands/do_flags.py +src/rom24/commands/do_flee.py +src/rom24/commands/do_follow.py +src/rom24/commands/do_force.py +src/rom24/commands/do_freeze.py +src/rom24/commands/do_freset.py +src/rom24/commands/do_gain.py +src/rom24/commands/do_get.py +src/rom24/commands/do_give.py +src/rom24/commands/do_gossip.py +src/rom24/commands/do_goto.py +src/rom24/commands/do_grats.py +src/rom24/commands/do_group.py +src/rom24/commands/do_groups.py +src/rom24/commands/do_gtell.py +src/rom24/commands/do_guild.py +src/rom24/commands/do_heal.py +src/rom24/commands/do_help.py +src/rom24/commands/do_hide.py +src/rom24/commands/do_holylight.py +src/rom24/commands/do_immtalk.py +src/rom24/commands/do_incognito.py +src/rom24/commands/do_inventory.py +src/rom24/commands/do_invis.py +src/rom24/commands/do_kick.py +src/rom24/commands/do_kill.py +src/rom24/commands/do_list.py +src/rom24/commands/do_load.py +src/rom24/commands/do_lock.py +src/rom24/commands/do_log.py +src/rom24/commands/do_look.py +src/rom24/commands/do_memory.py +src/rom24/commands/do_mfind.py +src/rom24/commands/do_mload.py +src/rom24/commands/do_mset.py +src/rom24/commands/do_mstat.py +src/rom24/commands/do_murder.py +src/rom24/commands/do_music.py +src/rom24/commands/do_mwhere.py +src/rom24/commands/do_newlock.py +src/rom24/commands/do_nochannels.py +src/rom24/commands/do_noemote.py +src/rom24/commands/do_nofollow.py +src/rom24/commands/do_noloot.py +src/rom24/commands/do_north.py +src/rom24/commands/do_noshout.py +src/rom24/commands/do_nosummon.py +src/rom24/commands/do_notell.py +src/rom24/commands/do_ofind.py +src/rom24/commands/do_oload.py +src/rom24/commands/do_omni.py +src/rom24/commands/do_open.py +src/rom24/commands/do_order.py +src/rom24/commands/do_oset.py +src/rom24/commands/do_ostat.py +src/rom24/commands/do_outfit.py +src/rom24/commands/do_owhere.py +src/rom24/commands/do_pardon.py +src/rom24/commands/do_password.py +src/rom24/commands/do_peace.py +src/rom24/commands/do_pecho.py +src/rom24/commands/do_pick.py +src/rom24/commands/do_pmote.py +src/rom24/commands/do_pose.py +src/rom24/commands/do_pour.py +src/rom24/commands/do_practice.py +src/rom24/commands/do_prefix.py +src/rom24/commands/do_prompt.py +src/rom24/commands/do_protect.py +src/rom24/commands/do_purge.py +src/rom24/commands/do_put.py +src/rom24/commands/do_quaff.py +src/rom24/commands/do_question.py +src/rom24/commands/do_quiet.py +src/rom24/commands/do_quit.py +src/rom24/commands/do_quote.py +src/rom24/commands/do_reboot.py +src/rom24/commands/do_recall.py +src/rom24/commands/do_recho.py +src/rom24/commands/do_recite.py +src/rom24/commands/do_reload.py +src/rom24/commands/do_remove.py +src/rom24/commands/do_rent.py +src/rom24/commands/do_replay.py +src/rom24/commands/do_reply.py +src/rom24/commands/do_report.py +src/rom24/commands/do_rescue.py +src/rom24/commands/do_rest.py +src/rom24/commands/do_restore.py +src/rom24/commands/do_return.py +src/rom24/commands/do_rstat.py +src/rom24/commands/do_sacrifice.py +src/rom24/commands/do_save.py +src/rom24/commands/do_say.py +src/rom24/commands/do_score.py +src/rom24/commands/do_scroll.py +src/rom24/commands/do_sell.py +src/rom24/commands/do_set.py +src/rom24/commands/do_shout.py +src/rom24/commands/do_show.py +src/rom24/commands/do_shutdown.py +src/rom24/commands/do_sit.py +src/rom24/commands/do_skills.py +src/rom24/commands/do_slay.py +src/rom24/commands/do_sleep.py +src/rom24/commands/do_slookup.py +src/rom24/commands/do_smote.py +src/rom24/commands/do_sneak.py +src/rom24/commands/do_snoop.py +src/rom24/commands/do_socials.py +src/rom24/commands/do_sockets.py +src/rom24/commands/do_south.py +src/rom24/commands/do_spells.py +src/rom24/commands/do_split.py +src/rom24/commands/do_sset.py +src/rom24/commands/do_stand.py +src/rom24/commands/do_stat.py +src/rom24/commands/do_steal.py +src/rom24/commands/do_string.py +src/rom24/commands/do_switch.py +src/rom24/commands/do_tabledump.py +src/rom24/commands/do_tableload.py +src/rom24/commands/do_tell.py +src/rom24/commands/do_term.py +src/rom24/commands/do_time.py +src/rom24/commands/do_title.py +src/rom24/commands/do_train.py +src/rom24/commands/do_transfer.py +src/rom24/commands/do_trip.py +src/rom24/commands/do_trust.py +src/rom24/commands/do_typo.py +src/rom24/commands/do_unalias.py +src/rom24/commands/do_unlock.py +src/rom24/commands/do_up.py +src/rom24/commands/do_value.py +src/rom24/commands/do_violate.py +src/rom24/commands/do_visible.py +src/rom24/commands/do_vnum.py +src/rom24/commands/do_wake.py +src/rom24/commands/do_wear.py +src/rom24/commands/do_weather.py +src/rom24/commands/do_west.py +src/rom24/commands/do_where.py +src/rom24/commands/do_who.py +src/rom24/commands/do_whois.py +src/rom24/commands/do_wimpy.py +src/rom24/commands/do_wizhelp.py +src/rom24/commands/do_wizlock.py +src/rom24/commands/do_wiznet.py +src/rom24/commands/do_worth.py +src/rom24/commands/do_yell.py +src/rom24/commands/do_zap.py +src/rom24/commands/do_zecho.py +src/rom24/database/__init__.py +src/rom24/database/tracker.py +src/rom24/database/read/__init__.py +src/rom24/database/read/read_tables.py +src/rom24/database/write/__init__.py +src/rom24/database/write/write_tables.py +src/rom24/miniboa/__init__.py +src/rom24/miniboa/asyncio.py +src/rom24/miniboa/colors.py +src/rom24/miniboa/telnet.py +src/rom24/miniboa/terminal.py +src/rom24/spells/__init__.py +src/rom24/spells/spell_acid_blast.py +src/rom24/spells/spell_acid_breath.py +src/rom24/spells/spell_armor.py +src/rom24/spells/spell_bless.py +src/rom24/spells/spell_blindness.py +src/rom24/spells/spell_burning_hands.py +src/rom24/spells/spell_call_lightning.py +src/rom24/spells/spell_calm.py +src/rom24/spells/spell_cancellation.py +src/rom24/spells/spell_cause_critical.py +src/rom24/spells/spell_cause_light.py +src/rom24/spells/spell_cause_serious.py +src/rom24/spells/spell_chain_lightning.py +src/rom24/spells/spell_change_sex.py +src/rom24/spells/spell_charm_person.py +src/rom24/spells/spell_chill_touch.py +src/rom24/spells/spell_colour_spray.py +src/rom24/spells/spell_continual_light.py +src/rom24/spells/spell_control_weather.py +src/rom24/spells/spell_create_food.py +src/rom24/spells/spell_create_rose.py +src/rom24/spells/spell_create_spring.py +src/rom24/spells/spell_create_water.py +src/rom24/spells/spell_cure_blindness.py +src/rom24/spells/spell_cure_critical.py +src/rom24/spells/spell_cure_disease.py +src/rom24/spells/spell_cure_light.py +src/rom24/spells/spell_cure_poison.py +src/rom24/spells/spell_cure_serious.py +src/rom24/spells/spell_curse.py +src/rom24/spells/spell_demonfire.py +src/rom24/spells/spell_detect_evil.py +src/rom24/spells/spell_detect_good.py +src/rom24/spells/spell_detect_hidden.py +src/rom24/spells/spell_detect_invis.py +src/rom24/spells/spell_detect_magic.py +src/rom24/spells/spell_detect_poison.py +src/rom24/spells/spell_dispel_evil.py +src/rom24/spells/spell_dispel_good.py +src/rom24/spells/spell_dispel_magic.py +src/rom24/spells/spell_earthquake.py +src/rom24/spells/spell_enchant_armor.py +src/rom24/spells/spell_enchant_weapon.py +src/rom24/spells/spell_energy_drain.py +src/rom24/spells/spell_faerie_fire.py +src/rom24/spells/spell_faerie_fog.py +src/rom24/spells/spell_farsight.py +src/rom24/spells/spell_fire_breath.py +src/rom24/spells/spell_fireball.py +src/rom24/spells/spell_fireproof.py +src/rom24/spells/spell_flamestrike.py +src/rom24/spells/spell_floating_disc.py +src/rom24/spells/spell_fly.py +src/rom24/spells/spell_frenzy.py +src/rom24/spells/spell_frost_breath.py +src/rom24/spells/spell_gas_breath.py +src/rom24/spells/spell_gate.py +src/rom24/spells/spell_general_purpose.py +src/rom24/spells/spell_giant_strength.py +src/rom24/spells/spell_harm.py +src/rom24/spells/spell_haste.py +src/rom24/spells/spell_heal.py +src/rom24/spells/spell_heat_metal.py +src/rom24/spells/spell_high_explosive.py +src/rom24/spells/spell_holy_word.py +src/rom24/spells/spell_identify.py +src/rom24/spells/spell_infravision.py +src/rom24/spells/spell_invis.py +src/rom24/spells/spell_know_alignment.py +src/rom24/spells/spell_lightning_bolt.py +src/rom24/spells/spell_lightning_breath.py +src/rom24/spells/spell_locate_object.py +src/rom24/spells/spell_magic_missile.py +src/rom24/spells/spell_mass_healing.py +src/rom24/spells/spell_mass_invis.py +src/rom24/spells/spell_nexus.py +src/rom24/spells/spell_pass_door.py +src/rom24/spells/spell_plague.py +src/rom24/spells/spell_poison.py +src/rom24/spells/spell_portal.py +src/rom24/spells/spell_protection_evil.py +src/rom24/spells/spell_protection_good.py +src/rom24/spells/spell_ray_of_truth.py +src/rom24/spells/spell_recharge.py +src/rom24/spells/spell_refresh.py +src/rom24/spells/spell_remove_curse.py +src/rom24/spells/spell_sanctuary.py +src/rom24/spells/spell_shield.py +src/rom24/spells/spell_shocking_grasp.py +src/rom24/spells/spell_sleep.py +src/rom24/spells/spell_slow.py +src/rom24/spells/spell_stone_skin.py +src/rom24/spells/spell_summon.py +src/rom24/spells/spell_teleport.py +src/rom24/spells/spell_ventriloquate.py +src/rom24/spells/spell_weaken.py +src/rom24/spells/spell_word_of_recall.py \ No newline at end of file diff --git a/src/rom24.egg-info/dependency_links.txt b/src/rom24.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/src/rom24.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/src/rom24.egg-info/entry_points.txt b/src/rom24.egg-info/entry_points.txt new file mode 100644 index 0000000..0260ed7 --- /dev/null +++ b/src/rom24.egg-info/entry_points.txt @@ -0,0 +1,3 @@ +[console_scripts] +rom24 = rom24.pyom:pyom + diff --git a/src/rom24.egg-info/requires.txt b/src/rom24.egg-info/requires.txt new file mode 100644 index 0000000..e874e3d --- /dev/null +++ b/src/rom24.egg-info/requires.txt @@ -0,0 +1,2 @@ +ipdb +psutil diff --git a/src/rom24.egg-info/top_level.txt b/src/rom24.egg-info/top_level.txt new file mode 100644 index 0000000..a91bf62 --- /dev/null +++ b/src/rom24.egg-info/top_level.txt @@ -0,0 +1 @@ +rom24 diff --git a/src/rom24/__init__.py b/src/rom24/__init__.py new file mode 100644 index 0000000..2dcb709 --- /dev/null +++ b/src/rom24/__init__.py @@ -0,0 +1,126 @@ +"""Configs for the library.""" + +import os +import logging +import logging.config + +LIBRARY_NAME = os.path.basename(os.path.dirname(__file__)) + +# Formats for logging +LOGGING_DATE_FORMAT = "%m/%d/%Y %I:%M:%S %p" +NORMAL_LOGGING_FORMAT = "%(asctime)s %(levelname)-8s [%(name)s] %(message)s" +VERBOSE_LOGGING_FORMAT = ( + "%(asctime)s %(levelname)-8s [%(name)s.%(funcName)s:%(lineno)d] %(message)s" +) + +# Configurable logging settings +LOGGING_LEVEL = os.environ.get(f"{LIBRARY_NAME.upper()}_LOGGING_LEVEL", logging.DEBUG) +LOG_ALL_THE_THINGS = os.environ.get(f"{LIBRARY_NAME.upper()}_LOG_ALL_THE_THINGS") +LOGGING_FORMATTER = os.environ.get( + f"{LIBRARY_NAME.upper()}_LOGGING_VERBOSITY", "normal" +) + + +ERROR_FILENAME = "error.log" +INFO_FILENAME = "info.log" +_BASE_FOLDER = f".{LIBRARY_NAME}" +_BASE_PATH = os.path.expanduser("~") + +LIBRARY_PATH = os.path.join(_BASE_PATH, _BASE_FOLDER) +ERROR_LOG_PATH = os.path.join(LIBRARY_PATH, ERROR_FILENAME) +INFO_LOG_PATH = os.path.join(LIBRARY_PATH, INFO_FILENAME) + + +if not os.path.exists(LIBRARY_PATH): + os.makedirs(LIBRARY_PATH) + + +class ErrorFilter(logging.Filter): + """Filter class for error only logs.""" + + # pylint: disable=too-few-public-methods + def filter(self, record: logging.LogRecord) -> bool: + """Filter down to only error level logs.""" + return record.levelno == logging.ERROR + + +# General logging config here. +LOGGING_CONFIG = { + "version": 1, + "disable_existing_loggers": False, + "filters": { + "errorfilter": { + "()": ErrorFilter, + }, + }, + "formatters": { + "verbose": { + "datefmt": LOGGING_DATE_FORMAT, + "format": VERBOSE_LOGGING_FORMAT, + }, + "normal": { + "datefmt": LOGGING_DATE_FORMAT, + "format": NORMAL_LOGGING_FORMAT, + }, + }, + "handlers": { + "console": { + "level": LOGGING_LEVEL, + "class": "logging.StreamHandler", + "formatter": LOGGING_FORMATTER, + }, + "info": { + "level": LOGGING_LEVEL, + "class": "logging.handlers.RotatingFileHandler", + "filename": INFO_LOG_PATH, + "formatter": LOGGING_FORMATTER, + }, + "null": { + "level": LOGGING_LEVEL, + "class": "logging.NullHandler", + "formatter": LOGGING_FORMATTER, + }, + "error": { + "level": logging.ERROR, + "class": "logging.handlers.RotatingFileHandler", + "filename": ERROR_LOG_PATH, + "filters": ["errorfilter"], + "formatter": LOGGING_FORMATTER, + }, + }, + "loggers": { + LIBRARY_NAME: { + "handlers": [ + "console", + "info", + "error", + ], + "level": LOGGING_LEVEL, + }, + }, +} + +if LOG_ALL_THE_THINGS: + # This will log everything from all libraries (altering the root logger). Use when + # troubleshooting third party libraries rather than your own. + LOGGING_CONFIG["loggers"] = { + "": { + "handlers": [ + "console", + "info", + "error", + ], + "level": 0, + }, + } + + +# Configure the logging, and then log a message after import of the library. +logging.config.dictConfig(LOGGING_CONFIG) +LOGGER = logging.getLogger(LIBRARY_NAME) +if LOG_ALL_THE_THINGS: + LOGGER.warning( + "Warning! You've enabled logging at the root logger level. This may result in a lot of logging!" + ) +LOGGER.info("Loaded %s library with %s log level.", LIBRARY_NAME, LOGGING_LEVEL) +LOGGER.info("Using %s log formatter.", LOGGING_FORMATTER) diff --git a/src/rom24/affects.py b/src/rom24/affects.py index 7ff89fa..7bef2db 100644 --- a/src/rom24/affects.py +++ b/src/rom24/affects.py @@ -1,48 +1,16 @@ -""" -/*************************************************************************** - * 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-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 * -***************************************************************************/ -/************ - * Ported to Python by Davion of MudBytes.net - * Using Miniboa https://code.google.com/p/miniboa/ - * Now using Python 3 version https://code.google.com/p/miniboa-py3/ - ************/ -""" import copy import json import logging logger = logging.getLogger(__name__) -import bit -import const -import handler_game -import merc -import tables -import instance +from rom24 import bit +from rom24 import const +from rom24 import handler_game +from rom24 import merc +from rom24 import tables +from rom24 import instance class Affects: diff --git a/src/rom24/auth.py b/src/rom24/auth.py index 6aedc6a..b5e0a62 100644 --- a/src/rom24/auth.py +++ b/src/rom24/auth.py @@ -35,7 +35,7 @@ logger = logging.getLogger(__name__) -import instance +from rom24 import instance class TwoFactorAuth: diff --git a/src/rom24/bit.py b/src/rom24/bit.py index a386362..fc18892 100644 --- a/src/rom24/bit.py +++ b/src/rom24/bit.py @@ -3,8 +3,8 @@ import logging logger = logging.getLogger(__name__) -import game_utils -import state_checks +from rom24 import game_utils +from rom24 import state_checks class Bit: diff --git a/src/rom24/comm.py b/src/rom24/comm.py index 16b75f8..dd3b5f0 100644 --- a/src/rom24/comm.py +++ b/src/rom24/comm.py @@ -1,36 +1,4 @@ -""" -/*************************************************************************** - * 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-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 * -***************************************************************************/ -/************ - * Ported to Python by Davion of MudBytes.net - * Using Miniboa https://code.google.com/p/miniboa/ - * Now using Python 3 version https://code.google.com/p/miniboa-py3/ - ************/ -""" from collections import OrderedDict from types import MethodType import random @@ -39,14 +7,14 @@ logger = logging.getLogger(__name__) -import db -import game_utils -import handler_game -import merc -import nanny -import handler_ch -import state_checks -import instance +from rom24 import db +from rom24 import game_utils +from rom24 import handler_game +from rom24 import merc +from rom24 import nanny +from rom24 import handler_ch +from rom24 import state_checks +from rom24 import instance done = False @@ -256,8 +224,8 @@ def is_reconnecting(d, name): def game_loop(server): - from update import update_handler - from pyom import startup_time + from rom24.update import update_handler + from rom24.pyom import startup_time #import sysutils global done @@ -265,14 +233,19 @@ def game_loop(server): boot_time = time.time() #boot_snapshot = sysutils.ResourceSnapshot() - #logger.boot(boot_snapshot.log_data()) + #logger.info(boot_snapshot.log_data()) - logger.boot('Pyom database booted in %.3f seconds', (boot_time - startup_time)) - logger.boot("Pyom is ready to rock on port %d", server.port) + logger.info('Pyom database booted in %.3f seconds', (boot_time - startup_time)) + logger.info("Saving instances") instance.save() + logger.info("Beginning server polling.") + logger.info("Pyom is ready to rock on port %d", server.port) done = False while not done: - server.poll() - process_input() - update_handler() + try: + server.poll() + process_input() + update_handler() + except Exception as e: + logger.exception("Exception %s caught - continuing loop.", e) diff --git a/src/rom24/commands/__init__.py b/src/rom24/commands/__init__.py index 1303261..e69de29 100644 --- a/src/rom24/commands/__init__.py +++ b/src/rom24/commands/__init__.py @@ -1,33 +0,0 @@ -""" -#************************************************************************** - * 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-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 * -***************************************************************************/ -#*********** - * Ported to Python by Davion of MudBytes.net - * Using Miniboa https://code.google.com/p/miniboa/ - * Now using Python 3 version https://code.google.com/p/miniboa-py3/ - ************/ -""" \ No newline at end of file diff --git a/src/rom24/commands/do_advance.py b/src/rom24/commands/do_advance.py index d5b8dc9..894df36 100644 --- a/src/rom24/commands/do_advance.py +++ b/src/rom24/commands/do_advance.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import merc -import game_utils -import update -import interp +from rom24 import merc +from rom24 import game_utils +from rom24 import update +from rom24 import interp def do_advance(ch, argument): argument, arg1 = game_utils.read_word(argument) diff --git a/src/rom24/commands/do_affects.py b/src/rom24/commands/do_affects.py index 894623a..4426f7e 100644 --- a/src/rom24/commands/do_affects.py +++ b/src/rom24/commands/do_affects.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp def do_affects(ch, argument): diff --git a/src/rom24/commands/do_afk.py b/src/rom24/commands/do_afk.py index 112e0f2..71bc196 100644 --- a/src/rom24/commands/do_afk.py +++ b/src/rom24/commands/do_afk.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp # afk command diff --git a/src/rom24/commands/do_alias.py b/src/rom24/commands/do_alias.py index 2c4ec52..13db0af 100644 --- a/src/rom24/commands/do_alias.py +++ b/src/rom24/commands/do_alias.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils +from rom24 import merc +from rom24 import interp +from rom24 import game_utils def do_alias(ch, argument): diff --git a/src/rom24/commands/do_answer.py b/src/rom24/commands/do_answer.py index 19ac8f2..8850da8 100644 --- a/src/rom24/commands/do_answer.py +++ b/src/rom24/commands/do_answer.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import handler_ch -import merc -import interp -import nanny -import handler_game +from rom24 import handler_ch +from rom24 import merc +from rom24 import interp +from rom24 import nanny +from rom24 import handler_game # RT answer channel - uses same line as questions diff --git a/src/rom24/commands/do_apickle.py b/src/rom24/commands/do_apickle.py index 7cab0a2..5b0a803 100644 --- a/src/rom24/commands/do_apickle.py +++ b/src/rom24/commands/do_apickle.py @@ -5,10 +5,10 @@ logger = logging.getLogger(__name__) import os -import interp -import merc -import save -import settings +from rom24 import interp +from rom24 import merc +from rom24 import save +from rom24 import settings def do_apickle(ch, argument): diff --git a/src/rom24/commands/do_areas.py b/src/rom24/commands/do_areas.py index 082f278..bb62b42 100644 --- a/src/rom24/commands/do_areas.py +++ b/src/rom24/commands/do_areas.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import instance +from rom24 import merc +from rom24 import interp +from rom24 import instance def do_areas(ch, argument): diff --git a/src/rom24/commands/do_at.py b/src/rom24/commands/do_at.py index da6c3f9..dcf9c6d 100644 --- a/src/rom24/commands/do_at.py +++ b/src/rom24/commands/do_at.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import game_utils -import merc -import interp -import instance +from rom24 import game_utils +from rom24 import merc +from rom24 import interp +from rom24 import instance def do_at(ch, argument): diff --git a/src/rom24/commands/do_auction.py b/src/rom24/commands/do_auction.py index 56fbc0f..f48df36 100644 --- a/src/rom24/commands/do_auction.py +++ b/src/rom24/commands/do_auction.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import nanny -import handler_ch -import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import nanny +from rom24 import handler_ch +from rom24 import handler_game def do_auction(ch, argument): diff --git a/src/rom24/commands/do_authenticator.py b/src/rom24/commands/do_authenticator.py index d5bad92..57b605f 100644 --- a/src/rom24/commands/do_authenticator.py +++ b/src/rom24/commands/do_authenticator.py @@ -4,10 +4,10 @@ import logging logger = logging.getLogger(__name__) -import auth -import game_utils -import interp -import merc +from rom24 import auth +from rom24 import game_utils +from rom24 import interp +from rom24 import merc def do_authenticator(ch, argument): diff --git a/src/rom24/commands/do_autoassist.py b/src/rom24/commands/do_autoassist.py index 7d086eb..26b7512 100644 --- a/src/rom24/commands/do_autoassist.py +++ b/src/rom24/commands/do_autoassist.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp def do_autoassist(ch, argument): diff --git a/src/rom24/commands/do_autoexit.py b/src/rom24/commands/do_autoexit.py index 5258346..b377aff 100644 --- a/src/rom24/commands/do_autoexit.py +++ b/src/rom24/commands/do_autoexit.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp def do_autoexit(ch, argument): diff --git a/src/rom24/commands/do_autogold.py b/src/rom24/commands/do_autogold.py index d59f222..7d7298b 100644 --- a/src/rom24/commands/do_autogold.py +++ b/src/rom24/commands/do_autogold.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import state_checks def do_autogold(ch, argument): diff --git a/src/rom24/commands/do_autolist.py b/src/rom24/commands/do_autolist.py index c64de2f..104cac3 100644 --- a/src/rom24/commands/do_autolist.py +++ b/src/rom24/commands/do_autolist.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp # RT this following section holds all the auto commands from ROM, as well as replacements for config diff --git a/src/rom24/commands/do_autoloot.py b/src/rom24/commands/do_autoloot.py index cdf9205..b78be13 100644 --- a/src/rom24/commands/do_autoloot.py +++ b/src/rom24/commands/do_autoloot.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp def do_autoloot(ch, argument): diff --git a/src/rom24/commands/do_autosac.py b/src/rom24/commands/do_autosac.py index ed6bfd9..4dceaf2 100644 --- a/src/rom24/commands/do_autosac.py +++ b/src/rom24/commands/do_autosac.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp def do_autosac(ch, argument): diff --git a/src/rom24/commands/do_autosplit.py b/src/rom24/commands/do_autosplit.py index 529c9fc..e90c025 100644 --- a/src/rom24/commands/do_autosplit.py +++ b/src/rom24/commands/do_autosplit.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp def do_autosplit(ch, argument): diff --git a/src/rom24/commands/do_backstab.py b/src/rom24/commands/do_backstab.py index 4b2e9d4..4c1ea65 100644 --- a/src/rom24/commands/do_backstab.py +++ b/src/rom24/commands/do_backstab.py @@ -3,13 +3,13 @@ logger = logging.getLogger(__name__) -import game_utils -import merc -import fight -import const -import state_checks -import interp -import handler_game +from rom24 import game_utils +from rom24 import merc +from rom24 import fight +from rom24 import const +from rom24 import state_checks +from rom24 import interp +from rom24 import handler_game def do_backstab(ch, argument): @@ -46,11 +46,11 @@ def do_backstab(ch, argument): state_checks.WAIT_STATE(ch, const.skill_table['backstab'].beats ) if random.randint(1, 99) < ch.get_skill('backstab') \ or (ch.get_skill('backstab') >= 2 and not state_checks.IS_AWAKE(victim)): - if ch.is_pc(): + if ch.is_pc: ch.check_improve('backstab',True,1) fight.multi_hit(ch, victim, 'backstab') else: - if ch.is_pc(): + if ch.is_pc: ch.check_improve('backstab', False, 1) fight.damage(ch, victim, 0, 'backstab', merc.DAM_NONE, True) return diff --git a/src/rom24/commands/do_bamfin.py b/src/rom24/commands/do_bamfin.py index 1070015..ec18426 100644 --- a/src/rom24/commands/do_bamfin.py +++ b/src/rom24/commands/do_bamfin.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp def do_bamfin(ch, argument): diff --git a/src/rom24/commands/do_bamfout.py b/src/rom24/commands/do_bamfout.py index d347e01..d81a8db 100644 --- a/src/rom24/commands/do_bamfout.py +++ b/src/rom24/commands/do_bamfout.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp def do_bamfout(ch, argument): diff --git a/src/rom24/commands/do_bash.py b/src/rom24/commands/do_bash.py index 157c2d7..ba8d8e8 100644 --- a/src/rom24/commands/do_bash.py +++ b/src/rom24/commands/do_bash.py @@ -3,13 +3,13 @@ logger = logging.getLogger(__name__) -import game_utils -import handler_game -import merc -import const -import fight -import interp -import state_checks +from rom24 import game_utils +from rom24 import handler_game +from rom24 import merc +from rom24 import const +from rom24 import fight +from rom24 import interp +from rom24 import state_checks def do_bash(ch, argument): @@ -77,7 +77,7 @@ def do_bash(ch, argument): handler_game.act("You slam into $N, and send $M flying!",ch,None,victim, merc.TO_CHAR) handler_game.act("$n sends $N sprawling with a powerful bash.", ch,None,victim, merc.TO_NOTVICT) if not ch.is_npc(): - if ch.is_pc(): + if ch.is_pc: ch.check_improve('bash',True,1) state_checks.DAZE_STATE(victim, 3 * merc.PULSE_VIOLENCE) state_checks.WAIT_STATE(ch,const.skill_table['bash'].beats) @@ -89,7 +89,7 @@ def do_bash(ch, argument): handler_game.act("$n falls flat on $s face.", ch, None, victim, merc.TO_NOTVICT) handler_game.act("You evade $n's bash, causing $m to fall flat on $s face.", ch, None, victim, merc.TO_VICT) if not ch.is_npc(): - if ch.is_pc(): + if ch.is_pc: ch.check_improve('bash',False,1) ch.position = merc.POS_RESTING state_checks.WAIT_STATE(ch, const.skill_table['bash'].beats * 3 // 2) diff --git a/src/rom24/commands/do_berserk.py b/src/rom24/commands/do_berserk.py index b79684d..1f1f46f 100644 --- a/src/rom24/commands/do_berserk.py +++ b/src/rom24/commands/do_berserk.py @@ -3,12 +3,12 @@ logger = logging.getLogger(__name__) import random -import merc -import game_utils -import handler_game -import const -import interp -import state_checks +from rom24 import merc +from rom24 import game_utils +from rom24 import handler_game +from rom24 import const +from rom24 import interp +from rom24 import state_checks def do_berserk(ch, argument): @@ -46,7 +46,7 @@ def do_berserk(ch, argument): ch.send("Your pulse races as you are consumed by rage!\n") handler_game.act("$n gets a wild look in $s eyes.", ch, None, None, merc.TO_ROOM) if not ch.is_npc(): - if ch.is_pc(): + if ch.is_pc: ch.check_improve( 'berserk', True, 2) af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS @@ -72,7 +72,7 @@ def do_berserk(ch, argument): ch.send("Your pulse speeds up, but nothing happens.\n") if not ch.is_npc(): - if ch.is_pc(): + if ch.is_pc: ch.check_improve('berserk', False, 2) diff --git a/src/rom24/commands/do_brandish.py b/src/rom24/commands/do_brandish.py index df5555b..6298483 100644 --- a/src/rom24/commands/do_brandish.py +++ b/src/rom24/commands/do_brandish.py @@ -3,12 +3,12 @@ logger = logging.getLogger(__name__) import random -import merc -import handler_game -import handler_magic -import interp -import const -import state_checks +from rom24 import merc +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import interp +from rom24 import const +from rom24 import state_checks def do_brandish(ch, argument): @@ -30,7 +30,7 @@ def do_brandish(ch, argument): if ch.level < staff.level or random.randint(1, 99) >= 20 + ch.get_skill("staves") * 4 / 5: handler_game.act("You fail to invoke $p.", ch, staff, None, merc.TO_CHAR) handler_game.act("...and nothing happens.", ch, None, None, merc.TO_ROOM) - if ch.is_pc(): + if ch.is_pc: ch.check_improve("staves", False, 2) else: for vch_id in ch.in_room.people[:]: @@ -52,7 +52,7 @@ def do_brandish(ch, argument): logger.error("BUG: Do_brandish: bad target for sn %s.", sn) return handler_magic.obj_cast_spell(staff.value[3], staff.value[0], ch, vch, None) - if ch.is_pc(): + if ch.is_pc: ch.check_improve("staves", True, 2) staff.value[2] -= 1 if staff.value[2] <= 0: diff --git a/src/rom24/commands/do_brief.py b/src/rom24/commands/do_brief.py index 29e58bc..401c654 100644 --- a/src/rom24/commands/do_brief.py +++ b/src/rom24/commands/do_brief.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp def do_brief(ch, argument): diff --git a/src/rom24/commands/do_bug.py b/src/rom24/commands/do_bug.py index 82b0776..334569f 100644 --- a/src/rom24/commands/do_bug.py +++ b/src/rom24/commands/do_bug.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import merc -import game_utils -import interp -import settings +from rom24 import merc +from rom24 import game_utils +from rom24 import interp +from rom24 import settings def do_bug(ch, argument): diff --git a/src/rom24/commands/do_buy.py b/src/rom24/commands/do_buy.py index 80f6b85..3306a9b 100644 --- a/src/rom24/commands/do_buy.py +++ b/src/rom24/commands/do_buy.py @@ -3,15 +3,15 @@ logger = logging.getLogger(__name__) -import merc -import game_utils -import handler_game -import handler_room -import interp -import object_creator -import shop_utils -import state_checks -import instance +from rom24 import merc +from rom24 import game_utils +from rom24 import handler_game +from rom24 import handler_room +from rom24 import interp +from rom24 import object_creator +from rom24 import shop_utils +from rom24 import state_checks +from rom24 import instance def do_buy(ch, argument): @@ -58,7 +58,7 @@ def do_buy(ch, argument): if roll < ch.get_skill("haggle"): cost -= cost // 2 * roll // 100 ch.send("You haggle the price down to %d coins.\n" % cost) - if ch.is_pc(): + if ch.is_pc: ch.check_improve( "haggle", True, 4) ch.deduct_cost(cost) pet = object_creator.create_mobile(pet.pIndexData) @@ -128,7 +128,7 @@ def do_buy(ch, argument): if not obj.flags.sell_extract and roll < ch.get_skill("haggle"): cost -= obj.cost // 2 * roll // 100 handler_game.act("You haggle with $N.", ch, None, keeper, merc.TO_CHAR) - if ch.is_pc(): + if ch.is_pc: ch.check_improve( "haggle", True, 4) if number > 1: diff --git a/src/rom24/commands/do_cast.py b/src/rom24/commands/do_cast.py index 02ec249..1865dd5 100644 --- a/src/rom24/commands/do_cast.py +++ b/src/rom24/commands/do_cast.py @@ -3,12 +3,12 @@ logger = logging.getLogger(__name__) -import game_utils -import handler_magic -import state_checks -import merc -import interp -import fight +from rom24 import game_utils +from rom24 import handler_magic +from rom24 import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import fight def do_cast(ch, argument): @@ -155,7 +155,7 @@ def do_cast(ch, argument): if random.randint(1, 99) > ch.get_skill(sn.name): ch.send("You lost your concentration.\n") - if ch.is_pc(): + if ch.is_pc: ch.check_improve( sn, False, 1) ch.mana -= mana // 2 else: @@ -165,7 +165,7 @@ def do_cast(ch, argument): sn.spell_fun(sn, ch.level, ch, vo, target) else: sn.spell_fun(sn, 3 * ch.level // 4, ch, vo, target) - if ch.is_pc(): + if ch.is_pc: ch.check_improve( sn, True, 1) if (sn.target == merc.TAR_CHAR_OFFENSIVE or (sn.target == merc.TAR_OBJ_CHAR_OFF and target == merc.TARGET_CHAR)) \ diff --git a/src/rom24/commands/do_channels.py b/src/rom24/commands/do_channels.py index 7bbf12b..9ec4005 100644 --- a/src/rom24/commands/do_channels.py +++ b/src/rom24/commands/do_channels.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import state_checks # RT code to display channel status def do_channels(ch, argument): diff --git a/src/rom24/commands/do_clantalk.py b/src/rom24/commands/do_clantalk.py index b9fb867..0de4daa 100644 --- a/src/rom24/commands/do_clantalk.py +++ b/src/rom24/commands/do_clantalk.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import merc -import interp -import nanny -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import nanny +from rom24 import state_checks # clan channels diff --git a/src/rom24/commands/do_clone.py b/src/rom24/commands/do_clone.py index b58c43b..21f638c 100644 --- a/src/rom24/commands/do_clone.py +++ b/src/rom24/commands/do_clone.py @@ -2,13 +2,13 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import handler_game -import handler_item -import object_creator -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import handler_game +from rom24 import handler_item +from rom24 import object_creator +from rom24 import state_checks # command that is similar to load diff --git a/src/rom24/commands/do_close.py b/src/rom24/commands/do_close.py index c0cc364..d3a09cf 100644 --- a/src/rom24/commands/do_close.py +++ b/src/rom24/commands/do_close.py @@ -2,13 +2,13 @@ logger = logging.getLogger(__name__) -import interp -import handler_room -import merc -import game_utils -import state_checks -import handler_game -import instance +from rom24 import interp +from rom24 import handler_room +from rom24 import merc +from rom24 import game_utils +from rom24 import state_checks +from rom24 import handler_game +from rom24 import instance def do_close(ch, argument): diff --git a/src/rom24/commands/do_combine.py b/src/rom24/commands/do_combine.py index 4ac05b6..a023b27 100644 --- a/src/rom24/commands/do_combine.py +++ b/src/rom24/commands/do_combine.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp def do_combine(ch, argument): diff --git a/src/rom24/commands/do_commands.py b/src/rom24/commands/do_commands.py index 8444c22..98fcabf 100644 --- a/src/rom24/commands/do_commands.py +++ b/src/rom24/commands/do_commands.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp def do_commands(ch, argument): diff --git a/src/rom24/commands/do_compact.py b/src/rom24/commands/do_compact.py index dd8857b..af3911c 100644 --- a/src/rom24/commands/do_compact.py +++ b/src/rom24/commands/do_compact.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp def do_compact(ch, argument): diff --git a/src/rom24/commands/do_compare.py b/src/rom24/commands/do_compare.py index cbed672..42d5db5 100644 --- a/src/rom24/commands/do_compare.py +++ b/src/rom24/commands/do_compare.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import game_utils -import merc -import interp -import handler_game +from rom24 import game_utils +from rom24 import merc +from rom24 import interp +from rom24 import handler_game def do_compare(ch, argument): diff --git a/src/rom24/commands/do_consider.py b/src/rom24/commands/do_consider.py index 21d89a1..bbe7932 100644 --- a/src/rom24/commands/do_consider.py +++ b/src/rom24/commands/do_consider.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import game_utils -import merc -import interp -import fight -import handler_game +from rom24 import game_utils +from rom24 import merc +from rom24 import interp +from rom24 import fight +from rom24 import handler_game def do_consider(ch, argument): diff --git a/src/rom24/commands/do_count.py b/src/rom24/commands/do_count.py index a059fb6..ead0ffc 100644 --- a/src/rom24/commands/do_count.py +++ b/src/rom24/commands/do_count.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import handler_ch -import merc -import interp -import nanny +from rom24 import handler_ch +from rom24 import merc +from rom24 import interp +from rom24 import nanny #TODO: Known broken # for keeping track of the player count diff --git a/src/rom24/commands/do_deaf.py b/src/rom24/commands/do_deaf.py index f6976e2..7addacd 100644 --- a/src/rom24/commands/do_deaf.py +++ b/src/rom24/commands/do_deaf.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp # RT deaf blocks out all shouts diff --git a/src/rom24/commands/do_debug.py b/src/rom24/commands/do_debug.py index 90446db..c51c456 100644 --- a/src/rom24/commands/do_debug.py +++ b/src/rom24/commands/do_debug.py @@ -2,11 +2,10 @@ logger = logging.getLogger(__name__) -import handler_pc -import game_utils -import interp -import merc -import handler_log +from rom24 import handler_pc +from rom24 import game_utils +from rom24 import interp +from rom24 import merc def do_debug(ch, argument): @@ -21,7 +20,6 @@ def do_debug(ch, argument): if word.startswith('debug'): ch.send("Nope.\n") return - handler_log.GlobalDebugFlag.gdfset(True) handler_pc.Pc.interpret(ch, argument) return diff --git a/src/rom24/commands/do_delete.py b/src/rom24/commands/do_delete.py index 0ba19f1..9a9cff1 100644 --- a/src/rom24/commands/do_delete.py +++ b/src/rom24/commands/do_delete.py @@ -3,11 +3,11 @@ logger = logging.getLogger(__name__) -import handler_game -import merc -import interp -import settings -import fight +from rom24 import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import settings +from rom24 import fight def do_delete(ch, argument): if ch.is_npc(): diff --git a/src/rom24/commands/do_deny.py b/src/rom24/commands/do_deny.py index e26abd2..ad78060 100644 --- a/src/rom24/commands/do_deny.py +++ b/src/rom24/commands/do_deny.py @@ -2,12 +2,12 @@ logger = logging.getLogger(__name__) -import merc -import interp -import fight -import game_utils -import handler_game -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import fight +from rom24 import game_utils +from rom24 import handler_game +from rom24 import state_checks def do_deny(ch, argument): diff --git a/src/rom24/commands/do_description.py b/src/rom24/commands/do_description.py index 03d87ab..3de4e09 100644 --- a/src/rom24/commands/do_description.py +++ b/src/rom24/commands/do_description.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp def do_description(ch, argument): diff --git a/src/rom24/commands/do_dirt.py b/src/rom24/commands/do_dirt.py index c1f170c..070c250 100644 --- a/src/rom24/commands/do_dirt.py +++ b/src/rom24/commands/do_dirt.py @@ -3,13 +3,13 @@ logger = logging.getLogger(__name__) -import game_utils -import handler_game -import state_checks -import merc -import const -import interp -import fight +from rom24 import game_utils +from rom24 import handler_game +from rom24 import state_checks +from rom24 import merc +from rom24 import const +from rom24 import interp +from rom24 import fight def do_dirt(ch, argument): @@ -82,7 +82,7 @@ def do_dirt(ch, argument): handler_game.act("$n kicks dirt in your eyes!", ch, None, victim, merc.TO_VICT) fight.damage(ch, victim, random.randint(2, 5), 'dirt kicking', merc.DAM_NONE, False) victim.send("You can't see a thing!\n") - if ch.is_pc(): + if ch.is_pc: ch.check_improve( 'dirt kicking', True, 2) state_checks.WAIT_STATE(ch, const.skill_table['dirt kicking'].beats) af = handler_game.AFFECT_DATA() @@ -96,7 +96,7 @@ def do_dirt(ch, argument): victim.affect_add(af) else: fight.damage(ch, victim, 0, 'dirt kicking', merc.DAM_NONE, True) - if ch.is_pc(): + if ch.is_pc: ch.check_improve( 'dirt kicking', False, 2) state_checks.WAIT_STATE(ch, const.skill_table['dirt kicking'].beats) fight.check_killer(ch, victim) diff --git a/src/rom24/commands/do_disarm.py b/src/rom24/commands/do_disarm.py index 29a89cf..0692ccd 100644 --- a/src/rom24/commands/do_disarm.py +++ b/src/rom24/commands/do_disarm.py @@ -3,12 +3,12 @@ logger = logging.getLogger(__name__) -import handler_game -import state_checks -import merc -import const -import interp -import fight +from rom24 import handler_game +from rom24 import state_checks +from rom24 import merc +from rom24 import const +from rom24 import interp +from rom24 import fight def do_disarm(ch, argument): @@ -57,14 +57,14 @@ def do_disarm(ch, argument): if random.randint(1, 99) < chance: state_checks.WAIT_STATE(ch, const.skill_table['disarm'].beats) fight.disarm(ch, victim) - if ch.is_pc(): + if ch.is_pc: ch.check_improve('disarm', True, 1) else: state_checks.WAIT_STATE(ch, const.skill_table['disarm'].beats) handler_game.act("You fail to disarm $N.", ch, None, victim, merc.TO_CHAR) handler_game.act("$n tries to disarm you, but fails.", ch, None, victim, merc.TO_VICT) handler_game.act("$n tries to disarm $N, but fails.", ch, None, victim, merc.TO_NOTVICT) - if ch.is_pc(): + if ch.is_pc: ch.check_improve('disarm', False, 1) fight.check_killer(ch, victim) return diff --git a/src/rom24/commands/do_disconnect.py b/src/rom24/commands/do_disconnect.py index 2535b71..f7f9a80 100644 --- a/src/rom24/commands/do_disconnect.py +++ b/src/rom24/commands/do_disconnect.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import comm -import game_utils -import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import comm +from rom24 import game_utils +from rom24 import handler_game def do_disconnect(ch, argument): diff --git a/src/rom24/commands/do_down.py b/src/rom24/commands/do_down.py index 9118aa3..7a6cb72 100644 --- a/src/rom24/commands/do_down.py +++ b/src/rom24/commands/do_down.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import handler_ch -import interp -import merc +from rom24 import handler_ch +from rom24 import interp +from rom24 import merc def do_down(ch, argument): handler_ch.move_char(ch, merc.DIR_DOWN, False) diff --git a/src/rom24/commands/do_drink.py b/src/rom24/commands/do_drink.py index 3cca5c9..7080c53 100644 --- a/src/rom24/commands/do_drink.py +++ b/src/rom24/commands/do_drink.py @@ -2,12 +2,12 @@ logger = logging.getLogger(__name__) -import merc -import const -import interp -import update -import game_utils -import handler_game +from rom24 import merc +from rom24 import const +from rom24 import interp +from rom24 import update +from rom24 import game_utils +from rom24 import handler_game def do_drink(ch, argument): diff --git a/src/rom24/commands/do_drop.py b/src/rom24/commands/do_drop.py index 2821105..e8f2e88 100644 --- a/src/rom24/commands/do_drop.py +++ b/src/rom24/commands/do_drop.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import object_creator -import handler_game -import merc -import interp -import game_utils +from rom24 import object_creator +from rom24 import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import game_utils def do_drop(ch, argument): diff --git a/src/rom24/commands/do_dump.py b/src/rom24/commands/do_dump.py index 82b4831..3b4c8fd 100644 --- a/src/rom24/commands/do_dump.py +++ b/src/rom24/commands/do_dump.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp #TODO: Known broken def do_dump(ch, argument): diff --git a/src/rom24/commands/do_east.py b/src/rom24/commands/do_east.py index 15b9862..751a162 100644 --- a/src/rom24/commands/do_east.py +++ b/src/rom24/commands/do_east.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import handler_ch -import interp -import merc +from rom24 import handler_ch +from rom24 import interp +from rom24 import merc def do_east(ch, argument): diff --git a/src/rom24/commands/do_eat.py b/src/rom24/commands/do_eat.py index 82a4579..1f755ea 100644 --- a/src/rom24/commands/do_eat.py +++ b/src/rom24/commands/do_eat.py @@ -2,12 +2,12 @@ logger = logging.getLogger(__name__) -import merc -import interp -import update -import game_utils -import handler_game -import handler_magic +from rom24 import merc +from rom24 import interp +from rom24 import update +from rom24 import game_utils +from rom24 import handler_game +from rom24 import handler_magic def do_eat(ch, argument): diff --git a/src/rom24/commands/do_echo.py b/src/rom24/commands/do_echo.py index c17c613..361c1dd 100644 --- a/src/rom24/commands/do_echo.py +++ b/src/rom24/commands/do_echo.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import nanny +from rom24 import merc +from rom24 import interp +from rom24 import nanny def do_echo(ch, argument): diff --git a/src/rom24/commands/do_emote.py b/src/rom24/commands/do_emote.py index 540bef2..92fdc3f 100644 --- a/src/rom24/commands/do_emote.py +++ b/src/rom24/commands/do_emote.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import handler_game -import merc -import interp +from rom24 import handler_game +from rom24 import merc +from rom24 import interp def do_emote(ch, argument): diff --git a/src/rom24/commands/do_enter.py b/src/rom24/commands/do_enter.py index baab472..0122d89 100644 --- a/src/rom24/commands/do_enter.py +++ b/src/rom24/commands/do_enter.py @@ -3,11 +3,11 @@ logger = logging.getLogger(__name__) -import handler_game -import merc -import interp -import handler_room -import state_checks +from rom24 import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import handler_room +from rom24 import state_checks # RT Enter portals diff --git a/src/rom24/commands/do_envenom.py b/src/rom24/commands/do_envenom.py index 7ea61b4..ad8fedf 100644 --- a/src/rom24/commands/do_envenom.py +++ b/src/rom24/commands/do_envenom.py @@ -3,11 +3,11 @@ logger = logging.getLogger(__name__) import random -import merc -import interp -import const -import handler_game -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import const +from rom24 import handler_game +from rom24 import state_checks # for poisoning weapons and food/drink @@ -33,13 +33,13 @@ def do_envenom(ch, argument): handler_game.act("You treat $p with deadly poison.", ch, item, None, merc.TO_CHAR) if not item.value[3]: item.value[3] = 1 - if ch.is_pc(): + if ch.is_pc: ch.check_improve( "envenom", True, 4) state_checks.WAIT_STATE(ch, const.skill_table["envenom"].beats) return handler_game.act("You fail to poison $p.", ch, item, None, merc.TO_CHAR) if not item.value[3]: - if ch.is_pc(): + if ch.is_pc: ch.check_improve( "envenom", False, 4) state_checks.WAIT_STATE(ch, const.skill_table["envenom"].beats) return @@ -68,13 +68,13 @@ def do_envenom(ch, argument): handler_game.act("$n coats $p with deadly venom.", ch, item, None, merc.TO_ROOM) handler_game.act("You coat $p with venom.", ch, item, None, merc.TO_CHAR) - if ch.is_pc(): + if ch.is_pc: ch.check_improve( "envenom", True, 3) state_checks.WAIT_STATE(ch, const.skill_table["envenom"].beats) return else: handler_game.act("You fail to envenom $p.", ch, item, None, merc.TO_CHAR) - if ch.is_pc(): + if ch.is_pc: ch.check_improve("envenom", False, 3) state_checks.WAIT_STATE(ch, const.skill_table["envenom"].beats) return diff --git a/src/rom24/commands/do_equipment.py b/src/rom24/commands/do_equipment.py index 56a1c90..a7d4168 100644 --- a/src/rom24/commands/do_equipment.py +++ b/src/rom24/commands/do_equipment.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import handler_item +from rom24 import merc +from rom24 import interp +from rom24 import handler_item def do_equipment(ch, argument): diff --git a/src/rom24/commands/do_examine.py b/src/rom24/commands/do_examine.py index 683bedd..1b985f0 100644 --- a/src/rom24/commands/do_examine.py +++ b/src/rom24/commands/do_examine.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils +from rom24 import merc +from rom24 import interp +from rom24 import game_utils def do_examine(ch, argument): diff --git a/src/rom24/commands/do_exits.py b/src/rom24/commands/do_exits.py index 9a5e1dc..48c4eab 100644 --- a/src/rom24/commands/do_exits.py +++ b/src/rom24/commands/do_exits.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import instance +from rom24 import merc +from rom24 import interp +from rom24 import instance # Thanks to Zrin for auto-exit part. diff --git a/src/rom24/commands/do_fill.py b/src/rom24/commands/do_fill.py index cd3ae17..752f5c0 100644 --- a/src/rom24/commands/do_fill.py +++ b/src/rom24/commands/do_fill.py @@ -2,12 +2,12 @@ logger = logging.getLogger(__name__) -import merc -import const -import interp -import game_utils -import handler_game -import instance +from rom24 import merc +from rom24 import const +from rom24 import interp +from rom24 import game_utils +from rom24 import handler_game +from rom24 import instance def do_fill(ch, argument): diff --git a/src/rom24/commands/do_flags.py b/src/rom24/commands/do_flags.py index 4a8cf0f..642dc0d 100644 --- a/src/rom24/commands/do_flags.py +++ b/src/rom24/commands/do_flags.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import interp -import merc -import game_utils -import tables +from rom24 import interp +from rom24 import merc +from rom24 import game_utils +from rom24 import tables __author__ = 'venom' diff --git a/src/rom24/commands/do_flee.py b/src/rom24/commands/do_flee.py index 7bc84d6..d588002 100644 --- a/src/rom24/commands/do_flee.py +++ b/src/rom24/commands/do_flee.py @@ -3,15 +3,15 @@ logger = logging.getLogger(__name__) -import handler_game -import handler_room -import handler_ch -import state_checks -import merc -import interp -import fight -import update -import instance +from rom24 import handler_game +from rom24 import handler_room +from rom24 import handler_ch +from rom24 import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import fight +from rom24 import update +from rom24 import instance def do_flee( ch, argument ): diff --git a/src/rom24/commands/do_follow.py b/src/rom24/commands/do_follow.py index 7d5f011..86d0425 100644 --- a/src/rom24/commands/do_follow.py +++ b/src/rom24/commands/do_follow.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import handler_ch -import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import handler_ch +from rom24 import handler_game def do_follow(ch, argument): diff --git a/src/rom24/commands/do_force.py b/src/rom24/commands/do_force.py index 56d2d4b..32e20f0 100644 --- a/src/rom24/commands/do_force.py +++ b/src/rom24/commands/do_force.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import handler_game -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import handler_game +from rom24 import state_checks # Thanks to Grodyn for pointing out bugs in this function. diff --git a/src/rom24/commands/do_freeze.py b/src/rom24/commands/do_freeze.py index 3604e56..9b6ebaf 100644 --- a/src/rom24/commands/do_freeze.py +++ b/src/rom24/commands/do_freeze.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import handler_game -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import handler_game +from rom24 import state_checks def do_freeze(ch, argument): diff --git a/src/rom24/commands/do_freset.py b/src/rom24/commands/do_freset.py index cda92d7..6eff5a1 100644 --- a/src/rom24/commands/do_freset.py +++ b/src/rom24/commands/do_freset.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import db +from rom24 import merc +from rom24 import interp +from rom24 import db def do_freset(ch, argument): diff --git a/src/rom24/commands/do_gain.py b/src/rom24/commands/do_gain.py index 15e3e4a..02c7bd9 100644 --- a/src/rom24/commands/do_gain.py +++ b/src/rom24/commands/do_gain.py @@ -2,13 +2,13 @@ logger = logging.getLogger(__name__) -import merc -import interp -import skills -import const -import magic -import game_utils -import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import skills +from rom24 import const +from rom24 import magic +from rom24 import game_utils +from rom24 import handler_game #TODO: Known broken. Probably needs some significant cleanup, doesn't appear to be granting skills properly. Needs more testing with non-immortal characters. def do_gain(ch, argument): diff --git a/src/rom24/commands/do_gdstate.py b/src/rom24/commands/do_gdstate.py deleted file mode 100644 index e46d530..0000000 --- a/src/rom24/commands/do_gdstate.py +++ /dev/null @@ -1,36 +0,0 @@ -__author__ = 'syn' -import logging - -logger = logging.getLogger(__name__) - -import interp -import merc -import handler_log -import game_utils - - -def do_gdstate(ch, argument): - if ch.level <= merc.ML -1: - ch.send("Huh?\n\n") - - if not argument: - ch.send("This command allows global debug mode for commands. " - "gdebug to turn on, gdebug to turn off.\n\n") - return - - word, arg = game_utils.read_word(argument) - - if arg.startswith('enable'): - handler_log.GlobalDebugFlag.gdcfset(True) - ch.send("Global Debug enabled.\n\n") - return - - elif arg.startswith('disable'): - handler_log.GlobalDebugFlag.gdcfset(False) - ch.send("Global Debug disabled. debug (command) will still function.\n\n") - return - else: - ch.send("accepted arguments: enable or disable\n") - return - -interp.register_command(interp.cmd_type('gdebug', do_gdstate, merc.POS_DEAD, merc.ML, merc.LOG_ALWAYS, 1)) diff --git a/src/rom24/commands/do_get.py b/src/rom24/commands/do_get.py index 681db07..2a6b136 100644 --- a/src/rom24/commands/do_get.py +++ b/src/rom24/commands/do_get.py @@ -2,12 +2,12 @@ logger = logging.getLogger(__name__) -import handler_game -import merc -import interp -import game_utils -import handler_item -import state_checks +from rom24 import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import handler_item +from rom24 import state_checks def do_get(ch, argument): diff --git a/src/rom24/commands/do_give.py b/src/rom24/commands/do_give.py index 8d193c7..230992f 100644 --- a/src/rom24/commands/do_give.py +++ b/src/rom24/commands/do_give.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import handler_game -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import handler_game +from rom24 import state_checks def do_give(ch, argument): diff --git a/src/rom24/commands/do_gossip.py b/src/rom24/commands/do_gossip.py index 78836eb..4e2e3c0 100644 --- a/src/rom24/commands/do_gossip.py +++ b/src/rom24/commands/do_gossip.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import nanny -import handler_ch -import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import nanny +from rom24 import handler_ch +from rom24 import handler_game # RT chat replaced with ROM gossip diff --git a/src/rom24/commands/do_goto.py b/src/rom24/commands/do_goto.py index 7d3c6dd..7c7dc4e 100644 --- a/src/rom24/commands/do_goto.py +++ b/src/rom24/commands/do_goto.py @@ -2,12 +2,12 @@ logger = logging.getLogger(__name__) -import handler_game -import merc -import interp -import fight -import game_utils -import instance +from rom24 import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import fight +from rom24 import game_utils +from rom24 import instance def do_goto(ch, argument): diff --git a/src/rom24/commands/do_grats.py b/src/rom24/commands/do_grats.py index ba6e03d..6630c5c 100644 --- a/src/rom24/commands/do_grats.py +++ b/src/rom24/commands/do_grats.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import nanny -import handler_ch -import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import nanny +from rom24 import handler_ch +from rom24 import handler_game def do_grats(ch, argument): diff --git a/src/rom24/commands/do_group.py b/src/rom24/commands/do_group.py index f2be8b9..6399c50 100644 --- a/src/rom24/commands/do_group.py +++ b/src/rom24/commands/do_group.py @@ -2,12 +2,12 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import state_checks -import handler_game -import instance +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import state_checks +from rom24 import handler_game +from rom24 import instance def do_group(ch, argument): diff --git a/src/rom24/commands/do_groups.py b/src/rom24/commands/do_groups.py index f70fed2..87f708a 100644 --- a/src/rom24/commands/do_groups.py +++ b/src/rom24/commands/do_groups.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import const -import interp +from rom24 import merc +from rom24 import const +from rom24 import interp def do_groups(ch, argument): diff --git a/src/rom24/commands/do_gtell.py b/src/rom24/commands/do_gtell.py index d0a7925..201e60f 100644 --- a/src/rom24/commands/do_gtell.py +++ b/src/rom24/commands/do_gtell.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import merc -import interp -import handler_game -import instance +from rom24 import merc +from rom24 import interp +from rom24 import handler_game +from rom24 import instance def do_gtell(ch, argument): diff --git a/src/rom24/commands/do_guild.py b/src/rom24/commands/do_guild.py index f2bd5c2..f3fae49 100644 --- a/src/rom24/commands/do_guild.py +++ b/src/rom24/commands/do_guild.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import tables -import game_utils -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import tables +from rom24 import game_utils +from rom24 import state_checks def do_guild(ch, argument): diff --git a/src/rom24/commands/do_heal.py b/src/rom24/commands/do_heal.py index ab6f1a5..df8994a 100644 --- a/src/rom24/commands/do_heal.py +++ b/src/rom24/commands/do_heal.py @@ -3,13 +3,13 @@ logger = logging.getLogger(__name__) -import game_utils -import handler_game -import state_checks -import const -import merc -import interp -import instance +from rom24 import game_utils +from rom24 import handler_game +from rom24 import state_checks +from rom24 import const +from rom24 import merc +from rom24 import interp +from rom24 import instance def do_heal(ch, argument): diff --git a/src/rom24/commands/do_help.py b/src/rom24/commands/do_help.py index 3a85f47..bb72c98 100644 --- a/src/rom24/commands/do_help.py +++ b/src/rom24/commands/do_help.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import nanny +from rom24 import merc +from rom24 import interp +from rom24 import nanny def do_help(ch, argument): diff --git a/src/rom24/commands/do_hide.py b/src/rom24/commands/do_hide.py index 3357d3c..0e1f489 100644 --- a/src/rom24/commands/do_hide.py +++ b/src/rom24/commands/do_hide.py @@ -3,8 +3,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp def do_hide(ch, argument): @@ -15,10 +15,10 @@ def do_hide(ch, argument): if random.randint(1, 99) < ch.get_skill("hide"): ch.affected_by.set_bit(merc.AFF_HIDE) - if ch.is_pc(): + if ch.is_pc: ch.check_improve( "hide", True, 3) else: - if ch.is_pc(): + if ch.is_pc: ch.check_improve( "hide", False, 3) return diff --git a/src/rom24/commands/do_holylight.py b/src/rom24/commands/do_holylight.py index 376e9d9..123396e 100644 --- a/src/rom24/commands/do_holylight.py +++ b/src/rom24/commands/do_holylight.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp def do_holylight(ch, argument): diff --git a/src/rom24/commands/do_immtalk.py b/src/rom24/commands/do_immtalk.py index 3338e07..83d7a9a 100644 --- a/src/rom24/commands/do_immtalk.py +++ b/src/rom24/commands/do_immtalk.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import nanny -import state_checks -import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import nanny +from rom24 import state_checks +from rom24 import handler_game def do_immtalk(ch, argument): diff --git a/src/rom24/commands/do_incognito.py b/src/rom24/commands/do_incognito.py index 4853234..9d0d1af 100644 --- a/src/rom24/commands/do_incognito.py +++ b/src/rom24/commands/do_incognito.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import handler_game def do_incognito(ch, argument): diff --git a/src/rom24/commands/do_inventory.py b/src/rom24/commands/do_inventory.py index 0c0109a..e87e63f 100644 --- a/src/rom24/commands/do_inventory.py +++ b/src/rom24/commands/do_inventory.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import handler_ch +from rom24 import merc +from rom24 import interp +from rom24 import handler_ch def do_inventory(ch, argument): diff --git a/src/rom24/commands/do_invis.py b/src/rom24/commands/do_invis.py index 9564b47..fc3bc90 100644 --- a/src/rom24/commands/do_invis.py +++ b/src/rom24/commands/do_invis.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import handler_game # New routines by Dionysos. def do_invis(ch, argument): diff --git a/src/rom24/commands/do_kick.py b/src/rom24/commands/do_kick.py index e001ff0..ac094d4 100644 --- a/src/rom24/commands/do_kick.py +++ b/src/rom24/commands/do_kick.py @@ -3,11 +3,11 @@ logger = logging.getLogger(__name__) -import state_checks -import merc -import fight -import const -import interp +from rom24 import state_checks +from rom24 import merc +from rom24 import fight +from rom24 import const +from rom24 import interp def do_kick(ch, argument): @@ -24,11 +24,11 @@ def do_kick(ch, argument): state_checks.WAIT_STATE(ch, const.skill_table['kick'].beats) if ch.get_skill('kick') > random.randint(1, 99): fight.damage(ch, victim, random.randint(1, ch.level), 'kick', merc.DAM_BASH, True) - if ch.is_pc(): + if ch.is_pc: ch.check_improve( 'kick', True, 1) else: fight.damage(ch, victim, 0, 'kick', merc.DAM_BASH, True) - if ch.is_pc(): + if ch.is_pc: ch.check_improve( 'kick', False, 1) fight.check_killer(ch, victim) return diff --git a/src/rom24/commands/do_kill.py b/src/rom24/commands/do_kill.py index 1b5825c..c95cae8 100644 --- a/src/rom24/commands/do_kill.py +++ b/src/rom24/commands/do_kill.py @@ -2,12 +2,12 @@ logger = logging.getLogger(__name__) -import merc -import fight -import interp -import game_utils -import state_checks -import handler_game +from rom24 import merc +from rom24 import fight +from rom24 import interp +from rom24 import game_utils +from rom24 import state_checks +from rom24 import handler_game def do_kill(ch, argument): diff --git a/src/rom24/commands/do_list.py b/src/rom24/commands/do_list.py index 58ca85e..0f97c7e 100644 --- a/src/rom24/commands/do_list.py +++ b/src/rom24/commands/do_list.py @@ -2,14 +2,14 @@ logger = logging.getLogger(__name__) -import game_utils -import shop_utils -import state_checks +from rom24 import game_utils +from rom24 import shop_utils +from rom24 import state_checks import collections -import merc -import handler_room -import interp -import instance +from rom24 import merc +from rom24 import handler_room +from rom24 import interp +from rom24 import instance def do_list(ch, argument): diff --git a/src/rom24/commands/do_load.py b/src/rom24/commands/do_load.py index 3ffbc48..a0afac1 100644 --- a/src/rom24/commands/do_load.py +++ b/src/rom24/commands/do_load.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils +from rom24 import merc +from rom24 import interp +from rom24 import game_utils # RT to replace the two load commands def do_load(ch, argument): diff --git a/src/rom24/commands/do_lock.py b/src/rom24/commands/do_lock.py index 389c1f7..a7198e9 100644 --- a/src/rom24/commands/do_lock.py +++ b/src/rom24/commands/do_lock.py @@ -2,12 +2,12 @@ logger = logging.getLogger(__name__) -import game_utils -import handler_game -import handler_room -import interp -import merc -import state_checks +from rom24 import game_utils +from rom24 import handler_game +from rom24 import handler_room +from rom24 import interp +from rom24 import merc +from rom24 import state_checks def do_lock(ch, argument): diff --git a/src/rom24/commands/do_log.py b/src/rom24/commands/do_log.py index 8f34c7e..6915924 100644 --- a/src/rom24/commands/do_log.py +++ b/src/rom24/commands/do_log.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import state_checks def do_log(ch, argument): diff --git a/src/rom24/commands/do_look.py b/src/rom24/commands/do_look.py index 6d61256..da4356b 100644 --- a/src/rom24/commands/do_look.py +++ b/src/rom24/commands/do_look.py @@ -2,14 +2,14 @@ logger = logging.getLogger(__name__) -import merc -import game_utils -import handler_ch -import handler_game -import state_checks -import interp -import const -import instance +from rom24 import merc +from rom24 import game_utils +from rom24 import handler_ch +from rom24 import handler_game +from rom24 import state_checks +from rom24 import interp +from rom24 import const +from rom24 import instance def do_look(ch, argument): @@ -89,8 +89,7 @@ def do_look(ch, argument): if victim: handler_ch.show_char_to_char_1(victim, ch) return - item_list = ch.items - item_list.extend(room.items) + item_list = list(ch.items) + list(room.items) for obj_id in item_list: item = instance.items[obj_id] if ch.can_see_item(item): diff --git a/src/rom24/commands/do_memory.py b/src/rom24/commands/do_memory.py index 2a4d567..609b7c7 100644 --- a/src/rom24/commands/do_memory.py +++ b/src/rom24/commands/do_memory.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp #TODO: Known broken. def do_memory(ch, argument): diff --git a/src/rom24/commands/do_mfind.py b/src/rom24/commands/do_mfind.py index 2ef9373..9063d47 100644 --- a/src/rom24/commands/do_mfind.py +++ b/src/rom24/commands/do_mfind.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import instance +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import instance def do_mfind(ch, argument): diff --git a/src/rom24/commands/do_mload.py b/src/rom24/commands/do_mload.py index e702019..be98ab3 100644 --- a/src/rom24/commands/do_mload.py +++ b/src/rom24/commands/do_mload.py @@ -2,12 +2,12 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import handler_game -import object_creator -import instance +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import handler_game +from rom24 import object_creator +from rom24 import instance def do_mload(ch, argument): diff --git a/src/rom24/commands/do_mset.py b/src/rom24/commands/do_mset.py index 0a25307..6efe34f 100644 --- a/src/rom24/commands/do_mset.py +++ b/src/rom24/commands/do_mset.py @@ -2,12 +2,12 @@ logger = logging.getLogger(__name__) -import merc -import const -import interp -import tables -import game_utils -import state_checks +from rom24 import merc +from rom24 import const +from rom24 import interp +from rom24 import tables +from rom24 import game_utils +from rom24 import state_checks def do_mset(ch, argument): argument, arg1 = game_utils.read_word(argument) diff --git a/src/rom24/commands/do_mstat.py b/src/rom24/commands/do_mstat.py index 1f56d4c..8ec04fb 100644 --- a/src/rom24/commands/do_mstat.py +++ b/src/rom24/commands/do_mstat.py @@ -3,12 +3,12 @@ logger = logging.getLogger(__name__) -import merc -import interp -import tables -import const -import game_utils -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import tables +from rom24 import const +from rom24 import game_utils +from rom24 import state_checks def do_mstat(ch, argument): diff --git a/src/rom24/commands/do_murder.py b/src/rom24/commands/do_murder.py index 84eb878..3b82263 100644 --- a/src/rom24/commands/do_murder.py +++ b/src/rom24/commands/do_murder.py @@ -2,12 +2,12 @@ logger = logging.getLogger(__name__) -import merc -import interp -import fight -import game_utils -import handler_game -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import fight +from rom24 import game_utils +from rom24 import handler_game +from rom24 import state_checks def do_murder(ch, argument): diff --git a/src/rom24/commands/do_music.py b/src/rom24/commands/do_music.py index b20fec0..4ca4b6a 100644 --- a/src/rom24/commands/do_music.py +++ b/src/rom24/commands/do_music.py @@ -2,12 +2,12 @@ logger = logging.getLogger(__name__) -import merc -import interp -import nanny -import handler_ch -import handler_game -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import nanny +from rom24 import handler_ch +from rom24 import handler_game +from rom24 import state_checks # RT music channel diff --git a/src/rom24/commands/do_mwhere.py b/src/rom24/commands/do_mwhere.py index 389fb83..d1380cc 100644 --- a/src/rom24/commands/do_mwhere.py +++ b/src/rom24/commands/do_mwhere.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import handler_game -import merc -import interp -import nanny -import instance +from rom24 import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import nanny +from rom24 import instance def do_mwhere(ch, argument): diff --git a/src/rom24/commands/do_newlock.py b/src/rom24/commands/do_newlock.py index 8db4d06..4ba9f60 100644 --- a/src/rom24/commands/do_newlock.py +++ b/src/rom24/commands/do_newlock.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import merc -import interp -import settings -import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import settings +from rom24 import handler_game # RT anti-newbie code def do_newlock(ch, argument): diff --git a/src/rom24/commands/do_nochannels.py b/src/rom24/commands/do_nochannels.py index 87402b9..300d229 100644 --- a/src/rom24/commands/do_nochannels.py +++ b/src/rom24/commands/do_nochannels.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import handler_game -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import handler_game +from rom24 import state_checks # RT nochannels command, for those spammers diff --git a/src/rom24/commands/do_noemote.py b/src/rom24/commands/do_noemote.py index 0c51821..3df3ba4 100644 --- a/src/rom24/commands/do_noemote.py +++ b/src/rom24/commands/do_noemote.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import handler_game -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import handler_game +from rom24 import state_checks def do_noemote(ch, argument): diff --git a/src/rom24/commands/do_nofollow.py b/src/rom24/commands/do_nofollow.py index 15c9408..e337530 100644 --- a/src/rom24/commands/do_nofollow.py +++ b/src/rom24/commands/do_nofollow.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import handler_ch +from rom24 import merc +from rom24 import interp +from rom24 import handler_ch def do_nofollow(ch, argument): diff --git a/src/rom24/commands/do_noloot.py b/src/rom24/commands/do_noloot.py index da484af..0703116 100644 --- a/src/rom24/commands/do_noloot.py +++ b/src/rom24/commands/do_noloot.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp def do_noloot(ch, argument): diff --git a/src/rom24/commands/do_north.py b/src/rom24/commands/do_north.py index 0bcfd26..62a5efc 100644 --- a/src/rom24/commands/do_north.py +++ b/src/rom24/commands/do_north.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import handler_ch -import interp -import merc +from rom24 import handler_ch +from rom24 import interp +from rom24 import merc def do_north(ch, argument): diff --git a/src/rom24/commands/do_noshout.py b/src/rom24/commands/do_noshout.py index 750bba4..f32f6de 100644 --- a/src/rom24/commands/do_noshout.py +++ b/src/rom24/commands/do_noshout.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import handler_game -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import handler_game +from rom24 import state_checks def do_noshout(ch, argument): argument, arg = game_utils.read_word(argument) diff --git a/src/rom24/commands/do_nosummon.py b/src/rom24/commands/do_nosummon.py index 74d9ecd..1c0d81b 100644 --- a/src/rom24/commands/do_nosummon.py +++ b/src/rom24/commands/do_nosummon.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import state_checks def do_nosummon(ch, argument): if ch.is_npc(): diff --git a/src/rom24/commands/do_notell.py b/src/rom24/commands/do_notell.py index b57e4dd..5fa6b53 100644 --- a/src/rom24/commands/do_notell.py +++ b/src/rom24/commands/do_notell.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import handler_game -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import handler_game +from rom24 import state_checks def do_notell(ch, argument): diff --git a/src/rom24/commands/do_ofind.py b/src/rom24/commands/do_ofind.py index 136f95b..5a3d45a 100644 --- a/src/rom24/commands/do_ofind.py +++ b/src/rom24/commands/do_ofind.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import instance +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import instance def do_ofind(ch, argument): diff --git a/src/rom24/commands/do_oload.py b/src/rom24/commands/do_oload.py index 7d810d3..5ee9ec9 100644 --- a/src/rom24/commands/do_oload.py +++ b/src/rom24/commands/do_oload.py @@ -2,12 +2,12 @@ logger = logging.getLogger(__name__) -import merc -import object_creator -import interp -import game_utils -import handler_game -import instance +from rom24 import merc +from rom24 import object_creator +from rom24 import interp +from rom24 import game_utils +from rom24 import handler_game +from rom24 import instance def do_oload(ch, argument): diff --git a/src/rom24/commands/do_omni.py b/src/rom24/commands/do_omni.py index 4edc934..74e28c8 100644 --- a/src/rom24/commands/do_omni.py +++ b/src/rom24/commands/do_omni.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp def do_omni(ch, argument): diff --git a/src/rom24/commands/do_open.py b/src/rom24/commands/do_open.py index 95f0180..6768190 100644 --- a/src/rom24/commands/do_open.py +++ b/src/rom24/commands/do_open.py @@ -2,12 +2,12 @@ logger = logging.getLogger(__name__) -import interp -import merc -import game_utils -import handler_game -import handler_room -import state_checks +from rom24 import interp +from rom24 import merc +from rom24 import game_utils +from rom24 import handler_game +from rom24 import handler_room +from rom24 import state_checks def do_open(ch, argument): diff --git a/src/rom24/commands/do_order.py b/src/rom24/commands/do_order.py index 0a7520f..e76a30f 100644 --- a/src/rom24/commands/do_order.py +++ b/src/rom24/commands/do_order.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import handler_game -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import handler_game +from rom24 import state_checks def do_order(ch, argument): diff --git a/src/rom24/commands/do_oset.py b/src/rom24/commands/do_oset.py index 562e7ef..19ceeae 100644 --- a/src/rom24/commands/do_oset.py +++ b/src/rom24/commands/do_oset.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils +from rom24 import merc +from rom24 import interp +from rom24 import game_utils def do_oset(ch, argument): argument, arg1 = game_utils.read_word(argument) diff --git a/src/rom24/commands/do_ostat.py b/src/rom24/commands/do_ostat.py index 36b4399..a281eb8 100644 --- a/src/rom24/commands/do_ostat.py +++ b/src/rom24/commands/do_ostat.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import game_utils -import merc -import const -import interp +from rom24 import game_utils +from rom24 import merc +from rom24 import const +from rom24 import interp def do_ostat(ch, argument): diff --git a/src/rom24/commands/do_outfit.py b/src/rom24/commands/do_outfit.py index aa416fa..d23bdeb 100644 --- a/src/rom24/commands/do_outfit.py +++ b/src/rom24/commands/do_outfit.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import const -import object_creator -import instance +from rom24 import merc +from rom24 import interp +from rom24 import const +from rom24 import object_creator +from rom24 import instance # equips a character diff --git a/src/rom24/commands/do_owhere.py b/src/rom24/commands/do_owhere.py index 4353060..a013aa1 100644 --- a/src/rom24/commands/do_owhere.py +++ b/src/rom24/commands/do_owhere.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import state_checks -import instance +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import state_checks +from rom24 import instance def do_owhere(ch, argument): diff --git a/src/rom24/commands/do_pardon.py b/src/rom24/commands/do_pardon.py index fe90778..9d11d9a 100644 --- a/src/rom24/commands/do_pardon.py +++ b/src/rom24/commands/do_pardon.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils +from rom24 import merc +from rom24 import interp +from rom24 import game_utils def do_pardon(ch, argument): diff --git a/src/rom24/commands/do_password.py b/src/rom24/commands/do_password.py index 0d141fb..b34f750 100644 --- a/src/rom24/commands/do_password.py +++ b/src/rom24/commands/do_password.py @@ -3,11 +3,11 @@ logger = logging.getLogger(__name__) -import game_utils -import state_checks -import merc -import interp -import settings +from rom24 import game_utils +from rom24 import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import settings def do_password(ch, argument): diff --git a/src/rom24/commands/do_peace.py b/src/rom24/commands/do_peace.py index 346b004..0550d10 100644 --- a/src/rom24/commands/do_peace.py +++ b/src/rom24/commands/do_peace.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import fight -import interp -import state_checks -import instance +from rom24 import merc +from rom24 import fight +from rom24 import interp +from rom24 import state_checks +from rom24 import instance def do_peace(ch, argument): diff --git a/src/rom24/commands/do_pecho.py b/src/rom24/commands/do_pecho.py index e4f84de..cada739 100644 --- a/src/rom24/commands/do_pecho.py +++ b/src/rom24/commands/do_pecho.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils +from rom24 import merc +from rom24 import interp +from rom24 import game_utils def do_pecho(ch, argument): diff --git a/src/rom24/commands/do_pick.py b/src/rom24/commands/do_pick.py index 6aaf75b..a9eca6b 100644 --- a/src/rom24/commands/do_pick.py +++ b/src/rom24/commands/do_pick.py @@ -3,13 +3,13 @@ logger = logging.getLogger(__name__) -import interp -import merc -import const -import game_utils -import handler_game -import handler_room -import state_checks +from rom24 import interp +from rom24 import merc +from rom24 import const +from rom24 import game_utils +from rom24 import handler_game +from rom24 import handler_room +from rom24 import state_checks def do_pick(self, argument): @@ -30,7 +30,7 @@ def do_pick(self, argument): return if not ch.is_npc() and random.randint(1, 99) > ch.get_skill("pick lock"): ch.send("You failed.\n") - if ch.is_pc(): + if ch.is_pc: ch.check_improve( "pick lock", False, 2) return obj = ch.get_item_here(arg) @@ -52,7 +52,7 @@ def do_pick(self, argument): state_checks.REMOVE_BIT(obj.value[1], merc.EX_LOCKED) handler_game.act("You pick the lock on $p.", ch, obj, None, merc.TO_CHAR) handler_game.act("$n picks the lock on $p.", ch, obj, None, merc.TO_ROOM) - if ch.is_pc(): + if ch.is_pc: ch.check_improve( "pick lock", True, 2) return @@ -77,7 +77,7 @@ def do_pick(self, argument): state_checks.REMOVE_BIT(obj.value[1], merc.CONT_LOCKED) handler_game.act("You pick the lock on $p.", ch, obj, None, merc.TO_CHAR) handler_game.act("$n picks the lock on $p.", ch, obj, None, merc.TO_ROOM) - if ch.is_pc(): + if ch.is_pc: ch.check_improve( "pick lock", True, 2) return door = handler_room.find_door(ch, arg) @@ -99,7 +99,7 @@ def do_pick(self, argument): pexit.exit_info.rem_bit(merc.EX_LOCKED) ch.send("*Click*\n") handler_game.act("$n picks the $d.", ch, None, pexit.keyword, merc.TO_ROOM) - if ch.is_pc(): + if ch.is_pc: ch.check_improve( "pick_lock", True, 2) # unlock the other side diff --git a/src/rom24/commands/do_pmote.py b/src/rom24/commands/do_pmote.py index 53bdbcb..0470162 100644 --- a/src/rom24/commands/do_pmote.py +++ b/src/rom24/commands/do_pmote.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import handler_game -import merc -import interp -import game_utils -import instance +from rom24 import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import instance def do_pmote(ch, argument): diff --git a/src/rom24/commands/do_pose.py b/src/rom24/commands/do_pose.py index 8634c73..b52e002 100644 --- a/src/rom24/commands/do_pose.py +++ b/src/rom24/commands/do_pose.py @@ -3,9 +3,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import handler_game # All the posing stuff. diff --git a/src/rom24/commands/do_pour.py b/src/rom24/commands/do_pour.py index b8009d7..8680275 100644 --- a/src/rom24/commands/do_pour.py +++ b/src/rom24/commands/do_pour.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import const -import interp -import game_utils -import handler_game +from rom24 import merc +from rom24 import const +from rom24 import interp +from rom24 import game_utils +from rom24 import handler_game def do_pour(ch, argument): diff --git a/src/rom24/commands/do_practice.py b/src/rom24/commands/do_practice.py index 83e19c5..bc10846 100644 --- a/src/rom24/commands/do_practice.py +++ b/src/rom24/commands/do_practice.py @@ -2,12 +2,12 @@ logger = logging.getLogger(__name__) -import game_utils -import handler_game -import merc -import interp -import const -import state_checks +from rom24 import game_utils +from rom24 import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import const +from rom24 import state_checks def do_practice(ch, argument): diff --git a/src/rom24/commands/do_prefix.py b/src/rom24/commands/do_prefix.py index cf8f285..bd4b181 100644 --- a/src/rom24/commands/do_prefix.py +++ b/src/rom24/commands/do_prefix.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp def do_prefix(ch, argument): diff --git a/src/rom24/commands/do_prompt.py b/src/rom24/commands/do_prompt.py index 5239a80..99767bc 100644 --- a/src/rom24/commands/do_prompt.py +++ b/src/rom24/commands/do_prompt.py @@ -3,8 +3,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp def do_prompt(ch, argument): diff --git a/src/rom24/commands/do_protect.py b/src/rom24/commands/do_protect.py index 1149b40..95b0fd5 100644 --- a/src/rom24/commands/do_protect.py +++ b/src/rom24/commands/do_protect.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import merc -import interp -import state_checks -import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import state_checks +from rom24 import handler_game def do_protect(ch, argument): if not argument: diff --git a/src/rom24/commands/do_purge.py b/src/rom24/commands/do_purge.py index 1514940..6979e13 100644 --- a/src/rom24/commands/do_purge.py +++ b/src/rom24/commands/do_purge.py @@ -2,12 +2,12 @@ logger = logging.getLogger(__name__) -import handler_game -import merc -import comm -import interp -import game_utils -import state_checks +from rom24 import handler_game +from rom24 import merc +from rom24 import comm +from rom24 import interp +from rom24 import game_utils +from rom24 import state_checks def do_purge(ch, argument): argument, arg = game_utils.read_word(argument) diff --git a/src/rom24/commands/do_put.py b/src/rom24/commands/do_put.py index c1d4e7a..b4615c9 100644 --- a/src/rom24/commands/do_put.py +++ b/src/rom24/commands/do_put.py @@ -3,11 +3,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import handler_game -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import handler_game +from rom24 import state_checks def do_put(ch, argument): argument, arg1 = game_utils.read_word(argument) diff --git a/src/rom24/commands/do_quaff.py b/src/rom24/commands/do_quaff.py index 52a0ab9..d4263cd 100644 --- a/src/rom24/commands/do_quaff.py +++ b/src/rom24/commands/do_quaff.py @@ -3,11 +3,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import handler_game -import handler_magic +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import handler_game +from rom24 import handler_magic def do_quaff(ch, argument): argument, arg = game_utils.read_word(argument) diff --git a/src/rom24/commands/do_question.py b/src/rom24/commands/do_question.py index 2d0c31d..6bdf716 100644 --- a/src/rom24/commands/do_question.py +++ b/src/rom24/commands/do_question.py @@ -3,12 +3,12 @@ logger = logging.getLogger(__name__) -import merc -import interp -import nanny -import handler_ch -import handler_game -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import nanny +from rom24 import handler_ch +from rom24 import handler_game +from rom24 import state_checks # RT question channel def do_question(ch, argument): diff --git a/src/rom24/commands/do_quiet.py b/src/rom24/commands/do_quiet.py index fb1d795..40cbb69 100644 --- a/src/rom24/commands/do_quiet.py +++ b/src/rom24/commands/do_quiet.py @@ -3,8 +3,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp # RT quiet blocks out all communication def do_quiet(ch, argument): diff --git a/src/rom24/commands/do_quit.py b/src/rom24/commands/do_quit.py index 30f9d4f..70402d4 100644 --- a/src/rom24/commands/do_quit.py +++ b/src/rom24/commands/do_quit.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import comm -import handler_ch -import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import comm +from rom24 import handler_ch +from rom24 import handler_game def do_quit(ch, argument): diff --git a/src/rom24/commands/do_quote.py b/src/rom24/commands/do_quote.py index 4d72f06..d0cac6c 100644 --- a/src/rom24/commands/do_quote.py +++ b/src/rom24/commands/do_quote.py @@ -2,12 +2,12 @@ logger = logging.getLogger(__name__) -import merc -import interp -import nanny -import handler_ch -import handler_game -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import nanny +from rom24 import handler_ch +from rom24 import handler_game +from rom24 import state_checks def do_quote(ch, argument): diff --git a/src/rom24/commands/do_reboot.py b/src/rom24/commands/do_reboot.py index 482b935..9838219 100644 --- a/src/rom24/commands/do_reboot.py +++ b/src/rom24/commands/do_reboot.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import merc -import interp -import comm -import handler_ch +from rom24 import merc +from rom24 import interp +from rom24 import comm +from rom24 import handler_ch def do_reboot(ch, argument): if ch.invis_level < merc.LEVEL_HERO: diff --git a/src/rom24/commands/do_recall.py b/src/rom24/commands/do_recall.py index ec4023e..33d1a64 100644 --- a/src/rom24/commands/do_recall.py +++ b/src/rom24/commands/do_recall.py @@ -2,14 +2,14 @@ logger = logging.getLogger(__name__) -import handler_game -import interp -import merc +from rom24 import handler_game +from rom24 import interp +from rom24 import merc import random -import fight -import handler_room -import state_checks -import update +from rom24 import fight +from rom24 import handler_room +from rom24 import state_checks +from rom24 import update @@ -31,14 +31,14 @@ def do_recall(ch, argument): if victim: skill = ch.get_skill("recall") if random.randint(1, 99) < 80 * skill / 100: - if ch.is_pc(): + if ch.is_pc: ch.check_improve( "recall", False, 6) state_checks.WAIT_STATE(ch, 4) ch.send("You failed!.\n") return lose = 25 if ch.desc else 50 update.gain_exp(ch, 0 - lose) - if ch.is_pc(): + if ch.is_pc: ch.check_improve( "recall", True, 4) ch.send("You recall from combat! You lose %d exps.\n" % lose) fight.stop_fighting(ch, True) diff --git a/src/rom24/commands/do_recho.py b/src/rom24/commands/do_recho.py index a4ef2b0..b7192b4 100644 --- a/src/rom24/commands/do_recho.py +++ b/src/rom24/commands/do_recho.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import nanny +from rom24 import merc +from rom24 import interp +from rom24 import nanny def do_recho(ch, argument): diff --git a/src/rom24/commands/do_recite.py b/src/rom24/commands/do_recite.py index c1770a9..2a9e3aa 100644 --- a/src/rom24/commands/do_recite.py +++ b/src/rom24/commands/do_recite.py @@ -3,11 +3,11 @@ logger = logging.getLogger(__name__) import random -import merc -import interp -import game_utils -import handler_game -import handler_magic +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import handler_game +from rom24 import handler_magic def do_recite(ch, argument): @@ -38,13 +38,13 @@ def do_recite(ch, argument): if random.randint(1, 99) >= 20 + ch.get_skill("scrolls") * 4 // 5: ch.send("You mispronounce a syllable.\n") - if ch.is_pc(): + if ch.is_pc: ch.check_improve( "scrolls", False, 2) else: handler_magic.obj_cast_spell(scroll.value[1], scroll.value[0], ch, victim, obj) handler_magic.obj_cast_spell(scroll.value[2], scroll.value[0], ch, victim, obj) handler_magic.obj_cast_spell(scroll.value[3], scroll.value[0], ch, victim, obj) - if ch.is_pc(): + if ch.is_pc: ch.check_improve( "scrolls", True, 2) scroll.extract() return diff --git a/src/rom24/commands/do_reload.py b/src/rom24/commands/do_reload.py index 449bd63..c2e958a 100644 --- a/src/rom24/commands/do_reload.py +++ b/src/rom24/commands/do_reload.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import hotfix -import interp +from rom24 import merc +from rom24 import hotfix +from rom24 import interp def do_reload(ch, argument): diff --git a/src/rom24/commands/do_remove.py b/src/rom24/commands/do_remove.py index 8f8b630..ea3c491 100644 --- a/src/rom24/commands/do_remove.py +++ b/src/rom24/commands/do_remove.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils +from rom24 import merc +from rom24 import interp +from rom24 import game_utils def do_remove(ch, argument): diff --git a/src/rom24/commands/do_rent.py b/src/rom24/commands/do_rent.py index 8c521e1..7d37b5f 100644 --- a/src/rom24/commands/do_rent.py +++ b/src/rom24/commands/do_rent.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp def do_rent(ch, argument): diff --git a/src/rom24/commands/do_replay.py b/src/rom24/commands/do_replay.py index 1c66823..9e408c7 100644 --- a/src/rom24/commands/do_replay.py +++ b/src/rom24/commands/do_replay.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp def do_replay(ch, argument): diff --git a/src/rom24/commands/do_reply.py b/src/rom24/commands/do_reply.py index 7cb16d9..9d3d54a 100644 --- a/src/rom24/commands/do_reply.py +++ b/src/rom24/commands/do_reply.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import merc -import interp -import handler_game -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import handler_game +from rom24 import state_checks def do_reply(ch, argument): diff --git a/src/rom24/commands/do_report.py b/src/rom24/commands/do_report.py index 1587444..bb3b5ac 100644 --- a/src/rom24/commands/do_report.py +++ b/src/rom24/commands/do_report.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import handler_game def do_report(ch, argument): diff --git a/src/rom24/commands/do_rescue.py b/src/rom24/commands/do_rescue.py index 914e20a..0c596a6 100644 --- a/src/rom24/commands/do_rescue.py +++ b/src/rom24/commands/do_rescue.py @@ -3,13 +3,13 @@ logger = logging.getLogger(__name__) -import merc -import const -import fight -import interp -import game_utils -import handler_game -import state_checks +from rom24 import merc +from rom24 import const +from rom24 import fight +from rom24 import interp +from rom24 import game_utils +from rom24 import handler_game +from rom24 import state_checks def do_rescue(ch, argument): @@ -41,13 +41,13 @@ def do_rescue(ch, argument): state_checks.WAIT_STATE(ch, const.skill_table['rescue'].beats) if random.randint(1, 99) > ch.get_skill('rescue'): ch.send("You fail the rescue.\n") - if ch.is_pc(): + if ch.is_pc: ch.check_improve( 'rescue', False, 1) return handler_game.act("You rescue $N!", ch, None, victim, merc.TO_CHAR) handler_game.act("$n rescues you!", ch, None, victim, merc.TO_VICT) handler_game.act("$n rescues $N!", ch, None, victim, merc.TO_NOTVICT) - if ch.is_pc(): + if ch.is_pc: ch.check_improve( 'rescue', True, 1) fight.stop_fighting(fch, False) diff --git a/src/rom24/commands/do_rest.py b/src/rom24/commands/do_rest.py index 5826660..83be0bb 100644 --- a/src/rom24/commands/do_rest.py +++ b/src/rom24/commands/do_rest.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import handler_game -import interp -import merc -import state_checks +from rom24 import handler_game +from rom24 import interp +from rom24 import merc +from rom24 import state_checks def do_rest(self, argument): diff --git a/src/rom24/commands/do_restore.py b/src/rom24/commands/do_restore.py index dfaa788..92c428f 100644 --- a/src/rom24/commands/do_restore.py +++ b/src/rom24/commands/do_restore.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import fight -import game_utils -import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import fight +from rom24 import game_utils +from rom24 import handler_game def do_restore(ch, argument): diff --git a/src/rom24/commands/do_return.py b/src/rom24/commands/do_return.py index f1496b6..937ecaa 100644 --- a/src/rom24/commands/do_return.py +++ b/src/rom24/commands/do_return.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import handler_game #TODO: Known broken. def do_return(ch, argument): diff --git a/src/rom24/commands/do_rstat.py b/src/rom24/commands/do_rstat.py index 40066a4..71891ff 100644 --- a/src/rom24/commands/do_rstat.py +++ b/src/rom24/commands/do_rstat.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import state_checks -import instance +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import state_checks +from rom24 import instance #TODO: Known broken. Exit flags or locks are messed up. def do_rstat(ch, argument): diff --git a/src/rom24/commands/do_sacrifice.py b/src/rom24/commands/do_sacrifice.py index 39b8da2..f288d4a 100644 --- a/src/rom24/commands/do_sacrifice.py +++ b/src/rom24/commands/do_sacrifice.py @@ -3,10 +3,10 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import handler_game def do_sacrifice(ch, argument): diff --git a/src/rom24/commands/do_save.py b/src/rom24/commands/do_save.py index bfd1371..50a149d 100644 --- a/src/rom24/commands/do_save.py +++ b/src/rom24/commands/do_save.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import state_checks def do_save(ch, argument): diff --git a/src/rom24/commands/do_say.py b/src/rom24/commands/do_say.py index df3a5d5..a2162dd 100644 --- a/src/rom24/commands/do_say.py +++ b/src/rom24/commands/do_say.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import merc -import interp -import pyprogs -from handler_game import act +from rom24 import merc +from rom24 import interp +from rom24 import pyprogs +from rom24.handler_game import act def do_say(ch, argument): if not argument: diff --git a/src/rom24/commands/do_score.py b/src/rom24/commands/do_score.py index 29cf81e..a4e1af4 100644 --- a/src/rom24/commands/do_score.py +++ b/src/rom24/commands/do_score.py @@ -3,9 +3,9 @@ logger = logging.getLogger(__name__) -import state_checks -import merc -import interp +from rom24 import state_checks +from rom24 import merc +from rom24 import interp def do_score(ch, argument): diff --git a/src/rom24/commands/do_scroll.py b/src/rom24/commands/do_scroll.py index b8235a3..dcc0c36 100644 --- a/src/rom24/commands/do_scroll.py +++ b/src/rom24/commands/do_scroll.py @@ -3,9 +3,9 @@ logger = logging.getLogger(__name__) # changes your scroll -import merc -import interp -import game_utils +from rom24 import merc +from rom24 import interp +from rom24 import game_utils #TODO: Known broken. Not this command, but the paging itself. def do_scroll(ch, argument): diff --git a/src/rom24/commands/do_sell.py b/src/rom24/commands/do_sell.py index 12b9554..51c67fe 100644 --- a/src/rom24/commands/do_sell.py +++ b/src/rom24/commands/do_sell.py @@ -3,11 +3,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import handler_game -import shop_utils +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import handler_game +from rom24 import shop_utils def do_sell(ch, argument): @@ -45,7 +45,7 @@ def do_sell(ch, argument): cost += item.cost // 2 * roll // 100 cost = min(cost, 95 * shop_utils.get_cost(keeper, item, True) // 100) cost = min(cost, (keeper.silver + 100 * keeper.gold)) - if ch.is_pc(): + if ch.is_pc: ch.check_improve( "haggle", True, 4) handler_game.act("You sell $p for %d silver and %d gold piece%s." % ( cost - (cost // 100) * 100, cost // 100, ("" if cost == 1 else "s")), ch, item, None, merc.TO_CHAR) diff --git a/src/rom24/commands/do_set.py b/src/rom24/commands/do_set.py index 87e9c36..3de0844 100644 --- a/src/rom24/commands/do_set.py +++ b/src/rom24/commands/do_set.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils +from rom24 import merc +from rom24 import interp +from rom24 import game_utils # RT set replaces sset, mset, oset, and rset diff --git a/src/rom24/commands/do_shout.py b/src/rom24/commands/do_shout.py index 56ff88c..7026fa4 100644 --- a/src/rom24/commands/do_shout.py +++ b/src/rom24/commands/do_shout.py @@ -3,12 +3,12 @@ logger = logging.getLogger(__name__) -import merc -import interp -import nanny -import handler_ch -import handler_game -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import nanny +from rom24 import handler_ch +from rom24 import handler_game +from rom24 import state_checks def do_shout(ch, argument): if not argument: diff --git a/src/rom24/commands/do_show.py b/src/rom24/commands/do_show.py index 1d690c6..ed4ee0c 100644 --- a/src/rom24/commands/do_show.py +++ b/src/rom24/commands/do_show.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp def do_show(ch, argument): diff --git a/src/rom24/commands/do_shutdown.py b/src/rom24/commands/do_shutdown.py index ddf9c6a..a181713 100644 --- a/src/rom24/commands/do_shutdown.py +++ b/src/rom24/commands/do_shutdown.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import comm -import handler_ch -import merc -import interp +from rom24 import comm +from rom24 import handler_ch +from rom24 import merc +from rom24 import interp def do_shutdown(ch, argument): diff --git a/src/rom24/commands/do_sit.py b/src/rom24/commands/do_sit.py index 5d5b3e4..fe27240 100644 --- a/src/rom24/commands/do_sit.py +++ b/src/rom24/commands/do_sit.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import handler_game -import interp -import merc -import state_checks +from rom24 import handler_game +from rom24 import interp +from rom24 import merc +from rom24 import state_checks def do_sit(ch, argument): obj = None diff --git a/src/rom24/commands/do_skills.py b/src/rom24/commands/do_skills.py index 72c37b8..539347c 100644 --- a/src/rom24/commands/do_skills.py +++ b/src/rom24/commands/do_skills.py @@ -3,10 +3,10 @@ logger = logging.getLogger(__name__) -import merc -import interp -import const -import game_utils +from rom24 import merc +from rom24 import interp +from rom24 import const +from rom24 import game_utils def do_skills(ch, argument): diff --git a/src/rom24/commands/do_slay.py b/src/rom24/commands/do_slay.py index ac680c9..5ab6b03 100644 --- a/src/rom24/commands/do_slay.py +++ b/src/rom24/commands/do_slay.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import fight -import game_utils -import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import fight +from rom24 import game_utils +from rom24 import handler_game def do_slay(ch, argument): diff --git a/src/rom24/commands/do_sleep.py b/src/rom24/commands/do_sleep.py index ac76a8c..0fa1374 100644 --- a/src/rom24/commands/do_sleep.py +++ b/src/rom24/commands/do_sleep.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import handler_game -import interp -import merc -import state_checks +from rom24 import handler_game +from rom24 import interp +from rom24 import merc +from rom24 import state_checks def do_sleep(ch, argument): diff --git a/src/rom24/commands/do_slookup.py b/src/rom24/commands/do_slookup.py index 4ac1e5b..adf0f37 100644 --- a/src/rom24/commands/do_slookup.py +++ b/src/rom24/commands/do_slookup.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import const -import interp -import game_utils -import state_checks +from rom24 import merc +from rom24 import const +from rom24 import interp +from rom24 import game_utils +from rom24 import state_checks def do_slookup(ch, argument): diff --git a/src/rom24/commands/do_smote.py b/src/rom24/commands/do_smote.py index 5058448..710b8a4 100644 --- a/src/rom24/commands/do_smote.py +++ b/src/rom24/commands/do_smote.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils +from rom24 import merc +from rom24 import interp +from rom24 import game_utils def do_smote(ch, argument): diff --git a/src/rom24/commands/do_sneak.py b/src/rom24/commands/do_sneak.py index dc1bad4..e218d42 100644 --- a/src/rom24/commands/do_sneak.py +++ b/src/rom24/commands/do_sneak.py @@ -4,9 +4,9 @@ logger = logging.getLogger(__name__) import random -import handler_game -import merc -import interp +from rom24 import handler_game +from rom24 import merc +from rom24 import interp def do_sneak(ch, argument): @@ -17,7 +17,7 @@ def do_sneak(ch, argument): return if random.randint(1, 99) < ch.get_skill("sneak"): - if ch.is_pc(): + if ch.is_pc: ch.check_improve( "sneak", True, 3) af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS @@ -29,7 +29,7 @@ def do_sneak(ch, argument): af.bitvector = merc.AFF_SNEAK ch.affect_add(af) else: - if ch.is_pc(): + if ch.is_pc: ch.check_improve( "sneak", False, 3) return diff --git a/src/rom24/commands/do_snoop.py b/src/rom24/commands/do_snoop.py index 4906e02..852d1fd 100644 --- a/src/rom24/commands/do_snoop.py +++ b/src/rom24/commands/do_snoop.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import handler_game -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import handler_game +from rom24 import state_checks def do_snoop(ch, argument): diff --git a/src/rom24/commands/do_socials.py b/src/rom24/commands/do_socials.py index bd45fbb..50a6515 100644 --- a/src/rom24/commands/do_socials.py +++ b/src/rom24/commands/do_socials.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp # RT does socials diff --git a/src/rom24/commands/do_sockets.py b/src/rom24/commands/do_sockets.py index 587b67d..5012aaf 100644 --- a/src/rom24/commands/do_sockets.py +++ b/src/rom24/commands/do_sockets.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils +from rom24 import merc +from rom24 import interp +from rom24 import game_utils def do_sockets(ch, argument): count = 0 diff --git a/src/rom24/commands/do_south.py b/src/rom24/commands/do_south.py index ccdbc07..fd954fb 100644 --- a/src/rom24/commands/do_south.py +++ b/src/rom24/commands/do_south.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import handler_ch -import interp -import merc +from rom24 import handler_ch +from rom24 import interp +from rom24 import merc def do_south(ch, argument): diff --git a/src/rom24/commands/do_spells.py b/src/rom24/commands/do_spells.py index 23a92bd..e625bcb 100644 --- a/src/rom24/commands/do_spells.py +++ b/src/rom24/commands/do_spells.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import merc -import const -import interp -import game_utils +from rom24 import merc +from rom24 import const +from rom24 import interp +from rom24 import game_utils # RT spells and skills show the players spells (or skills) def do_spells(ch, argument): diff --git a/src/rom24/commands/do_split.py b/src/rom24/commands/do_split.py index 574b8ce..d36c73b 100644 --- a/src/rom24/commands/do_split.py +++ b/src/rom24/commands/do_split.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import handler_game -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import handler_game +from rom24 import state_checks # 'Split' originally by Gnort, God of Chaos. def do_split(ch, argument): diff --git a/src/rom24/commands/do_sset.py b/src/rom24/commands/do_sset.py index d7d9e94..8fbe2b8 100644 --- a/src/rom24/commands/do_sset.py +++ b/src/rom24/commands/do_sset.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import const -import game_utils -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import const +from rom24 import game_utils +from rom24 import state_checks def do_sset(ch, argument): diff --git a/src/rom24/commands/do_stand.py b/src/rom24/commands/do_stand.py index 740d3fe..e96b6e5 100644 --- a/src/rom24/commands/do_stand.py +++ b/src/rom24/commands/do_stand.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import handler_game -import interp -import merc -import state_checks +from rom24 import handler_game +from rom24 import interp +from rom24 import merc +from rom24 import state_checks def do_stand(ch, argument): diff --git a/src/rom24/commands/do_stat.py b/src/rom24/commands/do_stat.py index ffc6960..85547bb 100644 --- a/src/rom24/commands/do_stat.py +++ b/src/rom24/commands/do_stat.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils +from rom24 import merc +from rom24 import interp +from rom24 import game_utils # RT to replace the 3 stat commands def do_stat(ch, argument): diff --git a/src/rom24/commands/do_steal.py b/src/rom24/commands/do_steal.py index e5c564c..6a17a81 100644 --- a/src/rom24/commands/do_steal.py +++ b/src/rom24/commands/do_steal.py @@ -3,13 +3,13 @@ logger = logging.getLogger(__name__) -import merc -import interp -import fight -import game_utils -import handler_game -import state_checks -import const +from rom24 import merc +from rom24 import interp +from rom24 import fight +from rom24 import game_utils +from rom24 import handler_game +from rom24 import state_checks +from rom24 import const def do_steal(ch, argument): @@ -68,7 +68,7 @@ def do_steal(ch, argument): victim.do_yell(buf) if not ch.is_npc(): if victim.is_npc(): - if ch.is_pc(): + if ch.is_pc: ch.check_improve("steal", False, 2) fight.multi_hit(victim, ch, merc.TYPE_UNDEFINED) else: @@ -95,7 +95,7 @@ def do_steal(ch, argument): ch.send("Bingo! You got %d silver coins.\n" % silver) else: ch.send("Bingo! You got %d silver and %d gold coins.\n" % (silver, gold)) - if ch.is_pc(): + if ch.is_pc: ch.check_improve( "steal", True, 2) return item = victim.get_item_carry(arg1, ch) @@ -114,7 +114,7 @@ def do_steal(ch, argument): item.get() ch.put(item) handler_game.act("You pocket $p.", ch, item, None, merc.TO_CHAR) - if ch.is_pc(): + if ch.is_pc: ch.check_improve( "steal", True, 2) ch.send("Got it!\n") return diff --git a/src/rom24/commands/do_string.py b/src/rom24/commands/do_string.py index c795c45..858b9ff 100644 --- a/src/rom24/commands/do_string.py +++ b/src/rom24/commands/do_string.py @@ -2,12 +2,12 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import world_classes -import state_checks -import special +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import world_classes +from rom24 import state_checks +from rom24 import special def do_string(ch, argument): diff --git a/src/rom24/commands/do_switch.py b/src/rom24/commands/do_switch.py index 9781c18..857c7c7 100644 --- a/src/rom24/commands/do_switch.py +++ b/src/rom24/commands/do_switch.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import handler_game -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import handler_game +from rom24 import state_checks #TODO: Known broken. diff --git a/src/rom24/commands/do_tabledump.py b/src/rom24/commands/do_tabledump.py index c83e94f..246ea41 100644 --- a/src/rom24/commands/do_tabledump.py +++ b/src/rom24/commands/do_tabledump.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import database -import merc -import interp +from rom24 import database +from rom24 import merc +from rom24 import interp def do_tabledump(ch, argument): diff --git a/src/rom24/commands/do_tableload.py b/src/rom24/commands/do_tableload.py index 79fde93..718bff2 100644 --- a/src/rom24/commands/do_tableload.py +++ b/src/rom24/commands/do_tableload.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import interp -import merc -import database +from rom24 import interp +from rom24 import merc +from rom24 import database def do_tableload(ch, argument): diff --git a/src/rom24/commands/do_tell.py b/src/rom24/commands/do_tell.py index 6769351..07b45f2 100644 --- a/src/rom24/commands/do_tell.py +++ b/src/rom24/commands/do_tell.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import handler_game -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import handler_game +from rom24 import state_checks def do_tell(ch, argument): diff --git a/src/rom24/commands/do_term.py b/src/rom24/commands/do_term.py index a018abb..939894c 100644 --- a/src/rom24/commands/do_term.py +++ b/src/rom24/commands/do_term.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import miniboa +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import miniboa def usage(ch): diff --git a/src/rom24/commands/do_time.py b/src/rom24/commands/do_time.py index 728e7f9..5de1705 100644 --- a/src/rom24/commands/do_time.py +++ b/src/rom24/commands/do_time.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import handler_game day_name = ["the Moon", "the Bull", "Deception", "Thunder", "Freedom", diff --git a/src/rom24/commands/do_title.py b/src/rom24/commands/do_title.py index 8dbe4fc..6b3e21d 100644 --- a/src/rom24/commands/do_title.py +++ b/src/rom24/commands/do_title.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils +from rom24 import merc +from rom24 import interp +from rom24 import game_utils def do_title(ch, argument): diff --git a/src/rom24/commands/do_train.py b/src/rom24/commands/do_train.py index edff3d1..577e84b 100644 --- a/src/rom24/commands/do_train.py +++ b/src/rom24/commands/do_train.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import handler_game -import merc -import interp +from rom24 import handler_game +from rom24 import merc +from rom24 import interp def do_train(ch, argument): diff --git a/src/rom24/commands/do_transfer.py b/src/rom24/commands/do_transfer.py index f40fe60..14d3259 100644 --- a/src/rom24/commands/do_transfer.py +++ b/src/rom24/commands/do_transfer.py @@ -2,12 +2,12 @@ logger = logging.getLogger(__name__) -import handler_game -import merc -import fight -import interp -import nanny -import game_utils +from rom24 import handler_game +from rom24 import merc +from rom24 import fight +from rom24 import interp +from rom24 import nanny +from rom24 import game_utils def do_transfer(ch, argument): diff --git a/src/rom24/commands/do_trip.py b/src/rom24/commands/do_trip.py index 26d0a09..3c03a68 100644 --- a/src/rom24/commands/do_trip.py +++ b/src/rom24/commands/do_trip.py @@ -3,13 +3,13 @@ logger = logging.getLogger(__name__) -import game_utils -import merc -import const -import interp -import fight -import handler_game -import state_checks +from rom24 import game_utils +from rom24 import merc +from rom24 import const +from rom24 import interp +from rom24 import fight +from rom24 import handler_game +from rom24 import state_checks def do_trip(ch, argument): @@ -70,7 +70,7 @@ def do_trip(ch, argument): handler_game.act("$n trips you and you go down!",ch,None,victim, merc.TO_VICT) handler_game.act("You trip $N and $N goes down!",ch,None,victim, merc.TO_CHAR) handler_game.act("$n trips $N, sending $M to the ground.",ch,None,victim, merc.TO_NOTVICT) - if ch.is_pc(): + if ch.is_pc: ch.check_improve('trip', True, 1) state_checks.DAZE_STATE(victim,2 * merc.PULSE_VIOLENCE) state_checks.WAIT_STATE(ch,const.skill_table['trip'].beats) @@ -79,7 +79,7 @@ def do_trip(ch, argument): else: fight.damage(ch,victim,0,'trip', merc.DAM_BASH,True) state_checks.WAIT_STATE(ch,const.skill_table['trip'].beats*2 // 3) - if ch.is_pc(): + if ch.is_pc: ch.check_improve('trip', False, 1) fight.check_killer(ch,victim) diff --git a/src/rom24/commands/do_trust.py b/src/rom24/commands/do_trust.py index 3d03b8f..eb35708 100644 --- a/src/rom24/commands/do_trust.py +++ b/src/rom24/commands/do_trust.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils +from rom24 import merc +from rom24 import interp +from rom24 import game_utils def do_trust(ch, argument): diff --git a/src/rom24/commands/do_typo.py b/src/rom24/commands/do_typo.py index 472083d..f028953 100644 --- a/src/rom24/commands/do_typo.py +++ b/src/rom24/commands/do_typo.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import merc -import interp -import settings -import game_utils +from rom24 import merc +from rom24 import interp +from rom24 import settings +from rom24 import game_utils def do_typo(ch, argument): diff --git a/src/rom24/commands/do_unalias.py b/src/rom24/commands/do_unalias.py index 33cb36d..3305bf1 100644 --- a/src/rom24/commands/do_unalias.py +++ b/src/rom24/commands/do_unalias.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils +from rom24 import merc +from rom24 import interp +from rom24 import game_utils def do_unalias(ch, argument): diff --git a/src/rom24/commands/do_unlock.py b/src/rom24/commands/do_unlock.py index 4ea3c31..e7d0c9a 100644 --- a/src/rom24/commands/do_unlock.py +++ b/src/rom24/commands/do_unlock.py @@ -2,12 +2,12 @@ logger = logging.getLogger(__name__) -import handler_game -import handler_room -import interp -import game_utils -import state_checks -import merc +from rom24 import handler_game +from rom24 import handler_room +from rom24 import interp +from rom24 import game_utils +from rom24 import state_checks +from rom24 import merc def do_unlock(ch, argument): diff --git a/src/rom24/commands/do_up.py b/src/rom24/commands/do_up.py index f825e2b..b1c51bb 100644 --- a/src/rom24/commands/do_up.py +++ b/src/rom24/commands/do_up.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import handler_ch -import interp -import merc +from rom24 import handler_ch +from rom24 import interp +from rom24 import merc def do_up(ch, argument): diff --git a/src/rom24/commands/do_value.py b/src/rom24/commands/do_value.py index e68aaad..2a1ca50 100644 --- a/src/rom24/commands/do_value.py +++ b/src/rom24/commands/do_value.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils -import handler_game -import shop_utils +from rom24 import merc +from rom24 import interp +from rom24 import game_utils +from rom24 import handler_game +from rom24 import shop_utils def do_value(ch, argument): diff --git a/src/rom24/commands/do_violate.py b/src/rom24/commands/do_violate.py index a9cebc2..418ba13 100644 --- a/src/rom24/commands/do_violate.py +++ b/src/rom24/commands/do_violate.py @@ -1,14 +1,14 @@ import logging -import handler_game +from rom24 import handler_game logger = logging.getLogger(__name__) -import merc -import interp -import fight -import game_utils +from rom24 import merc +from rom24 import interp +from rom24 import fight +from rom24 import game_utils def do_violate(ch, argument): diff --git a/src/rom24/commands/do_visible.py b/src/rom24/commands/do_visible.py index 2c5fdde..5853e8f 100644 --- a/src/rom24/commands/do_visible.py +++ b/src/rom24/commands/do_visible.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import interp -import merc +from rom24 import interp +from rom24 import merc # Contributed by Alander. diff --git a/src/rom24/commands/do_vnum.py b/src/rom24/commands/do_vnum.py index 2283b03..ee7ec4f 100644 --- a/src/rom24/commands/do_vnum.py +++ b/src/rom24/commands/do_vnum.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import game_utils +from rom24 import merc +from rom24 import interp +from rom24 import game_utils # ofind and mfind replaced with vnum, vnum skill also added */ diff --git a/src/rom24/commands/do_wake.py b/src/rom24/commands/do_wake.py index 60d2d07..f3a0dde 100644 --- a/src/rom24/commands/do_wake.py +++ b/src/rom24/commands/do_wake.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import game_utils -import merc -import interp -import handler_game -import state_checks +from rom24 import game_utils +from rom24 import merc +from rom24 import interp +from rom24 import handler_game +from rom24 import state_checks def do_wake(ch, argument): diff --git a/src/rom24/commands/do_wear.py b/src/rom24/commands/do_wear.py index da04680..706ba7e 100644 --- a/src/rom24/commands/do_wear.py +++ b/src/rom24/commands/do_wear.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import game_utils -import merc -import interp -import instance +from rom24 import game_utils +from rom24 import merc +from rom24 import interp +from rom24 import instance def do_wear(ch, argument): diff --git a/src/rom24/commands/do_weather.py b/src/rom24/commands/do_weather.py index 7918261..d37dcb6 100644 --- a/src/rom24/commands/do_weather.py +++ b/src/rom24/commands/do_weather.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import handler_game -import merc -import interp -import state_checks +from rom24 import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import state_checks def do_weather(ch, argument): sky_look = ["cloudless", "cloudy", "rainy", "lit by flashes of lightning"] diff --git a/src/rom24/commands/do_west.py b/src/rom24/commands/do_west.py index 1c0ded4..2f29e96 100644 --- a/src/rom24/commands/do_west.py +++ b/src/rom24/commands/do_west.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import handler_ch -import interp -import merc +from rom24 import handler_ch +from rom24 import interp +from rom24 import merc def do_west(ch, argument): diff --git a/src/rom24/commands/do_where.py b/src/rom24/commands/do_where.py index 35de31b..8f74c5d 100644 --- a/src/rom24/commands/do_where.py +++ b/src/rom24/commands/do_where.py @@ -2,14 +2,14 @@ logger = logging.getLogger(__name__) -import game_utils -import merc -import interp -import nanny -import state_checks -import handler_ch -import handler_game -import instance +from rom24 import game_utils +from rom24 import merc +from rom24 import interp +from rom24 import nanny +from rom24 import state_checks +from rom24 import handler_ch +from rom24 import handler_game +from rom24 import instance def do_where(ch, argument): diff --git a/src/rom24/commands/do_who.py b/src/rom24/commands/do_who.py index ea304d2..65b432f 100644 --- a/src/rom24/commands/do_who.py +++ b/src/rom24/commands/do_who.py @@ -2,13 +2,13 @@ logger = logging.getLogger(__name__) -import game_utils -import merc -import const -import interp -import nanny -import tables -import handler_ch +from rom24 import game_utils +from rom24 import merc +from rom24 import const +from rom24 import interp +from rom24 import nanny +from rom24 import tables +from rom24 import handler_ch # New 'who' command originally by Alander of Rivers of Mud. def do_who(ch, argument): diff --git a/src/rom24/commands/do_whois.py b/src/rom24/commands/do_whois.py index ef8fdbf..9be5c5f 100644 --- a/src/rom24/commands/do_whois.py +++ b/src/rom24/commands/do_whois.py @@ -2,12 +2,12 @@ logger = logging.getLogger(__name__) -import game_utils -import merc -import const -import interp -import nanny -import handler_ch +from rom24 import game_utils +from rom24 import merc +from rom24 import const +from rom24 import interp +from rom24 import nanny +from rom24 import handler_ch def do_whois(ch, argument): diff --git a/src/rom24/commands/do_wimpy.py b/src/rom24/commands/do_wimpy.py index 2154e99..a426fd9 100644 --- a/src/rom24/commands/do_wimpy.py +++ b/src/rom24/commands/do_wimpy.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import game_utils -import merc -import interp +from rom24 import game_utils +from rom24 import merc +from rom24 import interp # 'Wimpy' originally by Dionysos. def do_wimpy(ch, argument): diff --git a/src/rom24/commands/do_wizhelp.py b/src/rom24/commands/do_wizhelp.py index 21b3f87..3904187 100644 --- a/src/rom24/commands/do_wizhelp.py +++ b/src/rom24/commands/do_wizhelp.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp def do_wizhelp(ch, argument): diff --git a/src/rom24/commands/do_wizlock.py b/src/rom24/commands/do_wizlock.py index db23178..dd72f16 100644 --- a/src/rom24/commands/do_wizlock.py +++ b/src/rom24/commands/do_wizlock.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import merc -import interp -import settings -import handler_game +from rom24 import merc +from rom24 import interp +from rom24 import settings +from rom24 import handler_game def do_wizlock(ch, argument): diff --git a/src/rom24/commands/do_wiznet.py b/src/rom24/commands/do_wiznet.py index bd41ce0..e59d0f1 100644 --- a/src/rom24/commands/do_wiznet.py +++ b/src/rom24/commands/do_wiznet.py @@ -2,10 +2,10 @@ logger = logging.getLogger(__name__) -import merc -import interp -import const -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import const +from rom24 import state_checks def do_wiznet(ch, argument): diff --git a/src/rom24/commands/do_worth.py b/src/rom24/commands/do_worth.py index 748b682..58f9ada 100644 --- a/src/rom24/commands/do_worth.py +++ b/src/rom24/commands/do_worth.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import merc -import interp +from rom24 import merc +from rom24 import interp def do_worth(ch, argument): diff --git a/src/rom24/commands/do_yell.py b/src/rom24/commands/do_yell.py index c21359c..84c32d7 100644 --- a/src/rom24/commands/do_yell.py +++ b/src/rom24/commands/do_yell.py @@ -2,11 +2,11 @@ logger = logging.getLogger(__name__) -import merc -import interp -import nanny -import handler_game -import state_checks +from rom24 import merc +from rom24 import interp +from rom24 import nanny +from rom24 import handler_game +from rom24 import state_checks def do_yell(ch, argument): diff --git a/src/rom24/commands/do_zap.py b/src/rom24/commands/do_zap.py index 9e7d941..452fbaf 100644 --- a/src/rom24/commands/do_zap.py +++ b/src/rom24/commands/do_zap.py @@ -4,12 +4,12 @@ logger = logging.getLogger(__name__) -import game_utils -import handler_game -import handler_magic -import state_checks -import merc -import interp +from rom24 import game_utils +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import state_checks +from rom24 import merc +from rom24 import interp def do_zap(ch, argument): @@ -52,11 +52,11 @@ def do_zap(ch, argument): or random.randint(1, 99) >= 20 + ch.get_skill("wands") * 4 // 5: handler_game.act("Your efforts with $p produce only smoke and sparks.", ch, wand, None, merc.TO_CHAR) handler_game.act("$n's efforts with $p produce only smoke and sparks.", ch, wand, None, merc.TO_ROOM) - if ch.is_pc(): + if ch.is_pc: ch.check_improve( "wands", False, 2) else: handler_magic.obj_cast_spell(wand.value[3], wand.value[0], ch, victim, obj) - if ch.is_pc(): + if ch.is_pc: ch.check_improve( "wands", True, 2) wand.value[2] -= 1 if wand.value[2] <= 0: diff --git a/src/rom24/commands/do_zecho.py b/src/rom24/commands/do_zecho.py index 89d06b0..50fb02b 100644 --- a/src/rom24/commands/do_zecho.py +++ b/src/rom24/commands/do_zecho.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import merc -import interp -import nanny +from rom24 import merc +from rom24 import interp +from rom24 import nanny def do_zecho(ch, argument): diff --git a/src/rom24/const.py b/src/rom24/const.py index dd10519..79385f7 100644 --- a/src/rom24/const.py +++ b/src/rom24/const.py @@ -1,36 +1,4 @@ -""" -/*************************************************************************** - * 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-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 * -***************************************************************************/ -/************ - * Ported to Python by Davion of MudBytes.net - * Using Miniboa https://code.google.com/p/miniboa/ - * Now using Python 3 version https://code.google.com/p/miniboa-py3/ - ************/ -""" + from collections import OrderedDict, namedtuple import logging diff --git a/src/rom24/data_loader.py b/src/rom24/data_loader.py index efc7bc5..1e0530e 100644 --- a/src/rom24/data_loader.py +++ b/src/rom24/data_loader.py @@ -5,33 +5,33 @@ logger = logging.getLogger(__name__) -import const -import object_creator -import game_utils -import handler_game -import handler_item -import handler_npc -import world_classes -import handler_room -import merc -import settings -import state_checks -import tables -import miniboa.terminal -import instance +from rom24 import const +from rom24 import object_creator +from rom24 import game_utils +from rom24 import handler_game +from rom24 import handler_item +from rom24 import handler_npc +from rom24 import world_classes +from rom24 import handler_room +from rom24 import merc +from rom24 import settings +from rom24 import state_checks +from rom24 import tables +from rom24.miniboa import terminal as miniboa_terminal +from rom24 import instance __author__ = 'syn' def load_areas(): - logger.info('Loading Areas...') + logger.info('Loading Areas from %s', settings.AREA_LIST_FILE) index = 0 - narea_list = os.path.join(settings.LEGACY_AREA_DIR, settings.AREA_LIST) - fp = open(narea_list, 'r') + fp = open(settings.AREA_LIST_FILE, 'r') area = fp.readline().strip() while area != "$": - afp = open(os.path.join(settings.LEGACY_AREA_DIR, area), 'r') + logger.debug("Loading area %s", area) + afp = open(os.path.join(settings.AREA_DIR, area), 'r') index += 1 load_area(afp.read(), index) area = fp.readline().strip() @@ -96,7 +96,7 @@ def load_helps(area): break area, nhelp.text = game_utils.read_string(area) - nhelp.text = miniboa.terminal.escape(nhelp.text, 'pyom') + nhelp.text = miniboa_terminal.escape(nhelp.text, 'pyom') if nhelp.keyword == "GREETING": nhelp.text += ' ' merc.greeting_list.append(nhelp) @@ -118,9 +118,9 @@ def load_npcs(area, pArea): area, npc.short_descr = game_utils.read_string(area) area, npc.long_descr = game_utils.read_string(area) - npc.long_descr = miniboa.terminal.escape(npc.long_descr, 'pyom') + npc.long_descr = miniboa_terminal.escape(npc.long_descr, 'pyom') area, npc.description = game_utils.read_string(area) - npc.description = miniboa.terminal.escape(npc.description, 'pyom') + npc.description = miniboa_terminal.escape(npc.description, 'pyom') area, npc.race = game_utils.read_string(area) area = npc.act.read_bits(area, default=merc.ACT_IS_NPC | npc.race.act) @@ -192,7 +192,7 @@ def load_objects(area, pArea): area, item.short_descr = game_utils.read_string(area) area, item.description = game_utils.read_string(area) - item.description = miniboa.terminal.escape(item.description, 'pyom') + item.description = miniboa_terminal.escape(item.description, 'pyom') area, item.material = game_utils.read_string(area) area, item.item_type = game_utils.read_word(area, False) @@ -337,7 +337,7 @@ def load_rooms(area, pArea): area, room.name = game_utils.read_string(area) area, room.description = game_utils.read_string(area) - room.description = miniboa.terminal.escape(room.description, 'pyom') + room.description = miniboa_terminal.escape(room.description, 'pyom') area, number = game_utils.read_int(area) # area number area, room.room_flags = game_utils.read_flags(area) diff --git a/src/rom24/database/read/read_tables.py b/src/rom24/database/read/read_tables.py index 89bca74..463e7bd 100644 --- a/src/rom24/database/read/read_tables.py +++ b/src/rom24/database/read/read_tables.py @@ -2,12 +2,12 @@ import logging import os -from settings import DATA_DIR, DATA_EXTN +from rom24.settings import DATA_DIR, DATA_EXTN +from rom24.database.tracker import tables logger = logging.getLogger(__name__) -from database.tracker import tables def read_tables(listener=None, loc=DATA_DIR, extn=DATA_EXTN): if listener: diff --git a/src/rom24/database/tracker.py b/src/rom24/database/tracker.py index 5af03ce..0545fbf 100644 --- a/src/rom24/database/tracker.py +++ b/src/rom24/database/tracker.py @@ -1,8 +1,8 @@ -from const import liq_table, wiznet_table, attack_table, con_app, dex_app, wis_app, int_app, str_app, title_table, \ +from rom24.const import liq_table, wiznet_table, attack_table, con_app, dex_app, wis_app, int_app, str_app, title_table, \ weapon_table, guild_table, group_table, pc_race_table, race_table, skill_table, pc_race_type, race_type, liq_type, \ wiznet_type, attack_type, dex_app_type, wis_app_type, int_app_type, str_app_type, weapon_type, guild_type, \ group_type, skill_type, con_app_type -from tables import comm_flags, part_flags, form_flags, imm_flags, off_flags, affect_flags, plr_flags, act_flags, \ +from rom24.tables import comm_flags, part_flags, form_flags, imm_flags, off_flags, affect_flags, plr_flags, act_flags, \ size_table, sex_table, position_table, clan_table, clan_type, position_type, flag_type, exit_flags diff --git a/src/rom24/db.py b/src/rom24/db.py index d8abb7c..e465cd2 100644 --- a/src/rom24/db.py +++ b/src/rom24/db.py @@ -1,37 +1,3 @@ -""" -#************************************************************************** - * 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-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 * -***************************************************************************/ -#*********** - * Ported to Python by Davion of MudBytes.net - * Using Miniboa https://code.google.com/p/miniboa/ - * Now using Python 3 version https://code.google.com/p/miniboa-py3/ - ************/ -""" - import os import random import time @@ -39,24 +5,24 @@ logger = logging.getLogger(__name__) -import merc -import update -import data_loader -import object_creator -import handler_item -import settings -import state_checks -import game_utils -import handler_game -import const -import database.read.read_tables as read -import instance +from rom24 import merc +from rom24 import update +from rom24 import data_loader +from rom24 import object_creator +from rom24 import handler_item +from rom24 import settings +from rom24 import state_checks +from rom24 import game_utils +from rom24 import handler_game +from rom24 import const +from rom24.database.read import read_tables as read +from rom24 import instance def boot_db(): - import handler_npc - import handler_room - import world_classes + from rom24 import handler_npc + from rom24 import handler_room + from rom24 import world_classes init_time() init_instance() @@ -102,10 +68,9 @@ def init_instance(): #First lets add the bad terms we dont want to pass during instancing, while copying attributes instance.not_to_instance.append('instance_id') instance.not_to_instance.append('act') - instance_num_file = os.path.join(settings.LEGACY_AREA_DIR, "instance_tracker.txt") - fp = open(instance_num_file, 'a') # in case the file doesnt exist open in append mode to not wipe + fp = open(settings.INSTANCE_NUM_FILE, 'a') # in case the file doesnt exist open in append mode to not wipe fp.close() - fp = open(instance_num_file, 'r') + fp = open(settings.INSTANCE_NUM_FILE, 'r') junk, instance.max_instance_id = game_utils.read_int(fp.read()) fp.close() if instance.max_instance_id == 0 or not instance.max_instance_id: diff --git a/src/rom24/effects.py b/src/rom24/effects.py index 9c01c1d..80fb736 100644 --- a/src/rom24/effects.py +++ b/src/rom24/effects.py @@ -36,12 +36,12 @@ logger = logging.getLogger(__name__) -import merc -import handler_game -import handler_magic -import state_checks -import update -import instance +from rom24 import merc +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import state_checks +from rom24 import update +from rom24 import instance def acid_effect(vo, level, dam, target): diff --git a/src/rom24/environment.py b/src/rom24/environment.py index fef3c87..be29f3b 100644 --- a/src/rom24/environment.py +++ b/src/rom24/environment.py @@ -3,12 +3,12 @@ logger = logging.getLogger(__name__) -import merc -import handler_game -import handler_magic -import state_checks -import game_utils -import instance +from rom24 import merc +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import state_checks +from rom24 import game_utils +from rom24 import instance class Environment: diff --git a/src/rom24/equipment.py b/src/rom24/equipment.py index ffe2eea..3a56653 100644 --- a/src/rom24/equipment.py +++ b/src/rom24/equipment.py @@ -7,7 +7,7 @@ logger = logging.getLogger(__name__) -import instance +from rom24 import instance class Equipment: diff --git a/src/rom24/fight.py b/src/rom24/fight.py index 07bc7b4..89d0475 100644 --- a/src/rom24/fight.py +++ b/src/rom24/fight.py @@ -1,56 +1,24 @@ -""" -#************************************************************************** - * 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-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 * -***************************************************************************/ -#*********** - * Ported to Python by Davion of MudBytes.net - * Using Miniboa https://code.google.com/p/miniboa/ - * Now using Python 3 version https://code.google.com/p/miniboa-py3/ - ************/ -""" + import logging +import random logger = logging.getLogger(__name__) -from merc import * -import handler_ch -import handler_item -import object_creator -import game_utils -import handler_game -import random -import update -import const -import effects -import handler_magic -import skills -import state_checks -import settings -import instance +from rom24.merc import * +from rom24 import handler_ch +from rom24 import handler_item +from rom24 import object_creator +from rom24 import game_utils +from rom24 import handler_game +from rom24 import update +from rom24 import const +from rom24 import effects +from rom24 import handler_magic +from rom24 import skills +from rom24 import state_checks +from rom24 import settings +from rom24 import instance # Control the fights going on. @@ -152,7 +120,7 @@ def multi_hit(ch, victim, dt): if random.randint(1, 99) < chance: one_hit(ch, victim, dt) - if ch.is_pc(): + if ch.is_pc: ch.check_improve('second attack', True, 5) if ch.fighting != victim: return @@ -164,7 +132,7 @@ def multi_hit(ch, victim, dt): if random.randint(1, 99) < chance: one_hit(ch, victim, dt) - if ch.is_pc(): + if ch.is_pc: ch.check_improve('third attack', True, 6) if ch.fighting != victim : return @@ -370,7 +338,7 @@ def one_hit(ch, victim, dt): dam = game_utils.dice(ch.damage[DICE_NUMBER], ch.damage[DICE_TYPE]) else: if sn != -1: - if ch.is_pc(): + if ch.is_pc: ch.check_improve( sn, True, 5) if wield: if wield.new_format: @@ -397,7 +365,7 @@ def one_hit(ch, victim, dt): if ch.get_skill('enhanced damage') > 0: diceroll = random.randint(1, 99) if diceroll <= ch.get_skill('enhanced damage'): - if ch.is_pc(): + if ch.is_pc: ch.check_improve('enhanced damage', True, 6) dam += 2 * (dam * diceroll // 300) if not state_checks.IS_AWAKE(victim): diff --git a/src/rom24/game_utils.py b/src/rom24/game_utils.py index 077868f..183689b 100644 --- a/src/rom24/game_utils.py +++ b/src/rom24/game_utils.py @@ -9,9 +9,9 @@ logger = logging.getLogger(__name__) -import settings -import merc -import instance +from rom24 import settings +from rom24 import merc +from rom24 import instance def find_instance_file(instance_id: int=None, from_char_dir: str=None, from_world: bool=False): diff --git a/src/rom24/handler_ch.py b/src/rom24/handler_ch.py index eccc132..21755fc 100644 --- a/src/rom24/handler_ch.py +++ b/src/rom24/handler_ch.py @@ -1,48 +1,16 @@ -""" - #************************************************************************** - * 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-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 * -***************************************************************************/ -#*********** - * Ported to Python by Davion of MudBytes.net - * Using Miniboa https://code.google.com/p/miniboa/ - * Now using Python 3 version https://code.google.com/p/miniboa-py3/ - ************/ -""" + import collections import random import logging logger = logging.getLogger(__name__) -import merc -import handler_game -import const -import state_checks -import handler_item -import instance +from rom24 import merc +from rom24 import handler_game +from rom24 import const +from rom24 import state_checks +from rom24 import handler_item +from rom24 import instance depth = 0 @@ -385,7 +353,7 @@ def show_char_to_char_1(victim, ch): if victim != ch and not ch.is_npc() \ and random.randint(1, 99) < ch.get_skill("peek"): ch.send("\nYou peek at the inventory:\n") - if ch.is_pc(): + if ch.is_pc: ch.check_improve('peek', True, 4) show_list_to_char(victim.inventory, ch, True, True) return diff --git a/src/rom24/handler_game.py b/src/rom24/handler_game.py index 7e29f24..4d190ee 100644 --- a/src/rom24/handler_game.py +++ b/src/rom24/handler_game.py @@ -1,36 +1,4 @@ -""" -/*************************************************************************** - * 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-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 * -***************************************************************************/ -/************ - * Ported to Python by Davion of MudBytes.net - * Using Miniboa https://code.google.com/p/miniboa/ - * Now using Python 3 version https://code.google.com/p/miniboa-py3/ - ************/ -""" + __author__ = 'syn' import copy @@ -39,13 +7,13 @@ logger = logging.getLogger(__name__) -import handler_ch -import handler_item -import living -import game_utils -import merc -import state_checks -import instance +from rom24 import handler_ch +from rom24 import handler_item +from rom24 import living +from rom24 import game_utils +from rom24 import merc +from rom24 import state_checks +from rom24 import instance class SOCIAL_DATA: @@ -194,7 +162,7 @@ def act(format, ch, arg1=None, arg2=None, send_to=merc.TO_ROOM, min_pos=merc.POS return def wiznet( string, ch, obj, flag, flag_skip, min_level): - from nanny import con_playing + from rom24.nanny import con_playing for d in merc.descriptor_list: if d.is_connected(con_playing) \ and d.character.is_immortal() \ diff --git a/src/rom24/handler_item.py b/src/rom24/handler_item.py index 78948ca..32b194c 100644 --- a/src/rom24/handler_item.py +++ b/src/rom24/handler_item.py @@ -1,36 +1,4 @@ -""" - #************************************************************************** - * 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-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 * -***************************************************************************/ -#*********** - * Ported to Python by Davion of MudBytes.net - * Using Miniboa https://code.google.com/p/miniboa/ - * Now using Python 3 version https://code.google.com/p/miniboa-py3/ - ************/ -""" + import json import os import copy @@ -40,19 +8,19 @@ logger = logging.getLogger(__name__) -import instance -import settings -import equipment -import game_utils -import type_bypass -import inventory -import physical -import environment -import handler_game -import object_creator -import merc -import state_checks -import item_flags +from rom24 import instance +from rom24 import settings +from rom24 import equipment +from rom24 import game_utils +from rom24 import type_bypass +from rom24 import inventory +from rom24 import physical +from rom24 import environment +from rom24 import handler_game +from rom24 import object_creator +from rom24 import merc +from rom24 import state_checks +from rom24 import item_flags # * One object. @@ -540,7 +508,7 @@ def save(self, is_equipped: bool=False, in_inventory: bool=False, player_name: s os.makedirs(pathname, 0o755, True) filename = os.path.join(pathname, '%d-item.json' % number) - logger.info('Saving %s', filename) + # logger.info('Saving %s', filename) js = json.dumps(self, default=instance.to_json, indent=4, sort_keys=True) md5 = hashlib.md5(js.encode('utf-8')).hexdigest() if self._md5 != md5: @@ -551,7 +519,7 @@ def save(self, is_equipped: bool=False, in_inventory: bool=False, player_name: s if self.inventory: for item_id in self.inventory[:]: if item_id not in instance.global_instances: - logger.error('Item %d is in Item %d\'s inventory, but does not exist?', item_id, self.instance_id) + # logger.error('Item %d is in Item %d\'s inventory, but does not exist?', item_id, self.instance_id) continue item = instance.global_instances[item_id] item.save(is_equipped=is_equipped, in_inventory=in_inventory, player_name=player_name, force=force) diff --git a/src/rom24/handler_log.py b/src/rom24/handler_log.py index eb24a5f..a30124f 100644 --- a/src/rom24/handler_log.py +++ b/src/rom24/handler_log.py @@ -1,36 +1,4 @@ -""" - #************************************************************************** - * 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-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 * -***************************************************************************/ -#*********** - * Ported to Python by Davion of MudBytes.net - * Using Miniboa https://code.google.com/p/miniboa/ - * Now using Python 3 version https://code.google.com/p/miniboa-py3/ - ************/ - """ + __author__ = 'syn' import sys import functools @@ -39,8 +7,8 @@ logger = logging.getLogger(__name__) -import merc -import handler_pc +from rom24 import merc +from rom24 import handler_pc """So far this wrapper class will allow debugging of a function as such: @logger("Debug") @@ -64,7 +32,7 @@ def gdcfset(state): return def value_to_str(v): - import interp + from rom24 import interp if isinstance(v, handler_pc.Pc): return v.name elif isinstance(v, interp.cmd_type): diff --git a/src/rom24/handler_magic.py b/src/rom24/handler_magic.py index b9a1cd2..b33794a 100644 --- a/src/rom24/handler_magic.py +++ b/src/rom24/handler_magic.py @@ -1,36 +1,4 @@ -""" -/*************************************************************************** - * 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-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 * -***************************************************************************/ -/************ - * Ported to Python by Davion of MudBytes.net - * Using Miniboa https://code.google.com/p/miniboa/ - * Now using Python 3 version https://code.google.com/p/miniboa-py3/ - ************/ -""" + __author__ = 'syn' import random @@ -38,10 +6,10 @@ logger = logging.getLogger(__name__) -import merc -import handler_game -import state_checks -import game_utils +from rom24 import merc +from rom24 import handler_game +from rom24 import state_checks +from rom24 import game_utils #Magic functions def say_spell(ch, spell): @@ -128,8 +96,8 @@ def find_spell(ch, name): #Cast spells at targets using a magical object. def obj_cast_spell(sn, level, ch, victim, obj): - import const - import fight + from rom24 import const + from rom24 import fight target = merc.TARGET_NONE vo = None if not sn: diff --git a/src/rom24/handler_npc.py b/src/rom24/handler_npc.py index 25b5016..abed767 100644 --- a/src/rom24/handler_npc.py +++ b/src/rom24/handler_npc.py @@ -1,52 +1,20 @@ -""" -/*************************************************************************** - * 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-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 * -***************************************************************************/ -/************ - * Ported to Python by Davion of MudBytes.net - * Using Miniboa https://code.google.com/p/miniboa/ - * Now using Python 3 version https://code.google.com/p/miniboa-py3/ - ************/ -""" + import copy import os import hashlib import time import logging +import json logger = logging.getLogger(__name__) -import living -import pyprogs -import bit -import tables -import handler_item -import json -import settings -import instance +from rom24 import living +from rom24 import pyprogs +from rom24 import bit +from rom24 import tables +from rom24 import handler_item +from rom24 import settings +from rom24 import instance class Npc(living.Living): @@ -181,7 +149,7 @@ def save(self, force: bool=False): os.makedirs(pathname, 0o755, True) filename = os.path.join(pathname, '%d-npc.json' % number) - logger.info('Saving %s', filename) + # logger.info('Saving %s', filename) js = json.dumps(self, default=instance.to_json, indent=4, sort_keys=True) md5 = hashlib.md5(js.encode('utf-8')).hexdigest() if self._md5 != md5: @@ -192,14 +160,14 @@ def save(self, force: bool=False): if self.inventory: for item_id in self.inventory[:]: if item_id not in instance.items: - logger.error('Item %d is in NPC %d\'s inventory, but does not exist?', item_id, self.instance_id) + # logger.error('Item %d is in NPC %d\'s inventory, but does not exist?', item_id, self.instance_id) continue item = instance.items[item_id] item.save(in_inventory=True, force=force) for item_id in self.equipped.values(): if item_id: if item_id not in instance.items: - logger.error('Item %d is in NPC %d\'s equipment, but does not exist?', item_id, self.instance_id) + # logger.error('Item %d is in NPC %d\'s equipment, but does not exist?', item_id, self.instance_id) continue item = instance.items[item_id] item.save(is_equipped=True, force=force) diff --git a/src/rom24/handler_pc.py b/src/rom24/handler_pc.py index ff4e3d6..503e99e 100644 --- a/src/rom24/handler_pc.py +++ b/src/rom24/handler_pc.py @@ -8,18 +8,17 @@ logger = logging.getLogger(__name__) -import game_utils -import handler_log -import instance -import handler_game -import merc -import const -import interp -import living -import settings -import state_checks -import update -import handler_item +from rom24 import game_utils +from rom24 import instance +from rom24 import handler_game +from rom24 import merc +from rom24 import const +from rom24 import interp +from rom24 import living +from rom24 import settings +from rom24 import state_checks +from rom24 import update +from rom24 import handler_item class Pc(living.Living): @@ -27,7 +26,7 @@ class Pc(living.Living): instance_count = 0 def __init__(self, template=None, **kwargs): - import handler_item + from rom24 import handler_item super().__init__() self.is_pc = True self.buffer = [] @@ -491,8 +490,6 @@ def check_social(ch, command, argument): handler_game.act("$n slaps you.", victim, None, ch, merc.TO_VICT) return True - #TODO: RemoveDebug - @handler_log.logged("Interp") def interpret(self, argument): # Strip leading spaces. @@ -650,7 +647,7 @@ def save(self, logout: bool=False, force: bool=False): pathname = os.path.join(settings.PLAYER_DIR, self.name[0].lower(), self.name.capitalize()) os.makedirs(pathname, 0o755, True) filename = os.path.join(pathname, 'player.json') - logger.info('Saving %s', filename) + # logger.info('Saving %s', filename) js = json.dumps(self, default=instance.to_json, indent=4, sort_keys=True) md5 = hashlib.md5(js.encode('utf-8')).hexdigest() if self._md5 != md5: @@ -661,14 +658,14 @@ def save(self, logout: bool=False, force: bool=False): if self.inventory: for item_id in self.inventory[:]: if item_id not in instance.items: - logger.error('Item %d is in Player %s\'s inventory, but does not exist?', item_id, self.name) + # logger.error('Item %d is in Player %s\'s inventory, but does not exist?', item_id, self.name) continue item = instance.items[item_id] item.save(in_inventory=True, player_name=self.name, force=force) for item_id in self.equipped.values(): if item_id: if item_id not in instance.items: - logger.error('Item %d is in Player %s\'s inventory, but does not exist?', item_id, self.name) + # logger.error('Item %d is in Player %s\'s inventory, but does not exist?', item_id, self.name) continue item = instance.items[item_id] item.save(is_equipped=True, player_name=self.name, force=force) diff --git a/src/rom24/handler_room.py b/src/rom24/handler_room.py index 462aea3..956d78d 100644 --- a/src/rom24/handler_room.py +++ b/src/rom24/handler_room.py @@ -1,36 +1,4 @@ -""" - #************************************************************************** - * 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-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 * -***************************************************************************/ -#*********** - * Ported to Python by Davion of MudBytes.net - * Using Miniboa https://code.google.com/p/miniboa/ - * Now using Python 3 version https://code.google.com/p/miniboa-py3/ - ************/ -""" import random import copy import os @@ -41,14 +9,14 @@ logger = logging.getLogger(__name__) -import merc -import handler_game -import instance -import environment -import state_checks -import inventory -import type_bypass -import settings +from rom24 import merc +from rom24 import handler_game +from rom24 import instance +from rom24 import environment +from rom24 import state_checks +from rom24 import inventory +from rom24 import type_bypass +from rom24 import settings class Room(instance.Instancer, environment.Environment, inventory.Inventory, type_bypass.ObjectType): @@ -269,7 +237,7 @@ def save(self, force: bool=False): os.makedirs(pathname, 0o755, True) filename = os.path.join(pathname, '%d-room.json' % number) - logger.info('Saving %s', filename) + # logger.info('Saving %s', filename) js = json.dumps(self, default=instance.to_json, indent=4, sort_keys=True) md5 = hashlib.md5(js.encode('utf-8')).hexdigest() if self._md5 != md5: @@ -280,7 +248,7 @@ def save(self, force: bool=False): if self.inventory: for item_id in self.inventory[:]: if item_id not in instance.items: - logger.error('Item %d is in Room %d\'s inventory, but does not exist?', item_id, self.instance_id) + # logger.error('Item %d is in Room %d\'s inventory, but does not exist?', item_id, self.instance_id) continue item = instance.items[item_id] item.save(in_inventory=True, force=force) diff --git a/src/rom24/hotfix.py b/src/rom24/hotfix.py index 3bd2cba..e679327 100644 --- a/src/rom24/hotfix.py +++ b/src/rom24/hotfix.py @@ -1,36 +1,4 @@ -""" -#************************************************************************** - * 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-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 * -***************************************************************************/ -#*********** - * Ported to Python by Davion of MudBytes.net - * Using Miniboa https://code.google.com/p/miniboa/ - * Now using Python 3 version https://code.google.com/p/miniboa-py3/ - ************/ -""" + import os import importlib import traceback @@ -43,65 +11,80 @@ modified_files = {} -def init_file(path, modules, silent=False): +# Looks like we need to fix the directory for this init so that it will find the commands. + +def init_file(path, modules): #called by init_monitoring to begin tracking a file. - modules = [importlib.import_module(m) for m in modules] - tracked_files[path] = [os.path.getmtime(path), modules] - if not silent: - logger.info(' Tracking %s', path) - else: - logger.debug(' Tracking %s', path) + logger.info("Initializing monitoring for %s: %s", path, modules) + loaded_modules = {m: importlib.import_module(m) for m in modules} + logger.info("Adding %s to tracked paths.", path) + tracked_files[path] = [os.path.getmtime(path), loaded_modules] + logger.info("Successfully initialized %s", path) +def init_module(module): + logger.info("Initializing module for %s", module) + loaded_module = importlib.import_module(f"rom24.{module}") + tracked_files[loaded_module.__file__] = os.path.getmtime(loaded_module.__file__) -def init_directory(path, silent=False): - dir = os.listdir(path) - files = [f for f in dir if not f.startswith('__')] +def init_directory_module(directory_module): + loaded_module = importlib.import_module(f"rom24.{directory_module}") + dirpath = os.path.dirname(loaded_module.__file__) + dir_items = os.listdir(dirpath) + dfiles = [f for f in dir_items if not f.startswith('__')] - logger.info('Tracking %d files in %s', len(files), path) - for file in files: - full_path = os.path.join(path, file) - module = full_path.split('.')[0].replace(os.sep, '.') - init_file(full_path, [module], silent) + logger.info('Tracking %d files in %s', len(dfiles), dirpath) + for dfile in dfiles: + dfmodule = f"{directory_module}.{dfile.split('.')[0]}" + init_module(dfmodule) def init_monitoring(): #Called in main function to begin tracking files. logger.info('Monitoring system initializing...') - init_file('handler_ch.py', ['handler_ch']) - init_file('handler_item.py', ['handler_item']) - init_file('handler_room.py', ['handler_room']) - init_file('handler_log.py', ['handler_log']) - init_file('shop_utils.py', ['shop_utils']) - init_file('game_utils.py', ['game_utils']) - init_file('pyprogs.py', ['pyprogs']) - init_file('affects.py', ['affects']) - init_file('effects.py', ['effects']) - init_file('fight.py', ['fight']) - init_directory(os.path.join('commands')) - init_directory(os.path.join('spells')) + modules_to_init = [ + 'handler_ch', + 'handler_item', + 'handler_room', + 'shop_utils', + 'game_utils', + 'pyprogs', + 'affects', + 'effects' + ] + directories_to_init = [ + 'commands', + 'spells' + ] + for module in modules_to_init: + init_module(module) + for directory in directories_to_init: + init_directory_module(directory) logger.info('done. (Monitoring system)') def poll_files(): #Called in game_loop of program to check if files have been modified. - for fp, pair in tracked_files.items(): - mod, modules = pair + for fp, mod in tracked_files.items(): if mod != os.path.getmtime(fp): - #File has been modified. + # File has been modified. logger.warn('%s has been modified', fp) - tracked_files[fp][0] = os.path.getmtime(fp) - modified_files[fp] = [os.path.getmtime(fp), modules] + tracked_files[fp] = os.path.getmtime(fp) + modified_files[fp] = os.path.getmtime(fp) def reload_files(ch): - for fp, pair in modified_files.copy().items(): - mod, modules = pair - logger.warn('Reloading %s', fp) - for m in modules: - try: - importlib.reload(m) - except: - ch.send(traceback.format_exc()) - logger.exception('Failed to reload %s', fp) + # This will be broken - we need to import the module again + # but we're just doing file path and load times - we can + # infer the module from the file path though. + for fp, mod in modified_files.copy().items(): + import_path = fp.split('src')[-1] + module_name = import_path.replace('/', '.').lstrip('.').rstrip('.py') + module = importlib.import_module(module_name) + logger.warn('Reloading %s from %s', module, fp) + try: + importlib.reload(module) + except: + ch.send(traceback.format_exc()) + logger.exception('Failed to reload %s', fp) del modified_files[fp] diff --git a/src/rom24/immortal.py b/src/rom24/immortal.py index e7574bf..1dc9244 100644 --- a/src/rom24/immortal.py +++ b/src/rom24/immortal.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import bit -import const -import merc +from rom24 import bit +from rom24 import const +from rom24 import merc class Immortal: diff --git a/src/rom24/instance.py b/src/rom24/instance.py index b518f94..e021763 100644 --- a/src/rom24/instance.py +++ b/src/rom24/instance.py @@ -1,36 +1,4 @@ -""" -/*************************************************************************** - * 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-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 * -***************************************************************************/ -/************ - * Ported to Python by Davion of MudBytes.net - * Using Miniboa https://code.google.com/p/miniboa/ - * Now using Python 3 version https://code.google.com/p/miniboa-py3/ - ************/ -""" + __author__ = 'quixadhal' import os @@ -41,7 +9,7 @@ logger = logging.getLogger(__name__) -import settings +from rom24 import settings '''For the instance dicts, we are not going to make another pointer, or copy, of the original entity. We are going to alias, or bind, the specific entity @@ -229,10 +197,10 @@ def from_json(data): import importlib module_name = found[0][0].rstrip('.') class_name = found[0][1] - if module_name != '' and class_name != '': - module_ref = importlib.import_module(module_name) + module_ref = importlib.import_module('rom24.' + module_name) class_ref = getattr(module_ref, class_name) + logger.debug("class_ref: %s", class_ref) if hasattr(class_ref, 'from_json'): return class_ref.from_json(data, from_json) @@ -287,7 +255,7 @@ def load(): if hasattr(class_ref, 'load'): obj = class_ref.load(instance_id=k) if isinstance(obj, class_ref): - logger.boot('Restored instance %d (%r)', k, repr(obj)) + logger.info('Restored instance %d (%r)', k, repr(obj)) class Instancer: diff --git a/src/rom24/interp.py b/src/rom24/interp.py index 46971de..3677d93 100644 --- a/src/rom24/interp.py +++ b/src/rom24/interp.py @@ -1,42 +1,10 @@ -""" -#************************************************************************** - * 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-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 * -***************************************************************************/ -#*********** - * Ported to Python by Davion of MudBytes.net - * Using Miniboa https://code.google.com/p/miniboa/ - * Now using Python 3 version https://code.google.com/p/miniboa-py3/ - ************/ -""" from collections import OrderedDict import logging logger = logging.getLogger(__name__) -import living +from rom24 import living class cmd_type: diff --git a/src/rom24/inventory.py b/src/rom24/inventory.py index 5f7bc4a..de3ff4f 100644 --- a/src/rom24/inventory.py +++ b/src/rom24/inventory.py @@ -2,9 +2,9 @@ logger = logging.getLogger(__name__) -import const -import merc -import instance +from rom24 import const +from rom24 import merc +from rom24 import instance class Inventory: diff --git a/src/rom24/living.py b/src/rom24/living.py index b6d699e..72163a7 100644 --- a/src/rom24/living.py +++ b/src/rom24/living.py @@ -1,57 +1,25 @@ -""" -/*************************************************************************** - * 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-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 * -***************************************************************************/ -/************ - * Ported to Python by Davion of MudBytes.net - * Using Miniboa https://code.google.com/p/miniboa/ - * Now using Python 3 version https://code.google.com/p/miniboa-py3/ - ************/ -""" + import random import logging logger = logging.getLogger(__name__) -import merc -import equipment -import instance -import type_bypass -import inventory -import handler_game -import physical -import tables -import affects -import bit -import const -import fight -import game_utils -import immortal -import environment -import state_checks +from rom24 import merc +from rom24 import equipment +from rom24 import instance +from rom24 import type_bypass +from rom24 import inventory +from rom24 import handler_game +from rom24 import physical +from rom24 import tables +from rom24 import affects +from rom24 import bit +from rom24 import const +from rom24 import fight +from rom24 import game_utils +from rom24 import immortal +from rom24 import environment +from rom24 import state_checks class Grouping: @@ -211,6 +179,7 @@ def check_immune(self, dam_type): merc.DAM_LIGHT: merc.IMM_LIGHT, merc.DAM_CHARM: merc.IMM_CHARM, merc.DAM_SOUND: merc.IMM_SOUND} + if dam_type not in bit: return defence bit = bit[dam_type] @@ -409,10 +378,10 @@ def reset(self): if not item: continue affected = item.affected - #This was causing a massive bug, where items would multiply affects because json doesnt operate - #the way that the flat files did. - #if not item.enchanted: - this is unnecessary as we load all affects directly with the json - # affected(merc.itemTemplate[item.vnum].affected) + # This was causing a massive bug, where items would multiply affects because json doesnt operate + # the way that the flat files did. + # if not item.enchanted: - this is unnecessary as we load all affects directly with the json + # affected(merc.itemTemplate[item.vnum].affected) for af in affected: mod = af.modifier if af.location == merc.APPLY_SEX: @@ -462,8 +431,9 @@ def reset(self): for i in range(4): self.armor[i] -= item.apply_ac(i) affected = item.affected - #if not item.enchanted: - this is unnecessary as we load all affects directly with the json - # affected.extend(merc.itemTemplate[item.vnum].affected) + # this is unnecessary as we load all affects directly with the json + # if not item.enchanted: + # affected.extend(merc.itemTemplate[item.vnum].affected) for af in affected: mod = af.modifier @@ -803,7 +773,7 @@ def get_skill(self, sn): elif sn not in const.skill_table: logger.error("BUG: Bad sn %s in get_skill." % sn) skill = 0 - elif self.is_pc(): + elif self.is_pc: if self.level < const.skill_table[sn].skill_level[self.guild.name] \ or sn not in self.learned: skill = 0 @@ -854,7 +824,7 @@ def get_skill(self, sn): skill //= 2 else: skill = 2 * skill // 3 - if self.is_pc() \ + if self.is_pc \ and self.condition[merc.COND_DRUNK] > 10: skill = 9 * skill // 10 @@ -909,7 +879,7 @@ def deduct_cost(self, cost): logger.error("BUG: deduct costs: silver %d < 0" % self.silver) self.silver = 0 -# Find a piece of eq on a character. + # Find a piece of eq on a character. def get_eq(self, check_loc): """ :param check_loc: diff --git a/src/rom24/magic.py b/src/rom24/magic.py index da89c40..af8d7a9 100644 --- a/src/rom24/magic.py +++ b/src/rom24/magic.py @@ -1,36 +1,4 @@ -""" -#************************************************************************** - * 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-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 * -***************************************************************************/ -#*********** - * Ported to Python by Davion of MudBytes.net - * Using Miniboa https://code.google.com/p/miniboa/ - * Now using Python 3 version https://code.google.com/p/miniboa-py3/ - ************/ -""" def spell_null(sn, level, ch, victim, target): diff --git a/src/rom24/merc.py b/src/rom24/merc.py index ea5e8d5..e972846 100644 --- a/src/rom24/merc.py +++ b/src/rom24/merc.py @@ -1,36 +1,4 @@ -""" -/*************************************************************************** - * 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-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 * -***************************************************************************/ -/************ - * Ported to Python by Davion of MudBytes.net - * Using Miniboa https://code.google.com/p/miniboa/ - * Now using Python 3 version https://code.google.com/p/miniboa-py3/ - ************/ -""" + import time import collections @@ -38,7 +6,7 @@ logger = logging.getLogger(__name__) -import state_checks +from rom24 import state_checks #Merc Setup #Letter->Bit conversion diff --git a/src/rom24/miniboa/__init__.py b/src/rom24/miniboa/__init__.py index bd04869..97cfac3 100644 --- a/src/rom24/miniboa/__init__.py +++ b/src/rom24/miniboa/__init__.py @@ -1 +1 @@ -from miniboa.asyncio import TelnetServer +from rom24.miniboa.asyncio import TelnetServer diff --git a/src/rom24/miniboa/asyncio.py b/src/rom24/miniboa/asyncio.py index 6649864..3ffb2f0 100644 --- a/src/rom24/miniboa/asyncio.py +++ b/src/rom24/miniboa/asyncio.py @@ -34,8 +34,8 @@ logger = logging.getLogger(__name__) -from miniboa.telnet import TelnetClient -from miniboa.telnet import ConnectionLost +from rom24.miniboa.telnet import TelnetClient +from rom24.miniboa.telnet import ConnectionLost ## Cap sockets to 512 on Windows because winsock can only process 512 at time diff --git a/src/rom24/miniboa/telnet.py b/src/rom24/miniboa/telnet.py index 30fcca7..09318a6 100644 --- a/src/rom24/miniboa/telnet.py +++ b/src/rom24/miniboa/telnet.py @@ -34,8 +34,8 @@ logger = logging.getLogger(__name__) -from miniboa.terminal import color_convert -from miniboa.terminal import word_wrap +from rom24.miniboa.terminal import color_convert +from rom24.miniboa.terminal import word_wrap #---[ Telnet Notes ]----------------------------------------------------------- diff --git a/src/rom24/miniboa/terminal.py b/src/rom24/miniboa/terminal.py index e49ed95..8d434c8 100644 --- a/src/rom24/miniboa/terminal.py +++ b/src/rom24/miniboa/terminal.py @@ -55,7 +55,7 @@ import re -from miniboa.colors import TERMINAL_TYPES, COLOR_MAP +from rom24.miniboa.colors import TERMINAL_TYPES, COLOR_MAP _TTYPE_MAP = { 'tinyfugue': 'ansi', diff --git a/src/rom24/nanny.py b/src/rom24/nanny.py index d28f52f..09031c4 100644 --- a/src/rom24/nanny.py +++ b/src/rom24/nanny.py @@ -1,56 +1,24 @@ -""" -/*************************************************************************** - * 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-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 * -***************************************************************************/ -/************ - * Ported to Python by Davion of MudBytes.net - * Using Miniboa https://code.google.com/p/miniboa/ - * Now using Python 3 version https://code.google.com/p/miniboa-py3/ - ************/ -""" + import hashlib import os import logging logger = logging.getLogger(__name__) -import const -import object_creator -import game_utils -import handler_game -import comm -import merc -import save -import settings -import state_checks -import handler_pc -import world_classes -import sys_utils -import update -import instance +from rom24 import const +from rom24 import object_creator +from rom24 import game_utils +from rom24 import handler_game +from rom24 import comm +from rom24 import merc +from rom24 import save +from rom24 import settings +from rom24 import state_checks +from rom24 import handler_pc +from rom24 import world_classes +from rom24 import sys_utils +from rom24 import update +from rom24 import instance class CharDummy: diff --git a/src/rom24/object_creator.py b/src/rom24/object_creator.py index 6959753..4b92106 100644 --- a/src/rom24/object_creator.py +++ b/src/rom24/object_creator.py @@ -6,16 +6,16 @@ logger = logging.getLogger(__name__) -import game_utils -import handler_game -import handler_item -import handler_room -import world_classes -import merc -import handler_npc -import special -import state_checks -import instance +from rom24 import game_utils +from rom24 import handler_game +from rom24 import handler_item +from rom24 import handler_room +from rom24 import world_classes +from rom24 import merc +from rom24 import handler_npc +from rom24 import special +from rom24 import state_checks +from rom24 import instance def create_room(room_template): diff --git a/src/rom24/physical.py b/src/rom24/physical.py index 21d95f6..e74977c 100644 --- a/src/rom24/physical.py +++ b/src/rom24/physical.py @@ -2,8 +2,8 @@ logger = logging.getLogger(__name__) -import bit -import tables +from rom24 import bit +from rom24 import tables class Physical: diff --git a/src/rom24/pyom.py b/src/rom24/pyom.py index daca304..e95c569 100644 --- a/src/rom24/pyom.py +++ b/src/rom24/pyom.py @@ -1,80 +1,31 @@ -""" -/*************************************************************************** - * 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-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 * -***************************************************************************/ -/************ - * Ported to Python by Davion of MudBytes.net - * Using Miniboa https://code.google.com/p/miniboa/ - * Now using Python 3 version https://code.google.com/p/miniboa-py3/ - ************/ -""" import os import sys import logging -#import pdb - -def boot_log(self, message, *args, **kws): - if self.level <= 21: - self._log(21, message, args, **kws) - - -def trace_log(self, message, *args, **kws): - if self.level <= 5: - self._log(5, message, args, **kws) - - -sys.path.append(os.getcwd()) -logging.addLevelName(21, 'BOOT') -logging.Logger.boot = boot_log -logging.addLevelName(5, 'TRACE') -logging.Logger.trace = trace_log -logging.basicConfig(format='%(asctime)s %(levelname)-8s %(module)16s| %(message)s', level=21) logger = logging.getLogger(__name__) -from miniboa import TelnetServer -from settings import PORT -from comm import game_loop, init_descriptor, close_socket -from hotfix import init_monitoring +from rom24.miniboa import TelnetServer +from rom24.settings import PORT +from rom24.comm import game_loop, init_descriptor, close_socket +from rom24.hotfix import init_monitoring import time startup_time = time.time() -def Pyom(): +def pyom(): sys.path.append(os.getcwd()) - logger.boot('Logging system initialized.') + logger.info('Logging system initialized.') server = TelnetServer(port=PORT) server.on_connect = init_descriptor server.on_disconnect = close_socket + # TODO: Fix file monitoring init_monitoring() - logger.boot('Entering Game Loop') + logger.info('Entering Game Loop') game_loop(server) logger.critical('System halted.') if __name__ == "__main__": - Pyom() + pyom() diff --git a/src/rom24/pyprogs.py b/src/rom24/pyprogs.py index 995bbb0..88a1898 100644 --- a/src/rom24/pyprogs.py +++ b/src/rom24/pyprogs.py @@ -9,9 +9,9 @@ logger = logging.getLogger(__name__) -import merc -import settings -import instance +from rom24 import merc +from rom24 import settings +from rom24 import instance signals = {'say': []} diff --git a/src/rom24/save.py b/src/rom24/save.py index d2372bd..ffe5356 100644 --- a/src/rom24/save.py +++ b/src/rom24/save.py @@ -5,14 +5,14 @@ logger = logging.getLogger(__name__) -import object_creator -import instance -from merc import * -import tables -import world_classes -import settings -import handler_pc -import auth +from rom24 import object_creator +from rom24 import instance +from rom24.merc import * +from rom24 import tables +from rom24 import world_classes +from rom24 import settings +from rom24 import handler_pc +from rom24 import auth def area_pickler(): diff --git a/src/rom24/settings.py b/src/rom24/settings.py index 49f1b25..8d924a1 100644 --- a/src/rom24/settings.py +++ b/src/rom24/settings.py @@ -1,5 +1,7 @@ import os import logging +from pathlib import Path + logger = logging.getLogger(__name__) @@ -23,21 +25,50 @@ PKL_EXTN = '.pickle' #Folders -LEGACY_AREA_DIR = os.path.join('../..', 'area') +INSTALLED_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) +SOURCE_DIR = os.path.join(INSTALLED_DIR, 'src') +logger.info("SOURCE_DIR: %s", SOURCE_DIR) +LEGACY_AREA_DIR = os.path.join(SOURCE_DIR, 'area') +logger.info("LEGACY_AREA_DIR: %s", LEGACY_AREA_DIR) LEGACY_PLAYER_DIR = os.path.join('../..', 'player') +logger.info("LEGACY_PLAYER_DIR: %s", LEGACY_PLAYER_DIR) SOCIAL_DIR = os.path.join(LEGACY_AREA_DIR, 'socials') +logger.info("SOCIAL_DIR: %s", SOCIAL_DIR) HELP_DIR = os.path.join(LEGACY_AREA_DIR, 'help_files') +logger.info("HELP_DIR: %s", HELP_DIR) #New structure -DATA_DIR = os.path.join('../..', 'data') +USER_DIR = os.path.expanduser("~") +BASE_DIR = os.path.join(USER_DIR, 'rom24') +DATA_DIR = os.path.join(SOURCE_DIR, 'data') WORLD_DIR = os.path.join(DATA_DIR, 'world') - PLAYER_DIR = os.path.join(DATA_DIR, 'players') SYSTEM_DIR = os.path.join(DATA_DIR, 'system') DOC_DIR = os.path.join(DATA_DIR, 'docs') - -AREA_DIR = os.path.join(WORLD_DIR, 'areas') +AREA_DIR = LEGACY_AREA_DIR +AREA_LIST_FILE = os.path.join(AREA_DIR, AREA_LIST) INSTANCE_DIR = os.path.join(WORLD_DIR, 'instances') +INSTANCE_NUM_FILE = os.path.join(INSTANCE_DIR, "instance_tracker.txt") +for mydir in ( + BASE_DIR, + DATA_DIR, + WORLD_DIR, + PLAYER_DIR, + SYSTEM_DIR, + DOC_DIR, + AREA_DIR, + INSTANCE_DIR, +): + if not os.path.exists(mydir): + os.makedirs(mydir) + +for rom24_file in ( + INSTANCE_NUM_FILE, + AREA_LIST_FILE +): + if not os.path.exists(rom24_file): + rom24_file_path = Path(rom24_file) + rom24_file_path.touch(exist_ok=True) #Features SHOW_DAMAGE_NUMBERS = True diff --git a/src/rom24/shell.py b/src/rom24/shell.py index 7fbe657..f8cb199 100644 --- a/src/rom24/shell.py +++ b/src/rom24/shell.py @@ -6,7 +6,7 @@ logger = logging.getLogger(__name__) -import db +from rom24 import db db.boot_db() diff --git a/src/rom24/shop_utils.py b/src/rom24/shop_utils.py index 306e763..60d5b40 100644 --- a/src/rom24/shop_utils.py +++ b/src/rom24/shop_utils.py @@ -3,10 +3,10 @@ logger = logging.getLogger(__name__) -import merc -import handler_game -import game_utils -import instance +from rom24 import merc +from rom24 import handler_game +from rom24 import game_utils +from rom24 import instance # get an object from a shopkeeper's list */ diff --git a/src/rom24/skills.py b/src/rom24/skills.py index a161317..56122c0 100644 --- a/src/rom24/skills.py +++ b/src/rom24/skills.py @@ -1,45 +1,13 @@ -""" -#************************************************************************** - * 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-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 * -***************************************************************************/ -#*********** - * Ported to Python by Davion of MudBytes.net - * Using Miniboa https://code.google.com/p/miniboa/ - * Now using Python 3 version https://code.google.com/p/miniboa-py3/ - ************/ -""" + import random import logging logger = logging.getLogger(__name__) -from merc import * -import const -import game_utils -import magic +from rom24.merc import * +from rom24 import const +from rom24 import game_utils +from rom24 import magic # recursively adds a group given its number -- uses group_add */ @@ -292,8 +260,8 @@ def parse_gen_groups(ch, argument): # shows all groups, or the sub-members of a group */ # checks for skill improvement */ def check_improve( ch, sn, success, multiplier ): - import const - import update + from rom24 import const + from rom24 import update if ch.is_npc(): return if type(sn) == str: diff --git a/src/rom24/special.py b/src/rom24/special.py index 32b3fc1..f41ae40 100644 --- a/src/rom24/special.py +++ b/src/rom24/special.py @@ -1,47 +1,15 @@ -""" -#************************************************************************** - * 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-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 * -***************************************************************************/ -#*********** - * Ported to Python by Davion of MudBytes.net - * Using Miniboa https://code.google.com/p/miniboa/ - * Now using Python 3 version https://code.google.com/p/miniboa-py3/ - ************/ -""" + import random import logging logger = logging.getLogger(__name__) -import handler_ch -import const -import fight -import handler_game -import merc -import state_checks +from rom24 import handler_ch +from rom24 import const +from rom24 import fight +from rom24 import handler_game +from rom24 import merc +from rom24 import state_checks def spec_troll_member(ch): diff --git a/src/rom24/spells/__init__.py b/src/rom24/spells/__init__.py index 1303261..e69de29 100644 --- a/src/rom24/spells/__init__.py +++ b/src/rom24/spells/__init__.py @@ -1,33 +0,0 @@ -""" -#************************************************************************** - * 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-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 * -***************************************************************************/ -#*********** - * Ported to Python by Davion of MudBytes.net - * Using Miniboa https://code.google.com/p/miniboa/ - * Now using Python 3 version https://code.google.com/p/miniboa-py3/ - ************/ -""" \ No newline at end of file diff --git a/src/rom24/spells/spell_acid_blast.py b/src/rom24/spells/spell_acid_blast.py index 702b9b7..6868379 100644 --- a/src/rom24/spells/spell_acid_blast.py +++ b/src/rom24/spells/spell_acid_blast.py @@ -1,8 +1,8 @@ -import const -import fight -import game_utils -import handler_magic -import merc +from rom24 import const +from rom24 import fight +from rom24 import game_utils +from rom24 import handler_magic +from rom24 import merc def spell_acid_blast(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_acid_breath.py b/src/rom24/spells/spell_acid_breath.py index ebce970..7d996ee 100644 --- a/src/rom24/spells/spell_acid_breath.py +++ b/src/rom24/spells/spell_acid_breath.py @@ -1,12 +1,12 @@ import random -import const -import effects -import fight -import game_utils -import handler_game -import handler_magic -import merc +from rom24 import const +from rom24 import effects +from rom24 import fight +from rom24 import game_utils +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc def spell_acid_breath(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_armor.py b/src/rom24/spells/spell_armor.py index 6951bb4..71155b3 100644 --- a/src/rom24/spells/spell_armor.py +++ b/src/rom24/spells/spell_armor.py @@ -1,7 +1,7 @@ -import const -import handler_game -import merc -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import merc +from rom24 import state_checks def spell_armor(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_bless.py b/src/rom24/spells/spell_bless.py index 4ac47c2..929eb60 100644 --- a/src/rom24/spells/spell_bless.py +++ b/src/rom24/spells/spell_bless.py @@ -1,8 +1,8 @@ -import const -import handler_game -import handler_magic -import merc -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc +from rom24 import state_checks def spell_bless(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_blindness.py b/src/rom24/spells/spell_blindness.py index 1f63bd0..e12c2e2 100644 --- a/src/rom24/spells/spell_blindness.py +++ b/src/rom24/spells/spell_blindness.py @@ -1,7 +1,7 @@ -import const -import handler_game -import handler_magic -import merc +from rom24 import const +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc def spell_blindness(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_burning_hands.py b/src/rom24/spells/spell_burning_hands.py index 5189984..63e2c2b 100644 --- a/src/rom24/spells/spell_burning_hands.py +++ b/src/rom24/spells/spell_burning_hands.py @@ -1,8 +1,8 @@ import random -import const -import fight -import handler_magic -import merc +from rom24 import const +from rom24 import fight +from rom24 import handler_magic +from rom24 import merc def spell_burning_hands(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_call_lightning.py b/src/rom24/spells/spell_call_lightning.py index d2b58bc..1321cb4 100644 --- a/src/rom24/spells/spell_call_lightning.py +++ b/src/rom24/spells/spell_call_lightning.py @@ -1,10 +1,10 @@ -import const -import fight -import game_utils -import handler_game -import handler_magic -import merc -import state_checks +from rom24 import const +from rom24 import fight +from rom24 import game_utils +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc +from rom24 import state_checks def spell_call_lightning(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_calm.py b/src/rom24/spells/spell_calm.py index 479969d..6e36cf6 100644 --- a/src/rom24/spells/spell_calm.py +++ b/src/rom24/spells/spell_calm.py @@ -4,11 +4,11 @@ # RT calm spell stops all fighting in the room */ import random -import const -import fight -import handler_game -import merc -import state_checks +from rom24 import const +from rom24 import fight +from rom24 import handler_game +from rom24 import merc +from rom24 import state_checks def spell_calm(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_cancellation.py b/src/rom24/spells/spell_cancellation.py index a50c75f..9d9e60a 100644 --- a/src/rom24/spells/spell_cancellation.py +++ b/src/rom24/spells/spell_cancellation.py @@ -1,7 +1,7 @@ -import const -import handler_game -import handler_magic -import merc +from rom24 import const +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc def spell_cancellation(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_cause_critical.py b/src/rom24/spells/spell_cause_critical.py index 6fe6ec5..28e31db 100644 --- a/src/rom24/spells/spell_cause_critical.py +++ b/src/rom24/spells/spell_cause_critical.py @@ -1,7 +1,7 @@ -import const -import fight -import game_utils -import merc +from rom24 import const +from rom24 import fight +from rom24 import game_utils +from rom24 import merc def spell_cause_critical(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_cause_light.py b/src/rom24/spells/spell_cause_light.py index 842b787..f7d8cec 100644 --- a/src/rom24/spells/spell_cause_light.py +++ b/src/rom24/spells/spell_cause_light.py @@ -1,7 +1,7 @@ -import const -import fight -import game_utils -import merc +from rom24 import const +from rom24 import fight +from rom24 import game_utils +from rom24 import merc def spell_cause_light(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_cause_serious.py b/src/rom24/spells/spell_cause_serious.py index 7e3ccee..e048d5a 100644 --- a/src/rom24/spells/spell_cause_serious.py +++ b/src/rom24/spells/spell_cause_serious.py @@ -1,7 +1,7 @@ -import const -import fight -import game_utils -import merc +from rom24 import const +from rom24 import fight +from rom24 import game_utils +from rom24 import merc def spell_cause_serious(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_chain_lightning.py b/src/rom24/spells/spell_chain_lightning.py index ee5ead3..99835bd 100644 --- a/src/rom24/spells/spell_chain_lightning.py +++ b/src/rom24/spells/spell_chain_lightning.py @@ -1,9 +1,9 @@ -import const -import fight -import game_utils -import handler_game -import handler_magic -import merc +from rom24 import const +from rom24 import fight +from rom24 import game_utils +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc def spell_chain_lightning(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_change_sex.py b/src/rom24/spells/spell_change_sex.py index 7a80b78..4819813 100644 --- a/src/rom24/spells/spell_change_sex.py +++ b/src/rom24/spells/spell_change_sex.py @@ -1,10 +1,10 @@ import random -import const -import handler_game -import handler_magic -import merc -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc +from rom24 import state_checks def spell_change_sex(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_charm_person.py b/src/rom24/spells/spell_charm_person.py index ae970bc..515c044 100644 --- a/src/rom24/spells/spell_charm_person.py +++ b/src/rom24/spells/spell_charm_person.py @@ -1,11 +1,11 @@ -import const -import fight -import game_utils -import handler_ch -import handler_game -import handler_magic -import merc -import state_checks +from rom24 import const +from rom24 import fight +from rom24 import game_utils +from rom24 import handler_ch +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc +from rom24 import state_checks def spell_charm_person(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_chill_touch.py b/src/rom24/spells/spell_chill_touch.py index 7cbb127..b5c33de 100644 --- a/src/rom24/spells/spell_chill_touch.py +++ b/src/rom24/spells/spell_chill_touch.py @@ -1,10 +1,10 @@ import random -import const -import fight -import handler_game -import handler_magic -import merc +from rom24 import const +from rom24 import fight +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc def spell_chill_touch(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_colour_spray.py b/src/rom24/spells/spell_colour_spray.py index 3792f06..6a2500a 100644 --- a/src/rom24/spells/spell_colour_spray.py +++ b/src/rom24/spells/spell_colour_spray.py @@ -1,8 +1,8 @@ import random -import const -import fight -import handler_magic -import merc +from rom24 import const +from rom24 import fight +from rom24 import handler_magic +from rom24 import merc def spell_colour_spray(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_continual_light.py b/src/rom24/spells/spell_continual_light.py index 9addefd..1f6eeba 100644 --- a/src/rom24/spells/spell_continual_light.py +++ b/src/rom24/spells/spell_continual_light.py @@ -1,8 +1,8 @@ -import const -import handler_game -import merc -import object_creator -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import merc +from rom24 import object_creator +from rom24 import state_checks def spell_continual_light(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_control_weather.py b/src/rom24/spells/spell_control_weather.py index 027777a..e3a5c88 100644 --- a/src/rom24/spells/spell_control_weather.py +++ b/src/rom24/spells/spell_control_weather.py @@ -1,7 +1,7 @@ -import const -import game_utils -import handler_game -import merc +from rom24 import const +from rom24 import game_utils +from rom24 import handler_game +from rom24 import merc def spell_control_weather(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_create_food.py b/src/rom24/spells/spell_create_food.py index 12d028c..3cf6649 100644 --- a/src/rom24/spells/spell_create_food.py +++ b/src/rom24/spells/spell_create_food.py @@ -1,7 +1,7 @@ -import const -import handler_game -import merc -import object_creator +from rom24 import const +from rom24 import handler_game +from rom24 import merc +from rom24 import object_creator def spell_create_food(sn, level, ch, victim, target): mushroom = object_creator.create_item(instance.item_templates[merc.OBJ_VNUM_MUSHROOM], 0) diff --git a/src/rom24/spells/spell_create_rose.py b/src/rom24/spells/spell_create_rose.py index 602fa4a..e5f2238 100644 --- a/src/rom24/spells/spell_create_rose.py +++ b/src/rom24/spells/spell_create_rose.py @@ -1,7 +1,7 @@ -import const -import handler_game -import merc -import object_creator +from rom24 import const +from rom24 import handler_game +from rom24 import merc +from rom24 import object_creator def spell_create_rose(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_create_spring.py b/src/rom24/spells/spell_create_spring.py index ca8eb54..455c44c 100644 --- a/src/rom24/spells/spell_create_spring.py +++ b/src/rom24/spells/spell_create_spring.py @@ -1,7 +1,7 @@ -import const -import handler_game -import merc -import object_creator +from rom24 import const +from rom24 import handler_game +from rom24 import merc +from rom24 import object_creator def spell_create_spring(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_create_water.py b/src/rom24/spells/spell_create_water.py index 8974255..7a9b485 100644 --- a/src/rom24/spells/spell_create_water.py +++ b/src/rom24/spells/spell_create_water.py @@ -1,6 +1,6 @@ -import const -import handler_game -import merc +from rom24 import const +from rom24 import handler_game +from rom24 import merc def spell_create_water(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_cure_blindness.py b/src/rom24/spells/spell_cure_blindness.py index 4579a86..6790beb 100644 --- a/src/rom24/spells/spell_cure_blindness.py +++ b/src/rom24/spells/spell_cure_blindness.py @@ -1,8 +1,8 @@ -import const -import handler_game -import handler_magic -import merc -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc +from rom24 import state_checks def spell_cure_blindness(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_cure_critical.py b/src/rom24/spells/spell_cure_critical.py index dbbaffc..05ff0dd 100644 --- a/src/rom24/spells/spell_cure_critical.py +++ b/src/rom24/spells/spell_cure_critical.py @@ -1,7 +1,7 @@ -import const -import fight -import game_utils -import merc +from rom24 import const +from rom24 import fight +from rom24 import game_utils +from rom24 import merc def spell_cure_critical(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_cure_disease.py b/src/rom24/spells/spell_cure_disease.py index 21e640d..2a76307 100644 --- a/src/rom24/spells/spell_cure_disease.py +++ b/src/rom24/spells/spell_cure_disease.py @@ -1,8 +1,8 @@ -import const -import handler_game -import handler_magic -import merc -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc +from rom24 import state_checks def spell_cure_disease(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_cure_light.py b/src/rom24/spells/spell_cure_light.py index 4711142..a6e2f87 100644 --- a/src/rom24/spells/spell_cure_light.py +++ b/src/rom24/spells/spell_cure_light.py @@ -1,7 +1,7 @@ -import const -import fight -import game_utils -import merc +from rom24 import const +from rom24 import fight +from rom24 import game_utils +from rom24 import merc def spell_cure_light(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_cure_poison.py b/src/rom24/spells/spell_cure_poison.py index cc89997..003c736 100644 --- a/src/rom24/spells/spell_cure_poison.py +++ b/src/rom24/spells/spell_cure_poison.py @@ -1,8 +1,8 @@ -import const -import handler_game -import handler_magic -import merc -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc +from rom24 import state_checks def spell_cure_poison(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_cure_serious.py b/src/rom24/spells/spell_cure_serious.py index b8afc33..3ecbc36 100644 --- a/src/rom24/spells/spell_cure_serious.py +++ b/src/rom24/spells/spell_cure_serious.py @@ -1,7 +1,7 @@ -import const -import fight -import game_utils -import merc +from rom24 import const +from rom24 import fight +from rom24 import game_utils +from rom24 import merc def spell_cure_serious(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_curse.py b/src/rom24/spells/spell_curse.py index 1858723..62f7b29 100644 --- a/src/rom24/spells/spell_curse.py +++ b/src/rom24/spells/spell_curse.py @@ -1,8 +1,8 @@ -import const -import handler_game -import handler_magic -import merc -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc +from rom24 import state_checks def spell_curse(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_demonfire.py b/src/rom24/spells/spell_demonfire.py index 91924d3..5aeb43e 100644 --- a/src/rom24/spells/spell_demonfire.py +++ b/src/rom24/spells/spell_demonfire.py @@ -1,9 +1,9 @@ -import const -import fight -import game_utils -import handler_game -import handler_magic -import merc +from rom24 import const +from rom24 import fight +from rom24 import game_utils +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc def spell_demonfire(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_detect_evil.py b/src/rom24/spells/spell_detect_evil.py index c8546f6..3b97f81 100644 --- a/src/rom24/spells/spell_detect_evil.py +++ b/src/rom24/spells/spell_detect_evil.py @@ -1,6 +1,6 @@ -import const -import handler_game -import merc +from rom24 import const +from rom24 import handler_game +from rom24 import merc def spell_detect_evil(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_detect_good.py b/src/rom24/spells/spell_detect_good.py index 246e35f..284a194 100644 --- a/src/rom24/spells/spell_detect_good.py +++ b/src/rom24/spells/spell_detect_good.py @@ -1,6 +1,6 @@ -import const -import handler_game -import merc +from rom24 import const +from rom24 import handler_game +from rom24 import merc def spell_detect_good(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_detect_hidden.py b/src/rom24/spells/spell_detect_hidden.py index 837d05a..d65d0a8 100644 --- a/src/rom24/spells/spell_detect_hidden.py +++ b/src/rom24/spells/spell_detect_hidden.py @@ -1,6 +1,6 @@ -import const -import handler_game -import merc +from rom24 import const +from rom24 import handler_game +from rom24 import merc def spell_detect_hidden(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_detect_invis.py b/src/rom24/spells/spell_detect_invis.py index 0131efe..d1cb210 100644 --- a/src/rom24/spells/spell_detect_invis.py +++ b/src/rom24/spells/spell_detect_invis.py @@ -1,6 +1,6 @@ -import const -import handler_game -import merc +from rom24 import const +from rom24 import handler_game +from rom24 import merc def spell_detect_invis(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_detect_magic.py b/src/rom24/spells/spell_detect_magic.py index 71153ea..39ff07b 100644 --- a/src/rom24/spells/spell_detect_magic.py +++ b/src/rom24/spells/spell_detect_magic.py @@ -1,6 +1,6 @@ -import const -import handler_game -import merc +from rom24 import const +from rom24 import handler_game +from rom24 import merc def spell_detect_magic(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_detect_poison.py b/src/rom24/spells/spell_detect_poison.py index ca39675..110b1ef 100644 --- a/src/rom24/spells/spell_detect_poison.py +++ b/src/rom24/spells/spell_detect_poison.py @@ -1,6 +1,6 @@ -import const -import merc +from rom24 import const +from rom24 import merc def spell_detect_poison(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_dispel_evil.py b/src/rom24/spells/spell_dispel_evil.py index 17bc6e2..4f18ab0 100644 --- a/src/rom24/spells/spell_dispel_evil.py +++ b/src/rom24/spells/spell_dispel_evil.py @@ -1,10 +1,10 @@ -import const -import fight -import game_utils -import handler_game -import handler_magic -import merc -import state_checks +from rom24 import const +from rom24 import fight +from rom24 import game_utils +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc +from rom24 import state_checks def spell_dispel_evil(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_dispel_good.py b/src/rom24/spells/spell_dispel_good.py index 62b3723..326e9c4 100644 --- a/src/rom24/spells/spell_dispel_good.py +++ b/src/rom24/spells/spell_dispel_good.py @@ -1,10 +1,10 @@ -import const -import fight -import game_utils -import handler_game -import handler_magic -import merc -import state_checks +from rom24 import const +from rom24 import fight +from rom24 import game_utils +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc +from rom24 import state_checks def spell_dispel_good(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_dispel_magic.py b/src/rom24/spells/spell_dispel_magic.py index af6fc3b..bbb0f88 100644 --- a/src/rom24/spells/spell_dispel_magic.py +++ b/src/rom24/spells/spell_dispel_magic.py @@ -1,8 +1,8 @@ -import const -import handler_game -import handler_magic -import merc -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc +from rom24 import state_checks def spell_dispel_magic(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_earthquake.py b/src/rom24/spells/spell_earthquake.py index a157767..1090d79 100644 --- a/src/rom24/spells/spell_earthquake.py +++ b/src/rom24/spells/spell_earthquake.py @@ -1,9 +1,9 @@ -import const -import fight -import game_utils -import handler_game -import merc -import state_checks +from rom24 import const +from rom24 import fight +from rom24 import game_utils +from rom24 import handler_game +from rom24 import merc +from rom24 import state_checks def spell_earthquake(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_enchant_armor.py b/src/rom24/spells/spell_enchant_armor.py index 8aafdff..d1a0026 100644 --- a/src/rom24/spells/spell_enchant_armor.py +++ b/src/rom24/spells/spell_enchant_armor.py @@ -1,9 +1,9 @@ import random -import const -import handler_game -import merc -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import merc +from rom24 import state_checks def spell_enchant_armor(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_enchant_weapon.py b/src/rom24/spells/spell_enchant_weapon.py index 9c17ca0..5e5e768 100644 --- a/src/rom24/spells/spell_enchant_weapon.py +++ b/src/rom24/spells/spell_enchant_weapon.py @@ -1,9 +1,9 @@ import random -import const -import handler_game -import merc -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import merc +from rom24 import state_checks def spell_enchant_weapon(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_energy_drain.py b/src/rom24/spells/spell_energy_drain.py index 14392ad..16ebaf7 100644 --- a/src/rom24/spells/spell_energy_drain.py +++ b/src/rom24/spells/spell_energy_drain.py @@ -1,10 +1,10 @@ import random -import const -import fight -import game_utils -import handler_magic -import merc -import update +from rom24 import const +from rom24 import fight +from rom24 import game_utils +from rom24 import handler_magic +from rom24 import merc +from rom24 import update def spell_energy_drain(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_faerie_fire.py b/src/rom24/spells/spell_faerie_fire.py index 702af26..e809c2a 100644 --- a/src/rom24/spells/spell_faerie_fire.py +++ b/src/rom24/spells/spell_faerie_fire.py @@ -1,6 +1,6 @@ -import const -import handler_game -import merc +from rom24 import const +from rom24 import handler_game +from rom24 import merc def spell_faerie_fire(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_faerie_fog.py b/src/rom24/spells/spell_faerie_fog.py index bc6c718..10cb761 100644 --- a/src/rom24/spells/spell_faerie_fog.py +++ b/src/rom24/spells/spell_faerie_fog.py @@ -1,8 +1,8 @@ -import const -import handler_game -import handler_magic -import merc -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc +from rom24 import state_checks def spell_faerie_fog(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_farsight.py b/src/rom24/spells/spell_farsight.py index 78a479a..59ed367 100644 --- a/src/rom24/spells/spell_farsight.py +++ b/src/rom24/spells/spell_farsight.py @@ -1,6 +1,6 @@ -import const -import handler_magic -import merc +from rom24 import const +from rom24 import handler_magic +from rom24 import merc def spell_farsight(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_fire_breath.py b/src/rom24/spells/spell_fire_breath.py index 59017c7..c3960cd 100644 --- a/src/rom24/spells/spell_fire_breath.py +++ b/src/rom24/spells/spell_fire_breath.py @@ -1,12 +1,12 @@ import random -import const -import effects -import fight -import game_utils -import handler_game -import handler_magic -import merc +from rom24 import const +from rom24 import effects +from rom24 import fight +from rom24 import game_utils +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc def spell_fire_breath(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_fireball.py b/src/rom24/spells/spell_fireball.py index 676a3eb..13ae90c 100644 --- a/src/rom24/spells/spell_fireball.py +++ b/src/rom24/spells/spell_fireball.py @@ -1,8 +1,8 @@ import random -import const -import fight -import handler_magic -import merc +from rom24 import const +from rom24 import fight +from rom24 import handler_magic +from rom24 import merc def spell_fireball(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_fireproof.py b/src/rom24/spells/spell_fireproof.py index 9878263..a79710b 100644 --- a/src/rom24/spells/spell_fireproof.py +++ b/src/rom24/spells/spell_fireproof.py @@ -1,10 +1,10 @@ -import const -import game_utils -import handler_game -import merc -import state_checks +from rom24 import const +from rom24 import game_utils +from rom24 import handler_game +from rom24 import merc +from rom24 import state_checks def spell_fireproof(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_flamestrike.py b/src/rom24/spells/spell_flamestrike.py index 66315e4..7d8b58b 100644 --- a/src/rom24/spells/spell_flamestrike.py +++ b/src/rom24/spells/spell_flamestrike.py @@ -1,8 +1,8 @@ -import const -import fight -import game_utils -import handler_magic -import merc +from rom24 import const +from rom24 import fight +from rom24 import game_utils +from rom24 import handler_magic +from rom24 import merc def spell_flamestrike(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_floating_disc.py b/src/rom24/spells/spell_floating_disc.py index eecf428..77b9dd0 100644 --- a/src/rom24/spells/spell_floating_disc.py +++ b/src/rom24/spells/spell_floating_disc.py @@ -1,10 +1,10 @@ import random -import const -import handler_game -import merc -import object_creator -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import merc +from rom24 import object_creator +from rom24 import state_checks def spell_floating_disc(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_fly.py b/src/rom24/spells/spell_fly.py index 9b0099d..2fb1f0a 100644 --- a/src/rom24/spells/spell_fly.py +++ b/src/rom24/spells/spell_fly.py @@ -1,6 +1,6 @@ -import const -import handler_game -import merc +from rom24 import const +from rom24 import handler_game +from rom24 import merc def spell_fly(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_frenzy.py b/src/rom24/spells/spell_frenzy.py index 9542a4a..51d35c6 100644 --- a/src/rom24/spells/spell_frenzy.py +++ b/src/rom24/spells/spell_frenzy.py @@ -1,7 +1,7 @@ -import const -import handler_game -import merc -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import merc +from rom24 import state_checks def spell_frenzy(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_frost_breath.py b/src/rom24/spells/spell_frost_breath.py index b3aba46..892a125 100644 --- a/src/rom24/spells/spell_frost_breath.py +++ b/src/rom24/spells/spell_frost_breath.py @@ -1,12 +1,12 @@ import random -import const -import effects -import fight -import game_utils -import handler_game -import handler_magic -import merc +from rom24 import const +from rom24 import effects +from rom24 import fight +from rom24 import game_utils +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc def spell_frost_breath(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_gas_breath.py b/src/rom24/spells/spell_gas_breath.py index a49d8ac..9874cb5 100644 --- a/src/rom24/spells/spell_gas_breath.py +++ b/src/rom24/spells/spell_gas_breath.py @@ -1,12 +1,12 @@ import random -import const -import effects -import fight -import game_utils -import handler_game -import handler_magic -import merc +from rom24 import const +from rom24 import effects +from rom24 import fight +from rom24 import game_utils +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc def spell_gas_breath(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_gate.py b/src/rom24/spells/spell_gate.py index ca664e4..07a7fd1 100644 --- a/src/rom24/spells/spell_gate.py +++ b/src/rom24/spells/spell_gate.py @@ -1,8 +1,8 @@ -import const -import handler_game -import handler_magic -import merc -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc +from rom24 import state_checks def spell_gate(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_general_purpose.py b/src/rom24/spells/spell_general_purpose.py index 211855f..296d898 100644 --- a/src/rom24/spells/spell_general_purpose.py +++ b/src/rom24/spells/spell_general_purpose.py @@ -1,8 +1,8 @@ import random -import const -import fight -import handler_magic -import merc +from rom24 import const +from rom24 import fight +from rom24 import handler_magic +from rom24 import merc def spell_general_purpose(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_giant_strength.py b/src/rom24/spells/spell_giant_strength.py index ee8728f..383bed3 100644 --- a/src/rom24/spells/spell_giant_strength.py +++ b/src/rom24/spells/spell_giant_strength.py @@ -1,7 +1,7 @@ -import const -import handler_game -import merc -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import merc +from rom24 import state_checks def spell_giant_strength(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_harm.py b/src/rom24/spells/spell_harm.py index 9857427..241c139 100644 --- a/src/rom24/spells/spell_harm.py +++ b/src/rom24/spells/spell_harm.py @@ -1,8 +1,8 @@ -import const -import fight -import game_utils -import handler_magic -import merc +from rom24 import const +from rom24 import fight +from rom24 import game_utils +from rom24 import handler_magic +from rom24 import merc def spell_harm(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_haste.py b/src/rom24/spells/spell_haste.py index 25f8b16..45c460c 100644 --- a/src/rom24/spells/spell_haste.py +++ b/src/rom24/spells/spell_haste.py @@ -1,8 +1,8 @@ -import const -import handler_game -import handler_magic -import merc -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc +from rom24 import state_checks def spell_haste(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_heal.py b/src/rom24/spells/spell_heal.py index db1b0cc..40ec3fe 100644 --- a/src/rom24/spells/spell_heal.py +++ b/src/rom24/spells/spell_heal.py @@ -1,6 +1,6 @@ -import const -import fight -import merc +from rom24 import const +from rom24 import fight +from rom24 import merc def spell_heal(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_heat_metal.py b/src/rom24/spells/spell_heat_metal.py index a94e562..fdadf7f 100644 --- a/src/rom24/spells/spell_heat_metal.py +++ b/src/rom24/spells/spell_heat_metal.py @@ -1,11 +1,11 @@ import random -import const -import fight -import handler_game -import handler_magic -import merc -import state_checks +from rom24 import const +from rom24 import fight +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc +from rom24 import state_checks def spell_heat_metal(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_high_explosive.py b/src/rom24/spells/spell_high_explosive.py index 5f689d6..74bd955 100644 --- a/src/rom24/spells/spell_high_explosive.py +++ b/src/rom24/spells/spell_high_explosive.py @@ -1,8 +1,8 @@ import random -import const -import fight -import handler_magic -import merc +from rom24 import const +from rom24 import fight +from rom24 import handler_magic +from rom24 import merc def spell_high_explosive(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_holy_word.py b/src/rom24/spells/spell_holy_word.py index d359d18..fcea79d 100644 --- a/src/rom24/spells/spell_holy_word.py +++ b/src/rom24/spells/spell_holy_word.py @@ -1,9 +1,9 @@ -import const -import fight -import game_utils -import handler_game -import merc -import state_checks +from rom24 import const +from rom24 import fight +from rom24 import game_utils +from rom24 import handler_game +from rom24 import merc +from rom24 import state_checks def spell_holy_word(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_identify.py b/src/rom24/spells/spell_identify.py index 58f6e17..9e9fc52 100644 --- a/src/rom24/spells/spell_identify.py +++ b/src/rom24/spells/spell_identify.py @@ -1,6 +1,6 @@ -import const -import merc -from merc import affect_loc_name, affect_bit_name, extra_bit_name, imm_bit_name, weapon_bit_name, cont_bit_name +from rom24 import const +from rom24 import merc +from rom24.merc import affect_loc_name, affect_bit_name, extra_bit_name, imm_bit_name, weapon_bit_name, cont_bit_name #TODO: Make this ROM-like formatting def spell_identify(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_infravision.py b/src/rom24/spells/spell_infravision.py index dd19b7e..1148b14 100644 --- a/src/rom24/spells/spell_infravision.py +++ b/src/rom24/spells/spell_infravision.py @@ -1,6 +1,6 @@ -import const -import handler_game -import merc +from rom24 import const +from rom24 import handler_game +from rom24 import merc def spell_infravision(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_invis.py b/src/rom24/spells/spell_invis.py index 62aaff7..faf82c8 100644 --- a/src/rom24/spells/spell_invis.py +++ b/src/rom24/spells/spell_invis.py @@ -1,7 +1,7 @@ -import const -import handler_game -import merc -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import merc +from rom24 import state_checks def spell_invis(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_know_alignment.py b/src/rom24/spells/spell_know_alignment.py index 1a25bb9..0d7e579 100644 --- a/src/rom24/spells/spell_know_alignment.py +++ b/src/rom24/spells/spell_know_alignment.py @@ -1,6 +1,6 @@ -import const -import handler_game -import merc +from rom24 import const +from rom24 import handler_game +from rom24 import merc def spell_know_alignment(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_lightning_bolt.py b/src/rom24/spells/spell_lightning_bolt.py index ef5b0bd..6e1d1bb 100644 --- a/src/rom24/spells/spell_lightning_bolt.py +++ b/src/rom24/spells/spell_lightning_bolt.py @@ -1,8 +1,8 @@ import random -import const -import fight -import handler_magic -import merc +from rom24 import const +from rom24 import fight +from rom24 import handler_magic +from rom24 import merc def spell_lightning_bolt(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_lightning_breath.py b/src/rom24/spells/spell_lightning_breath.py index 9aa7477..1156411 100644 --- a/src/rom24/spells/spell_lightning_breath.py +++ b/src/rom24/spells/spell_lightning_breath.py @@ -1,12 +1,12 @@ import random -import const -import effects -import fight -import game_utils -import handler_game -import handler_magic -import merc +from rom24 import const +from rom24 import effects +from rom24 import fight +from rom24 import game_utils +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc def spell_lightning_breath(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_locate_object.py b/src/rom24/spells/spell_locate_object.py index 5b85474..4bda747 100644 --- a/src/rom24/spells/spell_locate_object.py +++ b/src/rom24/spells/spell_locate_object.py @@ -1,9 +1,9 @@ import random -import const -import game_utils -import handler_magic -import merc -import state_checks +from rom24 import const +from rom24 import game_utils +from rom24 import handler_magic +from rom24 import merc +from rom24 import state_checks def spell_locate_object(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_magic_missile.py b/src/rom24/spells/spell_magic_missile.py index 240caf5..3f5e82b 100644 --- a/src/rom24/spells/spell_magic_missile.py +++ b/src/rom24/spells/spell_magic_missile.py @@ -1,8 +1,8 @@ import random -import const -import fight -import handler_magic -import merc +from rom24 import const +from rom24 import fight +from rom24 import handler_magic +from rom24 import merc def spell_magic_missile(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_mass_healing.py b/src/rom24/spells/spell_mass_healing.py index ab6763f..fd22c9e 100644 --- a/src/rom24/spells/spell_mass_healing.py +++ b/src/rom24/spells/spell_mass_healing.py @@ -1,6 +1,6 @@ -import const -import merc -import state_checks +from rom24 import const +from rom24 import merc +from rom24 import state_checks def spell_mass_healing(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_mass_invis.py b/src/rom24/spells/spell_mass_invis.py index 4988301..0f17e8f 100644 --- a/src/rom24/spells/spell_mass_invis.py +++ b/src/rom24/spells/spell_mass_invis.py @@ -1,7 +1,7 @@ -import const -import handler_game -import merc -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import merc +from rom24 import state_checks def spell_mass_invis(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_nexus.py b/src/rom24/spells/spell_nexus.py index 4414a13..d5866d4 100644 --- a/src/rom24/spells/spell_nexus.py +++ b/src/rom24/spells/spell_nexus.py @@ -1,9 +1,9 @@ -import const -import handler_game -import handler_magic -import merc -import object_creator -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc +from rom24 import object_creator +from rom24 import state_checks def spell_nexus(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_pass_door.py b/src/rom24/spells/spell_pass_door.py index b3652a8..923f772 100644 --- a/src/rom24/spells/spell_pass_door.py +++ b/src/rom24/spells/spell_pass_door.py @@ -1,7 +1,7 @@ -import const -import game_utils -import handler_game -import merc +from rom24 import const +from rom24 import game_utils +from rom24 import handler_game +from rom24 import merc def spell_pass_door(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_plague.py b/src/rom24/spells/spell_plague.py index 9ded40b..8fe1be3 100644 --- a/src/rom24/spells/spell_plague.py +++ b/src/rom24/spells/spell_plague.py @@ -1,7 +1,7 @@ -import const -import handler_game -import handler_magic -import merc +from rom24 import const +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc def spell_plague(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_poison.py b/src/rom24/spells/spell_poison.py index abd724e..4186a6f 100644 --- a/src/rom24/spells/spell_poison.py +++ b/src/rom24/spells/spell_poison.py @@ -1,8 +1,8 @@ -import const -import handler_game -import handler_magic -import merc -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc +from rom24 import state_checks def spell_poison(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_portal.py b/src/rom24/spells/spell_portal.py index 44575a8..5c5f516 100644 --- a/src/rom24/spells/spell_portal.py +++ b/src/rom24/spells/spell_portal.py @@ -1,9 +1,9 @@ -import const -import handler_game -import handler_magic -import merc -import object_creator -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc +from rom24 import object_creator +from rom24 import state_checks def spell_portal(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_protection_evil.py b/src/rom24/spells/spell_protection_evil.py index 0521a5e..7f78da9 100644 --- a/src/rom24/spells/spell_protection_evil.py +++ b/src/rom24/spells/spell_protection_evil.py @@ -1,6 +1,6 @@ -import const -import handler_game -import merc +from rom24 import const +from rom24 import handler_game +from rom24 import merc def spell_protection_evil(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_protection_good.py b/src/rom24/spells/spell_protection_good.py index e6f2a01..c3e3fe9 100644 --- a/src/rom24/spells/spell_protection_good.py +++ b/src/rom24/spells/spell_protection_good.py @@ -1,6 +1,6 @@ -import const -import handler_game -import merc +from rom24 import const +from rom24 import handler_game +from rom24 import merc def spell_protection_good(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_ray_of_truth.py b/src/rom24/spells/spell_ray_of_truth.py index 858d045..70ee461 100644 --- a/src/rom24/spells/spell_ray_of_truth.py +++ b/src/rom24/spells/spell_ray_of_truth.py @@ -1,10 +1,10 @@ -import const -import fight -import game_utils -import handler_game -import handler_magic -import merc -import state_checks +from rom24 import const +from rom24 import fight +from rom24 import game_utils +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc +from rom24 import state_checks def spell_ray_of_truth(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_recharge.py b/src/rom24/spells/spell_recharge.py index b3ef9fd..97adf51 100644 --- a/src/rom24/spells/spell_recharge.py +++ b/src/rom24/spells/spell_recharge.py @@ -1,8 +1,8 @@ import random -import const -import handler_game -import merc +from rom24 import const +from rom24 import handler_game +from rom24 import merc def spell_recharge(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_refresh.py b/src/rom24/spells/spell_refresh.py index 2f1683f..63ba3b5 100644 --- a/src/rom24/spells/spell_refresh.py +++ b/src/rom24/spells/spell_refresh.py @@ -1,5 +1,5 @@ -import const -import merc +from rom24 import const +from rom24 import merc def spell_refresh(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_remove_curse.py b/src/rom24/spells/spell_remove_curse.py index b8008d4..c90cb4a 100644 --- a/src/rom24/spells/spell_remove_curse.py +++ b/src/rom24/spells/spell_remove_curse.py @@ -1,8 +1,8 @@ -import const -import handler_game -import handler_magic -import merc -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc +from rom24 import state_checks def spell_remove_curse(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_sanctuary.py b/src/rom24/spells/spell_sanctuary.py index 29766e0..b64f6f4 100644 --- a/src/rom24/spells/spell_sanctuary.py +++ b/src/rom24/spells/spell_sanctuary.py @@ -1,6 +1,6 @@ -import const -import handler_game -import merc +from rom24 import const +from rom24 import handler_game +from rom24 import merc def spell_sanctuary(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_shield.py b/src/rom24/spells/spell_shield.py index 074543f..8accf86 100644 --- a/src/rom24/spells/spell_shield.py +++ b/src/rom24/spells/spell_shield.py @@ -1,7 +1,7 @@ -import const -import handler_game -import merc -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import merc +from rom24 import state_checks def spell_shield(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_shocking_grasp.py b/src/rom24/spells/spell_shocking_grasp.py index e4378b6..a2dd037 100644 --- a/src/rom24/spells/spell_shocking_grasp.py +++ b/src/rom24/spells/spell_shocking_grasp.py @@ -1,8 +1,8 @@ import random -import const -import fight -import handler_magic -import merc +from rom24 import const +from rom24 import fight +from rom24 import handler_magic +from rom24 import merc def spell_shocking_grasp(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_sleep.py b/src/rom24/spells/spell_sleep.py index e3e1921..8ade391 100644 --- a/src/rom24/spells/spell_sleep.py +++ b/src/rom24/spells/spell_sleep.py @@ -1,8 +1,8 @@ -import const -import handler_game -import handler_magic -import merc -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc +from rom24 import state_checks def spell_sleep(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_slow.py b/src/rom24/spells/spell_slow.py index 509168d..56790ad 100644 --- a/src/rom24/spells/spell_slow.py +++ b/src/rom24/spells/spell_slow.py @@ -1,8 +1,8 @@ -import const -import handler_game -import handler_magic -import merc -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc +from rom24 import state_checks def spell_slow(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_stone_skin.py b/src/rom24/spells/spell_stone_skin.py index 386d00a..17a87e9 100644 --- a/src/rom24/spells/spell_stone_skin.py +++ b/src/rom24/spells/spell_stone_skin.py @@ -1,7 +1,7 @@ -import const -import handler_game -import merc -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import merc +from rom24 import state_checks def spell_stone_skin(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_summon.py b/src/rom24/spells/spell_summon.py index d36574e..249e309 100644 --- a/src/rom24/spells/spell_summon.py +++ b/src/rom24/spells/spell_summon.py @@ -1,8 +1,8 @@ -import const -import handler_game -import handler_magic -import merc -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc +from rom24 import state_checks def spell_summon(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_teleport.py b/src/rom24/spells/spell_teleport.py index 41c495a..6c7f3eb 100644 --- a/src/rom24/spells/spell_teleport.py +++ b/src/rom24/spells/spell_teleport.py @@ -1,9 +1,9 @@ -import const -import handler_game -import handler_magic -import handler_room -import merc -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import handler_room +from rom24 import merc +from rom24 import state_checks def spell_teleport(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_ventriloquate.py b/src/rom24/spells/spell_ventriloquate.py index d9713f8..2e1b7f9 100644 --- a/src/rom24/spells/spell_ventriloquate.py +++ b/src/rom24/spells/spell_ventriloquate.py @@ -1,7 +1,7 @@ -import game_utils -import handler_magic -import merc -import state_checks +from rom24 import game_utils +from rom24 import handler_magic +from rom24 import merc +from rom24 import state_checks def spell_ventriloquate(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_weaken.py b/src/rom24/spells/spell_weaken.py index 9c8f7c5..e6355db 100644 --- a/src/rom24/spells/spell_weaken.py +++ b/src/rom24/spells/spell_weaken.py @@ -1,8 +1,8 @@ -import const -import handler_game -import handler_magic -import merc -import state_checks +from rom24 import const +from rom24 import handler_game +from rom24 import handler_magic +from rom24 import merc +from rom24 import state_checks def spell_weaken(sn, level, ch, victim, target): diff --git a/src/rom24/spells/spell_word_of_recall.py b/src/rom24/spells/spell_word_of_recall.py index 78a634e..6d89dd9 100644 --- a/src/rom24/spells/spell_word_of_recall.py +++ b/src/rom24/spells/spell_word_of_recall.py @@ -1,9 +1,9 @@ -import const -import fight -import handler_game -import handler_room -import merc -import state_checks +from rom24 import const +from rom24 import fight +from rom24 import handler_game +from rom24 import handler_room +from rom24 import merc +from rom24 import state_checks def spell_word_of_recall(sn, level, ch, victim, target): diff --git a/src/rom24/state_checks.py b/src/rom24/state_checks.py index 97512e3..128b91a 100644 --- a/src/rom24/state_checks.py +++ b/src/rom24/state_checks.py @@ -1,43 +1,11 @@ -""" -/*************************************************************************** - * 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-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 * -***************************************************************************/ -/************ - * Ported to Python by Davion of MudBytes.net - * Using Miniboa https://code.google.com/p/miniboa/ - * Now using Python 3 version https://code.google.com/p/miniboa-py3/ - ************/ -""" + __author__ = 'syn' import time import logging logger = logging.getLogger(__name__) -import merc +from rom24 import merc def IS_SET(flag, bit): diff --git a/src/rom24/tables.py b/src/rom24/tables.py index be1f977..1ab8a4d 100644 --- a/src/rom24/tables.py +++ b/src/rom24/tables.py @@ -1,36 +1,4 @@ -""" -/*************************************************************************** - * 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-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 * -***************************************************************************/ -/************ - * Ported to Python by Davion of MudBytes.net - * Using Miniboa https://code.google.com/p/miniboa/ - * Now using Python 3 version https://code.google.com/p/miniboa-py3/ - ************/ -""" from collections import OrderedDict, namedtuple import logging diff --git a/src/rom24/uait/legacy_loads.py b/src/rom24/uait/legacy_loads.py index 8f6cec6..d8842a2 100644 --- a/src/rom24/uait/legacy_loads.py +++ b/src/rom24/uait/legacy_loads.py @@ -2,22 +2,22 @@ import pickle import sys import logging -import interp -import save +from rom24 import interp +from rom24 import save logger = logging.getLogger(__name__) -import const -import handler_item -import handler_room -import settings -import tables -import game_utils -import handler_ch -import handler_game -import world_classes -import merc -import state_checks +from rom24 import const +from rom24 import handler_item +from rom24 import handler_room +from rom24 import settings +from rom24 import tables +from rom24 import game_utils +from rom24 import handler_ch +from rom24 import handler_game +from rom24 import world_classes +from rom24 import merc +from rom24 import state_checks serializer_list = [] @@ -232,9 +232,8 @@ def load_socials(): def load_areas(): logger.info('Loading Areas...') - narea_list = os.path.join(settings.LEGACY_AREA_DIR, settings.AREA_LIST) parea_list = os.path.join(settings.LEGACY_AREA_DIR, settings.PAREA_LIST) - fp = open(narea_list, 'r') + fp = open(settings.AREA_LIST_FILE, 'r') area = fp.readline().strip() while area != "$": afp = open(os.path.join(settings.LEGACY_AREA_DIR, area), 'r') diff --git a/src/rom24/update.py b/src/rom24/update.py index 5feb300..799c284 100644 --- a/src/rom24/update.py +++ b/src/rom24/update.py @@ -1,36 +1,4 @@ -""" -#************************************************************************** - * 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-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 * -***************************************************************************/ -#*********** - * Ported to Python by Davion of MudBytes.net - * Using Miniboa https://code.google.com/p/miniboa/ - * Now using Python 3 version https://code.google.com/p/miniboa-py3/ - ************/ -""" + import os import random @@ -39,18 +7,18 @@ logger = logging.getLogger(__name__) -import merc -import db -import hotfix -import const -import fight -import settings -import state_checks -import handler_magic -import handler_game -import handler_ch -import game_utils -import instance +from rom24 import merc +from rom24 import db +from rom24 import hotfix +from rom24 import const +from rom24 import fight +from rom24 import settings +from rom24 import state_checks +from rom24 import handler_magic +from rom24 import handler_game +from rom24 import handler_ch +from rom24 import game_utils +from rom24 import instance # Advancement stuff. @@ -129,7 +97,7 @@ def hit_gain(ch): if number < ch.get_skill('fast healing'): gain += number * gain // 100 if ch.hit < ch.max_hit: - if ch.is_pc(): + if ch.is_pc: ch.check_improve('fast healing', True, 8) if ch.position == merc.POS_SLEEPING: @@ -184,7 +152,7 @@ def mana_gain(ch): if number < ch.get_skill('meditation'): gain += number * gain // 100 if ch.mana < ch.max_mana: - if ch.is_pc(): + if ch.is_pc: ch.check_improve( 'meditation', True, 8) if not ch.guild.fMana: @@ -726,7 +694,7 @@ def instance_number_save(): if instance.max_instance_id > instance.previous_max_instance_id: instance.previous_max_instance_id = instance.max_instance_id instance_num_file = os.path.join(settings.LEGACY_AREA_DIR, "instance_tracker.txt") - fp = open(instance_num_file, 'w') + fp = open(settings.INSTANCE_NUM_FILE, 'w') fp.write(str(instance.max_instance_id)) fp.close() logger.info("Saved the current instance number: %d" % (instance.max_instance_id,)) diff --git a/src/rom24/world_classes.py b/src/rom24/world_classes.py index 0c13fc8..4385b6a 100644 --- a/src/rom24/world_classes.py +++ b/src/rom24/world_classes.py @@ -7,12 +7,12 @@ logger = logging.getLogger(__name__) -import environment -import tables -import instance -import settings -import type_bypass -import bit +from rom24 import environment +from rom24 import tables +from rom24 import instance +from rom24 import settings +from rom24 import type_bypass +from rom24 import bit __author__ = 'syn' @@ -161,7 +161,7 @@ def save(self, force: bool=False): os.makedirs(pathname, 0o755, True) filename = os.path.join(pathname, '%d-area.json' % number) - logger.info('Saving %s', filename) + # logger.info('Saving %s', filename) js = json.dumps(self, default=instance.to_json, indent=4, sort_keys=True) md5 = hashlib.md5(js.encode('utf-8')).hexdigest() if self._md5 != md5: From 7b4c8f9ae1f6062f00303b0e7ebc56bfd7068ba3 Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Wed, 1 Dec 2021 14:18:47 -0800 Subject: [PATCH 09/40] Updated readme to have new installation/run instructions --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 29fea61..b328790 100644 --- a/README.md +++ b/README.md @@ -45,14 +45,14 @@ If all went well, you should be seeing a barrage of initialization messages and A basic interactive shell is available in **shell.py**. Various configuration options can be adjusted in **settings.py**. If you're running from a command -line, -``` -#!bash +line -cd ./Rom24/pysrc && python3 ./pyom.py +``` +cd PyRom +pip install -e . +rom24 ``` should get things started. If -you're using an IDE, make sure you set **pyom.py** as the start file. ## Configuring an Implementor Character ## From d8d05be2a8f4fe2a2ff19a56c216231adec3d9bc Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Wed, 1 Dec 2021 16:20:58 -0800 Subject: [PATCH 10/40] Working owhere function, and mostly functional stuff --- src/area/help.are | 15 ++++++++++ src/area/startup | 35 ----------------------- src/rom24/commands/do_brandish.py | 1 + src/rom24/commands/do_cast.py | 1 + src/rom24/commands/do_drink.py | 1 + src/rom24/commands/do_drop.py | 1 + src/rom24/commands/do_enter.py | 1 + src/rom24/commands/do_force.py | 3 +- src/rom24/commands/do_gain.py | 1 + src/rom24/commands/do_get.py | 1 + src/rom24/commands/do_open.py | 1 + src/rom24/commands/do_order.py | 1 + src/rom24/commands/do_owhere.py | 17 +++++++++-- src/rom24/commands/do_pick.py | 1 + src/rom24/commands/do_practice.py | 1 + src/rom24/commands/do_purge.py | 1 + src/rom24/commands/do_reload.py | 6 +++- src/rom24/commands/do_restore.py | 1 + src/rom24/commands/do_sacrifice.py | 2 +- src/rom24/commands/do_smote.py | 1 + src/rom24/commands/do_split.py | 1 + src/rom24/commands/do_sset.py | 22 ++++++++++++++ src/rom24/commands/do_train.py | 1 + src/rom24/commands/do_violate.py | 1 + src/rom24/data_loader.py | 3 +- src/rom24/fight.py | 6 ++-- src/rom24/handler_magic.py | 4 +-- src/rom24/handler_pc.py | 1 + src/rom24/hotfix.py | 2 +- src/rom24/instance.py | 1 - src/rom24/living.py | 28 ++++++++++++------ src/rom24/pyprogs.py | 46 ++++++++++++++++++------------ src/rom24/state_checks.py | 6 ++-- 33 files changed, 133 insertions(+), 81 deletions(-) delete mode 100644 src/area/startup diff --git a/src/area/help.are b/src/area/help.are index 6ff0d6b..b7a0880 100644 --- a/src/area/help.are +++ b/src/area/help.are @@ -945,6 +945,21 @@ given. Use string to change the strings on an object or mobile. (see also string, stat) ~ +58 SSET~ +Syntax: sset mob + sset + sset all + +The sset command is a shortcut for `set skill`. +(see also set) +~ + +58 at~ +Syntax: at + +THIS NEEDS A HELPFILE +~ + 55 STRING~ Syntax: string obj string mob diff --git a/src/area/startup b/src/area/startup deleted file mode 100644 index fef8214..0000000 --- a/src/area/startup +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/csh -# Written by Furey. -# With additions from Tony and Alander. - -# Set the port number. -set port = 9000 -if ( "$1" != "" ) set port="$1" - -# Change to area directory. -cd ../../area - -# Set limits. -if ( -e shutdown.txt ) rm -f shutdown.txt - -while ( 1 ) - # If you want to have logs in a different directory, - # change the 'set logfile' line to reflect the directory name. - set index = 1000 - while ( 1 ) - set logfile = ../log/$index.log - if ( ! -e $logfile ) break - @ index++ - end - - # Run rom. - ../src/rom $port >&! $logfile - - - # Restart, giving old connections a chance to die. - if ( -e shutdown.txt ) then - rm -f shutdown.txt - exit 0 - endif - sleep 15 -end diff --git a/src/rom24/commands/do_brandish.py b/src/rom24/commands/do_brandish.py index 6298483..bde20b1 100644 --- a/src/rom24/commands/do_brandish.py +++ b/src/rom24/commands/do_brandish.py @@ -9,6 +9,7 @@ from rom24 import interp from rom24 import const from rom24 import state_checks +from rom24 import instance def do_brandish(ch, argument): diff --git a/src/rom24/commands/do_cast.py b/src/rom24/commands/do_cast.py index 1865dd5..9458121 100644 --- a/src/rom24/commands/do_cast.py +++ b/src/rom24/commands/do_cast.py @@ -9,6 +9,7 @@ from rom24 import merc from rom24 import interp from rom24 import fight +from rom24 import instance def do_cast(ch, argument): diff --git a/src/rom24/commands/do_drink.py b/src/rom24/commands/do_drink.py index 7080c53..6378df1 100644 --- a/src/rom24/commands/do_drink.py +++ b/src/rom24/commands/do_drink.py @@ -8,6 +8,7 @@ from rom24 import update from rom24 import game_utils from rom24 import handler_game +from rom24 import instance def do_drink(ch, argument): diff --git a/src/rom24/commands/do_drop.py b/src/rom24/commands/do_drop.py index e8f2e88..a57a44d 100644 --- a/src/rom24/commands/do_drop.py +++ b/src/rom24/commands/do_drop.py @@ -7,6 +7,7 @@ from rom24 import merc from rom24 import interp from rom24 import game_utils +from rom24 import instance def do_drop(ch, argument): diff --git a/src/rom24/commands/do_enter.py b/src/rom24/commands/do_enter.py index 0122d89..499e309 100644 --- a/src/rom24/commands/do_enter.py +++ b/src/rom24/commands/do_enter.py @@ -8,6 +8,7 @@ from rom24 import interp from rom24 import handler_room from rom24 import state_checks +from rom24 import instance # RT Enter portals diff --git a/src/rom24/commands/do_force.py b/src/rom24/commands/do_force.py index 32e20f0..90058ea 100644 --- a/src/rom24/commands/do_force.py +++ b/src/rom24/commands/do_force.py @@ -7,6 +7,7 @@ from rom24 import game_utils from rom24 import handler_game from rom24 import state_checks +from rom24 import instance # Thanks to Grodyn for pointing out bugs in this function. @@ -57,7 +58,7 @@ def do_force(ch, argument): and victim.in_room.is_private() and not state_checks.IS_TRUSTED(ch, merc.MAX_LEVEL): ch.send("That character is in a private room.\n") return - if victim.is_pc() and victim.trust >= ch.trust: + if victim.is_pc and victim.trust >= ch.trust: ch.send("Do it yourself!\n") return if not victim.is_npc() and ch.trust < merc.MAX_LEVEL - 3: diff --git a/src/rom24/commands/do_gain.py b/src/rom24/commands/do_gain.py index 02c7bd9..0094fb7 100644 --- a/src/rom24/commands/do_gain.py +++ b/src/rom24/commands/do_gain.py @@ -9,6 +9,7 @@ from rom24 import magic from rom24 import game_utils from rom24 import handler_game +from rom24 import instance #TODO: Known broken. Probably needs some significant cleanup, doesn't appear to be granting skills properly. Needs more testing with non-immortal characters. def do_gain(ch, argument): diff --git a/src/rom24/commands/do_get.py b/src/rom24/commands/do_get.py index 2a6b136..d486626 100644 --- a/src/rom24/commands/do_get.py +++ b/src/rom24/commands/do_get.py @@ -8,6 +8,7 @@ from rom24 import game_utils from rom24 import handler_item from rom24 import state_checks +from rom24 import instance def do_get(ch, argument): diff --git a/src/rom24/commands/do_open.py b/src/rom24/commands/do_open.py index 6768190..bb83b01 100644 --- a/src/rom24/commands/do_open.py +++ b/src/rom24/commands/do_open.py @@ -8,6 +8,7 @@ from rom24 import handler_game from rom24 import handler_room from rom24 import state_checks +from rom24 import instance def do_open(ch, argument): diff --git a/src/rom24/commands/do_order.py b/src/rom24/commands/do_order.py index e76a30f..56118fd 100644 --- a/src/rom24/commands/do_order.py +++ b/src/rom24/commands/do_order.py @@ -7,6 +7,7 @@ from rom24 import game_utils from rom24 import handler_game from rom24 import state_checks +from rom24 import instance def do_order(ch, argument): diff --git a/src/rom24/commands/do_owhere.py b/src/rom24/commands/do_owhere.py index a013aa1..5ead69c 100644 --- a/src/rom24/commands/do_owhere.py +++ b/src/rom24/commands/do_owhere.py @@ -21,15 +21,25 @@ def do_owhere(ch, argument): if not ch.can_see_item(item) or not game_utils.is_name(argument, item.name) or ch.level < item.level: continue found = True + logger.info("owhere command found an item for %s: %s", argument, item) number += 1 - content = item.in_item - while content.in_item: + logger.debug("item: %s", item) + content = item.in_item if item.in_item else item + logger.debug("content: %s", content) + logger.debug("content.in_room: %s", content.in_room) + logger.debug("content.in_living: %s", content.in_living) + + # Check for our highest level of container to determine where it is in the world - this + # logic goes through and if a mob had a sword in a bag, it would iterate from the bag to the mob + # and then to the room around it to give a creature or a room. + + while content and content.in_item: content = content.in_item if content.in_living and ch.can_see(content.in_living) and content.in_living.in_room: ch.send("%3d) %s is carried by %s [[Room %d]]\n" % ( number, item.short_descr, state_checks.PERS(content.in_living, ch), content.in_living.in_room.vnum )) - elif content.in_room and ch.can_see_room(content.in_room): + elif content.in_room and ch.can_see_room(content.in_room.instance_id): ch.send("%3d) %s is in %s [[Room %d]]\n" % ( number, item.short_descr, content.in_room.name, content.in_room.vnum)) else: @@ -37,6 +47,7 @@ def do_owhere(ch, argument): if number >= max_found: break + if not found: ch.send("Nothing like that in heaven or earth.\n") diff --git a/src/rom24/commands/do_pick.py b/src/rom24/commands/do_pick.py index a9eca6b..934d890 100644 --- a/src/rom24/commands/do_pick.py +++ b/src/rom24/commands/do_pick.py @@ -10,6 +10,7 @@ from rom24 import handler_game from rom24 import handler_room from rom24 import state_checks +from rom24 import instance def do_pick(self, argument): diff --git a/src/rom24/commands/do_practice.py b/src/rom24/commands/do_practice.py index bc10846..78195dc 100644 --- a/src/rom24/commands/do_practice.py +++ b/src/rom24/commands/do_practice.py @@ -8,6 +8,7 @@ from rom24 import interp from rom24 import const from rom24 import state_checks +from rom24 import instance def do_practice(ch, argument): diff --git a/src/rom24/commands/do_purge.py b/src/rom24/commands/do_purge.py index 6979e13..6dc2ea6 100644 --- a/src/rom24/commands/do_purge.py +++ b/src/rom24/commands/do_purge.py @@ -8,6 +8,7 @@ from rom24 import interp from rom24 import game_utils from rom24 import state_checks +from rom24 import instance def do_purge(ch, argument): argument, arg = game_utils.read_word(argument) diff --git a/src/rom24/commands/do_reload.py b/src/rom24/commands/do_reload.py index c2e958a..437bace 100644 --- a/src/rom24/commands/do_reload.py +++ b/src/rom24/commands/do_reload.py @@ -3,13 +3,17 @@ logger = logging.getLogger(__name__) from rom24 import merc +from rom24 import nanny from rom24 import hotfix from rom24 import interp def do_reload(ch, argument): hotfix.reload_files(ch) - ch.send("Files reloaded.\n") + for d in merc.descriptor_list: + if d.is_connected(nanny.con_playing): + if d.character.trust <= ch.trust: + d.send(f"imp> {ch.name} reloaded files.") interp.register_command(interp.cmd_type('reload', do_reload, merc.POS_DEAD, merc.ML, merc.LOG_NORMAL, 1)) diff --git a/src/rom24/commands/do_restore.py b/src/rom24/commands/do_restore.py index 92c428f..546969b 100644 --- a/src/rom24/commands/do_restore.py +++ b/src/rom24/commands/do_restore.py @@ -7,6 +7,7 @@ from rom24 import fight from rom24 import game_utils from rom24 import handler_game +from rom24 import instance def do_restore(ch, argument): diff --git a/src/rom24/commands/do_sacrifice.py b/src/rom24/commands/do_sacrifice.py index f288d4a..b2b716c 100644 --- a/src/rom24/commands/do_sacrifice.py +++ b/src/rom24/commands/do_sacrifice.py @@ -7,7 +7,7 @@ from rom24 import interp from rom24 import game_utils from rom24 import handler_game - +from rom24 import instance def do_sacrifice(ch, argument): argument, arg = game_utils.read_word(argument) diff --git a/src/rom24/commands/do_smote.py b/src/rom24/commands/do_smote.py index 710b8a4..fb0cb53 100644 --- a/src/rom24/commands/do_smote.py +++ b/src/rom24/commands/do_smote.py @@ -5,6 +5,7 @@ from rom24 import merc from rom24 import interp from rom24 import game_utils +from rom24 import instance def do_smote(ch, argument): diff --git a/src/rom24/commands/do_split.py b/src/rom24/commands/do_split.py index d36c73b..c946620 100644 --- a/src/rom24/commands/do_split.py +++ b/src/rom24/commands/do_split.py @@ -7,6 +7,7 @@ from rom24 import game_utils from rom24 import handler_game from rom24 import state_checks +from rom24 import instance # 'Split' originally by Gnort, God of Chaos. def do_split(ch, argument): diff --git a/src/rom24/commands/do_sset.py b/src/rom24/commands/do_sset.py index 8fbe2b8..676cd81 100644 --- a/src/rom24/commands/do_sset.py +++ b/src/rom24/commands/do_sset.py @@ -10,6 +10,28 @@ def do_sset(ch, argument): + """Set a skill to a specific level. + + Example: + + <26hp 128m 454mv> sset bub dagger 100 + Skill set. + + <26hp 128m 454mv> skill + + Level 1: mace 1% trip 1% + backstab 1% wands 1% + dodge 1% peek 1% + recall 50% dagger 100% + sword 1% scrolls 1% + staves 1% hide 1% + Level 5: steal 1% + Level 12: second attack 1% disarm 1% + Level 7: pick lock 1% + Level 4: sneak 1% + + <26hp 128m 454mv> + """ argument, arg1 = game_utils.read_word(argument) argument, arg2 = game_utils.read_word(argument) argument, arg3 = game_utils.read_word(argument) diff --git a/src/rom24/commands/do_train.py b/src/rom24/commands/do_train.py index 577e84b..31df613 100644 --- a/src/rom24/commands/do_train.py +++ b/src/rom24/commands/do_train.py @@ -5,6 +5,7 @@ from rom24 import handler_game from rom24 import merc from rom24 import interp +from rom24 import instance def do_train(ch, argument): diff --git a/src/rom24/commands/do_violate.py b/src/rom24/commands/do_violate.py index 418ba13..91d7a5c 100644 --- a/src/rom24/commands/do_violate.py +++ b/src/rom24/commands/do_violate.py @@ -9,6 +9,7 @@ from rom24 import interp from rom24 import fight from rom24 import game_utils +from rom24 import instance def do_violate(ch, argument): diff --git a/src/rom24/data_loader.py b/src/rom24/data_loader.py index 1e0530e..b38ee30 100644 --- a/src/rom24/data_loader.py +++ b/src/rom24/data_loader.py @@ -30,7 +30,7 @@ def load_areas(): fp = open(settings.AREA_LIST_FILE, 'r') area = fp.readline().strip() while area != "$": - logger.debug("Loading area %s", area) + logger.info("Loading area %s", area) afp = open(os.path.join(settings.AREA_DIR, area), 'r') index += 1 load_area(afp.read(), index) @@ -58,7 +58,6 @@ def load_area(area, index): area, pArea.max_vnum = game_utils.read_int(area) instance.area_templates[pArea.name] = pArea area_instance = world_classes.Area(pArea) - logger.info(" Loading %s", area_instance) elif w == "#HELPS": area = load_helps(area) diff --git a/src/rom24/fight.py b/src/rom24/fight.py index 89d0475..39bef56 100644 --- a/src/rom24/fight.py +++ b/src/rom24/fight.py @@ -898,7 +898,7 @@ def stop_fighting(ch, fBoth): def make_corpse(ch): if ch.is_npc(): name = ch.short_descr - corpse = object_creator.create_item(item_templates[OBJ_VNUM_CORPSE_NPC], 0) + corpse = object_creator.create_item(instance.item_templates[OBJ_VNUM_CORPSE_NPC], 0) corpse.timer = random.randint(3, 6) if ch.gold > 0: corpse.put(object_creator.create_money(ch.gold, ch.silver)) @@ -907,7 +907,7 @@ def make_corpse(ch): corpse.cost = 0 else: name = ch.name - corpse = object_creator.create_item(item_templates[OBJ_VNUM_CORPSE_PC], 0) + corpse = object_creator.create_item(instance.item_templates[OBJ_VNUM_CORPSE_PC], 0) corpse.timer = random.randint(25, 40) ch.act.rem_bit(PLR_CANLOOT) if not ch.is_clan(): @@ -1004,7 +1004,7 @@ def death_cry(ch): handler_game.act(msg, ch, None, None, TO_ROOM) if vnum != 0: name = ch.short_descr if ch.is_npc() else ch.name - item = object_creator.create_item(item_templates[vnum], 0) + item = object_creator.create_item(instance.item_templates[vnum], 0) item.timer = random.randint(4, 7) item.short_descr = item.short_descr % name diff --git a/src/rom24/handler_magic.py b/src/rom24/handler_magic.py index b33794a..dc1afc9 100644 --- a/src/rom24/handler_magic.py +++ b/src/rom24/handler_magic.py @@ -58,7 +58,7 @@ def saves_dispel(dis_level, spell_level, duration): return random.randint(1,99) < save def check_dispel(dis_level, victim, skill): - from const import skill_table + from rom24.const import skill_table if state_checks.is_affected(victim, skill): for af in victim.affected[:]: if af.type == skill: @@ -82,7 +82,7 @@ def mana_cost (ch, min_mana, level): def find_spell(ch, name): #* finds a spell the character can cast if possible */ - from const import skill_table + from rom24.const import skill_table found = None if ch.is_npc(): return state_checks.prefix_lookup(skill_table,name) diff --git a/src/rom24/handler_pc.py b/src/rom24/handler_pc.py index 503e99e..f1de410 100644 --- a/src/rom24/handler_pc.py +++ b/src/rom24/handler_pc.py @@ -491,6 +491,7 @@ def check_social(ch, command, argument): return True def interpret(self, argument): + logger.debug("Char %s ran %s", self.name, argument) # Strip leading spaces. argument = argument.lstrip() diff --git a/src/rom24/hotfix.py b/src/rom24/hotfix.py index e679327..906b99a 100644 --- a/src/rom24/hotfix.py +++ b/src/rom24/hotfix.py @@ -78,7 +78,7 @@ def reload_files(ch): # infer the module from the file path though. for fp, mod in modified_files.copy().items(): import_path = fp.split('src')[-1] - module_name = import_path.replace('/', '.').lstrip('.').rstrip('.py') + module_name = import_path.replace('/', '.').lstrip('.').split('.py')[0] module = importlib.import_module(module_name) logger.warn('Reloading %s from %s', module, fp) try: diff --git a/src/rom24/instance.py b/src/rom24/instance.py index e021763..150f20e 100644 --- a/src/rom24/instance.py +++ b/src/rom24/instance.py @@ -200,7 +200,6 @@ def from_json(data): if module_name != '' and class_name != '': module_ref = importlib.import_module('rom24.' + module_name) class_ref = getattr(module_ref, class_name) - logger.debug("class_ref: %s", class_ref) if hasattr(class_ref, 'from_json'): return class_ref.from_json(data, from_json) diff --git a/src/rom24/living.py b/src/rom24/living.py index 72163a7..835f47a 100644 --- a/src/rom24/living.py +++ b/src/rom24/living.py @@ -303,9 +303,19 @@ def send(self, pstr): def is_npc(self): return self.act.is_set(merc.ACT_IS_NPC) + @property def is_pc(self): return not self.act.is_set(merc.ACT_IS_NPC) + @is_pc.setter + def is_pc(self, val): + if val is True: + self.act.rem_bit(merc.ACT_IS_NPC) + elif val is False: + self.act.set_bit(merc.ACT_IS_NPC) + else: + raise ValueError(f"Invalid bit set for is_pc: {val}. Values can only be true or false.") + def is_good(self): return self.alignment >= 350 @@ -580,12 +590,14 @@ def can_see_item(self, item): return True def can_see_room(self, room_id): + if self.is_immortal(): + return True if not room_id: - if self.is_immortal(): - return True - else: - return False - room = instance.rooms[room_id] + return False + room = instance.rooms.get(room_id) + if not room: + logger.error("No room found for room_id: %s", room_id) + return False if state_checks.IS_SET(room.room_flags, merc.ROOM_IMP_ONLY) and self.trust < merc.MAX_LEVEL: return False if state_checks.IS_SET(room.room_flags, merc.ROOM_GODS_ONLY) and not self.is_immortal(): @@ -774,8 +786,7 @@ def get_skill(self, sn): logger.error("BUG: Bad sn %s in get_skill." % sn) skill = 0 elif self.is_pc: - if self.level < const.skill_table[sn].skill_level[self.guild.name] \ - or sn not in self.learned: + if self.level < const.skill_table[sn].skill_level[self.guild.name] or sn not in self.learned: skill = 0 else: skill = self.learned[sn] @@ -824,8 +835,7 @@ def get_skill(self, sn): skill //= 2 else: skill = 2 * skill // 3 - if self.is_pc \ - and self.condition[merc.COND_DRUNK] > 10: + if self.is_pc and self.condition[merc.COND_DRUNK] > 10: skill = 9 * skill // 10 return max(0, min(skill, 100)) diff --git a/src/rom24/pyprogs.py b/src/rom24/pyprogs.py index 88a1898..bd5d749 100644 --- a/src/rom24/pyprogs.py +++ b/src/rom24/pyprogs.py @@ -400,22 +400,30 @@ def execute(self, actor, victim, argument, audience): exec_stop = time.time() logger.debug("Script took % 0.3fms", (exec_stop-exec_start) * 1000.0) -test_prog = """if actor.perm_hit > 20: - if actor.perm_hit > 30: - actor.do_say("I'm pretty much god.") - else: - actor.do_say("I'm a beast!") -else: - actor.do_say("I'm a wimp!") -if actor.guild.name == 'mage': - actor.do_say("I'm a mage tho, so don't mess with me.") -elif actor.guild.name == 'thief': - actor.do_say("I'm a thief, hold your wallet!") -else: - actor.do_say("I'm not sure what I am.") -if not actor.act.is_set(PLR_CANLOOT): - actor.do_say("And I can't loot!") -for vict in char_list: - actor.do_say(vict.name) -""" -register_prog('say', Progs(test_prog)) + +# TODO: Find out more about how this works - when I say anything, it also progged the scripts below, but +# it doesn't look like it's as simple as triggering it on anything, it looks like it has to trigger +# on valid commands. Commenting it out for now. + + +# test_prog = """if actor.perm_hit > 20: +# if actor.perm_hit > 30: +# actor.do_say("I'm pretty much god.") +# else: +# actor.do_say("I'm a beast!") +# else: +# actor.do_say("I'm a wimp!") + +# if actor.guild.name == 'mage': +# actor.do_say("I'm a mage tho, so don't mess with me.") +# elif actor.guild.name == 'thief': +# actor.do_say("I'm a thief, hold your wallet!") +# else: +# actor.do_say("I'm not sure what I am.") + +# if not actor.act.is_set(PLR_CANLOOT): +# actor.do_say("And I can't loot!") +# for vict in char_list: +# actor.do_say(vict.name) +# """ +# register_prog('say', Progs(test_prog)) diff --git a/src/rom24/state_checks.py b/src/rom24/state_checks.py index 128b91a..a718a02 100644 --- a/src/rom24/state_checks.py +++ b/src/rom24/state_checks.py @@ -104,17 +104,17 @@ def IS_AWAKE(ch): def GET_AC(ch, ptype): - from const import dex_app + from rom24.const import dex_app return ch.armor[ptype] + (dex_app[ch.stat(merc.STAT_DEX)].defensive if IS_AWAKE(ch) else 0) def GET_HITROLL(ch): - from const import str_app + from rom24.const import str_app return ch.hitroll + str_app[ch.stat(merc.STAT_STR)].tohit def GET_DAMROLL(ch): - from const import str_app + from rom24.const import str_app return ch.damroll + str_app[ch.stat(merc.STAT_STR)].todam From e8681381a539cd37e05879b1deef19a145594973 Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Wed, 1 Dec 2021 18:38:45 -0800 Subject: [PATCH 11/40] Rmoving old C code --- archive/README | 154 -- archive/README.rom | 32 - archive/README.version | 1 - archive/src/Makefile | 22 - archive/src/Makefile.linux | 19 - archive/src/Makefile.normal | 18 - archive/src/Makefile.solaris | 19 - archive/src/act_comm.c | 1999 --------------- archive/src/act_enter.c | 214 -- archive/src/act_info.c | 2755 -------------------- archive/src/act_move.c | 1640 ------------ archive/src/act_obj.c | 2989 --------------------- archive/src/act_wiz.c | 4378 ------------------------------- archive/src/alias.c | 273 -- archive/src/ban.c | 309 --- archive/src/comm.c | 2572 ------------------- archive/src/const.c | 2125 --------------- archive/src/db.c | 3372 ------------------------ archive/src/db.h | 52 - archive/src/db2.c | 493 ---- archive/src/effects.c | 621 ----- archive/src/fight.c | 3095 ---------------------- archive/src/flags.c | 249 -- archive/src/handler.c | 2912 --------------------- archive/src/healer.c | 196 -- archive/src/interp.c | 796 ------ archive/src/interp.h | 298 --- archive/src/lookup.c | 106 - archive/src/lookup.h | 32 - archive/src/magic.c | 4699 ---------------------------------- archive/src/magic.h | 130 - archive/src/magic2.c | 174 -- archive/src/merc.h | 2322 ----------------- archive/src/music.c | 350 --- archive/src/music.h | 43 - archive/src/note.c | 960 ------- archive/src/recycle.c | 652 ----- archive/src/recycle.h | 112 - archive/src/save.c | 1665 ------------ archive/src/scan.c | 127 - archive/src/skills.c | 1069 -------- archive/src/special.c | 1042 -------- archive/src/tables.c | 322 --- archive/src/tables.h | 81 - archive/src/telnet.h | 87 - archive/src/update.c | 1127 -------- 46 files changed, 46703 deletions(-) delete mode 100644 archive/README delete mode 100644 archive/README.rom delete mode 100644 archive/README.version delete mode 100644 archive/src/Makefile delete mode 100644 archive/src/Makefile.linux delete mode 100644 archive/src/Makefile.normal delete mode 100644 archive/src/Makefile.solaris delete mode 100644 archive/src/act_comm.c delete mode 100644 archive/src/act_enter.c delete mode 100644 archive/src/act_info.c delete mode 100644 archive/src/act_move.c delete mode 100644 archive/src/act_obj.c delete mode 100644 archive/src/act_wiz.c delete mode 100644 archive/src/alias.c delete mode 100644 archive/src/ban.c delete mode 100644 archive/src/comm.c delete mode 100644 archive/src/const.c delete mode 100644 archive/src/db.c delete mode 100644 archive/src/db.h delete mode 100644 archive/src/db2.c delete mode 100644 archive/src/effects.c delete mode 100644 archive/src/fight.c delete mode 100644 archive/src/flags.c delete mode 100644 archive/src/handler.c delete mode 100644 archive/src/healer.c delete mode 100644 archive/src/interp.c delete mode 100644 archive/src/interp.h delete mode 100644 archive/src/lookup.c delete mode 100644 archive/src/lookup.h delete mode 100644 archive/src/magic.c delete mode 100644 archive/src/magic.h delete mode 100644 archive/src/magic2.c delete mode 100644 archive/src/merc.h delete mode 100644 archive/src/music.c delete mode 100644 archive/src/music.h delete mode 100644 archive/src/note.c delete mode 100644 archive/src/recycle.c delete mode 100644 archive/src/recycle.h delete mode 100644 archive/src/save.c delete mode 100644 archive/src/scan.c delete mode 100644 archive/src/skills.c delete mode 100644 archive/src/special.c delete mode 100644 archive/src/tables.c delete mode 100644 archive/src/tables.h delete mode 100644 archive/src/telnet.h delete mode 100644 archive/src/update.c diff --git a/archive/README b/archive/README deleted file mode 100644 index e10bca0..0000000 --- a/archive/README +++ /dev/null @@ -1,154 +0,0 @@ - -Merc Release 2.1 -Sunday 01 August 1993 - -Furey mec@shell.portal.com -Hatchet hatchet@uclink.berkeley.edu -Kahn michael@uclink.berkeley.edu - - - -=== Introduction - -Merc Diku Mud is a Diku Mud with many enhancements and contributions. See our -'contrib.txt' and 'help merc' for acknowledgements. Send us your contribution, -and you'll be in there too! - -Enjoy our mud. May your visit here be ... Mercenary. - -This is the 2.1 production release of Merc. - - - -=== Copyright and License - -Diku Mud is copyright (C) 1990, 1991 by Sebastian Hammer, Michael Seifert, -Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe. Their license agreement -is in the file 'license.doc'. - -Merc Diku Mud is a derivative of the original Diku Mud and is subject to their -copyright and license agreement. Merc Diku Mud contains substantial -enhancements to Diku Mud. These enhancements are copyright 1992, 1993 by -Michael Chastain, Michael Quan, and Mitchell Tse. Our license agreement is in -'license.txt'. - -The license terms boil down to this: the people who wrote this mud want due -credit for their work. - - - -=== Contents of the Release - - area Area files. - doc Documentation. - log Log files (initially empty). - player Player files (initially empty). - src Source files. - - - -=== How to Install - -First, group with your highest level Unix guru, and have him or her tank. -Merc is easier to install than other muds, but every site is different. - -(1) Get the release Merc_21.tar.gz from one of these fine anonymous ftp - sites: - - ftp.tcp.com (formerly ferkel.ucsb.edu) - ftp.math.okstate.edu - -(2) Unpack the release: - - gzip -d -c Merc_21.tar.gz | tar xvf - - -(3) Go into the 'src' directory. Choose the Makefile for your operating - system and copy it into 'Makefile': - - Makefile Most machines with 'gcc' - Makefile.aix AIX - Makefile.hp Hp/UX - Makefile.isc Interactive Systems Unix - Makefile.mip Mips Risc/OS - Makefile.nex NeXT - Makefile.sol SunSoft Solaris 2.1 - Makefile.tra Traditional C (see 'trad.txt') - - Merc.exe, a pre-built MsDos executable, is included in the release. - See 'port.txt' for more information on porting, including the - single-user MsDos and Macintosh versions. - -(4) Run 'make' with the following options: - - make -k >&! make.out - - This will take 10 minutes to 60 minutes, depending on the speed of your - computer. - - If you encounter errors with 'make', send us your 'make.out' file: - - mail -s make.out mec@shell.portal.com < make.out - - Also we'll need to know what kind of hardware, operating system, - and C compiler you have. - - We will help you get Merc running, but obviously we can't guarantee - Merc will run on any particular machine. - -(5) Start the game: - - startup & - telnet localhost 4000 - -(6) To make your first immortal character, just start as a mortal - character, play at least as far as level 2, and then edit the - player file and change your level. (After the first immortal, - you can advance the rest). - -(7) If you haven't already done so, read 'license.doc' and 'license.txt'. - Because Merc is a derivative work of Diku Mud, you must register - your mud with the original Diku implementors. - -(8) Of course you're going to change the title screen, help files, and so on. - Don't just globally erase the 'Merc' references, ok? You wouldn't - like it if we did that to your work, so don't do it to ours. - - - -=== Support - -First, read the documentation in the 'doc' directory. We rewrote all of the -documentation files from scratch for the 2.0 Alpha release, and have been -keeping them up-to-date since. - -Also check the 'wizhelp' command and read the 'help' descriptions for the -individual immortal commands. - -There is a mailing list at 'merc@kpc.com'. Send mail to 'merc-request@kpc.com' -to join the list. - -You can write to us directly at the e-mail addresses at the top of this -document. - -When you write us, we need to know what kind of machine you're running on. If -you can give us specific information about the problem, that helps too. - -Specific information means: an adb or gdb stack trace (if you're reporting a -crash), or a syslog with the relevant commands logged. The player files are -ascii files -- dump them into your mail message too. - -If your e-mail is too vague, we're likely to bounce it back. There are three -of us and dozens of you -- we simply can't engage in long-distance debugging, -on unknown platforms, with the added factor of more code that you've dropped in -since the release. - - - -=== Future Plans - -We have finished core development of Merc. There will never be a Merc 3. -It's your mud now -- the end of our development is the beginning of yours. - -We will continue making maintenance releases to fix bugs, add new platform -support, and fold in contributed code and areas. The next release of Merc, -version 2.2, will be on 05 Sep 1993. diff --git a/archive/README.rom b/archive/README.rom deleted file mode 100644 index 59a25f0..0000000 --- a/archive/README.rom +++ /dev/null @@ -1,32 +0,0 @@ -This is the ROM 2.4 beta version of Merc 2.1 base code. -Please read the file in /Rom24/doc called rom.license before using -this program. - -Some notes about ROM code: - -The file rom.credits contains some contributions to the code. - -The lore skill is not completed at this time, nor are material types -and mobile memory. - -The race table (in const.c) can be expanded at will to add new races -Be sure to add new pc races to both the race table and the pc race -table, and make sure the order is the same. - -The ROM FAQ, by Gary Turkington, is available online at: -http://www.hypercube.org/tess/rom/ - -If you have any questions not covered by the FAQ, feel free to bug me at -rtaylor@hypercube.org. There is also a mailing list at rom@rom.org, to join -it, send to subject subscribe to rom-request@rom.org. Thanks to Brian Moore -for providing the list site. - -(the final ROM 2.4 is in the works, if that's your question) - -Alander - -[Please read the Rom FAQ material, located at http://www.hypercube.org/tess/rom. -There are short explanations of how to get the mud running for the first time, -and short answers to simple questions. Much more detailed matters are handled -in Garry Turkington's Rom FAQ, also located at that site. Thanks Garry! --- Satin] diff --git a/archive/README.version b/archive/README.version deleted file mode 100644 index 09c6cda..0000000 --- a/archive/README.version +++ /dev/null @@ -1 +0,0 @@ -ROM 2.4b6, May 29, 1998 diff --git a/archive/src/Makefile b/archive/src/Makefile deleted file mode 100644 index 8728499..0000000 --- a/archive/src/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -CC = gcc -PROF = -O -g -NOCRYPT = -C_FLAGS = -Wall $(PROF) $(NOCRYPT) -L_FLAGS = $(PROF) - -O_FILES = act_comm.o act_enter.o act_info.o act_move.o act_obj.o act_wiz.o \ - alias.o ban.o comm.o const.o db.o db2.o effects.o fight.o flags.o \ - handler.o healer.o interp.o note.o lookup.o magic.o magic2.o \ - music.o recycle.o save.o scan.o skills.o special.o tables.o \ - update.o -lcrypt - -rom: $(O_FILES) - rm -f rom - $(CC) $(L_FLAGS) -o rom $(O_FILES) - -.c.o: merc.h - $(CC) -c $(C_FLAGS) $< - -clean: - @rm -f *.o - make diff --git a/archive/src/Makefile.linux b/archive/src/Makefile.linux deleted file mode 100644 index cf44f87..0000000 --- a/archive/src/Makefile.linux +++ /dev/null @@ -1,19 +0,0 @@ -CC = gcc -PROF = -O -g -NOCRYPT = -C_FLAGS = -Wall $(PROF) $(NOCRYPT) -L_FLAGS = $(PROF) -LIBS = -lcrypt - -O_FILES = act_comm.o act_enter.o act_info.o act_move.o act_obj.o act_wiz.o \ - alias.o ban.o comm.o const.o db.o db2.o effects.o fight.o flags.o \ - handler.o healer.o interp.o note.o lookup.o magic.o magic2.o \ - music.o recycle.o save.o scan.o skills.o special.o tables.o \ - update.o - -rom: $(O_FILES) - rm -f rom - $(CC) $(L_FLAGS) -o rom $(O_FILES) $(LIBS) - -.c.o: merc.h - $(CC) -c $(C_FLAGS) $< diff --git a/archive/src/Makefile.normal b/archive/src/Makefile.normal deleted file mode 100644 index efcc512..0000000 --- a/archive/src/Makefile.normal +++ /dev/null @@ -1,18 +0,0 @@ -CC = gcc -PROF = -O -g -NOCRYPT = -C_FLAGS = -Wall $(PROF) $(NOCRYPT) -L_FLAGS = $(PROF) - -O_FILES = act_comm.o act_enter.o act_info.o act_move.o act_obj.o act_wiz.o \ - alias.o ban.o comm.o const.o db.o db2.o effects.o fight.o flags.o \ - handler.o healer.o interp.o note.o lookup.o magic.o magic2.o \ - music.o recycle.o save.o scan.o skills.o special.o tables.o \ - update.o - -rom: $(O_FILES) - rm -f rom - $(CC) $(L_FLAGS) -o rom $(O_FILES) - -.c.o: merc.h - $(CC) -c $(C_FLAGS) $< diff --git a/archive/src/Makefile.solaris b/archive/src/Makefile.solaris deleted file mode 100644 index 5d0038c..0000000 --- a/archive/src/Makefile.solaris +++ /dev/null @@ -1,19 +0,0 @@ -CC = gcc -PROF = -O -g -NOCRYPT = -C_FLAGS = -Wall $(PROF) $(NOCRYPT) -L_FLAGS = $(PROF) -LIBS = -lsocket -lresolv -lnsl - -O_FILES = act_comm.o act_enter.o act_info.o act_move.o act_obj.o act_wiz.o \ - alias.o ban.o comm.o const.o db.o db2.o effects.o fight.o flags.o \ - handler.o healer.o interp.o note.o lookup.o magic.o magic2.o \ - music.o recycle.o save.o scan.o skills.o special.o tables.o \ - update.o - -rom: $(O_FILES) - rm -f rom - $(CC) $(L_FLAGS) -o rom $(O_FILES) $(LIBS) - -.c.o: merc.h - $(CC) -c $(C_FLAGS) $< diff --git a/archive/src/act_comm.c b/archive/src/act_comm.c deleted file mode 100644 index a11bf11..0000000 --- a/archive/src/act_comm.c +++ /dev/null @@ -1,1999 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#include -#endif -#include -#include -#include -#include -#include -#include "merc.h" -#include "interp.h" -#include "recycle.h" -#include "tables.h" - -/* RT code to delete yourself */ - -void do_delet( CHAR_DATA *ch, char *argument) -{ - send_to_char("You must type the full command to delete yourself.\n\r",ch); -} - -void do_delete( CHAR_DATA *ch, char *argument) -{ - char strsave[MAX_INPUT_LENGTH]; - - if (IS_NPC(ch)) - return; - - if (ch->pcdata->confirm_delete) - { - if (argument[0] != '\0') - { - send_to_char("Delete status removed.\n\r",ch); - ch->pcdata->confirm_delete = FALSE; - return; - } - else - { - sprintf( strsave, "%s%s", PLAYER_DIR, capitalize( ch->name ) ); - wiznet("$N turns $Mself into line noise.",ch,NULL,0,0,0); - stop_fighting(ch,TRUE); - do_function(ch, &do_quit, ""); - unlink(strsave); - return; - } - } - - if (argument[0] != '\0') - { - send_to_char("Just type delete. No argument.\n\r",ch); - return; - } - - send_to_char("Type delete again to confirm this command.\n\r",ch); - send_to_char("WARNING: this command is irreversible.\n\r",ch); - send_to_char("Typing delete with an argument will undo delete status.\n\r", - ch); - ch->pcdata->confirm_delete = TRUE; - wiznet("$N is contemplating deletion.",ch,NULL,0,0,get_trust(ch)); -} - - -/* RT code to display channel status */ - -void do_channels( CHAR_DATA *ch, char *argument) -{ - char buf[MAX_STRING_LENGTH]; - - /* lists all channels and their status */ - send_to_char(" channel status\n\r",ch); - send_to_char("---------------------\n\r",ch); - - send_to_char("gossip ",ch); - if (!IS_SET(ch->comm,COMM_NOGOSSIP)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("auction ",ch); - if (!IS_SET(ch->comm,COMM_NOAUCTION)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("music ",ch); - if (!IS_SET(ch->comm,COMM_NOMUSIC)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("Q/A ",ch); - if (!IS_SET(ch->comm,COMM_NOQUESTION)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("Quote ",ch); - if (!IS_SET(ch->comm,COMM_NOQUOTE)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("grats ",ch); - if (!IS_SET(ch->comm,COMM_NOGRATS)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - if (IS_IMMORTAL(ch)) - { - send_to_char("god channel ",ch); - if(!IS_SET(ch->comm,COMM_NOWIZ)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - } - - send_to_char("shouts ",ch); - if (!IS_SET(ch->comm,COMM_SHOUTSOFF)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("tells ",ch); - if (!IS_SET(ch->comm,COMM_DEAF)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("quiet mode ",ch); - if (IS_SET(ch->comm,COMM_QUIET)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - if (IS_SET(ch->comm,COMM_AFK)) - send_to_char("You are AFK.\n\r",ch); - - if (IS_SET(ch->comm,COMM_SNOOP_PROOF)) - send_to_char("You are immune to snooping.\n\r",ch); - - if (ch->lines != PAGELEN) - { - if (ch->lines) - { - sprintf(buf,"You display %d lines of scroll.\n\r",ch->lines+2); - send_to_char(buf,ch); - } - else - send_to_char("Scroll buffering is off.\n\r",ch); - } - - if (ch->prompt != NULL) - { - sprintf(buf,"Your current prompt is: %s\n\r",ch->prompt); - send_to_char(buf,ch); - } - - if (IS_SET(ch->comm,COMM_NOSHOUT)) - send_to_char("You cannot shout.\n\r",ch); - - if (IS_SET(ch->comm,COMM_NOTELL)) - send_to_char("You cannot use tell.\n\r",ch); - - if (IS_SET(ch->comm,COMM_NOCHANNELS)) - send_to_char("You cannot use channels.\n\r",ch); - - if (IS_SET(ch->comm,COMM_NOEMOTE)) - send_to_char("You cannot show emotions.\n\r",ch); - -} - -/* RT deaf blocks out all shouts */ - -void do_deaf( CHAR_DATA *ch, char *argument) -{ - - if (IS_SET(ch->comm,COMM_DEAF)) - { - send_to_char("You can now hear tells again.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_DEAF); - } - else - { - send_to_char("From now on, you won't hear tells.\n\r",ch); - SET_BIT(ch->comm,COMM_DEAF); - } -} - -/* RT quiet blocks out all communication */ - -void do_quiet ( CHAR_DATA *ch, char * argument) -{ - if (IS_SET(ch->comm,COMM_QUIET)) - { - send_to_char("Quiet mode removed.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_QUIET); - } - else - { - send_to_char("From now on, you will only hear says and emotes.\n\r",ch); - SET_BIT(ch->comm,COMM_QUIET); - } -} - -/* afk command */ - -void do_afk ( CHAR_DATA *ch, char * argument) -{ - if (IS_SET(ch->comm,COMM_AFK)) - { - send_to_char("AFK mode removed. Type 'replay' to see tells.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_AFK); - } - else - { - send_to_char("You are now in AFK mode.\n\r",ch); - SET_BIT(ch->comm,COMM_AFK); - } -} - -void do_replay (CHAR_DATA *ch, char *argument) -{ - if (IS_NPC(ch)) - { - send_to_char("You can't replay.\n\r",ch); - return; - } - - if (buf_string(ch->pcdata->buffer)[0] == '\0') - { - send_to_char("You have no tells to replay.\n\r",ch); - return; - } - - page_to_char(buf_string(ch->pcdata->buffer),ch); - clear_buf(ch->pcdata->buffer); -} - -/* RT auction rewritten in ROM style */ -void do_auction( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - DESCRIPTOR_DATA *d; - - if (argument[0] == '\0' ) - { - if (IS_SET(ch->comm,COMM_NOAUCTION)) - { - send_to_char("Auction channel is now ON.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_NOAUCTION); - } - else - { - send_to_char("Auction channel is now OFF.\n\r",ch); - SET_BIT(ch->comm,COMM_NOAUCTION); - } - } - else /* auction message sent, turn auction on if it is off */ - { - if (IS_SET(ch->comm,COMM_QUIET)) - { - send_to_char("You must turn off quiet mode first.\n\r",ch); - return; - } - - if (IS_SET(ch->comm,COMM_NOCHANNELS)) - { - send_to_char("The gods have revoked your channel priviliges.\n\r",ch); - return; - } - - REMOVE_BIT(ch->comm,COMM_NOAUCTION); - } - - sprintf( buf, "You auction '%s'\n\r", argument ); - send_to_char( buf, ch ); - for ( d = descriptor_list; d != NULL; d = d->next ) - { - CHAR_DATA *victim; - - victim = d->original ? d->original : d->character; - - if ( d->connected == CON_PLAYING && - d->character != ch && - !IS_SET(victim->comm,COMM_NOAUCTION) && - !IS_SET(victim->comm,COMM_QUIET) ) - { - act_new("$n auctions '$t'", - ch,argument,d->character,TO_VICT,POS_DEAD); - } - } -} - -/* RT chat replaced with ROM gossip */ -void do_gossip( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - DESCRIPTOR_DATA *d; - - if (argument[0] == '\0' ) - { - if (IS_SET(ch->comm,COMM_NOGOSSIP)) - { - send_to_char("Gossip channel is now ON.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_NOGOSSIP); - } - else - { - send_to_char("Gossip channel is now OFF.\n\r",ch); - SET_BIT(ch->comm,COMM_NOGOSSIP); - } - } - else /* gossip message sent, turn gossip on if it isn't already */ - { - if (IS_SET(ch->comm,COMM_QUIET)) - { - send_to_char("You must turn off quiet mode first.\n\r",ch); - return; - } - - if (IS_SET(ch->comm,COMM_NOCHANNELS)) - { - send_to_char("The gods have revoked your channel priviliges.\n\r",ch); - return; - - } - - REMOVE_BIT(ch->comm,COMM_NOGOSSIP); - - sprintf( buf, "You gossip '%s'\n\r", argument ); - send_to_char( buf, ch ); - for ( d = descriptor_list; d != NULL; d = d->next ) - { - CHAR_DATA *victim; - - victim = d->original ? d->original : d->character; - - if ( d->connected == CON_PLAYING && - d->character != ch && - !IS_SET(victim->comm,COMM_NOGOSSIP) && - !IS_SET(victim->comm,COMM_QUIET) ) - { - act_new( "$n gossips '$t'", - ch,argument, d->character, TO_VICT,POS_SLEEPING ); - } - } - } -} - -void do_grats( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - DESCRIPTOR_DATA *d; - - if (argument[0] == '\0' ) - { - if (IS_SET(ch->comm,COMM_NOGRATS)) - { - send_to_char("Grats channel is now ON.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_NOGRATS); - } - else - { - send_to_char("Grats channel is now OFF.\n\r",ch); - SET_BIT(ch->comm,COMM_NOGRATS); - } - } - else /* grats message sent, turn grats on if it isn't already */ - { - if (IS_SET(ch->comm,COMM_QUIET)) - { - send_to_char("You must turn off quiet mode first.\n\r",ch); - return; - } - - if (IS_SET(ch->comm,COMM_NOCHANNELS)) - { - send_to_char("The gods have revoked your channel priviliges.\n\r",ch); - return; - - } - - REMOVE_BIT(ch->comm,COMM_NOGRATS); - - sprintf( buf, "You grats '%s'\n\r", argument ); - send_to_char( buf, ch ); - for ( d = descriptor_list; d != NULL; d = d->next ) - { - CHAR_DATA *victim; - - victim = d->original ? d->original : d->character; - - if ( d->connected == CON_PLAYING && - d->character != ch && - !IS_SET(victim->comm,COMM_NOGRATS) && - !IS_SET(victim->comm,COMM_QUIET) ) - { - act_new( "$n grats '$t'", - ch,argument, d->character, TO_VICT,POS_SLEEPING ); - } - } - } -} - -void do_quote( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - DESCRIPTOR_DATA *d; - - if (argument[0] == '\0' ) - { - if (IS_SET(ch->comm,COMM_NOQUOTE)) - { - send_to_char("Quote channel is now ON.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_NOQUOTE); - } - else - { - send_to_char("Quote channel is now OFF.\n\r",ch); - SET_BIT(ch->comm,COMM_NOQUOTE); - } - } - else /* quote message sent, turn quote on if it isn't already */ - { - if (IS_SET(ch->comm,COMM_QUIET)) - { - send_to_char("You must turn off quiet mode first.\n\r",ch); - return; - } - - if (IS_SET(ch->comm,COMM_NOCHANNELS)) - { - send_to_char("The gods have revoked your channel priviliges.\n\r",ch); - return; - - } - - REMOVE_BIT(ch->comm,COMM_NOQUOTE); - - sprintf( buf, "You quote '%s'\n\r", argument ); - send_to_char( buf, ch ); - for ( d = descriptor_list; d != NULL; d = d->next ) - { - CHAR_DATA *victim; - - victim = d->original ? d->original : d->character; - - if ( d->connected == CON_PLAYING && - d->character != ch && - !IS_SET(victim->comm,COMM_NOQUOTE) && - !IS_SET(victim->comm,COMM_QUIET) ) - { - act_new( "$n quotes '$t'", - ch,argument, d->character, TO_VICT,POS_SLEEPING ); - } - } - } -} - -/* RT question channel */ -void do_question( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - DESCRIPTOR_DATA *d; - - if (argument[0] == '\0' ) - { - if (IS_SET(ch->comm,COMM_NOQUESTION)) - { - send_to_char("Q/A channel is now ON.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_NOQUESTION); - } - else - { - send_to_char("Q/A channel is now OFF.\n\r",ch); - SET_BIT(ch->comm,COMM_NOQUESTION); - } - } - else /* question sent, turn Q/A on if it isn't already */ - { - if (IS_SET(ch->comm,COMM_QUIET)) - { - send_to_char("You must turn off quiet mode first.\n\r",ch); - return; - } - - if (IS_SET(ch->comm,COMM_NOCHANNELS)) - { - send_to_char("The gods have revoked your channel priviliges.\n\r",ch); - return; - } - - REMOVE_BIT(ch->comm,COMM_NOQUESTION); - - sprintf( buf, "You question '%s'\n\r", argument ); - send_to_char( buf, ch ); - for ( d = descriptor_list; d != NULL; d = d->next ) - { - CHAR_DATA *victim; - - victim = d->original ? d->original : d->character; - - if ( d->connected == CON_PLAYING && - d->character != ch && - !IS_SET(victim->comm,COMM_NOQUESTION) && - !IS_SET(victim->comm,COMM_QUIET) ) - { - act_new("$n questions '$t'", - ch,argument,d->character,TO_VICT,POS_SLEEPING); - } - } - } -} - -/* RT answer channel - uses same line as questions */ -void do_answer( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - DESCRIPTOR_DATA *d; - - if (argument[0] == '\0' ) - { - if (IS_SET(ch->comm,COMM_NOQUESTION)) - { - send_to_char("Q/A channel is now ON.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_NOQUESTION); - } - else - { - send_to_char("Q/A channel is now OFF.\n\r",ch); - SET_BIT(ch->comm,COMM_NOQUESTION); - } - } - else /* answer sent, turn Q/A on if it isn't already */ - { - if (IS_SET(ch->comm,COMM_QUIET)) - { - send_to_char("You must turn off quiet mode first.\n\r",ch); - return; - } - - if (IS_SET(ch->comm,COMM_NOCHANNELS)) - { - send_to_char("The gods have revoked your channel priviliges.\n\r",ch); - return; - } - - REMOVE_BIT(ch->comm,COMM_NOQUESTION); - - sprintf( buf, "You answer '%s'\n\r", argument ); - send_to_char( buf, ch ); - for ( d = descriptor_list; d != NULL; d = d->next ) - { - CHAR_DATA *victim; - - victim = d->original ? d->original : d->character; - - if ( d->connected == CON_PLAYING && - d->character != ch && - !IS_SET(victim->comm,COMM_NOQUESTION) && - !IS_SET(victim->comm,COMM_QUIET) ) - { - act_new("$n answers '$t'", - ch,argument,d->character,TO_VICT,POS_SLEEPING); - } - } - } -} - -/* RT music channel */ -void do_music( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - DESCRIPTOR_DATA *d; - - if (argument[0] == '\0' ) - { - if (IS_SET(ch->comm,COMM_NOMUSIC)) - { - send_to_char("Music channel is now ON.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_NOMUSIC); - } - else - { - send_to_char("Music channel is now OFF.\n\r",ch); - SET_BIT(ch->comm,COMM_NOMUSIC); - } - } - else /* music sent, turn music on if it isn't already */ - { - if (IS_SET(ch->comm,COMM_QUIET)) - { - send_to_char("You must turn off quiet mode first.\n\r",ch); - return; - } - - if (IS_SET(ch->comm,COMM_NOCHANNELS)) - { - send_to_char("The gods have revoked your channel priviliges.\n\r",ch); - return; - } - - REMOVE_BIT(ch->comm,COMM_NOMUSIC); - - sprintf( buf, "You MUSIC: '%s'\n\r", argument ); - send_to_char( buf, ch ); - sprintf( buf, "$n MUSIC: '%s'", argument ); - for ( d = descriptor_list; d != NULL; d = d->next ) - { - CHAR_DATA *victim; - - victim = d->original ? d->original : d->character; - - if ( d->connected == CON_PLAYING && - d->character != ch && - !IS_SET(victim->comm,COMM_NOMUSIC) && - !IS_SET(victim->comm,COMM_QUIET) ) - { - act_new("$n MUSIC: '$t'", - ch,argument,d->character,TO_VICT,POS_SLEEPING); - } - } - } -} - -/* clan channels */ -void do_clantalk( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - DESCRIPTOR_DATA *d; - - if (!is_clan(ch) || clan_table[ch->clan].independent) - { - send_to_char("You aren't in a clan.\n\r",ch); - return; - } - if ( argument[0] == '\0' ) - { - if (IS_SET(ch->comm,COMM_NOCLAN)) - { - send_to_char("Clan channel is now ON\n\r",ch); - REMOVE_BIT(ch->comm,COMM_NOCLAN); - } - else - { - send_to_char("Clan channel is now OFF\n\r",ch); - SET_BIT(ch->comm,COMM_NOCLAN); - } - return; - } - - if (IS_SET(ch->comm,COMM_NOCHANNELS)) - { - send_to_char("The gods have revoked your channel priviliges.\n\r",ch); - return; - } - - REMOVE_BIT(ch->comm,COMM_NOCLAN); - - sprintf( buf, "You clan '%s'\n\r", argument ); - send_to_char( buf, ch ); - sprintf( buf, "$n clans '%s'", argument ); - for ( d = descriptor_list; d != NULL; d = d->next ) - { - if ( d->connected == CON_PLAYING && - d->character != ch && - is_same_clan(ch,d->character) && - !IS_SET(d->character->comm,COMM_NOCLAN) && - !IS_SET(d->character->comm,COMM_QUIET) ) - { - act_new("$n clans '$t'",ch,argument,d->character,TO_VICT,POS_DEAD); - } - } - - return; -} - -void do_immtalk( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - DESCRIPTOR_DATA *d; - - if ( argument[0] == '\0' ) - { - if (IS_SET(ch->comm,COMM_NOWIZ)) - { - send_to_char("Immortal channel is now ON\n\r",ch); - REMOVE_BIT(ch->comm,COMM_NOWIZ); - } - else - { - send_to_char("Immortal channel is now OFF\n\r",ch); - SET_BIT(ch->comm,COMM_NOWIZ); - } - return; - } - - REMOVE_BIT(ch->comm,COMM_NOWIZ); - - sprintf( buf, "$n: %s", argument ); - act_new("$n: $t",ch,argument,NULL,TO_CHAR,POS_DEAD); - for ( d = descriptor_list; d != NULL; d = d->next ) - { - if ( d->connected == CON_PLAYING && - IS_IMMORTAL(d->character) && - !IS_SET(d->character->comm,COMM_NOWIZ) ) - { - act_new("$n: $t",ch,argument,d->character,TO_VICT,POS_DEAD); - } - } - - return; -} - - - -void do_say( CHAR_DATA *ch, char *argument ) -{ - if ( argument[0] == '\0' ) - { - send_to_char( "Say what?\n\r", ch ); - return; - } - - act( "$n says '$T'", ch, NULL, argument, TO_ROOM ); - act( "You say '$T'", ch, NULL, argument, TO_CHAR ); - return; -} - - - -void do_shout( CHAR_DATA *ch, char *argument ) -{ - DESCRIPTOR_DATA *d; - - if (argument[0] == '\0' ) - { - if (IS_SET(ch->comm,COMM_SHOUTSOFF)) - { - send_to_char("You can hear shouts again.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_SHOUTSOFF); - } - else - { - send_to_char("You will no longer hear shouts.\n\r",ch); - SET_BIT(ch->comm,COMM_SHOUTSOFF); - } - return; - } - - if ( IS_SET(ch->comm, COMM_NOSHOUT) ) - { - send_to_char( "You can't shout.\n\r", ch ); - return; - } - - REMOVE_BIT(ch->comm,COMM_SHOUTSOFF); - - WAIT_STATE( ch, 12 ); - - act( "You shout '$T'", ch, NULL, argument, TO_CHAR ); - for ( d = descriptor_list; d != NULL; d = d->next ) - { - CHAR_DATA *victim; - - victim = d->original ? d->original : d->character; - - if ( d->connected == CON_PLAYING && - d->character != ch && - !IS_SET(victim->comm, COMM_SHOUTSOFF) && - !IS_SET(victim->comm, COMM_QUIET) ) - { - act("$n shouts '$t'",ch,argument,d->character,TO_VICT); - } - } - - return; -} - - - -void do_tell( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH],buf[MAX_STRING_LENGTH]; - CHAR_DATA *victim; - - if ( IS_SET(ch->comm, COMM_NOTELL) || IS_SET(ch->comm,COMM_DEAF)) - { - send_to_char( "Your message didn't get through.\n\r", ch ); - return; - } - - if ( IS_SET(ch->comm, COMM_QUIET) ) - { - send_to_char( "You must turn off quiet mode first.\n\r", ch); - return; - } - - if (IS_SET(ch->comm,COMM_DEAF)) - { - send_to_char("You must turn off deaf mode first.\n\r",ch); - return; - } - - argument = one_argument( argument, arg ); - - if ( arg[0] == '\0' || argument[0] == '\0' ) - { - send_to_char( "Tell whom what?\n\r", ch ); - return; - } - - /* - * Can tell to PC's anywhere, but NPC's only in same room. - * -- Furey - */ - if ( ( victim = get_char_world( ch, arg ) ) == NULL - || ( IS_NPC(victim) && victim->in_room != ch->in_room ) ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - - if ( victim->desc == NULL && !IS_NPC(victim)) - { - act("$N seems to have misplaced $S link...try again later.", - ch,NULL,victim,TO_CHAR); - sprintf(buf,"%s tells you '%s'\n\r",PERS(ch,victim),argument); - buf[0] = UPPER(buf[0]); - add_buf(victim->pcdata->buffer,buf); - return; - } - - if ( !(IS_IMMORTAL(ch) && ch->level > LEVEL_IMMORTAL) && !IS_AWAKE(victim) ) - { - act( "$E can't hear you.", ch, 0, victim, TO_CHAR ); - return; - } - - if ((IS_SET(victim->comm,COMM_QUIET) || IS_SET(victim->comm,COMM_DEAF)) - && !IS_IMMORTAL(ch)) - { - act( "$E is not receiving tells.", ch, 0, victim, TO_CHAR ); - return; - } - - if (IS_SET(victim->comm,COMM_AFK)) - { - if (IS_NPC(victim)) - { - act("$E is AFK, and not receiving tells.",ch,NULL,victim,TO_CHAR); - return; - } - - act("$E is AFK, but your tell will go through when $E returns.", - ch,NULL,victim,TO_CHAR); - sprintf(buf,"%s tells you '%s'\n\r",PERS(ch,victim),argument); - buf[0] = UPPER(buf[0]); - add_buf(victim->pcdata->buffer,buf); - return; - } - - act( "You tell $N '$t'", ch, argument, victim, TO_CHAR ); - act_new("$n tells you '$t'",ch,argument,victim,TO_VICT,POS_DEAD); - victim->reply = ch; - - return; -} - - - -void do_reply( CHAR_DATA *ch, char *argument ) -{ - CHAR_DATA *victim; - char buf[MAX_STRING_LENGTH]; - - if ( IS_SET(ch->comm, COMM_NOTELL) ) - { - send_to_char( "Your message didn't get through.\n\r", ch ); - return; - } - - if ( ( victim = ch->reply ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - - if ( victim->desc == NULL && !IS_NPC(victim)) - { - act("$N seems to have misplaced $S link...try again later.", - ch,NULL,victim,TO_CHAR); - sprintf(buf,"%s tells you '%s'\n\r",PERS(ch,victim),argument); - buf[0] = UPPER(buf[0]); - add_buf(victim->pcdata->buffer,buf); - return; - } - - if ( !IS_IMMORTAL(ch) && !IS_AWAKE(victim) ) - { - act( "$E can't hear you.", ch, 0, victim, TO_CHAR ); - return; - } - - if ((IS_SET(victim->comm,COMM_QUIET) || IS_SET(victim->comm,COMM_DEAF)) - && !IS_IMMORTAL(ch) && !IS_IMMORTAL(victim)) - { - act_new( "$E is not receiving tells.", ch, 0, victim, TO_CHAR,POS_DEAD); - return; - } - - if (!IS_IMMORTAL(victim) && !IS_AWAKE(ch)) - { - send_to_char( "In your dreams, or what?\n\r", ch ); - return; - } - - if (IS_SET(victim->comm,COMM_AFK)) - { - if (IS_NPC(victim)) - { - act_new("$E is AFK, and not receiving tells.", - ch,NULL,victim,TO_CHAR,POS_DEAD); - return; - } - - act_new("$E is AFK, but your tell will go through when $E returns.", - ch,NULL,victim,TO_CHAR,POS_DEAD); - sprintf(buf,"%s tells you '%s'\n\r",PERS(ch,victim),argument); - buf[0] = UPPER(buf[0]); - add_buf(victim->pcdata->buffer,buf); - return; - } - - act_new("You tell $N '$t'",ch,argument,victim,TO_CHAR,POS_DEAD); - act_new("$n tells you '$t'",ch,argument,victim,TO_VICT,POS_DEAD); - victim->reply = ch; - - return; -} - - - -void do_yell( CHAR_DATA *ch, char *argument ) -{ - DESCRIPTOR_DATA *d; - - if ( IS_SET(ch->comm, COMM_NOSHOUT) ) - { - send_to_char( "You can't yell.\n\r", ch ); - return; - } - - if ( argument[0] == '\0' ) - { - send_to_char( "Yell what?\n\r", ch ); - return; - } - - - act("You yell '$t'",ch,argument,NULL,TO_CHAR); - for ( d = descriptor_list; d != NULL; d = d->next ) - { - if ( d->connected == CON_PLAYING - && d->character != ch - && d->character->in_room != NULL - && d->character->in_room->area == ch->in_room->area - && !IS_SET(d->character->comm,COMM_QUIET) ) - { - act("$n yells '$t'",ch,argument,d->character,TO_VICT); - } - } - - return; -} - - -void do_emote( CHAR_DATA *ch, char *argument ) -{ - if ( !IS_NPC(ch) && IS_SET(ch->comm, COMM_NOEMOTE) ) - { - send_to_char( "You can't show your emotions.\n\r", ch ); - return; - } - - if ( argument[0] == '\0' ) - { - send_to_char( "Emote what?\n\r", ch ); - return; - } - - act( "$n $T", ch, NULL, argument, TO_ROOM ); - act( "$n $T", ch, NULL, argument, TO_CHAR ); - return; -} - - -void do_pmote( CHAR_DATA *ch, char *argument ) -{ - CHAR_DATA *vch; - 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) ) - { - send_to_char( "You can't show your emotions.\n\r", ch ); - return; - } - - if ( argument[0] == '\0' ) - { - send_to_char( "Emote what?\n\r", ch ); - return; - } - - act( "$n $t", ch, argument, NULL, TO_CHAR ); - - 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) - { - act("$N $t",vch,argument,ch,TO_CHAR); - continue; - } - - strcpy(temp,argument); - temp[strlen(argument) - strlen(letter)] = '\0'; - last[0] = '\0'; - name = vch->name; - - for (; *letter != '\0'; letter++) - { - if (*letter == '\'' && matches == strlen(vch->name)) - { - strcat(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)) - { - strcat(temp,"you"); - last[0] = '\0'; - name = vch->name; - continue; - } - strncat(last,letter,1); - continue; - } - - matches = 0; - strcat(temp,last); - strncat(temp,letter,1); - last[0] = '\0'; - name = vch->name; - } - - act("$N $t",vch,temp,ch,TO_CHAR); - } - - return; -} - - -/* - * All the posing stuff. - */ -struct pose_table_type -{ - char * message[2*MAX_CLASS]; -}; - -const struct pose_table_type pose_table [] = -{ - { - { - "You sizzle with energy.", - "$n sizzles with energy.", - "You feel very holy.", - "$n looks very holy.", - "You perform a small card trick.", - "$n performs a small card trick.", - "You show your bulging muscles.", - "$n shows $s bulging muscles." - } - }, - - { - { - "You turn into a butterfly, then return to your normal shape.", - "$n turns into a butterfly, then returns to $s normal shape.", - "You nonchalantly turn wine into water.", - "$n nonchalantly turns wine into water.", - "You wiggle your ears alternately.", - "$n wiggles $s ears alternately.", - "You crack nuts between your fingers.", - "$n cracks nuts between $s fingers." - } - }, - - { - { - "Blue sparks fly from your fingers.", - "Blue sparks fly from $n's fingers.", - "A halo appears over your head.", - "A halo appears over $n's head.", - "You nimbly tie yourself into a knot.", - "$n nimbly ties $mself into a knot.", - "You grizzle your teeth and look mean.", - "$n grizzles $s teeth and looks mean." - } - }, - - { - { - "Little red lights dance in your eyes.", - "Little red lights dance in $n's eyes.", - "You recite words of wisdom.", - "$n recites words of wisdom.", - "You juggle with daggers, apples, and eyeballs.", - "$n juggles with daggers, apples, and eyeballs.", - "You hit your head, and your eyes roll.", - "$n hits $s head, and $s eyes roll." - } - }, - - { - { - "A slimy green monster appears before you and bows.", - "A slimy green monster appears before $n and bows.", - "Deep in prayer, you levitate.", - "Deep in prayer, $n levitates.", - "You steal the underwear off every person in the room.", - "Your underwear is gone! $n stole it!", - "Crunch, crunch -- you munch a bottle.", - "Crunch, crunch -- $n munches a bottle." - } - }, - - { - { - "You turn everybody into a little pink elephant.", - "You are turned into a little pink elephant by $n.", - "An angel consults you.", - "An angel consults $n.", - "The dice roll ... and you win again.", - "The dice roll ... and $n wins again.", - "... 98, 99, 100 ... you do pushups.", - "... 98, 99, 100 ... $n does pushups." - } - }, - - { - { - "A small ball of light dances on your fingertips.", - "A small ball of light dances on $n's fingertips.", - "Your body glows with an unearthly light.", - "$n's body glows with an unearthly light.", - "You count the money in everyone's pockets.", - "Check your money, $n is counting it.", - "Arnold Schwarzenegger admires your physique.", - "Arnold Schwarzenegger admires $n's physique." - } - }, - - { - { - "Smoke and fumes leak from your nostrils.", - "Smoke and fumes leak from $n's nostrils.", - "A spot light hits you.", - "A spot light hits $n.", - "You balance a pocket knife on your tongue.", - "$n balances a pocket knife on your tongue.", - "Watch your feet, you are juggling granite boulders.", - "Watch your feet, $n is juggling granite boulders." - } - }, - - { - { - "The light flickers as you rap in magical languages.", - "The light flickers as $n raps in magical languages.", - "Everyone levitates as you pray.", - "You levitate as $n prays.", - "You produce a coin from everyone's ear.", - "$n produces a coin from your ear.", - "Oomph! You squeeze water out of a granite boulder.", - "Oomph! $n squeezes water out of a granite boulder." - } - }, - - { - { - "Your head disappears.", - "$n's head disappears.", - "A cool breeze refreshes you.", - "A cool breeze refreshes $n.", - "You step behind your shadow.", - "$n steps behind $s shadow.", - "You pick your teeth with a spear.", - "$n picks $s teeth with a spear." - } - }, - - { - { - "A fire elemental singes your hair.", - "A fire elemental singes $n's hair.", - "The sun pierces through the clouds to illuminate you.", - "The sun pierces through the clouds to illuminate $n.", - "Your eyes dance with greed.", - "$n's eyes dance with greed.", - "Everyone is swept off their foot by your hug.", - "You are swept off your feet by $n's hug." - } - }, - - { - { - "The sky changes color to match your eyes.", - "The sky changes color to match $n's eyes.", - "The ocean parts before you.", - "The ocean parts before $n.", - "You deftly steal everyone's weapon.", - "$n deftly steals your weapon.", - "Your karate chop splits a tree.", - "$n's karate chop splits a tree." - } - }, - - { - { - "The stones dance to your command.", - "The stones dance to $n's command.", - "A thunder cloud kneels to you.", - "A thunder cloud kneels to $n.", - "The Grey Mouser buys you a beer.", - "The Grey Mouser buys $n a beer.", - "A strap of your armor breaks over your mighty thews.", - "A strap of $n's armor breaks over $s mighty thews." - } - }, - - { - { - "The heavens and grass change colour as you smile.", - "The heavens and grass change colour as $n smiles.", - "The Burning Man speaks to you.", - "The Burning Man speaks to $n.", - "Everyone's pocket explodes with your fireworks.", - "Your pocket explodes with $n's fireworks.", - "A boulder cracks at your frown.", - "A boulder cracks at $n's frown." - } - }, - - { - { - "Everyone's clothes are transparent, and you are laughing.", - "Your clothes are transparent, and $n is laughing.", - "An eye in a pyramid winks at you.", - "An eye in a pyramid winks at $n.", - "Everyone discovers your dagger a centimeter from their eye.", - "You discover $n's dagger a centimeter from your eye.", - "Mercenaries arrive to do your bidding.", - "Mercenaries arrive to do $n's bidding." - } - }, - - { - { - "A black hole swallows you.", - "A black hole swallows $n.", - "Valentine Michael Smith offers you a glass of water.", - "Valentine Michael Smith offers $n a glass of water.", - "Where did you go?", - "Where did $n go?", - "Four matched Percherons bring in your chariot.", - "Four matched Percherons bring in $n's chariot." - } - }, - - { - { - "The world shimmers in time with your whistling.", - "The world shimmers in time with $n's whistling.", - "The great god Mota gives you a staff.", - "The great god Mota gives $n a staff.", - "Click.", - "Click.", - "Atlas asks you to relieve him.", - "Atlas asks $n to relieve him." - } - } -}; - - - -void do_pose( CHAR_DATA *ch, char *argument ) -{ - int level; - int pose; - - if ( IS_NPC(ch) ) - return; - - level = UMIN( ch->level, sizeof(pose_table) / sizeof(pose_table[0]) - 1 ); - pose = number_range(0, level); - - act( pose_table[pose].message[2*ch->class+0], ch, NULL, NULL, TO_CHAR ); - act( pose_table[pose].message[2*ch->class+1], ch, NULL, NULL, TO_ROOM ); - - return; -} - - - -void do_bug( CHAR_DATA *ch, char *argument ) -{ - append_file( ch, BUG_FILE, argument ); - send_to_char( "Bug logged.\n\r", ch ); - return; -} - -void do_typo( CHAR_DATA *ch, char *argument ) -{ - append_file( ch, TYPO_FILE, argument ); - send_to_char( "Typo logged.\n\r", ch ); - return; -} - -void do_rent( CHAR_DATA *ch, char *argument ) -{ - send_to_char( "There is no rent here. Just save and quit.\n\r", ch ); - return; -} - - -void do_qui( CHAR_DATA *ch, char *argument ) -{ - send_to_char( "If you want to QUIT, you have to spell it out.\n\r", ch ); - return; -} - - - -void do_quit( CHAR_DATA *ch, char *argument ) -{ - DESCRIPTOR_DATA *d,*d_next; - int id; - - if ( IS_NPC(ch) ) - return; - - if ( ch->position == POS_FIGHTING ) - { - send_to_char( "No way! You are fighting.\n\r", ch ); - return; - } - - if ( ch->position < POS_STUNNED ) - { - send_to_char( "You're not DEAD yet.\n\r", ch ); - return; - } - send_to_char( - "Alas, all good things must come to an end.\n\r",ch); - act( "$n has left the game.", ch, NULL, NULL, TO_ROOM ); - sprintf( log_buf, "%s has quit.", ch->name ); - log_string( log_buf ); - wiznet("$N rejoins the real world.",ch,NULL,WIZ_LOGINS,0,get_trust(ch)); - - /* - * After extract_char the ch is no longer valid! - */ - save_char_obj( ch ); - id = ch->id; - d = ch->desc; - extract_char( ch, TRUE ); - if ( d != NULL ) - close_socket( d ); - - /* toast evil cheating bastards */ - for (d = descriptor_list; d != NULL; d = d_next) - { - CHAR_DATA *tch; - - d_next = d->next; - tch = d->original ? d->original : d->character; - if (tch && tch->id == id) - { - extract_char(tch,TRUE); - close_socket(d); - } - } - - return; -} - - - -void do_save( CHAR_DATA *ch, char *argument ) -{ - if ( IS_NPC(ch) ) - return; - - save_char_obj( ch ); - send_to_char("Saving. Remember that ROM has automatic saving now.\n\r", ch); - WAIT_STATE(ch,4 * PULSE_VIOLENCE); - return; -} - - - -void do_follow( CHAR_DATA *ch, char *argument ) -{ -/* RT changed to allow unlimited following and follow the NOFOLLOW rules */ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Follow whom?\n\r", ch ); - return; - } - - if ( ( victim = get_char_room( ch, arg ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - - if ( IS_AFFECTED(ch, AFF_CHARM) && ch->master != NULL ) - { - act( "But you'd rather follow $N!", ch, NULL, ch->master, TO_CHAR ); - return; - } - - if ( victim == ch ) - { - if ( ch->master == NULL ) - { - send_to_char( "You already follow yourself.\n\r", ch ); - return; - } - stop_follower(ch); - return; - } - - if (!IS_NPC(victim) && IS_SET(victim->act,PLR_NOFOLLOW) && !IS_IMMORTAL(ch)) - { - act("$N doesn't seem to want any followers.\n\r", - ch,NULL,victim, TO_CHAR); - return; - } - - REMOVE_BIT(ch->act,PLR_NOFOLLOW); - - if ( ch->master != NULL ) - stop_follower( ch ); - - add_follower( ch, victim ); - return; -} - - -void add_follower( CHAR_DATA *ch, CHAR_DATA *master ) -{ - if ( ch->master != NULL ) - { - bug( "Add_follower: non-null master.", 0 ); - return; - } - - ch->master = master; - ch->leader = NULL; - - if ( can_see( master, ch ) ) - act( "$n now follows you.", ch, NULL, master, TO_VICT ); - - act( "You now follow $N.", ch, NULL, master, TO_CHAR ); - - return; -} - - - -void stop_follower( CHAR_DATA *ch ) -{ - if ( ch->master == NULL ) - { - bug( "Stop_follower: null master.", 0 ); - return; - } - - if ( IS_AFFECTED(ch, AFF_CHARM) ) - { - REMOVE_BIT( ch->affected_by, AFF_CHARM ); - affect_strip( ch, gsn_charm_person ); - } - - if ( can_see( ch->master, ch ) && ch->in_room != NULL) - { - act( "$n stops following you.", ch, NULL, ch->master, TO_VICT ); - act( "You stop following $N.", ch, NULL, ch->master, TO_CHAR ); - } - if (ch->master->pet == ch) - ch->master->pet = NULL; - - ch->master = NULL; - ch->leader = NULL; - return; -} - -/* nukes charmed monsters and pets */ -void nuke_pets( CHAR_DATA *ch ) -{ - CHAR_DATA *pet; - - if ((pet = ch->pet) != NULL) - { - stop_follower(pet); - if (pet->in_room != NULL) - act("$N slowly fades away.",ch,NULL,pet,TO_NOTVICT); - extract_char(pet,TRUE); - } - ch->pet = NULL; - - return; -} - - - -void die_follower( CHAR_DATA *ch ) -{ - CHAR_DATA *fch; - - if ( ch->master != NULL ) - { - if (ch->master->pet == ch) - ch->master->pet = NULL; - stop_follower( ch ); - } - - ch->leader = NULL; - - for ( fch = char_list; fch != NULL; fch = fch->next ) - { - if ( fch->master == ch ) - stop_follower( fch ); - if ( fch->leader == ch ) - fch->leader = fch; - } - - return; -} - - - -void do_order( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH],arg2[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - CHAR_DATA *och; - CHAR_DATA *och_next; - bool found; - bool fAll; - - argument = one_argument( argument, arg ); - one_argument(argument,arg2); - - if (!str_cmp(arg2,"delete")) - { - send_to_char("That will NOT be done.\n\r",ch); - return; - } - - if ( arg[0] == '\0' || argument[0] == '\0' ) - { - send_to_char( "Order whom to do what?\n\r", ch ); - return; - } - - if ( IS_AFFECTED( ch, AFF_CHARM ) ) - { - send_to_char( "You feel like taking, not giving, orders.\n\r", ch ); - return; - } - - if ( !str_cmp( arg, "all" ) ) - { - fAll = TRUE; - victim = NULL; - } - else - { - fAll = FALSE; - if ( ( victim = get_char_room( ch, arg ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - - if ( victim == ch ) - { - send_to_char( "Aye aye, right away!\n\r", ch ); - return; - } - - if (!IS_AFFECTED(victim, AFF_CHARM) || victim->master != ch - || (IS_IMMORTAL(victim) && victim->trust >= ch->trust)) - { - send_to_char( "Do it yourself!\n\r", ch ); - return; - } - } - - found = FALSE; - for ( och = ch->in_room->people; och != NULL; och = och_next ) - { - och_next = och->next_in_room; - - if ( IS_AFFECTED(och, AFF_CHARM) - && och->master == ch - && ( fAll || och == victim ) ) - { - found = TRUE; - sprintf( buf, "$n orders you to '%s'.", argument ); - act( buf, ch, NULL, och, TO_VICT ); - interpret( och, argument ); - } - } - - if ( found ) - { - WAIT_STATE(ch,PULSE_VIOLENCE); - send_to_char( "Ok.\n\r", ch ); - } - else - send_to_char( "You have no followers here.\n\r", ch ); - return; -} - - - -void do_group( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - CHAR_DATA *gch; - CHAR_DATA *leader; - - leader = (ch->leader != NULL) ? ch->leader : ch; - sprintf( buf, "%s's group:\n\r", PERS(leader, ch) ); - send_to_char( buf, ch ); - - for ( gch = char_list; gch != NULL; gch = gch->next ) - { - if ( is_same_group( gch, ch ) ) - { - sprintf( buf, - "[%2d %s] %-16s %4d/%4d hp %4d/%4d mana %4d/%4d mv %5d xp\n\r", - gch->level, - IS_NPC(gch) ? "Mob" : class_table[gch->class].who_name, - capitalize( PERS(gch, ch) ), - gch->hit, gch->max_hit, - gch->mana, gch->max_mana, - gch->move, gch->max_move, - gch->exp ); - send_to_char( buf, ch ); - } - } - return; - } - - if ( ( victim = get_char_room( ch, arg ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - - if ( ch->master != NULL || ( ch->leader != NULL && ch->leader != ch ) ) - { - send_to_char( "But you are following someone else!\n\r", ch ); - return; - } - - if ( victim->master != ch && ch != victim ) - { - act_new("$N isn't following you.",ch,NULL,victim,TO_CHAR,POS_SLEEPING); - return; - } - - if (IS_AFFECTED(victim,AFF_CHARM)) - { - send_to_char("You can't remove charmed mobs from your group.\n\r",ch); - return; - } - - if (IS_AFFECTED(ch,AFF_CHARM)) - { - act_new("You like your master too much to leave $m!", - ch,NULL,victim,TO_VICT,POS_SLEEPING); - return; - } - - if ( is_same_group( victim, ch ) && ch != victim ) - { - victim->leader = NULL; - act_new("$n removes $N from $s group.", - ch,NULL,victim,TO_NOTVICT,POS_RESTING); - act_new("$n removes you from $s group.", - ch,NULL,victim,TO_VICT,POS_SLEEPING); - act_new("You remove $N from your group.", - ch,NULL,victim,TO_CHAR,POS_SLEEPING); - return; - } - - victim->leader = ch; - act_new("$N joins $n's group.",ch,NULL,victim,TO_NOTVICT,POS_RESTING); - act_new("You join $n's group.",ch,NULL,victim,TO_VICT,POS_SLEEPING); - act_new("$N joins your group.",ch,NULL,victim,TO_CHAR,POS_SLEEPING); - return; -} - - - -/* - * 'Split' originally by Gnort, God of Chaos. - */ -void do_split( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg1[MAX_INPUT_LENGTH],arg2[MAX_INPUT_LENGTH]; - CHAR_DATA *gch; - int members; - int amount_gold = 0, amount_silver = 0; - int share_gold, share_silver; - int extra_gold, extra_silver; - - argument = one_argument( argument, arg1 ); - one_argument( argument, arg2 ); - - if ( arg1[0] == '\0' ) - { - send_to_char( "Split how much?\n\r", ch ); - return; - } - - amount_silver = atoi( arg1 ); - - if (arg2[0] != '\0') - amount_gold = atoi(arg2); - - if ( amount_gold < 0 || amount_silver < 0) - { - send_to_char( "Your group wouldn't like that.\n\r", ch ); - return; - } - - if ( amount_gold == 0 && amount_silver == 0 ) - { - send_to_char( "You hand out zero coins, but no one notices.\n\r", ch ); - return; - } - - if ( ch->gold < amount_gold || ch->silver < amount_silver) - { - send_to_char( "You don't have that much to split.\n\r", ch ); - return; - } - - members = 0; - for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room ) - { - if ( is_same_group( gch, ch ) && !IS_AFFECTED(gch,AFF_CHARM)) - members++; - } - - if ( members < 2 ) - { - send_to_char( "Just keep it all.\n\r", ch ); - return; - } - - share_silver = amount_silver / members; - extra_silver = amount_silver % members; - - share_gold = amount_gold / members; - extra_gold = amount_gold % members; - - if ( share_gold == 0 && share_silver == 0 ) - { - send_to_char( "Don't even bother, cheapskate.\n\r", ch ); - return; - } - - ch->silver -= amount_silver; - ch->silver += share_silver + extra_silver; - ch->gold -= amount_gold; - ch->gold += share_gold + extra_gold; - - if (share_silver > 0) - { - sprintf(buf, - "You split %d silver coins. Your share is %d silver.\n\r", - amount_silver,share_silver + extra_silver); - send_to_char(buf,ch); - } - - if (share_gold > 0) - { - sprintf(buf, - "You split %d gold coins. Your share is %d gold.\n\r", - amount_gold,share_gold + extra_gold); - send_to_char(buf,ch); - } - - if (share_gold == 0) - { - sprintf(buf,"$n splits %d silver coins. Your share is %d silver.", - amount_silver,share_silver); - } - else if (share_silver == 0) - { - sprintf(buf,"$n splits %d gold coins. Your share is %d gold.", - amount_gold,share_gold); - } - else - { - sprintf(buf, -"$n splits %d silver and %d gold coins, giving you %d silver and %d gold.\n\r", - amount_silver,amount_gold,share_silver,share_gold); - } - - for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room ) - { - if ( gch != ch && is_same_group(gch,ch) && !IS_AFFECTED(gch,AFF_CHARM)) - { - act( buf, ch, NULL, gch, TO_VICT ); - gch->gold += share_gold; - gch->silver += share_silver; - } - } - - return; -} - - - -void do_gtell( CHAR_DATA *ch, char *argument ) -{ - CHAR_DATA *gch; - - if ( argument[0] == '\0' ) - { - send_to_char( "Tell your group what?\n\r", ch ); - return; - } - - if ( IS_SET( ch->comm, COMM_NOTELL ) ) - { - send_to_char( "Your message didn't get through!\n\r", ch ); - return; - } - - for ( gch = char_list; gch != NULL; gch = gch->next ) - { - if ( is_same_group( gch, ch ) ) - act_new("$n tells the group '$t'", - ch,argument,gch,TO_VICT,POS_SLEEPING); - } - - return; -} - -def do_commands( self, rgument ) -{ - char buf[MAX_STRING_LENGTH]; - int cmd; - int col; - - col = 0; - for ( cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++ ) - { - if ( cmd_table[cmd].level < LEVEL_HERO - && cmd_table[cmd].level <= get_trust( ch ) - && cmd_table[cmd].show) - { - sprintf( buf, "%-12s", cmd_table[cmd].name ); - send_to_char( buf, ch ); - if ( ++col % 6 == 0 ) - send_to_char( "\n\r", ch ); - } - } - - if ( col % 6 != 0 ) - send_to_char( "\n\r", ch ); - return; -} - -void do_wizhelp( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - int cmd; - int col; - - col = 0; - for ( cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++ ) - { - if ( cmd_table[cmd].level >= LEVEL_HERO - && cmd_table[cmd].level <= get_trust( ch ) - && cmd_table[cmd].show) - { - sprintf( buf, "%-12s", cmd_table[cmd].name ); - send_to_char( buf, ch ); - if ( ++col % 6 == 0 ) - send_to_char( "\n\r", ch ); - } - } - - if ( col % 6 != 0 ) - send_to_char( "\n\r", ch ); - return; -} - - -/* - * It is very important that this be an equivalence relation: - * (1) A ~ A - * (2) if A ~ B then B ~ A - * (3) if A ~ B and B ~ C, then A ~ C - */ -bool is_same_group( CHAR_DATA *ach, CHAR_DATA *bch ) -{ - if ( ach == NULL || bch == NULL) - return FALSE; - - if ( ach->leader != NULL ) ach = ach->leader; - if ( bch->leader != NULL ) bch = bch->leader; - return ach == bch; -} diff --git a/archive/src/act_enter.c b/archive/src/act_enter.c deleted file mode 100644 index c9a7f8c..0000000 --- a/archive/src/act_enter.c +++ /dev/null @@ -1,214 +0,0 @@ -/*************************************************************************** - * 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-1998 Russ Taylor * -* ROM has been brought to you by the ROM consortium * -* Russ Taylor (rtaylor@hypercube.org) * -* Gabrielle Taylor (gtaylor@efn.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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#include -#else -#include -#include -#endif -#include -#include -#include -#include "merc.h" -#include "interp.h" - -/* random room generation procedure */ -ROOM_INDEX_DATA *get_random_room(CHAR_DATA *ch) -{ - ROOM_INDEX_DATA *room; - - for ( ; ; ) - { - room = get_room_index( number_range( 0, 65535 ) ); - if ( room != NULL ) - if ( can_see_room(ch,room) - && !room_is_private(room) - && !IS_SET(room->room_flags, ROOM_PRIVATE) - && !IS_SET(room->room_flags, ROOM_SOLITARY) - && !IS_SET(room->room_flags, ROOM_SAFE) - && (IS_NPC(ch) || IS_SET(ch->act,ACT_AGGRESSIVE) - || !IS_SET(room->room_flags,ROOM_LAW))) - break; - } - - return room; -} - -/* RT Enter portals */ -void do_enter( CHAR_DATA *ch, char *argument) -{ - ROOM_INDEX_DATA *location; - - if ( ch->fighting != NULL ) - return; - - /* nifty portal stuff */ - if (argument[0] != '\0') - { - ROOM_INDEX_DATA *old_room; - OBJ_DATA *portal; - CHAR_DATA *fch, *fch_next; - - old_room = ch->in_room; - - portal = get_obj_list( ch, argument, ch->in_room->contents ); - - if (portal == NULL) - { - send_to_char("You don't see that here.\n\r",ch); - return; - } - - if (portal->item_type != ITEM_PORTAL - || (IS_SET(portal->value[1],EX_CLOSED) && !IS_TRUSTED(ch,ANGEL))) - { - send_to_char("You can't seem to find a way in.\n\r",ch); - return; - } - - if (!IS_TRUSTED(ch,ANGEL) && !IS_SET(portal->value[2],GATE_NOCURSE) - && (IS_AFFECTED(ch,AFF_CURSE) - || IS_SET(old_room->room_flags,ROOM_NO_RECALL))) - { - send_to_char("Something prevents you from leaving...\n\r",ch); - return; - } - - if (IS_SET(portal->value[2],GATE_RANDOM) || portal->value[3] == -1) - { - location = get_random_room(ch); - portal->value[3] = location->vnum; /* for record keeping :) */ - } - else if (IS_SET(portal->value[2],GATE_BUGGY) && (number_percent() < 5)) - location = get_random_room(ch); - else - location = get_room_index(portal->value[3]); - - if (location == NULL - || location == old_room - || !can_see_room(ch,location) - || (room_is_private(location) && !IS_TRUSTED(ch,IMPLEMENTOR))) - { - act("$p doesn't seem to go anywhere.",ch,portal,NULL,TO_CHAR); - return; - } - - if (IS_NPC(ch) && IS_SET(ch->act,ACT_AGGRESSIVE) - && IS_SET(location->room_flags,ROOM_LAW)) - { - send_to_char("Something prevents you from leaving...\n\r",ch); - return; - } - - act("$n steps into $p.",ch,portal,NULL,TO_ROOM); - - if (IS_SET(portal->value[2],GATE_NORMAL_EXIT)) - act("You enter $p.",ch,portal,NULL,TO_CHAR); - else - act("You walk through $p and find yourself somewhere else...", - ch,portal,NULL,TO_CHAR); - - char_from_room(ch); - char_to_room(ch, location); - - if (IS_SET(portal->value[2],GATE_GOWITH)) /* take the gate along */ - { - obj_from_room(portal); - obj_to_room(portal,location); - } - - if (IS_SET(portal->value[2],GATE_NORMAL_EXIT)) - act("$n has arrived.",ch,portal,NULL,TO_ROOM); - else - act("$n has arrived through $p.",ch,portal,NULL,TO_ROOM); - - do_function(ch, &do_look, "auto"); - - /* charges */ - if (portal->value[0] > 0) - { - portal->value[0]--; - if (portal->value[0] == 0) - portal->value[0] = -1; - } - - /* protect against circular follows */ - if (old_room == location) - return; - - for ( fch = old_room->people; fch != NULL; fch = fch_next ) - { - fch_next = fch->next_in_room; - - if (portal == NULL || portal->value[0] == -1) - /* no following through dead portals */ - continue; - - if ( fch->master == ch && IS_AFFECTED(fch,AFF_CHARM) - && fch->position < POS_STANDING) - do_function(fch, &do_stand, ""); - - if ( fch->master == ch && fch->position == POS_STANDING) - { - - if (IS_SET(ch->in_room->room_flags,ROOM_LAW) - && (IS_NPC(fch) && IS_SET(fch->act,ACT_AGGRESSIVE))) - { - act("You can't bring $N into the city.", - ch,NULL,fch,TO_CHAR); - act("You aren't allowed in the city.", - fch,NULL,NULL,TO_CHAR); - continue; - } - - act( "You follow $N.", fch, NULL, ch, TO_CHAR ); - do_function(fch, &do_enter, argument); - } - } - - if (portal != NULL && portal->value[0] == -1) - { - act("$p fades out of existence.",ch,portal,NULL,TO_CHAR); - if (ch->in_room == old_room) - act("$p fades out of existence.",ch,portal,NULL,TO_ROOM); - else if (old_room->people != NULL) - { - act("$p fades out of existence.", - old_room->people,portal,NULL,TO_CHAR); - act("$p fades out of existence.", - old_room->people,portal,NULL,TO_ROOM); - } - extract_obj(portal); - } - return; - } - - send_to_char("Nope, can't do it.\n\r",ch); - return; -} diff --git a/archive/src/act_info.c b/archive/src/act_info.c deleted file mode 100644 index e966f4d..0000000 --- a/archive/src/act_info.c +++ /dev/null @@ -1,2755 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#include -#endif -#include -#include -#include -#include -#include -#include "merc.h" -#include "interp.h" -#include "magic.h" -#include "recycle.h" -#include "tables.h" -#include "lookup.h" - -char * const where_name [] = -{ - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", -}; - - -/* for keeping track of the player count */ -int max_on = 0; - -/* - * Local functions. - */ -char * format_obj_to_char args( ( OBJ_DATA *obj, CHAR_DATA *ch, - bool fShort ) ); -void show_list_to_char args( ( OBJ_DATA *list, CHAR_DATA *ch, - bool fShort, bool fShowNothing ) ); -void show_char_to_char_0 args( ( CHAR_DATA *victim, CHAR_DATA *ch ) ); -void show_char_to_char_1 args( ( CHAR_DATA *victim, CHAR_DATA *ch ) ); -void show_char_to_char args( ( CHAR_DATA *list, CHAR_DATA *ch ) ); -bool check_blind args( ( CHAR_DATA *ch ) ); - - - -char *format_obj_to_char( OBJ_DATA *obj, CHAR_DATA *ch, bool fShort ) -{ - static char buf[MAX_STRING_LENGTH]; - - buf[0] = '\0'; - - if ((fShort && (obj->short_descr == NULL || obj->short_descr[0] == '\0')) - || (obj->description == NULL || obj->description[0] == '\0')) - return buf; - - if ( IS_OBJ_STAT(obj, ITEM_INVIS) ) strcat( buf, "(Invis) " ); - if ( IS_AFFECTED(ch, AFF_DETECT_EVIL) - && IS_OBJ_STAT(obj, ITEM_EVIL) ) strcat( buf, "(Red Aura) " ); - if (IS_AFFECTED(ch, AFF_DETECT_GOOD) - && IS_OBJ_STAT(obj,ITEM_BLESS)) strcat(buf,"(Blue Aura) " ); - if ( IS_AFFECTED(ch, AFF_DETECT_MAGIC) - && IS_OBJ_STAT(obj, ITEM_MAGIC) ) strcat( buf, "(Magical) " ); - if ( IS_OBJ_STAT(obj, ITEM_GLOW) ) strcat( buf, "(Glowing) " ); - if ( IS_OBJ_STAT(obj, ITEM_HUM) ) strcat( buf, "(Humming) " ); - - if ( fShort ) - { - if ( obj->short_descr != NULL ) - strcat( buf, obj->short_descr ); - } - else - { - if ( obj->description != NULL) - strcat( buf, obj->description ); - } - - return buf; -} - - - -/* - * Show a list to a character. - * Can coalesce duplicated items. - */ -void show_list_to_char( OBJ_DATA *list, CHAR_DATA *ch, bool fShort, bool fShowNothing ) -{ - char buf[MAX_STRING_LENGTH]; - BUFFER *output; - char **prgpstrShow; - int *prgnShow; - char *pstrShow; - OBJ_DATA *obj; - int nShow; - int iShow; - int count; - bool fCombine; - - if ( ch->desc == NULL ) - return; - - /* - * Alloc space for output lines. - */ - output = new_buf(); - - count = 0; - for ( obj = list; obj != NULL; obj = obj->next_content ) - count++; - prgpstrShow = alloc_mem( count * sizeof(char *) ); - prgnShow = alloc_mem( count * sizeof(int) ); - nShow = 0; - - /* - * Format the list of objects. - */ - for ( obj = list; obj != NULL; obj = obj->next_content ) - { - if ( obj->wear_loc == WEAR_NONE && can_see_obj( ch, obj )) - { - pstrShow = format_obj_to_char( obj, ch, fShort ); - - fCombine = FALSE; - - if ( IS_NPC(ch) || IS_SET(ch->comm, COMM_COMBINE) ) - { - /* - * Look for duplicates, case sensitive. - * Matches tend to be near end so run loop backwords. - */ - for ( iShow = nShow - 1; iShow >= 0; iShow-- ) - { - if ( !strcmp( prgpstrShow[iShow], pstrShow ) ) - { - prgnShow[iShow]++; - fCombine = TRUE; - break; - } - } - } - - /* - * Couldn't combine, or didn't want to. - */ - if ( !fCombine ) - { - prgpstrShow [nShow] = str_dup( pstrShow ); - prgnShow [nShow] = 1; - nShow++; - } - } - } - - /* - * Output the formatted list. - */ - for ( iShow = 0; iShow < nShow; iShow++ ) - { - if (prgpstrShow[iShow][0] == '\0') - { - free_string(prgpstrShow[iShow]); - continue; - } - - if ( IS_NPC(ch) || IS_SET(ch->comm, COMM_COMBINE) ) - { - if ( prgnShow[iShow] != 1 ) - { - sprintf( buf, "(%2d) ", prgnShow[iShow] ); - add_buf(output,buf); - } - else - { - add_buf(output," "); - } - } - add_buf(output,prgpstrShow[iShow]); - add_buf(output,"\n\r"); - free_string( prgpstrShow[iShow] ); - } - - if ( fShowNothing && nShow == 0 ) - { - if ( IS_NPC(ch) || IS_SET(ch->comm, COMM_COMBINE) ) - send_to_char( " ", ch ); - send_to_char( "Nothing.\n\r", ch ); - } - page_to_char(buf_string(output),ch); - - /* - * Clean up. - */ - free_buf(output); - free_mem( prgpstrShow, count * sizeof(char *) ); - free_mem( prgnShow, count * sizeof(int) ); - - return; -} - - - -void show_char_to_char_0( CHAR_DATA *victim, CHAR_DATA *ch ) -{ - char buf[MAX_STRING_LENGTH],message[MAX_STRING_LENGTH]; - - buf[0] = '\0'; - - if ( IS_SET(victim->comm,COMM_AFK ) ) strcat( buf, "[AFK] " ); - if ( IS_AFFECTED(victim, AFF_INVISIBLE) ) strcat( buf, "(Invis) " ); - if ( victim->invis_level >= LEVEL_HERO ) strcat( buf, "(Wizi) " ); - if ( IS_AFFECTED(victim, AFF_HIDE) ) strcat( buf, "(Hide) " ); - if ( IS_AFFECTED(victim, AFF_CHARM) ) strcat( buf, "(Charmed) " ); - if ( IS_AFFECTED(victim, AFF_PASS_DOOR) ) strcat( buf, "(Translucent) "); - if ( IS_AFFECTED(victim, AFF_FAERIE_FIRE) ) strcat( buf, "(Pink Aura) " ); - if ( IS_EVIL(victim) - && IS_AFFECTED(ch, AFF_DETECT_EVIL) ) strcat( buf, "(Red Aura) " ); - if ( IS_GOOD(victim) - && IS_AFFECTED(ch, AFF_DETECT_GOOD) ) strcat( buf, "(Golden Aura) "); - if ( IS_AFFECTED(victim, AFF_SANCTUARY) ) strcat( buf, "(White Aura) " ); - if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_KILLER ) ) - strcat( buf, "(KILLER) " ); - if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_THIEF ) ) - strcat( buf, "(THIEF) " ); - if ( victim->position == victim->start_pos && victim->long_descr[0] != '\0' ) - { - strcat( buf, victim->long_descr ); - send_to_char( buf, ch ); - return; - } - - strcat( buf, PERS( victim, ch ) ); - if ( !IS_NPC(victim) && !IS_SET(ch->comm, COMM_BRIEF) - && victim->position == POS_STANDING && ch->on == NULL ) - strcat( buf, victim->pcdata->title ); - - switch ( victim->position ) - { - case POS_DEAD: strcat( buf, " is DEAD!!" ); break; - case POS_MORTAL: strcat( buf, " is mortally wounded." ); break; - case POS_INCAP: strcat( buf, " is incapacitated." ); break; - case POS_STUNNED: strcat( buf, " is lying here stunned." ); break; - case POS_SLEEPING: - if (victim->on != NULL) - { - if (IS_SET(victim->on->value[2],SLEEP_AT)) - { - sprintf(message," is sleeping at %s.", - victim->on->short_descr); - strcat(buf,message); - } - else if (IS_SET(victim->on->value[2],SLEEP_ON)) - { - sprintf(message," is sleeping on %s.", - victim->on->short_descr); - strcat(buf,message); - } - else - { - sprintf(message, " is sleeping in %s.", - victim->on->short_descr); - strcat(buf,message); - } - } - else - strcat(buf," is sleeping here."); - break; - case POS_RESTING: - if (victim->on != NULL) - { - if (IS_SET(victim->on->value[2],REST_AT)) - { - sprintf(message," is resting at %s.", - victim->on->short_descr); - strcat(buf,message); - } - else if (IS_SET(victim->on->value[2],REST_ON)) - { - sprintf(message," is resting on %s.", - victim->on->short_descr); - strcat(buf,message); - } - else - { - sprintf(message, " is resting in %s.", - victim->on->short_descr); - strcat(buf,message); - } - } - else - strcat( buf, " is resting here." ); - break; - case POS_SITTING: - if (victim->on != NULL) - { - if (IS_SET(victim->on->value[2],SIT_AT)) - { - sprintf(message," is sitting at %s.", - victim->on->short_descr); - strcat(buf,message); - } - else if (IS_SET(victim->on->value[2],SIT_ON)) - { - sprintf(message," is sitting on %s.", - victim->on->short_descr); - strcat(buf,message); - } - else - { - sprintf(message, " is sitting in %s.", - victim->on->short_descr); - strcat(buf,message); - } - } - else - strcat(buf, " is sitting here."); - break; - case POS_STANDING: - if (victim->on != NULL) - { - if (IS_SET(victim->on->value[2],STAND_AT)) - { - sprintf(message," is standing at %s.", - victim->on->short_descr); - strcat(buf,message); - } - else if (IS_SET(victim->on->value[2],STAND_ON)) - { - sprintf(message," is standing on %s.", - victim->on->short_descr); - strcat(buf,message); - } - else - { - sprintf(message," is standing in %s.", - victim->on->short_descr); - strcat(buf,message); - } - } - else - strcat( buf, " is here." ); - break; - case POS_FIGHTING: - strcat( buf, " is here, fighting " ); - if ( victim->fighting == NULL ) - strcat( buf, "thin air??" ); - else if ( victim->fighting == ch ) - strcat( buf, "YOU!" ); - else if ( victim->in_room == victim->fighting->in_room ) - { - strcat( buf, PERS( victim->fighting, ch ) ); - strcat( buf, "." ); - } - else - strcat( buf, "someone who left??" ); - break; - } - - strcat( buf, "\n\r" ); - buf[0] = UPPER(buf[0]); - send_to_char( buf, ch ); - return; -} - - - -void show_char_to_char_1( CHAR_DATA *victim, CHAR_DATA *ch ) -{ - char buf[MAX_STRING_LENGTH]; - OBJ_DATA *obj; - int iWear; - int percent; - bool found; - - if ( can_see( victim, ch ) ) - { - if (ch == victim) - act( "$n looks at $mself.",ch,NULL,NULL,TO_ROOM); - else - { - act( "$n looks at you.", ch, NULL, victim, TO_VICT ); - act( "$n looks at $N.", ch, NULL, victim, TO_NOTVICT ); - } - } - - if ( victim->description[0] != '\0' ) - { - send_to_char( victim->description, ch ); - } - else - { - act( "You see nothing special about $M.", ch, NULL, victim, TO_CHAR ); - } - - if ( victim->max_hit > 0 ) - percent = ( 100 * victim->hit ) / victim->max_hit; - else - percent = -1; - - strcpy( buf, PERS(victim, ch) ); - - if (percent >= 100) - strcat( buf, " is in excellent condition.\n\r"); - else if (percent >= 90) - strcat( buf, " has a few scratches.\n\r"); - else if (percent >= 75) - strcat( buf," has some small wounds and bruises.\n\r"); - else if (percent >= 50) - strcat( buf, " has quite a few wounds.\n\r"); - else if (percent >= 30) - strcat( buf, " has some big nasty wounds and scratches.\n\r"); - else if (percent >= 15) - strcat ( buf, " looks pretty hurt.\n\r"); - else if (percent >= 0 ) - strcat (buf, " is in awful condition.\n\r"); - else - strcat(buf, " is bleeding to death.\n\r"); - - buf[0] = UPPER(buf[0]); - send_to_char( buf, ch ); - - found = FALSE; - for ( iWear = 0; iWear < MAX_WEAR; iWear++ ) - { - if ( ( obj = get_eq_char( victim, iWear ) ) != NULL - && can_see_obj( ch, obj ) ) - { - if ( !found ) - { - send_to_char( "\n\r", ch ); - act( "$N is using:", ch, NULL, victim, TO_CHAR ); - found = TRUE; - } - send_to_char( where_name[iWear], ch ); - send_to_char( format_obj_to_char( obj, ch, TRUE ), ch ); - send_to_char( "\n\r", ch ); - } - } - - if ( victim != ch - && !IS_NPC(ch) - && number_percent( ) < get_skill(ch,gsn_peek)) - { - send_to_char( "\n\rYou peek at the inventory:\n\r", ch ); - check_improve(ch,gsn_peek,TRUE,4); - show_list_to_char( victim->carrying, ch, TRUE, TRUE ); - } - - return; -} - - - -void show_char_to_char( CHAR_DATA *list, CHAR_DATA *ch ) -{ - CHAR_DATA *rch; - - for ( rch = list; rch != NULL; rch = rch->next_in_room ) - { - if ( rch == ch ) - continue; - - if ( get_trust(ch) < rch->invis_level) - continue; - - if ( can_see( ch, rch ) ) - { - show_char_to_char_0( rch, ch ); - } - else if ( room_is_dark( ch->in_room ) - && IS_AFFECTED(rch, AFF_INFRARED ) ) - { - send_to_char( "You see glowing red eyes watching YOU!\n\r", ch ); - } - } - - return; -} - - - -bool check_blind( CHAR_DATA *ch ) -{ - - if (!IS_NPC(ch) && IS_SET(ch->act,PLR_HOLYLIGHT)) - return TRUE; - - if ( IS_AFFECTED(ch, AFF_BLIND) ) - { - send_to_char( "You can't see a thing!\n\r", ch ); - return FALSE; - } - - return TRUE; -} - -/* changes your scroll */ -void do_scroll(CHAR_DATA *ch, char *argument) -{ - char arg[MAX_INPUT_LENGTH]; - char buf[100]; - int lines; - - one_argument(argument,arg); - - if (arg[0] == '\0') - { - if (ch->lines == 0) - send_to_char("You do not page long messages.\n\r",ch); - else - { - sprintf(buf,"You currently display %d lines per page.\n\r", - ch->lines + 2); - send_to_char(buf,ch); - } - return; - } - - if (!is_number(arg)) - { - send_to_char("You must provide a number.\n\r",ch); - return; - } - - lines = atoi(arg); - - if (lines == 0) - { - send_to_char("Paging disabled.\n\r",ch); - ch->lines = 0; - return; - } - - if (lines < 10 || lines > 100) - { - send_to_char("You must provide a reasonable number.\n\r",ch); - return; - } - - sprintf(buf,"Scroll set to %d lines.\n\r",lines); - send_to_char(buf,ch); - ch->lines = lines - 2; -} - -/* RT does socials */ -void do_socials(CHAR_DATA *ch, char *argument) -{ - char buf[MAX_STRING_LENGTH]; - int iSocial; - int col; - - col = 0; - - for (iSocial = 0; social_table[iSocial].name[0] != '\0'; iSocial++) - { - sprintf(buf,"%-12s",social_table[iSocial].name); - send_to_char(buf,ch); - if (++col % 6 == 0) - send_to_char("\n\r",ch); - } - - if ( col % 6 != 0) - send_to_char("\n\r",ch); - return; -} - - - -/* RT Commands to replace news, motd, imotd, etc from ROM */ - -void do_motd(CHAR_DATA *ch, char *argument) -{ - do_function(ch, &do_help, "motd"); -} - -void do_imotd(CHAR_DATA *ch, char *argument) -{ - do_function(ch, &do_help, "imotd"); -} - -void do_rules(CHAR_DATA *ch, char *argument) -{ - do_function(ch, &do_help, "rules"); -} - -void do_story(CHAR_DATA *ch, char *argument) -{ - do_function(ch, &do_help, "story"); -} - -void do_wizlist(CHAR_DATA *ch, char *argument) -{ - do_function(ch, &do_help, "wizlist"); -} - -/* RT this following section holds all the auto commands from ROM, as well as - replacements for config */ - -void do_autolist(CHAR_DATA *ch, char *argument) -{ - /* lists most player flags */ - if (IS_NPC(ch)) - return; - - send_to_char(" action status\n\r",ch); - send_to_char("---------------------\n\r",ch); - - send_to_char("autoassist ",ch); - if (IS_SET(ch->act,PLR_AUTOASSIST)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("autoexit ",ch); - if (IS_SET(ch->act,PLR_AUTOEXIT)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("autogold ",ch); - if (IS_SET(ch->act,PLR_AUTOGOLD)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("autoloot ",ch); - if (IS_SET(ch->act,PLR_AUTOLOOT)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("autosac ",ch); - if (IS_SET(ch->act,PLR_AUTOSAC)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("autosplit ",ch); - if (IS_SET(ch->act,PLR_AUTOSPLIT)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("compact mode ",ch); - if (IS_SET(ch->comm,COMM_COMPACT)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("prompt ",ch); - if (IS_SET(ch->comm,COMM_PROMPT)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - send_to_char("combine items ",ch); - if (IS_SET(ch->comm,COMM_COMBINE)) - send_to_char("ON\n\r",ch); - else - send_to_char("OFF\n\r",ch); - - if (!IS_SET(ch->act,PLR_CANLOOT)) - send_to_char("Your corpse is safe from thieves.\n\r",ch); - else - send_to_char("Your corpse may be looted.\n\r",ch); - - if (IS_SET(ch->act,PLR_NOSUMMON)) - send_to_char("You cannot be summoned.\n\r",ch); - else - send_to_char("You can be summoned.\n\r",ch); - - if (IS_SET(ch->act,PLR_NOFOLLOW)) - send_to_char("You do not welcome followers.\n\r",ch); - else - send_to_char("You accept followers.\n\r",ch); -} - -void do_autoassist(CHAR_DATA *ch, char *argument) -{ - if (IS_NPC(ch)) - return; - - if (IS_SET(ch->act,PLR_AUTOASSIST)) - { - send_to_char("Autoassist removed.\n\r",ch); - REMOVE_BIT(ch->act,PLR_AUTOASSIST); - } - else - { - send_to_char("You will now assist when needed.\n\r",ch); - SET_BIT(ch->act,PLR_AUTOASSIST); - } -} - -void do_autoexit(CHAR_DATA *ch, char *argument) -{ - if (IS_NPC(ch)) - return; - - if (IS_SET(ch->act,PLR_AUTOEXIT)) - { - send_to_char("Exits will no longer be displayed.\n\r",ch); - REMOVE_BIT(ch->act,PLR_AUTOEXIT); - } - else - { - send_to_char("Exits will now be displayed.\n\r",ch); - SET_BIT(ch->act,PLR_AUTOEXIT); - } -} - -void do_autogold(CHAR_DATA *ch, char *argument) -{ - if (IS_NPC(ch)) - return; - - if (IS_SET(ch->act,PLR_AUTOGOLD)) - { - send_to_char("Autogold removed.\n\r",ch); - REMOVE_BIT(ch->act,PLR_AUTOGOLD); - } - else - { - send_to_char("Automatic gold looting set.\n\r",ch); - SET_BIT(ch->act,PLR_AUTOGOLD); - } -} - -void do_autoloot(CHAR_DATA *ch, char *argument) -{ - if (IS_NPC(ch)) - return; - - if (IS_SET(ch->act,PLR_AUTOLOOT)) - { - send_to_char("Autolooting removed.\n\r",ch); - REMOVE_BIT(ch->act,PLR_AUTOLOOT); - } - else - { - send_to_char("Automatic corpse looting set.\n\r",ch); - SET_BIT(ch->act,PLR_AUTOLOOT); - } -} - -void do_autosac(CHAR_DATA *ch, char *argument) -{ - if (IS_NPC(ch)) - return; - - if (IS_SET(ch->act,PLR_AUTOSAC)) - { - send_to_char("Autosacrificing removed.\n\r",ch); - REMOVE_BIT(ch->act,PLR_AUTOSAC); - } - else - { - send_to_char("Automatic corpse sacrificing set.\n\r",ch); - SET_BIT(ch->act,PLR_AUTOSAC); - } -} - -void do_autosplit(CHAR_DATA *ch, char *argument) -{ - if (IS_NPC(ch)) - return; - - if (IS_SET(ch->act,PLR_AUTOSPLIT)) - { - send_to_char("Autosplitting removed.\n\r",ch); - REMOVE_BIT(ch->act,PLR_AUTOSPLIT); - } - else - { - send_to_char("Automatic gold splitting set.\n\r",ch); - SET_BIT(ch->act,PLR_AUTOSPLIT); - } -} - -void do_brief(CHAR_DATA *ch, char *argument) -{ - if (IS_SET(ch->comm,COMM_BRIEF)) - { - send_to_char("Full descriptions activated.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_BRIEF); - } - else - { - send_to_char("Short descriptions activated.\n\r",ch); - SET_BIT(ch->comm,COMM_BRIEF); - } -} - -void do_compact(CHAR_DATA *ch, char *argument) -{ - if (IS_SET(ch->comm,COMM_COMPACT)) - { - send_to_char("Compact mode removed.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_COMPACT); - } - else - { - send_to_char("Compact mode set.\n\r",ch); - SET_BIT(ch->comm,COMM_COMPACT); - } -} - -void do_show(CHAR_DATA *ch, char *argument) -{ - if (IS_SET(ch->comm,COMM_SHOW_AFFECTS)) - { - send_to_char("Affects will no longer be shown in score.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_SHOW_AFFECTS); - } - else - { - send_to_char("Affects will now be shown in score.\n\r",ch); - SET_BIT(ch->comm,COMM_SHOW_AFFECTS); - } -} - -void do_prompt(CHAR_DATA *ch, char *argument) -{ - char buf[MAX_STRING_LENGTH]; - - if ( argument[0] == '\0' ) - { - if (IS_SET(ch->comm,COMM_PROMPT)) - { - send_to_char("You will no longer see prompts.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_PROMPT); - } - else - { - send_to_char("You will now see prompts.\n\r",ch); - SET_BIT(ch->comm,COMM_PROMPT); - } - return; - } - - if( !strcmp( argument, "all" ) ) - strcpy( buf, "<%hhp %mm %vmv> "); - else - { - if ( strlen(argument) > 50 ) - argument[50] = '\0'; - strcpy( buf, argument ); - smash_tilde( buf ); - if (str_suffix("%c",buf)) - strcat(buf," "); - - } - - free_string( ch->prompt ); - ch->prompt = str_dup( buf ); - sprintf(buf,"Prompt set to %s\n\r",ch->prompt ); - send_to_char(buf,ch); - return; -} - -void do_combine(CHAR_DATA *ch, char *argument) -{ - if (IS_SET(ch->comm,COMM_COMBINE)) - { - send_to_char("Long inventory selected.\n\r",ch); - REMOVE_BIT(ch->comm,COMM_COMBINE); - } - else - { - send_to_char("Combined inventory selected.\n\r",ch); - SET_BIT(ch->comm,COMM_COMBINE); - } -} - -void do_noloot(CHAR_DATA *ch, char *argument) -{ - if (IS_NPC(ch)) - return; - - if (IS_SET(ch->act,PLR_CANLOOT)) - { - send_to_char("Your corpse is now safe from thieves.\n\r",ch); - REMOVE_BIT(ch->act,PLR_CANLOOT); - } - else - { - send_to_char("Your corpse may now be looted.\n\r",ch); - SET_BIT(ch->act,PLR_CANLOOT); - } -} - -void do_nofollow(CHAR_DATA *ch, char *argument) -{ - if (IS_NPC(ch)) - return; - - if (IS_SET(ch->act,PLR_NOFOLLOW)) - { - send_to_char("You now accept followers.\n\r",ch); - REMOVE_BIT(ch->act,PLR_NOFOLLOW); - } - else - { - send_to_char("You no longer accept followers.\n\r",ch); - SET_BIT(ch->act,PLR_NOFOLLOW); - die_follower( ch ); - } -} - -void do_nosummon(CHAR_DATA *ch, char *argument) -{ - if (IS_NPC(ch)) - { - if (IS_SET(ch->imm_flags,IMM_SUMMON)) - { - send_to_char("You are no longer immune to summon.\n\r",ch); - REMOVE_BIT(ch->imm_flags,IMM_SUMMON); - } - else - { - send_to_char("You are now immune to summoning.\n\r",ch); - SET_BIT(ch->imm_flags,IMM_SUMMON); - } - } - else - { - if (IS_SET(ch->act,PLR_NOSUMMON)) - { - send_to_char("You are no longer immune to summon.\n\r",ch); - REMOVE_BIT(ch->act,PLR_NOSUMMON); - } - else - { - send_to_char("You are now immune to summoning.\n\r",ch); - SET_BIT(ch->act,PLR_NOSUMMON); - } - } -} - -void do_look( CHAR_DATA *ch, char *argument ) -{ - char buf [MAX_STRING_LENGTH]; - char arg1 [MAX_INPUT_LENGTH]; - char arg2 [MAX_INPUT_LENGTH]; - char arg3 [MAX_INPUT_LENGTH]; - EXIT_DATA *pexit; - CHAR_DATA *victim; - OBJ_DATA *obj; - char *pdesc; - int door; - int number,count; - - if ( ch->desc == NULL ) - return; - - if ( ch->position < POS_SLEEPING ) - { - send_to_char( "You can't see anything but stars!\n\r", ch ); - return; - } - - if ( ch->position == POS_SLEEPING ) - { - send_to_char( "You can't see anything, you're sleeping!\n\r", ch ); - return; - } - - if ( !check_blind( ch ) ) - return; - - if ( !IS_NPC(ch) - && !IS_SET(ch->act, PLR_HOLYLIGHT) - && room_is_dark( ch->in_room ) ) - { - send_to_char( "It is pitch black ... \n\r", ch ); - show_char_to_char( ch->in_room->people, ch ); - return; - } - - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - number = number_argument(arg1,arg3); - count = 0; - - if ( arg1[0] == '\0' || !str_cmp( arg1, "auto" ) ) - { - /* 'look' or 'look auto' */ - send_to_char( ch->in_room->name, ch ); - - if (IS_IMMORTAL(ch) && (IS_NPC(ch) || IS_SET(ch->act,PLR_HOLYLIGHT))) - { - sprintf(buf," [Room %d]",ch->in_room->vnum); - send_to_char(buf,ch); - } - - send_to_char( "\n\r", ch ); - - if ( arg1[0] == '\0' - || ( !IS_NPC(ch) && !IS_SET(ch->comm, COMM_BRIEF) ) ) - { - send_to_char( " ",ch); - send_to_char( ch->in_room->description, ch ); - } - - if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_AUTOEXIT) ) - { - send_to_char("\n\r",ch); - do_function(ch, &do_exits, "auto" ); - } - - show_list_to_char( ch->in_room->contents, ch, FALSE, FALSE ); - show_char_to_char( ch->in_room->people, ch ); - return; - } - - if ( !str_cmp( arg1, "i" ) || !str_cmp(arg1, "in") || !str_cmp(arg1,"on")) - { - /* 'look in' */ - if ( arg2[0] == '\0' ) - { - send_to_char( "Look in what?\n\r", ch ); - return; - } - - if ( ( obj = get_obj_here( ch, arg2 ) ) == NULL ) - { - send_to_char( "You do not see that here.\n\r", ch ); - return; - } - - switch ( obj->item_type ) - { - default: - send_to_char( "That is not a container.\n\r", ch ); - break; - - case ITEM_DRINK_CON: - if ( obj->value[1] <= 0 ) - { - send_to_char( "It is empty.\n\r", ch ); - break; - } - - sprintf( buf, "It's %sfilled with a %s liquid.\n\r", - obj->value[1] < obj->value[0] / 4 - ? "less than half-" : - obj->value[1] < 3 * obj->value[0] / 4 - ? "about half-" : "more than half-", - liq_table[obj->value[2]].liq_color - ); - - send_to_char( buf, ch ); - break; - - case ITEM_CONTAINER: - case ITEM_CORPSE_NPC: - case ITEM_CORPSE_PC: - if ( IS_SET(obj->value[1], CONT_CLOSED) ) - { - send_to_char( "It is closed.\n\r", ch ); - break; - } - - act( "$p holds:", ch, obj, NULL, TO_CHAR ); - show_list_to_char( obj->contains, ch, TRUE, TRUE ); - break; - } - return; - } - - if ( ( victim = get_char_room( ch, arg1 ) ) != NULL ) - { - show_char_to_char_1( victim, ch ); - return; - } - - for ( obj = ch->carrying; obj != NULL; obj = obj->next_content ) - { - if ( can_see_obj( ch, obj ) ) - { /* player can see object */ - pdesc = get_extra_descr( arg3, obj->extra_descr ); - if ( pdesc != NULL ) - { if (++count == number) - { - send_to_char( pdesc, ch ); - return; - } - else continue; - } - pdesc = get_extra_descr( arg3, obj->pIndexData->extra_descr ); - if ( pdesc != NULL ) - { if (++count == number) - { - send_to_char( pdesc, ch ); - return; - } - else continue; - } - if ( is_name( arg3, obj->name ) ) - if (++count == number) - { - send_to_char( obj->description, ch ); - send_to_char( "\n\r",ch); - return; - } - } - } - - for ( obj = ch->in_room->contents; obj != NULL; obj = obj->next_content ) - { - if ( can_see_obj( ch, obj ) ) - { - pdesc = get_extra_descr( arg3, obj->extra_descr ); - if ( pdesc != NULL ) - if (++count == number) - { - send_to_char( pdesc, ch ); - return; - } - - pdesc = get_extra_descr( arg3, obj->pIndexData->extra_descr ); - if ( pdesc != NULL ) - if (++count == number) - { - send_to_char( pdesc, ch ); - return; - } - - if ( is_name( arg3, obj->name ) ) - if (++count == number) - { - send_to_char( obj->description, ch ); - send_to_char("\n\r",ch); - return; - } - } - } - - pdesc = get_extra_descr(arg3,ch->in_room->extra_descr); - if (pdesc != NULL) - { - if (++count == number) - { - send_to_char(pdesc,ch); - return; - } - } - - if (count > 0 && count != number) - { - if (count == 1) - sprintf(buf,"You only see one %s here.\n\r",arg3); - else - sprintf(buf,"You only see %d of those here.\n\r",count); - - send_to_char(buf,ch); - return; - } - - if ( !str_cmp( arg1, "n" ) || !str_cmp( arg1, "north" ) ) door = 0; - else if ( !str_cmp( arg1, "e" ) || !str_cmp( arg1, "east" ) ) door = 1; - else if ( !str_cmp( arg1, "s" ) || !str_cmp( arg1, "south" ) ) door = 2; - else if ( !str_cmp( arg1, "w" ) || !str_cmp( arg1, "west" ) ) door = 3; - else if ( !str_cmp( arg1, "u" ) || !str_cmp( arg1, "up" ) ) door = 4; - else if ( !str_cmp( arg1, "d" ) || !str_cmp( arg1, "down" ) ) door = 5; - else - { - send_to_char( "You do not see that here.\n\r", ch ); - return; - } - - /* 'look direction' */ - if ( ( pexit = ch->in_room->exit[door] ) == NULL ) - { - send_to_char( "Nothing special there.\n\r", ch ); - return; - } - - if ( pexit->description != NULL && pexit->description[0] != '\0' ) - send_to_char( pexit->description, ch ); - else - send_to_char( "Nothing special there.\n\r", ch ); - - if ( pexit->keyword != NULL - && pexit->keyword[0] != '\0' - && pexit->keyword[0] != ' ' ) - { - if ( IS_SET(pexit->exit_info, EX_CLOSED) ) - { - act( "The $d is closed.", ch, NULL, pexit->keyword, TO_CHAR ); - } - else if ( IS_SET(pexit->exit_info, EX_ISDOOR) ) - { - act( "The $d is open.", ch, NULL, pexit->keyword, TO_CHAR ); - } - } - - return; -} - -/* RT added back for the hell of it */ -void do_read (CHAR_DATA *ch, char *argument ) -{ - do_function(ch, &do_look, argument); -} - -void do_examine( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Examine what?\n\r", ch ); - return; - } - - do_function(ch, &do_look, arg ); - - if ( ( obj = get_obj_here( ch, arg ) ) != NULL ) - { - switch ( obj->item_type ) - { - default: - break; - - case ITEM_JUKEBOX: - do_function(ch, &do_play, "list"); - break; - - case ITEM_MONEY: - if (obj->value[0] == 0) - { - if (obj->value[1] == 0) - sprintf(buf,"Odd...there's no coins in the pile.\n\r"); - else if (obj->value[1] == 1) - sprintf(buf,"Wow. One gold coin.\n\r"); - else - sprintf(buf,"There are %d gold coins in the pile.\n\r", - obj->value[1]); - } - else if (obj->value[1] == 0) - { - if (obj->value[0] == 1) - sprintf(buf,"Wow. One silver coin.\n\r"); - else - sprintf(buf,"There are %d silver coins in the pile.\n\r", - obj->value[0]); - } - else - sprintf(buf, - "There are %d gold and %d silver coins in the pile.\n\r", - obj->value[1],obj->value[0]); - send_to_char(buf,ch); - break; - - case ITEM_DRINK_CON: - case ITEM_CONTAINER: - case ITEM_CORPSE_NPC: - case ITEM_CORPSE_PC: - sprintf(buf,"in %s",argument); - do_function(ch, &do_look, buf ); - } - } - - return; -} - - - -/* - * Thanks to Zrin for auto-exit part. - */ -void do_exits( CHAR_DATA *ch, char *argument ) -{ - extern char * const dir_name[]; - char buf[MAX_STRING_LENGTH]; - EXIT_DATA *pexit; - bool found; - bool fAuto; - int door; - - fAuto = !str_cmp( argument, "auto" ); - - if ( !check_blind( ch ) ) - return; - - if (fAuto) - sprintf(buf,"[Exits:"); - else if (IS_IMMORTAL(ch)) - sprintf(buf,"Obvious exits from room %d:\n\r",ch->in_room->vnum); - else - sprintf(buf,"Obvious exits:\n\r"); - - found = FALSE; - for ( door = 0; door <= 5; door++ ) - { - if ( ( pexit = ch->in_room->exit[door] ) != NULL - && pexit->u1.to_room != NULL - && can_see_room(ch,pexit->u1.to_room) - && !IS_SET(pexit->exit_info, EX_CLOSED) ) - { - found = TRUE; - if ( fAuto ) - { - strcat( buf, " " ); - strcat( buf, dir_name[door] ); - } - else - { - sprintf( buf + strlen(buf), "%-5s - %s", - capitalize( dir_name[door] ), - room_is_dark( pexit->u1.to_room ) - ? "Too dark to tell" - : pexit->u1.to_room->name - ); - if (IS_IMMORTAL(ch)) - sprintf(buf + strlen(buf), - " (room %d)\n\r",pexit->u1.to_room->vnum); - else - sprintf(buf + strlen(buf), "\n\r"); - } - } - } - - if ( !found ) - strcat( buf, fAuto ? " none" : "None.\n\r" ); - - if ( fAuto ) - strcat( buf, "]\n\r" ); - - send_to_char( buf, ch ); - return; -} - -void do_worth( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - - if (IS_NPC(ch)) - { - sprintf(buf,"You have %ld gold and %ld silver.\n\r", - ch->gold,ch->silver); - send_to_char(buf,ch); - return; - } - - sprintf(buf, - "You have %ld gold, %ld silver, and %d experience (%d exp to level).\n\r", - ch->gold, ch->silver,ch->exp, - (ch->level + 1) * exp_per_level(ch,ch->pcdata->points) - ch->exp); - - send_to_char(buf,ch); - - return; -} - - -void do_score( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - int i; - - sprintf( buf, - "You are %s%s, level %d, %d years old (%d hours).\n\r", - ch->name, - IS_NPC(ch) ? "" : ch->pcdata->title, - ch->level, get_age(ch), - ( ch->played + (int) (current_time - ch->logon) ) / 3600); - send_to_char( buf, ch ); - - if ( get_trust( ch ) != ch->level ) - { - sprintf( buf, "You are trusted at level %d.\n\r", - get_trust( ch ) ); - send_to_char( buf, ch ); - } - - sprintf(buf, "Race: %s Sex: %s Class: %s\n\r", - race_table[ch->race].name, - ch->sex == 0 ? "sexless" : ch->sex == 1 ? "male" : "female", - IS_NPC(ch) ? "mobile" : class_table[ch->class].name); - send_to_char(buf,ch); - - - sprintf( buf, - "You have %d/%d hit, %d/%d mana, %d/%d movement.\n\r", - ch->hit, ch->max_hit, - ch->mana, ch->max_mana, - ch->move, ch->max_move); - send_to_char( buf, ch ); - - sprintf( buf, - "You have %d practices and %d training sessions.\n\r", - ch->practice, ch->train); - send_to_char( buf, ch ); - - sprintf( buf, - "You are carrying %d/%d items with weight %ld/%d pounds.\n\r", - ch->carry_number, can_carry_n(ch), - get_carry_weight(ch) / 10, can_carry_w(ch) /10 ); - send_to_char( buf, ch ); - - sprintf( buf, - "Str: %d(%d) Int: %d(%d) Wis: %d(%d) Dex: %d(%d) Con: %d(%d)\n\r", - ch->perm_stat[STAT_STR], - get_curr_stat(ch,STAT_STR), - ch->perm_stat[STAT_INT], - get_curr_stat(ch,STAT_INT), - ch->perm_stat[STAT_WIS], - get_curr_stat(ch,STAT_WIS), - ch->perm_stat[STAT_DEX], - get_curr_stat(ch,STAT_DEX), - ch->perm_stat[STAT_CON], - get_curr_stat(ch,STAT_CON) ); - send_to_char( buf, ch ); - - sprintf( buf, - "You have scored %d exp, and have %ld gold and %ld silver coins.\n\r", - ch->exp, ch->gold, ch->silver ); - send_to_char( buf, ch ); - - /* RT shows exp to level */ - if (!IS_NPC(ch) && ch->level < LEVEL_HERO) - { - sprintf (buf, - "You need %d exp to level.\n\r", - ((ch->level + 1) * exp_per_level(ch,ch->pcdata->points) - ch->exp)); - send_to_char( buf, ch ); - } - - sprintf( buf, "Wimpy set to %d hit points.\n\r", ch->wimpy ); - send_to_char( buf, ch ); - - if ( !IS_NPC(ch) && ch->pcdata->condition[COND_DRUNK] > 10 ) - send_to_char( "You are drunk.\n\r", ch ); - if ( !IS_NPC(ch) && ch->pcdata->condition[COND_THIRST] == 0 ) - send_to_char( "You are thirsty.\n\r", ch ); - if ( !IS_NPC(ch) && ch->pcdata->condition[COND_HUNGER] == 0 ) - send_to_char( "You are hungry.\n\r", ch ); - - switch ( ch->position ) - { - case POS_DEAD: - send_to_char( "You are DEAD!!\n\r", ch ); - break; - case POS_MORTAL: - send_to_char( "You are mortally wounded.\n\r", ch ); - break; - case POS_INCAP: - send_to_char( "You are incapacitated.\n\r", ch ); - break; - case POS_STUNNED: - send_to_char( "You are stunned.\n\r", ch ); - break; - case POS_SLEEPING: - send_to_char( "You are sleeping.\n\r", ch ); - break; - case POS_RESTING: - send_to_char( "You are resting.\n\r", ch ); - break; - case POS_SITTING: - send_to_char( "You are sitting.\n\r", ch ); - break; - case POS_STANDING: - send_to_char( "You are standing.\n\r", ch ); - break; - case POS_FIGHTING: - send_to_char( "You are fighting.\n\r", ch ); - break; - } - - - /* print AC values */ - if (ch->level >= 25) - { - sprintf( buf,"Armor: pierce: %d bash: %d slash: %d magic: %d\n\r", - GET_AC(ch,AC_PIERCE), - GET_AC(ch,AC_BASH), - GET_AC(ch,AC_SLASH), - GET_AC(ch,AC_EXOTIC)); - send_to_char(buf,ch); - } - - for (i = 0; i < 4; i++) - { - char * temp; - - switch(i) - { - case(AC_PIERCE): temp = "piercing"; break; - case(AC_BASH): temp = "bashing"; break; - case(AC_SLASH): temp = "slashing"; break; - case(AC_EXOTIC): temp = "magic"; break; - default: temp = "error"; break; - } - - send_to_char("You are ", ch); - - if (GET_AC(ch,i) >= 101 ) - sprintf(buf,"hopelessly vulnerable to %s.\n\r",temp); - else if (GET_AC(ch,i) >= 80) - sprintf(buf,"defenseless against %s.\n\r",temp); - else if (GET_AC(ch,i) >= 60) - sprintf(buf,"barely protected from %s.\n\r",temp); - else if (GET_AC(ch,i) >= 40) - sprintf(buf,"slightly armored against %s.\n\r",temp); - else if (GET_AC(ch,i) >= 20) - sprintf(buf,"somewhat armored against %s.\n\r",temp); - else if (GET_AC(ch,i) >= 0) - sprintf(buf,"armored against %s.\n\r",temp); - else if (GET_AC(ch,i) >= -20) - sprintf(buf,"well-armored against %s.\n\r",temp); - else if (GET_AC(ch,i) >= -40) - sprintf(buf,"very well-armored against %s.\n\r",temp); - else if (GET_AC(ch,i) >= -60) - sprintf(buf,"heavily armored against %s.\n\r",temp); - else if (GET_AC(ch,i) >= -80) - sprintf(buf,"superbly armored against %s.\n\r",temp); - else if (GET_AC(ch,i) >= -100) - sprintf(buf,"almost invulnerable to %s.\n\r",temp); - else - sprintf(buf,"divinely armored against %s.\n\r",temp); - - send_to_char(buf,ch); - } - - - /* RT wizinvis and holy light */ - if ( IS_IMMORTAL(ch)) - { - send_to_char("Holy Light: ",ch); - if (IS_SET(ch->act,PLR_HOLYLIGHT)) - send_to_char("on",ch); - else - send_to_char("off",ch); - - if (ch->invis_level) - { - sprintf( buf, " Invisible: level %d",ch->invis_level); - send_to_char(buf,ch); - } - - if (ch->incog_level) - { - sprintf(buf," Incognito: level %d",ch->incog_level); - send_to_char(buf,ch); - } - send_to_char("\n\r",ch); - } - - if ( ch->level >= 15 ) - { - sprintf( buf, "Hitroll: %d Damroll: %d.\n\r", - GET_HITROLL(ch), GET_DAMROLL(ch) ); - send_to_char( buf, ch ); - } - - if ( ch->level >= 10 ) - { - sprintf( buf, "Alignment: %d. ", ch->alignment ); - send_to_char( buf, ch ); - } - - send_to_char( "You are ", ch ); - if ( ch->alignment > 900 ) send_to_char( "angelic.\n\r", ch ); - else if ( ch->alignment > 700 ) send_to_char( "saintly.\n\r", ch ); - else if ( ch->alignment > 350 ) send_to_char( "good.\n\r", ch ); - else if ( ch->alignment > 100 ) send_to_char( "kind.\n\r", ch ); - else if ( ch->alignment > -100 ) send_to_char( "neutral.\n\r", ch ); - else if ( ch->alignment > -350 ) send_to_char( "mean.\n\r", ch ); - else if ( ch->alignment > -700 ) send_to_char( "evil.\n\r", ch ); - else if ( ch->alignment > -900 ) send_to_char( "demonic.\n\r", ch ); - else send_to_char( "satanic.\n\r", ch ); - - if (IS_SET(ch->comm,COMM_SHOW_AFFECTS)) - do_function(ch, &do_affects, ""); -} - -void do_affects(CHAR_DATA *ch, char *argument ) -{ - AFFECT_DATA *paf, *paf_last = NULL; - char buf[MAX_STRING_LENGTH]; - - if ( ch->affected != NULL ) - { - send_to_char( "You are affected by the following spells:\n\r", ch ); - for ( paf = ch->affected; paf != NULL; paf = paf->next ) - { - if (paf_last != NULL && paf->type == paf_last->type) - if (ch->level >= 20) - sprintf( buf, " "); - else - continue; - else - sprintf( buf, "Spell: %-15s", skill_table[paf->type].name ); - - send_to_char( buf, ch ); - - if ( ch->level >= 20 ) - { - sprintf( buf, - ": modifies %s by %d ", - affect_loc_name( paf->location ), - paf->modifier); - send_to_char( buf, ch ); - if ( paf->duration == -1 ) - sprintf( buf, "permanently" ); - else - sprintf( buf, "for %d hours", paf->duration ); - send_to_char( buf, ch ); - } - - send_to_char( "\n\r", ch ); - paf_last = paf; - } - } - else - send_to_char("You are not affected by any spells.\n\r",ch); - - return; -} - - - -char * const day_name [] = -{ - "the Moon", "the Bull", "Deception", "Thunder", "Freedom", - "the Great Gods", "the Sun" -}; - -char * const month_name [] = -{ - "Winter", "the Winter Wolf", "the Frost Giant", "the Old Forces", - "the Grand Struggle", "the Spring", "Nature", "Futility", "the Dragon", - "the Sun", "the Heat", "the Battle", "the Dark Shades", "the Shadows", - "the Long Shadows", "the Ancient Darkness", "the Great Evil" -}; - -void do_time( CHAR_DATA *ch, char *argument ) -{ - extern char str_boot_time[]; - char buf[MAX_STRING_LENGTH]; - char *suf; - int day; - - day = time_info.day + 1; - - if ( day > 4 && day < 20 ) suf = "th"; - else if ( day % 10 == 1 ) suf = "st"; - else if ( day % 10 == 2 ) suf = "nd"; - else if ( day % 10 == 3 ) suf = "rd"; - else suf = "th"; - - sprintf( buf, - "It is %d o'clock %s, Day of %s, %d%s the Month of %s.\n\r", - (time_info.hour % 12 == 0) ? 12 : time_info.hour %12, - time_info.hour >= 12 ? "pm" : "am", - day_name[day % 7], - day, suf, - month_name[time_info.month]); - send_to_char(buf,ch); - sprintf(buf,"ROM started up at %s\n\rThe system time is %s.\n\r", - str_boot_time, - (char *) ctime( ¤t_time ) - ); - - send_to_char( buf, ch ); - return; -} - - - -void do_weather( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - - static char * const sky_look[4] = - { - "cloudless", - "cloudy", - "rainy", - "lit by flashes of lightning" - }; - - if ( !IS_OUTSIDE(ch) ) - { - send_to_char( "You can't see the weather indoors.\n\r", ch ); - return; - } - - sprintf( buf, "The sky is %s and %s.\n\r", - sky_look[weather_info.sky], - weather_info.change >= 0 - ? "a warm southerly breeze blows" - : "a cold northern gust blows" - ); - send_to_char( buf, ch ); - return; -} - -void do_help( CHAR_DATA *ch, char *argument ) -{ - HELP_DATA *pHelp; - BUFFER *output; - bool found = FALSE; - char argall[MAX_INPUT_LENGTH],argone[MAX_INPUT_LENGTH]; - int level; - - output = new_buf(); - - if ( argument[0] == '\0' ) - argument = "summary"; - - /* this parts handles help a b so that it returns help 'a b' */ - argall[0] = '\0'; - while (argument[0] != '\0' ) - { - argument = one_argument(argument,argone); - if (argall[0] != '\0') - strcat(argall," "); - strcat(argall,argone); - } - - for ( pHelp = help_first; pHelp != NULL; pHelp = pHelp->next ) - { - level = (pHelp->level < 0) ? -1 * pHelp->level - 1 : pHelp->level; - - if (level > get_trust( ch ) ) - continue; - - if ( is_name( argall, pHelp->keyword ) ) - { - /* add seperator if found */ - if (found) - add_buf(output, - "\n\r============================================================\n\r\n\r"); - if ( pHelp->level >= 0 && str_cmp( argall, "imotd" ) ) - { - add_buf(output,pHelp->keyword); - add_buf(output,"\n\r"); - } - - /* - * Strip leading '.' to allow initial blanks. - */ - if ( pHelp->text[0] == '.' ) - add_buf(output,pHelp->text+1); - else - add_buf(output,pHelp->text); - found = TRUE; - /* small hack :) */ - if (ch->desc != NULL && ch->desc->connected != CON_PLAYING - && ch->desc->connected != CON_GEN_GROUPS) - break; - } - } - - if (!found) - send_to_char( "No help on that word.\n\r", ch ); - else - page_to_char(buf_string(output),ch); - free_buf(output); -} - - -/* whois command */ -void do_whois (CHAR_DATA *ch, char *argument) -{ - char arg[MAX_INPUT_LENGTH]; - BUFFER *output; - char buf[MAX_STRING_LENGTH]; - DESCRIPTOR_DATA *d; - bool found = FALSE; - - one_argument(argument,arg); - - if (arg[0] == '\0') - { - send_to_char("You must provide a name.\n\r",ch); - return; - } - - output = new_buf(); - - for (d = descriptor_list; d != NULL; d = d->next) - { - CHAR_DATA *wch; - char const *class; - - if (d->connected != CON_PLAYING || !can_see(ch,d->character)) - continue; - - wch = ( d->original != NULL ) ? d->original : d->character; - - if (!can_see(ch,wch)) - continue; - - if (!str_prefix(arg,wch->name)) - { - found = TRUE; - - /* work out the printing */ - class = class_table[wch->class].who_name; - switch(wch->level) - { - case MAX_LEVEL - 0 : class = "IMP"; break; - case MAX_LEVEL - 1 : class = "CRE"; break; - case MAX_LEVEL - 2 : class = "SUP"; break; - case MAX_LEVEL - 3 : class = "DEI"; break; - case MAX_LEVEL - 4 : class = "GOD"; break; - case MAX_LEVEL - 5 : class = "IMM"; break; - case MAX_LEVEL - 6 : class = "DEM"; break; - case MAX_LEVEL - 7 : class = "ANG"; break; - case MAX_LEVEL - 8 : class = "AVA"; break; - } - - /* a little formatting */ - sprintf(buf, "[%2d %6s %s] %s%s%s%s%s%s%s%s\n\r", - wch->level, - wch->race < MAX_PC_RACE ? pc_race_table[wch->race].who_name - : " ", - class, - wch->incog_level >= LEVEL_HERO ? "(Incog) ": "", - wch->invis_level >= LEVEL_HERO ? "(Wizi) " : "", - clan_table[wch->clan].who_name, - IS_SET(wch->comm, COMM_AFK) ? "[AFK] " : "", - IS_SET(wch->act,PLR_KILLER) ? "(KILLER) " : "", - IS_SET(wch->act,PLR_THIEF) ? "(THIEF) " : "", - wch->name, IS_NPC(wch) ? "" : wch->pcdata->title); - add_buf(output,buf); - } - } - - if (!found) - { - send_to_char("No one of that name is playing.\n\r",ch); - return; - } - - page_to_char(buf_string(output),ch); - free_buf(output); -} - - -/* - * New 'who' command originally by Alander of Rivers of Mud. - */ -void do_who( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char buf2[MAX_STRING_LENGTH]; - BUFFER *output; - DESCRIPTOR_DATA *d; - int iClass; - int iRace; - int iClan; - int iLevelLower; - int iLevelUpper; - int nNumber; - int nMatch; - bool rgfClass[MAX_CLASS]; - bool rgfRace[MAX_PC_RACE]; - bool rgfClan[MAX_CLAN]; - bool fClassRestrict = FALSE; - bool fClanRestrict = FALSE; - bool fClan = FALSE; - bool fRaceRestrict = FALSE; - bool fImmortalOnly = FALSE; - - /* - * Set default arguments. - */ - iLevelLower = 0; - iLevelUpper = MAX_LEVEL; - for ( iClass = 0; iClass < MAX_CLASS; iClass++ ) - rgfClass[iClass] = FALSE; - for ( iRace = 0; iRace < MAX_PC_RACE; iRace++ ) - rgfRace[iRace] = FALSE; - for (iClan = 0; iClan < MAX_CLAN; iClan++) - rgfClan[iClan] = FALSE; - - /* - * Parse arguments. - */ - nNumber = 0; - for ( ;; ) - { - char arg[MAX_STRING_LENGTH]; - - argument = one_argument( argument, arg ); - if ( arg[0] == '\0' ) - break; - - if ( is_number( arg ) ) - { - switch ( ++nNumber ) - { - case 1: iLevelLower = atoi( arg ); break; - case 2: iLevelUpper = atoi( arg ); break; - default: - send_to_char( "Only two level numbers allowed.\n\r", ch ); - return; - } - } - else - { - - /* - * Look for classes to turn on. - */ - if (!str_prefix(arg,"immortals")) - { - fImmortalOnly = TRUE; - } - else - { - iClass = class_lookup(arg); - if (iClass == -1) - { - iRace = race_lookup(arg); - - if (iRace == 0 || iRace >= MAX_PC_RACE) - { - if (!str_prefix(arg,"clan")) - fClan = TRUE; - else - { - iClan = clan_lookup(arg); - if (iClan) - { - fClanRestrict = TRUE; - rgfClan[iClan] = TRUE; - } - else - { - send_to_char( - "That's not a valid race, class, or clan.\n\r", - ch); - return; - } - } - } - else - { - fRaceRestrict = TRUE; - rgfRace[iRace] = TRUE; - } - } - else - { - fClassRestrict = TRUE; - rgfClass[iClass] = TRUE; - } - } - } - } - - /* - * Now show matching chars. - */ - nMatch = 0; - buf[0] = '\0'; - output = new_buf(); - for ( d = descriptor_list; d != NULL; d = d->next ) - { - CHAR_DATA *wch; - char const *class; - - /* - * Check for match against restrictions. - * Don't use trust as that exposes trusted mortals. - */ - if ( d->connected != CON_PLAYING || !can_see( ch, d->character ) ) - continue; - - wch = ( d->original != NULL ) ? d->original : d->character; - - if (!can_see(ch,wch)) - continue; - - if ( wch->level < iLevelLower - || wch->level > iLevelUpper - || ( fImmortalOnly && wch->level < LEVEL_IMMORTAL ) - || ( fClassRestrict && !rgfClass[wch->class] ) - || ( fRaceRestrict && !rgfRace[wch->race]) - || ( fClan && !is_clan(wch)) - || ( fClanRestrict && !rgfClan[wch->clan])) - continue; - - nMatch++; - - /* - * Figure out what to print for class. - */ - class = class_table[wch->class].who_name; - switch ( wch->level ) - { - default: break; - { - case MAX_LEVEL - 0 : class = "IMP"; break; - case MAX_LEVEL - 1 : class = "CRE"; break; - case MAX_LEVEL - 2 : class = "SUP"; break; - case MAX_LEVEL - 3 : class = "DEI"; break; - case MAX_LEVEL - 4 : class = "GOD"; break; - case MAX_LEVEL - 5 : class = "IMM"; break; - case MAX_LEVEL - 6 : class = "DEM"; break; - case MAX_LEVEL - 7 : class = "ANG"; break; - case MAX_LEVEL - 8 : class = "AVA"; break; - } - } - - /* - * Format it up. - */ - sprintf( buf, "[%2d %6s %s] %s%s%s%s%s%s%s%s\n\r", - wch->level, - wch->race < MAX_PC_RACE ? pc_race_table[wch->race].who_name - : " ", - class, - wch->incog_level >= LEVEL_HERO ? "(Incog) " : "", - wch->invis_level >= LEVEL_HERO ? "(Wizi) " : "", - clan_table[wch->clan].who_name, - IS_SET(wch->comm, COMM_AFK) ? "[AFK] " : "", - IS_SET(wch->act, PLR_KILLER) ? "(KILLER) " : "", - IS_SET(wch->act, PLR_THIEF) ? "(THIEF) " : "", - wch->name, - IS_NPC(wch) ? "" : wch->pcdata->title ); - add_buf(output,buf); - } - - sprintf( buf2, "\n\rPlayers found: %d\n\r", nMatch ); - add_buf(output,buf2); - page_to_char( buf_string(output), ch ); - free_buf(output); - return; -} - -void do_count ( CHAR_DATA *ch, char *argument ) -{ - int count; - DESCRIPTOR_DATA *d; - char buf[MAX_STRING_LENGTH]; - - count = 0; - - for ( d = descriptor_list; d != NULL; d = d->next ) - if ( d->connected == CON_PLAYING && can_see( ch, d->character ) ) - count++; - - max_on = UMAX(count,max_on); - - if (max_on == count) - sprintf(buf,"There are %d characters on, the most so far today.\n\r", - count); - else - sprintf(buf,"There are %d characters on, the most on today was %d.\n\r", - count,max_on); - - send_to_char(buf,ch); -} - -void do_inventory( CHAR_DATA *ch, char *argument ) -{ - send_to_char( "You are carrying:\n\r", ch ); - show_list_to_char( ch->carrying, ch, TRUE, TRUE ); - return; -} - - - -void do_equipment( CHAR_DATA *ch, char *argument ) -{ - OBJ_DATA *obj; - int iWear; - bool found; - - send_to_char( "You are using:\n\r", ch ); - found = FALSE; - for ( iWear = 0; iWear < MAX_WEAR; iWear++ ) - { - if ( ( obj = get_eq_char( ch, iWear ) ) == NULL ) - continue; - - send_to_char( where_name[iWear], ch ); - if ( can_see_obj( ch, obj ) ) - { - send_to_char( format_obj_to_char( obj, ch, TRUE ), ch ); - send_to_char( "\n\r", ch ); - } - else - { - send_to_char( "something.\n\r", ch ); - } - found = TRUE; - } - - if ( !found ) - send_to_char( "Nothing.\n\r", ch ); - - return; -} - - - -void do_compare( CHAR_DATA *ch, char *argument ) -{ - char arg1[MAX_INPUT_LENGTH]; - char arg2[MAX_INPUT_LENGTH]; - OBJ_DATA *obj1; - OBJ_DATA *obj2; - int value1; - int value2; - char *msg; - - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - if ( arg1[0] == '\0' ) - { - send_to_char( "Compare what to what?\n\r", ch ); - return; - } - - if ( ( obj1 = get_obj_carry( ch, arg1, ch ) ) == NULL ) - { - send_to_char( "You do not have that item.\n\r", ch ); - return; - } - - if (arg2[0] == '\0') - { - for (obj2 = ch->carrying; obj2 != NULL; obj2 = obj2->next_content) - { - if (obj2->wear_loc != WEAR_NONE - && can_see_obj(ch,obj2) - && obj1->item_type == obj2->item_type - && (obj1->wear_flags & obj2->wear_flags & ~ITEM_TAKE) != 0 ) - break; - } - - if (obj2 == NULL) - { - send_to_char("You aren't wearing anything comparable.\n\r",ch); - return; - } - } - - else if ( (obj2 = get_obj_carry(ch,arg2,ch) ) == NULL ) - { - send_to_char("You do not have that item.\n\r",ch); - return; - } - - msg = NULL; - value1 = 0; - value2 = 0; - - if ( obj1 == obj2 ) - { - msg = "You compare $p to itself. It looks about the same."; - } - else if ( obj1->item_type != obj2->item_type ) - { - msg = "You can't compare $p and $P."; - } - else - { - switch ( obj1->item_type ) - { - default: - msg = "You can't compare $p and $P."; - break; - - case ITEM_ARMOR: - value1 = obj1->value[0] + obj1->value[1] + obj1->value[2]; - value2 = obj2->value[0] + obj2->value[1] + obj2->value[2]; - break; - - case ITEM_WEAPON: - if (obj1->pIndexData->new_format) - value1 = (1 + obj1->value[2]) * obj1->value[1]; - else - value1 = obj1->value[1] + obj1->value[2]; - - if (obj2->pIndexData->new_format) - value2 = (1 + obj2->value[2]) * obj2->value[1]; - else - value2 = obj2->value[1] + obj2->value[2]; - break; - } - } - - if ( msg == NULL ) - { - if ( value1 == value2 ) msg = "$p and $P look about the same."; - else if ( value1 > value2 ) msg = "$p looks better than $P."; - else msg = "$p looks worse than $P."; - } - - act( msg, ch, obj1, obj2, TO_CHAR ); - return; -} - - - -void do_credits( CHAR_DATA *ch, char *argument ) -{ - do_function(ch, &do_help, "diku" ); - return; -} - - - -void do_where( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - DESCRIPTOR_DATA *d; - bool found; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Players near you:\n\r", ch ); - found = FALSE; - for ( d = descriptor_list; d; d = d->next ) - { - if ( d->connected == CON_PLAYING - && ( victim = d->character ) != NULL - && !IS_NPC(victim) - && victim->in_room != NULL - && !IS_SET(victim->in_room->room_flags,ROOM_NOWHERE) - && (is_room_owner(ch,victim->in_room) - || !room_is_private(victim->in_room)) - && victim->in_room->area == ch->in_room->area - && can_see( ch, victim ) ) - { - found = TRUE; - sprintf( buf, "%-28s %s\n\r", - victim->name, victim->in_room->name ); - send_to_char( buf, ch ); - } - } - if ( !found ) - send_to_char( "None\n\r", ch ); - } - else - { - found = FALSE; - for ( victim = char_list; victim != NULL; victim = victim->next ) - { - if ( victim->in_room != NULL - && victim->in_room->area == ch->in_room->area - && !IS_AFFECTED(victim, AFF_HIDE) - && !IS_AFFECTED(victim, AFF_SNEAK) - && can_see( ch, victim ) - && is_name( arg, victim->name ) ) - { - found = TRUE; - sprintf( buf, "%-28s %s\n\r", - PERS(victim, ch), victim->in_room->name ); - send_to_char( buf, ch ); - break; - } - } - if ( !found ) - act( "You didn't find any $T.", ch, NULL, arg, TO_CHAR ); - } - - return; -} - - - - -void do_consider( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - char *msg; - int diff; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Consider killing whom?\n\r", ch ); - return; - } - - if ( ( victim = get_char_room( ch, arg ) ) == NULL ) - { - send_to_char( "They're not here.\n\r", ch ); - return; - } - - if (is_safe(ch,victim)) - { - send_to_char("Don't even think about it.\n\r",ch); - return; - } - - diff = victim->level - ch->level; - - if ( diff <= -10 ) msg = "You can kill $N naked and weaponless."; - else if ( diff <= -5 ) msg = "$N is no match for you."; - else if ( diff <= -2 ) msg = "$N looks like an easy kill."; - else if ( diff <= 1 ) msg = "The perfect match!"; - else if ( diff <= 4 ) msg = "$N says 'Do you feel lucky, punk?'."; - else if ( diff <= 9 ) msg = "$N laughs at you mercilessly."; - else msg = "Death will thank you for your gift."; - - act( msg, ch, NULL, victim, TO_CHAR ); - return; -} - - - -void set_title( CHAR_DATA *ch, char *title ) -{ - char buf[MAX_STRING_LENGTH]; - - if ( IS_NPC(ch) ) - { - bug( "Set_title: NPC.", 0 ); - return; - } - - if ( title[0] != '.' && title[0] != ',' && title[0] != '!' && title[0] != '?' ) - { - buf[0] = ' '; - strcpy( buf+1, title ); - } - else - { - strcpy( buf, title ); - } - - free_string( ch->pcdata->title ); - ch->pcdata->title = str_dup( buf ); - return; -} - - - -void do_title( CHAR_DATA *ch, char *argument ) -{ - if ( IS_NPC(ch) ) - return; - - if ( argument[0] == '\0' ) - { - send_to_char( "Change your title to what?\n\r", ch ); - return; - } - - if ( strlen(argument) > 45 ) - argument[45] = '\0'; - - smash_tilde( argument ); - set_title( ch, argument ); - send_to_char( "Ok.\n\r", ch ); -} - - - -void do_description( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - - if ( argument[0] != '\0' ) - { - buf[0] = '\0'; - smash_tilde( argument ); - - if (argument[0] == '-') - { - int len; - bool found = FALSE; - - if (ch->description == NULL || ch->description[0] == '\0') - { - send_to_char("No lines left to remove.\n\r",ch); - return; - } - - strcpy(buf,ch->description); - - for (len = strlen(buf); len > 0; len--) - { - if (buf[len] == '\r') - { - if (!found) /* back it up */ - { - if (len > 0) - len--; - found = TRUE; - } - else /* found the second one */ - { - buf[len + 1] = '\0'; - free_string(ch->description); - ch->description = str_dup(buf); - send_to_char( "Your description is:\n\r", ch ); - send_to_char( ch->description ? ch->description : - "(None).\n\r", ch ); - return; - } - } - } - buf[0] = '\0'; - free_string(ch->description); - ch->description = str_dup(buf); - send_to_char("Description cleared.\n\r",ch); - return; - } - if ( argument[0] == '+' ) - { - if ( ch->description != NULL ) - strcat( buf, ch->description ); - argument++; - while ( isspace(*argument) ) - argument++; - } - - if ( strlen(buf) >= 1024) - { - send_to_char( "Description too long.\n\r", ch ); - return; - } - - strcat( buf, argument ); - strcat( buf, "\n\r" ); - free_string( ch->description ); - ch->description = str_dup( buf ); - } - - send_to_char( "Your description is:\n\r", ch ); - send_to_char( ch->description ? ch->description : "(None).\n\r", ch ); - return; -} - - - -void do_report( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_INPUT_LENGTH]; - - sprintf( buf, - "You say 'I have %d/%d hp %d/%d mana %d/%d mv %d xp.'\n\r", - ch->hit, ch->max_hit, - ch->mana, ch->max_mana, - ch->move, ch->max_move, - ch->exp ); - - send_to_char( buf, ch ); - - sprintf( buf, "$n says 'I have %d/%d hp %d/%d mana %d/%d mv %d xp.'", - ch->hit, ch->max_hit, - ch->mana, ch->max_mana, - ch->move, ch->max_move, - ch->exp ); - - act( buf, ch, NULL, NULL, TO_ROOM ); - - return; -} - - - -void do_practice( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - int sn; - - if ( IS_NPC(ch) ) - return; - - if ( argument[0] == '\0' ) - { - int col; - - col = 0; - for ( sn = 0; sn < MAX_SKILL; sn++ ) - { - if ( skill_table[sn].name == NULL ) - break; - if ( ch->level < skill_table[sn].skill_level[ch->class] - || ch->pcdata->learned[sn] < 1 /* skill is not known */) - continue; - - sprintf( buf, "%-18s %3d%% ", - skill_table[sn].name, ch->pcdata->learned[sn] ); - send_to_char( buf, ch ); - if ( ++col % 3 == 0 ) - send_to_char( "\n\r", ch ); - } - - if ( col % 3 != 0 ) - send_to_char( "\n\r", ch ); - - sprintf( buf, "You have %d practice sessions left.\n\r", - ch->practice ); - send_to_char( buf, ch ); - } - else - { - CHAR_DATA *mob; - int adept; - - if ( !IS_AWAKE(ch) ) - { - send_to_char( "In your dreams, or what?\n\r", ch ); - return; - } - - for ( mob = ch->in_room->people; mob != NULL; mob = mob->next_in_room ) - { - if ( IS_NPC(mob) && IS_SET(mob->act, ACT_PRACTICE) ) - break; - } - - if ( mob == NULL ) - { - send_to_char( "You can't do that here.\n\r", ch ); - return; - } - - if ( ch->practice <= 0 ) - { - send_to_char( "You have no practice sessions left.\n\r", ch ); - return; - } - - if ( ( sn = find_spell( ch,argument ) ) < 0 - || ( !IS_NPC(ch) - && (ch->level < skill_table[sn].skill_level[ch->class] - || ch->pcdata->learned[sn] < 1 /* skill is not known */ - || skill_table[sn].rating[ch->class] == 0))) - { - send_to_char( "You can't practice that.\n\r", ch ); - return; - } - - adept = IS_NPC(ch) ? 100 : class_table[ch->class].skill_adept; - - if ( ch->pcdata->learned[sn] >= adept ) - { - sprintf( buf, "You are already learned at %s.\n\r", - skill_table[sn].name ); - send_to_char( buf, ch ); - } - else - { - ch->practice--; - ch->pcdata->learned[sn] += - int_app[get_curr_stat(ch,STAT_INT)].learn / - skill_table[sn].rating[ch->class]; - if ( ch->pcdata->learned[sn] < adept ) - { - act( "You practice $T.", - ch, NULL, skill_table[sn].name, TO_CHAR ); - act( "$n practices $T.", - ch, NULL, skill_table[sn].name, TO_ROOM ); - } - else - { - ch->pcdata->learned[sn] = adept; - act( "You are now learned at $T.", - ch, NULL, skill_table[sn].name, TO_CHAR ); - act( "$n is now learned at $T.", - ch, NULL, skill_table[sn].name, TO_ROOM ); - } - } - } - return; -} - - - -/* - * 'Wimpy' originally by Dionysos. - */ -void do_wimpy( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - int wimpy; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - wimpy = ch->max_hit / 5; - else - wimpy = atoi( arg ); - - if ( wimpy < 0 ) - { - send_to_char( "Your courage exceeds your wisdom.\n\r", ch ); - return; - } - - if ( wimpy > ch->max_hit/2 ) - { - send_to_char( "Such cowardice ill becomes you.\n\r", ch ); - return; - } - - ch->wimpy = wimpy; - sprintf( buf, "Wimpy set to %d hit points.\n\r", wimpy ); - send_to_char( buf, ch ); - return; -} - - - -void do_password( CHAR_DATA *ch, char *argument ) -{ - char arg1[MAX_INPUT_LENGTH]; - char arg2[MAX_INPUT_LENGTH]; - char *pArg; - char *pwdnew; - char *p; - char cEnd; - - if ( IS_NPC(ch) ) - return; - - /* - * Can't use one_argument here because it smashes case. - * So we just steal all its code. Bleagh. - */ - pArg = arg1; - while ( isspace(*argument) ) - argument++; - - cEnd = ' '; - if ( *argument == '\'' || *argument == '"' ) - cEnd = *argument++; - - while ( *argument != '\0' ) - { - if ( *argument == cEnd ) - { - argument++; - break; - } - *pArg++ = *argument++; - } - *pArg = '\0'; - - pArg = arg2; - while ( isspace(*argument) ) - argument++; - - cEnd = ' '; - if ( *argument == '\'' || *argument == '"' ) - cEnd = *argument++; - - while ( *argument != '\0' ) - { - if ( *argument == cEnd ) - { - argument++; - break; - } - *pArg++ = *argument++; - } - *pArg = '\0'; - - if ( arg1[0] == '\0' || arg2[0] == '\0' ) - { - send_to_char( "Syntax: password .\n\r", ch ); - return; - } - - if ( strcmp( crypt( arg1, ch->pcdata->pwd ), ch->pcdata->pwd ) ) - { - WAIT_STATE( ch, 40 ); - send_to_char( "Wrong password. Wait 10 seconds.\n\r", ch ); - return; - } - - if ( strlen(arg2) < 5 ) - { - send_to_char( - "New password must be at least five characters long.\n\r", ch ); - return; - } - - /* - * No tilde allowed because of player file format. - */ - pwdnew = crypt( arg2, ch->name ); - for ( p = pwdnew; *p != '\0'; p++ ) - { - if ( *p == '~' ) - { - send_to_char( - "New password not acceptable, try again.\n\r", ch ); - return; - } - } - - free_string( ch->pcdata->pwd ); - ch->pcdata->pwd = str_dup( pwdnew ); - save_char_obj( ch ); - send_to_char( "Ok.\n\r", ch ); - return; -} diff --git a/archive/src/act_move.c b/archive/src/act_move.c deleted file mode 100644 index 4fe4289..0000000 --- a/archive/src/act_move.c +++ /dev/null @@ -1,1640 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#include -#else -#include -#include -#endif -#include -#include -#include "merc.h" -#include "interp.h" - -char * const dir_name [] = -{ - "north", "east", "south", "west", "up", "down" -}; - -const sh_int rev_dir [] = -{ - 2, 3, 0, 1, 5, 4 -}; - -const sh_int movement_loss [SECT_MAX] = -{ - 1, 2, 2, 3, 4, 6, 4, 1, 6, 10, 6 -}; - - - -/* - * Local functions. - */ -int find_door args( ( CHAR_DATA *ch, char *arg ) ); -bool has_key args( ( CHAR_DATA *ch, int key ) ); - - - -void move_char( CHAR_DATA *ch, int door, bool follow ) -{ - CHAR_DATA *fch; - CHAR_DATA *fch_next; - ROOM_INDEX_DATA *in_room; - ROOM_INDEX_DATA *to_room; - EXIT_DATA *pexit; - - if ( door < 0 || door > 5 ) - { - bug( "Do_move: bad door %d.", door ); - return; - } - - in_room = ch->in_room; - if ( ( pexit = in_room->exit[door] ) == NULL - || ( to_room = pexit->u1.to_room ) == NULL - || !can_see_room(ch,pexit->u1.to_room)) - { - send_to_char( "Alas, you cannot go that way.\n\r", ch ); - return; - } - - if (IS_SET(pexit->exit_info, EX_CLOSED) - && (!IS_AFFECTED(ch, AFF_PASS_DOOR) || IS_SET(pexit->exit_info,EX_NOPASS)) - && !IS_TRUSTED(ch,ANGEL)) - { - act( "The $d is closed.", ch, NULL, pexit->keyword, TO_CHAR ); - return; - } - - if ( IS_AFFECTED(ch, AFF_CHARM) - && ch->master != NULL - && in_room == ch->master->in_room ) - { - send_to_char( "What? And leave your beloved master?\n\r", ch ); - return; - } - - if ( !is_room_owner(ch,to_room) && room_is_private( to_room ) ) - { - send_to_char( "That room is private right now.\n\r", ch ); - return; - } - - if ( !IS_NPC(ch) ) - { - int iClass, iGuild; - int move; - - for ( iClass = 0; iClass < MAX_CLASS; iClass++ ) - { - for ( iGuild = 0; iGuild < MAX_GUILD; iGuild ++) - { - if ( iClass != ch->class - && to_room->vnum == class_table[iClass].guild[iGuild] ) - { - send_to_char( "You aren't allowed in there.\n\r", ch ); - return; - } - } - } - - if ( in_room->sector_type == SECT_AIR - || to_room->sector_type == SECT_AIR ) - { - if ( !IS_AFFECTED(ch, AFF_FLYING) && !IS_IMMORTAL(ch)) - { - send_to_char( "You can't fly.\n\r", ch ); - return; - } - } - - if (( in_room->sector_type == SECT_WATER_NOSWIM - || to_room->sector_type == SECT_WATER_NOSWIM ) - && !IS_AFFECTED(ch,AFF_FLYING)) - { - OBJ_DATA *obj; - bool found; - - /* - * Look for a boat. - */ - found = FALSE; - - if (IS_IMMORTAL(ch)) - found = TRUE; - - for ( obj = ch->carrying; obj != NULL; obj = obj->next_content ) - { - if ( obj->item_type == ITEM_BOAT ) - { - found = TRUE; - break; - } - } - if ( !found ) - { - send_to_char( "You need a boat to go there.\n\r", ch ); - return; - } - } - - move = movement_loss[UMIN(SECT_MAX-1, in_room->sector_type)] - + movement_loss[UMIN(SECT_MAX-1, to_room->sector_type)] - ; - - move /= 2; /* i.e. the average */ - - - /* conditional effects */ - if (IS_AFFECTED(ch,AFF_FLYING) || IS_AFFECTED(ch,AFF_HASTE)) - move /= 2; - - if (IS_AFFECTED(ch,AFF_SLOW)) - move *= 2; - - if ( ch->move < move ) - { - send_to_char( "You are too exhausted.\n\r", ch ); - return; - } - - WAIT_STATE( ch, 1 ); - ch->move -= move; - } - - if ( !IS_AFFECTED(ch, AFF_SNEAK) - && ch->invis_level < LEVEL_HERO) - act( "$n leaves $T.", ch, NULL, dir_name[door], TO_ROOM ); - - char_from_room( ch ); - char_to_room( ch, to_room ); - if ( !IS_AFFECTED(ch, AFF_SNEAK) - && ch->invis_level < LEVEL_HERO) - act( "$n has arrived.", ch, NULL, NULL, TO_ROOM ); - - do_function(ch, &do_look, "auto" ); - - if (in_room == to_room) /* no circular follows */ - return; - - for ( fch = in_room->people; fch != NULL; fch = fch_next ) - { - fch_next = fch->next_in_room; - - if ( fch->master == ch && IS_AFFECTED(fch,AFF_CHARM) - && fch->position < POS_STANDING) - do_function(fch, &do_stand, ""); - - if ( fch->master == ch && fch->position == POS_STANDING - && can_see_room(fch,to_room)) - { - - if (IS_SET(ch->in_room->room_flags,ROOM_LAW) - && (IS_NPC(fch) && IS_SET(fch->act,ACT_AGGRESSIVE))) - { - act("You can't bring $N into the city.", - ch,NULL,fch,TO_CHAR); - act("You aren't allowed in the city.", - fch,NULL,NULL,TO_CHAR); - continue; - } - - act( "You follow $N.", fch, NULL, ch, TO_CHAR ); - move_char( fch, door, TRUE ); - } - } - - return; -} - - - -void do_north( CHAR_DATA *ch, char *argument ) -{ - move_char( ch, DIR_NORTH, FALSE ); - return; -} - - - -void do_east( CHAR_DATA *ch, char *argument ) -{ - move_char( ch, DIR_EAST, FALSE ); - return; -} - - - -void do_south( CHAR_DATA *ch, char *argument ) -{ - move_char( ch, DIR_SOUTH, FALSE ); - return; -} - - - -void do_west( CHAR_DATA *ch, char *argument ) -{ - move_char( ch, DIR_WEST, FALSE ); - return; -} - - - -void do_up( CHAR_DATA *ch, char *argument ) -{ - move_char( ch, DIR_UP, FALSE ); - return; -} - - - -void do_down( CHAR_DATA *ch, char *argument ) -{ - move_char( ch, DIR_DOWN, FALSE ); - return; -} - - - -int find_door( CHAR_DATA *ch, char *arg ) -{ - EXIT_DATA *pexit; - int door; - - if ( !str_cmp( arg, "n" ) || !str_cmp( arg, "north" ) ) door = 0; - else if ( !str_cmp( arg, "e" ) || !str_cmp( arg, "east" ) ) door = 1; - else if ( !str_cmp( arg, "s" ) || !str_cmp( arg, "south" ) ) door = 2; - else if ( !str_cmp( arg, "w" ) || !str_cmp( arg, "west" ) ) door = 3; - else if ( !str_cmp( arg, "u" ) || !str_cmp( arg, "up" ) ) door = 4; - else if ( !str_cmp( arg, "d" ) || !str_cmp( arg, "down" ) ) door = 5; - else - { - for ( door = 0; door <= 5; door++ ) - { - if ( ( pexit = ch->in_room->exit[door] ) != NULL - && IS_SET(pexit->exit_info, EX_ISDOOR) - && pexit->keyword != NULL - && is_name( arg, pexit->keyword ) ) - return door; - } - act( "I see no $T here.", ch, NULL, arg, TO_CHAR ); - return -1; - } - - if ( ( pexit = ch->in_room->exit[door] ) == NULL ) - { - act( "I see no door $T here.", ch, NULL, arg, TO_CHAR ); - return -1; - } - - if ( !IS_SET(pexit->exit_info, EX_ISDOOR) ) - { - send_to_char( "You can't do that.\n\r", ch ); - return -1; - } - - return door; -} - - - -void do_open( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - int door; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Open what?\n\r", ch ); - return; - } - - if ( ( obj = get_obj_here( ch, arg ) ) != NULL ) - { - /* open portal */ - if (obj->item_type == ITEM_PORTAL) - { - if (!IS_SET(obj->value[1], EX_ISDOOR)) - { - send_to_char("You can't do that.\n\r",ch); - return; - } - - if (!IS_SET(obj->value[1], EX_CLOSED)) - { - send_to_char("It's already open.\n\r",ch); - return; - } - - if (IS_SET(obj->value[1], EX_LOCKED)) - { - send_to_char("It's locked.\n\r",ch); - return; - } - - REMOVE_BIT(obj->value[1], EX_CLOSED); - act("You open $p.",ch,obj,NULL,TO_CHAR); - act("$n opens $p.",ch,obj,NULL,TO_ROOM); - return; - } - - /* 'open object' */ - if ( obj->item_type != ITEM_CONTAINER) - { send_to_char( "That's not a container.\n\r", ch ); return; } - if ( !IS_SET(obj->value[1], CONT_CLOSED) ) - { send_to_char( "It's already open.\n\r", ch ); return; } - if ( !IS_SET(obj->value[1], CONT_CLOSEABLE) ) - { send_to_char( "You can't do that.\n\r", ch ); return; } - if ( IS_SET(obj->value[1], CONT_LOCKED) ) - { send_to_char( "It's locked.\n\r", ch ); return; } - - REMOVE_BIT(obj->value[1], CONT_CLOSED); - act("You open $p.",ch,obj,NULL,TO_CHAR); - act( "$n opens $p.", ch, obj, NULL, TO_ROOM ); - return; - } - - if ( ( door = find_door( ch, arg ) ) >= 0 ) - { - /* 'open door' */ - ROOM_INDEX_DATA *to_room; - EXIT_DATA *pexit; - EXIT_DATA *pexit_rev; - - pexit = ch->in_room->exit[door]; - if ( !IS_SET(pexit->exit_info, EX_CLOSED) ) - { send_to_char( "It's already open.\n\r", ch ); return; } - if ( IS_SET(pexit->exit_info, EX_LOCKED) ) - { send_to_char( "It's locked.\n\r", ch ); return; } - - REMOVE_BIT(pexit->exit_info, EX_CLOSED); - act( "$n opens the $d.", ch, NULL, pexit->keyword, TO_ROOM ); - send_to_char( "Ok.\n\r", ch ); - - /* open the other side */ - if ( ( to_room = pexit->u1.to_room ) != NULL - && ( pexit_rev = to_room->exit[rev_dir[door]] ) != NULL - && pexit_rev->u1.to_room == ch->in_room ) - { - CHAR_DATA *rch; - - REMOVE_BIT( pexit_rev->exit_info, EX_CLOSED ); - for ( rch = to_room->people; rch != NULL; rch = rch->next_in_room ) - act( "The $d opens.", rch, NULL, pexit_rev->keyword, TO_CHAR ); - } - } - - return; -} - - - -void do_close( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - int door; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Close what?\n\r", ch ); - return; - } - - if ( ( obj = get_obj_here( ch, arg ) ) != NULL ) - { - /* portal stuff */ - if (obj->item_type == ITEM_PORTAL) - { - - if (!IS_SET(obj->value[1],EX_ISDOOR) - || IS_SET(obj->value[1],EX_NOCLOSE)) - { - send_to_char("You can't do that.\n\r",ch); - return; - } - - if (IS_SET(obj->value[1],EX_CLOSED)) - { - send_to_char("It's already closed.\n\r",ch); - return; - } - - SET_BIT(obj->value[1],EX_CLOSED); - act("You close $p.",ch,obj,NULL,TO_CHAR); - act("$n closes $p.",ch,obj,NULL,TO_ROOM); - return; - } - - /* 'close object' */ - if ( obj->item_type != ITEM_CONTAINER ) - { send_to_char( "That's not a container.\n\r", ch ); return; } - if ( IS_SET(obj->value[1], CONT_CLOSED) ) - { send_to_char( "It's already closed.\n\r", ch ); return; } - if ( !IS_SET(obj->value[1], CONT_CLOSEABLE) ) - { send_to_char( "You can't do that.\n\r", ch ); return; } - - SET_BIT(obj->value[1], CONT_CLOSED); - act("You close $p.",ch,obj,NULL,TO_CHAR); - act( "$n closes $p.", ch, obj, NULL, TO_ROOM ); - return; - } - - if ( ( door = find_door( ch, arg ) ) >= 0 ) - { - /* 'close door' */ - ROOM_INDEX_DATA *to_room; - EXIT_DATA *pexit; - EXIT_DATA *pexit_rev; - - pexit = ch->in_room->exit[door]; - if ( IS_SET(pexit->exit_info, EX_CLOSED) ) - { send_to_char( "It's already closed.\n\r", ch ); return; } - - SET_BIT(pexit->exit_info, EX_CLOSED); - act( "$n closes the $d.", ch, NULL, pexit->keyword, TO_ROOM ); - send_to_char( "Ok.\n\r", ch ); - - /* close the other side */ - if ( ( to_room = pexit->u1.to_room ) != NULL - && ( pexit_rev = to_room->exit[rev_dir[door]] ) != 0 - && pexit_rev->u1.to_room == ch->in_room ) - { - CHAR_DATA *rch; - - SET_BIT( pexit_rev->exit_info, EX_CLOSED ); - for ( rch = to_room->people; rch != NULL; rch = rch->next_in_room ) - act( "The $d closes.", rch, NULL, pexit_rev->keyword, TO_CHAR ); - } - } - - return; -} - - - -bool has_key( CHAR_DATA *ch, int key ) -{ - OBJ_DATA *obj; - - for ( obj = ch->carrying; obj != NULL; obj = obj->next_content ) - { - if ( obj->pIndexData->vnum == key ) - return TRUE; - } - - return FALSE; -} - - - -void do_lock( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - int door; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Lock what?\n\r", ch ); - return; - } - - if ( ( obj = get_obj_here( ch, arg ) ) != NULL ) - { - /* portal stuff */ - if (obj->item_type == ITEM_PORTAL) - { - if (!IS_SET(obj->value[1],EX_ISDOOR) - || IS_SET(obj->value[1],EX_NOCLOSE)) - { - send_to_char("You can't do that.\n\r",ch); - return; - } - if (!IS_SET(obj->value[1],EX_CLOSED)) - { - send_to_char("It's not closed.\n\r",ch); - return; - } - - if (obj->value[4] < 0 || IS_SET(obj->value[1],EX_NOLOCK)) - { - send_to_char("It can't be locked.\n\r",ch); - return; - } - - if (!has_key(ch,obj->value[4])) - { - send_to_char("You lack the key.\n\r",ch); - return; - } - - if (IS_SET(obj->value[1],EX_LOCKED)) - { - send_to_char("It's already locked.\n\r",ch); - return; - } - - SET_BIT(obj->value[1],EX_LOCKED); - act("You lock $p.",ch,obj,NULL,TO_CHAR); - act("$n locks $p.",ch,obj,NULL,TO_ROOM); - return; - } - - /* 'lock object' */ - if ( obj->item_type != ITEM_CONTAINER ) - { send_to_char( "That's not a container.\n\r", ch ); return; } - if ( !IS_SET(obj->value[1], CONT_CLOSED) ) - { send_to_char( "It's not closed.\n\r", ch ); return; } - if ( obj->value[2] < 0 ) - { send_to_char( "It can't be locked.\n\r", ch ); return; } - if ( !has_key( ch, obj->value[2] ) ) - { send_to_char( "You lack the key.\n\r", ch ); return; } - if ( IS_SET(obj->value[1], CONT_LOCKED) ) - { send_to_char( "It's already locked.\n\r", ch ); return; } - - SET_BIT(obj->value[1], CONT_LOCKED); - act("You lock $p.",ch,obj,NULL,TO_CHAR); - act( "$n locks $p.", ch, obj, NULL, TO_ROOM ); - return; - } - - if ( ( door = find_door( ch, arg ) ) >= 0 ) - { - /* 'lock door' */ - ROOM_INDEX_DATA *to_room; - EXIT_DATA *pexit; - EXIT_DATA *pexit_rev; - - pexit = ch->in_room->exit[door]; - if ( !IS_SET(pexit->exit_info, EX_CLOSED) ) - { send_to_char( "It's not closed.\n\r", ch ); return; } - if ( pexit->key < 0 ) - { send_to_char( "It can't be locked.\n\r", ch ); return; } - if ( !has_key( ch, pexit->key) ) - { send_to_char( "You lack the key.\n\r", ch ); return; } - if ( IS_SET(pexit->exit_info, EX_LOCKED) ) - { send_to_char( "It's already locked.\n\r", ch ); return; } - - SET_BIT(pexit->exit_info, EX_LOCKED); - send_to_char( "*Click*\n\r", ch ); - act( "$n locks the $d.", ch, NULL, pexit->keyword, TO_ROOM ); - - /* lock the other side */ - if ( ( to_room = pexit->u1.to_room ) != NULL - && ( pexit_rev = to_room->exit[rev_dir[door]] ) != 0 - && pexit_rev->u1.to_room == ch->in_room ) - { - SET_BIT( pexit_rev->exit_info, EX_LOCKED ); - } - } - - return; -} - - - -void do_unlock( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - int door; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Unlock what?\n\r", ch ); - return; - } - - if ( ( obj = get_obj_here( ch, arg ) ) != NULL ) - { - /* portal stuff */ - if (obj->item_type == ITEM_PORTAL) - { - if (!IS_SET(obj->value[1],EX_ISDOOR)) - { - send_to_char("You can't do that.\n\r",ch); - return; - } - - if (!IS_SET(obj->value[1],EX_CLOSED)) - { - send_to_char("It's not closed.\n\r",ch); - return; - } - - if (obj->value[4] < 0) - { - send_to_char("It can't be unlocked.\n\r",ch); - return; - } - - if (!has_key(ch,obj->value[4])) - { - send_to_char("You lack the key.\n\r",ch); - return; - } - - if (!IS_SET(obj->value[1],EX_LOCKED)) - { - send_to_char("It's already unlocked.\n\r",ch); - return; - } - - REMOVE_BIT(obj->value[1],EX_LOCKED); - act("You unlock $p.",ch,obj,NULL,TO_CHAR); - act("$n unlocks $p.",ch,obj,NULL,TO_ROOM); - return; - } - - /* 'unlock object' */ - if ( obj->item_type != ITEM_CONTAINER ) - { send_to_char( "That's not a container.\n\r", ch ); return; } - if ( !IS_SET(obj->value[1], CONT_CLOSED) ) - { send_to_char( "It's not closed.\n\r", ch ); return; } - if ( obj->value[2] < 0 ) - { send_to_char( "It can't be unlocked.\n\r", ch ); return; } - if ( !has_key( ch, obj->value[2] ) ) - { send_to_char( "You lack the key.\n\r", ch ); return; } - if ( !IS_SET(obj->value[1], CONT_LOCKED) ) - { send_to_char( "It's already unlocked.\n\r", ch ); return; } - - REMOVE_BIT(obj->value[1], CONT_LOCKED); - act("You unlock $p.",ch,obj,NULL,TO_CHAR); - act( "$n unlocks $p.", ch, obj, NULL, TO_ROOM ); - return; - } - - if ( ( door = find_door( ch, arg ) ) >= 0 ) - { - /* 'unlock door' */ - ROOM_INDEX_DATA *to_room; - EXIT_DATA *pexit; - EXIT_DATA *pexit_rev; - - pexit = ch->in_room->exit[door]; - if ( !IS_SET(pexit->exit_info, EX_CLOSED) ) - { send_to_char( "It's not closed.\n\r", ch ); return; } - if ( pexit->key < 0 ) - { send_to_char( "It can't be unlocked.\n\r", ch ); return; } - if ( !has_key( ch, pexit->key) ) - { send_to_char( "You lack the key.\n\r", ch ); return; } - if ( !IS_SET(pexit->exit_info, EX_LOCKED) ) - { send_to_char( "It's already unlocked.\n\r", ch ); return; } - - REMOVE_BIT(pexit->exit_info, EX_LOCKED); - send_to_char( "*Click*\n\r", ch ); - act( "$n unlocks the $d.", ch, NULL, pexit->keyword, TO_ROOM ); - - /* unlock the other side */ - if ( ( to_room = pexit->u1.to_room ) != NULL - && ( pexit_rev = to_room->exit[rev_dir[door]] ) != NULL - && pexit_rev->u1.to_room == ch->in_room ) - { - REMOVE_BIT( pexit_rev->exit_info, EX_LOCKED ); - } - } - - return; -} - - - -void do_pick( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *gch; - OBJ_DATA *obj; - int door; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Pick what?\n\r", ch ); - return; - } - - WAIT_STATE( ch, skill_table[gsn_pick_lock].beats ); - - /* look for guards */ - for ( gch = ch->in_room->people; gch; gch = gch->next_in_room ) - { - if ( IS_NPC(gch) && IS_AWAKE(gch) && ch->level + 5 < gch->level ) - { - act( "$N is standing too close to the lock.", - ch, NULL, gch, TO_CHAR ); - return; - } - } - - if ( !IS_NPC(ch) && number_percent( ) > get_skill(ch,gsn_pick_lock)) - { - send_to_char( "You failed.\n\r", ch); - check_improve(ch,gsn_pick_lock,FALSE,2); - return; - } - - if ( ( obj = get_obj_here( ch, arg ) ) != NULL ) - { - /* portal stuff */ - if (obj->item_type == ITEM_PORTAL) - { - if (!IS_SET(obj->value[1],EX_ISDOOR)) - { - send_to_char("You can't do that.\n\r",ch); - return; - } - - if (!IS_SET(obj->value[1],EX_CLOSED)) - { - send_to_char("It's not closed.\n\r",ch); - return; - } - - if (obj->value[4] < 0) - { - send_to_char("It can't be unlocked.\n\r",ch); - return; - } - - if (IS_SET(obj->value[1],EX_PICKPROOF)) - { - send_to_char("You failed.\n\r",ch); - return; - } - - REMOVE_BIT(obj->value[1],EX_LOCKED); - act("You pick the lock on $p.",ch,obj,NULL,TO_CHAR); - act("$n picks the lock on $p.",ch,obj,NULL,TO_ROOM); - check_improve(ch,gsn_pick_lock,TRUE,2); - return; - } - - - - - - /* 'pick object' */ - if ( obj->item_type != ITEM_CONTAINER ) - { send_to_char( "That's not a container.\n\r", ch ); return; } - if ( !IS_SET(obj->value[1], CONT_CLOSED) ) - { send_to_char( "It's not closed.\n\r", ch ); return; } - if ( obj->value[2] < 0 ) - { send_to_char( "It can't be unlocked.\n\r", ch ); return; } - if ( !IS_SET(obj->value[1], CONT_LOCKED) ) - { send_to_char( "It's already unlocked.\n\r", ch ); return; } - if ( IS_SET(obj->value[1], CONT_PICKPROOF) ) - { send_to_char( "You failed.\n\r", ch ); return; } - - REMOVE_BIT(obj->value[1], CONT_LOCKED); - act("You pick the lock on $p.",ch,obj,NULL,TO_CHAR); - act("$n picks the lock on $p.",ch,obj,NULL,TO_ROOM); - check_improve(ch,gsn_pick_lock,TRUE,2); - return; - } - - if ( ( door = find_door( ch, arg ) ) >= 0 ) - { - /* 'pick door' */ - ROOM_INDEX_DATA *to_room; - EXIT_DATA *pexit; - EXIT_DATA *pexit_rev; - - pexit = ch->in_room->exit[door]; - if ( !IS_SET(pexit->exit_info, EX_CLOSED) && !IS_IMMORTAL(ch)) - { send_to_char( "It's not closed.\n\r", ch ); return; } - if ( pexit->key < 0 && !IS_IMMORTAL(ch)) - { send_to_char( "It can't be picked.\n\r", ch ); return; } - if ( !IS_SET(pexit->exit_info, EX_LOCKED) ) - { send_to_char( "It's already unlocked.\n\r", ch ); return; } - if ( IS_SET(pexit->exit_info, EX_PICKPROOF) && !IS_IMMORTAL(ch)) - { send_to_char( "You failed.\n\r", ch ); return; } - - REMOVE_BIT(pexit->exit_info, EX_LOCKED); - send_to_char( "*Click*\n\r", ch ); - act( "$n picks the $d.", ch, NULL, pexit->keyword, TO_ROOM ); - check_improve(ch,gsn_pick_lock,TRUE,2); - - /* pick the other side */ - if ( ( to_room = pexit->u1.to_room ) != NULL - && ( pexit_rev = to_room->exit[rev_dir[door]] ) != NULL - && pexit_rev->u1.to_room == ch->in_room ) - { - REMOVE_BIT( pexit_rev->exit_info, EX_LOCKED ); - } - } - - return; -} - - - - -void do_stand( CHAR_DATA *ch, char *argument ) -{ - OBJ_DATA *obj = NULL; - - if (argument[0] != '\0') - { - if (ch->position == POS_FIGHTING) - { - send_to_char("Maybe you should finish fighting first?\n\r",ch); - return; - } - obj = get_obj_list(ch,argument,ch->in_room->contents); - if (obj == NULL) - { - send_to_char("You don't see that here.\n\r",ch); - return; - } - if (obj->item_type != ITEM_FURNITURE - || (!IS_SET(obj->value[2],STAND_AT) - && !IS_SET(obj->value[2],STAND_ON) - && !IS_SET(obj->value[2],STAND_IN))) - { - send_to_char("You can't seem to find a place to stand.\n\r",ch); - return; - } - if (ch->on != obj && count_users(obj) >= obj->value[0]) - { - act_new("There's no room to stand on $p.", - ch,obj,NULL,TO_CHAR,POS_DEAD); - return; - } - ch->on = obj; - } - - switch ( ch->position ) - { - case POS_SLEEPING: - if ( IS_AFFECTED(ch, AFF_SLEEP) ) - { send_to_char( "You can't wake up!\n\r", ch ); return; } - - if (obj == NULL) - { - send_to_char( "You wake and stand up.\n\r", ch ); - act( "$n wakes and stands up.", ch, NULL, NULL, TO_ROOM ); - ch->on = NULL; - } - else if (IS_SET(obj->value[2],STAND_AT)) - { - act_new("You wake and stand at $p.",ch,obj,NULL,TO_CHAR,POS_DEAD); - act("$n wakes and stands at $p.",ch,obj,NULL,TO_ROOM); - } - else if (IS_SET(obj->value[2],STAND_ON)) - { - act_new("You wake and stand on $p.",ch,obj,NULL,TO_CHAR,POS_DEAD); - act("$n wakes and stands on $p.",ch,obj,NULL,TO_ROOM); - } - else - { - act_new("You wake and stand in $p.",ch,obj,NULL,TO_CHAR,POS_DEAD); - act("$n wakes and stands in $p.",ch,obj,NULL,TO_ROOM); - } - ch->position = POS_STANDING; - do_function(ch, &do_look, "auto"); - break; - - case POS_RESTING: case POS_SITTING: - if (obj == NULL) - { - send_to_char( "You stand up.\n\r", ch ); - act( "$n stands up.", ch, NULL, NULL, TO_ROOM ); - ch->on = NULL; - } - else if (IS_SET(obj->value[2],STAND_AT)) - { - act("You stand at $p.",ch,obj,NULL,TO_CHAR); - act("$n stands at $p.",ch,obj,NULL,TO_ROOM); - } - else if (IS_SET(obj->value[2],STAND_ON)) - { - act("You stand on $p.",ch,obj,NULL,TO_CHAR); - act("$n stands on $p.",ch,obj,NULL,TO_ROOM); - } - else - { - act("You stand in $p.",ch,obj,NULL,TO_CHAR); - act("$n stands on $p.",ch,obj,NULL,TO_ROOM); - } - ch->position = POS_STANDING; - break; - - case POS_STANDING: - send_to_char( "You are already standing.\n\r", ch ); - break; - - case POS_FIGHTING: - send_to_char( "You are already fighting!\n\r", ch ); - break; - } - - return; -} - - - -void do_rest( CHAR_DATA *ch, char *argument ) -{ - OBJ_DATA *obj = NULL; - - if (ch->position == POS_FIGHTING) - { - send_to_char("You are already fighting!\n\r",ch); - return; - } - - /* okay, now that we know we can rest, find an object to rest on */ - if (argument[0] != '\0') - { - obj = get_obj_list(ch,argument,ch->in_room->contents); - if (obj == NULL) - { - send_to_char("You don't see that here.\n\r",ch); - return; - } - } - else obj = ch->on; - - if (obj != NULL) - { - if (obj->item_type != ITEM_FURNITURE - || (!IS_SET(obj->value[2],REST_ON) - && !IS_SET(obj->value[2],REST_IN) - && !IS_SET(obj->value[2],REST_AT))) - { - send_to_char("You can't rest on that.\n\r",ch); - return; - } - - if (obj != NULL && ch->on != obj && count_users(obj) >= obj->value[0]) - { - act_new("There's no more room on $p.",ch,obj,NULL,TO_CHAR,POS_DEAD); - return; - } - - ch->on = obj; - } - - switch ( ch->position ) - { - case POS_SLEEPING: - if (IS_AFFECTED(ch,AFF_SLEEP)) - { - send_to_char("You can't wake up!\n\r",ch); - return; - } - - if (obj == NULL) - { - send_to_char( "You wake up and start resting.\n\r", ch ); - act ("$n wakes up and starts resting.",ch,NULL,NULL,TO_ROOM); - } - else if (IS_SET(obj->value[2],REST_AT)) - { - act_new("You wake up and rest at $p.", - ch,obj,NULL,TO_CHAR,POS_SLEEPING); - act("$n wakes up and rests at $p.",ch,obj,NULL,TO_ROOM); - } - else if (IS_SET(obj->value[2],REST_ON)) - { - act_new("You wake up and rest on $p.", - ch,obj,NULL,TO_CHAR,POS_SLEEPING); - act("$n wakes up and rests on $p.",ch,obj,NULL,TO_ROOM); - } - else - { - act_new("You wake up and rest in $p.", - ch,obj,NULL,TO_CHAR,POS_SLEEPING); - act("$n wakes up and rests in $p.",ch,obj,NULL,TO_ROOM); - } - ch->position = POS_RESTING; - break; - - case POS_RESTING: - send_to_char( "You are already resting.\n\r", ch ); - break; - - case POS_STANDING: - if (obj == NULL) - { - send_to_char( "You rest.\n\r", ch ); - act( "$n sits down and rests.", ch, NULL, NULL, TO_ROOM ); - } - else if (IS_SET(obj->value[2],REST_AT)) - { - act("You sit down at $p and rest.",ch,obj,NULL,TO_CHAR); - act("$n sits down at $p and rests.",ch,obj,NULL,TO_ROOM); - } - else if (IS_SET(obj->value[2],REST_ON)) - { - act("You sit on $p and rest.",ch,obj,NULL,TO_CHAR); - act("$n sits on $p and rests.",ch,obj,NULL,TO_ROOM); - } - else - { - act("You rest in $p.",ch,obj,NULL,TO_CHAR); - act("$n rests in $p.",ch,obj,NULL,TO_ROOM); - } - ch->position = POS_RESTING; - break; - - case POS_SITTING: - if (obj == NULL) - { - send_to_char("You rest.\n\r",ch); - act("$n rests.",ch,NULL,NULL,TO_ROOM); - } - else if (IS_SET(obj->value[2],REST_AT)) - { - act("You rest at $p.",ch,obj,NULL,TO_CHAR); - act("$n rests at $p.",ch,obj,NULL,TO_ROOM); - } - else if (IS_SET(obj->value[2],REST_ON)) - { - act("You rest on $p.",ch,obj,NULL,TO_CHAR); - act("$n rests on $p.",ch,obj,NULL,TO_ROOM); - } - else - { - act("You rest in $p.",ch,obj,NULL,TO_CHAR); - act("$n rests in $p.",ch,obj,NULL,TO_ROOM); - } - ch->position = POS_RESTING; - break; - } - - - return; -} - - -void do_sit (CHAR_DATA *ch, char *argument ) -{ - OBJ_DATA *obj = NULL; - - if (ch->position == POS_FIGHTING) - { - send_to_char("Maybe you should finish this fight first?\n\r",ch); - return; - } - - /* okay, now that we know we can sit, find an object to sit on */ - if (argument[0] != '\0') - { - obj = get_obj_list(ch,argument,ch->in_room->contents); - if (obj == NULL) - { - send_to_char("You don't see that here.\n\r",ch); - return; - } - } - else obj = ch->on; - - if (obj != NULL) - { - if (obj->item_type != ITEM_FURNITURE - || (!IS_SET(obj->value[2],SIT_ON) - && !IS_SET(obj->value[2],SIT_IN) - && !IS_SET(obj->value[2],SIT_AT))) - { - send_to_char("You can't sit on that.\n\r",ch); - return; - } - - if (obj != NULL && ch->on != obj && count_users(obj) >= obj->value[0]) - { - act_new("There's no more room on $p.",ch,obj,NULL,TO_CHAR,POS_DEAD); - return; - } - - ch->on = obj; - } - switch (ch->position) - { - case POS_SLEEPING: - if (IS_AFFECTED(ch,AFF_SLEEP)) - { - send_to_char("You can't wake up!\n\r",ch); - return; - } - - if (obj == NULL) - { - send_to_char( "You wake and sit up.\n\r", ch ); - act( "$n wakes and sits up.", ch, NULL, NULL, TO_ROOM ); - } - else if (IS_SET(obj->value[2],SIT_AT)) - { - act_new("You wake and sit at $p.",ch,obj,NULL,TO_CHAR,POS_DEAD); - act("$n wakes and sits at $p.",ch,obj,NULL,TO_ROOM); - } - else if (IS_SET(obj->value[2],SIT_ON)) - { - act_new("You wake and sit on $p.",ch,obj,NULL,TO_CHAR,POS_DEAD); - act("$n wakes and sits at $p.",ch,obj,NULL,TO_ROOM); - } - else - { - act_new("You wake and sit in $p.",ch,obj,NULL,TO_CHAR,POS_DEAD); - act("$n wakes and sits in $p.",ch,obj,NULL,TO_ROOM); - } - - ch->position = POS_SITTING; - break; - case POS_RESTING: - if (obj == NULL) - send_to_char("You stop resting.\n\r",ch); - else if (IS_SET(obj->value[2],SIT_AT)) - { - act("You sit at $p.",ch,obj,NULL,TO_CHAR); - act("$n sits at $p.",ch,obj,NULL,TO_ROOM); - } - - else if (IS_SET(obj->value[2],SIT_ON)) - { - act("You sit on $p.",ch,obj,NULL,TO_CHAR); - act("$n sits on $p.",ch,obj,NULL,TO_ROOM); - } - ch->position = POS_SITTING; - break; - case POS_SITTING: - send_to_char("You are already sitting down.\n\r",ch); - break; - case POS_STANDING: - if (obj == NULL) - { - send_to_char("You sit down.\n\r",ch); - act("$n sits down on the ground.",ch,NULL,NULL,TO_ROOM); - } - else if (IS_SET(obj->value[2],SIT_AT)) - { - act("You sit down at $p.",ch,obj,NULL,TO_CHAR); - act("$n sits down at $p.",ch,obj,NULL,TO_ROOM); - } - else if (IS_SET(obj->value[2],SIT_ON)) - { - act("You sit on $p.",ch,obj,NULL,TO_CHAR); - act("$n sits on $p.",ch,obj,NULL,TO_ROOM); - } - else - { - act("You sit down in $p.",ch,obj,NULL,TO_CHAR); - act("$n sits down in $p.",ch,obj,NULL,TO_ROOM); - } - ch->position = POS_SITTING; - break; - } - return; -} - - -void do_sleep( CHAR_DATA *ch, char *argument ) -{ - OBJ_DATA *obj = NULL; - - switch ( ch->position ) - { - case POS_SLEEPING: - send_to_char( "You are already sleeping.\n\r", ch ); - break; - - case POS_RESTING: - case POS_SITTING: - case POS_STANDING: - if (argument[0] == '\0' && ch->on == NULL) - { - send_to_char( "You go to sleep.\n\r", ch ); - act( "$n goes to sleep.", ch, NULL, NULL, TO_ROOM ); - ch->position = POS_SLEEPING; - } - else /* find an object and sleep on it */ - { - if (argument[0] == '\0') - obj = ch->on; - else - obj = get_obj_list( ch, argument, ch->in_room->contents ); - - if (obj == NULL) - { - send_to_char("You don't see that here.\n\r",ch); - return; - } - if (obj->item_type != ITEM_FURNITURE - || (!IS_SET(obj->value[2],SLEEP_ON) - && !IS_SET(obj->value[2],SLEEP_IN) - && !IS_SET(obj->value[2],SLEEP_AT))) - { - send_to_char("You can't sleep on that!\n\r",ch); - return; - } - - if (ch->on != obj && count_users(obj) >= obj->value[0]) - { - act_new("There is no room on $p for you.", - ch,obj,NULL,TO_CHAR,POS_DEAD); - return; - } - - ch->on = obj; - if (IS_SET(obj->value[2],SLEEP_AT)) - { - act("You go to sleep at $p.",ch,obj,NULL,TO_CHAR); - act("$n goes to sleep at $p.",ch,obj,NULL,TO_ROOM); - } - else if (IS_SET(obj->value[2],SLEEP_ON)) - { - act("You go to sleep on $p.",ch,obj,NULL,TO_CHAR); - act("$n goes to sleep on $p.",ch,obj,NULL,TO_ROOM); - } - else - { - act("You go to sleep in $p.",ch,obj,NULL,TO_CHAR); - act("$n goes to sleep in $p.",ch,obj,NULL,TO_ROOM); - } - ch->position = POS_SLEEPING; - } - break; - - case POS_FIGHTING: - send_to_char( "You are already fighting!\n\r", ch ); - break; - } - - return; -} - - - -void do_wake( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - - one_argument( argument, arg ); - if ( arg[0] == '\0' ) - { do_function(ch, &do_stand, ""); return; } - - if ( !IS_AWAKE(ch) ) - { send_to_char( "You are asleep yourself!\n\r", ch ); return; } - - if ( ( victim = get_char_room( ch, arg ) ) == NULL ) - { send_to_char( "They aren't here.\n\r", ch ); return; } - - if ( IS_AWAKE(victim) ) - { act( "$N is already awake.", ch, NULL, victim, TO_CHAR ); return; } - - if ( IS_AFFECTED(victim, AFF_SLEEP) ) - { act( "You can't wake $M!", ch, NULL, victim, TO_CHAR ); return; } - - act_new( "$n wakes you.", ch, NULL, victim, TO_VICT,POS_SLEEPING ); - do_function(ch, &do_stand, ""); - return; -} - - - -void do_sneak( CHAR_DATA *ch, char *argument ) -{ - AFFECT_DATA af; - - send_to_char( "You attempt to move silently.\n\r", ch ); - affect_strip( ch, gsn_sneak ); - - if (IS_AFFECTED(ch,AFF_SNEAK)) - return; - - if ( number_percent( ) < get_skill(ch,gsn_sneak)) - { - check_improve(ch,gsn_sneak,TRUE,3); - af.where = TO_AFFECTS; - af.type = gsn_sneak; - af.level = ch->level; - af.duration = ch->level; - af.location = APPLY_NONE; - af.modifier = 0; - af.bitvector = AFF_SNEAK; - affect_to_char( ch, &af ); - } - else - check_improve(ch,gsn_sneak,FALSE,3); - - return; -} - - - -void do_hide( CHAR_DATA *ch, char *argument ) -{ - send_to_char( "You attempt to hide.\n\r", ch ); - - if ( IS_AFFECTED(ch, AFF_HIDE) ) - REMOVE_BIT(ch->affected_by, AFF_HIDE); - - if ( number_percent( ) < get_skill(ch,gsn_hide)) - { - SET_BIT(ch->affected_by, AFF_HIDE); - check_improve(ch,gsn_hide,TRUE,3); - } - else - check_improve(ch,gsn_hide,FALSE,3); - - return; -} - - - -/* - * Contributed by Alander. - */ -void do_visible( CHAR_DATA *ch, char *argument ) -{ - affect_strip ( ch, gsn_invis ); - affect_strip ( ch, gsn_mass_invis ); - affect_strip ( ch, gsn_sneak ); - REMOVE_BIT ( ch->affected_by, AFF_HIDE ); - REMOVE_BIT ( ch->affected_by, AFF_INVISIBLE ); - REMOVE_BIT ( ch->affected_by, AFF_SNEAK ); - send_to_char( "Ok.\n\r", ch ); - return; -} - - - -void do_recall( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - CHAR_DATA *victim; - ROOM_INDEX_DATA *location; - - if (IS_NPC(ch) && !IS_SET(ch->act,ACT_PET)) - { - send_to_char("Only players can recall.\n\r",ch); - return; - } - - act( "$n prays for transportation!", ch, 0, 0, TO_ROOM ); - - if ( ( location = get_room_index( ROOM_VNUM_TEMPLE ) ) == NULL ) - { - send_to_char( "You are completely lost.\n\r", ch ); - return; - } - - if ( ch->in_room == location ) - return; - - if ( IS_SET(ch->in_room->room_flags, ROOM_NO_RECALL) - || IS_AFFECTED(ch, AFF_CURSE)) - { - send_to_char( "Mota has forsaken you.\n\r", ch ); - return; - } - - if ( ( victim = ch->fighting ) != NULL ) - { - int lose,skill; - - skill = get_skill(ch,gsn_recall); - - if ( number_percent() < 80 * skill / 100 ) - { - check_improve(ch,gsn_recall,FALSE,6); - WAIT_STATE( ch, 4 ); - sprintf( buf, "You failed!.\n\r"); - send_to_char( buf, ch ); - return; - } - - lose = (ch->desc != NULL) ? 25 : 50; - gain_exp( ch, 0 - lose ); - check_improve(ch,gsn_recall,TRUE,4); - sprintf( buf, "You recall from combat! You lose %d exps.\n\r", lose ); - send_to_char( buf, ch ); - stop_fighting( ch, TRUE ); - - } - - ch->move /= 2; - act( "$n disappears.", ch, NULL, NULL, TO_ROOM ); - char_from_room( ch ); - char_to_room( ch, location ); - act( "$n appears in the room.", ch, NULL, NULL, TO_ROOM ); - do_function(ch, &do_look, "auto" ); - - if (ch->pet != NULL) - do_function(ch->pet, &do_recall, ""); - - return; -} - - - -void do_train( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - CHAR_DATA *mob; - sh_int stat = - 1; - char *pOutput = NULL; - int cost; - - if ( IS_NPC(ch) ) - return; - - /* - * Check for trainer. - */ - for ( mob = ch->in_room->people; mob; mob = mob->next_in_room ) - { - if ( IS_NPC(mob) && IS_SET(mob->act, ACT_TRAIN) ) - break; - } - - if ( mob == NULL ) - { - send_to_char( "You can't do that here.\n\r", ch ); - return; - } - - if ( argument[0] == '\0' ) - { - sprintf( buf, "You have %d training sessions.\n\r", ch->train ); - send_to_char( buf, ch ); - argument = "foo"; - } - - cost = 1; - - if ( !str_cmp( argument, "str" ) ) - { - if ( class_table[ch->class].attr_prime == STAT_STR ) - cost = 1; - stat = STAT_STR; - pOutput = "strength"; - } - - else if ( !str_cmp( argument, "int" ) ) - { - if ( class_table[ch->class].attr_prime == STAT_INT ) - cost = 1; - stat = STAT_INT; - pOutput = "intelligence"; - } - - else if ( !str_cmp( argument, "wis" ) ) - { - if ( class_table[ch->class].attr_prime == STAT_WIS ) - cost = 1; - stat = STAT_WIS; - pOutput = "wisdom"; - } - - else if ( !str_cmp( argument, "dex" ) ) - { - if ( class_table[ch->class].attr_prime == STAT_DEX ) - cost = 1; - stat = STAT_DEX; - pOutput = "dexterity"; - } - - else if ( !str_cmp( argument, "con" ) ) - { - if ( class_table[ch->class].attr_prime == STAT_CON ) - cost = 1; - stat = STAT_CON; - pOutput = "constitution"; - } - - else if ( !str_cmp(argument, "hp" ) ) - cost = 1; - - else if ( !str_cmp(argument, "mana" ) ) - cost = 1; - - else - { - strcpy( buf, "You can train:" ); - if ( ch->perm_stat[STAT_STR] < get_max_train(ch,STAT_STR)) - strcat( buf, " str" ); - if ( ch->perm_stat[STAT_INT] < get_max_train(ch,STAT_INT)) - strcat( buf, " int" ); - if ( ch->perm_stat[STAT_WIS] < get_max_train(ch,STAT_WIS)) - strcat( buf, " wis" ); - if ( ch->perm_stat[STAT_DEX] < get_max_train(ch,STAT_DEX)) - strcat( buf, " dex" ); - if ( ch->perm_stat[STAT_CON] < get_max_train(ch,STAT_CON)) - strcat( buf, " con" ); - strcat( buf, " hp mana"); - - if ( buf[strlen(buf)-1] != ':' ) - { - strcat( buf, ".\n\r" ); - send_to_char( buf, ch ); - } - else - { - /* - * This message dedicated to Jordan ... you big stud! - */ - act( "You have nothing left to train, you $T!", - ch, NULL, - ch->sex == SEX_MALE ? "big stud" : - ch->sex == SEX_FEMALE ? "hot babe" : - "wild thing", - TO_CHAR ); - } - - return; - } - - if (!str_cmp("hp",argument)) - { - if ( cost > ch->train ) - { - send_to_char( "You don't have enough training sessions.\n\r", ch ); - return; - } - - ch->train -= cost; - ch->pcdata->perm_hit += 10; - ch->max_hit += 10; - ch->hit +=10; - act( "Your durability increases!",ch,NULL,NULL,TO_CHAR); - act( "$n's durability increases!",ch,NULL,NULL,TO_ROOM); - return; - } - - if (!str_cmp("mana",argument)) - { - if ( cost > ch->train ) - { - send_to_char( "You don't have enough training sessions.\n\r", ch ); - return; - } - - ch->train -= cost; - ch->pcdata->perm_mana += 10; - ch->max_mana += 10; - ch->mana += 10; - act( "Your power increases!",ch,NULL,NULL,TO_CHAR); - act( "$n's power increases!",ch,NULL,NULL,TO_ROOM); - return; - } - - if ( ch->perm_stat[stat] >= get_max_train(ch,stat) ) - { - act( "Your $T is already at maximum.", ch, NULL, pOutput, TO_CHAR ); - return; - } - - if ( cost > ch->train ) - { - send_to_char( "You don't have enough training sessions.\n\r", ch ); - return; - } - - ch->train -= cost; - - ch->perm_stat[stat] += 1; - act( "Your $T increases!", ch, NULL, pOutput, TO_CHAR ); - act( "$n's $T increases!", ch, NULL, pOutput, TO_ROOM ); - return; -} diff --git a/archive/src/act_obj.c b/archive/src/act_obj.c deleted file mode 100644 index ede4c33..0000000 --- a/archive/src/act_obj.c +++ /dev/null @@ -1,2989 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#include -#else -#include -#include -#endif -#include -#include -#include -#include "merc.h" -#include "interp.h" - -/* - * Local functions. - */ -#define CD CHAR_DATA -#define OD OBJ_DATA -bool remove_obj args( (CHAR_DATA *ch, int iWear, bool fReplace ) ); -void wear_obj args( (CHAR_DATA *ch, OBJ_DATA *obj, bool fReplace ) ); -CD * find_keeper args( (CHAR_DATA *ch ) ); -int get_cost args( (CHAR_DATA *keeper, OBJ_DATA *obj, bool fBuy ) ); -void obj_to_keeper args( (OBJ_DATA *obj, CHAR_DATA *ch ) ); -OD * get_obj_keeper args( (CHAR_DATA *ch,CHAR_DATA *keeper,char *argument)); - -#undef OD -#undef CD - -/* RT part of the corpse looting code */ - -bool can_loot(CHAR_DATA *ch, OBJ_DATA *obj) -{ - CHAR_DATA *owner, *wch; - - if (IS_IMMORTAL(ch)) - return TRUE; - - if (!obj->owner || obj->owner == NULL) - return TRUE; - - owner = NULL; - for ( wch = char_list; wch != NULL ; wch = wch->next ) - if (!str_cmp(wch->name,obj->owner)) - owner = wch; - - if (owner == NULL) - return TRUE; - - if (!str_cmp(ch->name,owner->name)) - return TRUE; - - if (!IS_NPC(owner) && IS_SET(owner->act,PLR_CANLOOT)) - return TRUE; - - if (is_same_group(ch,owner)) - return TRUE; - - return FALSE; -} - - -void get_obj( CHAR_DATA *ch, OBJ_DATA *obj, OBJ_DATA *container ) -{ - /* variables for AUTOSPLIT */ - CHAR_DATA *gch; - int members; - char buffer[100]; - - if ( !CAN_WEAR(obj, ITEM_TAKE) ) - { - send_to_char( "You can't take that.\n\r", ch ); - return; - } - - if ( ch->carry_number + get_obj_number( obj ) > can_carry_n( ch ) ) - { - act( "$d: you can't carry that many items.", - ch, NULL, obj->name, TO_CHAR ); - return; - } - - if ((!obj->in_obj || obj->in_obj->carried_by != ch) - && (get_carry_weight(ch) + get_obj_weight(obj) > can_carry_w(ch))) - { - act( "$d: you can't carry that much weight.", - ch, NULL, obj->name, TO_CHAR ); - return; - } - - if (!can_loot(ch,obj)) - { - act("Corpse looting is not permitted.",ch,NULL,NULL,TO_CHAR ); - return; - } - - if (obj->in_room != NULL) - { - for (gch = obj->in_room->people; gch != NULL; gch = gch->next_in_room) - if (gch->on == obj) - { - act("$N appears to be using $p.", - ch,obj,gch,TO_CHAR); - return; - } - } - - - if ( container != NULL ) - { - if (container->pIndexData->vnum == OBJ_VNUM_PIT - && get_trust(ch) < obj->level) - { - send_to_char("You are not powerful enough to use it.\n\r",ch); - return; - } - - if (container->pIndexData->vnum == OBJ_VNUM_PIT - && !CAN_WEAR(container, ITEM_TAKE) - && !IS_OBJ_STAT(obj,ITEM_HAD_TIMER)) - obj->timer = 0; - act( "You get $p from $P.", ch, obj, container, TO_CHAR ); - act( "$n gets $p from $P.", ch, obj, container, TO_ROOM ); - REMOVE_BIT(obj->extra_flags,ITEM_HAD_TIMER); - obj_from_obj( obj ); - } - else - { - act( "You get $p.", ch, obj, container, TO_CHAR ); - act( "$n gets $p.", ch, obj, container, TO_ROOM ); - obj_from_room( obj ); - } - - if ( obj->item_type == ITEM_MONEY) - { - ch->silver += obj->value[0]; - ch->gold += obj->value[1]; - if (IS_SET(ch->act,PLR_AUTOSPLIT)) - { /* AUTOSPLIT code */ - members = 0; - for (gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room ) - { - if (!IS_AFFECTED(gch,AFF_CHARM) && is_same_group( gch, ch ) ) - members++; - } - - if ( members > 1 && (obj->value[0] > 1 || obj->value[1])) - { - sprintf(buffer,"%d %d",obj->value[0],obj->value[1]); - do_function(ch, &do_split, buffer); - } - } - - extract_obj( obj ); - } - else - { - obj_to_char( obj, ch ); - } - - return; -} - - - -void do_get( CHAR_DATA *ch, char *argument ) -{ - char arg1[MAX_INPUT_LENGTH]; - char arg2[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - OBJ_DATA *obj_next; - OBJ_DATA *container; - bool found; - - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - - if (!str_cmp(arg2,"from")) - argument = one_argument(argument,arg2); - - /* Get type. */ - if ( arg1[0] == '\0' ) - { - send_to_char( "Get what?\n\r", ch ); - return; - } - - if ( arg2[0] == '\0' ) - { - if ( str_cmp( arg1, "all" ) && str_prefix( "all.", arg1 ) ) - { - /* 'get obj' */ - obj = get_obj_list( ch, arg1, ch->in_room->contents ); - if ( obj == NULL ) - { - act( "I see no $T here.", ch, NULL, arg1, TO_CHAR ); - return; - } - - get_obj( ch, obj, NULL ); - } - else - { - /* 'get all' or 'get all.obj' */ - found = FALSE; - for ( obj = ch->in_room->contents; obj != NULL; obj = obj_next ) - { - obj_next = obj->next_content; - if ( ( arg1[3] == '\0' || is_name( &arg1[4], obj->name ) ) - && can_see_obj( ch, obj ) ) - { - found = TRUE; - get_obj( ch, obj, NULL ); - } - } - - if ( !found ) - { - if ( arg1[3] == '\0' ) - send_to_char( "I see nothing here.\n\r", ch ); - else - act( "I see no $T here.", ch, NULL, &arg1[4], TO_CHAR ); - } - } - } - else - { - /* 'get ... container' */ - if ( !str_cmp( arg2, "all" ) || !str_prefix( "all.", arg2 ) ) - { - send_to_char( "You can't do that.\n\r", ch ); - return; - } - - if ( ( container = get_obj_here( ch, arg2 ) ) == NULL ) - { - act( "I see no $T here.", ch, NULL, arg2, TO_CHAR ); - return; - } - - switch ( container->item_type ) - { - default: - send_to_char( "That's not a container.\n\r", ch ); - return; - - case ITEM_CONTAINER: - case ITEM_CORPSE_NPC: - break; - - case ITEM_CORPSE_PC: - { - - if (!can_loot(ch,container)) - { - send_to_char( "You can't do that.\n\r", ch ); - return; - } - } - } - - if ( IS_SET(container->value[1], CONT_CLOSED) ) - { - act( "The $d is closed.", ch, NULL, container->name, TO_CHAR ); - return; - } - - if ( str_cmp( arg1, "all" ) && str_prefix( "all.", arg1 ) ) - { - /* 'get obj container' */ - obj = get_obj_list( ch, arg1, container->contains ); - if ( obj == NULL ) - { - act( "I see nothing like that in the $T.", - ch, NULL, arg2, TO_CHAR ); - return; - } - get_obj( ch, obj, container ); - } - else - { - /* 'get all container' or 'get all.obj container' */ - found = FALSE; - for ( obj = container->contains; obj != NULL; obj = obj_next ) - { - obj_next = obj->next_content; - if ( ( arg1[3] == '\0' || is_name( &arg1[4], obj->name ) ) - && can_see_obj( ch, obj ) ) - { - found = TRUE; - if (container->pIndexData->vnum == OBJ_VNUM_PIT - && !IS_IMMORTAL(ch)) - { - send_to_char("Don't be so greedy!\n\r",ch); - return; - } - get_obj( ch, obj, container ); - } - } - - if ( !found ) - { - if ( arg1[3] == '\0' ) - act( "I see nothing in the $T.", - ch, NULL, arg2, TO_CHAR ); - else - act( "I see nothing like that in the $T.", - ch, NULL, arg2, TO_CHAR ); - } - } - } - - return; -} - - - -void do_put( CHAR_DATA *ch, char *argument ) -{ - char arg1[MAX_INPUT_LENGTH]; - char arg2[MAX_INPUT_LENGTH]; - OBJ_DATA *container; - OBJ_DATA *obj; - OBJ_DATA *obj_next; - - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - - if (!str_cmp(arg2,"in") || !str_cmp(arg2,"on")) - argument = one_argument(argument,arg2); - - if ( arg1[0] == '\0' || arg2[0] == '\0' ) - { - send_to_char( "Put what in what?\n\r", ch ); - return; - } - - if ( !str_cmp( arg2, "all" ) || !str_prefix( "all.", arg2 ) ) - { - send_to_char( "You can't do that.\n\r", ch ); - return; - } - - if ( ( container = get_obj_here( ch, arg2 ) ) == NULL ) - { - act( "I see no $T here.", ch, NULL, arg2, TO_CHAR ); - return; - } - - if ( container->item_type != ITEM_CONTAINER ) - { - send_to_char( "That's not a container.\n\r", ch ); - return; - } - - if ( IS_SET(container->value[1], CONT_CLOSED) ) - { - act( "The $d is closed.", ch, NULL, container->name, TO_CHAR ); - return; - } - - if ( str_cmp( arg1, "all" ) && str_prefix( "all.", arg1 ) ) - { - /* 'put obj container' */ - if ( ( obj = get_obj_carry( ch, arg1, ch ) ) == NULL ) - { - send_to_char( "You do not have that item.\n\r", ch ); - return; - } - - if ( obj == container ) - { - send_to_char( "You can't fold it into itself.\n\r", ch ); - return; - } - - if ( !can_drop_obj( ch, obj ) ) - { - send_to_char( "You can't let go of it.\n\r", ch ); - return; - } - - if (WEIGHT_MULT(obj) != 100) - { - send_to_char("You have a feeling that would be a bad idea.\n\r",ch); - return; - } - - if (get_obj_weight( obj ) + get_true_weight( container ) - > (container->value[0] * 10) - || get_obj_weight(obj) > (container->value[3] * 10)) - { - send_to_char( "It won't fit.\n\r", ch ); - return; - } - - if (container->pIndexData->vnum == OBJ_VNUM_PIT - && !CAN_WEAR(container,ITEM_TAKE)) - { if (obj->timer) - SET_BIT(obj->extra_flags,ITEM_HAD_TIMER); - else - obj->timer = number_range(100,200); - } - obj_from_char( obj ); - obj_to_obj( obj, container ); - - if (IS_SET(container->value[1],CONT_PUT_ON)) - { - act("$n puts $p on $P.",ch,obj,container, TO_ROOM); - act("You put $p on $P.",ch,obj,container, TO_CHAR); - } - else - { - act( "$n puts $p in $P.", ch, obj, container, TO_ROOM ); - act( "You put $p in $P.", ch, obj, container, TO_CHAR ); - } - } - else - { - /* 'put all container' or 'put all.obj container' */ - for ( obj = ch->carrying; obj != NULL; obj = obj_next ) - { - obj_next = obj->next_content; - - if ( ( arg1[3] == '\0' || is_name( &arg1[4], obj->name ) ) - && can_see_obj( ch, obj ) - && WEIGHT_MULT(obj) == 100 - && obj->wear_loc == WEAR_NONE - && obj != container - && can_drop_obj( ch, obj ) - && get_obj_weight( obj ) + get_true_weight( container ) - <= (container->value[0] * 10) - && get_obj_weight(obj) < (container->value[3] * 10)) - { - if (container->pIndexData->vnum == OBJ_VNUM_PIT - && !CAN_WEAR(obj, ITEM_TAKE) ) - { if (obj->timer) - SET_BIT(obj->extra_flags,ITEM_HAD_TIMER); - else - obj->timer = number_range(100,200); - } - obj_from_char( obj ); - obj_to_obj( obj, container ); - - if (IS_SET(container->value[1],CONT_PUT_ON)) - { - act("$n puts $p on $P.",ch,obj,container, TO_ROOM); - act("You put $p on $P.",ch,obj,container, TO_CHAR); - } - else - { - act( "$n puts $p in $P.", ch, obj, container, TO_ROOM ); - act( "You put $p in $P.", ch, obj, container, TO_CHAR ); - } - } - } - } - - return; -} - - - -void do_drop( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - OBJ_DATA *obj_next; - bool found; - - argument = one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Drop what?\n\r", ch ); - return; - } - - if ( is_number( arg ) ) - { - /* 'drop NNNN coins' */ - int amount, gold = 0, silver = 0; - - amount = atoi(arg); - argument = one_argument( argument, arg ); - if ( amount <= 0 - || ( str_cmp( arg, "coins" ) && str_cmp( arg, "coin" ) && - str_cmp( arg, "gold" ) && str_cmp( arg, "silver") ) ) - { - send_to_char( "Sorry, you can't do that.\n\r", ch ); - return; - } - - if ( !str_cmp( arg, "coins") || !str_cmp(arg,"coin") - || !str_cmp( arg, "silver")) - { - if (ch->silver < amount) - { - send_to_char("You don't have that much silver.\n\r",ch); - return; - } - - ch->silver -= amount; - silver = amount; - } - - else - { - if (ch->gold < amount) - { - send_to_char("You don't have that much gold.\n\r",ch); - return; - } - - ch->gold -= amount; - gold = amount; - } - - for ( obj = ch->in_room->contents; obj != NULL; obj = obj_next ) - { - obj_next = obj->next_content; - - switch ( obj->pIndexData->vnum ) - { - case OBJ_VNUM_SILVER_ONE: - silver += 1; - extract_obj(obj); - break; - - case OBJ_VNUM_GOLD_ONE: - gold += 1; - extract_obj( obj ); - break; - - case OBJ_VNUM_SILVER_SOME: - silver += obj->value[0]; - extract_obj(obj); - break; - - case OBJ_VNUM_GOLD_SOME: - gold += obj->value[1]; - extract_obj( obj ); - break; - - case OBJ_VNUM_COINS: - silver += obj->value[0]; - gold += obj->value[1]; - extract_obj(obj); - break; - } - } - - obj_to_room( create_money( gold, silver ), ch->in_room ); - act( "$n drops some coins.", ch, NULL, NULL, TO_ROOM ); - send_to_char( "OK.\n\r", ch ); - return; - } - - if ( str_cmp( arg, "all" ) && str_prefix( "all.", arg ) ) - { - /* 'drop obj' */ - if ( ( obj = get_obj_carry( ch, arg, ch ) ) == NULL ) - { - send_to_char( "You do not have that item.\n\r", ch ); - return; - } - - if ( !can_drop_obj( ch, obj ) ) - { - send_to_char( "You can't let go of it.\n\r", ch ); - return; - } - - obj_from_char( obj ); - obj_to_room( obj, ch->in_room ); - act( "$n drops $p.", ch, obj, NULL, TO_ROOM ); - act( "You drop $p.", ch, obj, NULL, TO_CHAR ); - if (IS_OBJ_STAT(obj,ITEM_MELT_DROP)) - { - act("$p dissolves into smoke.",ch,obj,NULL,TO_ROOM); - act("$p dissolves into smoke.",ch,obj,NULL,TO_CHAR); - extract_obj(obj); - } - } - else - { - /* 'drop all' or 'drop all.obj' */ - found = FALSE; - for ( obj = ch->carrying; obj != NULL; obj = obj_next ) - { - obj_next = obj->next_content; - - if ( ( arg[3] == '\0' || is_name( &arg[4], obj->name ) ) - && can_see_obj( ch, obj ) - && obj->wear_loc == WEAR_NONE - && can_drop_obj( ch, obj ) ) - { - found = TRUE; - obj_from_char( obj ); - obj_to_room( obj, ch->in_room ); - act( "$n drops $p.", ch, obj, NULL, TO_ROOM ); - act( "You drop $p.", ch, obj, NULL, TO_CHAR ); - if (IS_OBJ_STAT(obj,ITEM_MELT_DROP)) - { - act("$p dissolves into smoke.",ch,obj,NULL,TO_ROOM); - act("$p dissolves into smoke.",ch,obj,NULL,TO_CHAR); - extract_obj(obj); - } - } - } - - if ( !found ) - { - if ( arg[3] == '\0' ) - act( "You are not carrying anything.", - ch, NULL, arg, TO_CHAR ); - else - act( "You are not carrying any $T.", - ch, NULL, &arg[4], TO_CHAR ); - } - } - - return; -} - - - -void do_give( CHAR_DATA *ch, char *argument ) -{ - char arg1 [MAX_INPUT_LENGTH]; - char arg2 [MAX_INPUT_LENGTH]; - char buf[MAX_STRING_LENGTH]; - CHAR_DATA *victim; - OBJ_DATA *obj; - - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - - if ( arg1[0] == '\0' || arg2[0] == '\0' ) - { - send_to_char( "Give what to whom?\n\r", ch ); - return; - } - - if ( is_number( arg1 ) ) - { - /* 'give NNNN coins victim' */ - int amount; - bool silver; - - amount = atoi(arg1); - if ( amount <= 0 - || ( str_cmp( arg2, "coins" ) && str_cmp( arg2, "coin" ) && - str_cmp( arg2, "gold" ) && str_cmp( arg2, "silver")) ) - { - send_to_char( "Sorry, you can't do that.\n\r", ch ); - return; - } - - silver = str_cmp(arg2,"gold"); - - argument = one_argument( argument, arg2 ); - if ( arg2[0] == '\0' ) - { - send_to_char( "Give what to whom?\n\r", ch ); - return; - } - - if ( ( victim = get_char_room( ch, arg2 ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - - if ( (!silver && ch->gold < amount) || (silver && ch->silver < amount) ) - { - send_to_char( "You haven't got that much.\n\r", ch ); - return; - } - - if (silver) - { - ch->silver -= amount; - victim->silver += amount; - } - else - { - ch->gold -= amount; - victim->gold += amount; - } - - sprintf(buf,"$n gives you %d %s.",amount, silver ? "silver" : "gold"); - act( buf, ch, NULL, victim, TO_VICT ); - act( "$n gives $N some coins.", ch, NULL, victim, TO_NOTVICT ); - sprintf(buf,"You give $N %d %s.",amount, silver ? "silver" : "gold"); - act( buf, ch, NULL, victim, TO_CHAR ); - - if (IS_NPC(victim) && IS_SET(victim->act,ACT_IS_CHANGER)) - { - int change; - - change = (silver ? 95 * amount / 100 / 100 - : 95 * amount); - - - if (!silver && change > victim->silver) - victim->silver += change; - - if (silver && change > victim->gold) - victim->gold += change; - - if (change < 1 && can_see(victim,ch)) - { - act( - "$n tells you 'I'm sorry, you did not give me enough to change.'" - ,victim,NULL,ch,TO_VICT); - ch->reply = victim; - sprintf(buf,"%d %s %s", - amount, silver ? "silver" : "gold",ch->name); - do_function(victim, &do_give, buf); - } - else if (can_see(victim,ch)) - { - sprintf(buf,"%d %s %s", - change, silver ? "gold" : "silver",ch->name); - do_function(victim, &do_give, buf); - if (silver) - { - sprintf(buf,"%d silver %s", - (95 * amount / 100 - change * 100),ch->name); - do_function(victim, &do_give, buf); - } - act("$n tells you 'Thank you, come again.'", - victim,NULL,ch,TO_VICT); - ch->reply = victim; - } - } - return; - } - - if ( ( obj = get_obj_carry( ch, arg1, ch ) ) == NULL ) - { - send_to_char( "You do not have that item.\n\r", ch ); - return; - } - - if ( obj->wear_loc != WEAR_NONE ) - { - send_to_char( "You must remove it first.\n\r", ch ); - return; - } - - if ( ( victim = get_char_room( ch, arg2 ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - - if (IS_NPC(victim) && victim->pIndexData->pShop != NULL) - { - act("$N tells you 'Sorry, you'll have to sell that.'", - ch,NULL,victim,TO_CHAR); - ch->reply = victim; - return; - } - - if ( !can_drop_obj( ch, obj ) ) - { - send_to_char( "You can't let go of it.\n\r", ch ); - return; - } - - if ( victim->carry_number + get_obj_number( obj ) > can_carry_n( victim ) ) - { - act( "$N has $S hands full.", ch, NULL, victim, TO_CHAR ); - return; - } - - if (get_carry_weight(victim) + get_obj_weight(obj) > can_carry_w( victim ) ) - { - act( "$N can't carry that much weight.", ch, NULL, victim, TO_CHAR ); - return; - } - - if ( !can_see_obj( victim, obj ) ) - { - act( "$N can't see it.", ch, NULL, victim, TO_CHAR ); - return; - } - - obj_from_char( obj ); - obj_to_char( obj, victim ); - act( "$n gives $p to $N.", ch, obj, victim, TO_NOTVICT ); - act( "$n gives you $p.", ch, obj, victim, TO_VICT ); - act( "You give $p to $N.", ch, obj, victim, TO_CHAR ); - return; -} - - -/* for poisoning weapons and food/drink */ -void do_envenom(CHAR_DATA *ch, char *argument) -{ - OBJ_DATA *obj; - AFFECT_DATA af; - int percent,skill; - - /* find out what */ - if (argument[0] == '\0') - { - send_to_char("Envenom what item?\n\r",ch); - return; - } - - obj = get_obj_list(ch,argument,ch->carrying); - - if (obj== NULL) - { - send_to_char("You don't have that item.\n\r",ch); - return; - } - - if ((skill = get_skill(ch,gsn_envenom)) < 1) - { - send_to_char("Are you crazy? You'd poison yourself!\n\r",ch); - return; - } - - if (obj->item_type == ITEM_FOOD || obj->item_type == ITEM_DRINK_CON) - { - if (IS_OBJ_STAT(obj,ITEM_BLESS) || IS_OBJ_STAT(obj,ITEM_BURN_PROOF)) - { - act("You fail to poison $p.",ch,obj,NULL,TO_CHAR); - return; - } - - if (number_percent() < skill) /* success! */ - { - act("$n treats $p with deadly poison.",ch,obj,NULL,TO_ROOM); - act("You treat $p with deadly poison.",ch,obj,NULL,TO_CHAR); - if (!obj->value[3]) - { - obj->value[3] = 1; - check_improve(ch,gsn_envenom,TRUE,4); - } - WAIT_STATE(ch,skill_table[gsn_envenom].beats); - return; - } - - act("You fail to poison $p.",ch,obj,NULL,TO_CHAR); - if (!obj->value[3]) - check_improve(ch,gsn_envenom,FALSE,4); - WAIT_STATE(ch,skill_table[gsn_envenom].beats); - return; - } - - if (obj->item_type == ITEM_WEAPON) - { - if (IS_WEAPON_STAT(obj,WEAPON_FLAMING) - || IS_WEAPON_STAT(obj,WEAPON_FROST) - || IS_WEAPON_STAT(obj,WEAPON_VAMPIRIC) - || IS_WEAPON_STAT(obj,WEAPON_SHARP) - || IS_WEAPON_STAT(obj,WEAPON_VORPAL) - || IS_WEAPON_STAT(obj,WEAPON_SHOCKING) - || IS_OBJ_STAT(obj,ITEM_BLESS) || IS_OBJ_STAT(obj,ITEM_BURN_PROOF)) - { - act("You can't seem to envenom $p.",ch,obj,NULL,TO_CHAR); - return; - } - - if (obj->value[3] < 0 - || attack_table[obj->value[3]].damage == DAM_BASH) - { - send_to_char("You can only envenom edged weapons.\n\r",ch); - return; - } - - if (IS_WEAPON_STAT(obj,WEAPON_POISON)) - { - act("$p is already envenomed.",ch,obj,NULL,TO_CHAR); - return; - } - - percent = number_percent(); - if (percent < skill) - { - - af.where = TO_WEAPON; - af.type = gsn_poison; - af.level = ch->level * percent / 100; - af.duration = ch->level/2 * percent / 100; - af.location = 0; - af.modifier = 0; - af.bitvector = WEAPON_POISON; - affect_to_obj(obj,&af); - - act("$n coats $p with deadly venom.",ch,obj,NULL,TO_ROOM); - act("You coat $p with venom.",ch,obj,NULL,TO_CHAR); - check_improve(ch,gsn_envenom,TRUE,3); - WAIT_STATE(ch,skill_table[gsn_envenom].beats); - return; - } - else - { - act("You fail to envenom $p.",ch,obj,NULL,TO_CHAR); - check_improve(ch,gsn_envenom,FALSE,3); - WAIT_STATE(ch,skill_table[gsn_envenom].beats); - return; - } - } - - act("You can't poison $p.",ch,obj,NULL,TO_CHAR); - return; -} - -void do_fill( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - char buf[MAX_STRING_LENGTH]; - OBJ_DATA *obj; - OBJ_DATA *fountain; - bool found; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Fill what?\n\r", ch ); - return; - } - - if ( ( obj = get_obj_carry( ch, arg, ch ) ) == NULL ) - { - send_to_char( "You do not have that item.\n\r", ch ); - return; - } - - found = FALSE; - for ( fountain = ch->in_room->contents; fountain != NULL; - fountain = fountain->next_content ) - { - if ( fountain->item_type == ITEM_FOUNTAIN ) - { - found = TRUE; - break; - } - } - - if ( !found ) - { - send_to_char( "There is no fountain here!\n\r", ch ); - return; - } - - if ( obj->item_type != ITEM_DRINK_CON ) - { - send_to_char( "You can't fill that.\n\r", ch ); - return; - } - - if ( obj->value[1] != 0 && obj->value[2] != fountain->value[2] ) - { - send_to_char( "There is already another liquid in it.\n\r", ch ); - return; - } - - if ( obj->value[1] >= obj->value[0] ) - { - send_to_char( "Your container is full.\n\r", ch ); - return; - } - - sprintf(buf,"You fill $p with %s from $P.", - liq_table[fountain->value[2]].liq_name); - act( buf, ch, obj,fountain, TO_CHAR ); - sprintf(buf,"$n fills $p with %s from $P.", - liq_table[fountain->value[2]].liq_name); - act(buf,ch,obj,fountain,TO_ROOM); - obj->value[2] = fountain->value[2]; - obj->value[1] = obj->value[0]; - return; -} - -void do_pour (CHAR_DATA *ch, char *argument) -{ - char arg[MAX_STRING_LENGTH],buf[MAX_STRING_LENGTH]; - OBJ_DATA *out, *in; - CHAR_DATA *vch = NULL; - int amount; - - argument = one_argument(argument,arg); - - if (arg[0] == '\0' || argument[0] == '\0') - { - send_to_char("Pour what into what?\n\r",ch); - return; - } - - - if ((out = get_obj_carry(ch,arg, ch)) == NULL) - { - send_to_char("You don't have that item.\n\r",ch); - return; - } - - if (out->item_type != ITEM_DRINK_CON) - { - send_to_char("That's not a drink container.\n\r",ch); - return; - } - - if (!str_cmp(argument,"out")) - { - if (out->value[1] == 0) - { - send_to_char("It's already empty.\n\r",ch); - return; - } - - out->value[1] = 0; - out->value[3] = 0; - sprintf(buf,"You invert $p, spilling %s all over the ground.", - liq_table[out->value[2]].liq_name); - act(buf,ch,out,NULL,TO_CHAR); - - sprintf(buf,"$n inverts $p, spilling %s all over the ground.", - liq_table[out->value[2]].liq_name); - act(buf,ch,out,NULL,TO_ROOM); - return; - } - - if ((in = get_obj_here(ch,argument)) == NULL) - { - vch = get_char_room(ch,argument); - - if (vch == NULL) - { - send_to_char("Pour into what?\n\r",ch); - return; - } - - in = get_eq_char(vch,WEAR_HOLD); - - if (in == NULL) - { - send_to_char("They aren't holding anything.",ch); - return; - } - } - - if (in->item_type != ITEM_DRINK_CON) - { - send_to_char("You can only pour into other drink containers.\n\r",ch); - return; - } - - if (in == out) - { - send_to_char("You cannot change the laws of physics!\n\r",ch); - return; - } - - if (in->value[1] != 0 && in->value[2] != out->value[2]) - { - send_to_char("They don't hold the same liquid.\n\r",ch); - return; - } - - if (out->value[1] == 0) - { - act("There's nothing in $p to pour.",ch,out,NULL,TO_CHAR); - return; - } - - if (in->value[1] >= in->value[0]) - { - act("$p is already filled to the top.",ch,in,NULL,TO_CHAR); - return; - } - - amount = UMIN(out->value[1],in->value[0] - in->value[1]); - - in->value[1] += amount; - out->value[1] -= amount; - in->value[2] = out->value[2]; - - if (vch == NULL) - { - sprintf(buf,"You pour %s from $p into $P.", - liq_table[out->value[2]].liq_name); - act(buf,ch,out,in,TO_CHAR); - sprintf(buf,"$n pours %s from $p into $P.", - liq_table[out->value[2]].liq_name); - act(buf,ch,out,in,TO_ROOM); - } - else - { - sprintf(buf,"You pour some %s for $N.", - liq_table[out->value[2]].liq_name); - act(buf,ch,NULL,vch,TO_CHAR); - sprintf(buf,"$n pours you some %s.", - liq_table[out->value[2]].liq_name); - act(buf,ch,NULL,vch,TO_VICT); - sprintf(buf,"$n pours some %s for $N.", - liq_table[out->value[2]].liq_name); - act(buf,ch,NULL,vch,TO_NOTVICT); - - } -} - -void do_drink( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - int amount; - int liquid; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - for ( obj = ch->in_room->contents; obj; obj = obj->next_content ) - { - if ( obj->item_type == ITEM_FOUNTAIN ) - break; - } - - if ( obj == NULL ) - { - send_to_char( "Drink what?\n\r", ch ); - return; - } - } - else - { - if ( ( obj = get_obj_here( ch, arg ) ) == NULL ) - { - send_to_char( "You can't find it.\n\r", ch ); - return; - } - } - - if ( !IS_NPC(ch) && ch->pcdata->condition[COND_DRUNK] > 10 ) - { - send_to_char( "You fail to reach your mouth. *Hic*\n\r", ch ); - return; - } - - switch ( obj->item_type ) - { - default: - send_to_char( "You can't drink from that.\n\r", ch ); - return; - - case ITEM_FOUNTAIN: - if ( ( liquid = obj->value[2] ) < 0 ) - { - bug( "Do_drink: bad liquid number %d.", liquid ); - liquid = obj->value[2] = 0; - } - amount = liq_table[liquid].liq_affect[4] * 3; - break; - - case ITEM_DRINK_CON: - if ( obj->value[1] <= 0 ) - { - send_to_char( "It is already empty.\n\r", ch ); - return; - } - - if ( ( liquid = obj->value[2] ) < 0 ) - { - bug( "Do_drink: bad liquid number %d.", liquid ); - liquid = obj->value[2] = 0; - } - - amount = liq_table[liquid].liq_affect[4]; - amount = UMIN(amount, obj->value[1]); - break; - } - if (!IS_NPC(ch) && !IS_IMMORTAL(ch) - && ch->pcdata->condition[COND_FULL] > 45) - { - send_to_char("You're too full to drink more.\n\r",ch); - return; - } - - act( "$n drinks $T from $p.", - ch, obj, liq_table[liquid].liq_name, TO_ROOM ); - act( "You drink $T from $p.", - ch, obj, liq_table[liquid].liq_name, TO_CHAR ); - - gain_condition( ch, COND_DRUNK, - amount * liq_table[liquid].liq_affect[COND_DRUNK] / 36 ); - gain_condition( ch, COND_FULL, - amount * liq_table[liquid].liq_affect[COND_FULL] / 4 ); - gain_condition( ch, COND_THIRST, - amount * liq_table[liquid].liq_affect[COND_THIRST] / 10 ); - gain_condition(ch, COND_HUNGER, - amount * liq_table[liquid].liq_affect[COND_HUNGER] / 2 ); - - if ( !IS_NPC(ch) && ch->pcdata->condition[COND_DRUNK] > 10 ) - send_to_char( "You feel drunk.\n\r", ch ); - if ( !IS_NPC(ch) && ch->pcdata->condition[COND_FULL] > 40 ) - send_to_char( "You are full.\n\r", ch ); - if ( !IS_NPC(ch) && ch->pcdata->condition[COND_THIRST] > 40 ) - send_to_char( "Your thirst is quenched.\n\r", ch ); - - if ( obj->value[3] != 0 ) - { - /* The drink was poisoned ! */ - AFFECT_DATA af; - - act( "$n chokes and gags.", ch, NULL, NULL, TO_ROOM ); - send_to_char( "You choke and gag.\n\r", ch ); - af.where = TO_AFFECTS; - af.type = gsn_poison; - af.level = number_fuzzy(amount); - af.duration = 3 * amount; - af.location = APPLY_NONE; - af.modifier = 0; - af.bitvector = AFF_POISON; - affect_join( ch, &af ); - } - - if (obj->value[0] > 0) - obj->value[1] -= amount; - - return; -} - - - -void do_eat( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - - one_argument( argument, arg ); - if ( arg[0] == '\0' ) - { - send_to_char( "Eat what?\n\r", ch ); - return; - } - - if ( ( obj = get_obj_carry( ch, arg, ch ) ) == NULL ) - { - send_to_char( "You do not have that item.\n\r", ch ); - return; - } - - if ( !IS_IMMORTAL(ch) ) - { - if ( obj->item_type != ITEM_FOOD && obj->item_type != ITEM_PILL ) - { - send_to_char( "That's not edible.\n\r", ch ); - return; - } - - if ( !IS_NPC(ch) && ch->pcdata->condition[COND_FULL] > 40 ) - { - send_to_char( "You are too full to eat more.\n\r", ch ); - return; - } - } - - act( "$n eats $p.", ch, obj, NULL, TO_ROOM ); - act( "You eat $p.", ch, obj, NULL, TO_CHAR ); - - switch ( obj->item_type ) - { - - case ITEM_FOOD: - if ( !IS_NPC(ch) ) - { - int condition; - - condition = ch->pcdata->condition[COND_HUNGER]; - gain_condition( ch, COND_FULL, obj->value[0] ); - gain_condition( ch, COND_HUNGER, obj->value[1]); - if ( condition == 0 && ch->pcdata->condition[COND_HUNGER] > 0 ) - send_to_char( "You are no longer hungry.\n\r", ch ); - else if ( ch->pcdata->condition[COND_FULL] > 40 ) - send_to_char( "You are full.\n\r", ch ); - } - - if ( obj->value[3] != 0 ) - { - /* The food was poisoned! */ - AFFECT_DATA af; - - act( "$n chokes and gags.", ch, 0, 0, TO_ROOM ); - send_to_char( "You choke and gag.\n\r", ch ); - - af.where = TO_AFFECTS; - af.type = gsn_poison; - af.level = number_fuzzy(obj->value[0]); - af.duration = 2 * obj->value[0]; - af.location = APPLY_NONE; - af.modifier = 0; - af.bitvector = AFF_POISON; - affect_join( ch, &af ); - } - break; - - case ITEM_PILL: - obj_cast_spell( obj->value[1], obj->value[0], ch, ch, NULL ); - obj_cast_spell( obj->value[2], obj->value[0], ch, ch, NULL ); - obj_cast_spell( obj->value[3], obj->value[0], ch, ch, NULL ); - break; - } - - extract_obj( obj ); - return; -} - - - -/* - * Remove an object. - */ -bool remove_obj( CHAR_DATA *ch, int iWear, bool fReplace ) -{ - OBJ_DATA *obj; - - if ( ( obj = get_eq_char( ch, iWear ) ) == NULL ) - return TRUE; - - if ( !fReplace ) - return FALSE; - - if ( IS_SET(obj->extra_flags, ITEM_NOREMOVE) ) - { - act( "You can't remove $p.", ch, obj, NULL, TO_CHAR ); - return FALSE; - } - - unequip_char( ch, obj ); - act( "$n stops using $p.", ch, obj, NULL, TO_ROOM ); - act( "You stop using $p.", ch, obj, NULL, TO_CHAR ); - return TRUE; -} - - - -/* - * Wear one object. - * Optional replacement of existing objects. - * Big repetitive code, ick. - */ -void wear_obj( CHAR_DATA *ch, OBJ_DATA *obj, bool fReplace ) -{ - char buf[MAX_STRING_LENGTH]; - - if ( ch->level < obj->level ) - { - sprintf( buf, "You must be level %d to use this object.\n\r", - obj->level ); - send_to_char( buf, ch ); - act( "$n tries to use $p, but is too inexperienced.", - ch, obj, NULL, TO_ROOM ); - return; - } - - if ( obj->item_type == ITEM_LIGHT ) - { - if ( !remove_obj( ch, WEAR_LIGHT, fReplace ) ) - return; - act( "$n lights $p and holds it.", ch, obj, NULL, TO_ROOM ); - act( "You light $p and hold it.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_LIGHT ); - return; - } - - if ( CAN_WEAR( obj, ITEM_WEAR_FINGER ) ) - { - if ( get_eq_char( ch, WEAR_FINGER_L ) != NULL - && get_eq_char( ch, WEAR_FINGER_R ) != NULL - && !remove_obj( ch, WEAR_FINGER_L, fReplace ) - && !remove_obj( ch, WEAR_FINGER_R, fReplace ) ) - return; - - if ( get_eq_char( ch, WEAR_FINGER_L ) == NULL ) - { - act( "$n wears $p on $s left finger.", ch, obj, NULL, TO_ROOM ); - act( "You wear $p on your left finger.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_FINGER_L ); - return; - } - - if ( get_eq_char( ch, WEAR_FINGER_R ) == NULL ) - { - act( "$n wears $p on $s right finger.", ch, obj, NULL, TO_ROOM ); - act( "You wear $p on your right finger.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_FINGER_R ); - return; - } - - bug( "Wear_obj: no free finger.", 0 ); - send_to_char( "You already wear two rings.\n\r", ch ); - return; - } - - if ( CAN_WEAR( obj, ITEM_WEAR_NECK ) ) - { - if ( get_eq_char( ch, WEAR_NECK_1 ) != NULL - && get_eq_char( ch, WEAR_NECK_2 ) != NULL - && !remove_obj( ch, WEAR_NECK_1, fReplace ) - && !remove_obj( ch, WEAR_NECK_2, fReplace ) ) - return; - - if ( get_eq_char( ch, WEAR_NECK_1 ) == NULL ) - { - act( "$n wears $p around $s neck.", ch, obj, NULL, TO_ROOM ); - act( "You wear $p around your neck.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_NECK_1 ); - return; - } - - if ( get_eq_char( ch, WEAR_NECK_2 ) == NULL ) - { - act( "$n wears $p around $s neck.", ch, obj, NULL, TO_ROOM ); - act( "You wear $p around your neck.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_NECK_2 ); - return; - } - - bug( "Wear_obj: no free neck.", 0 ); - send_to_char( "You already wear two neck items.\n\r", ch ); - return; - } - - if ( CAN_WEAR( obj, ITEM_WEAR_BODY ) ) - { - if ( !remove_obj( ch, WEAR_BODY, fReplace ) ) - return; - act( "$n wears $p on $s torso.", ch, obj, NULL, TO_ROOM ); - act( "You wear $p on your torso.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_BODY ); - return; - } - - if ( CAN_WEAR( obj, ITEM_WEAR_HEAD ) ) - { - if ( !remove_obj( ch, WEAR_HEAD, fReplace ) ) - return; - act( "$n wears $p on $s head.", ch, obj, NULL, TO_ROOM ); - act( "You wear $p on your head.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_HEAD ); - return; - } - - if ( CAN_WEAR( obj, ITEM_WEAR_LEGS ) ) - { - if ( !remove_obj( ch, WEAR_LEGS, fReplace ) ) - return; - act( "$n wears $p on $s legs.", ch, obj, NULL, TO_ROOM ); - act( "You wear $p on your legs.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_LEGS ); - return; - } - - if ( CAN_WEAR( obj, ITEM_WEAR_FEET ) ) - { - if ( !remove_obj( ch, WEAR_FEET, fReplace ) ) - return; - act( "$n wears $p on $s feet.", ch, obj, NULL, TO_ROOM ); - act( "You wear $p on your feet.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_FEET ); - return; - } - - if ( CAN_WEAR( obj, ITEM_WEAR_HANDS ) ) - { - if ( !remove_obj( ch, WEAR_HANDS, fReplace ) ) - return; - act( "$n wears $p on $s hands.", ch, obj, NULL, TO_ROOM ); - act( "You wear $p on your hands.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_HANDS ); - return; - } - - if ( CAN_WEAR( obj, ITEM_WEAR_ARMS ) ) - { - if ( !remove_obj( ch, WEAR_ARMS, fReplace ) ) - return; - act( "$n wears $p on $s arms.", ch, obj, NULL, TO_ROOM ); - act( "You wear $p on your arms.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_ARMS ); - return; - } - - if ( CAN_WEAR( obj, ITEM_WEAR_ABOUT ) ) - { - if ( !remove_obj( ch, WEAR_ABOUT, fReplace ) ) - return; - act( "$n wears $p about $s torso.", ch, obj, NULL, TO_ROOM ); - act( "You wear $p about your torso.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_ABOUT ); - return; - } - - if ( CAN_WEAR( obj, ITEM_WEAR_WAIST ) ) - { - if ( !remove_obj( ch, WEAR_WAIST, fReplace ) ) - return; - act( "$n wears $p about $s waist.", ch, obj, NULL, TO_ROOM ); - act( "You wear $p about your waist.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_WAIST ); - return; - } - - if ( CAN_WEAR( obj, ITEM_WEAR_WRIST ) ) - { - if ( get_eq_char( ch, WEAR_WRIST_L ) != NULL - && get_eq_char( ch, WEAR_WRIST_R ) != NULL - && !remove_obj( ch, WEAR_WRIST_L, fReplace ) - && !remove_obj( ch, WEAR_WRIST_R, fReplace ) ) - return; - - if ( get_eq_char( ch, WEAR_WRIST_L ) == NULL ) - { - act( "$n wears $p around $s left wrist.", - ch, obj, NULL, TO_ROOM ); - act( "You wear $p around your left wrist.", - ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_WRIST_L ); - return; - } - - if ( get_eq_char( ch, WEAR_WRIST_R ) == NULL ) - { - act( "$n wears $p around $s right wrist.", - ch, obj, NULL, TO_ROOM ); - act( "You wear $p around your right wrist.", - ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_WRIST_R ); - return; - } - - bug( "Wear_obj: no free wrist.", 0 ); - send_to_char( "You already wear two wrist items.\n\r", ch ); - return; - } - - if ( CAN_WEAR( obj, ITEM_WEAR_SHIELD ) ) - { - OBJ_DATA *weapon; - - if ( !remove_obj( ch, WEAR_SHIELD, fReplace ) ) - return; - - weapon = get_eq_char(ch,WEAR_WIELD); - if (weapon != NULL && ch->size < SIZE_LARGE - && IS_WEAPON_STAT(weapon,WEAPON_TWO_HANDS)) - { - send_to_char("Your hands are tied up with your weapon!\n\r",ch); - return; - } - - act( "$n wears $p as a shield.", ch, obj, NULL, TO_ROOM ); - act( "You wear $p as a shield.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_SHIELD ); - return; - } - - if ( CAN_WEAR( obj, ITEM_WIELD ) ) - { - int sn,skill; - - if ( !remove_obj( ch, WEAR_WIELD, fReplace ) ) - return; - - if ( !IS_NPC(ch) - && get_obj_weight(obj) > (str_app[get_curr_stat(ch,STAT_STR)].wield - * 10)) - { - send_to_char( "It is too heavy for you to wield.\n\r", ch ); - return; - } - - if (!IS_NPC(ch) && ch->size < SIZE_LARGE - && IS_WEAPON_STAT(obj,WEAPON_TWO_HANDS) - && get_eq_char(ch,WEAR_SHIELD) != NULL) - { - send_to_char("You need two hands free for that weapon.\n\r",ch); - return; - } - - act( "$n wields $p.", ch, obj, NULL, TO_ROOM ); - act( "You wield $p.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_WIELD ); - - sn = get_weapon_sn(ch); - - if (sn == gsn_hand_to_hand) - return; - - skill = get_weapon_skill(ch,sn); - - if (skill >= 100) - act("$p feels like a part of you!",ch,obj,NULL,TO_CHAR); - else if (skill > 85) - act("You feel quite confident with $p.",ch,obj,NULL,TO_CHAR); - else if (skill > 70) - act("You are skilled with $p.",ch,obj,NULL,TO_CHAR); - else if (skill > 50) - act("Your skill with $p is adequate.",ch,obj,NULL,TO_CHAR); - else if (skill > 25) - act("$p feels a little clumsy in your hands.",ch,obj,NULL,TO_CHAR); - else if (skill > 1) - act("You fumble and almost drop $p.",ch,obj,NULL,TO_CHAR); - else - act("You don't even know which end is up on $p.", - ch,obj,NULL,TO_CHAR); - - return; - } - - if ( CAN_WEAR( obj, ITEM_HOLD ) ) - { - if ( !remove_obj( ch, WEAR_HOLD, fReplace ) ) - return; - act( "$n holds $p in $s hand.", ch, obj, NULL, TO_ROOM ); - act( "You hold $p in your hand.", ch, obj, NULL, TO_CHAR ); - equip_char( ch, obj, WEAR_HOLD ); - return; - } - - if ( CAN_WEAR(obj,ITEM_WEAR_FLOAT) ) - { - if (!remove_obj(ch,WEAR_FLOAT, fReplace) ) - return; - act("$n releases $p to float next to $m.",ch,obj,NULL,TO_ROOM); - act("You release $p and it floats next to you.",ch,obj,NULL,TO_CHAR); - equip_char(ch,obj,WEAR_FLOAT); - return; - } - - if ( fReplace ) - send_to_char( "You can't wear, wield, or hold that.\n\r", ch ); - - return; -} - - - -void do_wear( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Wear, wield, or hold what?\n\r", ch ); - return; - } - - if ( !str_cmp( arg, "all" ) ) - { - OBJ_DATA *obj_next; - - for ( obj = ch->carrying; obj != NULL; obj = obj_next ) - { - obj_next = obj->next_content; - if ( obj->wear_loc == WEAR_NONE && can_see_obj( ch, obj ) ) - wear_obj( ch, obj, FALSE ); - } - return; - } - else - { - if ( ( obj = get_obj_carry( ch, arg, ch ) ) == NULL ) - { - send_to_char( "You do not have that item.\n\r", ch ); - return; - } - - wear_obj( ch, obj, TRUE ); - } - - return; -} - - - -void do_remove( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Remove what?\n\r", ch ); - return; - } - - if ( ( obj = get_obj_wear( ch, arg ) ) == NULL ) - { - send_to_char( "You do not have that item.\n\r", ch ); - return; - } - - remove_obj( ch, obj->wear_loc, TRUE ); - return; -} - - - -void do_sacrifice( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - char buf[MAX_STRING_LENGTH]; - OBJ_DATA *obj; - int silver; - - /* variables for AUTOSPLIT */ - CHAR_DATA *gch; - int members; - char buffer[100]; - - - one_argument( argument, arg ); - - if ( arg[0] == '\0' || !str_cmp( arg, ch->name ) ) - { - act( "$n offers $mself to Mota, who graciously declines.", - ch, NULL, NULL, TO_ROOM ); - send_to_char( - "Mota appreciates your offer and may accept it later.\n\r", ch ); - return; - } - - obj = get_obj_list( ch, arg, ch->in_room->contents ); - if ( obj == NULL ) - { - send_to_char( "You can't find it.\n\r", ch ); - return; - } - - if ( obj->item_type == ITEM_CORPSE_PC ) - { - if (obj->contains) - { - send_to_char( - "Mota wouldn't like that.\n\r",ch); - return; - } - } - - - if ( !CAN_WEAR(obj, ITEM_TAKE) || CAN_WEAR(obj, ITEM_NO_SAC)) - { - act( "$p is not an acceptable sacrifice.", ch, obj, 0, TO_CHAR ); - return; - } - - if (obj->in_room != NULL) - { - for (gch = obj->in_room->people; gch != NULL; gch = gch->next_in_room) - if (gch->on == obj) - { - act("$N appears to be using $p.", - ch,obj,gch,TO_CHAR); - return; - } - } - - silver = UMAX(1,obj->level * 3); - - if (obj->item_type != ITEM_CORPSE_NPC && obj->item_type != ITEM_CORPSE_PC) - silver = UMIN(silver,obj->cost); - - if (silver == 1) - send_to_char( - "Mota gives you one silver coin for your sacrifice.\n\r", ch ); - else - { - sprintf(buf,"Mota gives you %d silver coins for your sacrifice.\n\r", - silver); - send_to_char(buf,ch); - } - - ch->silver += silver; - - if (IS_SET(ch->act,PLR_AUTOSPLIT) ) - { /* AUTOSPLIT code */ - members = 0; - for (gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room ) - { - if ( is_same_group( gch, ch ) ) - members++; - } - - if ( members > 1 && silver > 1) - { - sprintf(buffer,"%d",silver); - do_function(ch, &do_split, buffer); - } - } - - act( "$n sacrifices $p to Mota.", ch, obj, NULL, TO_ROOM ); - wiznet("$N sends up $p as a burnt offering.", - ch,obj,WIZ_SACCING,0,0); - extract_obj( obj ); - return; -} - - - -void do_quaff( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Quaff what?\n\r", ch ); - return; - } - - if ( ( obj = get_obj_carry( ch, arg, ch ) ) == NULL ) - { - send_to_char( "You do not have that potion.\n\r", ch ); - return; - } - - if ( obj->item_type != ITEM_POTION ) - { - send_to_char( "You can quaff only potions.\n\r", ch ); - return; - } - - if (ch->level < obj->level) - { - send_to_char("This liquid is too powerful for you to drink.\n\r",ch); - return; - } - - act( "$n quaffs $p.", ch, obj, NULL, TO_ROOM ); - act( "You quaff $p.", ch, obj, NULL ,TO_CHAR ); - - obj_cast_spell( obj->value[1], obj->value[0], ch, ch, NULL ); - obj_cast_spell( obj->value[2], obj->value[0], ch, ch, NULL ); - obj_cast_spell( obj->value[3], obj->value[0], ch, ch, NULL ); - - extract_obj( obj ); - return; -} - - - -void do_recite( CHAR_DATA *ch, char *argument ) -{ - char arg1[MAX_INPUT_LENGTH]; - char arg2[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - OBJ_DATA *scroll; - OBJ_DATA *obj; - - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - - if ( ( scroll = get_obj_carry( ch, arg1, ch ) ) == NULL ) - { - send_to_char( "You do not have that scroll.\n\r", ch ); - return; - } - - if ( scroll->item_type != ITEM_SCROLL ) - { - send_to_char( "You can recite only scrolls.\n\r", ch ); - return; - } - - if ( ch->level < scroll->level) - { - send_to_char( - "This scroll is too complex for you to comprehend.\n\r",ch); - return; - } - - obj = NULL; - if ( arg2[0] == '\0' ) - { - victim = ch; - } - else - { - if ( ( victim = get_char_room ( ch, arg2 ) ) == NULL - && ( obj = get_obj_here ( ch, arg2 ) ) == NULL ) - { - send_to_char( "You can't find it.\n\r", ch ); - return; - } - } - - act( "$n recites $p.", ch, scroll, NULL, TO_ROOM ); - act( "You recite $p.", ch, scroll, NULL, TO_CHAR ); - - if (number_percent() >= 20 + get_skill(ch,gsn_scrolls) * 4/5) - { - send_to_char("You mispronounce a syllable.\n\r",ch); - check_improve(ch,gsn_scrolls,FALSE,2); - } - - else - { - obj_cast_spell( scroll->value[1], scroll->value[0], ch, victim, obj ); - obj_cast_spell( scroll->value[2], scroll->value[0], ch, victim, obj ); - obj_cast_spell( scroll->value[3], scroll->value[0], ch, victim, obj ); - check_improve(ch,gsn_scrolls,TRUE,2); - } - - extract_obj( scroll ); - return; -} - - - -void do_brandish( CHAR_DATA *ch, char *argument ) -{ - CHAR_DATA *vch; - CHAR_DATA *vch_next; - OBJ_DATA *staff; - int sn; - - if ( ( staff = get_eq_char( ch, WEAR_HOLD ) ) == NULL ) - { - send_to_char( "You hold nothing in your hand.\n\r", ch ); - return; - } - - if ( staff->item_type != ITEM_STAFF ) - { - send_to_char( "You can brandish only with a staff.\n\r", ch ); - return; - } - - if ( ( sn = staff->value[3] ) < 0 - || sn >= MAX_SKILL - || skill_table[sn].spell_fun == 0 ) - { - bug( "Do_brandish: bad sn %d.", sn ); - return; - } - - WAIT_STATE( ch, 2 * PULSE_VIOLENCE ); - - if ( staff->value[2] > 0 ) - { - act( "$n brandishes $p.", ch, staff, NULL, TO_ROOM ); - act( "You brandish $p.", ch, staff, NULL, TO_CHAR ); - if ( ch->level < staff->level - || number_percent() >= 20 + get_skill(ch,gsn_staves) * 4/5) - { - act ("You fail to invoke $p.",ch,staff,NULL,TO_CHAR); - act ("...and nothing happens.",ch,NULL,NULL,TO_ROOM); - check_improve(ch,gsn_staves,FALSE,2); - } - - else for ( vch = ch->in_room->people; vch; vch = vch_next ) - { - vch_next = vch->next_in_room; - - switch ( skill_table[sn].target ) - { - default: - bug( "Do_brandish: bad target for sn %d.", sn ); - return; - - case TAR_IGNORE: - if ( vch != ch ) - continue; - break; - - case TAR_CHAR_OFFENSIVE: - if ( IS_NPC(ch) ? IS_NPC(vch) : !IS_NPC(vch) ) - continue; - break; - - case TAR_CHAR_DEFENSIVE: - if ( IS_NPC(ch) ? !IS_NPC(vch) : IS_NPC(vch) ) - continue; - break; - - case TAR_CHAR_SELF: - if ( vch != ch ) - continue; - break; - } - - obj_cast_spell( staff->value[3], staff->value[0], ch, vch, NULL ); - check_improve(ch,gsn_staves,TRUE,2); - } - } - - if ( --staff->value[2] <= 0 ) - { - act( "$n's $p blazes bright and is gone.", ch, staff, NULL, TO_ROOM ); - act( "Your $p blazes bright and is gone.", ch, staff, NULL, TO_CHAR ); - extract_obj( staff ); - } - - return; -} - - - -void do_zap( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - OBJ_DATA *wand; - OBJ_DATA *obj; - - one_argument( argument, arg ); - if ( arg[0] == '\0' && ch->fighting == NULL ) - { - send_to_char( "Zap whom or what?\n\r", ch ); - return; - } - - if ( ( wand = get_eq_char( ch, WEAR_HOLD ) ) == NULL ) - { - send_to_char( "You hold nothing in your hand.\n\r", ch ); - return; - } - - if ( wand->item_type != ITEM_WAND ) - { - send_to_char( "You can zap only with a wand.\n\r", ch ); - return; - } - - obj = NULL; - if ( arg[0] == '\0' ) - { - if ( ch->fighting != NULL ) - { - victim = ch->fighting; - } - else - { - send_to_char( "Zap whom or what?\n\r", ch ); - return; - } - } - else - { - if ( ( victim = get_char_room ( ch, arg ) ) == NULL - && ( obj = get_obj_here ( ch, arg ) ) == NULL ) - { - send_to_char( "You can't find it.\n\r", ch ); - return; - } - } - - WAIT_STATE( ch, 2 * PULSE_VIOLENCE ); - - if ( wand->value[2] > 0 ) - { - if ( victim != NULL ) - { - act( "$n zaps $N with $p.", ch, wand, victim, TO_NOTVICT ); - act( "You zap $N with $p.", ch, wand, victim, TO_CHAR ); - act( "$n zaps you with $p.",ch, wand, victim, TO_VICT ); - } - else - { - act( "$n zaps $P with $p.", ch, wand, obj, TO_ROOM ); - act( "You zap $P with $p.", ch, wand, obj, TO_CHAR ); - } - - if (ch->level < wand->level - || number_percent() >= 20 + get_skill(ch,gsn_wands) * 4/5) - { - act( "Your efforts with $p produce only smoke and sparks.", - ch,wand,NULL,TO_CHAR); - act( "$n's efforts with $p produce only smoke and sparks.", - ch,wand,NULL,TO_ROOM); - check_improve(ch,gsn_wands,FALSE,2); - } - else - { - obj_cast_spell( wand->value[3], wand->value[0], ch, victim, obj ); - check_improve(ch,gsn_wands,TRUE,2); - } - } - - if ( --wand->value[2] <= 0 ) - { - act( "$n's $p explodes into fragments.", ch, wand, NULL, TO_ROOM ); - act( "Your $p explodes into fragments.", ch, wand, NULL, TO_CHAR ); - extract_obj( wand ); - } - - return; -} - - - -void do_steal( CHAR_DATA *ch, char *argument ) -{ - char buf [MAX_STRING_LENGTH]; - char arg1 [MAX_INPUT_LENGTH]; - char arg2 [MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - OBJ_DATA *obj; - int percent; - - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - - if ( arg1[0] == '\0' || arg2[0] == '\0' ) - { - send_to_char( "Steal what from whom?\n\r", ch ); - return; - } - - if ( ( victim = get_char_room( ch, arg2 ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - - if ( victim == ch ) - { - send_to_char( "That's pointless.\n\r", ch ); - return; - } - - if (is_safe(ch,victim)) - return; - - if ( IS_NPC(victim) - && victim->position == POS_FIGHTING) - { - send_to_char( "Kill stealing is not permitted.\n\r" - "You'd better not -- you might get hit.\n\r",ch); - return; - } - - WAIT_STATE( ch, skill_table[gsn_steal].beats ); - percent = number_percent(); - - if (!IS_AWAKE(victim)) - percent -= 10; - else if (!can_see(victim,ch)) - percent += 25; - else - percent += 50; - - if ( ((ch->level + 7 < victim->level || ch->level -7 > victim->level) - && !IS_NPC(victim) && !IS_NPC(ch) ) - || ( !IS_NPC(ch) && percent > get_skill(ch,gsn_steal)) - || ( !IS_NPC(ch) && !is_clan(ch)) ) - { - /* - * Failure. - */ - send_to_char( "Oops.\n\r", ch ); - affect_strip(ch,gsn_sneak); - REMOVE_BIT(ch->affected_by,AFF_SNEAK); - - act( "$n tried to steal from you.\n\r", ch, NULL, victim, TO_VICT ); - act( "$n tried to steal from $N.\n\r", ch, NULL, victim, TO_NOTVICT ); - switch(number_range(0,3)) - { - case 0 : - sprintf( buf, "%s is a lousy thief!", ch->name ); - break; - case 1 : - sprintf( buf, "%s couldn't rob %s way out of a paper bag!", - ch->name,(ch->sex == 2) ? "her" : "his"); - break; - case 2 : - sprintf( buf,"%s tried to rob me!",ch->name ); - break; - case 3 : - sprintf(buf,"Keep your hands out of there, %s!",ch->name); - break; - } - if (!IS_AWAKE(victim)) - do_function(victim, &do_wake, ""); - if (IS_AWAKE(victim)) - do_function(victim, &do_yell, buf ); - if ( !IS_NPC(ch) ) - { - if ( IS_NPC(victim) ) - { - check_improve(ch,gsn_steal,FALSE,2); - multi_hit( victim, ch, TYPE_UNDEFINED ); - } - else - { - sprintf(buf,"$N tried to steal from %s.",victim->name); - wiznet(buf,ch,NULL,WIZ_FLAGS,0,0); - if ( !IS_SET(ch->act, PLR_THIEF) ) - { - SET_BIT(ch->act, PLR_THIEF); - send_to_char( "*** You are now a THIEF!! ***\n\r", ch ); - save_char_obj( ch ); - } - } - } - - return; - } - - if ( !str_cmp( arg1, "coin" ) - || !str_cmp( arg1, "coins" ) - || !str_cmp( arg1, "gold" ) - || !str_cmp( arg1, "silver")) - { - int gold, silver; - - gold = victim->gold * number_range(1, ch->level) / MAX_LEVEL; - silver = victim->silver * number_range(1,ch->level) / MAX_LEVEL; - if ( gold <= 0 && silver <= 0 ) - { - send_to_char( "You couldn't get any coins.\n\r", ch ); - return; - } - - ch->gold += gold; - ch->silver += silver; - victim->silver -= silver; - victim->gold -= gold; - if (silver <= 0) - sprintf( buf, "Bingo! You got %d gold coins.\n\r", gold ); - else if (gold <= 0) - sprintf( buf, "Bingo! You got %d silver coins.\n\r",silver); - else - sprintf(buf, "Bingo! You got %d silver and %d gold coins.\n\r", - silver,gold); - - send_to_char( buf, ch ); - check_improve(ch,gsn_steal,TRUE,2); - return; - } - - if ( ( obj = get_obj_carry( victim, arg1, ch ) ) == NULL ) - { - send_to_char( "You can't find it.\n\r", ch ); - return; - } - - if ( !can_drop_obj( ch, obj ) - || IS_SET(obj->extra_flags, ITEM_INVENTORY) - || obj->level > ch->level ) - { - send_to_char( "You can't pry it away.\n\r", ch ); - return; - } - - if ( ch->carry_number + get_obj_number( obj ) > can_carry_n( ch ) ) - { - send_to_char( "You have your hands full.\n\r", ch ); - return; - } - - if ( ch->carry_weight + get_obj_weight( obj ) > can_carry_w( ch ) ) - { - send_to_char( "You can't carry that much weight.\n\r", ch ); - return; - } - - obj_from_char( obj ); - obj_to_char( obj, ch ); - act("You pocket $p.",ch,obj,NULL,TO_CHAR); - check_improve(ch,gsn_steal,TRUE,2); - send_to_char( "Got it!\n\r", ch ); - return; -} - - - -/* - * Shopping commands. - */ -CHAR_DATA *find_keeper( CHAR_DATA *ch ) -{ - /*char buf[MAX_STRING_LENGTH];*/ - CHAR_DATA *keeper; - SHOP_DATA *pShop; - - pShop = NULL; - for ( keeper = ch->in_room->people; keeper; keeper = keeper->next_in_room ) - { - if ( IS_NPC(keeper) && (pShop = keeper->pIndexData->pShop) != NULL ) - break; - } - - if ( pShop == NULL ) - { - send_to_char( "You can't do that here.\n\r", ch ); - return NULL; - } - - /* - * Undesirables. - * - if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_KILLER) ) - { - do_function(keeper, &do_say, "Killers are not welcome!"); - sprintf(buf, "%s the KILLER is over here!\n\r", ch->name); - do_function(keeper, &do_yell, buf ); - return NULL; - } - - if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_THIEF) ) - { - do_function(keeper, &do_say, "Thieves are not welcome!"); - sprintf(buf, "%s the THIEF is over here!\n\r", ch->name); - do_function(keeper, &do_yell, buf ); - return NULL; - } - */ - /* - * Shop hours. - */ - if ( time_info.hour < pShop->open_hour ) - { - do_function(keeper, &do_say, "Sorry, I am closed. Come back later."); - return NULL; - } - - if ( time_info.hour > pShop->close_hour ) - { - do_function(keeper, &do_say, "Sorry, I am closed. Come back tomorrow."); - return NULL; - } - - /* - * Invisible or hidden people. - */ - if ( !can_see( keeper, ch ) ) - { - do_function(keeper, &do_say, "I don't trade with folks I can't see."); - return NULL; - } - - return keeper; -} - -/* insert an object at the right spot for the keeper */ -void obj_to_keeper( OBJ_DATA *obj, CHAR_DATA *ch ) -{ - OBJ_DATA *t_obj, *t_obj_next; - - /* see if any duplicates are found */ - for (t_obj = ch->carrying; t_obj != NULL; t_obj = t_obj_next) - { - t_obj_next = t_obj->next_content; - - if (obj->pIndexData == t_obj->pIndexData - && !str_cmp(obj->short_descr,t_obj->short_descr)) - { - /* if this is an unlimited item, destroy the new one */ - if (IS_OBJ_STAT(t_obj,ITEM_INVENTORY)) - { - extract_obj(obj); - return; - } - obj->cost = t_obj->cost; /* keep it standard */ - break; - } - } - - if (t_obj == NULL) - { - obj->next_content = ch->carrying; - ch->carrying = obj; - } - else - { - obj->next_content = t_obj->next_content; - t_obj->next_content = obj; - } - - obj->carried_by = ch; - obj->in_room = NULL; - obj->in_obj = NULL; - ch->carry_number += get_obj_number( obj ); - ch->carry_weight += get_obj_weight( obj ); -} - -/* get an object from a shopkeeper's list */ -OBJ_DATA *get_obj_keeper( CHAR_DATA *ch, CHAR_DATA *keeper, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - int number; - int count; - - number = number_argument( argument, arg ); - count = 0; - for ( obj = keeper->carrying; obj != NULL; obj = obj->next_content ) - { - if (obj->wear_loc == WEAR_NONE - && can_see_obj( keeper, obj ) - && can_see_obj(ch,obj) - && is_name( arg, obj->name ) ) - { - if ( ++count == number ) - return obj; - - /* skip other objects of the same name */ - while (obj->next_content != NULL - && obj->pIndexData == obj->next_content->pIndexData - && !str_cmp(obj->short_descr,obj->next_content->short_descr)) - obj = obj->next_content; - } - } - - return NULL; -} - -int get_cost( CHAR_DATA *keeper, OBJ_DATA *obj, bool fBuy ) -{ - SHOP_DATA *pShop; - int cost; - - if ( obj == NULL || ( pShop = keeper->pIndexData->pShop ) == NULL ) - return 0; - - if ( fBuy ) - { - cost = obj->cost * pShop->profit_buy / 100; - } - else - { - OBJ_DATA *obj2; - int itype; - - cost = 0; - for ( itype = 0; itype < MAX_TRADE; itype++ ) - { - if ( obj->item_type == pShop->buy_type[itype] ) - { - cost = obj->cost * pShop->profit_sell / 100; - break; - } - } - - if (!IS_OBJ_STAT(obj,ITEM_SELL_EXTRACT)) - for ( obj2 = keeper->carrying; obj2; obj2 = obj2->next_content ) - { - if ( obj->pIndexData == obj2->pIndexData - && !str_cmp(obj->short_descr,obj2->short_descr) ) - { if (IS_OBJ_STAT(obj2,ITEM_INVENTORY)) - cost /= 2; - else - cost = cost * 3 / 4; - } - } - } - - if ( obj->item_type == ITEM_STAFF || obj->item_type == ITEM_WAND ) - { - if (obj->value[1] == 0) - cost /= 4; - else - cost = cost * obj->value[2] / obj->value[1]; - } - - return cost; -} - - - -void do_buy( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - int cost,roll; - - if ( argument[0] == '\0' ) - { - send_to_char( "Buy what?\n\r", ch ); - return; - } - - if ( IS_SET(ch->in_room->room_flags, ROOM_PET_SHOP) ) - { - char arg[MAX_INPUT_LENGTH]; - char buf[MAX_STRING_LENGTH]; - CHAR_DATA *pet; - ROOM_INDEX_DATA *pRoomIndexNext; - ROOM_INDEX_DATA *in_room; - - smash_tilde(argument); - - if ( IS_NPC(ch) ) - return; - - argument = one_argument(argument,arg); - - /* hack to make new thalos pets work */ - if (ch->in_room->vnum == 9621) - pRoomIndexNext = get_room_index(9706); - else - pRoomIndexNext = get_room_index( ch->in_room->vnum + 1 ); - if ( pRoomIndexNext == NULL ) - { - bug( "Do_buy: bad pet shop at vnum %d.", ch->in_room->vnum ); - send_to_char( "Sorry, you can't buy that here.\n\r", ch ); - return; - } - - in_room = ch->in_room; - ch->in_room = pRoomIndexNext; - pet = get_char_room( ch, arg ); - ch->in_room = in_room; - - if ( pet == NULL || !IS_SET(pet->act, ACT_PET) ) - { - send_to_char( "Sorry, you can't buy that here.\n\r", ch ); - return; - } - - if ( ch->pet != NULL ) - { - send_to_char("You already own a pet.\n\r",ch); - return; - } - - cost = 10 * pet->level * pet->level; - - if ( (ch->silver + 100 * ch->gold) < cost ) - { - send_to_char( "You can't afford it.\n\r", ch ); - return; - } - - if ( ch->level < pet->level ) - { - send_to_char( - "You're not powerful enough to master this pet.\n\r", ch ); - return; - } - - /* haggle */ - roll = number_percent(); - if (roll < get_skill(ch,gsn_haggle)) - { - cost -= cost / 2 * roll / 100; - sprintf(buf,"You haggle the price down to %d coins.\n\r",cost); - send_to_char(buf,ch); - check_improve(ch,gsn_haggle,TRUE,4); - - } - - deduct_cost(ch,cost); - pet = create_mobile( pet->pIndexData ); - SET_BIT(pet->act, ACT_PET); - SET_BIT(pet->affected_by, AFF_CHARM); - pet->comm = COMM_NOTELL|COMM_NOSHOUT|COMM_NOCHANNELS; - - argument = one_argument( argument, arg ); - if ( arg[0] != '\0' ) - { - sprintf( buf, "%s %s", pet->name, arg ); - free_string( pet->name ); - pet->name = str_dup( buf ); - } - - sprintf( buf, "%sA neck tag says 'I belong to %s'.\n\r", - pet->description, ch->name ); - free_string( pet->description ); - pet->description = str_dup( buf ); - - char_to_room( pet, ch->in_room ); - add_follower( pet, ch ); - pet->leader = ch; - ch->pet = pet; - send_to_char( "Enjoy your pet.\n\r", ch ); - act( "$n bought $N as a pet.", ch, NULL, pet, TO_ROOM ); - return; - } - else - { - CHAR_DATA *keeper; - OBJ_DATA *obj,*t_obj; - char arg[MAX_INPUT_LENGTH]; - int number, count = 1; - - if ( ( keeper = find_keeper( ch ) ) == NULL ) - return; - - number = mult_argument(argument,arg); - obj = get_obj_keeper( ch,keeper, arg ); - cost = get_cost( keeper, obj, TRUE ); - - if (number < 1 || number > 99) - { - act("$n tells you 'Get real!",keeper,NULL,ch,TO_VICT); - return; - } - - if ( cost <= 0 || !can_see_obj( ch, obj ) ) - { - act( "$n tells you 'I don't sell that -- try 'list''.", - keeper, NULL, ch, TO_VICT ); - ch->reply = keeper; - return; - } - - if (!IS_OBJ_STAT(obj,ITEM_INVENTORY)) - { - for (t_obj = obj->next_content; - count < number && t_obj != NULL; - t_obj = t_obj->next_content) - { - if (t_obj->pIndexData == obj->pIndexData - && !str_cmp(t_obj->short_descr,obj->short_descr)) - count++; - else - break; - } - - if (count < number) - { - act("$n tells you 'I don't have that many in stock.", - keeper,NULL,ch,TO_VICT); - ch->reply = keeper; - return; - } - } - - if ( (ch->silver + ch->gold * 100) < cost * number ) - { - if (number > 1) - act("$n tells you 'You can't afford to buy that many.", - keeper,obj,ch,TO_VICT); - else - act( "$n tells you 'You can't afford to buy $p'.", - keeper, obj, ch, TO_VICT ); - ch->reply = keeper; - return; - } - - if ( obj->level > ch->level ) - { - act( "$n tells you 'You can't use $p yet'.", - keeper, obj, ch, TO_VICT ); - ch->reply = keeper; - return; - } - - if (ch->carry_number + number * get_obj_number(obj) > can_carry_n(ch)) - { - send_to_char( "You can't carry that many items.\n\r", ch ); - return; - } - - if ( ch->carry_weight + number * get_obj_weight(obj) > can_carry_w(ch)) - { - send_to_char( "You can't carry that much weight.\n\r", ch ); - return; - } - - /* haggle */ - roll = number_percent(); - if (!IS_OBJ_STAT(obj,ITEM_SELL_EXTRACT) - && roll < get_skill(ch,gsn_haggle)) - { - cost -= obj->cost / 2 * roll / 100; - act("You haggle with $N.",ch,NULL,keeper,TO_CHAR); - check_improve(ch,gsn_haggle,TRUE,4); - } - - if (number > 1) - { - sprintf(buf,"$n buys $p[%d].",number); - act(buf,ch,obj,NULL,TO_ROOM); - sprintf(buf,"You buy $p[%d] for %d silver.",number,cost * number); - act(buf,ch,obj,NULL,TO_CHAR); - } - else - { - act( "$n buys $p.", ch, obj, NULL, TO_ROOM ); - sprintf(buf,"You buy $p for %d silver.",cost); - act( buf, ch, obj, NULL, TO_CHAR ); - } - deduct_cost(ch,cost * number); - keeper->gold += cost * number/100; - keeper->silver += cost * number - (cost * number/100) * 100; - - for (count = 0; count < number; count++) - { - if ( IS_SET( obj->extra_flags, ITEM_INVENTORY ) ) - t_obj = create_object( obj->pIndexData, obj->level ); - else - { - t_obj = obj; - obj = obj->next_content; - obj_from_char( t_obj ); - } - - if (t_obj->timer > 0 && !IS_OBJ_STAT(t_obj,ITEM_HAD_TIMER)) - t_obj->timer = 0; - REMOVE_BIT(t_obj->extra_flags,ITEM_HAD_TIMER); - obj_to_char( t_obj, ch ); - if (cost < t_obj->cost) - t_obj->cost = cost; - } - } -} - - - -void do_list( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - - if ( IS_SET(ch->in_room->room_flags, ROOM_PET_SHOP) ) - { - ROOM_INDEX_DATA *pRoomIndexNext; - CHAR_DATA *pet; - bool found; - - /* hack to make new thalos pets work */ - if (ch->in_room->vnum == 9621) - pRoomIndexNext = get_room_index(9706); - else - pRoomIndexNext = get_room_index( ch->in_room->vnum + 1 ); - - if ( pRoomIndexNext == NULL ) - { - bug( "Do_list: bad pet shop at vnum %d.", ch->in_room->vnum ); - send_to_char( "You can't do that here.\n\r", ch ); - return; - } - - found = FALSE; - for ( pet = pRoomIndexNext->people; pet; pet = pet->next_in_room ) - { - if ( IS_SET(pet->act, ACT_PET) ) - { - if ( !found ) - { - found = TRUE; - send_to_char( "Pets for sale:\n\r", ch ); - } - sprintf( buf, "[%2d] %8d - %s\n\r", - pet->level, - 10 * pet->level * pet->level, - pet->short_descr ); - send_to_char( buf, ch ); - } - } - if ( !found ) - send_to_char( "Sorry, we're out of pets right now.\n\r", ch ); - return; - } - else - { - CHAR_DATA *keeper; - OBJ_DATA *obj; - int cost,count; - bool found; - char arg[MAX_INPUT_LENGTH]; - - if ( ( keeper = find_keeper( ch ) ) == NULL ) - return; - one_argument(argument,arg); - - found = FALSE; - for ( obj = keeper->carrying; obj; obj = obj->next_content ) - { - if ( obj->wear_loc == WEAR_NONE - && can_see_obj( ch, obj ) - && ( cost = get_cost( keeper, obj, TRUE ) ) > 0 - && ( arg[0] == '\0' - || is_name(arg,obj->name) )) - { - if ( !found ) - { - found = TRUE; - send_to_char( "[Lv Price Qty] Item\n\r", ch ); - } - - if (IS_OBJ_STAT(obj,ITEM_INVENTORY)) - sprintf(buf,"[%2d %5d -- ] %s\n\r", - obj->level,cost,obj->short_descr); - else - { - count = 1; - - while (obj->next_content != NULL - && obj->pIndexData == obj->next_content->pIndexData - && !str_cmp(obj->short_descr, - obj->next_content->short_descr)) - { - obj = obj->next_content; - count++; - } - sprintf(buf,"[%2d %5d %2d ] %s\n\r", - obj->level,cost,count,obj->short_descr); - } - send_to_char( buf, ch ); - } - } - - if ( !found ) - send_to_char( "You can't buy anything here.\n\r", ch ); - return; - } -} - - - -void do_sell( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *keeper; - OBJ_DATA *obj; - int cost,roll; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Sell what?\n\r", ch ); - return; - } - - if ( ( keeper = find_keeper( ch ) ) == NULL ) - return; - - if ( ( obj = get_obj_carry( ch, arg, ch ) ) == NULL ) - { - act( "$n tells you 'You don't have that item'.", - keeper, NULL, ch, TO_VICT ); - ch->reply = keeper; - return; - } - - if ( !can_drop_obj( ch, obj ) ) - { - send_to_char( "You can't let go of it.\n\r", ch ); - return; - } - - if (!can_see_obj(keeper,obj)) - { - act("$n doesn't see what you are offering.",keeper,NULL,ch,TO_VICT); - return; - } - - if ( ( cost = get_cost( keeper, obj, FALSE ) ) <= 0 ) - { - act( "$n looks uninterested in $p.", keeper, obj, ch, TO_VICT ); - return; - } - if ( cost > (keeper-> silver + 100 * keeper->gold) ) - { - act("$n tells you 'I'm afraid I don't have enough wealth to buy $p.", - keeper,obj,ch,TO_VICT); - return; - } - - act( "$n sells $p.", ch, obj, NULL, TO_ROOM ); - /* haggle */ - roll = number_percent(); - if (!IS_OBJ_STAT(obj,ITEM_SELL_EXTRACT) && roll < get_skill(ch,gsn_haggle)) - { - send_to_char("You haggle with the shopkeeper.\n\r",ch); - cost += obj->cost / 2 * roll / 100; - cost = UMIN(cost,95 * get_cost(keeper,obj,TRUE) / 100); - cost = UMIN(cost,(keeper->silver + 100 * keeper->gold)); - check_improve(ch,gsn_haggle,TRUE,4); - } - sprintf( buf, "You sell $p for %d silver and %d gold piece%s.", - cost - (cost/100) * 100, cost/100, cost == 1 ? "" : "s" ); - act( buf, ch, obj, NULL, TO_CHAR ); - ch->gold += cost/100; - ch->silver += cost - (cost/100) * 100; - deduct_cost(keeper,cost); - if ( keeper->gold < 0 ) - keeper->gold = 0; - if ( keeper->silver< 0) - keeper->silver = 0; - - if ( obj->item_type == ITEM_TRASH || IS_OBJ_STAT(obj,ITEM_SELL_EXTRACT)) - { - extract_obj( obj ); - } - else - { - obj_from_char( obj ); - if (obj->timer) - SET_BIT(obj->extra_flags,ITEM_HAD_TIMER); - else - obj->timer = number_range(50,100); - obj_to_keeper( obj, keeper ); - } - - return; -} - - - -void do_value( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *keeper; - OBJ_DATA *obj; - int cost; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Value what?\n\r", ch ); - return; - } - - if ( ( keeper = find_keeper( ch ) ) == NULL ) - return; - - if ( ( obj = get_obj_carry( ch, arg, ch ) ) == NULL ) - { - act( "$n tells you 'You don't have that item'.", - keeper, NULL, ch, TO_VICT ); - ch->reply = keeper; - return; - } - - if (!can_see_obj(keeper,obj)) - { - act("$n doesn't see what you are offering.",keeper,NULL,ch,TO_VICT); - return; - } - - if ( !can_drop_obj( ch, obj ) ) - { - send_to_char( "You can't let go of it.\n\r", ch ); - return; - } - - if ( ( cost = get_cost( keeper, obj, FALSE ) ) <= 0 ) - { - act( "$n looks uninterested in $p.", keeper, obj, ch, TO_VICT ); - return; - } - - sprintf( buf, - "$n tells you 'I'll give you %d silver and %d gold coins for $p'.", - cost - (cost/100) * 100, cost/100 ); - act( buf, keeper, obj, ch, TO_VICT ); - ch->reply = keeper; - - return; -} diff --git a/archive/src/act_wiz.c b/archive/src/act_wiz.c deleted file mode 100644 index de7617f..0000000 --- a/archive/src/act_wiz.c +++ /dev/null @@ -1,4378 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#include -#else -#include -#include -#endif -#include -#include -#include -#include "merc.h" -#include "interp.h" -#include "recycle.h" -#include "tables.h" -#include "lookup.h" - -/* - * Local functions. - */ -ROOM_INDEX_DATA * find_location args( ( CHAR_DATA *ch, char *arg ) ); - -void do_wiznet( CHAR_DATA *ch, char *argument ) -{ - int flag; - char buf[MAX_STRING_LENGTH]; - - 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; - } - - /* show wiznet status */ - 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")) - /* list of all wiznet options */ - { - 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)) - { - sprintf(buf,"You will no longer see %s on wiznet.\n\r", - wiznet_table[flag].name); - send_to_char(buf,ch); - REMOVE_BIT(ch->wiznet,wiznet_table[flag].flag); - return; - } - else - { - sprintf(buf,"You will now see %s on wiznet.\n\r", - wiznet_table[flag].name); - send_to_char(buf,ch); - 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) -{ - DESCRIPTOR_DATA *d; - - 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) - { - if (IS_SET(d->character->wiznet,WIZ_PREFIX)) - send_to_char("--> ",d->character); - act_new(string,d->character,obj,ch,TO_CHAR,POS_DEAD); - } - } - - return; -} - -void do_guild( CHAR_DATA *ch, char *argument ) -{ - char arg1[MAX_INPUT_LENGTH],arg2[MAX_INPUT_LENGTH]; - char buf[MAX_STRING_LENGTH]; - CHAR_DATA *victim; - int clan; - - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - - if ( arg1[0] == '\0' || arg2[0] == '\0' ) - { - send_to_char( "Syntax: guild \n\r",ch); - return; - } - if ( ( victim = get_char_world( ch, arg1 ) ) == NULL ) - { - send_to_char( "They aren't playing.\n\r", ch ); - return; - } - - if (!str_prefix(arg2,"none")) - { - send_to_char("They are now clanless.\n\r",ch); - send_to_char("You are now a member of no clan!\n\r",victim); - victim->clan = 0; - return; - } - - if ((clan = clan_lookup(arg2)) == 0) - { - send_to_char("No such clan exists.\n\r",ch); - return; - } - - if (clan_table[clan].independent) - { - sprintf(buf,"They are now a %s.\n\r",clan_table[clan].name); - send_to_char(buf,ch); - sprintf(buf,"You are now a %s.\n\r",clan_table[clan].name); - send_to_char(buf,victim); - } - else - { - sprintf(buf,"They are now a member of clan %s.\n\r", - capitalize(clan_table[clan].name)); - send_to_char(buf,ch); - sprintf(buf,"You are now a member of clan %s.\n\r", - capitalize(clan_table[clan].name)); - } - - victim->clan = clan; -} - -/* equips a character */ -void do_outfit ( CHAR_DATA *ch, char *argument ) -{ - OBJ_DATA *obj; - int i,sn,vnum; - - if (ch->level > 5 || IS_NPC(ch)) - { - send_to_char("Find it yourself!\n\r",ch); - return; - } - - if ( ( obj = get_eq_char( ch, WEAR_LIGHT ) ) == NULL ) - { - obj = create_object( get_obj_index(OBJ_VNUM_SCHOOL_BANNER), 0 ); - obj->cost = 0; - obj_to_char( obj, ch ); - equip_char( ch, obj, WEAR_LIGHT ); - } - - if ( ( obj = get_eq_char( ch, WEAR_BODY ) ) == NULL ) - { - obj = create_object( get_obj_index(OBJ_VNUM_SCHOOL_VEST), 0 ); - obj->cost = 0; - obj_to_char( obj, ch ); - equip_char( ch, obj, WEAR_BODY ); - } - - /* do the weapon thing */ - if ((obj = get_eq_char(ch,WEAR_WIELD)) == NULL) - { - sn = 0; - vnum = OBJ_VNUM_SCHOOL_SWORD; /* just in case! */ - - for (i = 0; weapon_table[i].name != NULL; i++) - { - if (ch->pcdata->learned[sn] < - ch->pcdata->learned[*weapon_table[i].gsn]) - { - sn = *weapon_table[i].gsn; - vnum = weapon_table[i].vnum; - } - } - - obj = create_object(get_obj_index(vnum),0); - obj_to_char(obj,ch); - equip_char(ch,obj,WEAR_WIELD); - } - - if (((obj = get_eq_char(ch,WEAR_WIELD)) == NULL - || !IS_WEAPON_STAT(obj,WEAPON_TWO_HANDS)) - && (obj = get_eq_char( ch, WEAR_SHIELD ) ) == NULL ) - { - obj = create_object( get_obj_index(OBJ_VNUM_SCHOOL_SHIELD), 0 ); - obj->cost = 0; - obj_to_char( obj, ch ); - equip_char( ch, obj, WEAR_SHIELD ); - } - - send_to_char("You have been equipped by Mota.\n\r",ch); -} - - -/* RT nochannels command, for those spammers */ -void do_nochannels( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH], buf[MAX_STRING_LENGTH]; - 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 ); - send_to_char( "NOCHANNELS removed.\n\r", ch ); - sprintf(buf,"$N restores channels to %s",victim->name); - wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); - } - else - { - SET_BIT(victim->comm, COMM_NOCHANNELS); - send_to_char( "The gods have revoked your channel priviliges.\n\r", - victim ); - send_to_char( "NOCHANNELS set.\n\r", ch ); - sprintf(buf,"$N revokes %s's channels.",victim->name); - wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); - } - - return; -} - - -void do_smote(CHAR_DATA *ch, char *argument ) -{ - CHAR_DATA *vch; - 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) ) - { - send_to_char( "You can't show your emotions.\n\r", ch ); - return; - } - - if ( argument[0] == '\0' ) - { - send_to_char( "Emote what?\n\r", ch ); - return; - } - - if (strstr(argument,ch->name) == NULL) - { - send_to_char("You must include your name in an smote.\n\r",ch); - return; - } - - send_to_char(argument,ch); - send_to_char("\n\r",ch); - - 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) - { - send_to_char(argument,vch); - send_to_char("\n\r",vch); - continue; - } - - strcpy(temp,argument); - temp[strlen(argument) - strlen(letter)] = '\0'; - last[0] = '\0'; - name = vch->name; - - for (; *letter != '\0'; letter++) - { - if (*letter == '\'' && matches == strlen(vch->name)) - { - strcat(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)) - { - strcat(temp,"you"); - last[0] = '\0'; - name = vch->name; - continue; - } - strncat(last,letter,1); - continue; - } - - matches = 0; - strcat(temp,last); - strncat(temp,letter,1); - last[0] = '\0'; - name = vch->name; - } - - send_to_char(temp,vch); - send_to_char("\n\r",vch); - } - - return; -} - -void do_bamfin( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - - if ( !IS_NPC(ch) ) - { - smash_tilde( argument ); - - if (argument[0] == '\0') - { - sprintf(buf,"Your poofin is %s\n\r",ch->pcdata->bamfin); - send_to_char(buf,ch); - 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 ); - - sprintf(buf,"Your poofin is now %s\n\r",ch->pcdata->bamfin); - send_to_char(buf,ch); - } - return; -} - -void do_bamfout( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - - if ( !IS_NPC(ch) ) - { - smash_tilde( argument ); - - if (argument[0] == '\0') - { - sprintf(buf,"Your poofout is %s\n\r",ch->pcdata->bamfout); - send_to_char(buf,ch); - 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 ); - - sprintf(buf,"Your poofout is now %s\n\r",ch->pcdata->bamfout); - send_to_char(buf,ch); - } - return; -} - - - -void do_deny( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH],buf[MAX_STRING_LENGTH]; - 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,0); - send_to_char( "OK.\n\r", ch ); - save_char_obj(victim); - stop_fighting(victim,TRUE); - do_function(victim, &do_quit, "" ); - - return; -} - - - -void do_disconnect( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - 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 ) - { - close_socket( d ); - send_to_char( "Ok.\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 ) - { - 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_socket( d ); - send_to_char( "Ok.\n\r", ch ); - return; - } - } - - bug( "Do_disconnect: desc not found.", 0 ); - send_to_char( "Descriptor not found!\n\r", ch ); - return; -} - - - -void do_pardon( CHAR_DATA *ch, char *argument ) -{ - char arg1[MAX_INPUT_LENGTH]; - char arg2[MAX_INPUT_LENGTH]; - 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 .\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 ( !str_cmp( arg2, "killer" ) ) - { - if ( IS_SET(victim->act, PLR_KILLER) ) - { - REMOVE_BIT( victim->act, PLR_KILLER ); - send_to_char( "Killer flag removed.\n\r", ch ); - send_to_char( "You are no longer a KILLER.\n\r", victim ); - } - return; - } - - if ( !str_cmp( arg2, "thief" ) ) - { - if ( IS_SET(victim->act, PLR_THIEF) ) - { - REMOVE_BIT( victim->act, PLR_THIEF ); - send_to_char( "Thief flag removed.\n\r", ch ); - send_to_char( "You are no longer a THIEF.\n\r", victim ); - } - return; - } - - send_to_char( "Syntax: pardon .\n\r", ch ); - return; -} - - - -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); - send_to_char( argument, d->character ); - send_to_char( "\n\r", d->character ); - } - } - - return; -} - - - -void do_recho( CHAR_DATA *ch, char *argument ) -{ - DESCRIPTOR_DATA *d; - - if ( argument[0] == '\0' ) - { - send_to_char( "Local echo what?\n\r", ch ); - - return; - } - - for ( d = descriptor_list; d; d = d->next ) - { - if ( d->connected == CON_PLAYING - && d->character->in_room == ch->in_room ) - { - if (get_trust(d->character) >= get_trust(ch)) - send_to_char( "local> ",d->character); - send_to_char( argument, d->character ); - send_to_char( "\n\r", d->character ); - } - } - - return; -} - -void do_zecho(CHAR_DATA *ch, char *argument) -{ - DESCRIPTOR_DATA *d; - - if (argument[0] == '\0') - { - send_to_char("Zone echo what?\n\r",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 (get_trust(d->character) >= get_trust(ch)) - send_to_char("zone> ",d->character); - send_to_char(argument,d->character); - send_to_char("\n\r",d->character); - } - } -} - -void do_pecho( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - - argument = one_argument(argument, arg); - - if ( argument[0] == '\0' || arg[0] == '\0' ) - { - send_to_char("Personal echo what?\n\r", ch); - return; - } - - if ( (victim = get_char_world(ch, arg) ) == NULL ) - { - send_to_char("Target not found.\n\r",ch); - return; - } - - if (get_trust(victim) >= get_trust(ch) && get_trust(ch) != MAX_LEVEL) - send_to_char( "personal> ",victim); - - send_to_char(argument,victim); - send_to_char("\n\r",victim); - send_to_char( "personal> ",ch); - send_to_char(argument,ch); - send_to_char("\n\r",ch); -} - - -ROOM_INDEX_DATA *find_location( CHAR_DATA *ch, char *arg ) -{ - CHAR_DATA *victim; - OBJ_DATA *obj; - - if ( is_number(arg) ) - return 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; -} - - - -void do_transfer( CHAR_DATA *ch, char *argument ) -{ - 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 ); - 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 ( 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 ) ) - { - char buf[MAX_STRING_LENGTH]; - sprintf( buf, "%s %s", d->character->name, arg2 ); - do_function(ch, &do_transfer, buf ); - } - } - return; - } - - /* - * Thanks to Grodyn for the optional location parameter. - */ - 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 ( !is_room_owner(ch,location) && room_is_private( location ) - && get_trust(ch) < MAX_LEVEL) - { - send_to_char( "That room is private right now.\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 ) - { - send_to_char( "They are in limbo.\n\r", ch ); - return; - } - - if ( victim->fighting != NULL ) - stop_fighting( victim, TRUE ); - act( "$n disappears in a mushroom cloud.", victim, NULL, NULL, TO_ROOM ); - char_from_room( victim ); - char_to_room( victim, location ); - act( "$n arrives from a puff of smoke.", victim, NULL, NULL, TO_ROOM ); - if ( ch != victim ) - act( "$n has transferred you.", ch, NULL, victim, TO_VICT ); - do_function(victim, &do_look, "auto" ); - send_to_char( "Ok.\n\r", ch ); -} - - - -void do_at( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - ROOM_INDEX_DATA *location; - ROOM_INDEX_DATA *original; - OBJ_DATA *on; - CHAR_DATA *wch; - - 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 (!is_room_owner(ch,location) && room_is_private( location ) - && get_trust(ch) < MAX_LEVEL) - { - send_to_char( "That room is private right now.\n\r", ch ); - return; - } - - original = ch->in_room; - on = ch->on; - char_from_room( ch ); - char_to_room( ch, location ); - interpret( ch, argument ); - - /* - * See if 'ch' still exists before continuing! - * Handles 'at XXXX quit' case. - */ - for ( wch = char_list; wch != NULL; wch = wch->next ) - { - if ( wch == ch ) - { - char_from_room( ch ); - char_to_room( ch, original ); - ch->on = on; - break; - } - } - - return; -} - - - -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 (!is_room_owner(ch,location) && 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 ( 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_function(ch, &do_look, "auto" ); - return; -} - -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 ( 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_function(ch, &do_look, "auto" ); - return; -} - -/* RT to replace the 3 stat commands */ - -void do_stat ( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - char *string; - OBJ_DATA *obj; - ROOM_INDEX_DATA *location; - CHAR_DATA *victim; - - string = one_argument(argument, arg); - if ( arg[0] == '\0') - { - send_to_char("Syntax:\n\r",ch); - send_to_char(" stat \n\r",ch); - send_to_char(" stat obj \n\r",ch); - send_to_char(" stat mob \n\r",ch); - send_to_char(" stat room \n\r",ch); - return; - } - - if (!str_cmp(arg,"room")) - { - do_function(ch, &do_rstat, string); - return; - } - - if (!str_cmp(arg,"obj")) - { - do_function(ch, &do_ostat, string); - return; - } - - if(!str_cmp(arg,"char") || !str_cmp(arg,"mob")) - { - do_function(ch, &do_mstat, string); - return; - } - - /* do it the old way */ - - obj = get_obj_world(ch,argument); - if (obj != NULL) - { - do_function(ch, &do_ostat, argument); - return; - } - - victim = get_char_world(ch,argument); - if (victim != NULL) - { - do_function(ch, &do_mstat, argument); - return; - } - - location = find_location(ch,argument); - if (location != NULL) - { - do_function(ch, &do_rstat, argument); - return; - } - - send_to_char("Nothing by that name found anywhere.\n\r",ch); -} - -void do_rstat( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - 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 (!is_room_owner(ch,location) && 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; - } - - sprintf( buf, "Name: '%s'\n\rArea: '%s'\n\r", - location->name, - location->area->name ); - send_to_char( buf, ch ); - - sprintf( buf, - "Vnum: %d Sector: %d Light: %d Healing: %d Mana: %d\n\r", - location->vnum, - location->sector_type, - location->light, - location->heal_rate, - location->mana_rate ); - send_to_char( buf, ch ); - - sprintf( buf, - "Room flags: %d.\n\rDescription:\n\r%s", - location->room_flags, - location->description ); - send_to_char( buf, ch ); - - 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 ) - { - sprintf( buf, - "Door: %d. To: %d. Key: %d. Exit flags: %d.\n\rKeyword: '%s'. Description: %s", - - door, - (pexit->u1.to_room == NULL ? -1 : pexit->u1.to_room->vnum), - pexit->key, - pexit->exit_info, - pexit->keyword, - pexit->description[0] != '\0' - ? pexit->description : "(none).\n\r" ); - send_to_char( buf, ch ); - } - } - - return; -} - - - -void do_ostat( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - AFFECT_DATA *paf; - OBJ_DATA *obj; - - 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; - } - - sprintf( buf, "Name(s): %s\n\r", - obj->name ); - send_to_char( buf, ch ); - - sprintf( buf, "Vnum: %d Format: %s Type: %s Resets: %d\n\r", - obj->pIndexData->vnum, obj->pIndexData->new_format ? "new" : "old", - item_name(obj->item_type), obj->pIndexData->reset_num ); - send_to_char( buf, ch ); - - sprintf( buf, "Short description: %s\n\rLong description: %s\n\r", - obj->short_descr, obj->description ); - send_to_char( buf, ch ); - - sprintf( buf, "Wear bits: %s\n\rExtra bits: %s\n\r", - wear_bit_name(obj->wear_flags), extra_bit_name( obj->extra_flags ) ); - send_to_char( buf, ch ); - - sprintf( buf, "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) ); - send_to_char( buf, ch ); - - sprintf( buf, "Level: %d Cost: %d Condition: %d Timer: %d\n\r", - obj->level, obj->cost, obj->condition, obj->timer ); - send_to_char( buf, ch ); - - sprintf( buf, - "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 ); - send_to_char( buf, ch ); - - sprintf( buf, "Values: %d %d %d %d %d\n\r", - obj->value[0], obj->value[1], obj->value[2], obj->value[3], - obj->value[4] ); - send_to_char( buf, ch ); - - /* now give out vital statistics as per identify */ - - switch ( obj->item_type ) - { - case ITEM_SCROLL: - case ITEM_POTION: - case ITEM_PILL: - sprintf( buf, "Level %d spells of:", obj->value[0] ); - send_to_char( buf, ch ); - - if ( obj->value[1] >= 0 && obj->value[1] < MAX_SKILL ) - { - send_to_char( " '", ch ); - send_to_char( skill_table[obj->value[1]].name, ch ); - send_to_char( "'", ch ); - } - - if ( obj->value[2] >= 0 && obj->value[2] < MAX_SKILL ) - { - send_to_char( " '", ch ); - send_to_char( skill_table[obj->value[2]].name, ch ); - send_to_char( "'", ch ); - } - - if ( obj->value[3] >= 0 && obj->value[3] < MAX_SKILL ) - { - send_to_char( " '", ch ); - send_to_char( skill_table[obj->value[3]].name, ch ); - send_to_char( "'", ch ); - } - - if (obj->value[4] >= 0 && obj->value[4] < MAX_SKILL) - { - send_to_char(" '",ch); - send_to_char(skill_table[obj->value[4]].name,ch); - send_to_char("'",ch); - } - - send_to_char( ".\n\r", ch ); - break; - - case ITEM_WAND: - case ITEM_STAFF: - sprintf( buf, "Has %d(%d) charges of level %d", - obj->value[1], obj->value[2], obj->value[0] ); - send_to_char( buf, ch ); - - if ( obj->value[3] >= 0 && obj->value[3] < MAX_SKILL ) - { - send_to_char( " '", ch ); - send_to_char( skill_table[obj->value[3]].name, ch ); - send_to_char( "'", ch ); - } - - send_to_char( ".\n\r", ch ); - break; - - case ITEM_DRINK_CON: - sprintf(buf,"It holds %s-colored %s.\n\r", - liq_table[obj->value[2]].liq_color, - liq_table[obj->value[2]].liq_name); - send_to_char(buf,ch); - 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/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) - sprintf(buf,"Damage is %dd%d (average %d)\n\r", - obj->value[1],obj->value[2], - (1 + obj->value[2]) * obj->value[1] / 2); - else - sprintf( buf, "Damage is %d to %d (average %d)\n\r", - obj->value[1], obj->value[2], - ( obj->value[1] + obj->value[2] ) / 2 ); - send_to_char( buf, ch ); - - sprintf(buf,"Damage noun is %s.\n\r", - (obj->value[3] > 0 && obj->value[3] < MAX_DAMAGE_MESSAGE) ? - attack_table[obj->value[3]].noun : "undefined"); - send_to_char(buf,ch); - - if (obj->value[4]) /* weapon flags */ - { - sprintf(buf,"Weapons flags: %s\n\r", - weapon_bit_name(obj->value[4])); - send_to_char(buf,ch); - } - break; - - case ITEM_ARMOR: - sprintf( buf, - "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] ); - send_to_char( buf, ch ); - break; - - case ITEM_CONTAINER: - sprintf(buf,"Capacity: %d# Maximum weight: %d# flags: %s\n\r", - obj->value[0], obj->value[3], cont_bit_name(obj->value[1])); - send_to_char(buf,ch); - if (obj->value[4] != 100) - { - sprintf(buf,"Weight multiplier: %d%%\n\r", - obj->value[4]); - send_to_char(buf,ch); - } - break; - } - - - 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 ) - { - sprintf( buf, "Affects %s by %d, level %d", - affect_loc_name( paf->location ), paf->modifier,paf->level ); - send_to_char(buf,ch); - if ( paf->duration > -1) - sprintf(buf,", %d hours.\n\r",paf->duration); - else - sprintf(buf,".\n\r"); - send_to_char( buf, ch ); - if (paf->bitvector) - { - switch(paf->where) - { - case TO_AFFECTS: - sprintf(buf,"Adds %s affect.\n", - affect_bit_name(paf->bitvector)); - break; - case TO_WEAPON: - sprintf(buf,"Adds %s weapon flags.\n", - weapon_bit_name(paf->bitvector)); - break; - case TO_OBJECT: - sprintf(buf,"Adds %s object flag.\n", - extra_bit_name(paf->bitvector)); - break; - case TO_IMMUNE: - sprintf(buf,"Adds immunity to %s.\n", - imm_bit_name(paf->bitvector)); - break; - case TO_RESIST: - sprintf(buf,"Adds resistance to %s.\n\r", - imm_bit_name(paf->bitvector)); - break; - case TO_VULN: - sprintf(buf,"Adds vulnerability to %s.\n\r", - imm_bit_name(paf->bitvector)); - break; - default: - sprintf(buf,"Unknown bit %d: %d\n\r", - paf->where,paf->bitvector); - break; - } - send_to_char(buf,ch); - } - } - - if (!obj->enchanted) - for ( paf = obj->pIndexData->affected; paf != NULL; paf = paf->next ) - { - sprintf( buf, "Affects %s by %d, level %d.\n\r", - affect_loc_name( paf->location ), paf->modifier,paf->level ); - send_to_char( buf, ch ); - if (paf->bitvector) - { - switch(paf->where) - { - case TO_AFFECTS: - sprintf(buf,"Adds %s affect.\n", - affect_bit_name(paf->bitvector)); - break; - case TO_OBJECT: - sprintf(buf,"Adds %s object flag.\n", - extra_bit_name(paf->bitvector)); - break; - case TO_IMMUNE: - sprintf(buf,"Adds immunity to %s.\n", - imm_bit_name(paf->bitvector)); - break; - case TO_RESIST: - sprintf(buf,"Adds resistance to %s.\n\r", - imm_bit_name(paf->bitvector)); - break; - case TO_VULN: - sprintf(buf,"Adds vulnerability to %s.\n\r", - imm_bit_name(paf->bitvector)); - break; - default: - sprintf(buf,"Unknown bit %d: %d\n\r", - paf->where,paf->bitvector); - break; - } - send_to_char(buf,ch); - } - } - - return; -} - - - -void do_mstat( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - AFFECT_DATA *paf; - CHAR_DATA *victim; - - 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; - } - - sprintf( buf, "Name: %s\n\r", - victim->name); - send_to_char( buf, ch ); - - sprintf( buf, - "Vnum: %d Format: %s Race: %s Group: %d Sex: %s Room: %d\n\r", - IS_NPC(victim) ? victim->pIndexData->vnum : 0, - IS_NPC(victim) ? victim->pIndexData->new_format ? "new" : "old" : "pc", - race_table[victim->race].name, - IS_NPC(victim) ? victim->group : 0, sex_table[victim->sex].name, - victim->in_room == NULL ? 0 : victim->in_room->vnum - ); - send_to_char( buf, ch ); - - if (IS_NPC(victim)) - { - sprintf(buf,"Count: %d Killed: %d\n\r", - victim->pIndexData->count,victim->pIndexData->killed); - send_to_char(buf,ch); - } - - sprintf( buf, - "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) ); - send_to_char( buf, ch ); - - sprintf( buf, "Hp: %d/%d Mana: %d/%d Move: %d/%d Practices: %d\n\r", - victim->hit, victim->max_hit, - victim->mana, victim->max_mana, - victim->move, victim->max_move, - IS_NPC(ch) ? 0 : victim->practice ); - send_to_char( buf, ch ); - - sprintf( buf, - "Lv: %d Class: %s Align: %d Gold: %ld Silver: %ld Exp: %d\n\r", - victim->level, - IS_NPC(victim) ? "mobile" : class_table[victim->class].name, - victim->alignment, - victim->gold, victim->silver, victim->exp ); - send_to_char( buf, ch ); - - sprintf(buf,"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)); - send_to_char(buf,ch); - - sprintf( buf, - "Hit: %d Dam: %d Saves: %d Size: %s Position: %s Wimpy: %d\n\r", - GET_HITROLL(victim), GET_DAMROLL(victim), victim->saving_throw, - size_table[victim->size].name, position_table[victim->position].name, - victim->wimpy ); - send_to_char( buf, ch ); - - if (IS_NPC(victim) && victim->pIndexData->new_format) - { - sprintf(buf, "Damage: %dd%d Message: %s\n\r", - victim->damage[DICE_NUMBER],victim->damage[DICE_TYPE], - attack_table[victim->dam_type].noun); - send_to_char(buf,ch); - } - sprintf( buf, "Fighting: %s\n\r", - victim->fighting ? victim->fighting->name : "(none)" ); - send_to_char( buf, ch ); - - if ( !IS_NPC(victim) ) - { - sprintf( buf, - "Thirst: %d Hunger: %d Full: %d Drunk: %d\n\r", - victim->pcdata->condition[COND_THIRST], - victim->pcdata->condition[COND_HUNGER], - victim->pcdata->condition[COND_FULL], - victim->pcdata->condition[COND_DRUNK] ); - send_to_char( buf, ch ); - } - - sprintf( buf, "Carry number: %d Carry weight: %ld\n\r", - victim->carry_number, get_carry_weight(victim) / 10 ); - send_to_char( buf, ch ); - - - if (!IS_NPC(victim)) - { - sprintf( buf, - "Age: %d Played: %d Last Level: %d Timer: %d\n\r", - get_age(victim), - (int) (victim->played + current_time - victim->logon) / 3600, - victim->pcdata->last_level, - victim->timer ); - send_to_char( buf, ch ); - } - - sprintf(buf, "Act: %s\n\r",act_bit_name(victim->act)); - send_to_char(buf,ch); - - if (victim->comm) - { - sprintf(buf,"Comm: %s\n\r",comm_bit_name(victim->comm)); - send_to_char(buf,ch); - } - - if (IS_NPC(victim) && victim->off_flags) - { - sprintf(buf, "Offense: %s\n\r",off_bit_name(victim->off_flags)); - send_to_char(buf,ch); - } - - if (victim->imm_flags) - { - sprintf(buf, "Immune: %s\n\r",imm_bit_name(victim->imm_flags)); - send_to_char(buf,ch); - } - - if (victim->res_flags) - { - sprintf(buf, "Resist: %s\n\r", imm_bit_name(victim->res_flags)); - send_to_char(buf,ch); - } - - if (victim->vuln_flags) - { - sprintf(buf, "Vulnerable: %s\n\r", imm_bit_name(victim->vuln_flags)); - send_to_char(buf,ch); - } - - sprintf(buf, "Form: %s\n\rParts: %s\n\r", - form_bit_name(victim->form), part_bit_name(victim->parts)); - send_to_char(buf,ch); - - if (victim->affected_by) - { - sprintf(buf, "Affected by %s\n\r", - affect_bit_name(victim->affected_by)); - send_to_char(buf,ch); - } - - sprintf( buf, "Master: %s Leader: %s Pet: %s\n\r", - victim->master ? victim->master->name : "(none)", - victim->leader ? victim->leader->name : "(none)", - victim->pet ? victim->pet->name : "(none)"); - send_to_char( buf, ch ); - - sprintf( buf, "Short description: %s\n\rLong description: %s", - victim->short_descr, - victim->long_descr[0] != '\0' ? victim->long_descr : "(none)\n\r" ); - send_to_char( buf, ch ); - - if ( IS_NPC(victim) && victim->spec_fun != 0 ) - { - sprintf(buf,"Mobile has special procedure %s.\n\r", - spec_name(victim->spec_fun)); - send_to_char(buf,ch); - } - - for ( paf = victim->affected; paf != NULL; paf = paf->next ) - { - sprintf( buf, - "Spell: '%s' modifies %s by %d for %d hours with bits %s, level %d.\n\r", - skill_table[(int) paf->type].name, - affect_loc_name( paf->location ), - paf->modifier, - paf->duration, - affect_bit_name( paf->bitvector ), - paf->level - ); - send_to_char( buf, ch ); - } - - return; -} - -/* ofind and mfind replaced with vnum, vnum skill also added */ - -void do_vnum(CHAR_DATA *ch, char *argument) -{ - char arg[MAX_INPUT_LENGTH]; - char *string; - - string = one_argument(argument,arg); - - if (arg[0] == '\0') - { - send_to_char("Syntax:\n\r",ch); - send_to_char(" vnum obj \n\r",ch); - send_to_char(" vnum mob \n\r",ch); - send_to_char(" vnum skill \n\r",ch); - return; - } - - if (!str_cmp(arg,"obj")) - { - do_function(ch, &do_ofind, string); - return; - } - - if (!str_cmp(arg,"mob") || !str_cmp(arg,"char")) - { - do_function(ch, &do_mfind, string); - return; - } - - if (!str_cmp(arg,"skill") || !str_cmp(arg,"spell")) - { - do_function (ch, &do_slookup, string); - return; - } - /* do both */ - do_function(ch, &do_mfind, argument); - do_function(ch, &do_ofind, argument); -} - - -void do_mfind( CHAR_DATA *ch, char *argument ) -{ - extern int top_mob_index; - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - MOB_INDEX_DATA *pMobIndex; - int vnum; - int nMatch; - bool fAll; - bool found; - - one_argument( argument, arg ); - if ( arg[0] == '\0' ) - { - send_to_char( "Find whom?\n\r", ch ); - return; - } - - fAll = FALSE; /* !str_cmp( arg, "all" ); */ - 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 ( fAll || is_name( argument, pMobIndex->player_name ) ) - { - found = TRUE; - sprintf( buf, "[%5d] %s\n\r", - pMobIndex->vnum, pMobIndex->short_descr ); - send_to_char( buf, ch ); - } - } - } - - if ( !found ) - send_to_char( "No mobiles by that name.\n\r", ch ); - - return; -} - - - -void do_ofind( CHAR_DATA *ch, char *argument ) -{ - extern int top_obj_index; - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - OBJ_INDEX_DATA *pObjIndex; - int vnum; - int nMatch; - bool fAll; - bool found; - - one_argument( argument, arg ); - if ( arg[0] == '\0' ) - { - send_to_char( "Find what?\n\r", ch ); - return; - } - - fAll = FALSE; /* !str_cmp( arg, "all" ); */ - 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 ( fAll || is_name( argument, pObjIndex->name ) ) - { - found = TRUE; - sprintf( buf, "[%5d] %s\n\r", - pObjIndex->vnum, pObjIndex->short_descr ); - send_to_char( buf, ch ); - } - } - } - - if ( !found ) - send_to_char( "No objects by that name.\n\r", ch ); - - return; -} - - -void do_owhere(CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_INPUT_LENGTH]; - BUFFER *buffer; - OBJ_DATA *obj; - OBJ_DATA *in_obj; - bool found; - int number = 0, max_found; - - found = FALSE; - 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 ) - { - if ( !can_see_obj( ch, obj ) || !is_name( argument, obj->name ) - || ch->level < obj->level) - continue; - - 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,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)) - 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_mwhere( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - BUFFER *buffer; - CHAR_DATA *victim; - bool found; - int count = 0; - - if ( argument[0] == '\0' ) - { - DESCRIPTOR_DATA *d; - - /* show characters logged */ - - buffer = new_buf(); - 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) - sprintf(buf,"%3d) %s (in the body of %s) is in %s [%d]\n\r", - count, d->original->name,victim->short_descr, - victim->in_room->name,victim->in_room->vnum); - else - sprintf(buf,"%3d) %s is in %s [%d]\n\r", - count, victim->name,victim->in_room->name, - victim->in_room->vnum); - add_buf(buffer,buf); - } - } - - page_to_char(buf_string(buffer),ch); - free_buf(buffer); - return; - } - - found = FALSE; - buffer = new_buf(); - for ( victim = char_list; victim != NULL; victim = victim->next ) - { - if ( victim->in_room != NULL - && is_name( argument, victim->name ) ) - { - 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 ) - act( "You didn't find any $T.", ch, NULL, argument, TO_CHAR ); - else - page_to_char(buf_string(buffer),ch); - - free_buf(buffer); - - return; -} - - - -void do_reboo( CHAR_DATA *ch, char *argument ) -{ - send_to_char( "If you want to REBOOT, spell it out.\n\r", ch ); - return; -} - - - -void do_reboot( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - extern bool merc_down; - DESCRIPTOR_DATA *d,*d_next; - CHAR_DATA *vch; - - if (ch->invis_level < LEVEL_HERO) - { - sprintf( buf, "Reboot by %s.", ch->name ); - do_function(ch, &do_echo, buf ); - } - - merc_down = TRUE; - for ( d = descriptor_list; d != NULL; d = d_next ) - { - d_next = d->next; - vch = d->original ? d->original : d->character; - if (vch != NULL) - save_char_obj(vch); - close_socket(d); - } - - return; -} - -void do_shutdow( CHAR_DATA *ch, char *argument ) -{ - send_to_char( "If you want to SHUTDOWN, spell it out.\n\r", ch ); - return; -} - -void do_shutdown( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - extern bool merc_down; - DESCRIPTOR_DATA *d,*d_next; - CHAR_DATA *vch; - - 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_function(ch, &do_echo, buf ); - } - merc_down = TRUE; - for ( d = descriptor_list; d != NULL; d = d_next) - { - d_next = d->next; - vch = d->original ? d->original : d->character; - if (vch != NULL) - save_char_obj(vch); - close_socket(d); - } - return; -} - -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)) - { - act_new("$N is no longer snoop-proof.",ch,NULL,victim,TO_CHAR,POS_DEAD); - send_to_char("Your snoop-proofing was just removed.\n\r",victim); - REMOVE_BIT(victim->comm,COMM_SNOOP_PROOF); - } - else - { - act_new("$N is now snoop-proof.",ch,NULL,victim,TO_CHAR,POS_DEAD); - send_to_char("You are now immune to snooping.\n\r",victim); - SET_BIT(victim->comm,COMM_SNOOP_PROOF); - } -} - - - -void do_snoop( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - DESCRIPTOR_DATA *d; - CHAR_DATA *victim; - char buf[MAX_STRING_LENGTH]; - - 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 ) - { - send_to_char( "No descriptor to snoop.\n\r", ch ); - 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)); - 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 ) - { - send_to_char( "Busy already.\n\r", 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)) - { - send_to_char("That character is in a private room.\n\r",ch); - return; - } - - if ( get_trust( victim ) >= get_trust( ch ) - || IS_SET(victim->comm,COMM_SNOOP_PROOF)) - { - send_to_char( "You failed.\n\r", 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 ) - { - send_to_char( "No snoop loops.\n\r", ch ); - return; - } - } - } - - victim->desc->snoop_by = 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)); - send_to_char( "Ok.\n\r", ch ); - return; -} - - - -void do_switch( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH], buf[MAX_STRING_LENGTH]; - 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( "Ok.\n\r", ch ); - return; - } - - if (!IS_NPC(victim)) - { - send_to_char("You can only switch into mobiles.\n\r",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)) - { - send_to_char("That character is in a private room.\n\r",ch); - return; - } - - if ( victim->desc != NULL ) - { - send_to_char( "Character in use.\n\r", ch ); - 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; - /* change communications to match */ - if (ch->prompt != NULL) - victim->prompt = str_dup(ch->prompt); - victim->comm = ch->comm; - victim->lines = ch->lines; - send_to_char( "Ok.\n\r", victim ); - return; -} - - - -void do_return( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - - 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. Type replay to see any 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->desc->character = ch->desc->original; - ch->desc->original = NULL; - ch->desc->character->desc = ch->desc; - ch->desc = NULL; - return; -} - -/* 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; -} - -/* 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_object(c_obj->pIndexData,0); - clone_object(c_obj,t_obj); - obj_to_obj(t_obj,clone); - recursive_clone(ch,c_obj,t_obj); - } - } -} - -/* command that is similar to load */ -void do_clone(CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - char *rest; - CHAR_DATA *mob; - OBJ_DATA *obj; - - 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,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,rest); - if (mob == NULL) - { - send_to_char("You don't see that here.\n\r",ch); - return; - } - } - else /* find both */ - { - mob = get_char_room(ch,argument); - obj = get_obj_here(ch,argument); - if (mob == NULL && obj == NULL) - { - send_to_char("You don't see that here.\n\r",ch); - return; - } - } - - /* clone an object */ - if (obj != NULL) - { - OBJ_DATA *clone; - - if (!obj_check(ch,obj)) - { - send_to_char( - "Your powers are not great enough for such a task.\n\r",ch); - return; - } - - 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[MAX_STRING_LENGTH]; - - if (!IS_NPC(mob)) - { - send_to_char("You can only clone mobiles.\n\r",ch); - return; - } - - 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)) - { - send_to_char( - "Your powers are not great enough for such a task.\n\r",ch); - return; - } - - clone = create_mobile(mob->pIndexData); - clone_mobile(mob,clone); - - for (obj = mob->carrying; obj != NULL; obj = obj->next_content) - { - if (obj_check(ch,obj)) - { - 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)); - return; - } -} - -/* RT to replace the two load commands */ - -void do_load(CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - - argument = one_argument(argument,arg); - - if (arg[0] == '\0') - { - send_to_char("Syntax:\n\r",ch); - send_to_char(" load mob \n\r",ch); - send_to_char(" load obj \n\r",ch); - return; - } - - if (!str_cmp(arg,"mob") || !str_cmp(arg,"char")) - { - do_function(ch, &do_mload, argument); - return; - } - - if (!str_cmp(arg,"obj")) - { - do_function(ch, &do_oload, argument); - return; - } - /* echo syntax */ - do_function(ch, &do_load, ""); -} - - -void do_mload( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - MOB_INDEX_DATA *pMobIndex; - CHAR_DATA *victim; - char buf[MAX_STRING_LENGTH]; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' || !is_number(arg) ) - { - send_to_char( "Syntax: load mob .\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 ); - sprintf(buf,"$N loads %s.",victim->short_descr); - wiznet(buf,ch,NULL,WIZ_LOAD,WIZ_SECURE,get_trust(ch)); - send_to_char( "Ok.\n\r", ch ); - return; -} - - - -void do_oload( CHAR_DATA *ch, char *argument ) -{ - char arg1[MAX_INPUT_LENGTH] ,arg2[MAX_INPUT_LENGTH]; - OBJ_INDEX_DATA *pObjIndex; - OBJ_DATA *obj; - int level; - - argument = one_argument( argument, arg1 ); - one_argument( argument, arg2 ); - - if ( arg1[0] == '\0' || !is_number(arg1)) - { - send_to_char( "Syntax: load obj .\n\r", ch ); - return; - } - - level = get_trust(ch); /* default */ - - if ( arg2[0] != '\0') /* load with a level */ - { - if (!is_number(arg2)) - { - send_to_char( "Syntax: oload .\n\r", ch ); - return; - } - level = atoi(arg2); - if (level < 0 || level > get_trust(ch)) - { - send_to_char( "Level must be be between 0 and your level.\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 ); - wiznet("$N loads $p.",ch,obj,WIZ_LOAD,WIZ_SECURE,get_trust(ch)); - send_to_char( "Ok.\n\r", ch ); - return; -} - - - -void do_purge( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - char buf[100]; - CHAR_DATA *victim; - OBJ_DATA *obj; - DESCRIPTOR_DATA *d; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - /* 'purge' */ - 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 /* 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); - send_to_char( "Ok.\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) ) - { - - 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); - sprintf(buf,"%s tried to purge you!\n\r",ch->name); - send_to_char(buf,victim); - return; - } - - act("$n disintegrates $N.",ch,0,victim,TO_NOTVICT); - - if (victim->level > 1) - save_char_obj( victim ); - d = victim->desc; - extract_char( victim, TRUE ); - if ( d != NULL ) - close_socket( d ); - - return; - } - - act( "$n purges $N.", ch, NULL, victim, TO_NOTVICT ); - extract_char( victim, TRUE ); - return; -} - - - -void do_advance( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg1[MAX_INPUT_LENGTH]; - char arg2[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - int level; - int iLevel; - - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - - if ( arg1[0] == '\0' || arg2[0] == '\0' || !is_number( arg2 ) ) - { - send_to_char( "Syntax: advance .\n\r", ch ); - return; - } - - if ( ( victim = get_char_world( ch, arg1 ) ) == NULL ) - { - send_to_char( "That player is not here.\n\r", ch); - return; - } - - if ( IS_NPC(victim) ) - { - send_to_char( "Not on NPC's.\n\r", ch ); - return; - } - - if ( ( level = atoi( arg2 ) ) < 1 || level > MAX_LEVEL ) - { - sprintf(buf,"Level must be 1 to %d.\n\r", MAX_LEVEL); - send_to_char(buf, ch); - return; - } - - if ( level > get_trust( ch ) ) - { - send_to_char( "Limited to your trust level.\n\r", ch ); - return; - } - - /* - * Lower level: - * Reset to level 1. - * Then raise again. - * Currently, an imp can lower another imp. - * -- Swiftest - */ - if ( level <= victim->level ) - { - int temp_prac; - - send_to_char( "Lowering a player's level!\n\r", ch ); - send_to_char( "**** OOOOHHHHHHHHHH NNNNOOOO ****\n\r", victim ); - temp_prac = victim->practice; - victim->level = 1; - victim->exp = exp_per_level(victim,victim->pcdata->points); - victim->max_hit = 10; - victim->max_mana = 100; - victim->max_move = 100; - victim->practice = 0; - victim->hit = victim->max_hit; - victim->mana = victim->max_mana; - victim->move = victim->max_move; - advance_level( victim, TRUE ); - victim->practice = temp_prac; - } - else - { - send_to_char( "Raising a player's level!\n\r", ch ); - send_to_char( "**** OOOOHHHHHHHHHH YYYYEEEESSS ****\n\r", victim ); - } - - for ( iLevel = victim->level ; iLevel < level; iLevel++ ) - { - victim->level += 1; - advance_level( victim,TRUE); - } - sprintf(buf,"You are now level %d.\n\r",victim->level); - send_to_char(buf,victim); - victim->exp = exp_per_level(victim,victim->pcdata->points) - * UMAX( 1, victim->level ); - victim->trust = 0; - save_char_obj(victim); - return; -} - - - -void do_trust( CHAR_DATA *ch, char *argument ) -{ - char arg1[MAX_INPUT_LENGTH]; - char arg2[MAX_INPUT_LENGTH]; - char buf[MAX_STRING_LENGTH]; - CHAR_DATA *victim; - int level; - - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - - if ( arg1[0] == '\0' || arg2[0] == '\0' || !is_number( arg2 ) ) - { - send_to_char( "Syntax: trust .\n\r", ch ); - return; - } - - if ( ( victim = get_char_world( ch, arg1 ) ) == NULL ) - { - send_to_char( "That player is not here.\n\r", ch); - return; - } - - if ( ( level = atoi( arg2 ) ) < 0 || level > MAX_LEVEL ) - { - sprintf(buf, "Level must be 0 (reset) or 1 to %d.\n\r",MAX_LEVEL); - send_to_char(buf, ch); - return; - } - - if ( level > get_trust( ch ) ) - { - send_to_char( "Limited to your trust.\n\r", ch ); - return; - } - - victim->trust = level; - return; -} - - - -void do_restore( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH], buf[MAX_STRING_LENGTH]; - CHAR_DATA *victim; - CHAR_DATA *vch; - DESCRIPTOR_DATA *d; - - one_argument( argument, arg ); - if (arg[0] == '\0' || !str_cmp(arg,"room")) - { - /* cure room */ - - for (vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room) - { - affect_strip(vch,gsn_plague); - affect_strip(vch,gsn_poison); - affect_strip(vch,gsn_blindness); - affect_strip(vch,gsn_sleep); - affect_strip(vch,gsn_curse); - - vch->hit = vch->max_hit; - vch->mana = vch->max_mana; - vch->move = vch->max_move; - update_pos( vch); - act("$n has restored you.",ch,NULL,vch,TO_VICT); - } - - sprintf(buf,"$N restored room %d.",ch->in_room->vnum); - wiznet(buf,ch,NULL,WIZ_RESTORE,WIZ_SECURE,get_trust(ch)); - - send_to_char("Room restored.\n\r",ch); - return; - - } - - if ( get_trust(ch) >= MAX_LEVEL - 1 && !str_cmp(arg,"all")) - { - /* cure all */ - - for (d = descriptor_list; d != NULL; d = d->next) - { - victim = d->character; - - if (victim == NULL || IS_NPC(victim)) - continue; - - affect_strip(victim,gsn_plague); - affect_strip(victim,gsn_poison); - affect_strip(victim,gsn_blindness); - affect_strip(victim,gsn_sleep); - affect_strip(victim,gsn_curse); - - victim->hit = victim->max_hit; - victim->mana = victim->max_mana; - victim->move = victim->max_move; - update_pos( victim); - if (victim->in_room != NULL) - act("$n has restored you.",ch,NULL,victim,TO_VICT); - } - send_to_char("All active players restored.\n\r",ch); - return; - } - - if ( ( victim = get_char_world( ch, arg ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - - affect_strip(victim,gsn_plague); - affect_strip(victim,gsn_poison); - affect_strip(victim,gsn_blindness); - affect_strip(victim,gsn_sleep); - affect_strip(victim,gsn_curse); - victim->hit = victim->max_hit; - victim->mana = victim->max_mana; - victim->move = victim->max_move; - update_pos( victim ); - act( "$n has restored you.", ch, NULL, victim, TO_VICT ); - sprintf(buf,"$N restored %s", - IS_NPC(victim) ? victim->short_descr : victim->name); - wiznet(buf,ch,NULL,WIZ_RESTORE,WIZ_SECURE,get_trust(ch)); - send_to_char( "Ok.\n\r", ch ); - return; -} - - -void do_freeze( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH],buf[MAX_STRING_LENGTH]; - CHAR_DATA *victim; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Freeze 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; - } - - if ( IS_SET(victim->act, PLR_FREEZE) ) - { - REMOVE_BIT(victim->act, PLR_FREEZE); - send_to_char( "You can play again.\n\r", victim ); - send_to_char( "FREEZE removed.\n\r", ch ); - sprintf(buf,"$N thaws %s.",victim->name); - wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); - } - else - { - SET_BIT(victim->act, PLR_FREEZE); - send_to_char( "You can't do ANYthing!\n\r", victim ); - send_to_char( "FREEZE set.\n\r", ch ); - sprintf(buf,"$N puts %s in the deep freeze.",victim->name); - wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); - } - - save_char_obj( victim ); - - return; -} - - - -void do_log( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Log whom?\n\r", ch ); - return; - } - - if ( !str_cmp( arg, "all" ) ) - { - if ( fLogAll ) - { - fLogAll = FALSE; - send_to_char( "Log ALL off.\n\r", ch ); - } - else - { - fLogAll = TRUE; - send_to_char( "Log ALL on.\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; - } - - /* - * No level check, gods can log anyone. - */ - if ( IS_SET(victim->act, PLR_LOG) ) - { - REMOVE_BIT(victim->act, PLR_LOG); - send_to_char( "LOG removed.\n\r", ch ); - } - else - { - SET_BIT(victim->act, PLR_LOG); - send_to_char( "LOG set.\n\r", ch ); - } - - return; -} - - - -void do_noemote( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH],buf[MAX_STRING_LENGTH]; - CHAR_DATA *victim; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Noemote 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 ( get_trust( victim ) >= get_trust( ch ) ) - { - send_to_char( "You failed.\n\r", ch ); - return; - } - - if ( IS_SET(victim->comm, COMM_NOEMOTE) ) - { - REMOVE_BIT(victim->comm, COMM_NOEMOTE); - send_to_char( "You can emote again.\n\r", victim ); - send_to_char( "NOEMOTE removed.\n\r", ch ); - sprintf(buf,"$N restores emotes to %s.",victim->name); - wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); - } - else - { - SET_BIT(victim->comm, COMM_NOEMOTE); - send_to_char( "You can't emote!\n\r", victim ); - send_to_char( "NOEMOTE set.\n\r", ch ); - sprintf(buf,"$N revokes %s's emotes.",victim->name); - wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); - } - - return; -} - - - -void do_noshout( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH],buf[MAX_STRING_LENGTH]; - CHAR_DATA *victim; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Noshout 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; - } - - if ( IS_SET(victim->comm, COMM_NOSHOUT) ) - { - REMOVE_BIT(victim->comm, COMM_NOSHOUT); - send_to_char( "You can shout again.\n\r", victim ); - send_to_char( "NOSHOUT removed.\n\r", ch ); - sprintf(buf,"$N restores shouts to %s.",victim->name); - wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); - } - else - { - SET_BIT(victim->comm, COMM_NOSHOUT); - send_to_char( "You can't shout!\n\r", victim ); - send_to_char( "NOSHOUT set.\n\r", ch ); - sprintf(buf,"$N revokes %s's shouts.",victim->name); - wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); - } - - return; -} - - - -void do_notell( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH],buf[MAX_STRING_LENGTH]; - CHAR_DATA *victim; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Notell 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_NOTELL) ) - { - REMOVE_BIT(victim->comm, COMM_NOTELL); - send_to_char( "You can tell again.\n\r", victim ); - send_to_char( "NOTELL removed.\n\r", ch ); - sprintf(buf,"$N restores tells to %s.",victim->name); - wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); - } - else - { - SET_BIT(victim->comm, COMM_NOTELL); - send_to_char( "You can't tell!\n\r", victim ); - send_to_char( "NOTELL set.\n\r", ch ); - sprintf(buf,"$N revokes %s's tells.",victim->name); - wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); - } - - return; -} - - - -void do_peace( CHAR_DATA *ch, char *argument ) -{ - CHAR_DATA *rch; - - for ( rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room ) - { - if ( rch->fighting != NULL ) - stop_fighting( rch, TRUE ); - if (IS_NPC(rch) && IS_SET(rch->act,ACT_AGGRESSIVE)) - REMOVE_BIT(rch->act,ACT_AGGRESSIVE); - } - - send_to_char( "Ok.\n\r", ch ); - return; -} - -void do_wizlock( CHAR_DATA *ch, char *argument ) -{ - extern bool wizlock; - wizlock = !wizlock; - - if ( wizlock ) - { - wiznet("$N has wizlocked the game.",ch,NULL,0,0,0); - send_to_char( "Game wizlocked.\n\r", ch ); - } - else - { - wiznet("$N removes wizlock.",ch,NULL,0,0,0); - send_to_char( "Game un-wizlocked.\n\r", ch ); - } - - return; -} - -/* RT anti-newbie code */ - -void do_newlock( CHAR_DATA *ch, char *argument ) -{ - extern bool newlock; - newlock = !newlock; - - if ( newlock ) - { - wiznet("$N locks out new characters.",ch,NULL,0,0,0); - send_to_char( "New characters have been locked out.\n\r", ch ); - } - else - { - wiznet("$N allows new characters back in.",ch,NULL,0,0,0); - send_to_char( "Newlock removed.\n\r", ch ); - } - - return; -} - - -void do_slookup( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - int sn; - - one_argument( argument, arg ); - if ( arg[0] == '\0' ) - { - send_to_char( "Lookup which skill or spell?\n\r", ch ); - return; - } - - if ( !str_cmp( arg, "all" ) ) - { - for ( sn = 0; sn < MAX_SKILL; sn++ ) - { - if ( skill_table[sn].name == NULL ) - break; - sprintf( buf, "Sn: %3d Slot: %3d Skill/spell: '%s'\n\r", - sn, skill_table[sn].slot, skill_table[sn].name ); - send_to_char( buf, ch ); - } - } - else - { - if ( ( sn = skill_lookup( arg ) ) < 0 ) - { - send_to_char( "No such skill or spell.\n\r", ch ); - return; - } - - sprintf( buf, "Sn: %3d Slot: %3d Skill/spell: '%s'\n\r", - sn, skill_table[sn].slot, skill_table[sn].name ); - send_to_char( buf, ch ); - } - - return; -} - -/* RT set replaces sset, mset, oset, and rset */ - -void do_set( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - - argument = one_argument(argument,arg); - - if (arg[0] == '\0') - { - send_to_char("Syntax:\n\r",ch); - send_to_char(" set mob \n\r",ch); - send_to_char(" set obj \n\r",ch); - send_to_char(" set room \n\r",ch); - send_to_char(" set skill \n\r",ch); - return; - } - - if (!str_prefix(arg,"mobile") || !str_prefix(arg,"character")) - { - do_function(ch, &do_mset, argument); - return; - } - - if (!str_prefix(arg,"skill") || !str_prefix(arg,"spell")) - { - do_function(ch, &do_sset, argument); - return; - } - - if (!str_prefix(arg,"object")) - { - do_function(ch, &do_oset, argument); - return; - } - - if (!str_prefix(arg,"room")) - { - do_function(ch, &do_rset, argument); - return; - } - /* echo syntax */ - do_function(ch, &do_set, ""); -} - - -void do_sset( CHAR_DATA *ch, char *argument ) -{ - char arg1 [MAX_INPUT_LENGTH]; - char arg2 [MAX_INPUT_LENGTH]; - char arg3 [MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - int value; - int sn; - bool fAll; - - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - argument = one_argument( argument, arg3 ); - - if ( arg1[0] == '\0' || arg2[0] == '\0' || arg3[0] == '\0' ) - { - send_to_char( "Syntax:\n\r",ch); - send_to_char( " set skill \n\r", ch); - send_to_char( " set skill all \n\r",ch); - send_to_char(" (use the name of the skill, not the number)\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; - } - - fAll = !str_cmp( arg2, "all" ); - sn = 0; - if ( !fAll && ( sn = skill_lookup( arg2 ) ) < 0 ) - { - send_to_char( "No such skill or spell.\n\r", ch ); - return; - } - - /* - * Snarf the value. - */ - if ( !is_number( arg3 ) ) - { - send_to_char( "Value must be numeric.\n\r", ch ); - return; - } - - value = atoi( arg3 ); - if ( value < 0 || value > 100 ) - { - send_to_char( "Value range is 0 to 100.\n\r", ch ); - return; - } - - if ( fAll ) - { - for ( sn = 0; sn < MAX_SKILL; sn++ ) - { - if ( skill_table[sn].name != NULL ) - victim->pcdata->learned[sn] = value; - } - } - else - { - victim->pcdata->learned[sn] = value; - } - - return; -} - - -void do_mset( CHAR_DATA *ch, char *argument ) -{ - char arg1 [MAX_INPUT_LENGTH]; - char arg2 [MAX_INPUT_LENGTH]; - char arg3 [MAX_INPUT_LENGTH]; - char buf[100]; - CHAR_DATA *victim; - int value; - - smash_tilde( argument ); - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - strcpy( arg3, argument ); - - if ( arg1[0] == '\0' || arg2[0] == '\0' || arg3[0] == '\0' ) - { - send_to_char("Syntax:\n\r",ch); - send_to_char(" set char \n\r",ch); - send_to_char( " Field being one of:\n\r", ch ); - send_to_char( " str int wis dex con sex class level\n\r", ch ); - send_to_char( " race group gold silver hp mana move prac\n\r",ch); - send_to_char( " align train thirst hunger drunk full\n\r", ch ); - return; - } - - if ( ( victim = get_char_world( ch, arg1 ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - - /* clear zones for mobs */ - victim->zone = NULL; - - /* - * Snarf the value (which need not be numeric). - */ - value = is_number( arg3 ) ? atoi( arg3 ) : -1; - - /* - * Set something. - */ - if ( !str_cmp( arg2, "str" ) ) - { - if ( value < 3 || value > get_max_train(victim,STAT_STR) ) - { - sprintf(buf, - "Strength range is 3 to %d\n\r.", - get_max_train(victim,STAT_STR)); - send_to_char(buf,ch); - return; - } - - victim->perm_stat[STAT_STR] = value; - return; - } - - if ( !str_cmp( arg2, "int" ) ) - { - if ( value < 3 || value > get_max_train(victim,STAT_INT) ) - { - sprintf(buf, - "Intelligence range is 3 to %d.\n\r", - get_max_train(victim,STAT_INT)); - send_to_char(buf,ch); - return; - } - - victim->perm_stat[STAT_INT] = value; - return; - } - - if ( !str_cmp( arg2, "wis" ) ) - { - if ( value < 3 || value > get_max_train(victim,STAT_WIS) ) - { - sprintf(buf, - "Wisdom range is 3 to %d.\n\r",get_max_train(victim,STAT_WIS)); - send_to_char( buf, ch ); - return; - } - - victim->perm_stat[STAT_WIS] = value; - return; - } - - if ( !str_cmp( arg2, "dex" ) ) - { - if ( value < 3 || value > get_max_train(victim,STAT_DEX) ) - { - sprintf(buf, - "Dexterity range is 3 to %d.\n\r", - get_max_train(victim,STAT_DEX)); - send_to_char( buf, ch ); - return; - } - - victim->perm_stat[STAT_DEX] = value; - return; - } - - if ( !str_cmp( arg2, "con" ) ) - { - if ( value < 3 || value > get_max_train(victim,STAT_CON) ) - { - sprintf(buf, - "Constitution range is 3 to %d.\n\r", - get_max_train(victim,STAT_CON)); - send_to_char( buf, ch ); - return; - } - - victim->perm_stat[STAT_CON] = value; - return; - } - - if ( !str_prefix( arg2, "sex" ) ) - { - if ( value < 0 || value > 2 ) - { - send_to_char( "Sex range is 0 to 2.\n\r", ch ); - return; - } - victim->sex = value; - if (!IS_NPC(victim)) - victim->pcdata->true_sex = value; - return; - } - - if ( !str_prefix( arg2, "class" ) ) - { - int class; - - if (IS_NPC(victim)) - { - send_to_char("Mobiles have no class.\n\r",ch); - return; - } - - class = class_lookup(arg3); - if ( class == -1 ) - { - char buf[MAX_STRING_LENGTH]; - - strcpy( buf, "Possible classes are: " ); - for ( class = 0; class < MAX_CLASS; class++ ) - { - if ( class > 0 ) - strcat( buf, " " ); - strcat( buf, class_table[class].name ); - } - strcat( buf, ".\n\r" ); - - send_to_char(buf,ch); - return; - } - - victim->class = class; - return; - } - - if ( !str_prefix( arg2, "level" ) ) - { - if ( !IS_NPC(victim) ) - { - send_to_char( "Not on PC's.\n\r", ch ); - return; - } - - if ( value < 0 || value > MAX_LEVEL ) - { - sprintf(buf, "Level range is 0 to %d.\n\r", MAX_LEVEL); - send_to_char(buf, ch); - return; - } - victim->level = value; - return; - } - - if ( !str_prefix( arg2, "gold" ) ) - { - victim->gold = value; - return; - } - - if ( !str_prefix(arg2, "silver" ) ) - { - victim->silver = value; - return; - } - - if ( !str_prefix( arg2, "hp" ) ) - { - if ( value < -10 || value > 30000 ) - { - send_to_char( "Hp range is -10 to 30,000 hit points.\n\r", ch ); - return; - } - victim->max_hit = value; - if (!IS_NPC(victim)) - victim->pcdata->perm_hit = value; - return; - } - - if ( !str_prefix( arg2, "mana" ) ) - { - if ( value < 0 || value > 30000 ) - { - send_to_char( "Mana range is 0 to 30,000 mana points.\n\r", ch ); - return; - } - victim->max_mana = value; - if (!IS_NPC(victim)) - victim->pcdata->perm_mana = value; - return; - } - - if ( !str_prefix( arg2, "move" ) ) - { - if ( value < 0 || value > 30000 ) - { - send_to_char( "Move range is 0 to 30,000 move points.\n\r", ch ); - return; - } - victim->max_move = value; - if (!IS_NPC(victim)) - victim->pcdata->perm_move = value; - return; - } - - if ( !str_prefix( arg2, "practice" ) ) - { - if ( value < 0 || value > 250 ) - { - send_to_char( "Practice range is 0 to 250 sessions.\n\r", ch ); - return; - } - victim->practice = value; - return; - } - - if ( !str_prefix( arg2, "train" )) - { - if (value < 0 || value > 50 ) - { - send_to_char("Training session range is 0 to 50 sessions.\n\r",ch); - return; - } - victim->train = value; - return; - } - - if ( !str_prefix( arg2, "align" ) ) - { - if ( value < -1000 || value > 1000 ) - { - send_to_char( "Alignment range is -1000 to 1000.\n\r", ch ); - return; - } - victim->alignment = value; - return; - } - - if ( !str_prefix( arg2, "thirst" ) ) - { - if ( IS_NPC(victim) ) - { - send_to_char( "Not on NPC's.\n\r", ch ); - return; - } - - if ( value < -1 || value > 100 ) - { - send_to_char( "Thirst range is -1 to 100.\n\r", ch ); - return; - } - - victim->pcdata->condition[COND_THIRST] = value; - return; - } - - if ( !str_prefix( arg2, "drunk" ) ) - { - if ( IS_NPC(victim) ) - { - send_to_char( "Not on NPC's.\n\r", ch ); - return; - } - - if ( value < -1 || value > 100 ) - { - send_to_char( "Drunk range is -1 to 100.\n\r", ch ); - return; - } - - victim->pcdata->condition[COND_DRUNK] = value; - return; - } - - if ( !str_prefix( arg2, "full" ) ) - { - if ( IS_NPC(victim) ) - { - send_to_char( "Not on NPC's.\n\r", ch ); - return; - } - - if ( value < -1 || value > 100 ) - { - send_to_char( "Full range is -1 to 100.\n\r", ch ); - return; - } - - victim->pcdata->condition[COND_FULL] = value; - return; - } - - if ( !str_prefix( arg2, "hunger" ) ) - { - if ( IS_NPC(victim) ) - { - send_to_char( "Not on NPC's.\n\r", ch ); - return; - } - - if ( value < -1 || value > 100 ) - { - send_to_char( "Full range is -1 to 100.\n\r", ch ); - return; - } - - victim->pcdata->condition[COND_HUNGER] = value; - return; - } - - if (!str_prefix( arg2, "race" ) ) - { - int race; - - race = race_lookup(arg3); - - if ( race == 0) - { - send_to_char("That is not a valid race.\n\r",ch); - return; - } - - if (!IS_NPC(victim) && !race_table[race].pc_race) - { - send_to_char("That is not a valid player race.\n\r",ch); - return; - } - - victim->race = race; - return; - } - - if (!str_prefix(arg2,"group")) - { - if (!IS_NPC(victim)) - { - send_to_char("Only on NPCs.\n\r",ch); - return; - } - victim->group = value; - return; - } - - - /* - * Generate usage message. - */ - do_function(ch, &do_mset, "" ); - return; -} - -void do_string( CHAR_DATA *ch, char *argument ) -{ - char type [MAX_INPUT_LENGTH]; - char arg1 [MAX_INPUT_LENGTH]; - char arg2 [MAX_INPUT_LENGTH]; - char arg3 [MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - OBJ_DATA *obj; - - smash_tilde( argument ); - argument = one_argument( argument, type ); - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - strcpy( arg3, argument ); - - if ( type[0] == '\0' || arg1[0] == '\0' || arg2[0] == '\0' || arg3[0] == '\0' ) - { - send_to_char("Syntax:\n\r",ch); - send_to_char(" string char \n\r",ch); - send_to_char(" fields: name short long desc title spec\n\r",ch); - send_to_char(" string obj \n\r",ch); - send_to_char(" fields: name short long extended\n\r",ch); - return; - } - - if (!str_prefix(type,"character") || !str_prefix(type,"mobile")) - { - if ( ( victim = get_char_world( ch, arg1 ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - - /* clear zone for mobs */ - victim->zone = NULL; - - /* string something */ - - if ( !str_prefix( arg2, "name" ) ) - { - if ( !IS_NPC(victim) ) - { - send_to_char( "Not on PC's.\n\r", ch ); - return; - } - free_string( victim->name ); - victim->name = str_dup( arg3 ); - return; - } - - if ( !str_prefix( arg2, "description" ) ) - { - free_string(victim->description); - victim->description = str_dup(arg3); - return; - } - - if ( !str_prefix( arg2, "short" ) ) - { - free_string( victim->short_descr ); - victim->short_descr = str_dup( arg3 ); - return; - } - - if ( !str_prefix( arg2, "long" ) ) - { - free_string( victim->long_descr ); - strcat(arg3,"\n\r"); - victim->long_descr = str_dup( arg3 ); - return; - } - - if ( !str_prefix( arg2, "title" ) ) - { - if ( IS_NPC(victim) ) - { - send_to_char( "Not on NPC's.\n\r", ch ); - return; - } - - set_title( victim, arg3 ); - return; - } - - if ( !str_prefix( arg2, "spec" ) ) - { - if ( !IS_NPC(victim) ) - { - send_to_char( "Not on PC's.\n\r", ch ); - return; - } - - if ( ( victim->spec_fun = spec_lookup( arg3 ) ) == 0 ) - { - send_to_char( "No such spec fun.\n\r", ch ); - return; - } - - return; - } - } - - if (!str_prefix(type,"object")) - { - /* string an obj */ - - if ( ( obj = get_obj_world( ch, arg1 ) ) == NULL ) - { - send_to_char( "Nothing like that in heaven or earth.\n\r", ch ); - return; - } - - if ( !str_prefix( arg2, "name" ) ) - { - free_string( obj->name ); - obj->name = str_dup( arg3 ); - return; - } - - if ( !str_prefix( arg2, "short" ) ) - { - free_string( obj->short_descr ); - obj->short_descr = str_dup( arg3 ); - return; - } - - if ( !str_prefix( arg2, "long" ) ) - { - free_string( obj->description ); - obj->description = str_dup( arg3 ); - return; - } - - if ( !str_prefix( arg2, "ed" ) || !str_prefix( arg2, "extended")) - { - EXTRA_DESCR_DATA *ed; - - argument = one_argument( argument, arg3 ); - if ( argument == NULL ) - { - send_to_char( "Syntax: oset ed \n\r", - ch ); - return; - } - - strcat(argument,"\n\r"); - - ed = new_extra_descr(); - - ed->keyword = str_dup( arg3 ); - ed->description = str_dup( argument ); - ed->next = obj->extra_descr; - obj->extra_descr = ed; - return; - } - } - - - /* echo bad use message */ - do_function(ch, &do_string, ""); -} - - - -void do_oset( CHAR_DATA *ch, char *argument ) -{ - char arg1 [MAX_INPUT_LENGTH]; - char arg2 [MAX_INPUT_LENGTH]; - char arg3 [MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - int value; - - smash_tilde( argument ); - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - strcpy( arg3, argument ); - - if ( arg1[0] == '\0' || arg2[0] == '\0' || arg3[0] == '\0' ) - { - send_to_char("Syntax:\n\r",ch); - send_to_char(" set obj \n\r",ch); - send_to_char(" Field being one of:\n\r", ch ); - send_to_char(" value0 value1 value2 value3 value4 (v1-v4)\n\r", ch ); - send_to_char(" extra wear level weight cost timer\n\r", ch ); - return; - } - - if ( ( obj = get_obj_world( ch, arg1 ) ) == NULL ) - { - send_to_char( "Nothing like that in heaven or earth.\n\r", ch ); - return; - } - - /* - * Snarf the value (which need not be numeric). - */ - value = atoi( arg3 ); - - /* - * Set something. - */ - if ( !str_cmp( arg2, "value0" ) || !str_cmp( arg2, "v0" ) ) - { - obj->value[0] = UMIN(50,value); - return; - } - - if ( !str_cmp( arg2, "value1" ) || !str_cmp( arg2, "v1" ) ) - { - obj->value[1] = value; - return; - } - - if ( !str_cmp( arg2, "value2" ) || !str_cmp( arg2, "v2" ) ) - { - obj->value[2] = value; - return; - } - - if ( !str_cmp( arg2, "value3" ) || !str_cmp( arg2, "v3" ) ) - { - obj->value[3] = value; - return; - } - - if ( !str_cmp( arg2, "value4" ) || !str_cmp( arg2, "v4" ) ) - { - obj->value[4] = value; - return; - } - - if ( !str_prefix( arg2, "extra" ) ) - { - obj->extra_flags = value; - return; - } - - if ( !str_prefix( arg2, "wear" ) ) - { - obj->wear_flags = value; - return; - } - - if ( !str_prefix( arg2, "level" ) ) - { - obj->level = value; - return; - } - - if ( !str_prefix( arg2, "weight" ) ) - { - obj->weight = value; - return; - } - - if ( !str_prefix( arg2, "cost" ) ) - { - obj->cost = value; - return; - } - - if ( !str_prefix( arg2, "timer" ) ) - { - obj->timer = value; - return; - } - - /* - * Generate usage message. - */ - do_function(ch, &do_oset, "" ); - return; -} - - - -void do_rset( CHAR_DATA *ch, char *argument ) -{ - char arg1 [MAX_INPUT_LENGTH]; - char arg2 [MAX_INPUT_LENGTH]; - char arg3 [MAX_INPUT_LENGTH]; - ROOM_INDEX_DATA *location; - int value; - - smash_tilde( argument ); - argument = one_argument( argument, arg1 ); - argument = one_argument( argument, arg2 ); - strcpy( arg3, argument ); - - if ( arg1[0] == '\0' || arg2[0] == '\0' || arg3[0] == '\0' ) - { - send_to_char( "Syntax:\n\r",ch); - send_to_char( " set room \n\r",ch); - send_to_char( " Field being one of:\n\r", ch ); - send_to_char( " flags sector\n\r", ch ); - return; - } - - if ( ( location = find_location( ch, arg1 ) ) == NULL ) - { - send_to_char( "No such location.\n\r", ch ); - return; - } - - if (!is_room_owner(ch,location) && 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; - } - - /* - * Snarf the value. - */ - if ( !is_number( arg3 ) ) - { - send_to_char( "Value must be numeric.\n\r", ch ); - return; - } - value = atoi( arg3 ); - - /* - * Set something. - */ - if ( !str_prefix( arg2, "flags" ) ) - { - location->room_flags = value; - return; - } - - if ( !str_prefix( arg2, "sector" ) ) - { - location->sector_type = value; - return; - } - - /* - * Generate usage message. - */ - do_function(ch, &do_rset, ""); - return; -} - - - -void do_sockets( CHAR_DATA *ch, char *argument ) -{ - char buf[2 * MAX_STRING_LENGTH]; - char buf2[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - DESCRIPTOR_DATA *d; - int count; - - count = 0; - buf[0] = '\0'; - - one_argument(argument,arg); - for ( d = descriptor_list; d != NULL; d = d->next ) - { - if ( d->character != NULL && can_see( ch, d->character ) - && (arg[0] == '\0' || is_name(arg,d->character->name) - || (d->original && is_name(arg,d->original->name)))) - { - count++; - sprintf( buf + strlen(buf), "[%3d %2d] %s@%s\n\r", - d->descriptor, - d->connected, - d->original ? d->original->name : - d->character ? d->character->name : "(none)", - d->host - ); - } - } - if (count == 0) - { - send_to_char("No one by that name is connected.\n\r",ch); - return; - } - - sprintf( buf2, "%d user%s\n\r", count, count == 1 ? "" : "s" ); - strcat(buf,buf2); - page_to_char( buf, ch ); - return; -} - - - -/* - * Thanks to Grodyn for pointing out bugs in this function. - */ -void do_force( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - char arg2[MAX_INPUT_LENGTH]; - - argument = one_argument( argument, arg ); - - if ( arg[0] == '\0' || argument[0] == '\0' ) - { - send_to_char( "Force whom to do what?\n\r", ch ); - return; - } - - one_argument(argument,arg2); - - if (!str_cmp(arg2,"delete")) - { - send_to_char("That will NOT be done.\n\r",ch); - return; - } - - sprintf( buf, "$n forces you to '%s'.", argument ); - - if ( !str_cmp( arg, "all" ) ) - { - CHAR_DATA *vch; - CHAR_DATA *vch_next; - - if (get_trust(ch) < MAX_LEVEL - 3) - { - send_to_char("Not at your level!\n\r",ch); - return; - } - - for ( vch = char_list; vch != NULL; vch = vch_next ) - { - vch_next = vch->next; - - if ( !IS_NPC(vch) && get_trust( vch ) < get_trust( ch ) ) - { - act( buf, ch, NULL, vch, TO_VICT ); - interpret( vch, argument ); - } - } - } - else if (!str_cmp(arg,"players")) - { - CHAR_DATA *vch; - CHAR_DATA *vch_next; - - if (get_trust(ch) < MAX_LEVEL - 2) - { - send_to_char("Not at your level!\n\r",ch); - return; - } - - for ( vch = char_list; vch != NULL; vch = vch_next ) - { - vch_next = vch->next; - - if ( !IS_NPC(vch) && get_trust( vch ) < get_trust( ch ) - && vch->level < LEVEL_HERO) - { - act( buf, ch, NULL, vch, TO_VICT ); - interpret( vch, argument ); - } - } - } - else if (!str_cmp(arg,"gods")) - { - CHAR_DATA *vch; - CHAR_DATA *vch_next; - - if (get_trust(ch) < MAX_LEVEL - 2) - { - send_to_char("Not at your level!\n\r",ch); - return; - } - - for ( vch = char_list; vch != NULL; vch = vch_next ) - { - vch_next = vch->next; - - if ( !IS_NPC(vch) && get_trust( vch ) < get_trust( ch ) - && vch->level >= LEVEL_HERO) - { - act( buf, ch, NULL, vch, TO_VICT ); - interpret( vch, argument ); - } - } - } - else - { - CHAR_DATA *victim; - - 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( "Aye aye, right away!\n\r", 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)) - { - send_to_char("That character is in a private room.\n\r",ch); - return; - } - - if ( get_trust( victim ) >= get_trust( ch ) ) - { - send_to_char( "Do it yourself!\n\r", ch ); - return; - } - - if ( !IS_NPC(victim) && get_trust(ch) < MAX_LEVEL -3) - { - send_to_char("Not at your level!\n\r",ch); - return; - } - - act( buf, ch, NULL, victim, TO_VICT ); - interpret( victim, argument ); - } - - send_to_char( "Ok.\n\r", ch ); - return; -} - - - -/* - * New routines by Dionysos. - */ -void do_invis( CHAR_DATA *ch, char *argument ) -{ - int level; - char arg[MAX_STRING_LENGTH]; - - /* RT code for taking a level argument */ - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - /* take the default path */ - - if ( ch->invis_level) - { - ch->invis_level = 0; - act( "$n slowly fades into existence.", ch, NULL, NULL, TO_ROOM ); - send_to_char( "You slowly fade back into existence.\n\r", ch ); - } - else - { - ch->invis_level = get_trust(ch); - act( "$n slowly fades into thin air.", ch, NULL, NULL, TO_ROOM ); - send_to_char( "You slowly vanish into thin air.\n\r", ch ); - } - else - /* do the level thing */ - { - level = atoi(arg); - if (level < 2 || level > get_trust(ch)) - { - send_to_char("Invis level must be between 2 and your level.\n\r",ch); - return; - } - else - { - ch->reply = NULL; - ch->invis_level = level; - act( "$n slowly fades into thin air.", ch, NULL, NULL, TO_ROOM ); - send_to_char( "You slowly vanish into thin air.\n\r", ch ); - } - } - - return; -} - - -void do_incognito( CHAR_DATA *ch, char *argument ) -{ - int level; - char arg[MAX_STRING_LENGTH]; - - /* RT code for taking a level argument */ - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - /* take the default path */ - - if ( ch->incog_level) - { - ch->incog_level = 0; - act( "$n is no longer cloaked.", ch, NULL, NULL, TO_ROOM ); - send_to_char( "You are no longer cloaked.\n\r", ch ); - } - else - { - ch->incog_level = get_trust(ch); - act( "$n cloaks $s presence.", ch, NULL, NULL, TO_ROOM ); - send_to_char( "You cloak your presence.\n\r", ch ); - } - else - /* do the level thing */ - { - level = atoi(arg); - if (level < 2 || level > get_trust(ch)) - { - send_to_char("Incog level must be between 2 and your level.\n\r",ch); - return; - } - else - { - ch->reply = NULL; - ch->incog_level = level; - act( "$n cloaks $s presence.", ch, NULL, NULL, TO_ROOM ); - send_to_char( "You cloak your presence.\n\r", ch ); - } - } - - return; -} - - - -void do_holylight( CHAR_DATA *ch, char *argument ) -{ - if ( IS_NPC(ch) ) - return; - - if ( IS_SET(ch->act, PLR_HOLYLIGHT) ) - { - REMOVE_BIT(ch->act, PLR_HOLYLIGHT); - send_to_char( "Holy light mode off.\n\r", ch ); - } - else - { - SET_BIT(ch->act, PLR_HOLYLIGHT); - send_to_char( "Holy light mode on.\n\r", ch ); - } - - return; -} - -/* prefix command: it will put the string typed on each line typed */ - -void do_prefi (CHAR_DATA *ch, char *argument) -{ - send_to_char("You cannot abbreviate the prefix command.\r\n",ch); - return; -} - -void do_prefix (CHAR_DATA *ch, char *argument) -{ - char buf[MAX_INPUT_LENGTH]; - - if (argument[0] == '\0') - { - if (ch->prefix[0] == '\0') - { - send_to_char("You have no prefix to clear.\r\n",ch); - return; - } - - send_to_char("Prefix removed.\r\n",ch); - free_string(ch->prefix); - ch->prefix = str_dup(""); - return; - } - - if (ch->prefix[0] != '\0') - { - sprintf(buf,"Prefix changed to %s.\r\n",argument); - free_string(ch->prefix); - } - else - { - sprintf(buf,"Prefix set to %s.\r\n",argument); - } - - ch->prefix = str_dup(argument); -} diff --git a/archive/src/alias.c b/archive/src/alias.c deleted file mode 100644 index 8f1fa6f..0000000 --- a/archive/src/alias.c +++ /dev/null @@ -1,273 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#endif -#include -#include -#include -#include "merc.h" - -/* does aliasing and other fun stuff */ -void substitute_alias(DESCRIPTOR_DATA *d, char *argument) -{ - CHAR_DATA *ch; - char buf[MAX_STRING_LENGTH],prefix[MAX_INPUT_LENGTH],name[MAX_INPUT_LENGTH]; - char *point; - int alias; - - ch = d->original ? d->original : d->character; - - /* check for prefix */ - if (ch->prefix[0] != '\0' && str_prefix("prefix",argument)) - { - if (strlen(ch->prefix) + strlen(argument) > MAX_INPUT_LENGTH) - send_to_char("Line to long, prefix not processed.\r\n",ch); - else - { - sprintf(prefix,"%s %s",ch->prefix,argument); - argument = prefix; - } - } - - if (IS_NPC(ch) || ch->pcdata->alias[0] == NULL - || !str_prefix("alias",argument) || !str_prefix("una",argument) - || !str_prefix("prefix",argument)) - { - interpret(d->character,argument); - return; - } - - strcpy(buf,argument); - - for (alias = 0; alias < MAX_ALIAS; alias++) /* go through the aliases */ - { - if (ch->pcdata->alias[alias] == NULL) - break; - - if (!str_prefix(ch->pcdata->alias[alias],argument)) - { - point = one_argument(argument,name); - if (!strcmp(ch->pcdata->alias[alias],name)) - { - buf[0] = '\0'; - strcat(buf,ch->pcdata->alias_sub[alias]); - strcat(buf," "); - strcat(buf,point); - - if (strlen(buf) > MAX_INPUT_LENGTH - 1) - { - send_to_char( - "Alias substitution too long. Truncated.\r\n",ch); - buf[MAX_INPUT_LENGTH -1] = '\0'; - } - break; - } - } - } - interpret(d->character,buf); -} - -void do_alia(CHAR_DATA *ch, char *argument) -{ - send_to_char("I'm sorry, alias must be entered in full.\n\r",ch); - return; -} - -void do_alias(CHAR_DATA *ch, char *argument) -{ - CHAR_DATA *rch; - char arg[MAX_INPUT_LENGTH],buf[MAX_STRING_LENGTH]; - int pos; - - smash_tilde(argument); - - if (ch->desc == NULL) - rch = ch; - else - rch = ch->desc->original ? ch->desc->original : ch; - - if (IS_NPC(rch)) - return; - - argument = one_argument(argument,arg); - - - if (arg[0] == '\0') - { - - if (rch->pcdata->alias[0] == NULL) - { - send_to_char("You have no aliases defined.\n\r",ch); - return; - } - send_to_char("Your current aliases are:\n\r",ch); - - for (pos = 0; pos < MAX_ALIAS; pos++) - { - if (rch->pcdata->alias[pos] == NULL - || rch->pcdata->alias_sub[pos] == NULL) - break; - - sprintf(buf," %s: %s\n\r",rch->pcdata->alias[pos], - rch->pcdata->alias_sub[pos]); - send_to_char(buf,ch); - } - return; - } - - if (!str_prefix("una",arg) || !str_cmp("alias",arg)) - { - send_to_char("Sorry, that word is reserved.\n\r",ch); - return; - } - - if (argument[0] == '\0') - { - for (pos = 0; pos < MAX_ALIAS; pos++) - { - if (rch->pcdata->alias[pos] == NULL - || rch->pcdata->alias_sub[pos] == NULL) - break; - - if (!str_cmp(arg,rch->pcdata->alias[pos])) - { - sprintf(buf,"%s aliases to '%s'.\n\r",rch->pcdata->alias[pos], - rch->pcdata->alias_sub[pos]); - send_to_char(buf,ch); - return; - } - } - - send_to_char("That alias is not defined.\n\r",ch); - return; - } - - if (!str_prefix(argument,"delete") || !str_prefix(argument,"prefix")) - { - send_to_char("That shall not be done!\n\r",ch); - return; - } - - for (pos = 0; pos < MAX_ALIAS; pos++) - { - if (rch->pcdata->alias[pos] == NULL) - break; - - if (!str_cmp(arg,rch->pcdata->alias[pos])) /* redefine an alias */ - { - free_string(rch->pcdata->alias_sub[pos]); - rch->pcdata->alias_sub[pos] = str_dup(argument); - sprintf(buf,"%s is now realiased to '%s'.\n\r",arg,argument); - send_to_char(buf,ch); - return; - } - } - - if (pos >= MAX_ALIAS) - { - send_to_char("Sorry, you have reached the alias limit.\n\r",ch); - return; - } - - /* make a new alias */ - rch->pcdata->alias[pos] = str_dup(arg); - rch->pcdata->alias_sub[pos] = str_dup(argument); - sprintf(buf,"%s is now aliased to '%s'.\n\r",arg,argument); - send_to_char(buf,ch); -} - - -void do_unalias(CHAR_DATA *ch, char *argument) -{ - CHAR_DATA *rch; - char arg[MAX_INPUT_LENGTH]; - int pos; - bool found = FALSE; - - if (ch->desc == NULL) - rch = ch; - else - rch = ch->desc->original ? ch->desc->original : ch; - - if (IS_NPC(rch)) - return; - - argument = one_argument(argument,arg); - - if (arg[0] == '\0') - { - send_to_char("Unalias what?\n\r",ch); - return; - } - - for (pos = 0; pos < MAX_ALIAS; pos++) - { - if (rch->pcdata->alias[pos] == NULL) - break; - - if (found) - { - rch->pcdata->alias[pos-1] = rch->pcdata->alias[pos]; - rch->pcdata->alias_sub[pos-1] = rch->pcdata->alias_sub[pos]; - rch->pcdata->alias[pos] = NULL; - rch->pcdata->alias_sub[pos] = NULL; - continue; - } - - if(!strcmp(arg,rch->pcdata->alias[pos])) - { - send_to_char("Alias removed.\n\r",ch); - free_string(rch->pcdata->alias[pos]); - free_string(rch->pcdata->alias_sub[pos]); - rch->pcdata->alias[pos] = NULL; - rch->pcdata->alias_sub[pos] = NULL; - found = TRUE; - } - } - - if (!found) - send_to_char("No alias of that name to remove.\n\r",ch); -} - - - - - - - - - - - - - - - diff --git a/archive/src/ban.c b/archive/src/ban.c deleted file mode 100644 index 4656d10..0000000 --- a/archive/src/ban.c +++ /dev/null @@ -1,309 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#include -#else -#include -#include -#endif -#include -#include -#include -#include -#include "merc.h" -#include "recycle.h" - -BAN_DATA *ban_list; - -void save_bans(void) -{ - BAN_DATA *pban; - FILE *fp; - bool found = FALSE; - - fclose( fpReserve ); - if ( ( fp = fopen( BAN_FILE, "w" ) ) == NULL ) - { - perror( BAN_FILE ); - } - - for (pban = ban_list; pban != NULL; pban = pban->next) - { - if (IS_SET(pban->ban_flags,BAN_PERMANENT)) - { - found = TRUE; - fprintf(fp,"%-20s %-2d %s\n",pban->name,pban->level, - print_flags(pban->ban_flags)); - } - } - - fclose(fp); - fpReserve = fopen( NULL_FILE, "r" ); - if (!found) - unlink(BAN_FILE); -} - -void load_bans(void) -{ - FILE *fp; - BAN_DATA *ban_last; - - if ( ( fp = fopen( BAN_FILE, "r" ) ) == NULL ) - return; - - ban_last = NULL; - for ( ; ; ) - { - BAN_DATA *pban; - if ( feof(fp) ) - { - fclose( fp ); - return; - } - - pban = new_ban(); - - pban->name = str_dup(fread_word(fp)); - pban->level = fread_number(fp); - pban->ban_flags = fread_flag(fp); - fread_to_eol(fp); - - if (ban_list == NULL) - ban_list = pban; - else - ban_last->next = pban; - ban_last = pban; - } -} - -bool check_ban(char *site,int type) -{ - BAN_DATA *pban; - char host[MAX_STRING_LENGTH]; - - strcpy(host,capitalize(site)); - host[0] = LOWER(host[0]); - - for ( pban = ban_list; pban != NULL; pban = pban->next ) - { - if(!IS_SET(pban->ban_flags,type)) - continue; - - if (IS_SET(pban->ban_flags,BAN_PREFIX) - && IS_SET(pban->ban_flags,BAN_SUFFIX) - && strstr(pban->name,host) != NULL) - return TRUE; - - if (IS_SET(pban->ban_flags,BAN_PREFIX) - && !str_suffix(pban->name,host)) - return TRUE; - - if (IS_SET(pban->ban_flags,BAN_SUFFIX) - && !str_prefix(pban->name,host)) - return TRUE; - } - - return FALSE; -} - - -void ban_site(CHAR_DATA *ch, char *argument, bool fPerm) -{ - char buf[MAX_STRING_LENGTH],buf2[MAX_STRING_LENGTH]; - char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH]; - char *name; - BUFFER *buffer; - BAN_DATA *pban, *prev; - bool prefix = FALSE,suffix = FALSE; - int type; - - argument = one_argument(argument,arg1); - argument = one_argument(argument,arg2); - - if ( arg1[0] == '\0' ) - { - if (ban_list == NULL) - { - send_to_char("No sites banned at this time.\n\r",ch); - return; - } - buffer = new_buf(); - - add_buf(buffer,"Banned sites level type status\n\r"); - for (pban = ban_list;pban != NULL;pban = pban->next) - { - sprintf(buf2,"%s%s%s", - IS_SET(pban->ban_flags,BAN_PREFIX) ? "*" : "", - pban->name, - IS_SET(pban->ban_flags,BAN_SUFFIX) ? "*" : ""); - sprintf(buf,"%-12s %-3d %-7s %s\n\r", - buf2, pban->level, - IS_SET(pban->ban_flags,BAN_NEWBIES) ? "newbies" : - IS_SET(pban->ban_flags,BAN_PERMIT) ? "permit" : - IS_SET(pban->ban_flags,BAN_ALL) ? "all" : "", - IS_SET(pban->ban_flags,BAN_PERMANENT) ? "perm" : "temp"); - add_buf(buffer,buf); - } - - page_to_char( buf_string(buffer), ch ); - free_buf(buffer); - return; - } - - /* find out what type of ban */ - if (arg2[0] == '\0' || !str_prefix(arg2,"all")) - type = BAN_ALL; - else if (!str_prefix(arg2,"newbies")) - type = BAN_NEWBIES; - else if (!str_prefix(arg2,"permit")) - type = BAN_PERMIT; - else - { - send_to_char("Acceptable ban types are all, newbies, and permit.\n\r", - ch); - return; - } - - name = arg1; - - if (name[0] == '*') - { - prefix = TRUE; - name++; - } - - if (name[strlen(name) - 1] == '*') - { - suffix = TRUE; - name[strlen(name) - 1] = '\0'; - } - - if (strlen(name) == 0) - { - send_to_char("You have to ban SOMETHING.\n\r",ch); - return; - } - - prev = NULL; - for ( pban = ban_list; pban != NULL; prev = pban, pban = pban->next ) - { - if (!str_cmp(name,pban->name)) - { - if (pban->level > get_trust(ch)) - { - send_to_char( "That ban was set by a higher power.\n\r", ch ); - return; - } - else - { - if (prev == NULL) - ban_list = pban->next; - else - prev->next = pban->next; - free_ban(pban); - } - } - } - - pban = new_ban(); - pban->name = str_dup(name); - pban->level = get_trust(ch); - - /* set ban type */ - pban->ban_flags = type; - - if (prefix) - SET_BIT(pban->ban_flags,BAN_PREFIX); - if (suffix) - SET_BIT(pban->ban_flags,BAN_SUFFIX); - if (fPerm) - SET_BIT(pban->ban_flags,BAN_PERMANENT); - - pban->next = ban_list; - ban_list = pban; - save_bans(); - sprintf(buf,"%s has been banned.\n\r",pban->name); - send_to_char( buf, ch ); - return; -} - -void do_ban(CHAR_DATA *ch, char *argument) -{ - ban_site(ch,argument,FALSE); -} - -void do_permban(CHAR_DATA *ch, char *argument) -{ - ban_site(ch,argument,TRUE); -} - -void do_allow( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - char buf[MAX_STRING_LENGTH]; - BAN_DATA *prev; - BAN_DATA *curr; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Remove which site from the ban list?\n\r", ch ); - return; - } - - prev = NULL; - for ( curr = ban_list; curr != NULL; prev = curr, curr = curr->next ) - { - if ( !str_cmp( arg, curr->name ) ) - { - if (curr->level > get_trust(ch)) - { - send_to_char( - "You are not powerful enough to lift that ban.\n\r",ch); - return; - } - if ( prev == NULL ) - ban_list = ban_list->next; - else - prev->next = curr->next; - - free_ban(curr); - sprintf(buf,"Ban on %s lifted.\n\r",arg); - send_to_char( buf, ch ); - save_bans(); - return; - } - } - - send_to_char( "Site is not banned.\n\r", ch ); - return; -} - - diff --git a/archive/src/comm.c b/archive/src/comm.c deleted file mode 100644 index 3a60c68..0000000 --- a/archive/src/comm.c +++ /dev/null @@ -1,2572 +0,0 @@ -/*************************************************************************** - * 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. * - * * - * Thanks to abaddon for proof-reading our comm.c and pointing out bugs. * - * Any remaining bugs are, of course, our work, not his. :) * - * * - * 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 * -***************************************************************************/ - -/* - * This file contains all of the OS-dependent stuff: - * startup, signals, BSD sockets for tcp/ip, i/o, timing. - * - * The data flow for input is: - * Game_loop ---> Read_from_descriptor ---> Read - * Game_loop ---> Read_from_buffer - * - * The data flow for output is: - * Game_loop ---> Process_Output ---> Write_to_descriptor -> Write - * - * The OS-dependent functions are Read_from_descriptor and Write_to_descriptor. - * -- Furey 26 Jan 1993 - */ - -#if defined(macintosh) -#include -#else -#include -#include -#endif - -#include -#include -#include -#include -#include -#include - -#include "merc.h" -#include "interp.h" -#include "recycle.h" -#include "tables.h" - -/* - * Malloc debugging stuff. - */ -#if defined(sun) -#undef MALLOC_DEBUG -#endif - -#if defined(MALLOC_DEBUG) -#include -extern int malloc_debug args( ( int ) ); -extern int malloc_verify args( ( void ) ); -#endif - - - -/* - * Signal handling. - * Apollo has a problem with __attribute(atomic) in signal.h, - * I dance around it. - */ -#if defined(apollo) -#define __attribute(x) -#endif - -#if defined(unix) -#include -#endif - -#if defined(apollo) -#undef __attribute -#endif - - - -/* - * Socket and TCP/IP stuff. - */ -#if defined(macintosh) || defined(MSDOS) -const char echo_off_str [] = { '\0' }; -const char echo_on_str [] = { '\0' }; -const char go_ahead_str [] = { '\0' }; -#endif - -#if defined(unix) -#include -#include -#include -#include -#include "telnet.h" -const char echo_off_str [] = { IAC, WILL, TELOPT_ECHO, '\0' }; -const char echo_on_str [] = { IAC, WONT, TELOPT_ECHO, '\0' }; -const char go_ahead_str [] = { IAC, GA, '\0' }; -#endif - - - -/* - * OS-dependent declarations. - */ -#if defined(_AIX) -#include -int accept args( ( int s, struct sockaddr *addr, int *addrlen ) ); -int bind args( ( int s, struct sockaddr *name, int namelen ) ); -void bzero args( ( char *b, int length ) ); -int getpeername args( ( int s, struct sockaddr *name, int *namelen ) ); -int getsockname args( ( int s, struct sockaddr *name, int *namelen ) ); -int gettimeofday args( ( struct timeval *tp, struct timezone *tzp ) ); -int listen args( ( int s, int backlog ) ); -int setsockopt args( ( int s, int level, int optname, void *optval, - int optlen ) ); -int socket args( ( int domain, int type, int protocol ) ); -#endif - -#if defined(apollo) -#include -void bzero args( ( char *b, int length ) ); -#endif - -#if defined(__hpux) -int accept args( ( int s, void *addr, int *addrlen ) ); -int bind args( ( int s, const void *addr, int addrlen ) ); -void bzero args( ( char *b, int length ) ); -int getpeername args( ( int s, void *addr, int *addrlen ) ); -int getsockname args( ( int s, void *name, int *addrlen ) ); -int gettimeofday args( ( struct timeval *tp, struct timezone *tzp ) ); -int listen args( ( int s, int backlog ) ); -int setsockopt args( ( int s, int level, int optname, - const void *optval, int optlen ) ); -int socket args( ( int domain, int type, int protocol ) ); -#endif - -#if defined(interactive) -#include -#include -#endif - -#if defined(linux) -/* - Linux shouldn't need these. If you have a problem compiling, try - uncommenting these functions. -*/ -/* -int accept args( ( int s, struct sockaddr *addr, int *addrlen ) ); -int bind args( ( int s, struct sockaddr *name, int namelen ) ); -int getpeername args( ( int s, struct sockaddr *name, int *namelen ) ); -int getsockname args( ( int s, struct sockaddr *name, int *namelen ) ); -int listen args( ( int s, int backlog ) ); -*/ - -int close args( ( int fd ) ); -int gettimeofday args( ( struct timeval *tp, struct timezone *tzp ) ); -int read args( ( int fd, char *buf, int nbyte ) ); -int select args( ( int width, fd_set *readfds, fd_set *writefds, - fd_set *exceptfds, struct timeval *timeout ) ); -int socket args( ( int domain, int type, int protocol ) ); -int write args( ( int fd, char *buf, int nbyte ) ); -#endif - -#if defined(macintosh) -#include -#include -#include -struct timeval -{ - time_t tv_sec; - time_t tv_usec; -}; -#if !defined(isascii) -#define isascii(c) ( (c) < 0200 ) -#endif -static long theKeys [4]; - -int gettimeofday args( ( struct timeval *tp, void *tzp ) ); -#endif - -#if defined(MIPS_OS) -extern int errno; -#endif - -#if defined(MSDOS) -int gettimeofday args( ( struct timeval *tp, void *tzp ) ); -int kbhit args( ( void ) ); -#endif - -#if defined(NeXT) -int close args( ( int fd ) ); -int fcntl args( ( int fd, int cmd, int arg ) ); -#if !defined(htons) -u_short htons args( ( u_short hostshort ) ); -#endif -#if !defined(ntohl) -u_long ntohl args( ( u_long hostlong ) ); -#endif -int read args( ( int fd, char *buf, int nbyte ) ); -int select args( ( int width, fd_set *readfds, fd_set *writefds, - fd_set *exceptfds, struct timeval *timeout ) ); -int write args( ( int fd, char *buf, int nbyte ) ); -#endif - -#if defined(sequent) -int accept args( ( int s, struct sockaddr *addr, int *addrlen ) ); -int bind args( ( int s, struct sockaddr *name, int namelen ) ); -int close args( ( int fd ) ); -int fcntl args( ( int fd, int cmd, int arg ) ); -int getpeername args( ( int s, struct sockaddr *name, int *namelen ) ); -int getsockname args( ( int s, struct sockaddr *name, int *namelen ) ); -int gettimeofday args( ( struct timeval *tp, struct timezone *tzp ) ); -#if !defined(htons) -u_short htons args( ( u_short hostshort ) ); -#endif -int listen args( ( int s, int backlog ) ); -#if !defined(ntohl) -u_long ntohl args( ( u_long hostlong ) ); -#endif -int read args( ( int fd, char *buf, int nbyte ) ); -int select args( ( int width, fd_set *readfds, fd_set *writefds, - fd_set *exceptfds, struct timeval *timeout ) ); -int setsockopt args( ( int s, int level, int optname, caddr_t optval, - int optlen ) ); -int socket args( ( int domain, int type, int protocol ) ); -int write args( ( int fd, char *buf, int nbyte ) ); -#endif - -/* This includes Solaris Sys V as well */ -#if defined(sun) -int accept args( ( int s, struct sockaddr *addr, int *addrlen ) ); -int bind args( ( int s, struct sockaddr *name, int namelen ) ); -void bzero args( ( char *b, int length ) ); -int close args( ( int fd ) ); -int getpeername args( ( int s, struct sockaddr *name, int *namelen ) ); -int getsockname args( ( int s, struct sockaddr *name, int *namelen ) ); -int listen args( ( int s, int backlog ) ); -int read args( ( int fd, char *buf, int nbyte ) ); -int select args( ( int width, fd_set *readfds, fd_set *writefds, - fd_set *exceptfds, struct timeval *timeout ) ); - -#if !defined(__SVR4) -int gettimeofday args( ( struct timeval *tp, struct timezone *tzp ) ); - -#if defined(SYSV) -int setsockopt args( ( int s, int level, int optname, - const char *optval, int optlen ) ); -#else -int setsockopt args( ( int s, int level, int optname, void *optval, - int optlen ) ); -#endif -#endif -int socket args( ( int domain, int type, int protocol ) ); -int write args( ( int fd, char *buf, int nbyte ) ); -#endif - -#if defined(ultrix) -int accept args( ( int s, struct sockaddr *addr, int *addrlen ) ); -int bind args( ( int s, struct sockaddr *name, int namelen ) ); -void bzero args( ( char *b, int length ) ); -int close args( ( int fd ) ); -int getpeername args( ( int s, struct sockaddr *name, int *namelen ) ); -int getsockname args( ( int s, struct sockaddr *name, int *namelen ) ); -int gettimeofday args( ( struct timeval *tp, struct timezone *tzp ) ); -int listen args( ( int s, int backlog ) ); -int read args( ( int fd, char *buf, int nbyte ) ); -int select args( ( int width, fd_set *readfds, fd_set *writefds, - fd_set *exceptfds, struct timeval *timeout ) ); -int setsockopt args( ( int s, int level, int optname, void *optval, - int optlen ) ); -int socket args( ( int domain, int type, int protocol ) ); -int write args( ( int fd, char *buf, int nbyte ) ); -#endif - - - -/* - * Global variables. - */ -DESCRIPTOR_DATA * descriptor_list; /* All open descriptors */ -DESCRIPTOR_DATA * d_next; /* Next descriptor in loop */ -FILE * fpReserve; /* Reserved file handle */ -bool god; /* All new chars are gods! */ -bool merc_down; /* Shutdown */ -bool wizlock; /* Game is wizlocked */ -bool newlock; /* Game is newlocked */ -char str_boot_time[MAX_INPUT_LENGTH]; -time_t current_time; /* time of this pulse */ - - - -/* - * OS-dependent local functions. - */ -#if defined(macintosh) || defined(MSDOS) -void game_loop_mac_msdos args( ( void ) ); -bool read_from_descriptor args( ( DESCRIPTOR_DATA *d ) ); -bool write_to_descriptor args( ( int desc, char *txt, int length ) ); -#endif - -#if defined(unix) -void game_loop_unix args( ( int control ) ); -int init_socket args( ( int port ) ); -void init_descriptor args( ( int control ) ); -bool read_from_descriptor args( ( DESCRIPTOR_DATA *d ) ); -bool write_to_descriptor args( ( int desc, char *txt, int length ) ); -#endif - - - - -/* - * Other local functions (OS-independent). - */ -bool check_parse_name args( ( char *name ) ); -bool check_reconnect args( ( DESCRIPTOR_DATA *d, char *name, - bool fConn ) ); -bool check_playing args( ( DESCRIPTOR_DATA *d, char *name ) ); -int main args( ( int argc, char **argv ) ); -void nanny args( ( DESCRIPTOR_DATA *d, char *argument ) ); -bool process_output args( ( DESCRIPTOR_DATA *d, bool fPrompt ) ); -void read_from_buffer args( ( DESCRIPTOR_DATA *d ) ); -void stop_idling args( ( CHAR_DATA *ch ) ); -void bust_a_prompt args( ( CHAR_DATA *ch ) ); - - -int main( int argc, char **argv ) -{ - struct timeval now_time; - int port; - -#if defined(unix) - int control; -#endif - - /* - * Memory debugging if needed. - */ -#if defined(MALLOC_DEBUG) - malloc_debug( 2 ); -#endif - - /* - * Init time. - */ - gettimeofday( &now_time, NULL ); - current_time = (time_t) now_time.tv_sec; - strcpy( str_boot_time, ctime( ¤t_time ) ); - - /* - * Macintosh console initialization. - */ -#if defined(macintosh) - console_options.nrows = 31; - cshow( stdout ); - csetmode( C_RAW, stdin ); - cecho2file( "log file", 1, stderr ); -#endif - - /* - * Reserve one channel for our use. - */ - if ( ( fpReserve = fopen( NULL_FILE, "r" ) ) == NULL ) - { - perror( NULL_FILE ); - exit( 1 ); - } - - /* - * Get the port number. - */ - port = 4000; - if ( argc > 1 ) - { - if ( !is_number( argv[1] ) ) - { - fprintf( stderr, "Usage: %s [port #]\n", argv[0] ); - exit( 1 ); - } - else if ( ( port = atoi( argv[1] ) ) <= 1024 ) - { - fprintf( stderr, "Port number must be above 1024.\n" ); - exit( 1 ); - } - } - - /* - * Run the game. - */ -#if defined(macintosh) || defined(MSDOS) - boot_db( ); - log_string( "Merc is ready to rock." ); - game_loop_mac_msdos( ); -#endif - -#if defined(unix) - control = init_socket( port ); - boot_db( ); - sprintf( log_buf, "ROM is ready to rock on port %d.", port ); - log_string( log_buf ); - game_loop_unix( control ); - close (control); -#endif - - /* - * That's all, folks. - */ - log_string( "Normal termination of game." ); - exit( 0 ); - return 0; -} - - - -#if defined(unix) -int init_socket( int port ) -{ - static struct sockaddr_in sa_zero; - struct sockaddr_in sa; - int x = 1; - int fd; - - if ( ( fd = socket( AF_INET, SOCK_STREAM, 0 ) ) < 0 ) - { - perror( "Init_socket: socket" ); - exit( 1 ); - } - - if ( setsockopt( fd, SOL_SOCKET, SO_REUSEADDR, - (char *) &x, sizeof(x) ) < 0 ) - { - perror( "Init_socket: SO_REUSEADDR" ); - close(fd); - exit( 1 ); - } - -#if defined(SO_DONTLINGER) && !defined(SYSV) - { - struct linger ld; - - ld.l_onoff = 1; - ld.l_linger = 1000; - - if ( setsockopt( fd, SOL_SOCKET, SO_DONTLINGER, - (char *) &ld, sizeof(ld) ) < 0 ) - { - perror( "Init_socket: SO_DONTLINGER" ); - close(fd); - exit( 1 ); - } - } -#endif - - sa = sa_zero; - sa.sin_family = AF_INET; - sa.sin_port = htons( port ); - - if ( bind( fd, (struct sockaddr *) &sa, sizeof(sa) ) < 0 ) - { - perror("Init socket: bind" ); - close(fd); - exit(1); - } - - - if ( listen( fd, 3 ) < 0 ) - { - perror("Init socket: listen"); - close(fd); - exit(1); - } - - return fd; -} -#endif - - - -#if defined(macintosh) || defined(MSDOS) -void game_loop_mac_msdos( void ) -{ - struct timeval last_time; - struct timeval now_time; - static DESCRIPTOR_DATA dcon; - - gettimeofday( &last_time, NULL ); - current_time = (time_t) last_time.tv_sec; - - /* - * New_descriptor analogue. - */ - dcon.descriptor = 0; - dcon.connected = CON_GET_NAME; - dcon.host = str_dup( "localhost" ); - dcon.outsize = 2000; - dcon.outbuf = alloc_mem( dcon.outsize ); - dcon.next = descriptor_list; - dcon.showstr_head = NULL; - dcon.showstr_point = NULL; - descriptor_list = &dcon; - - /* - * Send the greeting. - */ - { - extern char * help_greeting; - if ( help_greeting[0] == '.' ) - write_to_buffer( &dcon, help_greeting+1, 0 ); - else - write_to_buffer( &dcon, help_greeting , 0 ); - } - - /* Main loop */ - while ( !merc_down ) - { - DESCRIPTOR_DATA *d; - - /* - * Process input. - */ - for ( d = descriptor_list; d != NULL; d = d_next ) - { - d_next = d->next; - d->fcommand = FALSE; - -#if defined(MSDOS) - if ( kbhit( ) ) -#endif - { - if ( d->character != NULL ) - d->character->timer = 0; - if ( !read_from_descriptor( d ) ) - { - if ( d->character != NULL && d->connected == CON_PLAYING) - save_char_obj( d->character ); - d->outtop = 0; - close_socket( d ); - continue; - } - } - - if (d->character != NULL && d->character->daze > 0) - --d->character->daze; - - if ( d->character != NULL && d->character->wait > 0 ) - { - --d->character->wait; - continue; - } - - read_from_buffer( d ); - if ( d->incomm[0] != '\0' ) - { - d->fcommand = TRUE; - stop_idling( d->character ); - - if ( d->connected == CON_PLAYING ) - substitute_alias( d, d->incomm ); - else - nanny( d, d->incomm ); - - d->incomm[0] = '\0'; - } - } - - - - /* - * Autonomous game motion. - */ - update_handler( ); - - - - /* - * Output. - */ - for ( d = descriptor_list; d != NULL; d = d_next ) - { - d_next = d->next; - - if ( ( d->fcommand || d->outtop > 0 ) ) - { - if ( !process_output( d, TRUE ) ) - { - if ( d->character != NULL && d->connected == CON_PLAYING) - save_char_obj( d->character ); - d->outtop = 0; - close_socket( d ); - } - } - } - - - - /* - * Synchronize to a clock. - * Busy wait (blargh). - */ - now_time = last_time; - for ( ; ; ) - { - int delta; - -#if defined(MSDOS) - if ( kbhit( ) ) -#endif - { - if ( dcon.character != NULL ) - dcon.character->timer = 0; - if ( !read_from_descriptor( &dcon ) ) - { - if ( dcon.character != NULL && d->connected == CON_PLAYING) - save_char_obj( d->character ); - dcon.outtop = 0; - close_socket( &dcon ); - } -#if defined(MSDOS) - break; -#endif - } - - gettimeofday( &now_time, NULL ); - delta = ( now_time.tv_sec - last_time.tv_sec ) * 1000 * 1000 - + ( now_time.tv_usec - last_time.tv_usec ); - if ( delta >= 1000000 / PULSE_PER_SECOND ) - break; - } - last_time = now_time; - current_time = (time_t) last_time.tv_sec; - } - - return; -} -#endif - - - -#if defined(unix) -void game_loop_unix( int control ) -{ - static struct timeval null_time; - struct timeval last_time; - - signal( SIGPIPE, SIG_IGN ); - gettimeofday( &last_time, NULL ); - current_time = (time_t) last_time.tv_sec; - - /* Main loop */ - while ( !merc_down ) - { - fd_set in_set; - fd_set out_set; - fd_set exc_set; - DESCRIPTOR_DATA *d; - int maxdesc; - -#if defined(MALLOC_DEBUG) - if ( malloc_verify( ) != 1 ) - abort( ); -#endif - - /* - * Poll all active descriptors. - */ - FD_ZERO( &in_set ); - FD_ZERO( &out_set ); - FD_ZERO( &exc_set ); - FD_SET( control, &in_set ); - maxdesc = control; - for ( d = descriptor_list; d; d = d->next ) - { - maxdesc = UMAX( maxdesc, d->descriptor ); - FD_SET( d->descriptor, &in_set ); - FD_SET( d->descriptor, &out_set ); - FD_SET( d->descriptor, &exc_set ); - } - - if ( select( maxdesc+1, &in_set, &out_set, &exc_set, &null_time ) < 0 ) - { - perror( "Game_loop: select: poll" ); - exit( 1 ); - } - - /* - * New connection? - */ - if ( FD_ISSET( control, &in_set ) ) - init_descriptor( control ); - - /* - * Kick out the freaky folks. - */ - for ( d = descriptor_list; d != NULL; d = d_next ) - { - d_next = d->next; - if ( FD_ISSET( d->descriptor, &exc_set ) ) - { - FD_CLR( d->descriptor, &in_set ); - FD_CLR( d->descriptor, &out_set ); - if ( d->character && d->connected == CON_PLAYING) - save_char_obj( d->character ); - d->outtop = 0; - close_socket( d ); - } - } - - /* - * Process input. - */ - for ( d = descriptor_list; d != NULL; d = d_next ) - { - d_next = d->next; - d->fcommand = FALSE; - - if ( FD_ISSET( d->descriptor, &in_set ) ) - { - if ( d->character != NULL ) - d->character->timer = 0; - if ( !read_from_descriptor( d ) ) - { - FD_CLR( d->descriptor, &out_set ); - if ( d->character != NULL && d->connected == CON_PLAYING) - save_char_obj( d->character ); - d->outtop = 0; - close_socket( d ); - continue; - } - } - - if (d->character != NULL && d->character->daze > 0) - --d->character->daze; - - if ( d->character != NULL && d->character->wait > 0 ) - { - --d->character->wait; - continue; - } - - read_from_buffer( d ); - if ( d->incomm[0] != '\0' ) - { - d->fcommand = TRUE; - stop_idling( d->character ); - - if (d->showstr_point) - show_string(d,d->incomm); - else if ( d->connected == CON_PLAYING ) - substitute_alias( d, d->incomm ); - else - nanny( d, d->incomm ); - - d->incomm[0] = '\0'; - } - } - - - - /* - * Autonomous game motion. - */ - update_handler( ); - - - - /* - * Output. - */ - for ( d = descriptor_list; d != NULL; d = d_next ) - { - d_next = d->next; - - if ( ( d->fcommand || d->outtop > 0 ) - && FD_ISSET(d->descriptor, &out_set) ) - { - if ( !process_output( d, TRUE ) ) - { - if ( d->character != NULL && d->connected == CON_PLAYING) - save_char_obj( d->character ); - d->outtop = 0; - close_socket( d ); - } - } - } - - - - /* - * Synchronize to a clock. - * Sleep( last_time + 1/PULSE_PER_SECOND - now ). - * Careful here of signed versus unsigned arithmetic. - */ - { - struct timeval now_time; - long secDelta; - long usecDelta; - - gettimeofday( &now_time, NULL ); - usecDelta = ((int) last_time.tv_usec) - ((int) now_time.tv_usec) - + 1000000 / PULSE_PER_SECOND; - secDelta = ((int) last_time.tv_sec ) - ((int) now_time.tv_sec ); - while ( usecDelta < 0 ) - { - usecDelta += 1000000; - secDelta -= 1; - } - - while ( usecDelta >= 1000000 ) - { - usecDelta -= 1000000; - secDelta += 1; - } - - if ( secDelta > 0 || ( secDelta == 0 && usecDelta > 0 ) ) - { - struct timeval stall_time; - - stall_time.tv_usec = usecDelta; - stall_time.tv_sec = secDelta; - if ( select( 0, NULL, NULL, NULL, &stall_time ) < 0 ) - { - perror( "Game_loop: select: stall" ); - exit( 1 ); - } - } - } - - gettimeofday( &last_time, NULL ); - current_time = (time_t) last_time.tv_sec; - } - - return; -} -#endif - - - -#if defined(unix) -void init_descriptor( int control ) -{ - char buf[MAX_STRING_LENGTH]; - DESCRIPTOR_DATA *dnew; - struct sockaddr_in sock; - struct hostent *from; - int desc; - socklen_t size; - - size = sizeof(sock); - getsockname( control, (struct sockaddr *) &sock, &size ); - if ( ( desc = accept( control, (struct sockaddr *) &sock, &size) ) < 0 ) - { - perror( "New_descriptor: accept" ); - return; - } - -#if !defined(FNDELAY) -#define FNDELAY O_NDELAY -#endif - - if ( fcntl( desc, F_SETFL, FNDELAY ) == -1 ) - { - perror( "New_descriptor: fcntl: FNDELAY" ); - return; - } - - /* - * Cons a new descriptor. - */ - dnew = new_descriptor(); - - dnew->descriptor = desc; - dnew->connected = CON_GET_NAME; - dnew->showstr_head = NULL; - dnew->showstr_point = NULL; - dnew->outsize = 2000; - dnew->outbuf = alloc_mem( dnew->outsize ); - - size = sizeof(sock); - if ( getpeername( desc, (struct sockaddr *) &sock, &size ) < 0 ) - { - perror( "New_descriptor: getpeername" ); - dnew->host = str_dup( "(unknown)" ); - } - else - { - /* - * Would be nice to use inet_ntoa here but it takes a struct arg, - * which ain't very compatible between gcc and system libraries. - */ - int addr; - - addr = ntohl( sock.sin_addr.s_addr ); - sprintf( buf, "%d.%d.%d.%d", - ( addr >> 24 ) & 0xFF, ( addr >> 16 ) & 0xFF, - ( addr >> 8 ) & 0xFF, ( addr ) & 0xFF - ); - sprintf( log_buf, "Sock.sinaddr: %s", buf ); - log_string( log_buf ); - from = gethostbyaddr( (char *) &sock.sin_addr, - sizeof(sock.sin_addr), AF_INET ); - dnew->host = str_dup( from ? from->h_name : buf ); - } - - /* - * Swiftest: I added the following to ban sites. I don't - * endorse banning of sites, but Copper has few descriptors now - * and some people from certain sites keep abusing access by - * using automated 'autodialers' and leaving connections hanging. - * - * Furey: added suffix check by request of Nickel of HiddenWorlds. - */ - if ( check_ban(dnew->host,BAN_ALL)) - { - write_to_descriptor( desc, - "Your site has been banned from this mud.\n\r", 0 ); - close( desc ); - free_descriptor(dnew); - return; - } - /* - * Init descriptor data. - */ - dnew->next = descriptor_list; - descriptor_list = dnew; - - /* - * Send the greeting. - */ - { - extern char * help_greeting; - if ( help_greeting[0] == '.' ) - write_to_buffer( dnew, help_greeting+1, 0 ); - else - write_to_buffer( dnew, help_greeting , 0 ); - } - - return; -} -#endif - - - -void close_socket( DESCRIPTOR_DATA *dclose ) -{ - CHAR_DATA *ch; - - if ( dclose->outtop > 0 ) - process_output( dclose, FALSE ); - - if ( dclose->snoop_by != NULL ) - { - write_to_buffer( dclose->snoop_by, - "Your victim has left the game.\n\r", 0 ); - } - - { - DESCRIPTOR_DATA *d; - - for ( d = descriptor_list; d != NULL; d = d->next ) - { - if ( d->snoop_by == dclose ) - d->snoop_by = NULL; - } - } - - if ( ( ch = dclose->character ) != NULL ) - { - sprintf( log_buf, "Closing link to %s.", ch->name ); - log_string( log_buf ); - /* cut down on wiznet spam when rebooting */ - if ( dclose->connected == CON_PLAYING && !merc_down) - { - act( "$n has lost $s link.", ch, NULL, NULL, TO_ROOM ); - wiznet("Net death has claimed $N.",ch,NULL,WIZ_LINKS,0,0); - ch->desc = NULL; - } - else - { - free_char(dclose->original ? dclose->original : - dclose->character ); - } - } - - if ( d_next == dclose ) - d_next = d_next->next; - - if ( dclose == descriptor_list ) - { - descriptor_list = descriptor_list->next; - } - else - { - DESCRIPTOR_DATA *d; - - for ( d = descriptor_list; d && d->next != dclose; d = d->next ) - ; - if ( d != NULL ) - d->next = dclose->next; - else - bug( "Close_socket: dclose not found.", 0 ); - } - - close( dclose->descriptor ); - free_descriptor(dclose); -#if defined(MSDOS) || defined(macintosh) - exit(1); -#endif - return; -} - - - -bool read_from_descriptor( DESCRIPTOR_DATA *d ) -{ - int iStart; - - /* Hold horses if pending command already. */ - if ( d->incomm[0] != '\0' ) - return TRUE; - - /* Check for overflow. */ - iStart = strlen(d->inbuf); - if ( iStart >= sizeof(d->inbuf) - 10 ) - { - sprintf( log_buf, "%s input overflow!", d->host ); - log_string( log_buf ); - write_to_descriptor( d->descriptor, - "\n\r*** PUT A LID ON IT!!! ***\n\r", 0 ); - return FALSE; - } - - /* Snarf input. */ -#if defined(macintosh) - for ( ; ; ) - { - int c; - c = getc( stdin ); - if ( c == '\0' || c == EOF ) - break; - putc( c, stdout ); - if ( c == '\r' ) - putc( '\n', stdout ); - d->inbuf[iStart++] = c; - if ( iStart > sizeof(d->inbuf) - 10 ) - break; - } -#endif - -#if defined(MSDOS) || defined(unix) - for ( ; ; ) - { - int nRead; - - nRead = read( d->descriptor, d->inbuf + iStart, - sizeof(d->inbuf) - 10 - iStart ); - if ( nRead > 0 ) - { - iStart += nRead; - if ( d->inbuf[iStart-1] == '\n' || d->inbuf[iStart-1] == '\r' ) - break; - } - else if ( nRead == 0 ) - { - log_string( "EOF encountered on read." ); - return FALSE; - } - else if ( errno == EWOULDBLOCK ) - break; - else - { - perror( "Read_from_descriptor" ); - return FALSE; - } - } -#endif - - d->inbuf[iStart] = '\0'; - return TRUE; -} - - - -/* - * Transfer one line from input buffer to input line. - */ -void read_from_buffer( DESCRIPTOR_DATA *d ) -{ - int i, j, k; - - /* - * Hold horses if pending command already. - */ - if ( d->incomm[0] != '\0' ) - return; - - /* - * Look for at least one new line. - */ - for ( i = 0; d->inbuf[i] != '\n' && d->inbuf[i] != '\r'; i++ ) - { - if ( d->inbuf[i] == '\0' ) - return; - } - - /* - * Canonical input processing. - */ - for ( i = 0, k = 0; d->inbuf[i] != '\n' && d->inbuf[i] != '\r'; i++ ) - { - if ( k >= MAX_INPUT_LENGTH - 2 ) - { - write_to_descriptor( d->descriptor, "Line too long.\n\r", 0 ); - - /* skip the rest of the line */ - for ( ; d->inbuf[i] != '\0'; i++ ) - { - if ( d->inbuf[i] == '\n' || d->inbuf[i] == '\r' ) - break; - } - d->inbuf[i] = '\n'; - d->inbuf[i+1] = '\0'; - break; - } - - if ( d->inbuf[i] == '\b' && k > 0 ) - --k; - else if ( isascii(d->inbuf[i]) && isprint(d->inbuf[i]) ) - d->incomm[k++] = d->inbuf[i]; - } - - /* - * Finish off the line. - */ - if ( k == 0 ) - d->incomm[k++] = ' '; - d->incomm[k] = '\0'; - - /* - * Deal with bozos with #repeat 1000 ... - */ - - if ( k > 1 || d->incomm[0] == '!' ) - { - if ( d->incomm[0] != '!' && strcmp( d->incomm, d->inlast ) ) - { - d->repeat = 0; - } - else - { - if (++d->repeat >= 25 && d->character - && d->connected == CON_PLAYING) - { - sprintf( log_buf, "%s input spamming!", d->host ); - log_string( log_buf ); - wiznet("Spam spam spam $N spam spam spam spam spam!", - d->character,NULL,WIZ_SPAM,0,get_trust(d->character)); - if (d->incomm[0] == '!') - wiznet(d->inlast,d->character,NULL,WIZ_SPAM,0, - get_trust(d->character)); - else - wiznet(d->incomm,d->character,NULL,WIZ_SPAM,0, - get_trust(d->character)); - - d->repeat = 0; -/* - write_to_descriptor( d->descriptor, - "\n\r*** PUT A LID ON IT!!! ***\n\r", 0 ); - strcpy( d->incomm, "quit" ); -*/ - } - } - } - - - /* - * Do '!' substitution. - */ - if ( d->incomm[0] == '!' ) - strcpy( d->incomm, d->inlast ); - else - strcpy( d->inlast, d->incomm ); - - /* - * Shift the input buffer. - */ - while ( d->inbuf[i] == '\n' || d->inbuf[i] == '\r' ) - i++; - for ( j = 0; ( d->inbuf[j] = d->inbuf[i+j] ) != '\0'; j++ ) - ; - return; -} - - - -/* - * Low level output function. - */ -bool process_output( DESCRIPTOR_DATA *d, bool fPrompt ) -{ - extern bool merc_down; - - /* - * Bust a prompt. - */ - if (!merc_down && d->showstr_point) - write_to_buffer(d,"[Hit Return to continue]\n\r",0); - else if (fPrompt && !merc_down && d->connected == CON_PLAYING) - { - CHAR_DATA *ch; - CHAR_DATA *victim; - - ch = d->character; - - /* battle prompt */ - if ((victim = ch->fighting) != NULL && can_see(ch,victim)) - { - int percent; - char wound[100]; - char buf[MAX_STRING_LENGTH]; - - if (victim->max_hit > 0) - percent = victim->hit * 100 / victim->max_hit; - else - percent = -1; - - if (percent >= 100) - sprintf(wound,"is in excellent condition."); - else if (percent >= 90) - sprintf(wound,"has a few scratches."); - else if (percent >= 75) - sprintf(wound,"has some small wounds and bruises."); - else if (percent >= 50) - sprintf(wound,"has quite a few wounds."); - else if (percent >= 30) - sprintf(wound,"has some big nasty wounds and scratches."); - else if (percent >= 15) - sprintf(wound,"looks pretty hurt."); - else if (percent >= 0) - sprintf(wound,"is in awful condition."); - else - sprintf(wound,"is bleeding to death."); - - sprintf(buf,"%s %s \n\r", - IS_NPC(victim) ? victim->short_descr : victim->name,wound); - buf[0] = UPPER(buf[0]); - write_to_buffer( d, buf, 0); - } - - - ch = d->original ? d->original : d->character; - if (!IS_SET(ch->comm, COMM_COMPACT) ) - write_to_buffer( d, "\n\r", 2 ); - - - if ( IS_SET(ch->comm, COMM_PROMPT) ) - bust_a_prompt( d->character ); - - if (IS_SET(ch->comm,COMM_TELNET_GA)) - write_to_buffer(d,go_ahead_str,0); - } - - /* - * Short-circuit if nothing to write. - */ - if ( d->outtop == 0 ) - return TRUE; - - /* - * Snoop-o-rama. - */ - if ( d->snoop_by != NULL ) - { - if (d->character != NULL) - write_to_buffer( d->snoop_by, d->character->name,0); - write_to_buffer( d->snoop_by, "> ", 2 ); - write_to_buffer( d->snoop_by, d->outbuf, d->outtop ); - } - - /* - * OS-dependent output. - */ - if ( !write_to_descriptor( d->descriptor, d->outbuf, d->outtop ) ) - { - d->outtop = 0; - return FALSE; - } - else - { - d->outtop = 0; - return TRUE; - } -} - -/* - * Bust a prompt (player settable prompt) - * coded by Morgenes for Aldara Mud - */ -void bust_a_prompt( CHAR_DATA *ch ) -{ - char buf[MAX_STRING_LENGTH]; - char buf2[MAX_STRING_LENGTH]; - const char *str; - const char *i; - char *point; - char doors[MAX_INPUT_LENGTH]; - EXIT_DATA *pexit; - bool found; - const char *dir_name[] = {"N","E","S","W","U","D"}; - int door; - - point = buf; - str = ch->prompt; - if (str == NULL || str[0] == '\0') - { - sprintf( buf, "<%dhp %dm %dmv> %s", - ch->hit,ch->mana,ch->move,ch->prefix); - send_to_char(buf,ch); - return; - } - - if (IS_SET(ch->comm,COMM_AFK)) - { - send_to_char(" ",ch); - return; - } - - while( *str != '\0' ) - { - if( *str != '%' ) - { - *point++ = *str++; - continue; - } - ++str; - switch( *str ) - { - default : - i = " "; break; - case 'e': - found = FALSE; - doors[0] = '\0'; - for (door = 0; door < 6; door++) - { - if ((pexit = ch->in_room->exit[door]) != NULL - && pexit ->u1.to_room != NULL - && (can_see_room(ch,pexit->u1.to_room) - || (IS_AFFECTED(ch,AFF_INFRARED) - && !IS_AFFECTED(ch,AFF_BLIND))) - && !IS_SET(pexit->exit_info,EX_CLOSED)) - { - found = TRUE; - strcat(doors,dir_name[door]); - } - } - if (!found) - strcat(buf,"none"); - sprintf(buf2,"%s",doors); - i = buf2; break; - case 'c' : - sprintf(buf2,"%s","\n\r"); - i = buf2; break; - case 'h' : - sprintf( buf2, "%d", ch->hit ); - i = buf2; break; - case 'H' : - sprintf( buf2, "%d", ch->max_hit ); - i = buf2; break; - case 'm' : - sprintf( buf2, "%d", ch->mana ); - i = buf2; break; - case 'M' : - sprintf( buf2, "%d", ch->max_mana ); - i = buf2; break; - case 'v' : - sprintf( buf2, "%d", ch->move ); - i = buf2; break; - case 'V' : - sprintf( buf2, "%d", ch->max_move ); - i = buf2; break; - case 'x' : - sprintf( buf2, "%d", ch->exp ); - i = buf2; break; - case 'X' : - sprintf(buf2, "%d", IS_NPC(ch) ? 0 : - (ch->level + 1) * exp_per_level(ch,ch->pcdata->points) - ch->exp); - i = buf2; break; - case 'g' : - sprintf( buf2, "%ld", ch->gold); - i = buf2; break; - case 's' : - sprintf( buf2, "%ld", ch->silver); - i = buf2; break; - case 'a' : - if( ch->level > 9 ) - sprintf( buf2, "%d", ch->alignment ); - else - sprintf( buf2, "%s", IS_GOOD(ch) ? "good" : IS_EVIL(ch) ? - "evil" : "neutral" ); - i = buf2; break; - case 'r' : - if( ch->in_room != NULL ) - sprintf( buf2, "%s", - ((!IS_NPC(ch) && IS_SET(ch->act,PLR_HOLYLIGHT)) || - (!IS_AFFECTED(ch,AFF_BLIND) && !room_is_dark( ch->in_room ))) - ? ch->in_room->name : "darkness"); - else - sprintf( buf2, " " ); - i = buf2; break; - case 'R' : - if( IS_IMMORTAL( ch ) && ch->in_room != NULL ) - sprintf( buf2, "%d", ch->in_room->vnum ); - else - sprintf( buf2, " " ); - i = buf2; break; - case 'z' : - if( IS_IMMORTAL( ch ) && ch->in_room != NULL ) - sprintf( buf2, "%s", ch->in_room->area->name ); - else - sprintf( buf2, " " ); - i = buf2; break; - case '%' : - sprintf( buf2, "%%" ); - i = buf2; break; - } - ++str; - while( (*point = *i) != '\0' ) - ++point, ++i; - } - write_to_buffer( ch->desc, buf, point - buf ); - - if (ch->prefix[0] != '\0') - write_to_buffer(ch->desc,ch->prefix,0); - return; -} - - - -/* - * Append onto an output buffer. - */ -void write_to_buffer( DESCRIPTOR_DATA *d, const char *txt, int length ) -{ - /* - * Find length in case caller didn't. - */ - if ( length <= 0 ) - length = strlen(txt); - - /* - * Initial \n\r if needed. - */ - if ( d->outtop == 0 && !d->fcommand ) - { - d->outbuf[0] = '\n'; - d->outbuf[1] = '\r'; - d->outtop = 2; - } - - /* - * Expand the buffer as needed. - */ - while ( d->outtop + length >= d->outsize ) - { - char *outbuf; - - if (d->outsize >= 32000) - { - bug("Buffer overflow. Closing.\n\r",0); - close_socket(d); - return; - } - outbuf = alloc_mem( 2 * d->outsize ); - strncpy( outbuf, d->outbuf, d->outtop ); - free_mem( d->outbuf, d->outsize ); - d->outbuf = outbuf; - d->outsize *= 2; - } - - /* - * Copy. - */ - strncpy( d->outbuf + d->outtop, txt, length ); - d->outtop += length; - return; -} - - - -/* - * Lowest level output function. - * Write a block of text to the file descriptor. - * If this gives errors on very long blocks (like 'ofind all'), - * try lowering the max block size. - */ -bool write_to_descriptor( int desc, char *txt, int length ) -{ - int iStart; - int nWrite; - int nBlock; - -#if defined(macintosh) || defined(MSDOS) - if ( desc == 0 ) - desc = 1; -#endif - - if ( length <= 0 ) - length = strlen(txt); - - for ( iStart = 0; iStart < length; iStart += nWrite ) - { - nBlock = UMIN( length - iStart, 4096 ); - if ( ( nWrite = write( desc, txt + iStart, nBlock ) ) < 0 ) - { perror( "Write_to_descriptor" ); return FALSE; } - } - - return TRUE; -} - - - -/* - * Deal with sockets that haven't logged in yet. - */ -void nanny( DESCRIPTOR_DATA *d, char *argument ) -{ - DESCRIPTOR_DATA *d_old, *d_next; - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *ch; - char *pwdnew; - char *p; - int iClass,race,i,weapon; - bool fOld; - - while ( isspace(*argument) ) - argument++; - - ch = d->character; - - switch ( d->connected ) - { - - default: - bug( "Nanny: bad d->connected %d.", d->connected ); - close_socket( d ); - return; - - case CON_GET_NAME: - if ( argument[0] == '\0' ) - { - close_socket( d ); - return; - } - - argument[0] = UPPER(argument[0]); - if ( !check_parse_name( argument ) ) - { - write_to_buffer( d, "Illegal name, try another.\n\rName: ", 0 ); - return; - } - - fOld = load_char_obj( d, argument ); - ch = d->character; - - if (IS_SET(ch->act, PLR_DENY)) - { - sprintf( log_buf, "Denying access to %s@%s.", argument, d->host ); - log_string( log_buf ); - write_to_buffer( d, "You are denied access.\n\r", 0 ); - close_socket( d ); - return; - } - - if (check_ban(d->host,BAN_PERMIT) && !IS_SET(ch->act,PLR_PERMIT)) - { - write_to_buffer(d,"Your site has been banned from this mud.\n\r",0); - close_socket(d); - return; - } - - if ( check_reconnect( d, argument, FALSE ) ) - { - fOld = TRUE; - } - else - { - if ( wizlock && !IS_IMMORTAL(ch)) - { - write_to_buffer( d, "The game is wizlocked.\n\r", 0 ); - close_socket( d ); - return; - } - } - - if ( fOld ) - { - /* Old player */ - write_to_buffer( d, "Password: ", 0 ); - write_to_buffer( d, echo_off_str, 0 ); - d->connected = CON_GET_OLD_PASSWORD; - return; - } - else - { - /* New player */ - if (newlock) - { - write_to_buffer( d, "The game is newlocked.\n\r", 0 ); - close_socket( d ); - return; - } - - if (check_ban(d->host,BAN_NEWBIES)) - { - write_to_buffer(d, - "New players are not allowed from your site.\n\r",0); - close_socket(d); - return; - } - - sprintf( buf, "Did I get that right, %s (Y/N)? ", argument ); - write_to_buffer( d, buf, 0 ); - d->connected = CON_CONFIRM_NEW_NAME; - return; - } - break; - - case CON_GET_OLD_PASSWORD: -#if defined(unix) - write_to_buffer( d, "\n\r", 2 ); -#endif - - if ( strcmp( crypt( argument, ch->pcdata->pwd ), ch->pcdata->pwd )) - { - write_to_buffer( d, "Wrong password.\n\r", 0 ); - close_socket( d ); - return; - } - - write_to_buffer( d, echo_on_str, 0 ); - - if (check_playing(d,ch->name)) - return; - - if ( check_reconnect( d, ch->name, TRUE ) ) - return; - - sprintf( log_buf, "%s@%s has connected.", ch->name, d->host ); - log_string( log_buf ); - wiznet(log_buf,NULL,NULL,WIZ_SITES,0,get_trust(ch)); - - if ( IS_IMMORTAL(ch) ) - { - do_function(ch, &do_help, "imotd" ); - d->connected = CON_READ_IMOTD; - } - else - { - do_function(ch, &do_help, "motd" ); - d->connected = CON_READ_MOTD; - } - break; - -/* RT code for breaking link */ - - case CON_BREAK_CONNECT: - switch( *argument ) - { - case 'y' : case 'Y': - for ( d_old = descriptor_list; d_old != NULL; d_old = d_next ) - { - d_next = d_old->next; - if (d_old == d || d_old->character == NULL) - continue; - - if (str_cmp(ch->name,d_old->original ? - d_old->original->name : d_old->character->name)) - continue; - - close_socket(d_old); - } - if (check_reconnect(d,ch->name,TRUE)) - return; - write_to_buffer(d,"Reconnect attempt failed.\n\rName: ",0); - if ( d->character != NULL ) - { - free_char( d->character ); - d->character = NULL; - } - d->connected = CON_GET_NAME; - break; - - case 'n' : case 'N': - write_to_buffer(d,"Name: ",0); - if ( d->character != NULL ) - { - free_char( d->character ); - d->character = NULL; - } - d->connected = CON_GET_NAME; - break; - - default: - write_to_buffer(d,"Please type Y or N? ",0); - break; - } - break; - - case CON_CONFIRM_NEW_NAME: - switch ( *argument ) - { - case 'y': case 'Y': - sprintf( buf, "New character.\n\rGive me a password for %s: %s", - ch->name, echo_off_str ); - write_to_buffer( d, buf, 0 ); - d->connected = CON_GET_NEW_PASSWORD; - break; - - case 'n': case 'N': - write_to_buffer( d, "Ok, what IS it, then? ", 0 ); - free_char( d->character ); - d->character = NULL; - d->connected = CON_GET_NAME; - break; - - default: - write_to_buffer( d, "Please type Yes or No? ", 0 ); - break; - } - break; - - case CON_GET_NEW_PASSWORD: -#if defined(unix) - write_to_buffer( d, "\n\r", 2 ); -#endif - - if ( strlen(argument) < 5 ) - { - write_to_buffer( d, - "Password must be at least five characters long.\n\rPassword: ", - 0 ); - return; - } - - pwdnew = crypt( argument, ch->name ); - for ( p = pwdnew; *p != '\0'; p++ ) - { - if ( *p == '~' ) - { - write_to_buffer( d, - "New password not acceptable, try again.\n\rPassword: ", - 0 ); - return; - } - } - - free_string( ch->pcdata->pwd ); - ch->pcdata->pwd = str_dup( pwdnew ); - write_to_buffer( d, "Please retype password: ", 0 ); - d->connected = CON_CONFIRM_NEW_PASSWORD; - break; - - case CON_CONFIRM_NEW_PASSWORD: -#if defined(unix) - write_to_buffer( d, "\n\r", 2 ); -#endif - - if ( strcmp( crypt( argument, ch->pcdata->pwd ), ch->pcdata->pwd ) ) - { - write_to_buffer( d, "Passwords don't match.\n\rRetype password: ", - 0 ); - d->connected = CON_GET_NEW_PASSWORD; - return; - } - - write_to_buffer( d, echo_on_str, 0 ); - write_to_buffer(d,"The following races are available:\n\r ",0); - for ( race = 1; race_table[race].name != NULL; race++ ) - { - if (!race_table[race].pc_race) - break; - write_to_buffer(d,race_table[race].name,0); - write_to_buffer(d," ",1); - } - write_to_buffer(d,"\n\r",0); - write_to_buffer(d,"What is your race (help for more information)? ",0); - d->connected = CON_GET_NEW_RACE; - break; - - case CON_GET_NEW_RACE: - one_argument(argument,arg); - - if (!strcmp(arg,"help")) - { - argument = one_argument(argument,arg); - if (argument[0] == '\0') - do_function(ch, &do_help, "race help"); - else - do_function(ch, &do_help, argument); - write_to_buffer(d, - "What is your race (help for more information)? ",0); - break; - } - - race = race_lookup(argument); - - if (race == 0 || !race_table[race].pc_race) - { - write_to_buffer(d,"That is not a valid race.\n\r",0); - write_to_buffer(d,"The following races are available:\n\r ",0); - for ( race = 1; race_table[race].name != NULL; race++ ) - { - if (!race_table[race].pc_race) - break; - write_to_buffer(d,race_table[race].name,0); - write_to_buffer(d," ",1); - } - write_to_buffer(d,"\n\r",0); - write_to_buffer(d, - "What is your race? (help for more information) ",0); - break; - } - - ch->race = race; - /* initialize stats */ - for (i = 0; i < MAX_STATS; i++) - ch->perm_stat[i] = pc_race_table[race].stats[i]; - ch->affected_by = ch->affected_by|race_table[race].aff; - ch->imm_flags = ch->imm_flags|race_table[race].imm; - ch->res_flags = ch->res_flags|race_table[race].res; - ch->vuln_flags = ch->vuln_flags|race_table[race].vuln; - ch->form = race_table[race].form; - ch->parts = race_table[race].parts; - - /* add skills */ - for (i = 0; i < 5; i++) - { - if (pc_race_table[race].skills[i] == NULL) - break; - group_add(ch,pc_race_table[race].skills[i],FALSE); - } - /* add cost */ - ch->pcdata->points = pc_race_table[race].points; - ch->size = pc_race_table[race].size; - - write_to_buffer( d, "What is your sex (M/F)? ", 0 ); - d->connected = CON_GET_NEW_SEX; - break; - - - case CON_GET_NEW_SEX: - switch ( argument[0] ) - { - case 'm': case 'M': ch->sex = SEX_MALE; - ch->pcdata->true_sex = SEX_MALE; - break; - case 'f': case 'F': ch->sex = SEX_FEMALE; - ch->pcdata->true_sex = SEX_FEMALE; - break; - default: - write_to_buffer( d, "That's not a sex.\n\rWhat IS your sex? ", 0 ); - return; - } - - strcpy( buf, "Select a class [" ); - for ( iClass = 0; iClass < MAX_CLASS; iClass++ ) - { - if ( iClass > 0 ) - strcat( buf, " " ); - strcat( buf, class_table[iClass].name ); - } - strcat( buf, "]: " ); - write_to_buffer( d, buf, 0 ); - d->connected = CON_GET_NEW_CLASS; - break; - - case CON_GET_NEW_CLASS: - iClass = class_lookup(argument); - - if ( iClass == -1 ) - { - write_to_buffer( d, - "That's not a class.\n\rWhat IS your class? ", 0 ); - return; - } - - ch->class = iClass; - - sprintf( log_buf, "%s@%s new player.", ch->name, d->host ); - log_string( log_buf ); - wiznet("Newbie alert! $N sighted.",ch,NULL,WIZ_NEWBIE,0,0); - wiznet(log_buf,NULL,NULL,WIZ_SITES,0,get_trust(ch)); - - write_to_buffer( d, "\n\r", 2 ); - write_to_buffer( d, "You may be good, neutral, or evil.\n\r",0); - write_to_buffer( d, "Which alignment (G/N/E)? ",0); - d->connected = CON_GET_ALIGNMENT; - break; - -case CON_GET_ALIGNMENT: - switch( argument[0]) - { - case 'g' : case 'G' : ch->alignment = 750; break; - case 'n' : case 'N' : ch->alignment = 0; break; - case 'e' : case 'E' : ch->alignment = -750; break; - default: - write_to_buffer(d,"That's not a valid alignment.\n\r",0); - write_to_buffer(d,"Which alignment (G/N/E)? ",0); - return; - } - - write_to_buffer(d,"\n\r",0); - - group_add(ch,"rom basics",FALSE); - group_add(ch,class_table[ch->class].base_group,FALSE); - ch->pcdata->learned[gsn_recall] = 50; - write_to_buffer(d,"Do you wish to customize this character?\n\r",0); - write_to_buffer(d,"Customization takes time, but allows a wider range of skills and abilities.\n\r",0); - write_to_buffer(d,"Customize (Y/N)? ",0); - d->connected = CON_DEFAULT_CHOICE; - break; - -case CON_DEFAULT_CHOICE: - write_to_buffer(d,"\n\r",2); - switch ( argument[0] ) - { - case 'y': case 'Y': - ch->gen_data = new_gen_data(); - ch->gen_data->points_chosen = ch->pcdata->points; - do_function(ch, &do_help, "group header"); - list_group_costs(ch); - write_to_buffer(d,"You already have the following skills:\n\r",0); - do_function(ch, &do_skills, ""); - do_function(ch, &do_help, "menu choice"); - d->connected = CON_GEN_GROUPS; - break; - case 'n': case 'N': - group_add(ch,class_table[ch->class].default_group,TRUE); - write_to_buffer( d, "\n\r", 2 ); - write_to_buffer(d, - "Please pick a weapon from the following choices:\n\r",0); - buf[0] = '\0'; - for ( i = 0; weapon_table[i].name != NULL; i++) - if (ch->pcdata->learned[*weapon_table[i].gsn] > 0) - { - strcat(buf,weapon_table[i].name); - strcat(buf," "); - } - strcat(buf,"\n\rYour choice? "); - write_to_buffer(d,buf,0); - d->connected = CON_PICK_WEAPON; - break; - default: - write_to_buffer( d, "Please answer (Y/N)? ", 0 ); - return; - } - break; - - case CON_PICK_WEAPON: - write_to_buffer(d,"\n\r",2); - weapon = weapon_lookup(argument); - if (weapon == -1 || ch->pcdata->learned[*weapon_table[weapon].gsn] <= 0) - { - write_to_buffer(d, - "That's not a valid selection. Choices are:\n\r",0); - buf[0] = '\0'; - for ( i = 0; weapon_table[i].name != NULL; i++) - if (ch->pcdata->learned[*weapon_table[i].gsn] > 0) - { - strcat(buf,weapon_table[i].name); - strcat(buf," "); - } - strcat(buf,"\n\rYour choice? "); - write_to_buffer(d,buf,0); - return; - } - - ch->pcdata->learned[*weapon_table[weapon].gsn] = 40; - write_to_buffer(d,"\n\r",2); - do_function(ch, &do_help, "motd"); - d->connected = CON_READ_MOTD; - break; - - case CON_GEN_GROUPS: - send_to_char("\n\r",ch); - - if (!str_cmp(argument,"done")) - { - if (ch->pcdata->points == pc_race_table[ch->race].points) - { - send_to_char("You didn't pick anything.\n\r",ch); - break; - } - - if (ch->pcdata->points <= 40 + pc_race_table[ch->race].points) - { - sprintf(buf, - "You must take at least %d points of skills and groups", - 40 + pc_race_table[ch->race].points); - send_to_char(buf, ch); - break; - } - - sprintf(buf,"Creation points: %d\n\r",ch->pcdata->points); - send_to_char(buf,ch); - sprintf(buf,"Experience per level: %d\n\r", - exp_per_level(ch,ch->gen_data->points_chosen)); - if (ch->pcdata->points < 40) - ch->train = (40 - ch->pcdata->points + 1) / 2; - free_gen_data(ch->gen_data); - ch->gen_data = NULL; - send_to_char(buf,ch); - write_to_buffer( d, "\n\r", 2 ); - write_to_buffer(d, - "Please pick a weapon from the following choices:\n\r",0); - buf[0] = '\0'; - for ( i = 0; weapon_table[i].name != NULL; i++) - if (ch->pcdata->learned[*weapon_table[i].gsn] > 0) - { - strcat(buf,weapon_table[i].name); - strcat(buf," "); - } - strcat(buf,"\n\rYour choice? "); - write_to_buffer(d,buf,0); - d->connected = CON_PICK_WEAPON; - break; - } - - if (!parse_gen_groups(ch,argument)) - send_to_char( - "Choices are: list,learned,premise,add,drop,info,help, and done.\n\r" - ,ch); - - do_function(ch, &do_help, "menu choice"); - break; - - case CON_READ_IMOTD: - write_to_buffer(d,"\n\r",2); - do_function(ch, &do_help, "motd"); - d->connected = CON_READ_MOTD; - break; - - case CON_READ_MOTD: - if ( ch->pcdata == NULL || ch->pcdata->pwd[0] == '\0') - { - write_to_buffer( d, "Warning! Null password!\n\r",0 ); - write_to_buffer( d, "Please report old password with bug.\n\r",0); - write_to_buffer( d, - "Type 'password null ' to fix.\n\r",0); - } - - write_to_buffer( d, - "\n\rWelcome to ROM 2.4. Please do not feed the mobiles.\n\r", - 0 ); - ch->next = char_list; - char_list = ch; - d->connected = CON_PLAYING; - reset_char(ch); - - if ( ch->level == 0 ) - { - - ch->perm_stat[class_table[ch->class].attr_prime] += 3; - - ch->level = 1; - ch->exp = exp_per_level(ch,ch->pcdata->points); - ch->hit = ch->max_hit; - ch->mana = ch->max_mana; - ch->move = ch->max_move; - ch->train = 3; - ch->practice = 5; - sprintf( buf, "the %s", - title_table [ch->class] [ch->level] - [ch->sex == SEX_FEMALE ? 1 : 0] ); - set_title( ch, buf ); - - do_function (ch, &do_outfit,""); - obj_to_char(create_object(get_obj_index(OBJ_VNUM_MAP),0),ch); - - char_to_room( ch, get_room_index( ROOM_VNUM_SCHOOL ) ); - send_to_char("\n\r",ch); - do_function(ch, &do_help, "newbie info"); - send_to_char("\n\r",ch); - } - else if ( ch->in_room != NULL ) - { - char_to_room( ch, ch->in_room ); - } - else if ( IS_IMMORTAL(ch) ) - { - char_to_room( ch, get_room_index( ROOM_VNUM_CHAT ) ); - } - else - { - char_to_room( ch, get_room_index( ROOM_VNUM_TEMPLE ) ); - } - - act( "$n has entered the game.", ch, NULL, NULL, TO_ROOM ); - do_function(ch, &do_look, "auto" ); - - wiznet("$N has left real life behind.",ch,NULL, - WIZ_LOGINS,WIZ_SITES,get_trust(ch)); - - if (ch->pet != NULL) - { - char_to_room(ch->pet,ch->in_room); - act("$n has entered the game.",ch->pet,NULL,NULL,TO_ROOM); - } - - do_function(ch, &do_unread, ""); - break; - } - - return; -} - - - -/* - * Parse a name for acceptability. - */ -bool check_parse_name( char *name ) -{ - int clan; - - /* - * Reserved words. - */ - if (is_exact_name(name, - "all auto immortal self someone something the you loner")) - { - return FALSE; - } - - /* check clans */ - for (clan = 0; clan < MAX_CLAN; clan++) - { - if (LOWER(name[0]) == LOWER(clan_table[clan].name[0]) - && !str_cmp(name,clan_table[clan].name)) - return FALSE; - } - - if (str_cmp(capitalize(name),"Alander") && (!str_prefix("Alan",name) - || !str_suffix("Alander",name))) - return FALSE; - - /* - * Length restrictions. - */ - - if ( strlen(name) < 2 ) - return FALSE; - -#if defined(MSDOS) - if ( strlen(name) > 8 ) - return FALSE; -#endif - -#if defined(macintosh) || defined(unix) - if ( strlen(name) > 12 ) - return FALSE; -#endif - - /* - * Alphanumerics only. - * Lock out IllIll twits. - */ - { - char *pc; - bool fIll,adjcaps = FALSE,cleancaps = FALSE; - int total_caps = 0; - - fIll = TRUE; - for ( pc = name; *pc != '\0'; pc++ ) - { - if ( !isalpha(*pc) ) - return FALSE; - - if ( isupper(*pc)) /* ugly anti-caps hack */ - { - if (adjcaps) - cleancaps = TRUE; - total_caps++; - adjcaps = TRUE; - } - else - adjcaps = FALSE; - - if ( LOWER(*pc) != 'i' && LOWER(*pc) != 'l' ) - fIll = FALSE; - } - - if ( fIll ) - return FALSE; - - if (cleancaps || (total_caps > (strlen(name)) / 2 && strlen(name) < 3)) - return FALSE; - } - - /* - * Prevent players from naming themselves after mobs. - */ - { - extern MOB_INDEX_DATA *mob_index_hash[MAX_KEY_HASH]; - MOB_INDEX_DATA *pMobIndex; - int iHash; - - for ( iHash = 0; iHash < MAX_KEY_HASH; iHash++ ) - { - for ( pMobIndex = mob_index_hash[iHash]; - pMobIndex != NULL; - pMobIndex = pMobIndex->next ) - { - if ( is_name( name, pMobIndex->player_name ) ) - return FALSE; - } - } - } - - return TRUE; -} - - - -/* - * Look for link-dead player to reconnect. - */ -bool check_reconnect( DESCRIPTOR_DATA *d, char *name, bool fConn ) -{ - CHAR_DATA *ch; - - for ( ch = char_list; ch != NULL; ch = ch->next ) - { - if ( !IS_NPC(ch) - && (!fConn || ch->desc == NULL) - && !str_cmp( d->character->name, ch->name ) ) - { - if ( fConn == FALSE ) - { - free_string( d->character->pcdata->pwd ); - d->character->pcdata->pwd = str_dup( ch->pcdata->pwd ); - } - else - { - free_char( d->character ); - d->character = ch; - ch->desc = d; - ch->timer = 0; - send_to_char( - "Reconnecting. Type replay to see missed tells.\n\r", ch ); - act( "$n has reconnected.", ch, NULL, NULL, TO_ROOM ); - - sprintf( log_buf, "%s@%s reconnected.", ch->name, d->host ); - log_string( log_buf ); - wiznet("$N groks the fullness of $S link.", - ch,NULL,WIZ_LINKS,0,0); - d->connected = CON_PLAYING; - } - return TRUE; - } - } - - return FALSE; -} - - - -/* - * Check if already playing. - */ -bool check_playing( DESCRIPTOR_DATA *d, char *name ) -{ - DESCRIPTOR_DATA *dold; - - for ( dold = descriptor_list; dold; dold = dold->next ) - { - if ( dold != d - && dold->character != NULL - && dold->connected != CON_GET_NAME - && dold->connected != CON_GET_OLD_PASSWORD - && !str_cmp( name, dold->original - ? dold->original->name : dold->character->name ) ) - { - write_to_buffer( d, "That character is already playing.\n\r",0); - write_to_buffer( d, "Do you wish to connect anyway (Y/N)?",0); - d->connected = CON_BREAK_CONNECT; - return TRUE; - } - } - - return FALSE; -} - - - -void stop_idling( CHAR_DATA *ch ) -{ - if ( ch == NULL - || ch->desc == NULL - || ch->desc->connected != CON_PLAYING - || ch->was_in_room == NULL - || ch->in_room != get_room_index(ROOM_VNUM_LIMBO)) - return; - - ch->timer = 0; - char_from_room( ch ); - char_to_room( ch, ch->was_in_room ); - ch->was_in_room = NULL; - act( "$n has returned from the void.", ch, NULL, NULL, TO_ROOM ); - return; -} - - - -/* - * Write to one char. - */ -void send_to_char( const char *txt, CHAR_DATA *ch ) -{ - if ( txt != NULL && ch->desc != NULL ) - write_to_buffer( ch->desc, txt, strlen(txt) ); - return; -} - -/* - * Send a page to one char. - */ -void page_to_char( const char *txt, CHAR_DATA *ch ) -{ - if ( txt == NULL || ch->desc == NULL) - return; - - if (ch->lines == 0 ) - { - send_to_char(txt,ch); - return; - } - -#if defined(macintosh) - send_to_char(txt,ch); -#else - ch->desc->showstr_head = alloc_mem(strlen(txt) + 1); - strcpy(ch->desc->showstr_head,txt); - ch->desc->showstr_point = ch->desc->showstr_head; - show_string(ch->desc,""); -#endif -} - - -/* string pager */ -void show_string(struct descriptor_data *d, char *input) -{ - char buffer[4*MAX_STRING_LENGTH]; - char buf[MAX_INPUT_LENGTH]; - register char *scan, *chk; - int lines = 0, toggle = 1; - int show_lines; - - one_argument(input,buf); - if (buf[0] != '\0') - { - if (d->showstr_head) - { - free_mem(d->showstr_head,strlen(d->showstr_head)); - d->showstr_head = 0; - } - d->showstr_point = 0; - return; - } - - if (d->character) - show_lines = d->character->lines; - else - show_lines = 0; - - for (scan = buffer; ; scan++, d->showstr_point++) - { - if (((*scan = *d->showstr_point) == '\n' || *scan == '\r') - && (toggle = -toggle) < 0) - lines++; - - else if (!*scan || (show_lines > 0 && lines >= show_lines)) - { - *scan = '\0'; - write_to_buffer(d,buffer,strlen(buffer)); - for (chk = d->showstr_point; isspace(*chk); chk++); - { - if (!*chk) - { - if (d->showstr_head) - { - free_mem(d->showstr_head,strlen(d->showstr_head)); - d->showstr_head = 0; - } - d->showstr_point = 0; - } - } - return; - } - } - return; -} - - -/* quick sex fixer */ -void fix_sex(CHAR_DATA *ch) -{ - if (ch->sex < 0 || ch->sex > 2) - ch->sex = IS_NPC(ch) ? 0 : ch->pcdata->true_sex; -} - -void act_new( const char *format, CHAR_DATA *ch, const void *arg1, - const void *arg2, int type, int min_pos) -{ - static char * const he_she [] = { "it", "he", "she" }; - static char * const him_her [] = { "it", "him", "her" }; - static char * const his_her [] = { "its", "his", "her" }; - - char buf[MAX_STRING_LENGTH]; - char fname[MAX_INPUT_LENGTH]; - CHAR_DATA *to; - CHAR_DATA *vch = (CHAR_DATA *) arg2; - OBJ_DATA *obj1 = (OBJ_DATA *) arg1; - OBJ_DATA *obj2 = (OBJ_DATA *) arg2; - const char *str; - const char *i; - char *point; - - /* - * Discard null and zero-length messages. - */ - if ( format == NULL || format[0] == '\0' ) - return; - - /* discard null rooms and chars */ - if (ch == NULL || ch->in_room == NULL) - return; - - to = ch->in_room->people; - if ( type == TO_VICT ) - { - if ( vch == NULL ) - { - bug( "Act: null vch with TO_VICT.", 0 ); - return; - } - - if (vch->in_room == NULL) - return; - - to = vch->in_room->people; - } - - for ( ; to != NULL; to = to->next_in_room ) - { - if ( to->desc == NULL || to->position < min_pos ) - continue; - - if ( (type == TO_CHAR) && to != ch ) - continue; - if ( type == TO_VICT && ( to != vch || to == ch ) ) - continue; - if ( type == TO_ROOM && to == ch ) - continue; - if ( type == TO_NOTVICT && (to == ch || to == vch) ) - continue; - - point = buf; - str = format; - while ( *str != '\0' ) - { - if ( *str != '$' ) - { - *point++ = *str++; - continue; - } - ++str; - - if ( arg2 == NULL && *str >= 'A' && *str <= 'Z' ) - { - bug( "Act: missing arg2 for code %d.", *str ); - i = " <@@@> "; - } - else - { - switch ( *str ) - { - default: bug( "Act: bad code %d.", *str ); - i = " <@@@> "; break; - /* Thx alex for 't' idea */ - case 't': i = (char *) arg1; break; - case 'T': i = (char *) arg2; break; - case 'n': i = PERS( ch, to ); break; - case 'N': i = PERS( vch, to ); break; - case 'e': i = he_she [URANGE(0, ch ->sex, 2)]; break; - case 'E': i = he_she [URANGE(0, vch ->sex, 2)]; break; - case 'm': i = him_her [URANGE(0, ch ->sex, 2)]; break; - case 'M': i = him_her [URANGE(0, vch ->sex, 2)]; break; - case 's': i = his_her [URANGE(0, ch ->sex, 2)]; break; - case 'S': i = his_her [URANGE(0, vch ->sex, 2)]; break; - - case 'p': - i = can_see_obj( to, obj1 ) - ? obj1->short_descr - : "something"; - break; - - case 'P': - i = can_see_obj( to, obj2 ) - ? obj2->short_descr - : "something"; - break; - - case 'd': - if ( arg2 == NULL || ((char *) arg2)[0] == '\0' ) - { - i = "door"; - } - else - { - one_argument( (char *) arg2, fname ); - i = fname; - } - break; - } - } - - ++str; - while ( ( *point = *i ) != '\0' ) - ++point, ++i; - } - - *point++ = '\n'; - *point++ = '\r'; - buf[0] = UPPER(buf[0]); - write_to_buffer( to->desc, buf, point - buf ); - } - - return; -} - - - -/* - * Macintosh support functions. - */ -#if defined(macintosh) -int gettimeofday( struct timeval *tp, void *tzp ) -{ - tp->tv_sec = time( NULL ); - tp->tv_usec = 0; -} -#endif diff --git a/archive/src/const.c b/archive/src/const.c deleted file mode 100644 index 71eae1f..0000000 --- a/archive/src/const.c +++ /dev/null @@ -1,2125 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#endif -#include -#include -#include "merc.h" -#include "magic.h" -#include "interp.h" - - -/* item type list */ -const struct item_type item_table [] = -{ - { ITEM_LIGHT, "light" }, - { ITEM_SCROLL, "scroll" }, - { ITEM_WAND, "wand" }, - { ITEM_STAFF, "staff" }, - { ITEM_WEAPON, "weapon" }, - { ITEM_TREASURE, "treasure" }, - { ITEM_ARMOR, "armor" }, - { ITEM_POTION, "potion" }, - { ITEM_CLOTHING, "clothing" }, - { ITEM_FURNITURE, "furniture" }, - { ITEM_TRASH, "trash" }, - { ITEM_CONTAINER, "container" }, - { ITEM_DRINK_CON, "drink" }, - { ITEM_KEY, "key" }, - { ITEM_FOOD, "food" }, - { ITEM_MONEY, "money" }, - { ITEM_BOAT, "boat" }, - { ITEM_CORPSE_NPC,"npc_corpse" }, - { ITEM_CORPSE_PC, "pc_corpse" }, - { ITEM_FOUNTAIN, "fountain" }, - { ITEM_PILL, "pill" }, - { ITEM_PROTECT, "protect" }, - { ITEM_MAP, "map" }, - { ITEM_PORTAL, "portal" }, - { ITEM_WARP_STONE,"warp_stone" }, - { ITEM_ROOM_KEY, "room_key" }, - { ITEM_GEM, "gem" }, - { ITEM_JEWELRY, "jewelry" }, - { ITEM_JUKEBOX, "jukebox" }, - { 0, NULL } -}; - - -/* weapon selection table */ -const struct weapon_type weapon_table [] = -{ - { "sword", OBJ_VNUM_SCHOOL_SWORD, WEAPON_SWORD, &gsn_sword }, - { "mace", OBJ_VNUM_SCHOOL_MACE, WEAPON_MACE, &gsn_mace }, - { "dagger", OBJ_VNUM_SCHOOL_DAGGER, WEAPON_DAGGER, &gsn_dagger }, - { "axe", OBJ_VNUM_SCHOOL_AXE, WEAPON_AXE, &gsn_axe }, - { "staff", OBJ_VNUM_SCHOOL_STAFF, WEAPON_SPEAR, &gsn_spear }, - { "flail", OBJ_VNUM_SCHOOL_FLAIL, WEAPON_FLAIL, &gsn_flail }, - { "whip", OBJ_VNUM_SCHOOL_WHIP, WEAPON_WHIP, &gsn_whip }, - { "polearm", OBJ_VNUM_SCHOOL_POLEARM,WEAPON_POLEARM, &gsn_polearm }, - { NULL, 0, 0, NULL } -}; - - - -/* wiznet table and prototype for future flag setting */ -const struct wiznet_type wiznet_table [] = -{ - { "on", WIZ_ON, IM }, - { "prefix", WIZ_PREFIX, IM }, - { "ticks", WIZ_TICKS, IM }, - { "logins", WIZ_LOGINS, IM }, - { "sites", WIZ_SITES, L4 }, - { "links", WIZ_LINKS, L7 }, - { "newbies", WIZ_NEWBIE, IM }, - { "spam", WIZ_SPAM, L5 }, - { "deaths", WIZ_DEATHS, IM }, - { "resets", WIZ_RESETS, L4 }, - { "mobdeaths", WIZ_MOBDEATHS, L4 }, - { "flags", WIZ_FLAGS, L5 }, - { "penalties", WIZ_PENALTIES, L5 }, - { "saccing", WIZ_SACCING, L5 }, - { "levels", WIZ_LEVELS, IM }, - { "load", WIZ_LOAD, L2 }, - { "restore", WIZ_RESTORE, L2 }, - { "snoops", WIZ_SNOOPS, L2 }, - { "switches", WIZ_SWITCHES, L2 }, - { "secure", WIZ_SECURE, L1 }, - { NULL, 0, 0 } -}; - -/* attack table -- not very organized :( */ -const struct attack_type attack_table [MAX_DAMAGE_MESSAGE] = -{ - { "none", "hit", -1 }, /* 0 */ - { "slice", "slice", DAM_SLASH }, - { "stab", "stab", DAM_PIERCE }, - { "slash", "slash", DAM_SLASH }, - { "whip", "whip", DAM_SLASH }, - { "claw", "claw", DAM_SLASH }, /* 5 */ - { "blast", "blast", DAM_BASH }, - { "pound", "pound", DAM_BASH }, - { "crush", "crush", DAM_BASH }, - { "grep", "grep", DAM_SLASH }, - { "bite", "bite", DAM_PIERCE }, /* 10 */ - { "pierce", "pierce", DAM_PIERCE }, - { "suction", "suction", DAM_BASH }, - { "beating", "beating", DAM_BASH }, - { "digestion", "digestion", DAM_ACID }, - { "charge", "charge", DAM_BASH }, /* 15 */ - { "slap", "slap", DAM_BASH }, - { "punch", "punch", DAM_BASH }, - { "wrath", "wrath", DAM_ENERGY }, - { "magic", "magic", DAM_ENERGY }, - { "divine", "divine power", DAM_HOLY }, /* 20 */ - { "cleave", "cleave", DAM_SLASH }, - { "scratch", "scratch", DAM_PIERCE }, - { "peck", "peck", DAM_PIERCE }, - { "peckb", "peck", DAM_BASH }, - { "chop", "chop", DAM_SLASH }, /* 25 */ - { "sting", "sting", DAM_PIERCE }, - { "smash", "smash", DAM_BASH }, - { "shbite", "shocking bite",DAM_LIGHTNING }, - { "flbite", "flaming bite", DAM_FIRE }, - { "frbite", "freezing bite", DAM_COLD }, /* 30 */ - { "acbite", "acidic bite", DAM_ACID }, - { "chomp", "chomp", DAM_PIERCE }, - { "drain", "life drain", DAM_NEGATIVE }, - { "thrust", "thrust", DAM_PIERCE }, - { "slime", "slime", DAM_ACID }, - { "shock", "shock", DAM_LIGHTNING }, - { "thwack", "thwack", DAM_BASH }, - { "flame", "flame", DAM_FIRE }, - { "chill", "chill", DAM_COLD }, - { NULL, NULL, 0 } -}; - -/* race table */ -const struct race_type race_table [] = -{ -/* - { - name, pc_race?, - act bits, aff_by bits, off bits, - imm, res, vuln, - form, parts - }, -*/ - { "unique", FALSE, 0, 0, 0, 0, 0, 0, 0, 0 }, - - { - "human", TRUE, - 0, 0, 0, - 0, 0, 0, - A|H|M|V, A|B|C|D|E|F|G|H|I|J|K - }, - - { - "elf", TRUE, - 0, AFF_INFRARED, 0, - 0, RES_CHARM, VULN_IRON, - A|H|M|V, A|B|C|D|E|F|G|H|I|J|K - }, - - { - "dwarf", TRUE, - 0, AFF_INFRARED, 0, - 0, RES_POISON|RES_DISEASE, VULN_DROWNING, - A|H|M|V, A|B|C|D|E|F|G|H|I|J|K - }, - - { - "giant", TRUE, - 0, 0, 0, - 0, RES_FIRE|RES_COLD, VULN_MENTAL|VULN_LIGHTNING, - A|H|M|V, A|B|C|D|E|F|G|H|I|J|K - }, - - { - "bat", FALSE, - 0, AFF_FLYING|AFF_DARK_VISION, OFF_DODGE|OFF_FAST, - 0, 0, VULN_LIGHT, - A|G|V, A|C|D|E|F|H|J|K|P - }, - - { - "bear", FALSE, - 0, 0, OFF_CRUSH|OFF_DISARM|OFF_BERSERK, - 0, RES_BASH|RES_COLD, 0, - A|G|V, A|B|C|D|E|F|H|J|K|U|V - }, - - { - "cat", FALSE, - 0, AFF_DARK_VISION, OFF_FAST|OFF_DODGE, - 0, 0, 0, - A|G|V, A|C|D|E|F|H|J|K|Q|U|V - }, - - { - "centipede", FALSE, - 0, AFF_DARK_VISION, 0, - 0, RES_PIERCE|RES_COLD, VULN_BASH, - A|B|G|O, A|C|K - }, - - { - "dog", FALSE, - 0, 0, OFF_FAST, - 0, 0, 0, - A|G|V, A|C|D|E|F|H|J|K|U|V - }, - - { - "doll", FALSE, - 0, 0, 0, - IMM_COLD|IMM_POISON|IMM_HOLY|IMM_NEGATIVE|IMM_MENTAL|IMM_DISEASE - |IMM_DROWNING, RES_BASH|RES_LIGHT, - VULN_SLASH|VULN_FIRE|VULN_ACID|VULN_LIGHTNING|VULN_ENERGY, - E|J|M|cc, A|B|C|G|H|K - }, - - { "dragon", FALSE, - 0, AFF_INFRARED|AFF_FLYING, 0, - 0, RES_FIRE|RES_BASH|RES_CHARM, - VULN_PIERCE|VULN_COLD, - A|H|Z, A|C|D|E|F|G|H|I|J|K|P|Q|U|V|X - }, - - { - "fido", FALSE, - 0, 0, OFF_DODGE|ASSIST_RACE, - 0, 0, VULN_MAGIC, - A|B|G|V, A|C|D|E|F|H|J|K|Q|V - }, - - { - "fox", FALSE, - 0, AFF_DARK_VISION, OFF_FAST|OFF_DODGE, - 0, 0, 0, - A|G|V, A|C|D|E|F|H|J|K|Q|V - }, - - { - "goblin", FALSE, - 0, AFF_INFRARED, 0, - 0, RES_DISEASE, VULN_MAGIC, - A|H|M|V, A|B|C|D|E|F|G|H|I|J|K - }, - - { - "hobgoblin", FALSE, - 0, AFF_INFRARED, 0, - 0, RES_DISEASE|RES_POISON, 0, - A|H|M|V, A|B|C|D|E|F|G|H|I|J|K|Y - }, - - { - "kobold", FALSE, - 0, AFF_INFRARED, 0, - 0, RES_POISON, VULN_MAGIC, - A|B|H|M|V, A|B|C|D|E|F|G|H|I|J|K|Q - }, - - { - "lizard", FALSE, - 0, 0, 0, - 0, RES_POISON, VULN_COLD, - A|G|X|cc, A|C|D|E|F|H|K|Q|V - }, - - { - "modron", FALSE, - 0, AFF_INFRARED, ASSIST_RACE|ASSIST_ALIGN, - IMM_CHARM|IMM_DISEASE|IMM_MENTAL|IMM_HOLY|IMM_NEGATIVE, - RES_FIRE|RES_COLD|RES_ACID, 0, - H, A|B|C|G|H|J|K - }, - - { - "orc", FALSE, - 0, AFF_INFRARED, 0, - 0, RES_DISEASE, VULN_LIGHT, - A|H|M|V, A|B|C|D|E|F|G|H|I|J|K - }, - - { - "pig", FALSE, - 0, 0, 0, - 0, 0, 0, - A|G|V, A|C|D|E|F|H|J|K - }, - - { - "rabbit", FALSE, - 0, 0, OFF_DODGE|OFF_FAST, - 0, 0, 0, - A|G|V, A|C|D|E|F|H|J|K - }, - - { - "school monster", FALSE, - ACT_NOALIGN, 0, 0, - IMM_CHARM|IMM_SUMMON, 0, VULN_MAGIC, - A|M|V, A|B|C|D|E|F|H|J|K|Q|U - }, - - { - "snake", FALSE, - 0, 0, 0, - 0, RES_POISON, VULN_COLD, - A|G|X|Y|cc, A|D|E|F|K|L|Q|V|X - }, - - { - "song bird", FALSE, - 0, AFF_FLYING, OFF_FAST|OFF_DODGE, - 0, 0, 0, - A|G|W, A|C|D|E|F|H|K|P - }, - - { - "troll", FALSE, - 0, AFF_REGENERATION|AFF_INFRARED|AFF_DETECT_HIDDEN, - OFF_BERSERK, - 0, RES_CHARM|RES_BASH, VULN_FIRE|VULN_ACID, - A|B|H|M|V, A|B|C|D|E|F|G|H|I|J|K|U|V - }, - - { - "water fowl", FALSE, - 0, AFF_SWIM|AFF_FLYING, 0, - 0, RES_DROWNING, 0, - A|G|W, A|C|D|E|F|H|K|P - }, - - { - "wolf", FALSE, - 0, AFF_DARK_VISION, OFF_FAST|OFF_DODGE, - 0, 0, 0, - A|G|V, A|C|D|E|F|J|K|Q|V - }, - - { - "wyvern", FALSE, - 0, AFF_FLYING|AFF_DETECT_INVIS|AFF_DETECT_HIDDEN, - OFF_BASH|OFF_FAST|OFF_DODGE, - IMM_POISON, 0, VULN_LIGHT, - A|B|G|Z, A|C|D|E|F|H|J|K|Q|V|X - }, - - { - "unique", FALSE, - 0, 0, 0, - 0, 0, 0, - 0, 0 - }, - - - { - NULL, 0, 0, 0, 0, 0, 0 - } -}; - -const struct pc_race_type pc_race_table [] = -{ - { "null race", "", 0, { 100, 100, 100, 100 }, - { "" }, { 13, 13, 13, 13, 13 }, { 18, 18, 18, 18, 18 }, 0 }, - -/* - { - "race name", short name, points, { class multipliers }, - { bonus skills }, - { base stats }, { max stats }, size - }, -*/ - { - "human", "Human", 0, { 100, 100, 100, 100 }, - { "" }, - { 13, 13, 13, 13, 13 }, { 18, 18, 18, 18, 18 }, SIZE_MEDIUM - }, - - { - "elf", " Elf ", 5, { 100, 125, 100, 120 }, - { "sneak", "hide" }, - { 12, 14, 13, 15, 11 }, { 16, 20, 18, 21, 15 }, SIZE_SMALL - }, - - { - "dwarf", "Dwarf", 8, { 150, 100, 125, 100 }, - { "berserk" }, - { 14, 12, 14, 10, 15 }, { 20, 16, 19, 14, 21 }, SIZE_MEDIUM - }, - - { - "giant", "Giant", 6, { 200, 150, 150, 105 }, - { "bash", "fast healing" }, - { 16, 11, 13, 11, 14 }, { 22, 15, 18, 15, 20 }, SIZE_LARGE - } -}; - - - - -/* - * Class table. - */ -const struct class_type class_table [MAX_CLASS] = -{ - { - "mage", "Mag", STAT_INT, OBJ_VNUM_SCHOOL_DAGGER, - { 3018, 9618 }, 75, 20, 6, 6, 8, TRUE, - "mage basics", "mage default" - }, - - { - "cleric", "Cle", STAT_WIS, OBJ_VNUM_SCHOOL_MACE, - { 3003, 9619 }, 75, 20, 2, 7, 10, TRUE, - "cleric basics", "cleric default" - }, - - { - "thief", "Thi", STAT_DEX, OBJ_VNUM_SCHOOL_DAGGER, - { 3028, 9639 }, 75, 20, -4, 8, 13, FALSE, - "thief basics", "thief default" - }, - - { - "warrior", "War", STAT_STR, OBJ_VNUM_SCHOOL_SWORD, - { 3022, 9633 }, 75, 20, -10, 11, 15, FALSE, - "warrior basics", "warrior default" - } -}; - - - -/* - * Titles. - */ -char * const title_table [MAX_CLASS][MAX_LEVEL+1][2] = -{ - { - { "Man", "Woman" }, - - { "Apprentice of Magic", "Apprentice of Magic" }, - { "Spell Student", "Spell Student" }, - { "Scholar of Magic", "Scholar of Magic" }, - { "Delver in Spells", "Delveress in Spells" }, - { "Medium of Magic", "Medium of Magic" }, - - { "Scribe of Magic", "Scribess of Magic" }, - { "Seer", "Seeress" }, - { "Sage", "Sage" }, - { "Illusionist", "Illusionist" }, - { "Abjurer", "Abjuress" }, - - { "Invoker", "Invoker" }, - { "Enchanter", "Enchantress" }, - { "Conjurer", "Conjuress" }, - { "Magician", "Witch" }, - { "Creator", "Creator" }, - - { "Savant", "Savant" }, - { "Magus", "Craftess" }, - { "Wizard", "Wizard" }, - { "Warlock", "War Witch" }, - { "Sorcerer", "Sorceress" }, - - { "Elder Sorcerer", "Elder Sorceress" }, - { "Grand Sorcerer", "Grand Sorceress" }, - { "Great Sorcerer", "Great Sorceress" }, - { "Golem Maker", "Golem Maker" }, - { "Greater Golem Maker", "Greater Golem Maker" }, - - { "Maker of Stones", "Maker of Stones", }, - { "Maker of Potions", "Maker of Potions", }, - { "Maker of Scrolls", "Maker of Scrolls", }, - { "Maker of Wands", "Maker of Wands", }, - { "Maker of Staves", "Maker of Staves", }, - - { "Demon Summoner", "Demon Summoner" }, - { "Greater Demon Summoner", "Greater Demon Summoner" }, - { "Dragon Charmer", "Dragon Charmer" }, - { "Greater Dragon Charmer", "Greater Dragon Charmer" }, - { "Master of all Magic", "Master of all Magic" }, - - { "Master Mage", "Master Mage" }, - { "Master Mage", "Master Mage" }, - { "Master Mage", "Master Mage" }, - { "Master Mage", "Master Mage" }, - { "Master Mage", "Master Mage" }, - - { "Master Mage", "Master Mage" }, - { "Master Mage", "Master Mage" }, - { "Master Mage", "Master Mage" }, - { "Master Mage", "Master Mage" }, - { "Master Mage", "Master Mage" }, - - { "Master Mage", "Master Mage" }, - { "Master Mage", "Master Mage" }, - { "Master Mage", "Master Mage" }, - { "Master Mage", "Master Mage" }, - { "Master Mage", "Master Mage" }, - - { "Mage Hero", "Mage Heroine" }, - { "Avatar of Magic", "Avatar of Magic" }, - { "Angel of Magic", "Angel of Magic" }, - { "Demigod of Magic", "Demigoddess of Magic" }, - { "Immortal of Magic", "Immortal of Magic" }, - { "God of Magic", "Goddess of Magic" }, - { "Deity of Magic", "Deity of Magic" }, - { "Supremity of Magic", "Supremity of Magic" }, - { "Creator", "Creator" }, - { "Implementor", "Implementress" } - }, - - { - { "Man", "Woman" }, - - { "Believer", "Believer" }, - { "Attendant", "Attendant" }, - { "Acolyte", "Acolyte" }, - { "Novice", "Novice" }, - { "Missionary", "Missionary" }, - - { "Adept", "Adept" }, - { "Deacon", "Deaconess" }, - { "Vicar", "Vicaress" }, - { "Priest", "Priestess" }, - { "Minister", "Lady Minister" }, - - { "Canon", "Canon" }, - { "Levite", "Levitess" }, - { "Curate", "Curess" }, - { "Monk", "Nun" }, - { "Healer", "Healess" }, - - { "Chaplain", "Chaplain" }, - { "Expositor", "Expositress" }, - { "Bishop", "Bishop" }, - { "Arch Bishop", "Arch Lady of the Church" }, - { "Patriarch", "Matriarch" }, - - { "Elder Patriarch", "Elder Matriarch" }, - { "Grand Patriarch", "Grand Matriarch" }, - { "Great Patriarch", "Great Matriarch" }, - { "Demon Killer", "Demon Killer" }, - { "Greater Demon Killer", "Greater Demon Killer" }, - - { "Cardinal of the Sea", "Cardinal of the Sea" }, - { "Cardinal of the Earth", "Cardinal of the Earth" }, - { "Cardinal of the Air", "Cardinal of the Air" }, - { "Cardinal of the Ether", "Cardinal of the Ether" }, - { "Cardinal of the Heavens", "Cardinal of the Heavens" }, - - { "Avatar of an Immortal", "Avatar of an Immortal" }, - { "Avatar of a Deity", "Avatar of a Deity" }, - { "Avatar of a Supremity", "Avatar of a Supremity" }, - { "Avatar of an Implementor", "Avatar of an Implementor" }, - { "Master of all Divinity", "Mistress of all Divinity" }, - - { "Master Cleric", "Master Cleric" }, - { "Master Cleric", "Master Cleric" }, - { "Master Cleric", "Master Cleric" }, - { "Master Cleric", "Master Cleric" }, - { "Master Cleric", "Master Cleric" }, - - { "Master Cleric", "Master Cleric" }, - { "Master Cleric", "Master Cleric" }, - { "Master Cleric", "Master Cleric" }, - { "Master Cleric", "Master Cleric" }, - { "Master Cleric", "Master Cleric" }, - - { "Master Cleric", "Master Cleric" }, - { "Master Cleric", "Master Cleric" }, - { "Master Cleric", "Master Cleric" }, - { "Master Cleric", "Master Cleric" }, - { "Master Cleric", "Master Cleric" }, - - { "Holy Hero", "Holy Heroine" }, - { "Holy Avatar", "Holy Avatar" }, - { "Angel", "Angel" }, - { "Demigod", "Demigoddess", }, - { "Immortal", "Immortal" }, - { "God", "Goddess" }, - { "Deity", "Deity" }, - { "Supreme Master", "Supreme Mistress" }, - { "Creator", "Creator" }, - { "Implementor", "Implementress" } - }, - - { - { "Man", "Woman" }, - - { "Pilferer", "Pilferess" }, - { "Footpad", "Footpad" }, - { "Filcher", "Filcheress" }, - { "Pick-Pocket", "Pick-Pocket" }, - { "Sneak", "Sneak" }, - - { "Pincher", "Pincheress" }, - { "Cut-Purse", "Cut-Purse" }, - { "Snatcher", "Snatcheress" }, - { "Sharper", "Sharpress" }, - { "Rogue", "Rogue" }, - - { "Robber", "Robber" }, - { "Magsman", "Magswoman" }, - { "Highwayman", "Highwaywoman" }, - { "Burglar", "Burglaress" }, - { "Thief", "Thief" }, - - { "Knifer", "Knifer" }, - { "Quick-Blade", "Quick-Blade" }, - { "Killer", "Murderess" }, - { "Brigand", "Brigand" }, - { "Cut-Throat", "Cut-Throat" }, - - { "Spy", "Spy" }, - { "Grand Spy", "Grand Spy" }, - { "Master Spy", "Master Spy" }, - { "Assassin", "Assassin" }, - { "Greater Assassin", "Greater Assassin" }, - - { "Master of Vision", "Mistress of Vision" }, - { "Master of Hearing", "Mistress of Hearing" }, - { "Master of Smell", "Mistress of Smell" }, - { "Master of Taste", "Mistress of Taste" }, - { "Master of Touch", "Mistress of Touch" }, - - { "Crime Lord", "Crime Mistress" }, - { "Infamous Crime Lord", "Infamous Crime Mistress" }, - { "Greater Crime Lord", "Greater Crime Mistress" }, - { "Master Crime Lord", "Master Crime Mistress" }, - { "Godfather", "Godmother" }, - - { "Master Thief", "Master Thief" }, - { "Master Thief", "Master Thief" }, - { "Master Thief", "Master Thief" }, - { "Master Thief", "Master Thief" }, - { "Master Thief", "Master Thief" }, - - { "Master Thief", "Master Thief" }, - { "Master Thief", "Master Thief" }, - { "Master Thief", "Master Thief" }, - { "Master Thief", "Master Thief" }, - { "Master Thief", "Master Thief" }, - - { "Master Thief", "Master Thief" }, - { "Master Thief", "Master Thief" }, - { "Master Thief", "Master Thief" }, - { "Master Thief", "Master Thief" }, - { "Master Thief", "Master Thief" }, - - { "Assassin Hero", "Assassin Heroine" }, - { "Avatar of Death", "Avatar of Death", }, - { "Angel of Death", "Angel of Death" }, - { "Demigod of Assassins", "Demigoddess of Assassins" }, - { "Immortal Assasin", "Immortal Assassin" }, - { "God of Assassins", "God of Assassins", }, - { "Deity of Assassins", "Deity of Assassins" }, - { "Supreme Master", "Supreme Mistress" }, - { "Creator", "Creator" }, - { "Implementor", "Implementress" } - }, - - { - { "Man", "Woman" }, - - { "Swordpupil", "Swordpupil" }, - { "Recruit", "Recruit" }, - { "Sentry", "Sentress" }, - { "Fighter", "Fighter" }, - { "Soldier", "Soldier" }, - - { "Warrior", "Warrior" }, - { "Veteran", "Veteran" }, - { "Swordsman", "Swordswoman" }, - { "Fencer", "Fenceress" }, - { "Combatant", "Combatess" }, - - { "Hero", "Heroine" }, - { "Myrmidon", "Myrmidon" }, - { "Swashbuckler", "Swashbuckleress" }, - { "Mercenary", "Mercenaress" }, - { "Swordmaster", "Swordmistress" }, - - { "Lieutenant", "Lieutenant" }, - { "Champion", "Lady Champion" }, - { "Dragoon", "Lady Dragoon" }, - { "Cavalier", "Lady Cavalier" }, - { "Knight", "Lady Knight" }, - - { "Grand Knight", "Grand Knight" }, - { "Master Knight", "Master Knight" }, - { "Paladin", "Paladin" }, - { "Grand Paladin", "Grand Paladin" }, - { "Demon Slayer", "Demon Slayer" }, - - { "Greater Demon Slayer", "Greater Demon Slayer" }, - { "Dragon Slayer", "Dragon Slayer" }, - { "Greater Dragon Slayer", "Greater Dragon Slayer" }, - { "Underlord", "Underlord" }, - { "Overlord", "Overlord" }, - - { "Baron of Thunder", "Baroness of Thunder" }, - { "Baron of Storms", "Baroness of Storms" }, - { "Baron of Tornadoes", "Baroness of Tornadoes" }, - { "Baron of Hurricanes", "Baroness of Hurricanes" }, - { "Baron of Meteors", "Baroness of Meteors" }, - - { "Master Warrior", "Master Warrior" }, - { "Master Warrior", "Master Warrior" }, - { "Master Warrior", "Master Warrior" }, - { "Master Warrior", "Master Warrior" }, - { "Master Warrior", "Master Warrior" }, - - { "Master Warrior", "Master Warrior" }, - { "Master Warrior", "Master Warrior" }, - { "Master Warrior", "Master Warrior" }, - { "Master Warrior", "Master Warrior" }, - { "Master Warrior", "Master Warrior" }, - - { "Master Warrior", "Master Warrior" }, - { "Master Warrior", "Master Warrior" }, - { "Master Warrior", "Master Warrior" }, - { "Master Warrior", "Master Warrior" }, - { "Master Warrior", "Master Warrior" }, - - { "Knight Hero", "Knight Heroine" }, - { "Avatar of War", "Avatar of War" }, - { "Angel of War", "Angel of War" }, - { "Demigod of War", "Demigoddess of War" }, - { "Immortal Warlord", "Immortal Warlord" }, - { "God of War", "God of War" }, - { "Deity of War", "Deity of War" }, - { "Supreme Master of War", "Supreme Mistress of War" }, - { "Creator", "Creator" }, - { "Implementor", "Implementress" } - } -}; - - - -/* - * Attribute bonus tables. - */ -const struct str_app_type str_app [26] = -{ - { -5, -4, 0, 0 }, /* 0 */ - { -5, -4, 3, 1 }, /* 1 */ - { -3, -2, 3, 2 }, - { -3, -1, 10, 3 }, /* 3 */ - { -2, -1, 25, 4 }, - { -2, -1, 55, 5 }, /* 5 */ - { -1, 0, 80, 6 }, - { -1, 0, 90, 7 }, - { 0, 0, 100, 8 }, - { 0, 0, 100, 9 }, - { 0, 0, 115, 10 }, /* 10 */ - { 0, 0, 115, 11 }, - { 0, 0, 130, 12 }, - { 0, 0, 130, 13 }, /* 13 */ - { 0, 1, 140, 14 }, - { 1, 1, 150, 15 }, /* 15 */ - { 1, 2, 165, 16 }, - { 2, 3, 180, 22 }, - { 2, 3, 200, 25 }, /* 18 */ - { 3, 4, 225, 30 }, - { 3, 5, 250, 35 }, /* 20 */ - { 4, 6, 300, 40 }, - { 4, 6, 350, 45 }, - { 5, 7, 400, 50 }, - { 5, 8, 450, 55 }, - { 6, 9, 500, 60 } /* 25 */ -}; - - - -const struct int_app_type int_app [26] = -{ - { 3 }, /* 0 */ - { 5 }, /* 1 */ - { 7 }, - { 8 }, /* 3 */ - { 9 }, - { 10 }, /* 5 */ - { 11 }, - { 12 }, - { 13 }, - { 15 }, - { 17 }, /* 10 */ - { 19 }, - { 22 }, - { 25 }, - { 28 }, - { 31 }, /* 15 */ - { 34 }, - { 37 }, - { 40 }, /* 18 */ - { 44 }, - { 49 }, /* 20 */ - { 55 }, - { 60 }, - { 70 }, - { 80 }, - { 85 } /* 25 */ -}; - - - -const struct wis_app_type wis_app [26] = -{ - { 0 }, /* 0 */ - { 0 }, /* 1 */ - { 0 }, - { 0 }, /* 3 */ - { 0 }, - { 1 }, /* 5 */ - { 1 }, - { 1 }, - { 1 }, - { 1 }, - { 1 }, /* 10 */ - { 1 }, - { 1 }, - { 1 }, - { 1 }, - { 2 }, /* 15 */ - { 2 }, - { 2 }, - { 3 }, /* 18 */ - { 3 }, - { 3 }, /* 20 */ - { 3 }, - { 4 }, - { 4 }, - { 4 }, - { 5 } /* 25 */ -}; - - - -const struct dex_app_type dex_app [26] = -{ - { 60 }, /* 0 */ - { 50 }, /* 1 */ - { 50 }, - { 40 }, - { 30 }, - { 20 }, /* 5 */ - { 10 }, - { 0 }, - { 0 }, - { 0 }, - { 0 }, /* 10 */ - { 0 }, - { 0 }, - { 0 }, - { 0 }, - { - 10 }, /* 15 */ - { - 15 }, - { - 20 }, - { - 30 }, - { - 40 }, - { - 50 }, /* 20 */ - { - 60 }, - { - 75 }, - { - 90 }, - { -105 }, - { -120 } /* 25 */ -}; - - -const struct con_app_type con_app [26] = -{ - { -4, 20 }, /* 0 */ - { -3, 25 }, /* 1 */ - { -2, 30 }, - { -2, 35 }, /* 3 */ - { -1, 40 }, - { -1, 45 }, /* 5 */ - { -1, 50 }, - { 0, 55 }, - { 0, 60 }, - { 0, 65 }, - { 0, 70 }, /* 10 */ - { 0, 75 }, - { 0, 80 }, - { 0, 85 }, - { 0, 88 }, - { 1, 90 }, /* 15 */ - { 2, 95 }, - { 2, 97 }, - { 3, 99 }, /* 18 */ - { 3, 99 }, - { 4, 99 }, /* 20 */ - { 4, 99 }, - { 5, 99 }, - { 6, 99 }, - { 7, 99 }, - { 8, 99 } /* 25 */ -}; - - - -/* - * Liquid properties. - * Used in world.obj. - */ -const struct liq_type liq_table [] = -{ -/* name color proof, full, thirst, food, ssize */ - { "water", "clear", { 0, 1, 10, 0, 16 } }, - { "beer", "amber", { 12, 1, 8, 1, 12 } }, - { "red wine", "burgundy", { 30, 1, 8, 1, 5 } }, - { "ale", "brown", { 15, 1, 8, 1, 12 } }, - { "dark ale", "dark", { 16, 1, 8, 1, 12 } }, - - { "whisky", "golden", { 120, 1, 5, 0, 2 } }, - { "lemonade", "pink", { 0, 1, 9, 2, 12 } }, - { "firebreather", "boiling", { 190, 0, 4, 0, 2 } }, - { "local specialty", "clear", { 151, 1, 3, 0, 2 } }, - { "slime mold juice", "green", { 0, 2, -8, 1, 2 } }, - - { "milk", "white", { 0, 2, 9, 3, 12 } }, - { "tea", "tan", { 0, 1, 8, 0, 6 } }, - { "coffee", "black", { 0, 1, 8, 0, 6 } }, - { "blood", "red", { 0, 2, -1, 2, 6 } }, - { "salt water", "clear", { 0, 1, -2, 0, 1 } }, - - { "coke", "brown", { 0, 2, 9, 2, 12 } }, - { "root beer", "brown", { 0, 2, 9, 2, 12 } }, - { "elvish wine", "green", { 35, 2, 8, 1, 5 } }, - { "white wine", "golden", { 28, 1, 8, 1, 5 } }, - { "champagne", "golden", { 32, 1, 8, 1, 5 } }, - - { "mead", "honey-colored",{ 34, 2, 8, 2, 12 } }, - { "rose wine", "pink", { 26, 1, 8, 1, 5 } }, - { "benedictine wine", "burgundy", { 40, 1, 8, 1, 5 } }, - { "vodka", "clear", { 130, 1, 5, 0, 2 } }, - { "cranberry juice", "red", { 0, 1, 9, 2, 12 } }, - - { "orange juice", "orange", { 0, 2, 9, 3, 12 } }, - { "absinthe", "green", { 200, 1, 4, 0, 2 } }, - { "brandy", "golden", { 80, 1, 5, 0, 4 } }, - { "aquavit", "clear", { 140, 1, 5, 0, 2 } }, - { "schnapps", "clear", { 90, 1, 5, 0, 2 } }, - - { "icewine", "purple", { 50, 2, 6, 1, 5 } }, - { "amontillado", "burgundy", { 35, 2, 8, 1, 5 } }, - { "sherry", "red", { 38, 2, 7, 1, 5 } }, - { "framboise", "red", { 50, 1, 7, 1, 5 } }, - { "rum", "amber", { 151, 1, 4, 0, 2 } }, - - { "cordial", "clear", { 100, 1, 5, 0, 2 } }, - { NULL, NULL, { 0, 0, 0, 0, 0 } } -}; - - - -/* - * The skill and spell table. - * Slot numbers must never be changed as they appear in #OBJECTS sections. - */ -#define SLOT(n) n - -const struct skill_type skill_table [MAX_SKILL] = -{ - -/* - * Magic spells. - */ - - { - "reserved", { 99, 99, 99, 99 }, { 99, 99, 99, 99}, - 0, TAR_IGNORE, POS_STANDING, - NULL, SLOT( 0), 0, 0, - "", "", "" - }, - - { - "acid blast", { 28, 53, 35, 32 }, { 1, 1, 2, 2}, - spell_acid_blast, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(70), 20, 12, - "acid blast", "!Acid Blast!" - }, - - { - "armor", { 7, 2, 10, 5 }, { 1, 1, 2, 2}, - spell_armor, TAR_CHAR_DEFENSIVE, POS_STANDING, - NULL, SLOT( 1), 5, 12, - "", "You feel less armored.", "" - }, - - { - "bless", { 53, 7, 53, 8 }, { 1, 1, 2, 2}, - spell_bless, TAR_OBJ_CHAR_DEF, POS_STANDING, - NULL, SLOT( 3), 5, 12, - "", "You feel less righteous.", - "$p's holy aura fades." - }, - - { - "blindness", { 12, 8, 17, 15 }, { 1, 1, 2, 2}, - spell_blindness, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - &gsn_blindness, SLOT( 4), 5, 12, - "", "You can see again.", "" - }, - - { - "burning hands", { 7, 53, 10, 9 }, { 1, 1, 2, 2}, - spell_burning_hands, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT( 5), 15, 12, - "burning hands", "!Burning Hands!", "" - }, - - { - "call lightning", { 26, 18, 31, 22 }, { 1, 1, 2, 2}, - spell_call_lightning, TAR_IGNORE, POS_FIGHTING, - NULL, SLOT( 6), 15, 12, - "lightning bolt", "!Call Lightning!", "" - }, - - { "calm", { 48, 16, 50, 20 }, { 1, 1, 2, 2}, - spell_calm, TAR_IGNORE, POS_FIGHTING, - NULL, SLOT(509), 30, 12, - "", "You have lost your peace of mind.", "" - }, - - { - "cancellation", { 18, 26, 34, 34 }, { 1, 1, 2, 2}, - spell_cancellation, TAR_CHAR_DEFENSIVE, POS_FIGHTING, - NULL, SLOT(507), 20, 12, - "" "!cancellation!", "" - }, - - { - "cause critical", { 53, 13, 53, 19 }, { 1, 1, 2, 2}, - spell_cause_critical, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(63), 20, 12, - "spell", "!Cause Critical!", "" - }, - - { - "cause light", { 53, 1, 53, 3 }, { 1, 1, 2, 2}, - spell_cause_light, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(62), 15, 12, - "spell", "!Cause Light!", "" - }, - - { - "cause serious", { 53, 7, 53, 10 }, { 1, 1, 2, 2}, - spell_cause_serious, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(64), 17, 12, - "spell", "!Cause Serious!", "" - }, - - { - "chain lightning", { 33, 53, 39, 36 }, { 1, 1, 2, 2}, - spell_chain_lightning, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(500), 25, 12, - "lightning", "!Chain Lightning!", "" - }, - - { - "change sex", { 53, 53, 53, 53 }, { 1, 1, 2, 2}, - spell_change_sex, TAR_CHAR_DEFENSIVE, POS_FIGHTING, - NULL, SLOT(82), 15, 12, - "", "Your body feels familiar again.", "" - }, - - { - "charm person", { 20, 53, 25, 53 }, { 1, 1, 2, 2}, - spell_charm_person, TAR_CHAR_OFFENSIVE, POS_STANDING, - &gsn_charm_person, SLOT( 7), 5, 12, - "", "You feel more self-confident.", "" - }, - - { - "chill touch", { 4, 53, 6, 6 }, { 1, 1, 2, 2}, - spell_chill_touch, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT( 8), 15, 12, - "chilling touch", "You feel less cold.", "" - }, - - { - "colour spray", { 16, 53, 22, 20 }, { 1, 1, 2, 2}, - spell_colour_spray, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(10), 15, 12, - "colour spray", "!Colour Spray!", "" - }, - - { - "continual light", { 6, 4, 6, 9 }, { 1, 1, 2, 2}, - spell_continual_light, TAR_IGNORE, POS_STANDING, - NULL, SLOT(57), 7, 12, - "", "!Continual Light!", "" - }, - - { - "control weather", { 15, 19, 28, 22 }, { 1, 1, 2, 2}, - spell_control_weather, TAR_IGNORE, POS_STANDING, - NULL, SLOT(11), 25, 12, - "", "!Control Weather!", "" - }, - - { - "create food", { 10, 5, 11, 12 }, { 1, 1, 2, 2}, - spell_create_food, TAR_IGNORE, POS_STANDING, - NULL, SLOT(12), 5, 12, - "", "!Create Food!", "" - }, - - { - "create rose", { 16, 11, 10, 24 }, { 1, 1, 2, 2 }, - spell_create_rose, TAR_IGNORE, POS_STANDING, - NULL, SLOT(511), 30, 12, - "", "!Create Rose!", "" - }, - - { - "create spring", { 14, 17, 23, 20 }, { 1, 1, 2, 2}, - spell_create_spring, TAR_IGNORE, POS_STANDING, - NULL, SLOT(80), 20, 12, - "", "!Create Spring!", "" - }, - - { - "create water", { 8, 3, 12, 11 }, { 1, 1, 2, 2}, - spell_create_water, TAR_OBJ_INV, POS_STANDING, - NULL, SLOT(13), 5, 12, - "", "!Create Water!", "" - }, - - { - "cure blindness", { 53, 6, 53, 8 }, { 1, 1, 2, 2}, - spell_cure_blindness, TAR_CHAR_DEFENSIVE, POS_FIGHTING, - NULL, SLOT(14), 5, 12, - "", "!Cure Blindness!", "" - }, - - { - "cure critical", { 53, 13, 53, 19 }, { 1, 1, 2, 2}, - spell_cure_critical, TAR_CHAR_DEFENSIVE, POS_FIGHTING, - NULL, SLOT(15), 20, 12, - "", "!Cure Critical!", "" - }, - - { - "cure disease", { 53, 13, 53, 14 }, { 1, 1, 2, 2}, - spell_cure_disease, TAR_CHAR_DEFENSIVE, POS_STANDING, - NULL, SLOT(501), 20, 12, - "", "!Cure Disease!", "" - }, - - { - "cure light", { 53, 1, 53, 3 }, { 1, 1, 2, 2}, - spell_cure_light, TAR_CHAR_DEFENSIVE, POS_FIGHTING, - NULL, SLOT(16), 10, 12, - "", "!Cure Light!", "" - }, - - { - "cure poison", { 53, 14, 53, 16 }, { 1, 1, 2, 2}, - spell_cure_poison, TAR_CHAR_DEFENSIVE, POS_STANDING, - NULL, SLOT(43), 5, 12, - "", "!Cure Poison!", "" - }, - - { - "cure serious", { 53, 7, 53, 10 }, { 1, 1, 2, 2}, - spell_cure_serious, TAR_CHAR_DEFENSIVE, POS_FIGHTING, - NULL, SLOT(61), 15, 12, - "", "!Cure Serious!", "" - }, - - { - "curse", { 18, 18, 26, 22 }, { 1, 1, 2, 2}, - spell_curse, TAR_OBJ_CHAR_OFF, POS_FIGHTING, - &gsn_curse, SLOT(17), 20, 12, - "curse", "The curse wears off.", - "$p is no longer impure." - }, - - { - "demonfire", { 53, 34, 53, 45 }, { 1, 1, 2, 2}, - spell_demonfire, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(505), 20, 12, - "torments", "!Demonfire!", "" - }, - - { - "detect evil", { 11, 4, 12, 53 }, { 1, 1, 2, 2}, - spell_detect_evil, TAR_CHAR_SELF, POS_STANDING, - NULL, SLOT(18), 5, 12, - "", "The red in your vision disappears.", "" - }, - - { - "detect good", { 11, 4, 12, 53 }, { 1, 1, 2, 2}, - spell_detect_good, TAR_CHAR_SELF, POS_STANDING, - NULL, SLOT(513), 5, 12, - "", "The gold in your vision disappears.", "" - }, - - { - "detect hidden", { 15, 11, 12, 53 }, { 1, 1, 2, 2}, - spell_detect_hidden, TAR_CHAR_SELF, POS_STANDING, - NULL, SLOT(44), 5, 12, - "", "You feel less aware of your surroundings.", - "" - }, - - { - "detect invis", { 3, 8, 6, 53 }, { 1, 1, 2, 2}, - spell_detect_invis, TAR_CHAR_SELF, POS_STANDING, - NULL, SLOT(19), 5, 12, - "", "You no longer see invisible objects.", - "" - }, - - { - "detect magic", { 2, 6, 5, 53 }, { 1, 1, 2, 2}, - spell_detect_magic, TAR_CHAR_SELF, POS_STANDING, - NULL, SLOT(20), 5, 12, - "", "The detect magic wears off.", "" - }, - - { - "detect poison", { 15, 7, 9, 53 }, { 1, 1, 2, 2}, - spell_detect_poison, TAR_OBJ_INV, POS_STANDING, - NULL, SLOT(21), 5, 12, - "", "!Detect Poison!", "" - }, - - { - "dispel evil", { 53, 15, 53, 21 }, { 1, 1, 2, 2}, - spell_dispel_evil, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(22), 15, 12, - "dispel evil", "!Dispel Evil!", "" - }, - - { - "dispel good", { 53, 15, 53, 21 }, { 1, 1, 2, 2}, - spell_dispel_good, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(512), 15, 12, - "dispel good", "!Dispel Good!", "" - }, - - { - "dispel magic", { 16, 24, 30, 30 }, { 1, 1, 2, 2}, - spell_dispel_magic, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(59), 15, 12, - "", "!Dispel Magic!", "" - }, - - { - "earthquake", { 53, 10, 53, 14 }, { 1, 1, 2, 2}, - spell_earthquake, TAR_IGNORE, POS_FIGHTING, - NULL, SLOT(23), 15, 12, - "earthquake", "!Earthquake!", "" - }, - - { - "enchant armor", { 16, 53, 53, 53 }, { 2, 2, 4, 4 }, - spell_enchant_armor, TAR_OBJ_INV, POS_STANDING, - NULL, SLOT(510), 100, 24, - "", "!Enchant Armor!", "" - }, - - { - "enchant weapon", { 17, 53, 53, 53 }, { 2, 2, 4, 4}, - spell_enchant_weapon, TAR_OBJ_INV, POS_STANDING, - NULL, SLOT(24), 100, 24, - "", "!Enchant Weapon!", "" - }, - - { - "energy drain", { 19, 22, 26, 23 }, { 1, 1, 2, 2}, - spell_energy_drain, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(25), 35, 12, - "energy drain", "!Energy Drain!", "" - }, - - { - "faerie fire", { 6, 3, 5, 8 }, { 1, 1, 2, 2}, - spell_faerie_fire, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(72), 5, 12, - "faerie fire", "The pink aura around you fades away.", - "" - }, - - { - "faerie fog", { 14, 21, 16, 24 }, { 1, 1, 2, 2}, - spell_faerie_fog, TAR_IGNORE, POS_STANDING, - NULL, SLOT(73), 12, 12, - "faerie fog", "!Faerie Fog!", "" - }, - - { - "farsight", { 14, 16, 16, 53 }, { 1, 1, 2, 2}, - spell_farsight, TAR_IGNORE, POS_STANDING, - NULL, SLOT(521), 36, 20, - "farsight", "!Farsight!", "" - }, - - { - "fireball", { 22, 53, 30, 26 }, { 1, 1, 2, 2}, - spell_fireball, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(26), 15, 12, - "fireball", "!Fireball!", "" - }, - - { - "fireproof", { 13, 12, 19, 18 }, { 1, 1, 2, 2}, - spell_fireproof, TAR_OBJ_INV, POS_STANDING, - NULL, SLOT(523), 10, 12, - "", "", "$p's protective aura fades." - }, - - { - "flamestrike", { 53, 20, 53, 27 }, { 1, 1, 2, 2}, - spell_flamestrike, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(65), 20, 12, - "flamestrike", "!Flamestrike!", "" - }, - - { - "fly", { 10, 18, 20, 22 }, { 1, 1, 2, 2}, - spell_fly, TAR_CHAR_DEFENSIVE, POS_STANDING, - NULL, SLOT(56), 10, 18, - "", "You slowly float to the ground.", "" - }, - - { - "floating disc", { 4, 10, 7, 16 }, { 1, 1, 2, 2}, - spell_floating_disc, TAR_IGNORE, POS_STANDING, - NULL, SLOT(522), 40, 24, - "", "!Floating disc!", "" - }, - - { - "frenzy", { 53, 24, 53, 26 }, { 1, 1, 2, 2}, - spell_frenzy, TAR_CHAR_DEFENSIVE, POS_STANDING, - NULL, SLOT(504), 30, 24, - "", "Your rage ebbs.", "" - }, - - { - "gate", { 27, 17, 32, 28 }, { 1, 1, 2, 2}, - spell_gate, TAR_IGNORE, POS_FIGHTING, - NULL, SLOT(83), 80, 12, - "", "!Gate!", "" - }, - - { - "giant strength", { 11, 53, 22, 20 }, { 1, 1, 2, 2}, - spell_giant_strength, TAR_CHAR_DEFENSIVE, POS_STANDING, - NULL, SLOT(39), 20, 12, - "", "You feel weaker.", "" - }, - - { - "harm", { 53, 23, 53, 28 }, { 1, 1, 2, 2}, - spell_harm, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(27), 35, 12, - "harm spell", "!Harm!, """ - }, - - { - "haste", { 21, 53, 26, 29 }, { 1, 1, 2, 2}, - spell_haste, TAR_CHAR_DEFENSIVE, POS_FIGHTING, - NULL, SLOT(502), 30, 12, - "", "You feel yourself slow down.", "" - }, - - { - "heal", { 53, 21, 33, 30 }, { 1, 1, 2, 2}, - spell_heal, TAR_CHAR_DEFENSIVE, POS_FIGHTING, - NULL, SLOT(28), 50, 12, - "", "!Heal!", "" - }, - - { - "heat metal", { 53, 16, 53, 23 }, { 1, 1, 2, 2 }, - spell_heat_metal, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(516), 25, 18, - "spell", "!Heat Metal!", "" - }, - - { - "holy word", { 53, 36, 53, 42 }, { 2, 2, 4, 4}, - spell_holy_word, TAR_IGNORE, POS_FIGHTING, - NULL, SLOT(506), 200, 24, - "divine wrath", "!Holy Word!", "" - }, - - { - "identify", { 15, 16, 18, 53 }, { 1, 1, 2, 2}, - spell_identify, TAR_OBJ_INV, POS_STANDING, - NULL, SLOT(53), 12, 24, - "", "!Identify!", "" - }, - - { - "infravision", { 9, 13, 10, 16 }, { 1, 1, 2, 2}, - spell_infravision, TAR_CHAR_DEFENSIVE, POS_STANDING, - NULL, SLOT(77), 5, 18, - "", "You no longer see in the dark.", "" - }, - - { - "invisibility", { 5, 53, 9, 53 }, { 1, 1, 2, 2}, - spell_invis, TAR_OBJ_CHAR_DEF, POS_STANDING, - &gsn_invis, SLOT(29), 5, 12, - "", "You are no longer invisible.", - "$p fades into view." - }, - - { - "know alignment", { 12, 9, 20, 53 }, { 1, 1, 2, 2}, - spell_know_alignment, TAR_CHAR_DEFENSIVE, POS_FIGHTING, - NULL, SLOT(58), 9, 12, - "", "!Know Alignment!", "" - }, - - { - "lightning bolt", { 13, 23, 18, 16 }, { 1, 1, 2, 2}, - spell_lightning_bolt, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(30), 15, 12, - "lightning bolt", "!Lightning Bolt!", "" - }, - - { - "locate object", { 9, 15, 11, 53 }, { 1, 1, 2, 2}, - spell_locate_object, TAR_IGNORE, POS_STANDING, - NULL, SLOT(31), 20, 18, - "", "!Locate Object!", "" - }, - - { - "magic missile", { 1, 53, 2, 2 }, { 1, 1, 2, 2}, - spell_magic_missile, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(32), 15, 12, - "magic missile", "!Magic Missile!", "" - }, - - { - "mass healing", { 53, 38, 53, 46 }, { 2, 2, 4, 4}, - spell_mass_healing, TAR_IGNORE, POS_STANDING, - NULL, SLOT(508), 100, 36, - "", "!Mass Healing!", "" - }, - - { - "mass invis", { 22, 25, 31, 53 }, { 1, 1, 2, 2}, - spell_mass_invis, TAR_IGNORE, POS_STANDING, - &gsn_mass_invis, SLOT(69), 20, 24, - "", "You are no longer invisible.", "" - }, - - { - "nexus", { 40, 35, 50, 45 }, { 2, 2, 4, 4}, - spell_nexus, TAR_IGNORE, POS_STANDING, - NULL, SLOT(520), 150, 36, - "", "!Nexus!", "" - }, - - { - "pass door", { 24, 32, 25, 37 }, { 1, 1, 2, 2}, - spell_pass_door, TAR_CHAR_SELF, POS_STANDING, - NULL, SLOT(74), 20, 12, - "", "You feel solid again.", "" - }, - - { - "plague", { 23, 17, 36, 26 }, { 1, 1, 2, 2}, - spell_plague, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - &gsn_plague, SLOT(503), 20, 12, - "sickness", "Your sores vanish.", "" - }, - - { - "poison", { 17, 12, 15, 21 }, { 1, 1, 2, 2}, - spell_poison, TAR_OBJ_CHAR_OFF, POS_FIGHTING, - &gsn_poison, SLOT(33), 10, 12, - "poison", "You feel less sick.", - "The poison on $p dries up." - }, - - { - "portal", { 35, 30, 45, 40 }, { 2, 2, 4, 4}, - spell_portal, TAR_IGNORE, POS_STANDING, - NULL, SLOT(519), 100, 24, - "", "!Portal!", "" - }, - - { - "protection evil", { 12, 9, 17, 11 }, { 1, 1, 2, 2}, - spell_protection_evil, TAR_CHAR_SELF, POS_STANDING, - NULL, SLOT(34), 5, 12, - "", "You feel less protected.", "" - }, - - { - "protection good", { 12, 9, 17, 11 }, { 1, 1, 2, 2}, - spell_protection_good, TAR_CHAR_SELF, POS_STANDING, - NULL, SLOT(514), 5, 12, - "", "You feel less protected.", "" - }, - - { - "ray of truth", { 53, 35, 53, 47 }, { 1, 1, 2, 2}, - spell_ray_of_truth, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(518), 20, 12, - "ray of truth", "!Ray of Truth!", "" - }, - - { - "recharge", { 9, 53, 53, 53 }, { 1, 1, 2, 2 }, - spell_recharge, TAR_OBJ_INV, POS_STANDING, - NULL, SLOT(517), 60, 24, - "", "!Recharge!", "" - }, - - { - "refresh", { 8, 5, 12, 9 }, { 1, 1, 2, 2}, - spell_refresh, TAR_CHAR_DEFENSIVE, POS_STANDING, - NULL, SLOT(81), 12, 18, - "refresh", "!Refresh!", "" - }, - - { - "remove curse", { 53, 18, 53, 22 }, { 1, 1, 2, 2}, - spell_remove_curse, TAR_OBJ_CHAR_DEF, POS_STANDING, - NULL, SLOT(35), 5, 12, - "", "!Remove Curse!", "" - }, - - { - "sanctuary", { 36, 20, 42, 30 }, { 1, 1, 2, 2}, - spell_sanctuary, TAR_CHAR_DEFENSIVE, POS_STANDING, - &gsn_sanctuary, SLOT(36), 75, 12, - "", "The white aura around your body fades.", - "" - }, - - { - "shield", { 20, 35, 35, 40 }, { 1, 1, 2, 2}, - spell_shield, TAR_CHAR_DEFENSIVE, POS_STANDING, - NULL, SLOT(67), 12, 18, - "", "Your force shield shimmers then fades away.", - "" - }, - - { - "shocking grasp", { 10, 53, 14, 13 }, { 1, 1, 2, 2}, - spell_shocking_grasp, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(53), 15, 12, - "shocking grasp", "!Shocking Grasp!", "" - }, - - { - "sleep", { 10, 53, 11, 53 }, { 1, 1, 2, 2}, - spell_sleep, TAR_CHAR_OFFENSIVE, POS_STANDING, - &gsn_sleep, SLOT(38), 15, 12, - "", "You feel less tired.", "" - }, - - { - "slow", { 23, 30, 29, 32 }, { 1, 1, 2, 2}, - spell_slow, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(515), 30, 12, - "", "You feel yourself speed up.", "" - }, - - { - "stone skin", { 25, 40, 40, 45 }, { 1, 1, 2, 2}, - spell_stone_skin, TAR_CHAR_SELF, POS_STANDING, - NULL, SLOT(66), 12, 18, - "", "Your skin feels soft again.", "" - }, - - { - "summon", { 24, 12, 29, 22 }, { 1, 1, 2, 2}, - spell_summon, TAR_IGNORE, POS_STANDING, - NULL, SLOT(40), 50, 12, - "", "!Summon!", "" - }, - - { - "teleport", { 13, 22, 25, 36 }, { 1, 1, 2, 2}, - spell_teleport, TAR_CHAR_SELF, POS_FIGHTING, - NULL, SLOT( 2), 35, 12, - "", "!Teleport!", "" - }, - - { - "ventriloquate", { 1, 53, 2, 53 }, { 1, 1, 2, 2}, - spell_ventriloquate, TAR_IGNORE, POS_STANDING, - NULL, SLOT(41), 5, 12, - "", "!Ventriloquate!", "" - }, - - { - "weaken", { 11, 14, 16, 17 }, { 1, 1, 2, 2}, - spell_weaken, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(68), 20, 12, - "spell", "You feel stronger.", "" - }, - - { - "word of recall", { 32, 28, 40, 30 }, { 1, 1, 2, 2}, - spell_word_of_recall, TAR_CHAR_SELF, POS_RESTING, - NULL, SLOT(42), 5, 12, - "", "!Word of Recall!", "" - }, - -/* - * Dragon breath - */ - { - "acid breath", { 31, 32, 33, 34 }, { 1, 1, 2, 2}, - spell_acid_breath, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(200), 100, 24, - "blast of acid", "!Acid Breath!", "" - }, - - { - "fire breath", { 40, 45, 50, 51 }, { 1, 1, 2, 2}, - spell_fire_breath, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(201), 200, 24, - "blast of flame", "The smoke leaves your eyes.", "" - }, - - { - "frost breath", { 34, 36, 38, 40 }, { 1, 1, 2, 2}, - spell_frost_breath, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(202), 125, 24, - "blast of frost", "!Frost Breath!", "" - }, - - { - "gas breath", { 39, 43, 47, 50 }, { 1, 1, 2, 2}, - spell_gas_breath, TAR_IGNORE, POS_FIGHTING, - NULL, SLOT(203), 175, 24, - "blast of gas", "!Gas Breath!", "" - }, - - { - "lightning breath", { 37, 40, 43, 46 }, { 1, 1, 2, 2}, - spell_lightning_breath, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(204), 150, 24, - "blast of lightning", "!Lightning Breath!", "" - }, - -/* - * Spells for mega1.are from Glop/Erkenbrand. - */ - { - "general purpose", { 53, 53, 53, 53 }, { 0, 0, 0, 0 }, - spell_general_purpose, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(401), 0, 12, - "general purpose ammo", "!General Purpose Ammo!", "" - }, - - { - "high explosive", { 53, 53, 53, 53 }, { 0, 0, 0, 0 }, - spell_high_explosive, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - NULL, SLOT(402), 0, 12, - "high explosive ammo", "!High Explosive Ammo!", "" - }, - - -/* combat and weapons skills */ - - - { - "axe", { 1, 1, 1, 1 }, { 6, 6, 5, 4}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_axe, SLOT( 0), 0, 0, - "", "!Axe!", "" - }, - - { - "dagger", { 1, 1, 1, 1 }, { 2, 3, 2, 2}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_dagger, SLOT( 0), 0, 0, - "", "!Dagger!", "" - }, - - { - "flail", { 1, 1, 1, 1 }, { 6, 3, 6, 4}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_flail, SLOT( 0), 0, 0, - "", "!Flail!", "" - }, - - { - "mace", { 1, 1, 1, 1 }, { 5, 2, 3, 3}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_mace, SLOT( 0), 0, 0, - "", "!Mace!", "" - }, - - { - "polearm", { 1, 1, 1, 1 }, { 6, 6, 6, 4}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_polearm, SLOT( 0), 0, 0, - "", "!Polearm!", "" - }, - - { - "shield block", { 1, 1, 1, 1 }, { 6, 4, 6, 2}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_shield_block, SLOT(0), 0, 0, - "", "!Shield!", "" - }, - - { - "spear", { 1, 1, 1, 1 }, { 4, 4, 4, 3}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_spear, SLOT( 0), 0, 0, - "", "!Spear!", "" - }, - - { - "sword", { 1, 1, 1, 1}, { 5, 6, 3, 2}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_sword, SLOT( 0), 0, 0, - "", "!sword!", "" - }, - - { - "whip", { 1, 1, 1, 1}, { 6, 5, 5, 4}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_whip, SLOT( 0), 0, 0, - "", "!Whip!", "" - }, - - { - "backstab", { 53, 53, 1, 53 }, { 0, 0, 5, 0}, - spell_null, TAR_IGNORE, POS_STANDING, - &gsn_backstab, SLOT( 0), 0, 24, - "backstab", "!Backstab!", "" - }, - - { - "bash", { 53, 53, 53, 1 }, { 0, 0, 0, 4}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_bash, SLOT( 0), 0, 24, - "bash", "!Bash!", "" - }, - - { - "berserk", { 53, 53, 53, 18 }, { 0, 0, 0, 5}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_berserk, SLOT( 0), 0, 24, - "", "You feel your pulse slow down.", "" - }, - - { - "dirt kicking", { 53, 53, 3, 3 }, { 0, 0, 4, 4}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_dirt, SLOT( 0), 0, 24, - "kicked dirt", "You rub the dirt out of your eyes.", "" - }, - - { - "disarm", { 53, 53, 12, 11 }, { 0, 0, 6, 4}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_disarm, SLOT( 0), 0, 24, - "", "!Disarm!", "" - }, - - { - "dodge", { 20, 22, 1, 13 }, { 8, 8, 4, 6}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_dodge, SLOT( 0), 0, 0, - "", "!Dodge!", "" - }, - - { - "enhanced damage", { 45, 30, 25, 1 }, { 10, 9, 5, 3}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_enhanced_damage, SLOT( 0), 0, 0, - "", "!Enhanced Damage!", "" - }, - - { - "envenom", { 53, 53, 10, 53 }, { 0, 0, 4, 0 }, - spell_null, TAR_IGNORE, POS_RESTING, - &gsn_envenom, SLOT(0), 0, 36, - "", "!Envenom!", "" - }, - - { - "hand to hand", { 25, 10, 15, 6 }, { 8, 5, 6, 4}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_hand_to_hand, SLOT( 0), 0, 0, - "", "!Hand to Hand!", "" - }, - - { - "kick", { 53, 12, 14, 8 }, { 0, 4, 6, 3}, - spell_null, TAR_CHAR_OFFENSIVE, POS_FIGHTING, - &gsn_kick, SLOT( 0), 0, 12, - "kick", "!Kick!", "" - }, - - { - "parry", { 22, 20, 13, 1 }, { 8, 8, 6, 4}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_parry, SLOT( 0), 0, 0, - "", "!Parry!", "" - }, - - { - "rescue", { 53, 53, 53, 1 }, { 0, 0, 0, 4}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_rescue, SLOT( 0), 0, 12, - "", "!Rescue!", "" - }, - - { - "trip", { 53, 53, 1, 15 }, { 0, 0, 4, 8}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_trip, SLOT( 0), 0, 24, - "trip", "!Trip!", "" - }, - - { - "second attack", { 30, 24, 12, 5 }, { 10, 8, 5, 3}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_second_attack, SLOT( 0), 0, 0, - "", "!Second Attack!", "" - }, - - { - "third attack", { 53, 53, 24, 12 }, { 0, 0, 10, 4}, - spell_null, TAR_IGNORE, POS_FIGHTING, - &gsn_third_attack, SLOT( 0), 0, 0, - "", "!Third Attack!", "" - }, - -/* non-combat skills */ - - { - "fast healing", { 15, 9, 16, 6 }, { 8, 5, 6, 4}, - spell_null, TAR_IGNORE, POS_SLEEPING, - &gsn_fast_healing, SLOT( 0), 0, 0, - "", "!Fast Healing!", "" - }, - - { - "haggle", { 7, 18, 1, 14 }, { 5, 8, 3, 6}, - spell_null, TAR_IGNORE, POS_RESTING, - &gsn_haggle, SLOT( 0), 0, 0, - "", "!Haggle!", "" - }, - - { - "hide", { 53, 53, 1, 12 }, { 0, 0, 4, 6}, - spell_null, TAR_IGNORE, POS_RESTING, - &gsn_hide, SLOT( 0), 0, 12, - "", "!Hide!", "" - }, - - { - "lore", { 10, 10, 6, 20 }, { 6, 6, 4, 8}, - spell_null, TAR_IGNORE, POS_RESTING, - &gsn_lore, SLOT( 0), 0, 36, - "", "!Lore!", "" - }, - - { - "meditation", { 6, 6, 15, 15 }, { 5, 5, 8, 8}, - spell_null, TAR_IGNORE, POS_SLEEPING, - &gsn_meditation, SLOT( 0), 0, 0, - "", "Meditation", "" - }, - - { - "peek", { 8, 21, 1, 14 }, { 5, 7, 3, 6}, - spell_null, TAR_IGNORE, POS_STANDING, - &gsn_peek, SLOT( 0), 0, 0, - "", "!Peek!", "" - }, - - { - "pick lock", { 25, 25, 7, 25 }, { 8, 8, 4, 8}, - spell_null, TAR_IGNORE, POS_STANDING, - &gsn_pick_lock, SLOT( 0), 0, 12, - "", "!Pick!", "" - }, - - { - "sneak", { 53, 53, 4, 10 }, { 0, 0, 4, 6}, - spell_null, TAR_IGNORE, POS_STANDING, - &gsn_sneak, SLOT( 0), 0, 12, - "", "You no longer feel stealthy.", "" - }, - - { - "steal", { 53, 53, 5, 53 }, { 0, 0, 4, 0}, - spell_null, TAR_IGNORE, POS_STANDING, - &gsn_steal, SLOT( 0), 0, 24, - "", "!Steal!", "" - }, - - { - "scrolls", { 1, 1, 1, 1 }, { 2, 3, 5, 8}, - spell_null, TAR_IGNORE, POS_STANDING, - &gsn_scrolls, SLOT( 0), 0, 24, - "", "!Scrolls!", "" - }, - - { - "staves", { 1, 1, 1, 1 }, { 2, 3, 5, 8}, - spell_null, TAR_IGNORE, POS_STANDING, - &gsn_staves, SLOT( 0), 0, 12, - "", "!Staves!", "" - }, - - { - "wands", { 1, 1, 1, 1 }, { 2, 3, 5, 8}, - spell_null, TAR_IGNORE, POS_STANDING, - &gsn_wands, SLOT( 0), 0, 12, - "", "!Wands!", "" - }, - - { - "recall", { 1, 1, 1, 1 }, { 2, 2, 2, 2}, - spell_null, TAR_IGNORE, POS_STANDING, - &gsn_recall, SLOT( 0), 0, 12, - "", "!Recall!", "" - } -}; - -const struct group_type group_table [MAX_GROUP] = -{ - - { - "rom basics", { 0, 0, 0, 0 }, - { "scrolls", "staves", "wands", "recall" } - }, - - { - "mage basics", { 0, -1, -1, -1 }, - { "dagger" } - }, - - { - "cleric basics", { -1, 0, -1, -1 }, - { "mace" } - }, - - { - "thief basics", { -1, -1, 0, -1 }, - { "dagger", "steal" } - }, - - { - "warrior basics", { -1, -1, -1, 0 }, - { "sword", "second attack" } - }, - - { - "mage default", { 40, -1, -1, -1 }, - { "lore", "beguiling", "combat", "detection", "enhancement", "illusion", - "maladictions", "protective", "transportation", "weather" } - }, - - { - "cleric default", { -1, 40, -1, -1 }, - { "flail", "attack", "creation", "curative", "benedictions", - "detection", "healing", "maladictions", "protective", "shield block", - "transportation", "weather" } - }, - - { - "thief default", { -1, -1, 40, -1 }, - { "mace", "sword", "backstab", "disarm", "dodge", "second attack", - "trip", "hide", "peek", "pick lock", "sneak" } - }, - - { - "warrior default", { -1, -1, -1, 40 }, - { "weaponsmaster", "shield block", "bash", "disarm", "enhanced damage", - "parry", "rescue", "third attack" } - }, - - { - "weaponsmaster", { 40, 40, 40, 20 }, - { "axe", "dagger", "flail", "mace", "polearm", "spear", "sword","whip" } - }, - - { - "attack", { -1, 5, -1, 8 }, - { "demonfire", "dispel evil", "dispel good", "earthquake", - "flamestrike", "heat metal", "ray of truth" } - }, - - { - "beguiling", { 4, -1, 6, -1 }, - { "calm", "charm person", "sleep" } - }, - - { - "benedictions", { -1, 4, -1, 8 }, - { "bless", "calm", "frenzy", "holy word", "remove curse" } - }, - - { - "combat", { 6, -1, 10, 9 }, - { "acid blast", "burning hands", "chain lightning", "chill touch", - "colour spray", "fireball", "lightning bolt", "magic missile", - "shocking grasp" } - }, - - { - "creation", { 4, 4, 8, 8 }, - { "continual light", "create food", "create spring", "create water", - "create rose", "floating disc" } - }, - - { - "curative", { -1, 4, -1, 8 }, - { "cure blindness", "cure disease", "cure poison" } - }, - - { - "detection", { 4, 3, 6, -1 }, - { "detect evil", "detect good", "detect hidden", "detect invis", - "detect magic", "detect poison", "farsight", "identify", - "know alignment", "locate object" } - }, - - { - "draconian", { 8, -1, -1, -1 }, - { "acid breath", "fire breath", "frost breath", "gas breath", - "lightning breath" } - }, - - { - "enchantment", { 6, -1, -1, -1 }, - { "enchant armor", "enchant weapon", "fireproof", "recharge" } - }, - - { - "enhancement", { 5, -1, 9, 9 }, - { "giant strength", "haste", "infravision", "refresh" } - }, - - { - "harmful", { -1, 3, -1, 6 }, - { "cause critical", "cause light", "cause serious", "harm" } - }, - - { - "healing", { -1, 3, -1, 6 }, - { "cure critical", "cure light", "cure serious", "heal", - "mass healing", "refresh" } - }, - - { - "illusion", { 4, -1, 7, -1 }, - { "invis", "mass invis", "ventriloquate" } - }, - - { - "maladictions", { 5, 5, 9, 9 }, - { "blindness", "change sex", "curse", "energy drain", "plague", - "poison", "slow", "weaken" } - }, - - { - "protective", { 4, 4, 7, 8 }, - { "armor", "cancellation", "dispel magic", "fireproof", - "protection evil", "protection good", "sanctuary", "shield", - "stone skin" } - }, - - { - "transportation", { 4, 4, 8, 9 }, - { "fly", "gate", "nexus", "pass door", "portal", "summon", "teleport", - "word of recall" } - }, - - { - "weather", { 4, 4, 8, 8 }, - { "call lightning", "control weather", "faerie fire", "faerie fog", - "lightning bolt" } - } - - - -}; diff --git a/archive/src/db.c b/archive/src/db.c deleted file mode 100644 index 83b9712..0000000 --- a/archive/src/db.c +++ /dev/null @@ -1,3372 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#include -#include -#include -#include -#include -#if defined(macintosh) -#include -#else -#include -#include -#include -#endif - -#include "merc.h" -#include "db.h" -#include "recycle.h" -#include "music.h" -#include "lookup.h" - - -#if !defined(macintosh) -extern int _filbuf args( (FILE *) ); -#endif - -#if !defined(OLD_RAND) -#if !defined(linux) -long random(); -#endif -void srandom(unsigned int); -int getpid(); -time_t time(time_t *tloc); -#endif - - -/* externals for counting purposes */ -extern OBJ_DATA *obj_free; -extern CHAR_DATA *char_free; -extern DESCRIPTOR_DATA *descriptor_free; -extern PC_DATA *pcdata_free; -extern AFFECT_DATA *affect_free; - -/* - * Globals. - */ -HELP_DATA * help_first; -HELP_DATA * help_last; - -SHOP_DATA * shop_first; -SHOP_DATA * shop_last; - -NOTE_DATA * note_free; - -char bug_buf [2*MAX_INPUT_LENGTH]; -CHAR_DATA * char_list; -char * help_greeting; -char log_buf [2*MAX_INPUT_LENGTH]; -KILL_DATA kill_table [MAX_LEVEL]; -NOTE_DATA * note_list; -OBJ_DATA * object_list; -TIME_INFO_DATA time_info; -WEATHER_DATA weather_info; - -sh_int gsn_backstab; -sh_int gsn_dodge; -sh_int gsn_envenom; -sh_int gsn_hide; -sh_int gsn_peek; -sh_int gsn_pick_lock; -sh_int gsn_sneak; -sh_int gsn_steal; - -sh_int gsn_disarm; -sh_int gsn_enhanced_damage; -sh_int gsn_kick; -sh_int gsn_parry; -sh_int gsn_rescue; -sh_int gsn_second_attack; -sh_int gsn_third_attack; - -sh_int gsn_blindness; -sh_int gsn_charm_person; -sh_int gsn_curse; -sh_int gsn_invis; -sh_int gsn_mass_invis; -sh_int gsn_poison; -sh_int gsn_plague; -sh_int gsn_sleep; -sh_int gsn_sanctuary; -sh_int gsn_fly; -/* new gsns */ - -sh_int gsn_axe; -sh_int gsn_dagger; -sh_int gsn_flail; -sh_int gsn_mace; -sh_int gsn_polearm; -sh_int gsn_shield_block; -sh_int gsn_spear; -sh_int gsn_sword; -sh_int gsn_whip; - -sh_int gsn_bash; -sh_int gsn_berserk; -sh_int gsn_dirt; -sh_int gsn_hand_to_hand; -sh_int gsn_trip; - -sh_int gsn_fast_healing; -sh_int gsn_haggle; -sh_int gsn_lore; -sh_int gsn_meditation; - -sh_int gsn_scrolls; -sh_int gsn_staves; -sh_int gsn_wands; -sh_int gsn_recall; - - - -/* - * Locals. - */ -MOB_INDEX_DATA * mob_index_hash [MAX_KEY_HASH]; -OBJ_INDEX_DATA * obj_index_hash [MAX_KEY_HASH]; -ROOM_INDEX_DATA * room_index_hash [MAX_KEY_HASH]; -char * string_hash [MAX_KEY_HASH]; - -AREA_DATA * area_first; -AREA_DATA * area_last; - -char * string_space; -char * top_string; -char str_empty [1]; - -int top_affect; -int top_area; -int top_ed; -int top_exit; -int top_help; -int top_mob_index; -int top_obj_index; -int top_reset; -int top_room; -int top_shop; -int mobile_count = 0; -int newmobs = 0; -int newobjs = 0; - - -/* - * Memory management. - * Increase MAX_STRING if you have too. - * Tune the others only if you understand what you're doing. - */ -#define MAX_STRING 1413120 -#define MAX_PERM_BLOCK 131072 -#define MAX_MEM_LIST 11 - -void * rgFreeList [MAX_MEM_LIST]; -const int rgSizeList [MAX_MEM_LIST] = -{ - 16, 32, 64, 128, 256, 1024, 2048, 4096, 8192, 16384, 32768-64 -}; - -int nAllocString; -int sAllocString; -int nAllocPerm; -int sAllocPerm; - - - -/* - * Semi-locals. - */ -bool fBootDb; -FILE * fpArea; -char strArea[MAX_INPUT_LENGTH]; - - - -/* - * Local booting procedures. -*/ -void init_mm args( ( void ) ); -void load_area args( ( FILE *fp ) ); -void load_helps args( ( FILE *fp ) ); -void load_old_mob args( ( FILE *fp ) ); -void load_mobiles args( ( FILE *fp ) ); -void load_old_obj args( ( FILE *fp ) ); -void load_objects args( ( FILE *fp ) ); -void load_resets args( ( FILE *fp ) ); -void load_rooms args( ( FILE *fp ) ); -void load_shops args( ( FILE *fp ) ); -void load_socials args( ( FILE *fp ) ); -void load_specials args( ( FILE *fp ) ); -void load_notes args( ( void ) ); -void load_bans args( ( void ) ); - -void fix_exits args( ( void ) ); - -void reset_area args( ( AREA_DATA * pArea ) ); - -/* - * Big mama top level function. - */ -void boot_db( void ) -{ - - /* - * Init some data space stuff. - */ - { - if ( ( string_space = calloc( 1, MAX_STRING ) ) == NULL ) - { - bug( "Boot_db: can't alloc %d string space.", MAX_STRING ); - exit( 1 ); - } - top_string = string_space; - fBootDb = TRUE; - } - - /* - * Init random number generator. - */ - { - init_mm( ); - } - - /* - * Set time and weather. - */ - { - long lhour, lday, lmonth; - - lhour = (current_time - 650336715) - / (PULSE_TICK / PULSE_PER_SECOND); - time_info.hour = lhour % 24; - lday = lhour / 24; - time_info.day = lday % 35; - lmonth = lday / 35; - time_info.month = lmonth % 17; - time_info.year = lmonth / 17; - - if ( time_info.hour < 5 ) weather_info.sunlight = SUN_DARK; - else if ( time_info.hour < 6 ) weather_info.sunlight = SUN_RISE; - else if ( time_info.hour < 19 ) weather_info.sunlight = SUN_LIGHT; - else if ( time_info.hour < 20 ) weather_info.sunlight = SUN_SET; - else weather_info.sunlight = SUN_DARK; - - weather_info.change = 0; - weather_info.mmhg = 960; - if ( time_info.month >= 7 && time_info.month <=12 ) - weather_info.mmhg += number_range( 1, 50 ); - else - weather_info.mmhg += number_range( 1, 80 ); - - if ( weather_info.mmhg <= 980 ) weather_info.sky = SKY_LIGHTNING; - else if ( weather_info.mmhg <= 1000 ) weather_info.sky = SKY_RAINING; - else if ( weather_info.mmhg <= 1020 ) weather_info.sky = SKY_CLOUDY; - else weather_info.sky = SKY_CLOUDLESS; - - } - - /* - * Assign gsn's for skills which have them. - */ - { - int sn; - - for ( sn = 0; sn < MAX_SKILL; sn++ ) - { - if ( skill_table[sn].pgsn != NULL ) - *skill_table[sn].pgsn = sn; - } - } - - /* - * Read in all the area files. - */ - { - FILE *fpList; - - if ( ( fpList = fopen( AREA_LIST, "r" ) ) == NULL ) - { - perror( AREA_LIST ); - exit( 1 ); - } - - for ( ; ; ) - { - strcpy( strArea, fread_word( fpList ) ); - if ( strArea[0] == '$' ) - break; - - if ( strArea[0] == '-' ) - { - fpArea = stdin; - } - else - { - if ( ( fpArea = fopen( strArea, "r" ) ) == NULL ) - { - perror( strArea ); - exit( 1 ); - } - } - - for ( ; ; ) - { - char *word; - - if ( fread_letter( fpArea ) != '#' ) - { - bug( "Boot_db: # not found.", 0 ); - exit( 1 ); - } - - word = fread_word( fpArea ); - - if ( word[0] == '$' ) break; - else if ( !str_cmp( word, "AREA" ) ) load_area (fpArea); - else if ( !str_cmp( word, "HELPS" ) ) load_helps (fpArea); - else if ( !str_cmp( word, "MOBOLD" ) ) load_old_mob (fpArea); - else if ( !str_cmp( word, "MOBILES" ) ) load_mobiles (fpArea); - else if ( !str_cmp( word, "OBJOLD" ) ) load_old_obj (fpArea); - else if ( !str_cmp( word, "OBJECTS" ) ) load_objects (fpArea); - else if ( !str_cmp( word, "RESETS" ) ) load_resets (fpArea); - else if ( !str_cmp( word, "ROOMS" ) ) load_rooms (fpArea); - else if ( !str_cmp( word, "SHOPS" ) ) load_shops (fpArea); - else if ( !str_cmp( word, "SOCIALS" ) ) load_socials (fpArea); - else if ( !str_cmp( word, "SPECIALS" ) ) load_specials(fpArea); - else - { - bug( "Boot_db: bad section name.", 0 ); - exit( 1 ); - } - } - - if ( fpArea != stdin ) - fclose( fpArea ); - fpArea = NULL; - } - fclose( fpList ); - } - - /* - * Fix up exits. - * Declare db booting over. - * Reset all areas once. - * Load up the songs, notes and ban files. - */ - { - fix_exits( ); - fBootDb = FALSE; - area_update( ); - load_notes( ); - load_bans(); - load_songs(); - } - - return; -} - - - -/* - * Snarf an 'area' header line. - */ -void load_area( FILE *fp ) -{ - AREA_DATA *pArea; - - pArea = alloc_perm( sizeof(*pArea) ); - pArea->reset_first = NULL; - pArea->reset_last = NULL; - pArea->file_name = fread_string(fp); - pArea->name = fread_string( fp ); - pArea->credits = fread_string( fp ); - pArea->min_vnum = fread_number(fp); - pArea->max_vnum = fread_number(fp); - pArea->age = 15; - pArea->nplayer = 0; - pArea->empty = FALSE; - - if ( area_first == NULL ) - area_first = pArea; - if ( area_last != NULL ) - area_last->next = pArea; - area_last = pArea; - pArea->next = NULL; - - top_area++; - return; -} - - - -/* - * Snarf a help section. - */ -void load_helps( FILE *fp ) -{ - HELP_DATA *pHelp; - - for ( ; ; ) - { - pHelp = alloc_perm( sizeof(*pHelp) ); - pHelp->level = fread_number( fp ); - pHelp->keyword = fread_string( fp ); - if ( pHelp->keyword[0] == '$' ) - break; - pHelp->text = fread_string( fp ); - - if ( !str_cmp( pHelp->keyword, "greeting" ) ) - help_greeting = pHelp->text; - - if ( help_first == NULL ) - help_first = pHelp; - if ( help_last != NULL ) - help_last->next = pHelp; - - help_last = pHelp; - pHelp->next = NULL; - top_help++; - } - - return; -} - - - -/* - * Snarf a mob section. old style - */ -void load_old_mob( FILE *fp ) -{ - MOB_INDEX_DATA *pMobIndex; - /* for race updating */ - int race; - char name[MAX_STRING_LENGTH]; - - for ( ; ; ) - { - sh_int vnum; - char letter; - int iHash; - - letter = fread_letter( fp ); - if ( letter != '#' ) - { - bug( "Load_mobiles: # not found.", 0 ); - exit( 1 ); - } - - vnum = fread_number( fp ); - if ( vnum == 0 ) - break; - - fBootDb = FALSE; - if ( get_mob_index( vnum ) != NULL ) - { - bug( "Load_mobiles: vnum %d duplicated.", vnum ); - exit( 1 ); - } - fBootDb = TRUE; - - pMobIndex = alloc_perm( sizeof(*pMobIndex) ); - pMobIndex->vnum = vnum; - pMobIndex->new_format = FALSE; - pMobIndex->player_name = fread_string( fp ); - pMobIndex->short_descr = fread_string( fp ); - pMobIndex->long_descr = fread_string( fp ); - pMobIndex->description = fread_string( fp ); - - pMobIndex->long_descr[0] = UPPER(pMobIndex->long_descr[0]); - pMobIndex->description[0] = UPPER(pMobIndex->description[0]); - - pMobIndex->act = fread_flag( fp ) | ACT_IS_NPC; - pMobIndex->affected_by = fread_flag( fp ); - pMobIndex->pShop = NULL; - pMobIndex->alignment = fread_number( fp ); - letter = fread_letter( fp ); - pMobIndex->level = fread_number( fp ); - - /* - * The unused stuff is for imps who want to use the old-style - * stats-in-files method. - */ - fread_number( fp ); /* Unused */ - fread_number( fp ); /* Unused */ - fread_number( fp ); /* Unused */ - /* 'd' */ fread_letter( fp ); /* Unused */ - fread_number( fp ); /* Unused */ - /* '+' */ fread_letter( fp ); /* Unused */ - fread_number( fp ); /* Unused */ - fread_number( fp ); /* Unused */ - /* 'd' */ fread_letter( fp ); /* Unused */ - fread_number( fp ); /* Unused */ - /* '+' */ fread_letter( fp ); /* Unused */ - fread_number( fp ); /* Unused */ - pMobIndex->wealth = fread_number( fp )/20; - /* xp can't be used! */ fread_number( fp ); /* Unused */ - pMobIndex->start_pos = fread_number( fp ); /* Unused */ - pMobIndex->default_pos = fread_number( fp ); /* Unused */ - - if (pMobIndex->start_pos < POS_SLEEPING) - pMobIndex->start_pos = POS_STANDING; - if (pMobIndex->default_pos < POS_SLEEPING) - pMobIndex->default_pos = POS_STANDING; - - /* - * Back to meaningful values. - */ - pMobIndex->sex = fread_number( fp ); - - /* compute the race BS */ - one_argument(pMobIndex->player_name,name); - - if (name[0] == '\0' || (race = race_lookup(name)) == 0) - { - /* fill in with blanks */ - pMobIndex->race = race_lookup("human"); - pMobIndex->off_flags = OFF_DODGE|OFF_DISARM|OFF_TRIP|ASSIST_VNUM; - pMobIndex->imm_flags = 0; - pMobIndex->res_flags = 0; - pMobIndex->vuln_flags = 0; - pMobIndex->form = FORM_EDIBLE|FORM_SENTIENT|FORM_BIPED|FORM_MAMMAL; - pMobIndex->parts = PART_HEAD|PART_ARMS|PART_LEGS|PART_HEART| - PART_BRAINS|PART_GUTS; - } - else - { - pMobIndex->race = race; - pMobIndex->off_flags = OFF_DODGE|OFF_DISARM|OFF_TRIP|ASSIST_RACE| - race_table[race].off; - pMobIndex->imm_flags = race_table[race].imm; - pMobIndex->res_flags = race_table[race].res; - pMobIndex->vuln_flags = race_table[race].vuln; - pMobIndex->form = race_table[race].form; - pMobIndex->parts = race_table[race].parts; - } - - if ( letter != 'S' ) - { - bug( "Load_mobiles: vnum %d non-S.", vnum ); - exit( 1 ); - } - - iHash = vnum % MAX_KEY_HASH; - pMobIndex->next = mob_index_hash[iHash]; - mob_index_hash[iHash] = pMobIndex; - top_mob_index++; - kill_table[URANGE(0, pMobIndex->level, MAX_LEVEL-1)].number++; - } - - return; -} - -/* - * Snarf an obj section. old style - */ -void load_old_obj( FILE *fp ) -{ - OBJ_INDEX_DATA *pObjIndex; - - for ( ; ; ) - { - sh_int vnum; - char letter; - int iHash; - - letter = fread_letter( fp ); - if ( letter != '#' ) - { - bug( "Load_objects: # not found.", 0 ); - exit( 1 ); - } - - vnum = fread_number( fp ); - if ( vnum == 0 ) - break; - - fBootDb = FALSE; - if ( get_obj_index( vnum ) != NULL ) - { - bug( "Load_objects: vnum %d duplicated.", vnum ); - exit( 1 ); - } - fBootDb = TRUE; - - pObjIndex = alloc_perm( sizeof(*pObjIndex) ); - pObjIndex->vnum = vnum; - pObjIndex->new_format = FALSE; - pObjIndex->reset_num = 0; - pObjIndex->name = fread_string( fp ); - pObjIndex->short_descr = fread_string( fp ); - pObjIndex->description = fread_string( fp ); - /* Action description */ fread_string( fp ); - - pObjIndex->short_descr[0] = LOWER(pObjIndex->short_descr[0]); - pObjIndex->description[0] = UPPER(pObjIndex->description[0]); - pObjIndex->material = str_dup(""); - - pObjIndex->item_type = fread_number( fp ); - pObjIndex->extra_flags = fread_flag( fp ); - pObjIndex->wear_flags = fread_flag( fp ); - pObjIndex->value[0] = fread_number( fp ); - pObjIndex->value[1] = fread_number( fp ); - pObjIndex->value[2] = fread_number( fp ); - pObjIndex->value[3] = fread_number( fp ); - pObjIndex->value[4] = 0; - pObjIndex->level = 0; - pObjIndex->condition = 100; - pObjIndex->weight = fread_number( fp ); - pObjIndex->cost = fread_number( fp ); /* Unused */ - /* Cost per day */ fread_number( fp ); - - - if (pObjIndex->item_type == ITEM_WEAPON) - { - if (is_name("two",pObjIndex->name) - || is_name("two-handed",pObjIndex->name) - || is_name("claymore",pObjIndex->name)) - SET_BIT(pObjIndex->value[4],WEAPON_TWO_HANDS); - } - - for ( ; ; ) - { - char letter; - - letter = fread_letter( fp ); - - if ( letter == 'A' ) - { - AFFECT_DATA *paf; - - paf = alloc_perm( sizeof(*paf) ); - paf->where = TO_OBJECT; - paf->type = -1; - paf->level = 20; /* RT temp fix */ - paf->duration = -1; - paf->location = fread_number( fp ); - paf->modifier = fread_number( fp ); - paf->bitvector = 0; - paf->next = pObjIndex->affected; - pObjIndex->affected = paf; - top_affect++; - } - - else if ( letter == 'E' ) - { - EXTRA_DESCR_DATA *ed; - - ed = alloc_perm( sizeof(*ed) ); - ed->keyword = fread_string( fp ); - ed->description = fread_string( fp ); - ed->next = pObjIndex->extra_descr; - pObjIndex->extra_descr = ed; - top_ed++; - } - - else - { - ungetc( letter, fp ); - break; - } - } - - /* fix armors */ - if (pObjIndex->item_type == ITEM_ARMOR) - { - pObjIndex->value[1] = pObjIndex->value[0]; - pObjIndex->value[2] = pObjIndex->value[1]; - } - - /* - * Translate spell "slot numbers" to internal "skill numbers." - */ - switch ( pObjIndex->item_type ) - { - case ITEM_PILL: - case ITEM_POTION: - case ITEM_SCROLL: - pObjIndex->value[1] = slot_lookup( pObjIndex->value[1] ); - pObjIndex->value[2] = slot_lookup( pObjIndex->value[2] ); - pObjIndex->value[3] = slot_lookup( pObjIndex->value[3] ); - pObjIndex->value[4] = slot_lookup( pObjIndex->value[4] ); - break; - - case ITEM_STAFF: - case ITEM_WAND: - pObjIndex->value[3] = slot_lookup( pObjIndex->value[3] ); - break; - } - - iHash = vnum % MAX_KEY_HASH; - pObjIndex->next = obj_index_hash[iHash]; - obj_index_hash[iHash] = pObjIndex; - top_obj_index++; - } - - return; -} - - - - - -/* - * Snarf a reset section. - */ -void load_resets( FILE *fp ) -{ - RESET_DATA *pReset; - - if ( area_last == NULL ) - { - bug( "Load_resets: no #AREA seen yet.", 0 ); - exit( 1 ); - } - - for ( ; ; ) - { - ROOM_INDEX_DATA *pRoomIndex; - EXIT_DATA *pexit; - char letter; - OBJ_INDEX_DATA *temp_index; - - if ( ( letter = fread_letter( fp ) ) == 'S' ) - break; - - if ( letter == '*' ) - { - fread_to_eol( fp ); - continue; - } - - pReset = alloc_perm( sizeof(*pReset) ); - pReset->command = letter; - /* if_flag */ fread_number( fp ); - pReset->arg1 = fread_number( fp ); - pReset->arg2 = fread_number( fp ); - pReset->arg3 = (letter == 'G' || letter == 'R') - ? 0 : fread_number( fp ); - pReset->arg4 = (letter == 'P' || letter == 'M') - ? fread_number(fp) : 0; - fread_to_eol( fp ); - - /* - * Validate parameters. - * We're calling the index functions for the side effect. - */ - switch ( letter ) - { - default: - bug( "Load_resets: bad command '%c'.", letter ); - exit( 1 ); - break; - - case 'M': - get_mob_index ( pReset->arg1 ); - get_room_index ( pReset->arg3 ); - break; - - case 'O': - temp_index = get_obj_index ( pReset->arg1 ); - temp_index->reset_num++; - get_room_index ( pReset->arg3 ); - break; - - case 'P': - temp_index = get_obj_index ( pReset->arg1 ); - temp_index->reset_num++; - get_obj_index ( pReset->arg3 ); - break; - - case 'G': - case 'E': - temp_index = get_obj_index ( pReset->arg1 ); - temp_index->reset_num++; - break; - - case 'D': - pRoomIndex = get_room_index( pReset->arg1 ); - - if ( pReset->arg2 < 0 - || pReset->arg2 > 5 - || ( pexit = pRoomIndex->exit[pReset->arg2] ) == NULL - || !IS_SET( pexit->exit_info, EX_ISDOOR ) ) - { - bug( "Load_resets: 'D': exit %d not door.", pReset->arg2 ); - exit( 1 ); - } - - if ( pReset->arg3 < 0 || pReset->arg3 > 2 ) - { - bug( "Load_resets: 'D': bad 'locks': %d.", pReset->arg3 ); - exit( 1 ); - } - - break; - - case 'R': - pRoomIndex = get_room_index( pReset->arg1 ); - - if ( pReset->arg2 < 0 || pReset->arg2 > 6 ) - { - bug( "Load_resets: 'R': bad exit %d.", pReset->arg2 ); - exit( 1 ); - } - - break; - } - - if ( area_last->reset_first == NULL ) - area_last->reset_first = pReset; - if ( area_last->reset_last != NULL ) - area_last->reset_last->next = pReset; - - area_last->reset_last = pReset; - pReset->next = NULL; - top_reset++; - } - - return; -} - - - -/* - * Snarf a room section. - */ -void load_rooms( FILE *fp ) -{ - ROOM_INDEX_DATA *pRoomIndex; - - if ( area_last == NULL ) - { - bug( "Load_resets: no #AREA seen yet.", 0 ); - exit( 1 ); - } - - for ( ; ; ) - { - sh_int vnum; - char letter; - int door; - int iHash; - - letter = fread_letter( fp ); - if ( letter != '#' ) - { - bug( "Load_rooms: # not found.", 0 ); - exit( 1 ); - } - - vnum = fread_number( fp ); - if ( vnum == 0 ) - break; - - fBootDb = FALSE; - if ( get_room_index( vnum ) != NULL ) - { - bug( "Load_rooms: vnum %d duplicated.", vnum ); - exit( 1 ); - } - fBootDb = TRUE; - - pRoomIndex = alloc_perm( sizeof(*pRoomIndex) ); - pRoomIndex->owner = str_dup(""); - pRoomIndex->people = NULL; - pRoomIndex->contents = NULL; - pRoomIndex->extra_descr = NULL; - pRoomIndex->area = area_last; - pRoomIndex->vnum = vnum; - pRoomIndex->name = fread_string( fp ); - pRoomIndex->description = fread_string( fp ); - /* Area number */ fread_number( fp ); - pRoomIndex->room_flags = fread_flag( fp ); - /* horrible hack */ - if ( 3000 <= vnum && vnum < 3400) - SET_BIT(pRoomIndex->room_flags,ROOM_LAW); - pRoomIndex->sector_type = fread_number( fp ); - pRoomIndex->light = 0; - for ( door = 0; door <= 5; door++ ) - pRoomIndex->exit[door] = NULL; - - /* defaults */ - pRoomIndex->heal_rate = 100; - pRoomIndex->mana_rate = 100; - - for ( ; ; ) - { - letter = fread_letter( fp ); - - if ( letter == 'S' ) - break; - - if ( letter == 'H') /* healing room */ - pRoomIndex->heal_rate = fread_number(fp); - - else if ( letter == 'M') /* mana room */ - pRoomIndex->mana_rate = fread_number(fp); - - else if ( letter == 'C') /* clan */ - { - if (pRoomIndex->clan) - { - bug("Load_rooms: duplicate clan fields.",0); - exit(1); - } - pRoomIndex->clan = clan_lookup(fread_string(fp)); - } - - - else if ( letter == 'D' ) - { - EXIT_DATA *pexit; - int locks; - - door = fread_number( fp ); - if ( door < 0 || door > 5 ) - { - bug( "Fread_rooms: vnum %d has bad door number.", vnum ); - exit( 1 ); - } - - pexit = alloc_perm( sizeof(*pexit) ); - pexit->description = fread_string( fp ); - pexit->keyword = fread_string( fp ); - pexit->exit_info = 0; - locks = fread_number( fp ); - pexit->key = fread_number( fp ); - pexit->u1.vnum = fread_number( fp ); - - switch ( locks ) - { - case 1: pexit->exit_info = EX_ISDOOR; break; - case 2: pexit->exit_info = EX_ISDOOR | EX_PICKPROOF; break; - case 3: pexit->exit_info = EX_ISDOOR | EX_NOPASS; break; - case 4: pexit->exit_info = EX_ISDOOR|EX_NOPASS|EX_PICKPROOF; - break; - } - - pRoomIndex->exit[door] = pexit; - pRoomIndex->old_exit[door] = pexit; - top_exit++; - } - else if ( letter == 'E' ) - { - EXTRA_DESCR_DATA *ed; - - ed = alloc_perm( sizeof(*ed) ); - ed->keyword = fread_string( fp ); - ed->description = fread_string( fp ); - ed->next = pRoomIndex->extra_descr; - pRoomIndex->extra_descr = ed; - top_ed++; - } - - else if (letter == 'O') - { - if (pRoomIndex->owner[0] != '\0') - { - bug("Load_rooms: duplicate owner.",0); - exit(1); - } - - pRoomIndex->owner = fread_string(fp); - } - - else - { - bug( "Load_rooms: vnum %d has flag not 'DES'.", vnum ); - exit( 1 ); - } - } - - iHash = vnum % MAX_KEY_HASH; - pRoomIndex->next = room_index_hash[iHash]; - room_index_hash[iHash] = pRoomIndex; - top_room++; - } - - return; -} - - - -/* - * Snarf a shop section. - */ -void load_shops( FILE *fp ) -{ - SHOP_DATA *pShop; - - for ( ; ; ) - { - MOB_INDEX_DATA *pMobIndex; - int iTrade; - - pShop = alloc_perm( sizeof(*pShop) ); - pShop->keeper = fread_number( fp ); - if ( pShop->keeper == 0 ) - break; - for ( iTrade = 0; iTrade < MAX_TRADE; iTrade++ ) - pShop->buy_type[iTrade] = fread_number( fp ); - pShop->profit_buy = fread_number( fp ); - pShop->profit_sell = fread_number( fp ); - pShop->open_hour = fread_number( fp ); - pShop->close_hour = fread_number( fp ); - fread_to_eol( fp ); - pMobIndex = get_mob_index( pShop->keeper ); - pMobIndex->pShop = pShop; - - if ( shop_first == NULL ) - shop_first = pShop; - if ( shop_last != NULL ) - shop_last->next = pShop; - - shop_last = pShop; - pShop->next = NULL; - top_shop++; - } - - return; -} - - -/* - * Snarf spec proc declarations. - */ -void load_specials( FILE *fp ) -{ - for ( ; ; ) - { - MOB_INDEX_DATA *pMobIndex; - char letter; - - switch ( letter = fread_letter( fp ) ) - { - default: - bug( "Load_specials: letter '%c' not *MS.", letter ); - exit( 1 ); - - case 'S': - return; - - case '*': - break; - - case 'M': - pMobIndex = get_mob_index ( fread_number ( fp ) ); - pMobIndex->spec_fun = spec_lookup ( fread_word ( fp ) ); - if ( pMobIndex->spec_fun == 0 ) - { - bug( "Load_specials: 'M': vnum %d.", pMobIndex->vnum ); - exit( 1 ); - } - break; - } - - fread_to_eol( fp ); - } -} - - -/* - * Translate all room exits from virtual to real. - * Has to be done after all rooms are read in. - * Check for bad reverse exits. - */ -void fix_exits( void ) -{ - extern const sh_int rev_dir []; - char buf[MAX_STRING_LENGTH]; - ROOM_INDEX_DATA *pRoomIndex; - ROOM_INDEX_DATA *to_room; - EXIT_DATA *pexit; - EXIT_DATA *pexit_rev; - int iHash; - int door; - - for ( iHash = 0; iHash < MAX_KEY_HASH; iHash++ ) - { - for ( pRoomIndex = room_index_hash[iHash]; - pRoomIndex != NULL; - pRoomIndex = pRoomIndex->next ) - { - bool fexit; - - fexit = FALSE; - for ( door = 0; door <= 5; door++ ) - { - if ( ( pexit = pRoomIndex->exit[door] ) != NULL ) - { - if ( pexit->u1.vnum <= 0 - || get_room_index(pexit->u1.vnum) == NULL) - pexit->u1.to_room = NULL; - else - { - fexit = TRUE; - pexit->u1.to_room = get_room_index( pexit->u1.vnum ); - } - } - } - if (!fexit) - SET_BIT(pRoomIndex->room_flags,ROOM_NO_MOB); - } - } - - for ( iHash = 0; iHash < MAX_KEY_HASH; iHash++ ) - { - for ( pRoomIndex = room_index_hash[iHash]; - pRoomIndex != NULL; - pRoomIndex = pRoomIndex->next ) - { - for ( door = 0; door <= 5; door++ ) - { - if ( ( pexit = pRoomIndex->exit[door] ) != NULL - && ( to_room = pexit->u1.to_room ) != NULL - && ( pexit_rev = to_room->exit[rev_dir[door]] ) != NULL - && pexit_rev->u1.to_room != pRoomIndex - && (pRoomIndex->vnum < 1200 || pRoomIndex->vnum > 1299)) - { - sprintf( buf, "Fix_exits: %d:%d -> %d:%d -> %d.", - pRoomIndex->vnum, door, - to_room->vnum, rev_dir[door], - (pexit_rev->u1.to_room == NULL) - ? 0 : pexit_rev->u1.to_room->vnum ); - bug( buf, 0 ); - } - } - } - } - - return; -} - - - -/* - * Repopulate areas periodically. - */ -void area_update( void ) -{ - AREA_DATA *pArea; - char buf[MAX_STRING_LENGTH]; - - for ( pArea = area_first; pArea != NULL; pArea = pArea->next ) - { - - if ( ++pArea->age < 3 ) - continue; - - /* - * Check age and reset. - * Note: Mud School resets every 3 minutes (not 15). - */ - if ( (!pArea->empty && (pArea->nplayer == 0 || pArea->age >= 15)) - || pArea->age >= 31) - { - ROOM_INDEX_DATA *pRoomIndex; - - reset_area( pArea ); - sprintf(buf,"%s has just been reset.",pArea->name); - wiznet(buf,NULL,NULL,WIZ_RESETS,0,0); - - pArea->age = number_range( 0, 3 ); - pRoomIndex = get_room_index( ROOM_VNUM_SCHOOL ); - if ( pRoomIndex != NULL && pArea == pRoomIndex->area ) - pArea->age = 15 - 2; - else if (pArea->nplayer == 0) - pArea->empty = TRUE; - } - } - - return; -} - - - -/* - * Reset one area. - */ -void reset_area( AREA_DATA *pArea ) -{ - RESET_DATA *pReset; - CHAR_DATA *mob; - bool last; - int level; - - mob = NULL; - last = TRUE; - level = 0; - for ( pReset = pArea->reset_first; pReset != NULL; pReset = pReset->next ) - { - ROOM_INDEX_DATA *pRoomIndex; - MOB_INDEX_DATA *pMobIndex; - OBJ_INDEX_DATA *pObjIndex; - OBJ_INDEX_DATA *pObjToIndex; - EXIT_DATA *pexit; - OBJ_DATA *obj; - OBJ_DATA *obj_to; - int count, limit; - - switch ( pReset->command ) - { - default: - bug( "Reset_area: bad command %c.", pReset->command ); - break; - - case 'M': - if ( ( pMobIndex = get_mob_index( pReset->arg1 ) ) == NULL ) - { - bug( "Reset_area: 'M': bad vnum %d.", pReset->arg1 ); - continue; - } - - if ( ( pRoomIndex = get_room_index( pReset->arg3 ) ) == NULL ) - { - bug( "Reset_area: 'R': bad vnum %d.", pReset->arg3 ); - continue; - } - - if ( pMobIndex->count >= pReset->arg2 ) - { - last = FALSE; - break; - } - - count = 0; - for (mob = pRoomIndex->people; mob != NULL; mob = mob->next_in_room) - if (mob->pIndexData == pMobIndex) - { - count++; - if (count >= pReset->arg4) - { - last = FALSE; - break; - } - } - - if (count >= pReset->arg4) - break; - - mob = create_mobile( pMobIndex ); - - /* - * Check for pet shop. - */ - { - ROOM_INDEX_DATA *pRoomIndexPrev; - pRoomIndexPrev = get_room_index( pRoomIndex->vnum - 1 ); - if ( pRoomIndexPrev != NULL - && IS_SET(pRoomIndexPrev->room_flags, ROOM_PET_SHOP) ) - SET_BIT(mob->act, ACT_PET); - } - - /* set area */ - mob->zone = pRoomIndex->area; - - char_to_room( mob, pRoomIndex ); - level = URANGE( 0, mob->level - 2, LEVEL_HERO - 1 ); - last = TRUE; - break; - - case 'O': - if ( ( pObjIndex = get_obj_index( pReset->arg1 ) ) == NULL ) - { - bug( "Reset_area: 'O': bad vnum %d.", pReset->arg1 ); - continue; - } - - if ( ( pRoomIndex = get_room_index( pReset->arg3 ) ) == NULL ) - { - bug( "Reset_area: 'R': bad vnum %d.", pReset->arg3 ); - continue; - } - - if ( pArea->nplayer > 0 - || count_obj_list( pObjIndex, pRoomIndex->contents ) > 0 ) - { - last = FALSE; - break; - } - - obj = create_object( pObjIndex, UMIN(number_fuzzy(level), - LEVEL_HERO - 1) ); - obj->cost = 0; - obj_to_room( obj, pRoomIndex ); - last = TRUE; - break; - - case 'P': - if ( ( pObjIndex = get_obj_index( pReset->arg1 ) ) == NULL ) - { - bug( "Reset_area: 'P': bad vnum %d.", pReset->arg1 ); - continue; - } - - if ( ( pObjToIndex = get_obj_index( pReset->arg3 ) ) == NULL ) - { - bug( "Reset_area: 'P': bad vnum %d.", pReset->arg3 ); - continue; - } - - if (pReset->arg2 > 50) /* old format */ - limit = 6; - else if (pReset->arg2 == -1) /* no limit */ - limit = 999; - else - limit = pReset->arg2; - - if (pArea->nplayer > 0 - || (obj_to = get_obj_type( pObjToIndex ) ) == NULL - || (obj_to->in_room == NULL && !last) - || ( pObjIndex->count >= limit && number_range(0,4) != 0) - || (count = count_obj_list(pObjIndex,obj_to->contains)) - > pReset->arg4 ) - { - last = FALSE; - break; - } - - while (count < pReset->arg4) - { - obj = create_object( pObjIndex, number_fuzzy(obj_to->level) ); - obj_to_obj( obj, obj_to ); - count++; - if (pObjIndex->count >= limit) - break; - } - /* fix object lock state! */ - obj_to->value[1] = obj_to->pIndexData->value[1]; - last = TRUE; - break; - - case 'G': - case 'E': - if ( ( pObjIndex = get_obj_index( pReset->arg1 ) ) == NULL ) - { - bug( "Reset_area: 'E' or 'G': bad vnum %d.", pReset->arg1 ); - continue; - } - - if ( !last ) - break; - - if ( mob == NULL ) - { - bug( "Reset_area: 'E' or 'G': null mob for vnum %d.", - pReset->arg1 ); - last = FALSE; - break; - } - - if ( mob->pIndexData->pShop != NULL ) - { - int olevel = 0,i,j; - - if (!pObjIndex->new_format) - switch ( pObjIndex->item_type ) - { - case ITEM_PILL: - case ITEM_POTION: - case ITEM_SCROLL: - olevel = 53; - for (i = 1; i < 5; i++) - { - if (pObjIndex->value[i] > 0) - { - for (j = 0; j < MAX_CLASS; j++) - { - olevel = UMIN(olevel, - skill_table[pObjIndex->value[i]]. - skill_level[j]); - } - } - } - - olevel = UMAX(0,(olevel * 3 / 4) - 2); - break; - case ITEM_WAND: olevel = number_range( 10, 20 ); break; - case ITEM_STAFF: olevel = number_range( 15, 25 ); break; - case ITEM_ARMOR: olevel = number_range( 5, 15 ); break; - case ITEM_WEAPON: olevel = number_range( 5, 15 ); break; - case ITEM_TREASURE: olevel = number_range( 10, 20 ); break; - } - - obj = create_object( pObjIndex, olevel ); - SET_BIT( obj->extra_flags, ITEM_INVENTORY ); - } - - else - { - if (pReset->arg2 > 50) /* old format */ - limit = 6; - else if (pReset->arg2 == -1) /* no limit */ - limit = 999; - else - limit = pReset->arg2; - - if (pObjIndex->count < limit || number_range(0,4) == 0) - { - obj=create_object(pObjIndex,UMIN(number_fuzzy(level), - LEVEL_HERO - 1)); - /* error message if it is too high */ - if (obj->level > mob->level + 3 - || (obj->item_type == ITEM_WEAPON - && pReset->command == 'E' - && obj->level < mob->level -5 && obj->level < 45)) - fprintf(stderr, - "Err: obj %s (%d) -- %d, mob %s (%d) -- %d\n", - obj->short_descr,obj->pIndexData->vnum,obj->level, - mob->short_descr,mob->pIndexData->vnum,mob->level); - } - else - break; - } - obj_to_char( obj, mob ); - if ( pReset->command == 'E' ) - equip_char( mob, obj, pReset->arg3 ); - last = TRUE; - break; - - case 'D': - if ( ( pRoomIndex = get_room_index( pReset->arg1 ) ) == NULL ) - { - bug( "Reset_area: 'D': bad vnum %d.", pReset->arg1 ); - continue; - } - - if ( ( pexit = pRoomIndex->exit[pReset->arg2] ) == NULL ) - break; - - switch ( pReset->arg3 ) - { - case 0: - REMOVE_BIT( pexit->exit_info, EX_CLOSED ); - REMOVE_BIT( pexit->exit_info, EX_LOCKED ); - break; - - case 1: - SET_BIT( pexit->exit_info, EX_CLOSED ); - REMOVE_BIT( pexit->exit_info, EX_LOCKED ); - break; - - case 2: - SET_BIT( pexit->exit_info, EX_CLOSED ); - SET_BIT( pexit->exit_info, EX_LOCKED ); - break; - } - - last = TRUE; - break; - - case 'R': - if ( ( pRoomIndex = get_room_index( pReset->arg1 ) ) == NULL ) - { - bug( "Reset_area: 'R': bad vnum %d.", pReset->arg1 ); - continue; - } - - { - int d0; - int d1; - - for ( d0 = 0; d0 < pReset->arg2 - 1; d0++ ) - { - d1 = number_range( d0, pReset->arg2-1 ); - pexit = pRoomIndex->exit[d0]; - pRoomIndex->exit[d0] = pRoomIndex->exit[d1]; - pRoomIndex->exit[d1] = pexit; - } - } - break; - } - } - - return; -} - - - -/* - * Create an instance of a mobile. - */ -CHAR_DATA *create_mobile( MOB_INDEX_DATA *pMobIndex ) -{ - CHAR_DATA *mob; - int i; - AFFECT_DATA af; - - mobile_count++; - - if ( pMobIndex == NULL ) - { - bug( "Create_mobile: NULL pMobIndex.", 0 ); - exit( 1 ); - } - - mob = new_char(); - - mob->pIndexData = pMobIndex; - - mob->name = pMobIndex->player_name; - mob->id = get_mob_id(); - mob->short_descr = pMobIndex->short_descr; - mob->long_descr = pMobIndex->long_descr; - mob->description = pMobIndex->description; - mob->spec_fun = pMobIndex->spec_fun; - mob->prompt = NULL; - - if (pMobIndex->wealth == 0) - { - mob->silver = 0; - mob->gold = 0; - } - else - { - long wealth; - - wealth = number_range(pMobIndex->wealth/2, 3 * pMobIndex->wealth/2); - mob->gold = number_range(wealth/200,wealth/100); - mob->silver = wealth - (mob->gold * 100); - } - - if (pMobIndex->new_format) - /* load in new style */ - { - /* read from prototype */ - mob->group = pMobIndex->group; - mob->act = pMobIndex->act; - mob->comm = COMM_NOCHANNELS|COMM_NOSHOUT|COMM_NOTELL; - mob->affected_by = pMobIndex->affected_by; - mob->alignment = pMobIndex->alignment; - mob->level = pMobIndex->level; - mob->hitroll = pMobIndex->hitroll; - mob->damroll = pMobIndex->damage[DICE_BONUS]; - mob->max_hit = dice(pMobIndex->hit[DICE_NUMBER], - pMobIndex->hit[DICE_TYPE]) - + pMobIndex->hit[DICE_BONUS]; - mob->hit = mob->max_hit; - mob->max_mana = dice(pMobIndex->mana[DICE_NUMBER], - pMobIndex->mana[DICE_TYPE]) - + pMobIndex->mana[DICE_BONUS]; - mob->mana = mob->max_mana; - mob->damage[DICE_NUMBER]= pMobIndex->damage[DICE_NUMBER]; - mob->damage[DICE_TYPE] = pMobIndex->damage[DICE_TYPE]; - mob->dam_type = pMobIndex->dam_type; - if (mob->dam_type == 0) - switch(number_range(1,3)) - { - case (1): mob->dam_type = 3; break; /* slash */ - case (2): mob->dam_type = 7; break; /* pound */ - case (3): mob->dam_type = 11; break; /* pierce */ - } - for (i = 0; i < 4; i++) - mob->armor[i] = pMobIndex->ac[i]; - mob->off_flags = pMobIndex->off_flags; - mob->imm_flags = pMobIndex->imm_flags; - mob->res_flags = pMobIndex->res_flags; - mob->vuln_flags = pMobIndex->vuln_flags; - mob->start_pos = pMobIndex->start_pos; - mob->default_pos = pMobIndex->default_pos; - mob->sex = pMobIndex->sex; - if (mob->sex == 3) /* random sex */ - mob->sex = number_range(1,2); - mob->race = pMobIndex->race; - mob->form = pMobIndex->form; - mob->parts = pMobIndex->parts; - mob->size = pMobIndex->size; - mob->material = str_dup(pMobIndex->material); - - /* computed on the spot */ - - for (i = 0; i < MAX_STATS; i ++) - mob->perm_stat[i] = UMIN(25,11 + mob->level/4); - - if (IS_SET(mob->act,ACT_WARRIOR)) - { - mob->perm_stat[STAT_STR] += 3; - mob->perm_stat[STAT_INT] -= 1; - mob->perm_stat[STAT_CON] += 2; - } - - if (IS_SET(mob->act,ACT_THIEF)) - { - mob->perm_stat[STAT_DEX] += 3; - mob->perm_stat[STAT_INT] += 1; - mob->perm_stat[STAT_WIS] -= 1; - } - - if (IS_SET(mob->act,ACT_CLERIC)) - { - mob->perm_stat[STAT_WIS] += 3; - mob->perm_stat[STAT_DEX] -= 1; - mob->perm_stat[STAT_STR] += 1; - } - - if (IS_SET(mob->act,ACT_MAGE)) - { - mob->perm_stat[STAT_INT] += 3; - mob->perm_stat[STAT_STR] -= 1; - mob->perm_stat[STAT_DEX] += 1; - } - - if (IS_SET(mob->off_flags,OFF_FAST)) - mob->perm_stat[STAT_DEX] += 2; - - mob->perm_stat[STAT_STR] += mob->size - SIZE_MEDIUM; - mob->perm_stat[STAT_CON] += (mob->size - SIZE_MEDIUM) / 2; - - /* let's get some spell action */ - if (IS_AFFECTED(mob,AFF_SANCTUARY)) - { - af.where = TO_AFFECTS; - af.type = skill_lookup("sanctuary"); - af.level = mob->level; - af.duration = -1; - af.location = APPLY_NONE; - af.modifier = 0; - af.bitvector = AFF_SANCTUARY; - affect_to_char( mob, &af ); - } - - if (IS_AFFECTED(mob,AFF_HASTE)) - { - af.where = TO_AFFECTS; - af.type = skill_lookup("haste"); - af.level = mob->level; - af.duration = -1; - af.location = APPLY_DEX; - af.modifier = 1 + (mob->level >= 18) + (mob->level >= 25) + - (mob->level >= 32); - af.bitvector = AFF_HASTE; - affect_to_char( mob, &af ); - } - - if (IS_AFFECTED(mob,AFF_PROTECT_EVIL)) - { - af.where = TO_AFFECTS; - af.type = skill_lookup("protection evil"); - af.level = mob->level; - af.duration = -1; - af.location = APPLY_SAVES; - af.modifier = -1; - af.bitvector = AFF_PROTECT_EVIL; - affect_to_char(mob,&af); - } - - if (IS_AFFECTED(mob,AFF_PROTECT_GOOD)) - { - af.where = TO_AFFECTS; - af.type = skill_lookup("protection good"); - af.level = mob->level; - af.duration = -1; - af.location = APPLY_SAVES; - af.modifier = -1; - af.bitvector = AFF_PROTECT_GOOD; - affect_to_char(mob,&af); - } - } - else /* read in old format and convert */ - { - mob->act = pMobIndex->act; - mob->affected_by = pMobIndex->affected_by; - mob->alignment = pMobIndex->alignment; - mob->level = pMobIndex->level; - mob->hitroll = pMobIndex->hitroll; - mob->damroll = 0; - mob->max_hit = mob->level * 8 + number_range( - mob->level * mob->level/4, - mob->level * mob->level); - mob->max_hit *= .9; - mob->hit = mob->max_hit; - mob->max_mana = 100 + dice(mob->level,10); - mob->mana = mob->max_mana; - switch(number_range(1,3)) - { - case (1): mob->dam_type = 3; break; /* slash */ - case (2): mob->dam_type = 7; break; /* pound */ - case (3): mob->dam_type = 11; break; /* pierce */ - } - for (i = 0; i < 3; i++) - mob->armor[i] = interpolate(mob->level,100,-100); - mob->armor[3] = interpolate(mob->level,100,0); - mob->race = pMobIndex->race; - mob->off_flags = pMobIndex->off_flags; - mob->imm_flags = pMobIndex->imm_flags; - mob->res_flags = pMobIndex->res_flags; - mob->vuln_flags = pMobIndex->vuln_flags; - mob->start_pos = pMobIndex->start_pos; - mob->default_pos = pMobIndex->default_pos; - mob->sex = pMobIndex->sex; - mob->form = pMobIndex->form; - mob->parts = pMobIndex->parts; - mob->size = SIZE_MEDIUM; - mob->material = ""; - - for (i = 0; i < MAX_STATS; i ++) - mob->perm_stat[i] = 11 + mob->level/4; - } - - mob->position = mob->start_pos; - - - /* link the mob to the world list */ - mob->next = char_list; - char_list = mob; - pMobIndex->count++; - return mob; -} - -/* duplicate a mobile exactly -- except inventory */ -void clone_mobile(CHAR_DATA *parent, CHAR_DATA *clone) -{ - int i; - AFFECT_DATA *paf; - - if ( parent == NULL || clone == NULL || !IS_NPC(parent)) - return; - - /* start fixing values */ - clone->name = str_dup(parent->name); - clone->version = parent->version; - clone->short_descr = str_dup(parent->short_descr); - clone->long_descr = str_dup(parent->long_descr); - clone->description = str_dup(parent->description); - clone->group = parent->group; - clone->sex = parent->sex; - clone->class = parent->class; - clone->race = parent->race; - clone->level = parent->level; - clone->trust = 0; - clone->timer = parent->timer; - clone->wait = parent->wait; - clone->hit = parent->hit; - clone->max_hit = parent->max_hit; - clone->mana = parent->mana; - clone->max_mana = parent->max_mana; - clone->move = parent->move; - clone->max_move = parent->max_move; - clone->gold = parent->gold; - clone->silver = parent->silver; - clone->exp = parent->exp; - clone->act = parent->act; - clone->comm = parent->comm; - clone->imm_flags = parent->imm_flags; - clone->res_flags = parent->res_flags; - clone->vuln_flags = parent->vuln_flags; - clone->invis_level = parent->invis_level; - clone->affected_by = parent->affected_by; - clone->position = parent->position; - clone->practice = parent->practice; - clone->train = parent->train; - clone->saving_throw = parent->saving_throw; - clone->alignment = parent->alignment; - clone->hitroll = parent->hitroll; - clone->damroll = parent->damroll; - clone->wimpy = parent->wimpy; - clone->form = parent->form; - clone->parts = parent->parts; - clone->size = parent->size; - clone->material = str_dup(parent->material); - clone->off_flags = parent->off_flags; - clone->dam_type = parent->dam_type; - clone->start_pos = parent->start_pos; - clone->default_pos = parent->default_pos; - clone->spec_fun = parent->spec_fun; - - for (i = 0; i < 4; i++) - clone->armor[i] = parent->armor[i]; - - for (i = 0; i < MAX_STATS; i++) - { - clone->perm_stat[i] = parent->perm_stat[i]; - clone->mod_stat[i] = parent->mod_stat[i]; - } - - for (i = 0; i < 3; i++) - clone->damage[i] = parent->damage[i]; - - /* now add the affects */ - for (paf = parent->affected; paf != NULL; paf = paf->next) - affect_to_char(clone,paf); - -} - - - - -/* - * Create an instance of an object. - */ -OBJ_DATA *create_object( OBJ_INDEX_DATA *pObjIndex, int level ) -{ - AFFECT_DATA *paf; - OBJ_DATA *obj; - int i; - - if ( pObjIndex == NULL ) - { - bug( "Create_object: NULL pObjIndex.", 0 ); - exit( 1 ); - } - - obj = new_obj(); - - obj->pIndexData = pObjIndex; - obj->in_room = NULL; - obj->enchanted = FALSE; - - if (pObjIndex->new_format) - obj->level = pObjIndex->level; - else - obj->level = UMAX(0,level); - obj->wear_loc = -1; - - obj->name = pObjIndex->name; - obj->short_descr = pObjIndex->short_descr; - obj->description = pObjIndex->description; - obj->material = str_dup(pObjIndex->material); - obj->item_type = pObjIndex->item_type; - obj->extra_flags = pObjIndex->extra_flags; - obj->wear_flags = pObjIndex->wear_flags; - obj->value[0] = pObjIndex->value[0]; - obj->value[1] = pObjIndex->value[1]; - obj->value[2] = pObjIndex->value[2]; - obj->value[3] = pObjIndex->value[3]; - obj->value[4] = pObjIndex->value[4]; - obj->weight = pObjIndex->weight; - - if (level == -1 || pObjIndex->new_format) - obj->cost = pObjIndex->cost; - else - obj->cost = number_fuzzy( 10 ) - * number_fuzzy( level ) * number_fuzzy( level ); - - /* - * Mess with object properties. - */ - switch ( obj->item_type ) - { - default: - bug( "Read_object: vnum %d bad type.", pObjIndex->vnum ); - break; - - case ITEM_LIGHT: - if (obj->value[2] == 999) - obj->value[2] = -1; - break; - - case ITEM_FURNITURE: - case ITEM_TRASH: - case ITEM_CONTAINER: - case ITEM_DRINK_CON: - case ITEM_KEY: - case ITEM_FOOD: - case ITEM_BOAT: - case ITEM_CORPSE_NPC: - case ITEM_CORPSE_PC: - case ITEM_FOUNTAIN: - case ITEM_MAP: - case ITEM_CLOTHING: - case ITEM_PORTAL: - if (!pObjIndex->new_format) - obj->cost /= 5; - break; - - case ITEM_TREASURE: - case ITEM_WARP_STONE: - case ITEM_ROOM_KEY: - case ITEM_GEM: - case ITEM_JEWELRY: - break; - - case ITEM_JUKEBOX: - for (i = 0; i < 5; i++) - obj->value[i] = -1; - break; - - case ITEM_SCROLL: - if (level != -1 && !pObjIndex->new_format) - obj->value[0] = number_fuzzy( obj->value[0] ); - break; - - case ITEM_WAND: - case ITEM_STAFF: - if (level != -1 && !pObjIndex->new_format) - { - obj->value[0] = number_fuzzy( obj->value[0] ); - obj->value[1] = number_fuzzy( obj->value[1] ); - obj->value[2] = obj->value[1]; - } - if (!pObjIndex->new_format) - obj->cost *= 2; - break; - - case ITEM_WEAPON: - if (level != -1 && !pObjIndex->new_format) - { - obj->value[1] = number_fuzzy( number_fuzzy( 1 * level / 4 + 2 ) ); - obj->value[2] = number_fuzzy( number_fuzzy( 3 * level / 4 + 6 ) ); - } - break; - - case ITEM_ARMOR: - if (level != -1 && !pObjIndex->new_format) - { - obj->value[0] = number_fuzzy( level / 5 + 3 ); - obj->value[1] = number_fuzzy( level / 5 + 3 ); - obj->value[2] = number_fuzzy( level / 5 + 3 ); - } - break; - - case ITEM_POTION: - case ITEM_PILL: - if (level != -1 && !pObjIndex->new_format) - obj->value[0] = number_fuzzy( number_fuzzy( obj->value[0] ) ); - break; - - case ITEM_MONEY: - if (!pObjIndex->new_format) - obj->value[0] = obj->cost; - break; - } - - for (paf = pObjIndex->affected; paf != NULL; paf = paf->next) - if ( paf->location == APPLY_SPELL_AFFECT ) - affect_to_obj(obj,paf); - - obj->next = object_list; - object_list = obj; - pObjIndex->count++; - - return obj; -} - -/* duplicate an object exactly -- except contents */ -void clone_object(OBJ_DATA *parent, OBJ_DATA *clone) -{ - int i; - AFFECT_DATA *paf; - EXTRA_DESCR_DATA *ed,*ed_new; - - if (parent == NULL || clone == NULL) - return; - - /* start fixing the object */ - clone->name = str_dup(parent->name); - clone->short_descr = str_dup(parent->short_descr); - clone->description = str_dup(parent->description); - clone->item_type = parent->item_type; - clone->extra_flags = parent->extra_flags; - clone->wear_flags = parent->wear_flags; - clone->weight = parent->weight; - clone->cost = parent->cost; - clone->level = parent->level; - clone->condition = parent->condition; - clone->material = str_dup(parent->material); - clone->timer = parent->timer; - - for (i = 0; i < 5; i ++) - clone->value[i] = parent->value[i]; - - /* affects */ - clone->enchanted = parent->enchanted; - - for (paf = parent->affected; paf != NULL; paf = paf->next) - affect_to_obj(clone,paf); - - /* extended desc */ - for (ed = parent->extra_descr; ed != NULL; ed = ed->next) - { - ed_new = new_extra_descr(); - ed_new->keyword = str_dup( ed->keyword); - ed_new->description = str_dup( ed->description ); - ed_new->next = clone->extra_descr; - clone->extra_descr = ed_new; - } - -} - - - -/* - * Clear a new character. - */ -void clear_char( CHAR_DATA *ch ) -{ - static CHAR_DATA ch_zero; - int i; - - *ch = ch_zero; - ch->name = &str_empty[0]; - ch->short_descr = &str_empty[0]; - ch->long_descr = &str_empty[0]; - ch->description = &str_empty[0]; - ch->prompt = &str_empty[0]; - ch->logon = current_time; - ch->lines = PAGELEN; - for (i = 0; i < 4; i++) - ch->armor[i] = 100; - ch->position = POS_STANDING; - ch->hit = 20; - ch->max_hit = 20; - ch->mana = 100; - ch->max_mana = 100; - ch->move = 100; - ch->max_move = 100; - ch->on = NULL; - for (i = 0; i < MAX_STATS; i ++) - { - ch->perm_stat[i] = 13; - ch->mod_stat[i] = 0; - } - return; -} - -/* - * Get an extra description from a list. - */ -char *get_extra_descr( const char *name, EXTRA_DESCR_DATA *ed ) -{ - for ( ; ed != NULL; ed = ed->next ) - { - if ( is_name( (char *) name, ed->keyword ) ) - return ed->description; - } - return NULL; -} - - - -/* - * Translates mob virtual number to its mob index struct. - * Hash table lookup. - */ -MOB_INDEX_DATA *get_mob_index( int vnum ) -{ - MOB_INDEX_DATA *pMobIndex; - - for ( pMobIndex = mob_index_hash[vnum % MAX_KEY_HASH]; - pMobIndex != NULL; - pMobIndex = pMobIndex->next ) - { - if ( pMobIndex->vnum == vnum ) - return pMobIndex; - } - - if ( fBootDb ) - { - bug( "Get_mob_index: bad vnum %d.", vnum ); - exit( 1 ); - } - - return NULL; -} - - - -/* - * Translates mob virtual number to its obj index struct. - * Hash table lookup. - */ -OBJ_INDEX_DATA *get_obj_index( int vnum ) -{ - OBJ_INDEX_DATA *pObjIndex; - - for ( pObjIndex = obj_index_hash[vnum % MAX_KEY_HASH]; - pObjIndex != NULL; - pObjIndex = pObjIndex->next ) - { - if ( pObjIndex->vnum == vnum ) - return pObjIndex; - } - - if ( fBootDb ) - { - bug( "Get_obj_index: bad vnum %d.", vnum ); - exit( 1 ); - } - - return NULL; -} - - - -/* - * Translates mob virtual number to its room index struct. - * Hash table lookup. - */ -ROOM_INDEX_DATA *get_room_index( int vnum ) -{ - ROOM_INDEX_DATA *pRoomIndex; - - for ( pRoomIndex = room_index_hash[vnum % MAX_KEY_HASH]; - pRoomIndex != NULL; - pRoomIndex = pRoomIndex->next ) - { - if ( pRoomIndex->vnum == vnum ) - return pRoomIndex; - } - - if ( fBootDb ) - { - bug( "Get_room_index: bad vnum %d.", vnum ); - exit( 1 ); - } - - return NULL; -} - - - -/* - * Read a letter from a file. - */ -char fread_letter( FILE *fp ) -{ - char c; - - do - { - c = getc( fp ); - } - while ( isspace(c) ); - - return c; -} - - - -/* - * Read a number from a file. - */ -int fread_number( FILE *fp ) -{ - int number; - bool sign; - char c; - - do - { - c = getc( fp ); - } - while ( isspace(c) ); - - number = 0; - - sign = FALSE; - if ( c == '+' ) - { - c = getc( fp ); - } - else if ( c == '-' ) - { - sign = TRUE; - c = getc( fp ); - } - - if ( !isdigit(c) ) - { - bug( "Fread_number: bad format.", 0 ); - exit( 1 ); - } - - while ( isdigit(c) ) - { - number = number * 10 + c - '0'; - c = getc( fp ); - } - - if ( sign ) - number = 0 - number; - - if ( c == '|' ) - number += fread_number( fp ); - else if ( c != ' ' ) - ungetc( c, fp ); - - return number; -} - -long fread_flag( FILE *fp) -{ - int number; - char c; - bool negative = FALSE; - - do - { - c = getc(fp); - } - while ( isspace(c)); - - if (c == '-') - { - negative = TRUE; - c = getc(fp); - } - - number = 0; - - if (!isdigit(c)) - { - while (('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z')) - { - number += flag_convert(c); - c = getc(fp); - } - } - - while (isdigit(c)) - { - number = number * 10 + c - '0'; - c = getc(fp); - } - - if (c == '|') - number += fread_flag(fp); - - else if ( c != ' ') - ungetc(c,fp); - - if (negative) - return -1 * number; - - return number; -} - -long flag_convert(char letter ) -{ - long bitsum = 0; - char i; - - if ('A' <= letter && letter <= 'Z') - { - bitsum = 1; - for (i = letter; i > 'A'; i--) - bitsum *= 2; - } - else if ('a' <= letter && letter <= 'z') - { - bitsum = 67108864; /* 2^26 */ - for (i = letter; i > 'a'; i --) - bitsum *= 2; - } - - return bitsum; -} - - - - -/* - * Read and allocate space for a string from a file. - * These strings are read-only and shared. - * Strings are hashed: - * each string prepended with hash pointer to prev string, - * hash code is simply the string length. - * this function takes 40% to 50% of boot-up time. - */ -char *fread_string( FILE *fp ) -{ - char *plast; - char c; - - plast = top_string + sizeof(char *); - if ( plast > &string_space[MAX_STRING - MAX_STRING_LENGTH] ) - { - bug( "Fread_string: MAX_STRING %d exceeded.", MAX_STRING ); - exit( 1 ); - } - - /* - * Skip blanks. - * Read first char. - */ - do - { - c = getc( fp ); - } - while ( isspace(c) ); - - if ( ( *plast++ = c ) == '~' ) - return &str_empty[0]; - - for ( ;; ) - { - /* - * Back off the char type lookup, - * it was too dirty for portability. - * -- Furey - */ - - switch ( *plast = getc(fp) ) - { - default: - plast++; - break; - - case EOF: - /* temp fix */ - bug( "Fread_string: EOF", 0 ); - return NULL; - /* exit( 1 ); */ - break; - - case '\n': - plast++; - *plast++ = '\r'; - break; - - case '\r': - break; - - case '~': - plast++; - { - union - { - char * pc; - char rgc[sizeof(char *)]; - } u1; - int ic; - int iHash; - char *pHash; - char *pHashPrev; - char *pString; - - plast[-1] = '\0'; - iHash = UMIN( MAX_KEY_HASH - 1, plast - 1 - top_string ); - for ( pHash = string_hash[iHash]; pHash; pHash = pHashPrev ) - { - for ( ic = 0; ic < sizeof(char *); ic++ ) - u1.rgc[ic] = pHash[ic]; - pHashPrev = u1.pc; - pHash += sizeof(char *); - - if ( top_string[sizeof(char *)] == pHash[0] - && !strcmp( top_string+sizeof(char *)+1, pHash+1 ) ) - return pHash; - } - - if ( fBootDb ) - { - pString = top_string; - top_string = plast; - u1.pc = string_hash[iHash]; - for ( ic = 0; ic < sizeof(char *); ic++ ) - pString[ic] = u1.rgc[ic]; - string_hash[iHash] = pString; - - nAllocString += 1; - sAllocString += top_string - pString; - return pString + sizeof(char *); - } - else - { - return str_dup( top_string + sizeof(char *) ); - } - } - } - } -} - -char *fread_string_eol( FILE *fp ) -{ - static bool char_special[256-EOF]; - char *plast; - char c; - - if ( char_special[EOF-EOF] != TRUE ) - { - char_special[EOF - EOF] = TRUE; - char_special['\n' - EOF] = TRUE; - char_special['\r' - EOF] = TRUE; - } - - plast = top_string + sizeof(char *); - if ( plast > &string_space[MAX_STRING - MAX_STRING_LENGTH] ) - { - bug( "Fread_string: MAX_STRING %d exceeded.", MAX_STRING ); - exit( 1 ); - } - - /* - * Skip blanks. - * Read first char. - */ - do - { - c = getc( fp ); - } - while ( isspace(c) ); - - if ( ( *plast++ = c ) == '\n') - return &str_empty[0]; - - for ( ;; ) - { - if ( !char_special[ ( *plast++ = getc( fp ) ) - EOF ] ) - continue; - - switch ( plast[-1] ) - { - default: - break; - - case EOF: - bug( "Fread_string_eol EOF", 0 ); - exit( 1 ); - break; - - case '\n': case '\r': - { - union - { - char * pc; - char rgc[sizeof(char *)]; - } u1; - int ic; - int iHash; - char *pHash; - char *pHashPrev; - char *pString; - - plast[-1] = '\0'; - iHash = UMIN( MAX_KEY_HASH - 1, plast - 1 - top_string ); - for ( pHash = string_hash[iHash]; pHash; pHash = pHashPrev ) - { - for ( ic = 0; ic < sizeof(char *); ic++ ) - u1.rgc[ic] = pHash[ic]; - pHashPrev = u1.pc; - pHash += sizeof(char *); - - if ( top_string[sizeof(char *)] == pHash[0] - && !strcmp( top_string+sizeof(char *)+1, pHash+1 ) ) - return pHash; - } - - if ( fBootDb ) - { - pString = top_string; - top_string = plast; - u1.pc = string_hash[iHash]; - for ( ic = 0; ic < sizeof(char *); ic++ ) - pString[ic] = u1.rgc[ic]; - string_hash[iHash] = pString; - - nAllocString += 1; - sAllocString += top_string - pString; - return pString + sizeof(char *); - } - else - { - return str_dup( top_string + sizeof(char *) ); - } - } - } - } -} - - - -/* - * Read to end of line (for comments). - */ -void fread_to_eol( FILE *fp ) -{ - char c; - - do - { - c = getc( fp ); - } - while ( c != '\n' && c != '\r' ); - - do - { - c = getc( fp ); - } - while ( c == '\n' || c == '\r' ); - - ungetc( c, fp ); - return; -} - - - -/* - * Read one word (into static buffer). - */ -char *fread_word( FILE *fp ) -{ - static char word[MAX_INPUT_LENGTH]; - char *pword; - char cEnd; - - do - { - cEnd = getc( fp ); - } - while ( isspace( cEnd ) ); - - if ( cEnd == '\'' || cEnd == '"' ) - { - pword = word; - } - else - { - word[0] = cEnd; - pword = word+1; - cEnd = ' '; - } - - for ( ; pword < word + MAX_INPUT_LENGTH; pword++ ) - { - *pword = getc( fp ); - if ( cEnd == ' ' ? isspace(*pword) : *pword == cEnd ) - { - if ( cEnd == ' ' ) - ungetc( *pword, fp ); - *pword = '\0'; - return word; - } - } - - bug( "Fread_word: word too long.", 0 ); - exit( 1 ); - return NULL; -} - -/* - * Allocate some ordinary memory, - * with the expectation of freeing it someday. - */ -void *alloc_mem( int sMem ) -{ - void *pMem; - int *magic; - int iList; - - sMem += sizeof(*magic); - - for ( iList = 0; iList < MAX_MEM_LIST; iList++ ) - { - if ( sMem <= rgSizeList[iList] ) - break; - } - - if ( iList == MAX_MEM_LIST ) - { - bug( "Alloc_mem: size %d too large.", sMem ); - exit( 1 ); - } - - if ( rgFreeList[iList] == NULL ) - { - pMem = alloc_perm( rgSizeList[iList] ); - } - else - { - pMem = rgFreeList[iList]; - rgFreeList[iList] = * ((void **) rgFreeList[iList]); - } - - magic = (int *) pMem; - *magic = MAGIC_NUM; - pMem += sizeof(*magic); - - return pMem; -} - - - -/* - * Free some memory. - * Recycle it back onto the free list for blocks of that size. - */ -void free_mem( void *pMem, int sMem ) -{ - int iList; - int *magic; - - pMem -= sizeof(*magic); - magic = (int *) pMem; - - if (*magic != MAGIC_NUM) - { - bug("Attempt to recyle invalid memory of size %d.",sMem); - bug((char*) pMem + sizeof(*magic),0); - return; - } - - *magic = 0; - sMem += sizeof(*magic); - - for ( iList = 0; iList < MAX_MEM_LIST; iList++ ) - { - if ( sMem <= rgSizeList[iList] ) - break; - } - - if ( iList == MAX_MEM_LIST ) - { - bug( "Free_mem: size %d too large.", sMem ); - exit( 1 ); - } - - * ((void **) pMem) = rgFreeList[iList]; - rgFreeList[iList] = pMem; - - return; -} - - -/* - * Allocate some permanent memory. - * Permanent memory is never freed, - * pointers into it may be copied safely. - */ -void *alloc_perm( int sMem ) -{ - static char *pMemPerm; - static int iMemPerm; - void *pMem; - - while ( sMem % sizeof(long) != 0 ) - sMem++; - if ( sMem > MAX_PERM_BLOCK ) - { - bug( "Alloc_perm: %d too large.", sMem ); - exit( 1 ); - } - - if ( pMemPerm == NULL || iMemPerm + sMem > MAX_PERM_BLOCK ) - { - iMemPerm = 0; - if ( ( pMemPerm = calloc( 1, MAX_PERM_BLOCK ) ) == NULL ) - { - perror( "Alloc_perm" ); - exit( 1 ); - } - } - - pMem = pMemPerm + iMemPerm; - iMemPerm += sMem; - nAllocPerm += 1; - sAllocPerm += sMem; - return pMem; -} - - - -/* - * Duplicate a string into dynamic memory. - * Fread_strings are read-only and shared. - */ -char *str_dup( const char *str ) -{ - char *str_new; - - if ( str[0] == '\0' ) - return &str_empty[0]; - - if ( str >= string_space && str < top_string ) - return (char *) str; - - str_new = alloc_mem( strlen(str) + 1 ); - strcpy( str_new, str ); - return str_new; -} - - - -/* - * Free a string. - * Null is legal here to simplify callers. - * Read-only shared strings are not touched. - */ -void free_string( char *pstr ) -{ - if ( pstr == NULL - || pstr == &str_empty[0] - || ( pstr >= string_space && pstr < top_string ) ) - return; - - free_mem( pstr, strlen(pstr) + 1 ); - return; -} - - - -void do_areas( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - AREA_DATA *pArea1; - AREA_DATA *pArea2; - int iArea; - int iAreaHalf; - - if (argument[0] != '\0') - { - send_to_char("No argument is used with this command.\n\r",ch); - return; - } - - iAreaHalf = (top_area + 1) / 2; - pArea1 = area_first; - pArea2 = area_first; - for ( iArea = 0; iArea < iAreaHalf; iArea++ ) - pArea2 = pArea2->next; - - for ( iArea = 0; iArea < iAreaHalf; iArea++ ) - { - sprintf( buf, "%-39s%-39s\n\r", - pArea1->credits, (pArea2 != NULL) ? pArea2->credits : "" ); - send_to_char( buf, ch ); - pArea1 = pArea1->next; - if ( pArea2 != NULL ) - pArea2 = pArea2->next; - } - - return; -} - - - -void do_memory( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - - sprintf( buf, "Affects %5d\n\r", top_affect ); send_to_char( buf, ch ); - sprintf( buf, "Areas %5d\n\r", top_area ); send_to_char( buf, ch ); - sprintf( buf, "ExDes %5d\n\r", top_ed ); send_to_char( buf, ch ); - sprintf( buf, "Exits %5d\n\r", top_exit ); send_to_char( buf, ch ); - sprintf( buf, "Helps %5d\n\r", top_help ); send_to_char( buf, ch ); - sprintf( buf, "Socials %5d\n\r", social_count ); send_to_char( buf, ch ); - sprintf( buf, "Mobs %5d(%d new format)\n\r", top_mob_index,newmobs ); - send_to_char( buf, ch ); - sprintf( buf, "(in use)%5d\n\r", mobile_count ); send_to_char( buf, ch ); - sprintf( buf, "Objs %5d(%d new format)\n\r", top_obj_index,newobjs ); - send_to_char( buf, ch ); - sprintf( buf, "Resets %5d\n\r", top_reset ); send_to_char( buf, ch ); - sprintf( buf, "Rooms %5d\n\r", top_room ); send_to_char( buf, ch ); - sprintf( buf, "Shops %5d\n\r", top_shop ); send_to_char( buf, ch ); - - sprintf( buf, "Strings %5d strings of %7d bytes (max %d).\n\r", - nAllocString, sAllocString, MAX_STRING ); - send_to_char( buf, ch ); - - sprintf( buf, "Perms %5d blocks of %7d bytes.\n\r", - nAllocPerm, sAllocPerm ); - send_to_char( buf, ch ); - - return; -} - -void do_dump( CHAR_DATA *ch, char *argument ) -{ - int count,count2,num_pcs,aff_count; - CHAR_DATA *fch; - MOB_INDEX_DATA *pMobIndex; - PC_DATA *pc; - OBJ_DATA *obj; - OBJ_INDEX_DATA *pObjIndex; - ROOM_INDEX_DATA *room; - EXIT_DATA *exit; - DESCRIPTOR_DATA *d; - AFFECT_DATA *af; - FILE *fp; - int vnum,nMatch = 0; - - /* open file */ - fclose(fpReserve); - fp = fopen("mem.dmp","w"); - - /* report use of data structures */ - - num_pcs = 0; - aff_count = 0; - - /* mobile prototypes */ - fprintf(fp,"MobProt %4d (%8zd bytes)\n", - top_mob_index, top_mob_index * (sizeof(*pMobIndex))); - - /* mobs */ - count = 0; count2 = 0; - for (fch = char_list; fch != NULL; fch = fch->next) - { - count++; - if (fch->pcdata != NULL) - num_pcs++; - for (af = fch->affected; af != NULL; af = af->next) - aff_count++; - } - for (fch = char_free; fch != NULL; fch = fch->next) - count2++; - - fprintf(fp,"Mobs %4d (%8zd bytes), %2d free (%zd bytes)\n", - count, count * (sizeof(*fch)), count2, count2 * (sizeof(*fch))); - - /* pcdata */ - count = 0; - for (pc = pcdata_free; pc != NULL; pc = pc->next) - count++; - - fprintf(fp,"Pcdata %4d (%8zd bytes), %2d free (%zd bytes)\n", - num_pcs, num_pcs * (sizeof(*pc)), count, count * (sizeof(*pc))); - - /* descriptors */ - count = 0; count2 = 0; - for (d = descriptor_list; d != NULL; d = d->next) - count++; - for (d= descriptor_free; d != NULL; d = d->next) - count2++; - - fprintf(fp, "Descs %4d (%8zd bytes), %2d free (%zd bytes)\n", - count, count * (sizeof(*d)), count2, count2 * (sizeof(*d))); - - /* object prototypes */ - for ( vnum = 0; nMatch < top_obj_index; vnum++ ) - if ( ( pObjIndex = get_obj_index( vnum ) ) != NULL ) - { - for (af = pObjIndex->affected; af != NULL; af = af->next) - aff_count++; - nMatch++; - } - - fprintf(fp,"ObjProt %4d (%8zd bytes)\n", - top_obj_index, top_obj_index * (sizeof(*pObjIndex))); - - - /* objects */ - count = 0; count2 = 0; - for (obj = object_list; obj != NULL; obj = obj->next) - { - count++; - for (af = obj->affected; af != NULL; af = af->next) - aff_count++; - } - for (obj = obj_free; obj != NULL; obj = obj->next) - count2++; - - fprintf(fp,"Objs %4d (%8zd bytes), %2d free (%zd bytes)\n", - count, count * (sizeof(*obj)), count2, count2 * (sizeof(*obj))); - - /* affects */ - count = 0; - for (af = affect_free; af != NULL; af = af->next) - count++; - - fprintf(fp,"Affects %4d (%8zd bytes), %2d free (%zd bytes)\n", - aff_count, aff_count * (sizeof(*af)), count, count * (sizeof(*af))); - - /* rooms */ - fprintf(fp,"Rooms %4d (%8zd bytes)\n", - top_room, top_room * (sizeof(*room))); - - /* exits */ - fprintf(fp,"Exits %4d (%8zd bytes)\n", - top_exit, top_exit * (sizeof(*exit))); - - fclose(fp); - - /* start printing out mobile data */ - fp = fopen("mob.dmp","w"); - - fprintf(fp,"\nMobile Analysis\n"); - fprintf(fp, "---------------\n"); - nMatch = 0; - for (vnum = 0; nMatch < top_mob_index; vnum++) - if ((pMobIndex = get_mob_index(vnum)) != NULL) - { - nMatch++; - fprintf(fp,"#%-4d %3d active %3d killed %s\n", - pMobIndex->vnum,pMobIndex->count, - pMobIndex->killed,pMobIndex->short_descr); - } - fclose(fp); - - /* start printing out object data */ - fp = fopen("obj.dmp","w"); - - fprintf(fp,"\nObject Analysis\n"); - fprintf(fp, "---------------\n"); - nMatch = 0; - for (vnum = 0; nMatch < top_obj_index; vnum++) - if ((pObjIndex = get_obj_index(vnum)) != NULL) - { - nMatch++; - fprintf(fp,"#%-4d %3d active %3d reset %s\n", - pObjIndex->vnum,pObjIndex->count, - pObjIndex->reset_num,pObjIndex->short_descr); - } - - /* close file */ - fclose(fp); - fpReserve = fopen( NULL_FILE, "r" ); -} - - - -/* - * Stick a little fuzz on a number. - */ -int number_fuzzy( int number ) -{ - switch ( number_bits( 2 ) ) - { - case 0: number -= 1; break; - case 3: number += 1; break; - } - - return UMAX( 1, number ); -} - - - -/* - * Generate a random number. - */ -int number_range( int from, int to ) -{ - int power; - int number; - - if (from == 0 && to == 0) - return 0; - - if ( ( to = to - from + 1 ) <= 1 ) - return from; - - for ( power = 2; power < to; power <<= 1 ) - ; - - while ( ( number = number_mm() & (power -1 ) ) >= to ) - ; - - return from + number; -} - - - -/* - * Generate a percentile roll. - */ -int number_percent( void ) -{ - int percent; - - while ( (percent = number_mm() & (128-1) ) > 99 ) - ; - - return 1 + percent; -} - - - -/* - * Generate a random door. - */ -int number_door( void ) -{ - int door; - - while ( ( door = number_mm() & (8-1) ) > 5) - ; - - return door; -} - -int number_bits( int width ) -{ - return number_mm( ) & ( ( 1 << width ) - 1 ); -} - - - - -/* - * I've gotten too many bad reports on OS-supplied random number generators. - * This is the Mitchell-Moore algorithm from Knuth Volume II. - * Best to leave the constants alone unless you've read Knuth. - * -- Furey - */ - -/* I noticed streaking with this random number generator, so I switched - back to the system srandom call. If this doesn't work for you, - define OLD_RAND to use the old system -- Alander */ - -#if defined (OLD_RAND) -static int rgiState[2+55]; -#endif - -void init_mm( ) -{ -#if defined (OLD_RAND) - int *piState; - int iState; - - piState = &rgiState[2]; - - piState[-2] = 55 - 55; - piState[-1] = 55 - 24; - - piState[0] = ((int) current_time) & ((1 << 30) - 1); - piState[1] = 1; - for ( iState = 2; iState < 55; iState++ ) - { - piState[iState] = (piState[iState-1] + piState[iState-2]) - & ((1 << 30) - 1); - } -#else - srandom(time(NULL)^getpid()); -#endif - return; -} - - - -long number_mm( void ) -{ -#if defined (OLD_RAND) - int *piState; - int iState1; - int iState2; - int iRand; - - piState = &rgiState[2]; - iState1 = piState[-2]; - iState2 = piState[-1]; - iRand = (piState[iState1] + piState[iState2]) - & ((1 << 30) - 1); - piState[iState1] = iRand; - if ( ++iState1 == 55 ) - iState1 = 0; - if ( ++iState2 == 55 ) - iState2 = 0; - piState[-2] = iState1; - piState[-1] = iState2; - return iRand >> 6; -#else - return random() >> 6; -#endif -} - - -/* - * Roll some dice. - */ -int dice( int number, int size ) -{ - int idice; - int sum; - - switch ( size ) - { - case 0: return 0; - case 1: return number; - } - - for ( idice = 0, sum = 0; idice < number; idice++ ) - sum += number_range( 1, size ); - - return sum; -} - - - -/* - * Simple linear interpolation. - */ -int interpolate( int level, int value_00, int value_32 ) -{ - return value_00 + level * (value_32 - value_00) / 32; -} - - - -/* - * Removes the tildes from a string. - * Used for player-entered strings that go into disk files. - */ -void smash_tilde( char *str ) -{ - for ( ; *str != '\0'; str++ ) - { - if ( *str == '~' ) - *str = '-'; - } - - return; -} - - - -/* - * Compare strings, case insensitive. - * Return TRUE if different - * (compatibility with historical functions). - */ -bool str_cmp( const char *astr, const char *bstr ) -{ - if ( astr == NULL ) - { - bug( "Str_cmp: null astr.", 0 ); - return TRUE; - } - - if ( bstr == NULL ) - { - bug( "Str_cmp: null bstr.", 0 ); - return TRUE; - } - - for ( ; *astr || *bstr; astr++, bstr++ ) - { - if ( LOWER(*astr) != LOWER(*bstr) ) - return TRUE; - } - - return FALSE; -} - - - -/* - * Compare strings, case insensitive, for prefix matching. - * Return TRUE if astr not a prefix of bstr - * (compatibility with historical functions). - */ -bool str_prefix( const char *astr, const char *bstr ) -{ - if ( astr == NULL ) - { - bug( "Strn_cmp: null astr.", 0 ); - return TRUE; - } - - if ( bstr == NULL ) - { - bug( "Strn_cmp: null bstr.", 0 ); - return TRUE; - } - - for ( ; *astr; astr++, bstr++ ) - { - if ( LOWER(*astr) != LOWER(*bstr) ) - return TRUE; - } - - return FALSE; -} - - - -/* - * Compare strings, case insensitive, for match anywhere. - * Returns TRUE is astr not part of bstr. - * (compatibility with historical functions). - */ -bool str_infix( const char *astr, const char *bstr ) -{ - int sstr1; - int sstr2; - int ichar; - char c0; - - if ( ( c0 = LOWER(astr[0]) ) == '\0' ) - return FALSE; - - sstr1 = strlen(astr); - sstr2 = strlen(bstr); - - for ( ichar = 0; ichar <= sstr2 - sstr1; ichar++ ) - { - if ( c0 == LOWER(bstr[ichar]) && !str_prefix( astr, bstr + ichar ) ) - return FALSE; - } - - return TRUE; -} - - - -/* - * Compare strings, case insensitive, for suffix matching. - * Return TRUE if astr not a suffix of bstr - * (compatibility with historical functions). - */ -bool str_suffix( const char *astr, const char *bstr ) -{ - int sstr1; - int sstr2; - - sstr1 = strlen(astr); - sstr2 = strlen(bstr); - if ( sstr1 <= sstr2 && !str_cmp( astr, bstr + sstr2 - sstr1 ) ) - return FALSE; - else - return TRUE; -} - - - -/* - * Returns an initial-capped string. - */ -char *capitalize( const char *str ) -{ - static char strcap[MAX_STRING_LENGTH]; - int i; - - for ( i = 0; str[i] != '\0'; i++ ) - strcap[i] = LOWER(str[i]); - strcap[i] = '\0'; - strcap[0] = UPPER(strcap[0]); - return strcap; -} - - -/* - * Append a string to a file. - */ -void append_file( CHAR_DATA *ch, char *file, char *str ) -{ - FILE *fp; - - if ( IS_NPC(ch) || str[0] == '\0' ) - return; - - fclose( fpReserve ); - if ( ( fp = fopen( file, "a" ) ) == NULL ) - { - perror( file ); - send_to_char( "Could not open the file!\n\r", ch ); - } - else - { - fprintf( fp, "[%5d] %s: %s\n", - ch->in_room ? ch->in_room->vnum : 0, ch->name, str ); - fclose( fp ); - } - - fpReserve = fopen( NULL_FILE, "r" ); - return; -} - - - -/* - * Reports a bug. - */ -void bug( const char *str, int param ) -{ - char buf[MAX_STRING_LENGTH]; - - if ( fpArea != NULL ) - { - int iLine; - int iChar; - - if ( fpArea == stdin ) - { - iLine = 0; - } - else - { - iChar = ftell( fpArea ); - fseek( fpArea, 0, 0 ); - for ( iLine = 0; ftell( fpArea ) < iChar; iLine++ ) - { - while ( getc( fpArea ) != '\n' ) - ; - } - fseek( fpArea, iChar, 0 ); - } - - sprintf( buf, "[*****] FILE: %s LINE: %d", strArea, iLine ); - log_string( buf ); -/* RT removed because we don't want bugs shutting the mud - if ( ( fp = fopen( "shutdown.txt", "a" ) ) != NULL ) - { - fprintf( fp, "[*****] %s\n", buf ); - fclose( fp ); - } -*/ - } - - strcpy( buf, "[*****] BUG: " ); - sprintf( buf + strlen(buf), str, param ); - log_string( buf ); -/* RT removed due to bug-file spamming - fclose( fpReserve ); - if ( ( fp = fopen( BUG_FILE, "a" ) ) != NULL ) - { - fprintf( fp, "%s\n", buf ); - fclose( fp ); - } - fpReserve = fopen( NULL_FILE, "r" ); -*/ - - return; -} - - - -/* - * Writes a string to the log. - */ -void log_string( const char *str ) -{ - char *strtime; - - strtime = ctime( ¤t_time ); - strtime[strlen(strtime)-1] = '\0'; - fprintf( stderr, "%s :: %s\n", strtime, str ); - return; -} - - - -/* - * This function is here to aid in debugging. - * If the last expression in a function is another function call, - * gcc likes to generate a JMP instead of a CALL. - * This is called "tail chaining." - * It hoses the debugger call stack for that call. - * So I make this the last call in certain critical functions, - * where I really need the call stack to be right for debugging! - * - * If you don't understand this, then LEAVE IT ALONE. - * Don't remove any calls to tail_chain anywhere. - * - * -- Furey - */ -void tail_chain( void ) -{ - return; -} diff --git a/archive/src/db.h b/archive/src/db.h deleted file mode 100644 index 48b5824..0000000 --- a/archive/src/db.h +++ /dev/null @@ -1,52 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -/* vals from db.c */ -extern bool fBootDb; -extern int newmobs; -extern int newobjs; -extern MOB_INDEX_DATA * mob_index_hash [MAX_KEY_HASH]; -extern OBJ_INDEX_DATA * obj_index_hash [MAX_KEY_HASH]; -extern int top_mob_index; -extern int top_obj_index; -extern int top_affect; -extern int top_ed; -extern AREA_DATA * area_first; - - -/* from db2.c */ -extern int social_count; - -/* conversion from db.h */ -void convert_mob(MOB_INDEX_DATA *mob); -void convert_obj(OBJ_INDEX_DATA *obj); - -/* macro for flag swapping */ -#define GET_UNSET(flag1,flag2) (~(flag1)&((flag1)|(flag2))) - -/* Magic number for memory allocation */ -#define MAGIC_NUM 52571214 diff --git a/archive/src/db2.c b/archive/src/db2.c deleted file mode 100644 index 89c0929..0000000 --- a/archive/src/db2.c +++ /dev/null @@ -1,493 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#include -#include -#include -#include -#include -#if defined(macintosh) -#include -#else -#include -#include -#endif - -#include "merc.h" -#include "db.h" -#include "lookup.h" - - -/* values for db2.c */ -struct social_type social_list [MAX_SOCIALS]; -int social_count; - -/* snarf a socials file */ -void load_socials( FILE *fp) -{ - for ( ; ; ) - { - struct social_type social; - char *temp; - /* clear social */ - social.char_no_arg = NULL; - social.others_no_arg = NULL; - social.char_found = NULL; - social.others_found = NULL; - social.vict_found = NULL; - social.char_not_found = NULL; - social.char_auto = NULL; - social.others_auto = NULL; - - temp = fread_word(fp); - if (!strcmp(temp,"#0")) - return; /* done */ - strcpy(social.name,temp); - fread_to_eol(fp); - - temp = fread_string_eol(fp); - if (!strcmp(temp,"$")) - social.char_no_arg = NULL; - else if (!strcmp(temp,"#")) - { - social_list[social_count] = social; - social_count++; - continue; - } - else - social.char_no_arg = temp; - - temp = fread_string_eol(fp); - if (!strcmp(temp,"$")) - social.others_no_arg = NULL; - - - - - - - - - - - - - - - temp = fread_string_eol(fp); - if (!strcmp(temp,"$")) - social.char_auto = NULL; - else if (!strcmp(temp,"#")) - { - social_list[social_count] = social; - social_count++; - continue; - } - else - social.char_auto = temp; - - temp = fread_string_eol(fp); - if (!strcmp(temp,"$")) - social.others_auto = NULL; - else if (!strcmp(temp,"#")) - { - social_list[social_count] = social; - social_count++; - continue; - } - else - social.others_auto = temp; - - social_list[social_count] = social; - social_count++; - } - return; -} - - - - - - -/* - * Snarf a mob section. new style - */ -void load_mobiles( FILE *fp ) -{ - MOB_INDEX_DATA *pMobIndex; - - for ( ; ; ) - { - sh_int vnum; - char letter; - int iHash; - - letter = fread_letter( fp ); - if ( letter != '#' ) - { - bug( "Load_mobiles: # not found.", 0 ); - exit( 1 ); - } - - vnum = fread_number( fp ); - if ( vnum == 0 ) - break; - - fBootDb = FALSE; - if ( get_mob_index( vnum ) != NULL ) - { - bug( "Load_mobiles: vnum %d duplicated.", vnum ); - exit( 1 ); - } - fBootDb = TRUE; - - pMobIndex = alloc_perm( sizeof(*pMobIndex) ); - pMobIndex->vnum = vnum; - pMobIndex->new_format = TRUE; - newmobs++; - pMobIndex->player_name = fread_string( fp ); - pMobIndex->short_descr = fread_string( fp ); - pMobIndex->long_descr = fread_string( fp ); - pMobIndex->description = fread_string( fp ); - pMobIndex->race = race_lookup(fread_string( fp )); - - pMobIndex->long_descr[0] = UPPER(pMobIndex->long_descr[0]); - pMobIndex->description[0] = UPPER(pMobIndex->description[0]); - - pMobIndex->act = fread_flag( fp ) | ACT_IS_NPC - | race_table[pMobIndex->race].act; - pMobIndex->affected_by = fread_flag( fp ) - | race_table[pMobIndex->race].aff; - pMobIndex->pShop = NULL; - pMobIndex->alignment = fread_number( fp ); - pMobIndex->group = fread_number( fp ); - - pMobIndex->level = fread_number( fp ); - pMobIndex->hitroll = fread_number( fp ); - - /* read hit dice */ - pMobIndex->hit[DICE_NUMBER] = fread_number( fp ); - /* 'd' */ fread_letter( fp ); - pMobIndex->hit[DICE_TYPE] = fread_number( fp ); - /* '+' */ fread_letter( fp ); - pMobIndex->hit[DICE_BONUS] = fread_number( fp ); - - /* read mana dice */ - pMobIndex->mana[DICE_NUMBER] = fread_number( fp ); - fread_letter( fp ); - pMobIndex->mana[DICE_TYPE] = fread_number( fp ); - fread_letter( fp ); - pMobIndex->mana[DICE_BONUS] = fread_number( fp ); - - /* read damage dice */ - pMobIndex->damage[DICE_NUMBER] = fread_number( fp ); - fread_letter( fp ); - pMobIndex->damage[DICE_TYPE] = fread_number( fp ); - fread_letter( fp ); - pMobIndex->damage[DICE_BONUS] = fread_number( fp ); - pMobIndex->dam_type = attack_lookup(fread_word(fp)); - - /* read armor class */ - pMobIndex->ac[AC_PIERCE] = fread_number( fp ) * 10; - pMobIndex->ac[AC_BASH] = fread_number( fp ) * 10; - pMobIndex->ac[AC_SLASH] = fread_number( fp ) * 10; - pMobIndex->ac[AC_EXOTIC] = fread_number( fp ) * 10; - - /* read flags and add in data from the race table */ - pMobIndex->off_flags = fread_flag( fp ) - | race_table[pMobIndex->race].off; - pMobIndex->imm_flags = fread_flag( fp ) - | race_table[pMobIndex->race].imm; - pMobIndex->res_flags = fread_flag( fp ) - | race_table[pMobIndex->race].res; - pMobIndex->vuln_flags = fread_flag( fp ) - | race_table[pMobIndex->race].vuln; - - /* vital statistics */ - pMobIndex->start_pos = position_lookup(fread_word(fp)); - pMobIndex->default_pos = position_lookup(fread_word(fp)); - pMobIndex->sex = sex_lookup(fread_word(fp)); - - pMobIndex->wealth = fread_number( fp ); - - pMobIndex->form = fread_flag( fp ) - | race_table[pMobIndex->race].form; - pMobIndex->parts = fread_flag( fp ) - | race_table[pMobIndex->race].parts; - /* size */ - pMobIndex->size = size_lookup(fread_word(fp)); - pMobIndex->material = str_dup(fread_word( fp )); - - for ( ; ; ) - { - letter = fread_letter( fp ); - - if (letter == 'F') - { - char *word; - long vector; - - word = fread_word(fp); - vector = fread_flag(fp); - - if (!str_prefix(word,"act")) - REMOVE_BIT(pMobIndex->act,vector); - else if (!str_prefix(word,"aff")) - REMOVE_BIT(pMobIndex->affected_by,vector); - else if (!str_prefix(word,"off")) - REMOVE_BIT(pMobIndex->off_flags,vector); - else if (!str_prefix(word,"imm")) - REMOVE_BIT(pMobIndex->imm_flags,vector); - else if (!str_prefix(word,"res")) - REMOVE_BIT(pMobIndex->res_flags,vector); - else if (!str_prefix(word,"vul")) - REMOVE_BIT(pMobIndex->vuln_flags,vector); - else if (!str_prefix(word,"for")) - REMOVE_BIT(pMobIndex->form,vector); - else if (!str_prefix(word,"par")) - REMOVE_BIT(pMobIndex->parts,vector); - else - { - bug("Flag remove: flag not found.",0); - exit(1); - } - } - else - { - ungetc(letter,fp); - break; - } - } - - iHash = vnum % MAX_KEY_HASH; - pMobIndex->next = mob_index_hash[iHash]; - mob_index_hash[iHash] = pMobIndex; - top_mob_index++; - kill_table[URANGE(0, pMobIndex->level, MAX_LEVEL-1)].number++; - } - - return; -} - -/* - * Snarf an obj section. new style - */ -void load_objects( FILE *fp ) -{ - OBJ_INDEX_DATA *pObjIndex; - - for ( ; ; ) - { - sh_int vnum; - char letter; - int iHash; - - letter = fread_letter( fp ); - if ( letter != '#' ) - { - bug( "Load_objects: # not found.", 0 ); - exit( 1 ); - } - - vnum = fread_number( fp ); - if ( vnum == 0 ) - break; - - fBootDb = FALSE; - if ( get_obj_index( vnum ) != NULL ) - { - bug( "Load_objects: vnum %d duplicated.", vnum ); - exit( 1 ); - } - fBootDb = TRUE; - - pObjIndex = alloc_perm( sizeof(*pObjIndex) ); - pObjIndex->vnum = vnum; - pObjIndex->new_format = TRUE; - pObjIndex->reset_num = 0; - newobjs++; - pObjIndex->name = fread_string( fp ); - pObjIndex->short_descr = fread_string( fp ); - pObjIndex->description = fread_string( fp ); - pObjIndex->material = fread_string( fp ); - - pObjIndex->item_type = item_lookup(fread_word( fp )); - pObjIndex->extra_flags = fread_flag( fp ); - pObjIndex->wear_flags = fread_flag( fp ); - switch(pObjIndex->item_type) - { - case ITEM_WEAPON: - pObjIndex->value[0] = weapon_type(fread_word(fp)); - pObjIndex->value[1] = fread_number(fp); - pObjIndex->value[2] = fread_number(fp); - pObjIndex->value[3] = attack_lookup(fread_word(fp)); - pObjIndex->value[4] = fread_flag(fp); - break; - case ITEM_CONTAINER: - pObjIndex->value[0] = fread_number(fp); - pObjIndex->value[1] = fread_flag(fp); - pObjIndex->value[2] = fread_number(fp); - pObjIndex->value[3] = fread_number(fp); - pObjIndex->value[4] = fread_number(fp); - break; - case ITEM_DRINK_CON: - case ITEM_FOUNTAIN: - pObjIndex->value[0] = fread_number(fp); - pObjIndex->value[1] = fread_number(fp); - pObjIndex->value[2] = liq_lookup(fread_word(fp)); - pObjIndex->value[3] = fread_number(fp); - pObjIndex->value[4] = fread_number(fp); - break; - case ITEM_WAND: - case ITEM_STAFF: - pObjIndex->value[0] = fread_number(fp); - pObjIndex->value[1] = fread_number(fp); - pObjIndex->value[2] = fread_number(fp); - pObjIndex->value[3] = skill_lookup(fread_word(fp)); - pObjIndex->value[4] = fread_number(fp); - break; - case ITEM_POTION: - case ITEM_PILL: - case ITEM_SCROLL: - pObjIndex->value[0] = fread_number(fp); - pObjIndex->value[1] = skill_lookup(fread_word(fp)); - pObjIndex->value[2] = skill_lookup(fread_word(fp)); - pObjIndex->value[3] = skill_lookup(fread_word(fp)); - pObjIndex->value[4] = skill_lookup(fread_word(fp)); - break; - default: - pObjIndex->value[0] = fread_flag( fp ); - pObjIndex->value[1] = fread_flag( fp ); - pObjIndex->value[2] = fread_flag( fp ); - pObjIndex->value[3] = fread_flag( fp ); - pObjIndex->value[4] = fread_flag( fp ); - break; - } - pObjIndex->level = fread_number( fp ); - pObjIndex->weight = fread_number( fp ); - pObjIndex->cost = fread_number( fp ); - - /* condition */ - letter = fread_letter( fp ); - switch (letter) - { - case ('P') : pObjIndex->condition = 100; break; - case ('G') : pObjIndex->condition = 90; break; - case ('A') : pObjIndex->condition = 75; break; - case ('W') : pObjIndex->condition = 50; break; - case ('D') : pObjIndex->condition = 25; break; - case ('B') : pObjIndex->condition = 10; break; - case ('R') : pObjIndex->condition = 0; break; - default: pObjIndex->condition = 100; break; - } - - for ( ; ; ) - { - char letter; - - letter = fread_letter( fp ); - - if ( letter == 'A' ) - { - AFFECT_DATA *paf; - - paf = alloc_perm( sizeof(*paf) ); - paf->where = TO_OBJECT; - paf->type = -1; - paf->level = pObjIndex->level; - paf->duration = -1; - paf->location = fread_number( fp ); - paf->modifier = fread_number( fp ); - paf->bitvector = 0; - paf->next = pObjIndex->affected; - pObjIndex->affected = paf; - top_affect++; - } - - else if (letter == 'F') - { - AFFECT_DATA *paf; - - paf = alloc_perm( sizeof(*paf) ); - letter = fread_letter(fp); - switch (letter) - { - case 'A': - paf->where = TO_AFFECTS; - break; - case 'I': - paf->where = TO_IMMUNE; - break; - case 'R': - paf->where = TO_RESIST; - break; - case 'V': - paf->where = TO_VULN; - break; - default: - bug( "Load_objects: Bad where on flag set.", 0 ); - exit( 1 ); - } - paf->type = -1; - paf->level = pObjIndex->level; - paf->duration = -1; - paf->location = fread_number(fp); - paf->modifier = fread_number(fp); - paf->bitvector = fread_flag(fp); - paf->next = pObjIndex->affected; - pObjIndex->affected = paf; - top_affect++; - } - - else if ( letter == 'E' ) - { - EXTRA_DESCR_DATA *ed; - - ed = alloc_perm( sizeof(*ed) ); - ed->keyword = fread_string( fp ); - ed->description = fread_string( fp ); - ed->next = pObjIndex->extra_descr; - pObjIndex->extra_descr = ed; - top_ed++; - } - - else - { - ungetc( letter, fp ); - break; - } - } - - iHash = vnum % MAX_KEY_HASH; - pObjIndex->next = obj_index_hash[iHash]; - obj_index_hash[iHash] = pObjIndex; - top_obj_index++; - } - - return; -} - diff --git a/archive/src/effects.c b/archive/src/effects.c deleted file mode 100644 index c56fe92..0000000 --- a/archive/src/effects.c +++ /dev/null @@ -1,621 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#endif -#include -#include -#include -#include -#include "merc.h" -#include "recycle.h" - -void acid_effect(void *vo, int level, int dam, int target) -{ - if (target == TARGET_ROOM) /* nail objects on the floor */ - { - ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo; - OBJ_DATA *obj, *obj_next; - - for (obj = room->contents; obj != NULL; obj = obj_next) - { - obj_next = obj->next_content; - acid_effect(obj,level,dam,TARGET_OBJ); - } - return; - } - - if (target == TARGET_CHAR) /* do the effect on a victim */ - { - CHAR_DATA *victim = (CHAR_DATA *) vo; - OBJ_DATA *obj, *obj_next; - - /* let's toast some gear */ - for (obj = victim->carrying; obj != NULL; obj = obj_next) - { - obj_next = obj->next_content; - acid_effect(obj,level,dam,TARGET_OBJ); - } - return; - } - - if (target == TARGET_OBJ) /* toast an object */ - { - OBJ_DATA *obj = (OBJ_DATA *) vo; - OBJ_DATA *t_obj,*n_obj; - int chance; - char *msg; - - if (IS_OBJ_STAT(obj,ITEM_BURN_PROOF) - || IS_OBJ_STAT(obj,ITEM_NOPURGE) - || number_range(0,4) == 0) - return; - - chance = level / 4 + dam / 10; - - if (chance > 25) - chance = (chance - 25) / 2 + 25; - if (chance > 50) - chance = (chance - 50) / 2 + 50; - - if (IS_OBJ_STAT(obj,ITEM_BLESS)) - chance -= 5; - - chance -= obj->level * 2; - - switch (obj->item_type) - { - default: - return; - case ITEM_CONTAINER: - case ITEM_CORPSE_PC: - case ITEM_CORPSE_NPC: - msg = "$p fumes and dissolves."; - break; - case ITEM_ARMOR: - msg = "$p is pitted and etched."; - break; - case ITEM_CLOTHING: - msg = "$p is corroded into scrap."; - break; - case ITEM_STAFF: - case ITEM_WAND: - chance -= 10; - msg = "$p corrodes and breaks."; - break; - case ITEM_SCROLL: - chance += 10; - msg = "$p is burned into waste."; - break; - } - - chance = URANGE(5,chance,95); - - if (number_percent() > chance) - return; - - if (obj->carried_by != NULL) - act(msg,obj->carried_by,obj,NULL,TO_ALL); - else if (obj->in_room != NULL && obj->in_room->people != NULL) - act(msg,obj->in_room->people,obj,NULL,TO_ALL); - - if (obj->item_type == ITEM_ARMOR) /* etch it */ - { - AFFECT_DATA *paf; - bool af_found = FALSE; - int i; - - affect_enchant(obj); - - for ( paf = obj->affected; paf != NULL; paf = paf->next) - { - if ( paf->location == APPLY_AC) - { - af_found = TRUE; - paf->type = -1; - paf->modifier += 1; - paf->level = UMAX(paf->level,level); - break; - } - } - - if (!af_found) - /* needs a new affect */ - { - paf = new_affect(); - - paf->type = -1; - paf->level = level; - paf->duration = -1; - paf->location = APPLY_AC; - paf->modifier = 1; - paf->bitvector = 0; - paf->next = obj->affected; - obj->affected = paf; - } - - if (obj->carried_by != NULL && obj->wear_loc != WEAR_NONE) - for (i = 0; i < 4; i++) - obj->carried_by->armor[i] += 1; - return; - } - - /* get rid of the object */ - if (obj->contains) /* dump contents */ - { - for (t_obj = obj->contains; t_obj != NULL; t_obj = n_obj) - { - n_obj = t_obj->next_content; - obj_from_obj(t_obj); - if (obj->in_room != NULL) - obj_to_room(t_obj,obj->in_room); - else if (obj->carried_by != NULL) - obj_to_room(t_obj,obj->carried_by->in_room); - else - { - extract_obj(t_obj); - continue; - } - - acid_effect(t_obj,level/2,dam/2,TARGET_OBJ); - } - } - - extract_obj(obj); - return; - } -} - - -void cold_effect(void *vo, int level, int dam, int target) -{ - if (target == TARGET_ROOM) /* nail objects on the floor */ - { - ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo; - OBJ_DATA *obj, *obj_next; - - for (obj = room->contents; obj != NULL; obj = obj_next) - { - obj_next = obj->next_content; - cold_effect(obj,level,dam,TARGET_OBJ); - } - return; - } - - if (target == TARGET_CHAR) /* whack a character */ - { - CHAR_DATA *victim = (CHAR_DATA *) vo; - OBJ_DATA *obj, *obj_next; - - /* chill touch effect */ - if (!saves_spell(level/4 + dam / 20, victim, DAM_COLD)) - { - AFFECT_DATA af; - - act("$n turns blue and shivers.",victim,NULL,NULL,TO_ROOM); - act("A chill sinks deep into your bones.",victim,NULL,NULL,TO_CHAR); - af.where = TO_AFFECTS; - af.type = skill_lookup("chill touch"); - af.level = level; - af.duration = 6; - af.location = APPLY_STR; - af.modifier = -1; - af.bitvector = 0; - affect_join( victim, &af ); - } - - /* hunger! (warmth sucked out */ - if (!IS_NPC(victim)) - gain_condition(victim,COND_HUNGER,dam/20); - - /* let's toast some gear */ - for (obj = victim->carrying; obj != NULL; obj = obj_next) - { - obj_next = obj->next_content; - cold_effect(obj,level,dam,TARGET_OBJ); - } - return; - } - - if (target == TARGET_OBJ) /* toast an object */ - { - OBJ_DATA *obj = (OBJ_DATA *) vo; - int chance; - char *msg; - - if (IS_OBJ_STAT(obj,ITEM_BURN_PROOF) - || IS_OBJ_STAT(obj,ITEM_NOPURGE) - || number_range(0,4) == 0) - return; - - chance = level / 4 + dam / 10; - - if (chance > 25) - chance = (chance - 25) / 2 + 25; - if (chance > 50) - chance = (chance - 50) / 2 + 50; - - if (IS_OBJ_STAT(obj,ITEM_BLESS)) - chance -= 5; - - chance -= obj->level * 2; - - switch(obj->item_type) - { - default: - return; - case ITEM_POTION: - msg = "$p freezes and shatters!"; - chance += 25; - break; - case ITEM_DRINK_CON: - msg = "$p freezes and shatters!"; - chance += 5; - break; - } - - chance = URANGE(5,chance,95); - - if (number_percent() > chance) - return; - - if (obj->carried_by != NULL) - act(msg,obj->carried_by,obj,NULL,TO_ALL); - else if (obj->in_room != NULL && obj->in_room->people != NULL) - act(msg,obj->in_room->people,obj,NULL,TO_ALL); - - extract_obj(obj); - return; - } -} - - - -void fire_effect(void *vo, int level, int dam, int target) -{ - if (target == TARGET_ROOM) /* nail objects on the floor */ - { - ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo; - OBJ_DATA *obj, *obj_next; - - for (obj = room->contents; obj != NULL; obj = obj_next) - { - obj_next = obj->next_content; - fire_effect(obj,level,dam,TARGET_OBJ); - } - return; - } - - if (target == TARGET_CHAR) /* do the effect on a victim */ - { - CHAR_DATA *victim = (CHAR_DATA *) vo; - OBJ_DATA *obj, *obj_next; - - /* chance of blindness */ - if (!IS_AFFECTED(victim,AFF_BLIND) - && !saves_spell(level / 4 + dam / 20, victim,DAM_FIRE)) - { - AFFECT_DATA af; - act("$n is blinded by smoke!",victim,NULL,NULL,TO_ROOM); - act("Your eyes tear up from smoke...you can't see a thing!", - victim,NULL,NULL,TO_CHAR); - - af.where = TO_AFFECTS; - af.type = skill_lookup("fire breath"); - af.level = level; - af.duration = number_range(0,level/10); - af.location = APPLY_HITROLL; - af.modifier = -4; - af.bitvector = AFF_BLIND; - - affect_to_char(victim,&af); - } - - /* getting thirsty */ - if (!IS_NPC(victim)) - gain_condition(victim,COND_THIRST,dam/20); - - /* let's toast some gear! */ - for (obj = victim->carrying; obj != NULL; obj = obj_next) - { - obj_next = obj->next_content; - - fire_effect(obj,level,dam,TARGET_OBJ); - } - return; - } - - if (target == TARGET_OBJ) /* toast an object */ - { - OBJ_DATA *obj = (OBJ_DATA *) vo; - OBJ_DATA *t_obj,*n_obj; - int chance; - char *msg; - - if (IS_OBJ_STAT(obj,ITEM_BURN_PROOF) - || IS_OBJ_STAT(obj,ITEM_NOPURGE) - || number_range(0,4) == 0) - return; - - chance = level / 4 + dam / 10; - - if (chance > 25) - chance = (chance - 25) / 2 + 25; - if (chance > 50) - chance = (chance - 50) / 2 + 50; - - if (IS_OBJ_STAT(obj,ITEM_BLESS)) - chance -= 5; - chance -= obj->level * 2; - - switch ( obj->item_type ) - { - default: - return; - case ITEM_CONTAINER: - msg = "$p ignites and burns!"; - break; - case ITEM_POTION: - chance += 25; - msg = "$p bubbles and boils!"; - break; - case ITEM_SCROLL: - chance += 50; - msg = "$p crackles and burns!"; - break; - case ITEM_STAFF: - chance += 10; - msg = "$p smokes and chars!"; - break; - case ITEM_WAND: - msg = "$p sparks and sputters!"; - break; - case ITEM_FOOD: - msg = "$p blackens and crisps!"; - break; - case ITEM_PILL: - msg = "$p melts and drips!"; - break; - } - - chance = URANGE(5,chance,95); - - if (number_percent() > chance) - return; - - if (obj->carried_by != NULL) - act( msg, obj->carried_by, obj, NULL, TO_ALL ); - else if (obj->in_room != NULL && obj->in_room->people != NULL) - act(msg,obj->in_room->people,obj,NULL,TO_ALL); - - if (obj->contains) - { - /* dump the contents */ - - for (t_obj = obj->contains; t_obj != NULL; t_obj = n_obj) - { - n_obj = t_obj->next_content; - obj_from_obj(t_obj); - if (obj->in_room != NULL) - obj_to_room(t_obj,obj->in_room); - else if (obj->carried_by != NULL) - obj_to_room(t_obj,obj->carried_by->in_room); - else - { - extract_obj(t_obj); - continue; - } - fire_effect(t_obj,level/2,dam/2,TARGET_OBJ); - } - } - - extract_obj( obj ); - return; - } -} - -void poison_effect(void *vo,int level, int dam, int target) -{ - if (target == TARGET_ROOM) /* nail objects on the floor */ - { - ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo; - OBJ_DATA *obj, *obj_next; - - for (obj = room->contents; obj != NULL; obj = obj_next) - { - obj_next = obj->next_content; - poison_effect(obj,level,dam,TARGET_OBJ); - } - return; - } - - if (target == TARGET_CHAR) /* do the effect on a victim */ - { - CHAR_DATA *victim = (CHAR_DATA *) vo; - OBJ_DATA *obj, *obj_next; - - /* chance of poisoning */ - if (!saves_spell(level / 4 + dam / 20,victim,DAM_POISON)) - { - AFFECT_DATA af; - - send_to_char("You feel poison coursing through your veins.\n\r", - victim); - act("$n looks very ill.",victim,NULL,NULL,TO_ROOM); - - af.where = TO_AFFECTS; - af.type = gsn_poison; - af.level = level; - af.duration = level / 2; - af.location = APPLY_STR; - af.modifier = -1; - af.bitvector = AFF_POISON; - affect_join( victim, &af ); - } - - /* equipment */ - for (obj = victim->carrying; obj != NULL; obj = obj_next) - { - obj_next = obj->next_content; - poison_effect(obj,level,dam,TARGET_OBJ); - } - return; - } - - if (target == TARGET_OBJ) /* do some poisoning */ - { - OBJ_DATA *obj = (OBJ_DATA *) vo; - int chance; - - - if (IS_OBJ_STAT(obj,ITEM_BURN_PROOF) - || IS_OBJ_STAT(obj,ITEM_BLESS) - || number_range(0,4) == 0) - return; - - chance = level / 4 + dam / 10; - if (chance > 25) - chance = (chance - 25) / 2 + 25; - if (chance > 50) - chance = (chance - 50) / 2 + 50; - - chance -= obj->level * 2; - - switch (obj->item_type) - { - default: - return; - case ITEM_FOOD: - break; - case ITEM_DRINK_CON: - if (obj->value[0] == obj->value[1]) - return; - break; - } - - chance = URANGE(5,chance,95); - - if (number_percent() > chance) - return; - - obj->value[3] = 1; - return; - } -} - - -void shock_effect(void *vo,int level, int dam, int target) -{ - if (target == TARGET_ROOM) - { - ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo; - OBJ_DATA *obj, *obj_next; - - for (obj = room->contents; obj != NULL; obj = obj_next) - { - obj_next = obj->next_content; - shock_effect(obj,level,dam,TARGET_OBJ); - } - return; - } - - if (target == TARGET_CHAR) - { - CHAR_DATA *victim = (CHAR_DATA *) vo; - OBJ_DATA *obj, *obj_next; - - /* daze and confused? */ - if (!saves_spell(level/4 + dam/20,victim,DAM_LIGHTNING)) - { - send_to_char("Your muscles stop responding.\n\r",victim); - DAZE_STATE(victim,UMAX(12,level/4 + dam/20)); - } - - /* toast some gear */ - for (obj = victim->carrying; obj != NULL; obj = obj_next) - { - obj_next = obj->next_content; - shock_effect(obj,level,dam,TARGET_OBJ); - } - return; - } - - if (target == TARGET_OBJ) - { - OBJ_DATA *obj = (OBJ_DATA *) vo; - int chance; - char *msg; - - if (IS_OBJ_STAT(obj,ITEM_BURN_PROOF) - || IS_OBJ_STAT(obj,ITEM_NOPURGE) - || number_range(0,4) == 0) - return; - - chance = level / 4 + dam / 10; - - if (chance > 25) - chance = (chance - 25) / 2 + 25; - if (chance > 50) - chance = (chance - 50) /2 + 50; - - if (IS_OBJ_STAT(obj,ITEM_BLESS)) - chance -= 5; - - chance -= obj->level * 2; - - switch(obj->item_type) - { - default: - return; - case ITEM_WAND: - case ITEM_STAFF: - chance += 10; - msg = "$p overloads and explodes!"; - break; - case ITEM_JEWELRY: - chance -= 10; - msg = "$p is fused into a worthless lump."; - } - - chance = URANGE(5,chance,95); - - if (number_percent() > chance) - return; - - if (obj->carried_by != NULL) - act(msg,obj->carried_by,obj,NULL,TO_ALL); - else if (obj->in_room != NULL && obj->in_room->people != NULL) - act(msg,obj->in_room->people,obj,NULL,TO_ALL); - - extract_obj(obj); - return; - } -} - diff --git a/archive/src/fight.c b/archive/src/fight.c deleted file mode 100644 index b9acac0..0000000 --- a/archive/src/fight.c +++ /dev/null @@ -1,3095 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#endif -#include -#include -#include -#include "merc.h" -#include "interp.h" - -/* - * Local functions. - */ -void check_assist args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); -bool check_dodge args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); -void check_killer args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); -bool check_parry args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); -bool check_shield_block args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); -void dam_message args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dam, - int dt, bool immune ) ); -void death_cry args( ( CHAR_DATA *ch ) ); -void group_gain args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); -int xp_compute args( ( CHAR_DATA *gch, CHAR_DATA *victim, - int total_levels ) ); -bool is_safe args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); -void make_corpse args( ( CHAR_DATA *ch ) ); -void one_hit args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dt ) ); -void mob_hit args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dt ) ); -void raw_kill args( ( CHAR_DATA *victim ) ); -void set_fighting args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); -void disarm args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); - - - -/* - * Control the fights going on. - * Called periodically by update_handler. - */ -void violence_update( void ) -{ - CHAR_DATA *ch; - CHAR_DATA *ch_next; - CHAR_DATA *victim; - - for ( ch = char_list; ch != NULL; ch = ch->next ) - { - ch_next = ch->next; - - if ( ( victim = ch->fighting ) == NULL || ch->in_room == NULL ) - continue; - - if ( IS_AWAKE(ch) && ch->in_room == victim->in_room ) - multi_hit( ch, victim, TYPE_UNDEFINED ); - else - stop_fighting( ch, FALSE ); - - if ( ( victim = ch->fighting ) == NULL ) - continue; - - /* - * Fun for the whole family! - */ - check_assist(ch,victim); - } - - return; -} - -/* for auto assisting */ -void check_assist(CHAR_DATA *ch,CHAR_DATA *victim) -{ - CHAR_DATA *rch, *rch_next; - - for (rch = ch->in_room->people; rch != NULL; rch = rch_next) - { - rch_next = rch->next_in_room; - - if (IS_AWAKE(rch) && rch->fighting == NULL) - { - - /* quick check for ASSIST_PLAYER */ - if (!IS_NPC(ch) && IS_NPC(rch) - && IS_SET(rch->off_flags,ASSIST_PLAYERS) - && rch->level + 6 > victim->level) - { - do_function(rch, &do_emote, "screams and attacks!"); - multi_hit(rch,victim,TYPE_UNDEFINED); - continue; - } - - /* PCs next */ - if (!IS_NPC(ch) || IS_AFFECTED(ch,AFF_CHARM)) - { - if ( ( (!IS_NPC(rch) && IS_SET(rch->act,PLR_AUTOASSIST)) - || IS_AFFECTED(rch,AFF_CHARM)) - && is_same_group(ch,rch) - && !is_safe(rch, victim)) - multi_hit (rch,victim,TYPE_UNDEFINED); - - continue; - } - - /* now check the NPC cases */ - - if (IS_NPC(ch) && !IS_AFFECTED(ch,AFF_CHARM)) - - { - if ( (IS_NPC(rch) && IS_SET(rch->off_flags,ASSIST_ALL)) - - || (IS_NPC(rch) && rch->group && rch->group == ch->group) - - || (IS_NPC(rch) && rch->race == ch->race - && IS_SET(rch->off_flags,ASSIST_RACE)) - - || (IS_NPC(rch) && IS_SET(rch->off_flags,ASSIST_ALIGN) - && ((IS_GOOD(rch) && IS_GOOD(ch)) - || (IS_EVIL(rch) && IS_EVIL(ch)) - || (IS_NEUTRAL(rch) && IS_NEUTRAL(ch)))) - - || (rch->pIndexData == ch->pIndexData - && IS_SET(rch->off_flags,ASSIST_VNUM))) - - { - CHAR_DATA *vch; - CHAR_DATA *target; - int number; - - if (number_bits(1) == 0) - continue; - - target = NULL; - number = 0; - for (vch = ch->in_room->people; vch; vch = vch->next) - { - if (can_see(rch,vch) - && is_same_group(vch,victim) - && number_range(0,number) == 0) - { - target = vch; - number++; - } - } - - if (target != NULL) - { - do_function(rch, &do_emote, "screams and attacks!"); - multi_hit(rch,target,TYPE_UNDEFINED); - } - } - } - } - } -} - - -/* - * Do one group of attacks. - */ -void multi_hit( CHAR_DATA *ch, CHAR_DATA *victim, int dt ) -{ - int chance; - - /* decrement the wait */ - if (ch->desc == NULL) - ch->wait = UMAX(0,ch->wait - PULSE_VIOLENCE); - - if (ch->desc == NULL) - ch->daze = UMAX(0,ch->daze - PULSE_VIOLENCE); - - - /* no attacks for stunnies -- just a check */ - if (ch->position < POS_RESTING) - return; - - if (IS_NPC(ch)) - { - mob_hit(ch,victim,dt); - return; - } - - one_hit( ch, victim, dt ); - - if (ch->fighting != victim) - return; - - if (IS_AFFECTED(ch,AFF_HASTE)) - one_hit(ch,victim,dt); - - if ( ch->fighting != victim || dt == gsn_backstab ) - return; - - chance = get_skill(ch,gsn_second_attack)/2; - - if (IS_AFFECTED(ch,AFF_SLOW)) - chance /= 2; - - if ( number_percent( ) < chance ) - { - one_hit( ch, victim, dt ); - check_improve(ch,gsn_second_attack,TRUE,5); - if ( ch->fighting != victim ) - return; - } - - chance = get_skill(ch,gsn_third_attack)/4; - - if (IS_AFFECTED(ch,AFF_SLOW)) - chance = 0;; - - if ( number_percent( ) < chance ) - { - one_hit( ch, victim, dt ); - check_improve(ch,gsn_third_attack,TRUE,6); - if ( ch->fighting != victim ) - return; - } - - return; -} - -/* procedure for all mobile attacks */ -void mob_hit (CHAR_DATA *ch, CHAR_DATA *victim, int dt) -{ - int chance,number; - CHAR_DATA *vch, *vch_next; - - one_hit(ch,victim,dt); - - if (ch->fighting != victim) - return; - - /* Area attack -- BALLS nasty! */ - - if (IS_SET(ch->off_flags,OFF_AREA_ATTACK)) - { - for (vch = ch->in_room->people; vch != NULL; vch = vch_next) - { - vch_next = vch->next; - if ((vch != victim && vch->fighting == ch)) - one_hit(ch,vch,dt); - } - } - - if (IS_AFFECTED(ch,AFF_HASTE) - || (IS_SET(ch->off_flags,OFF_FAST) && !IS_AFFECTED(ch,AFF_SLOW))) - one_hit(ch,victim,dt); - - if (ch->fighting != victim || dt == gsn_backstab) - return; - - chance = get_skill(ch,gsn_second_attack)/2; - - if (IS_AFFECTED(ch,AFF_SLOW) && !IS_SET(ch->off_flags,OFF_FAST)) - chance /= 2; - - if (number_percent() < chance) - { - one_hit(ch,victim,dt); - if (ch->fighting != victim) - return; - } - - chance = get_skill(ch,gsn_third_attack)/4; - - if (IS_AFFECTED(ch,AFF_SLOW) && !IS_SET(ch->off_flags,OFF_FAST)) - chance = 0; - - if (number_percent() < chance) - { - one_hit(ch,victim,dt); - if (ch->fighting != victim) - return; - } - - /* oh boy! Fun stuff! */ - - if (ch->wait > 0) - return; - - number = number_range(0,2); - - if (number == 1 && IS_SET(ch->act,ACT_MAGE)) - { - /* { mob_cast_mage(ch,victim); return; } */ ; - } - - if (number == 2 && IS_SET(ch->act,ACT_CLERIC)) - { - /* { mob_cast_cleric(ch,victim); return; } */ ; - } - - /* now for the skills */ - - number = number_range(0,8); - - switch(number) - { - case (0) : - if (IS_SET(ch->off_flags,OFF_BASH)) - do_function(ch, &do_bash, ""); - break; - - case (1) : - if (IS_SET(ch->off_flags,OFF_BERSERK) && !IS_AFFECTED(ch,AFF_BERSERK)) - do_function(ch, &do_berserk, ""); - break; - - - case (2) : - if (IS_SET(ch->off_flags,OFF_DISARM) - || (get_weapon_sn(ch) != gsn_hand_to_hand - && (IS_SET(ch->act,ACT_WARRIOR) - || IS_SET(ch->act,ACT_THIEF)))) - do_function(ch, &do_disarm, ""); - break; - - case (3) : - if (IS_SET(ch->off_flags,OFF_KICK)) - do_function(ch, &do_kick, ""); - break; - - case (4) : - if (IS_SET(ch->off_flags,OFF_KICK_DIRT)) - do_function(ch, &do_dirt, ""); - break; - - case (5) : - if (IS_SET(ch->off_flags,OFF_TAIL)) - { - /* do_function(ch, &do_tail, "") */ ; - } - break; - - case (6) : - if (IS_SET(ch->off_flags,OFF_TRIP)) - do_function(ch, &do_trip, ""); - break; - - case (7) : - if (IS_SET(ch->off_flags,OFF_CRUSH)) - { - /* do_function(ch, &do_crush, "") */ ; - } - break; - case (8) : - if (IS_SET(ch->off_flags,OFF_BACKSTAB)) - { - do_function(ch, &do_backstab, ""); - } - } -} - - -/* - * Hit one guy once. - */ -void one_hit( CHAR_DATA *ch, CHAR_DATA *victim, int dt ) -{ - OBJ_DATA *wield; - int victim_ac; - int thac0; - int thac0_00; - int thac0_32; - int dam; - int diceroll; - int sn,skill; - int dam_type; - bool result; - - sn = -1; - - - /* just in case */ - if (victim == ch || ch == NULL || victim == NULL) - return; - - /* - * Can't beat a dead char! - * Guard against weird room-leavings. - */ - if ( victim->position == POS_DEAD || ch->in_room != victim->in_room ) - return; - - /* - * Figure out the type of damage message. - */ - wield = get_eq_char( ch, WEAR_WIELD ); - - if ( dt == TYPE_UNDEFINED ) - { - dt = TYPE_HIT; - if ( wield != NULL && wield->item_type == ITEM_WEAPON ) - dt += wield->value[3]; - else - dt += ch->dam_type; - } - - if (dt < TYPE_HIT) - if (wield != NULL) - dam_type = attack_table[wield->value[3]].damage; - else - dam_type = attack_table[ch->dam_type].damage; - else - dam_type = attack_table[dt - TYPE_HIT].damage; - - if (dam_type == -1) - dam_type = DAM_BASH; - - /* get the weapon skill */ - sn = get_weapon_sn(ch); - skill = 20 + get_weapon_skill(ch,sn); - - /* - * Calculate to-hit-armor-class-0 versus armor. - */ - if ( IS_NPC(ch) ) - { - thac0_00 = 20; - thac0_32 = -4; /* as good as a thief */ - if (IS_SET(ch->act,ACT_WARRIOR)) - thac0_32 = -10; - else if (IS_SET(ch->act,ACT_THIEF)) - thac0_32 = -4; - else if (IS_SET(ch->act,ACT_CLERIC)) - thac0_32 = 2; - else if (IS_SET(ch->act,ACT_MAGE)) - thac0_32 = 6; - } - else - { - thac0_00 = class_table[ch->class].thac0_00; - thac0_32 = class_table[ch->class].thac0_32; - } - thac0 = interpolate( ch->level, thac0_00, thac0_32 ); - - if (thac0 < 0) - thac0 = thac0/2; - - if (thac0 < -5) - thac0 = -5 + (thac0 + 5) / 2; - - thac0 -= GET_HITROLL(ch) * skill/100; - thac0 += 5 * (100 - skill) / 100; - - if (dt == gsn_backstab) - thac0 -= 10 * (100 - get_skill(ch,gsn_backstab)); - - switch(dam_type) - { - case(DAM_PIERCE):victim_ac = GET_AC(victim,AC_PIERCE)/10; break; - case(DAM_BASH): victim_ac = GET_AC(victim,AC_BASH)/10; break; - case(DAM_SLASH): victim_ac = GET_AC(victim,AC_SLASH)/10; break; - default: victim_ac = GET_AC(victim,AC_EXOTIC)/10; break; - }; - - if (victim_ac < -15) - victim_ac = (victim_ac + 15) / 5 - 15; - - if ( !can_see( ch, victim ) ) - victim_ac -= 4; - - if ( victim->position < POS_FIGHTING) - victim_ac += 4; - - if (victim->position < POS_RESTING) - victim_ac += 6; - - /* - * The moment of excitement! - */ - while ( ( diceroll = number_bits( 5 ) ) >= 20 ) - ; - - if ( diceroll == 0 - || ( diceroll != 19 && diceroll < thac0 - victim_ac ) ) - { - /* Miss. */ - damage( ch, victim, 0, dt, dam_type, TRUE ); - tail_chain( ); - return; - } - - /* - * Hit. - * Calc damage. - */ - if ( IS_NPC(ch) && (!ch->pIndexData->new_format || wield == NULL)) - if (!ch->pIndexData->new_format) - { - dam = number_range( ch->level / 2, ch->level * 3 / 2 ); - if ( wield != NULL ) - dam += dam / 2; - } - else - dam = dice(ch->damage[DICE_NUMBER],ch->damage[DICE_TYPE]); - - else - { - if (sn != -1) - check_improve(ch,sn,TRUE,5); - if ( wield != NULL ) - { - if (wield->pIndexData->new_format) - dam = dice(wield->value[1],wield->value[2]) * skill/100; - else - dam = number_range( wield->value[1] * skill/100, - wield->value[2] * skill/100); - - if (get_eq_char(ch,WEAR_SHIELD) == NULL) /* no shield = more */ - dam = dam * 11/10; - - /* sharpness! */ - if (IS_WEAPON_STAT(wield,WEAPON_SHARP)) - { - int percent; - - if ((percent = number_percent()) <= (skill / 8)) - dam = 2 * dam + (dam * 2 * percent / 100); - } - } - else - dam = number_range( 1 + 4 * skill/100, 2 * ch->level/3 * skill/100); - } - - /* - * Bonuses. - */ - if ( get_skill(ch,gsn_enhanced_damage) > 0 ) - { - diceroll = number_percent(); - if (diceroll <= get_skill(ch,gsn_enhanced_damage)) - { - check_improve(ch,gsn_enhanced_damage,TRUE,6); - dam += 2 * ( dam * diceroll/300); - } - } - - if ( !IS_AWAKE(victim) ) - dam *= 2; - else if (victim->position < POS_FIGHTING) - dam = dam * 3 / 2; - - if ( dt == gsn_backstab && wield != NULL) - { if ( wield->value[0] != 2 ) - dam *= 2 + (ch->level / 10); - else - dam *= 2 + (ch->level / 8); - } - dam += GET_DAMROLL(ch) * UMIN(100,skill) /100; - - if ( dam <= 0 ) - dam = 1; - - result = damage( ch, victim, dam, dt, dam_type, TRUE ); - - /* but do we have a funky weapon? */ - if (result && wield != NULL) - { - int dam; - - if (ch->fighting == victim && IS_WEAPON_STAT(wield,WEAPON_POISON)) - { - int level; - AFFECT_DATA *poison, af; - - if ((poison = affect_find(wield->affected,gsn_poison)) == NULL) - level = wield->level; - else - level = poison->level; - - if (!saves_spell(level / 2,victim,DAM_POISON)) - { - send_to_char("You feel poison coursing through your veins.", - victim); - act("$n is poisoned by the venom on $p.", - victim,wield,NULL,TO_ROOM); - - af.where = TO_AFFECTS; - af.type = gsn_poison; - af.level = level * 3/4; - af.duration = level / 2; - af.location = APPLY_STR; - af.modifier = -1; - af.bitvector = AFF_POISON; - affect_join( victim, &af ); - } - - /* weaken the poison if it's temporary */ - if (poison != NULL) - { - poison->level = UMAX(0,poison->level - 2); - poison->duration = UMAX(0,poison->duration - 1); - - if (poison->level == 0 || poison->duration == 0) - act("The poison on $p has worn off.",ch,wield,NULL,TO_CHAR); - } - } - - - if (ch->fighting == victim && IS_WEAPON_STAT(wield,WEAPON_VAMPIRIC)) - { - dam = number_range(1, wield->level / 5 + 1); - act("$p draws life from $n.",victim,wield,NULL,TO_ROOM); - act("You feel $p drawing your life away.", - victim,wield,NULL,TO_CHAR); - damage(ch,victim,dam,0,DAM_NEGATIVE,FALSE); - ch->alignment = UMAX(-1000,ch->alignment - 1); - ch->hit += dam/2; - } - - if (ch->fighting == victim && IS_WEAPON_STAT(wield,WEAPON_FLAMING)) - { - dam = number_range(1,wield->level / 4 + 1); - act("$n is burned by $p.",victim,wield,NULL,TO_ROOM); - act("$p sears your flesh.",victim,wield,NULL,TO_CHAR); - fire_effect( (void *) victim,wield->level/2,dam,TARGET_CHAR); - damage(ch,victim,dam,0,DAM_FIRE,FALSE); - } - - if (ch->fighting == victim && IS_WEAPON_STAT(wield,WEAPON_FROST)) - { - dam = number_range(1,wield->level / 6 + 2); - act("$p freezes $n.",victim,wield,NULL,TO_ROOM); - act("The cold touch of $p surrounds you with ice.", - victim,wield,NULL,TO_CHAR); - cold_effect(victim,wield->level/2,dam,TARGET_CHAR); - damage(ch,victim,dam,0,DAM_COLD,FALSE); - } - - if (ch->fighting == victim && IS_WEAPON_STAT(wield,WEAPON_SHOCKING)) - { - dam = number_range(1,wield->level/5 + 2); - act("$n is struck by lightning from $p.",victim,wield,NULL,TO_ROOM); - act("You are shocked by $p.",victim,wield,NULL,TO_CHAR); - shock_effect(victim,wield->level/2,dam,TARGET_CHAR); - damage(ch,victim,dam,0,DAM_LIGHTNING,FALSE); - } - } - tail_chain( ); - return; -} - - -/* - * Inflict damage from a hit. - */ -bool damage(CHAR_DATA *ch,CHAR_DATA *victim,int dam,int dt,int dam_type, - bool show) -{ - OBJ_DATA *corpse; - bool immune; - - if ( victim->position == POS_DEAD ) - return FALSE; - - /* - * Stop up any residual loopholes. - */ - if ( dam > 1200 && dt >= TYPE_HIT) - { - bug( "Damage: %d: more than 1200 points!", dam ); - dam = 1200; - if (!IS_IMMORTAL(ch)) - { - OBJ_DATA *obj; - obj = get_eq_char( ch, WEAR_WIELD ); - send_to_char("You really shouldn't cheat.\n\r",ch); - if (obj != NULL) - extract_obj(obj); - } - - } - - - /* damage reduction */ - if ( dam > 35) - dam = (dam - 35)/2 + 35; - if ( dam > 80) - dam = (dam - 80)/2 + 80; - - - - - if ( victim != ch ) - { - /* - * Certain attacks are forbidden. - * Most other attacks are returned. - */ - if ( is_safe( ch, victim ) ) - return FALSE; - check_killer( ch, victim ); - - if ( victim->position > POS_STUNNED ) - { - if ( victim->fighting == NULL ) - set_fighting( victim, ch ); - if (victim->timer <= 4) - victim->position = POS_FIGHTING; - } - - if ( victim->position > POS_STUNNED ) - { - if ( ch->fighting == NULL ) - set_fighting( ch, victim ); - } - - /* - * More charm stuff. - */ - if ( victim->master == ch ) - stop_follower( victim ); - } - - /* - * Inviso attacks ... not. - */ - if ( IS_AFFECTED(ch, AFF_INVISIBLE) ) - { - affect_strip( ch, gsn_invis ); - affect_strip( ch, gsn_mass_invis ); - REMOVE_BIT( ch->affected_by, AFF_INVISIBLE ); - act( "$n fades into existence.", ch, NULL, NULL, TO_ROOM ); - } - - /* - * Damage modifiers. - */ - - if ( dam > 1 && !IS_NPC(victim) - && victim->pcdata->condition[COND_DRUNK] > 10 ) - dam = 9 * dam / 10; - - if ( dam > 1 && IS_AFFECTED(victim, AFF_SANCTUARY) ) - dam /= 2; - - if ( dam > 1 && ((IS_AFFECTED(victim, AFF_PROTECT_EVIL) && IS_EVIL(ch) ) - || (IS_AFFECTED(victim, AFF_PROTECT_GOOD) && IS_GOOD(ch) ))) - dam -= dam / 4; - - immune = FALSE; - - - /* - * Check for parry, and dodge. - */ - if ( dt >= TYPE_HIT && ch != victim) - { - if ( check_parry( ch, victim ) ) - return FALSE; - if ( check_dodge( ch, victim ) ) - return FALSE; - if ( check_shield_block(ch,victim)) - return FALSE; - - } - - switch(check_immune(victim,dam_type)) - { - case(IS_IMMUNE): - immune = TRUE; - dam = 0; - break; - case(IS_RESISTANT): - dam -= dam/3; - break; - case(IS_VULNERABLE): - dam += dam/2; - break; - } - - if (show) - dam_message( ch, victim, dam, dt, immune ); - - if (dam == 0) - return FALSE; - - /* - * Hurt the victim. - * Inform the victim of his new state. - */ - victim->hit -= dam; - if ( !IS_NPC(victim) - && victim->level >= LEVEL_IMMORTAL - && victim->hit < 1 ) - victim->hit = 1; - update_pos( victim ); - - switch( victim->position ) - { - case POS_MORTAL: - act( "$n is mortally wounded, and will die soon, if not aided.", - victim, NULL, NULL, TO_ROOM ); - send_to_char( - "You are mortally wounded, and will die soon, if not aided.\n\r", - victim ); - break; - - case POS_INCAP: - act( "$n is incapacitated and will slowly die, if not aided.", - victim, NULL, NULL, TO_ROOM ); - send_to_char( - "You are incapacitated and will slowly die, if not aided.\n\r", - victim ); - break; - - case POS_STUNNED: - act( "$n is stunned, but will probably recover.", - victim, NULL, NULL, TO_ROOM ); - send_to_char("You are stunned, but will probably recover.\n\r", - victim ); - break; - - case POS_DEAD: - act( "$n is DEAD!!", victim, 0, 0, TO_ROOM ); - send_to_char( "You have been KILLED!!\n\r\n\r", victim ); - break; - - default: - if ( dam > victim->max_hit / 4 ) - send_to_char( "That really did HURT!\n\r", victim ); - if ( victim->hit < victim->max_hit / 4 ) - send_to_char( "You sure are BLEEDING!\n\r", victim ); - break; - } - - /* - * Sleep spells and extremely wounded folks. - */ - if ( !IS_AWAKE(victim) ) - stop_fighting( victim, FALSE ); - - /* - * Payoff for killing things. - */ - if ( victim->position == POS_DEAD ) - { - group_gain( ch, victim ); - - if ( !IS_NPC(victim) ) - { - sprintf( log_buf, "%s killed by %s at %d", - victim->name, - (IS_NPC(ch) ? ch->short_descr : ch->name), - ch->in_room->vnum ); - log_string( log_buf ); - - /* - * Dying penalty: - * 2/3 way back to previous level. - */ - if ( victim->exp > exp_per_level(victim,victim->pcdata->points) - * victim->level ) - gain_exp( victim, (2 * (exp_per_level(victim,victim->pcdata->points) - * victim->level - victim->exp)/3) + 50 ); - } - - sprintf( log_buf, "%s got toasted by %s at %s [room %d]", - (IS_NPC(victim) ? victim->short_descr : victim->name), - (IS_NPC(ch) ? ch->short_descr : ch->name), - ch->in_room->name, ch->in_room->vnum); - - if (IS_NPC(victim)) - wiznet(log_buf,NULL,NULL,WIZ_MOBDEATHS,0,0); - else - wiznet(log_buf,NULL,NULL,WIZ_DEATHS,0,0); - - raw_kill( victim ); - /* dump the flags */ - if (ch != victim && !IS_NPC(ch) && !is_same_clan(ch,victim)) - { - if (IS_SET(victim->act,PLR_KILLER)) - REMOVE_BIT(victim->act,PLR_KILLER); - else - REMOVE_BIT(victim->act,PLR_THIEF); - } - - /* RT new auto commands */ - - if (!IS_NPC(ch) - && (corpse = get_obj_list(ch,"corpse",ch->in_room->contents)) != NULL - && corpse->item_type == ITEM_CORPSE_NPC && can_see_obj(ch,corpse)) - { - OBJ_DATA *coins; - - corpse = get_obj_list( ch, "corpse", ch->in_room->contents ); - - if ( IS_SET(ch->act, PLR_AUTOLOOT) && - corpse && corpse->contains) /* exists and not empty */ - { - do_function(ch, &do_get, "all corpse"); - } - - if (IS_SET(ch->act,PLR_AUTOGOLD) && - corpse && corpse->contains && /* exists and not empty */ - !IS_SET(ch->act,PLR_AUTOLOOT)) - { - if ((coins = get_obj_list(ch,"gcash",corpse->contains)) - != NULL) - { - do_function(ch, &do_get, "all.gcash corpse"); - } - } - - if (IS_SET(ch->act, PLR_AUTOSAC)) - { - if (IS_SET(ch->act,PLR_AUTOLOOT) && corpse && corpse->contains) - { - return TRUE; /* leave if corpse has treasure */ - } - else - { - do_function(ch, &do_sacrifice, "corpse"); - } - } - } - - return TRUE; - } - - if ( victim == ch ) - return TRUE; - - /* - * Take care of link dead people. - */ - if ( !IS_NPC(victim) && victim->desc == NULL ) - { - if ( number_range( 0, victim->wait ) == 0 ) - { - do_function(victim, &do_recall, "" ); - return TRUE; - } - } - - /* - * Wimp out? - */ - if ( IS_NPC(victim) && dam > 0 && victim->wait < PULSE_VIOLENCE / 2) - { - if ( ( IS_SET(victim->act, ACT_WIMPY) && number_bits( 2 ) == 0 - && victim->hit < victim->max_hit / 5) - || ( IS_AFFECTED(victim, AFF_CHARM) && victim->master != NULL - && victim->master->in_room != victim->in_room ) ) - { - do_function(victim, &do_flee, "" ); - } - } - - if ( !IS_NPC(victim) - && victim->hit > 0 - && victim->hit <= victim->wimpy - && victim->wait < PULSE_VIOLENCE / 2 ) - { - do_function (victim, &do_flee, "" ); - } - - tail_chain( ); - return TRUE; -} - -bool is_safe(CHAR_DATA *ch, CHAR_DATA *victim) -{ - if (victim->in_room == NULL || ch->in_room == NULL) - return TRUE; - - if (victim->fighting == ch || victim == ch) - return FALSE; - - if (IS_IMMORTAL(ch) && ch->level > LEVEL_IMMORTAL) - return FALSE; - - /* killing mobiles */ - if (IS_NPC(victim)) - { - - /* safe room? */ - if (IS_SET(victim->in_room->room_flags,ROOM_SAFE)) - { - send_to_char("Not in this room.\n\r",ch); - return TRUE; - } - - if (victim->pIndexData->pShop != NULL) - { - send_to_char("The shopkeeper wouldn't like that.\n\r",ch); - return TRUE; - } - - /* no killing healers, trainers, etc */ - if (IS_SET(victim->act,ACT_TRAIN) - || IS_SET(victim->act,ACT_PRACTICE) - || IS_SET(victim->act,ACT_IS_HEALER) - || IS_SET(victim->act,ACT_IS_CHANGER)) - { - send_to_char("I don't think Mota would approve.\n\r",ch); - return TRUE; - } - - if (!IS_NPC(ch)) - { - /* no pets */ - if (IS_SET(victim->act,ACT_PET)) - { - act("But $N looks so cute and cuddly...", - ch,NULL,victim,TO_CHAR); - return TRUE; - } - - /* no charmed creatures unless owner */ - if (IS_AFFECTED(victim,AFF_CHARM) && ch != victim->master) - { - send_to_char("You don't own that monster.\n\r",ch); - return TRUE; - } - } - } - /* killing players */ - else - { - /* NPC doing the killing */ - if (IS_NPC(ch)) - { - /* safe room check */ - if (IS_SET(victim->in_room->room_flags,ROOM_SAFE)) - { - send_to_char("Not in this room.\n\r",ch); - return TRUE; - } - - /* charmed mobs and pets cannot attack players while owned */ - if (IS_AFFECTED(ch,AFF_CHARM) && ch->master != NULL - && ch->master->fighting != victim) - { - send_to_char("Players are your friends!\n\r",ch); - return TRUE; - } - } - /* player doing the killing */ - else - { - if (!is_clan(ch)) - { - send_to_char("Join a clan if you want to kill players.\n\r",ch); - return TRUE; - } - - if (IS_SET(victim->act,PLR_KILLER) || IS_SET(victim->act,PLR_THIEF)) - return FALSE; - - if (!is_clan(victim)) - { - send_to_char("They aren't in a clan, leave them alone.\n\r",ch); - return TRUE; - } - - if (ch->level > victim->level + 8) - { - send_to_char("Pick on someone your own size.\n\r",ch); - return TRUE; - } - } - } - return FALSE; -} - -bool is_safe_spell(CHAR_DATA *ch, CHAR_DATA *victim, bool area ) -{ - if (victim->in_room == NULL || ch->in_room == NULL) - return TRUE; - - if (victim == ch && area) - return TRUE; - - if (victim->fighting == ch || victim == ch) - return FALSE; - - if (IS_IMMORTAL(ch) && ch->level > LEVEL_IMMORTAL && !area) - return FALSE; - - /* killing mobiles */ - if (IS_NPC(victim)) - { - /* safe room? */ - if (IS_SET(victim->in_room->room_flags,ROOM_SAFE)) - return TRUE; - - if (victim->pIndexData->pShop != NULL) - return TRUE; - - /* no killing healers, trainers, etc */ - if (IS_SET(victim->act,ACT_TRAIN) - || IS_SET(victim->act,ACT_PRACTICE) - || IS_SET(victim->act,ACT_IS_HEALER) - || IS_SET(victim->act,ACT_IS_CHANGER)) - return TRUE; - - if (!IS_NPC(ch)) - { - /* no pets */ - if (IS_SET(victim->act,ACT_PET)) - return TRUE; - - /* no charmed creatures unless owner */ - if (IS_AFFECTED(victim,AFF_CHARM) && (area || ch != victim->master)) - return TRUE; - - /* legal kill? -- cannot hit mob fighting non-group member */ - if (victim->fighting != NULL && !is_same_group(ch,victim->fighting)) - return TRUE; - } - else - { - /* area effect spells do not hit other mobs */ - if (area && !is_same_group(victim,ch->fighting)) - return TRUE; - } - } - /* killing players */ - else - { - if (area && IS_IMMORTAL(victim) && victim->level > LEVEL_IMMORTAL) - return TRUE; - - /* NPC doing the killing */ - if (IS_NPC(ch)) - { - /* charmed mobs and pets cannot attack players while owned */ - if (IS_AFFECTED(ch,AFF_CHARM) && ch->master != NULL - && ch->master->fighting != victim) - return TRUE; - - /* safe room? */ - if (IS_SET(victim->in_room->room_flags,ROOM_SAFE)) - return TRUE; - - /* legal kill? -- mobs only hit players grouped with opponent*/ - if (ch->fighting != NULL && !is_same_group(ch->fighting,victim)) - return TRUE; - } - - /* player doing the killing */ - else - { - if (!is_clan(ch)) - return TRUE; - - if (IS_SET(victim->act,PLR_KILLER) || IS_SET(victim->act,PLR_THIEF)) - return FALSE; - - if (!is_clan(victim)) - return TRUE; - - if (ch->level > victim->level + 8) - return TRUE; - } - - } - return FALSE; -} -/* - * See if an attack justifies a KILLER flag. - */ -void check_killer( CHAR_DATA *ch, CHAR_DATA *victim ) -{ - char buf[MAX_STRING_LENGTH]; - /* - * Follow charm thread to responsible character. - * Attacking someone's charmed char is hostile! - */ - while ( IS_AFFECTED(victim, AFF_CHARM) && victim->master != NULL ) - victim = victim->master; - - /* - * NPC's are fair game. - * So are killers and thieves. - */ - if ( IS_NPC(victim) - || IS_SET(victim->act, PLR_KILLER) - || IS_SET(victim->act, PLR_THIEF)) - return; - - /* - * Charm-o-rama. - */ - if ( IS_SET(ch->affected_by, AFF_CHARM) ) - { - if ( ch->master == NULL ) - { - char buf[MAX_STRING_LENGTH]; - - sprintf( buf, "Check_killer: %s bad AFF_CHARM", - IS_NPC(ch) ? ch->short_descr : ch->name ); - bug( buf, 0 ); - affect_strip( ch, gsn_charm_person ); - REMOVE_BIT( ch->affected_by, AFF_CHARM ); - return; - } -/* - send_to_char( "*** You are now a KILLER!! ***\n\r", ch->master ); - SET_BIT(ch->master->act, PLR_KILLER); -*/ - - stop_follower( ch ); - return; - } - - /* - * NPC's are cool of course (as long as not charmed). - * Hitting yourself is cool too (bleeding). - * So is being immortal (Alander's idea). - * And current killers stay as they are. - */ - if ( IS_NPC(ch) - || ch == victim - || ch->level >= LEVEL_IMMORTAL - || !is_clan(ch) - || IS_SET(ch->act, PLR_KILLER) - || ch->fighting == victim) - return; - - send_to_char( "*** You are now a KILLER!! ***\n\r", ch ); - SET_BIT(ch->act, PLR_KILLER); - sprintf(buf,"$N is attempting to murder %s",victim->name); - wiznet(buf,ch,NULL,WIZ_FLAGS,0,0); - save_char_obj( ch ); - return; -} - - - -/* - * Check for parry. - */ -bool check_parry( CHAR_DATA *ch, CHAR_DATA *victim ) -{ - int chance; - - if ( !IS_AWAKE(victim) ) - return FALSE; - - chance = get_skill(victim,gsn_parry) / 2; - - if ( get_eq_char( victim, WEAR_WIELD ) == NULL ) - { - if (IS_NPC(victim)) - chance /= 2; - else - return FALSE; - } - - if (!can_see(ch,victim)) - chance /= 2; - - if ( number_percent( ) >= chance + victim->level - ch->level ) - return FALSE; - - act( "You parry $n's attack.", ch, NULL, victim, TO_VICT ); - act( "$N parries your attack.", ch, NULL, victim, TO_CHAR ); - check_improve(victim,gsn_parry,TRUE,6); - return TRUE; -} - -/* - * Check for shield block. - */ -bool check_shield_block( CHAR_DATA *ch, CHAR_DATA *victim ) -{ - int chance; - - if ( !IS_AWAKE(victim) ) - return FALSE; - - - chance = get_skill(victim,gsn_shield_block) / 5 + 3; - - - if ( get_eq_char( victim, WEAR_SHIELD ) == NULL ) - return FALSE; - - if ( number_percent( ) >= chance + victim->level - ch->level ) - return FALSE; - - act( "You block $n's attack with your shield.", ch, NULL, victim, -TO_VICT ); - act( "$N blocks your attack with a shield.", ch, NULL, victim, -TO_CHAR ); - check_improve(victim,gsn_shield_block,TRUE,6); - return TRUE; -} - - -/* - * Check for dodge. - */ -bool check_dodge( CHAR_DATA *ch, CHAR_DATA *victim ) -{ - int chance; - - if ( !IS_AWAKE(victim) ) - return FALSE; - - chance = get_skill(victim,gsn_dodge) / 2; - - if (!can_see(victim,ch)) - chance /= 2; - - if ( number_percent( ) >= chance + victim->level - ch->level ) - return FALSE; - - act( "You dodge $n's attack.", ch, NULL, victim, TO_VICT ); - act( "$N dodges your attack.", ch, NULL, victim, TO_CHAR ); - check_improve(victim,gsn_dodge,TRUE,6); - return TRUE; -} - - - -/* - * Set position of a victim. - */ -void update_pos( CHAR_DATA *victim ) -{ - if ( victim->hit > 0 ) - { - if ( victim->position <= POS_STUNNED ) - victim->position = POS_STANDING; - return; - } - - if ( IS_NPC(victim) && victim->hit < 1 ) - { - victim->position = POS_DEAD; - return; - } - - if ( victim->hit <= -11 ) - { - victim->position = POS_DEAD; - return; - } - - if ( victim->hit <= -6 ) victim->position = POS_MORTAL; - else if ( victim->hit <= -3 ) victim->position = POS_INCAP; - else victim->position = POS_STUNNED; - - return; -} - - - -/* - * Start fights. - */ -void set_fighting( CHAR_DATA *ch, CHAR_DATA *victim ) -{ - if ( ch->fighting != NULL ) - { - bug( "Set_fighting: already fighting", 0 ); - return; - } - - if ( IS_AFFECTED(ch, AFF_SLEEP) ) - affect_strip( ch, gsn_sleep ); - - ch->fighting = victim; - ch->position = POS_FIGHTING; - - return; -} - - - -/* - * Stop fights. - */ -void stop_fighting( CHAR_DATA *ch, bool fBoth ) -{ - CHAR_DATA *fch; - - for ( fch = char_list; fch != NULL; fch = fch->next ) - { - if ( fch == ch || ( fBoth && fch->fighting == ch ) ) - { - fch->fighting = NULL; - fch->position = IS_NPC(fch) ? fch->default_pos : POS_STANDING; - update_pos( fch ); - } - } - - return; -} - - - -/* - * Make a corpse out of a character. - */ -void make_corpse( CHAR_DATA *ch ) -{ - char buf[MAX_STRING_LENGTH]; - OBJ_DATA *corpse; - OBJ_DATA *obj; - OBJ_DATA *obj_next; - char *name; - - if ( IS_NPC(ch) ) - { - name = ch->short_descr; - corpse = create_object(get_obj_index(OBJ_VNUM_CORPSE_NPC), 0); - corpse->timer = number_range( 3, 6 ); - if ( ch->gold > 0 ) - { - obj_to_obj( create_money( ch->gold, ch->silver ), corpse ); - ch->gold = 0; - ch->silver = 0; - } - corpse->cost = 0; - } - else - { - name = ch->name; - corpse = create_object(get_obj_index(OBJ_VNUM_CORPSE_PC), 0); - corpse->timer = number_range( 25, 40 ); - REMOVE_BIT(ch->act,PLR_CANLOOT); - if (!is_clan(ch)) - corpse->owner = str_dup(ch->name); - else - { - corpse->owner = NULL; - if (ch->gold > 1 || ch->silver > 1) - { - obj_to_obj(create_money(ch->gold / 2, ch->silver/2), corpse); - ch->gold -= ch->gold/2; - ch->silver -= ch->silver/2; - } - } - - corpse->cost = 0; - } - - corpse->level = ch->level; - - sprintf( buf, corpse->short_descr, name ); - free_string( corpse->short_descr ); - corpse->short_descr = str_dup( buf ); - - sprintf( buf, corpse->description, name ); - free_string( corpse->description ); - corpse->description = str_dup( buf ); - - for ( obj = ch->carrying; obj != NULL; obj = obj_next ) - { - bool floating = FALSE; - - obj_next = obj->next_content; - if (obj->wear_loc == WEAR_FLOAT) - floating = TRUE; - obj_from_char( obj ); - if (obj->item_type == ITEM_POTION) - obj->timer = number_range(500,1000); - if (obj->item_type == ITEM_SCROLL) - obj->timer = number_range(1000,2500); - if (IS_SET(obj->extra_flags,ITEM_ROT_DEATH) && !floating) - { - obj->timer = number_range(5,10); - REMOVE_BIT(obj->extra_flags,ITEM_ROT_DEATH); - } - REMOVE_BIT(obj->extra_flags,ITEM_VIS_DEATH); - - if ( IS_SET( obj->extra_flags, ITEM_INVENTORY ) ) - extract_obj( obj ); - else if (floating) - { - if (IS_OBJ_STAT(obj,ITEM_ROT_DEATH)) /* get rid of it! */ - { - if (obj->contains != NULL) - { - OBJ_DATA *in, *in_next; - - act("$p evaporates,scattering its contents.", - ch,obj,NULL,TO_ROOM); - for (in = obj->contains; in != NULL; in = in_next) - { - in_next = in->next_content; - obj_from_obj(in); - obj_to_room(in,ch->in_room); - } - } - else - act("$p evaporates.", - ch,obj,NULL,TO_ROOM); - extract_obj(obj); - } - else - { - act("$p falls to the floor.",ch,obj,NULL,TO_ROOM); - obj_to_room(obj,ch->in_room); - } - } - else - obj_to_obj( obj, corpse ); - } - - obj_to_room( corpse, ch->in_room ); - return; -} - - - -/* - * Improved Death_cry contributed by Diavolo. - */ -void death_cry( CHAR_DATA *ch ) -{ - ROOM_INDEX_DATA *was_in_room; - char *msg; - int door; - int vnum; - - vnum = 0; - msg = "You hear $n's death cry."; - - switch ( number_bits(4)) - { - case 0: msg = "$n hits the ground ... DEAD."; break; - case 1: - if (ch->material == 0) - { - msg = "$n splatters blood on your armor."; - break; - } - case 2: - if (IS_SET(ch->parts,PART_GUTS)) - { - msg = "$n spills $s guts all over the floor."; - vnum = OBJ_VNUM_GUTS; - } - break; - case 3: - if (IS_SET(ch->parts,PART_HEAD)) - { - msg = "$n's severed head plops on the ground."; - vnum = OBJ_VNUM_SEVERED_HEAD; - } - break; - case 4: - if (IS_SET(ch->parts,PART_HEART)) - { - msg = "$n's heart is torn from $s chest."; - vnum = OBJ_VNUM_TORN_HEART; - } - break; - case 5: - if (IS_SET(ch->parts,PART_ARMS)) - { - msg = "$n's arm is sliced from $s dead body."; - vnum = OBJ_VNUM_SLICED_ARM; - } - break; - case 6: - if (IS_SET(ch->parts,PART_LEGS)) - { - msg = "$n's leg is sliced from $s dead body."; - vnum = OBJ_VNUM_SLICED_LEG; - } - break; - case 7: - if (IS_SET(ch->parts,PART_BRAINS)) - { - msg = "$n's head is shattered, and $s brains splash all over you."; - vnum = OBJ_VNUM_BRAINS; - } - } - - act( msg, ch, NULL, NULL, TO_ROOM ); - - if ( vnum != 0 ) - { - char buf[MAX_STRING_LENGTH]; - OBJ_DATA *obj; - char *name; - - name = IS_NPC(ch) ? ch->short_descr : ch->name; - obj = create_object( get_obj_index( vnum ), 0 ); - obj->timer = number_range( 4, 7 ); - - sprintf( buf, obj->short_descr, name ); - free_string( obj->short_descr ); - obj->short_descr = str_dup( buf ); - - sprintf( buf, obj->description, name ); - free_string( obj->description ); - obj->description = str_dup( buf ); - - if (obj->item_type == ITEM_FOOD) - { - if (IS_SET(ch->form,FORM_POISON)) - obj->value[3] = 1; - else if (!IS_SET(ch->form,FORM_EDIBLE)) - obj->item_type = ITEM_TRASH; - } - - obj_to_room( obj, ch->in_room ); - } - - if ( IS_NPC(ch) ) - msg = "You hear something's death cry."; - else - msg = "You hear someone's death cry."; - - was_in_room = ch->in_room; - for ( door = 0; door <= 5; door++ ) - { - EXIT_DATA *pexit; - - if ( ( pexit = was_in_room->exit[door] ) != NULL - && pexit->u1.to_room != NULL - && pexit->u1.to_room != was_in_room ) - { - ch->in_room = pexit->u1.to_room; - act( msg, ch, NULL, NULL, TO_ROOM ); - } - } - ch->in_room = was_in_room; - - return; -} - - - -void raw_kill( CHAR_DATA *victim ) -{ - int i; - - stop_fighting( victim, TRUE ); - death_cry( victim ); - make_corpse( victim ); - - if ( IS_NPC(victim) ) - { - victim->pIndexData->killed++; - kill_table[URANGE(0, victim->level, MAX_LEVEL-1)].killed++; - extract_char( victim, TRUE ); - return; - } - - extract_char( victim, FALSE ); - while ( victim->affected ) - affect_remove( victim, victim->affected ); - victim->affected_by = race_table[victim->race].aff; - for (i = 0; i < 4; i++) - victim->armor[i]= 100; - victim->position = POS_RESTING; - victim->hit = UMAX( 1, victim->hit ); - victim->mana = UMAX( 1, victim->mana ); - victim->move = UMAX( 1, victim->move ); -/* save_char_obj( victim ); we're stable enough to not need this :) */ - return; -} - - - -void group_gain( CHAR_DATA *ch, CHAR_DATA *victim ) -{ - char buf[MAX_STRING_LENGTH]; - CHAR_DATA *gch; - CHAR_DATA *lch; - int xp; - int members; - int group_levels; - - /* - * Monsters don't get kill xp's or alignment changes. - * P-killing doesn't help either. - * Dying of mortal wounds or poison doesn't give xp to anyone! - */ - if ( victim == ch ) - return; - - members = 0; - group_levels = 0; - for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room ) - { - if ( is_same_group( gch, ch ) ) - { - members++; - group_levels += IS_NPC(gch) ? gch->level / 2 : gch->level; - } - } - - if ( members == 0 ) - { - bug( "Group_gain: members.", members ); - members = 1; - group_levels = ch->level ; - } - - lch = (ch->leader != NULL) ? ch->leader : ch; - - for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room ) - { - OBJ_DATA *obj; - OBJ_DATA *obj_next; - - if ( !is_same_group( gch, ch ) || IS_NPC(gch)) - continue; - -/* Taken out, add it back if you want it - if ( gch->level - lch->level >= 5 ) - { - send_to_char( "You are too high for this group.\n\r", gch ); - continue; - } - - if ( gch->level - lch->level <= -5 ) - { - send_to_char( "You are too low for this group.\n\r", gch ); - continue; - } -*/ - - xp = xp_compute( gch, victim, group_levels ); - sprintf( buf, "You receive %d experience points.\n\r", xp ); - send_to_char( buf, gch ); - gain_exp( gch, xp ); - - for ( obj = ch->carrying; obj != NULL; obj = obj_next ) - { - obj_next = obj->next_content; - if ( obj->wear_loc == WEAR_NONE ) - continue; - - if ( ( IS_OBJ_STAT(obj, ITEM_ANTI_EVIL) && IS_EVIL(ch) ) - || ( IS_OBJ_STAT(obj, ITEM_ANTI_GOOD) && IS_GOOD(ch) ) - || ( IS_OBJ_STAT(obj, ITEM_ANTI_NEUTRAL) && IS_NEUTRAL(ch) ) ) - { - act( "You are zapped by $p.", ch, obj, NULL, TO_CHAR ); - act( "$n is zapped by $p.", ch, obj, NULL, TO_ROOM ); - obj_from_char( obj ); - obj_to_room( obj, ch->in_room ); - } - } - } - - return; -} - - - -/* - * Compute xp for a kill. - * Also adjust alignment of killer. - * Edit this function to change xp computations. - */ -int xp_compute( CHAR_DATA *gch, CHAR_DATA *victim, int total_levels ) -{ - int xp,base_exp; - int align,level_range; - int change; - int time_per_level; - - level_range = victim->level - gch->level; - - /* compute the base exp */ - switch (level_range) - { - default : base_exp = 0; break; - case -9 : base_exp = 1; break; - case -8 : base_exp = 2; break; - case -7 : base_exp = 5; break; - case -6 : base_exp = 9; break; - case -5 : base_exp = 11; break; - case -4 : base_exp = 22; break; - case -3 : base_exp = 33; break; - case -2 : base_exp = 50; break; - case -1 : base_exp = 66; break; - case 0 : base_exp = 83; break; - case 1 : base_exp = 99; break; - case 2 : base_exp = 121; break; - case 3 : base_exp = 143; break; - case 4 : base_exp = 165; break; - } - - if (level_range > 4) - base_exp = 160 + 20 * (level_range - 4); - - /* do alignment computations */ - - align = victim->alignment - gch->alignment; - - if (IS_SET(victim->act,ACT_NOALIGN)) - { - /* no change */ - } - - else if (align > 500) /* monster is more good than slayer */ - { - change = (align - 500) * base_exp / 500 * gch->level/total_levels; - change = UMAX(1,change); - gch->alignment = UMAX(-1000,gch->alignment - change); - } - - else if (align < -500) /* monster is more evil than slayer */ - { - change = ( -1 * align - 500) * base_exp/500 * gch->level/total_levels; - change = UMAX(1,change); - gch->alignment = UMIN(1000,gch->alignment + change); - } - - else /* improve this someday */ - { - change = gch->alignment * base_exp/500 * gch->level/total_levels; - gch->alignment -= change; - } - - /* calculate exp multiplier */ - if (IS_SET(victim->act,ACT_NOALIGN)) - xp = base_exp; - - else if (gch->alignment > 500) /* for goodie two shoes */ - { - if (victim->alignment < -750) - xp = (base_exp *4)/3; - - else if (victim->alignment < -500) - xp = (base_exp * 5)/4; - - else if (victim->alignment > 750) - xp = base_exp / 4; - - else if (victim->alignment > 500) - xp = base_exp / 2; - - else if (victim->alignment > 250) - xp = (base_exp * 3)/4; - - else - xp = base_exp; - } - - else if (gch->alignment < -500) /* for baddies */ - { - if (victim->alignment > 750) - xp = (base_exp * 5)/4; - - else if (victim->alignment > 500) - xp = (base_exp * 11)/10; - - else if (victim->alignment < -750) - xp = base_exp/2; - - else if (victim->alignment < -500) - xp = (base_exp * 3)/4; - - else if (victim->alignment < -250) - xp = (base_exp * 9)/10; - - else - xp = base_exp; - } - - else if (gch->alignment > 200) /* a little good */ - { - - if (victim->alignment < -500) - xp = (base_exp * 6)/5; - - else if (victim->alignment > 750) - xp = base_exp/2; - - else if (victim->alignment > 0) - xp = (base_exp * 3)/4; - - else - xp = base_exp; - } - - else if (gch->alignment < -200) /* a little bad */ - { - if (victim->alignment > 500) - xp = (base_exp * 6)/5; - - else if (victim->alignment < -750) - xp = base_exp/2; - - else if (victim->alignment < 0) - xp = (base_exp * 3)/4; - - else - xp = base_exp; - } - - else /* neutral */ - { - - if (victim->alignment > 500 || victim->alignment < -500) - xp = (base_exp * 4)/3; - - else if (victim->alignment < 200 && victim->alignment > -200) - xp = base_exp/2; - - else - xp = base_exp; - } - - /* more exp at the low levels */ - if (gch->level < 6) - xp = 10 * xp / (gch->level + 4); - - /* less at high */ - if (gch->level > 35 ) - xp = 15 * xp / (gch->level - 25 ); - - /* reduce for playing time */ - - { - /* compute quarter-hours per level */ - time_per_level = 4 * - (gch->played + (int) (current_time - gch->logon))/3600 - / gch->level; - - time_per_level = URANGE(2,time_per_level,12); - if (gch->level < 15) /* make it a curve */ - time_per_level = UMAX(time_per_level,(15 - gch->level)); - xp = xp * time_per_level / 12; - } - - /* randomize the rewards */ - xp = number_range (xp * 3/4, xp * 5/4); - - /* adjust for grouping */ - xp = xp * gch->level/( UMAX(1,total_levels -1) ); - - return xp; -} - - -void dam_message( CHAR_DATA *ch, CHAR_DATA *victim,int dam,int dt,bool immune ) -{ - char buf1[256], buf2[256], buf3[256]; - const char *vs; - const char *vp; - const char *attack; - char punct; - - if (ch == NULL || victim == NULL) - return; - - if ( dam == 0 ) { vs = "miss"; vp = "misses"; } - else if ( dam <= 4 ) { vs = "scratch"; vp = "scratches"; } - else if ( dam <= 8 ) { vs = "graze"; vp = "grazes"; } - else if ( dam <= 12 ) { vs = "hit"; vp = "hits"; } - else if ( dam <= 16 ) { vs = "injure"; vp = "injures"; } - else if ( dam <= 20 ) { vs = "wound"; vp = "wounds"; } - else if ( dam <= 24 ) { vs = "maul"; vp = "mauls"; } - else if ( dam <= 28 ) { vs = "decimate"; vp = "decimates"; } - else if ( dam <= 32 ) { vs = "devastate"; vp = "devastates"; } - else if ( dam <= 36 ) { vs = "maim"; vp = "maims"; } - else if ( dam <= 40 ) { vs = "MUTILATE"; vp = "MUTILATES"; } - else if ( dam <= 44 ) { vs = "DISEMBOWEL"; vp = "DISEMBOWELS"; } - else if ( dam <= 48 ) { vs = "DISMEMBER"; vp = "DISMEMBERS"; } - else if ( dam <= 52 ) { vs = "MASSACRE"; vp = "MASSACRES"; } - else if ( dam <= 56 ) { vs = "MANGLE"; vp = "MANGLES"; } - else if ( dam <= 60 ) { vs = "*** DEMOLISH ***"; - vp = "*** DEMOLISHES ***"; } - else if ( dam <= 75 ) { vs = "*** DEVASTATE ***"; - vp = "*** DEVASTATES ***"; } - else if ( dam <= 100) { vs = "=== OBLITERATE ==="; - vp = "=== OBLITERATES ==="; } - else if ( dam <= 125) { vs = ">>> ANNIHILATE <<<"; - vp = ">>> ANNIHILATES <<<"; } - else if ( dam <= 150) { vs = "<<< ERADICATE >>>"; - vp = "<<< ERADICATES >>>"; } - else { vs = "do UNSPEAKABLE things to"; - vp = "does UNSPEAKABLE things to"; } - - punct = (dam <= 24) ? '.' : '!'; - - if ( dt == TYPE_HIT ) - { - if (ch == victim) - { - sprintf( buf1, "$n %s $melf%c",vp,punct); - sprintf( buf2, "You %s yourself%c",vs,punct); - } - else - { - sprintf( buf1, "$n %s $N%c", vp, punct ); - sprintf( buf2, "You %s $N%c", vs, punct ); - sprintf( buf3, "$n %s you%c", vp, punct ); - } - } - else - { - if ( dt >= 0 && dt < MAX_SKILL ) - attack = skill_table[dt].noun_damage; - else if ( dt >= TYPE_HIT - && dt < TYPE_HIT + MAX_DAMAGE_MESSAGE) - attack = attack_table[dt - TYPE_HIT].noun; - else - { - bug( "Dam_message: bad dt %d.", dt ); - dt = TYPE_HIT; - attack = attack_table[0].name; - } - - if (immune) - { - if (ch == victim) - { - sprintf(buf1,"$n is unaffected by $s own %s.",attack); - sprintf(buf2,"Luckily, you are immune to that."); - } - else - { - sprintf(buf1,"$N is unaffected by $n's %s!",attack); - sprintf(buf2,"$N is unaffected by your %s!",attack); - sprintf(buf3,"$n's %s is powerless against you.",attack); - } - } - else - { - if (ch == victim) - { - sprintf( buf1, "$n's %s %s $m%c",attack,vp,punct); - sprintf( buf2, "Your %s %s you%c",attack,vp,punct); - } - else - { - sprintf( buf1, "$n's %s %s $N%c", attack, vp, punct ); - sprintf( buf2, "Your %s %s $N%c", attack, vp, punct ); - sprintf( buf3, "$n's %s %s you%c", attack, vp, punct ); - } - } - } - - if (ch == victim) - { - act(buf1,ch,NULL,NULL,TO_ROOM); - act(buf2,ch,NULL,NULL,TO_CHAR); - } - else - { - act( buf1, ch, NULL, victim, TO_NOTVICT ); - act( buf2, ch, NULL, victim, TO_CHAR ); - act( buf3, ch, NULL, victim, TO_VICT ); - } - - return; -} - - - -/* - * Disarm a creature. - * Caller must check for successful attack. - */ -void disarm( CHAR_DATA *ch, CHAR_DATA *victim ) -{ - OBJ_DATA *obj; - - if ( ( obj = get_eq_char( victim, WEAR_WIELD ) ) == NULL ) - return; - - if ( IS_OBJ_STAT(obj,ITEM_NOREMOVE)) - { - act("$S weapon won't budge!",ch,NULL,victim,TO_CHAR); - act("$n tries to disarm you, but your weapon won't budge!", - ch,NULL,victim,TO_VICT); - act("$n tries to disarm $N, but fails.",ch,NULL,victim,TO_NOTVICT); - return; - } - - act( "$n DISARMS you and sends your weapon flying!", - ch, NULL, victim, TO_VICT ); - act( "You disarm $N!", ch, NULL, victim, TO_CHAR ); - act( "$n disarms $N!", ch, NULL, victim, TO_NOTVICT ); - - obj_from_char( obj ); - if ( IS_OBJ_STAT(obj,ITEM_NODROP) || IS_OBJ_STAT(obj,ITEM_INVENTORY) ) - obj_to_char( obj, victim ); - else - { - obj_to_room( obj, victim->in_room ); - if (IS_NPC(victim) && victim->wait == 0 && can_see_obj(victim,obj)) - get_obj(victim,obj,NULL); - } - - return; -} - -void do_berserk( CHAR_DATA *ch, char *argument) -{ - int chance, hp_percent; - - if ((chance = get_skill(ch,gsn_berserk)) == 0 - || (IS_NPC(ch) && !IS_SET(ch->off_flags,OFF_BERSERK)) - || (!IS_NPC(ch) - && ch->level < skill_table[gsn_berserk].skill_level[ch->class])) - { - send_to_char("You turn red in the face, but nothing happens.\n\r",ch); - return; - } - - if (IS_AFFECTED(ch,AFF_BERSERK) || is_affected(ch,gsn_berserk) - || is_affected(ch,skill_lookup("frenzy"))) - { - send_to_char("You get a little madder.\n\r",ch); - return; - } - - if (IS_AFFECTED(ch,AFF_CALM)) - { - send_to_char("You're feeling to mellow to berserk.\n\r",ch); - return; - } - - if (ch->mana < 50) - { - send_to_char("You can't get up enough energy.\n\r",ch); - return; - } - - /* modifiers */ - - /* fighting */ - if (ch->position == POS_FIGHTING) - chance += 10; - - /* damage -- below 50% of hp helps, above hurts */ - hp_percent = 100 * ch->hit/ch->max_hit; - chance += 25 - hp_percent/2; - - if (number_percent() < chance) - { - AFFECT_DATA af; - - WAIT_STATE(ch,PULSE_VIOLENCE); - ch->mana -= 50; - ch->move /= 2; - - /* heal a little damage */ - ch->hit += ch->level * 2; - ch->hit = UMIN(ch->hit,ch->max_hit); - - send_to_char("Your pulse races as you are consumed by rage!\n\r",ch); - act("$n gets a wild look in $s eyes.",ch,NULL,NULL,TO_ROOM); - check_improve(ch,gsn_berserk,TRUE,2); - - af.where = TO_AFFECTS; - af.type = gsn_berserk; - af.level = ch->level; - af.duration = number_fuzzy(ch->level / 8); - af.modifier = UMAX(1,ch->level/5); - af.bitvector = AFF_BERSERK; - - af.location = APPLY_HITROLL; - affect_to_char(ch,&af); - - af.location = APPLY_DAMROLL; - affect_to_char(ch,&af); - - af.modifier = UMAX(10,10 * (ch->level/5)); - af.location = APPLY_AC; - affect_to_char(ch,&af); - } - - else - { - WAIT_STATE(ch,3 * PULSE_VIOLENCE); - ch->mana -= 25; - ch->move /= 2; - - send_to_char("Your pulse speeds up, but nothing happens.\n\r",ch); - check_improve(ch,gsn_berserk,FALSE,2); - } -} - -void do_bash( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - int chance; - - one_argument(argument,arg); - - if ( (chance = get_skill(ch,gsn_bash)) == 0 - || (IS_NPC(ch) && !IS_SET(ch->off_flags,OFF_BASH)) - || (!IS_NPC(ch) - && ch->level < skill_table[gsn_bash].skill_level[ch->class])) - { - send_to_char("Bashing? What's that?\n\r",ch); - return; - } - - if (arg[0] == '\0') - { - victim = ch->fighting; - if (victim == NULL) - { - send_to_char("But you aren't fighting anyone!\n\r",ch); - return; - } - } - - else if ((victim = get_char_room(ch,arg)) == NULL) - { - send_to_char("They aren't here.\n\r",ch); - return; - } - - if (victim->position < POS_FIGHTING) - { - act("You'll have to let $M get back up first.",ch,NULL,victim,TO_CHAR); - return; - } - - if (victim == ch) - { - send_to_char("You try to bash your brains out, but fail.\n\r",ch); - return; - } - - if (is_safe(ch,victim)) - return; - - if ( IS_NPC(victim) && - victim->fighting != NULL && - !is_same_group(ch,victim->fighting)) - { - send_to_char("Kill stealing is not permitted.\n\r",ch); - return; - } - - if (IS_AFFECTED(ch,AFF_CHARM) && ch->master == victim) - { - act("But $N is your friend!",ch,NULL,victim,TO_CHAR); - return; - } - - /* modifiers */ - - /* size and weight */ - chance += ch->carry_weight / 250; - chance -= victim->carry_weight / 200; - - if (ch->size < victim->size) - chance += (ch->size - victim->size) * 15; - else - chance += (ch->size - victim->size) * 10; - - - /* stats */ - chance += get_curr_stat(ch,STAT_STR); - chance -= (get_curr_stat(victim,STAT_DEX) * 4)/3; - chance -= GET_AC(victim,AC_BASH) /25; - /* speed */ - if (IS_SET(ch->off_flags,OFF_FAST) || IS_AFFECTED(ch,AFF_HASTE)) - chance += 10; - if (IS_SET(victim->off_flags,OFF_FAST) || IS_AFFECTED(victim,AFF_HASTE)) - chance -= 30; - - /* level */ - chance += (ch->level - victim->level); - - if (!IS_NPC(victim) - && chance < get_skill(victim,gsn_dodge) ) - { /* - act("$n tries to bash you, but you dodge it.",ch,NULL,victim,TO_VICT); - act("$N dodges your bash, you fall flat on your face.",ch,NULL,victim,TO_CHAR); - WAIT_STATE(ch,skill_table[gsn_bash].beats); - return;*/ - chance -= 3 * (get_skill(victim,gsn_dodge) - chance); - } - - /* now the attack */ - if (number_percent() < chance ) - { - - act("$n sends you sprawling with a powerful bash!", - ch,NULL,victim,TO_VICT); - act("You slam into $N, and send $M flying!",ch,NULL,victim,TO_CHAR); - act("$n sends $N sprawling with a powerful bash.", - ch,NULL,victim,TO_NOTVICT); - check_improve(ch,gsn_bash,TRUE,1); - - DAZE_STATE(victim, 3 * PULSE_VIOLENCE); - WAIT_STATE(ch,skill_table[gsn_bash].beats); - victim->position = POS_RESTING; - damage(ch,victim,number_range(2,2 + 2 * ch->size + chance/20),gsn_bash, - DAM_BASH,FALSE); - - } - else - { - damage(ch,victim,0,gsn_bash,DAM_BASH,FALSE); - act("You fall flat on your face!", - ch,NULL,victim,TO_CHAR); - act("$n falls flat on $s face.", - ch,NULL,victim,TO_NOTVICT); - act("You evade $n's bash, causing $m to fall flat on $s face.", - ch,NULL,victim,TO_VICT); - check_improve(ch,gsn_bash,FALSE,1); - ch->position = POS_RESTING; - WAIT_STATE(ch,skill_table[gsn_bash].beats * 3/2); - } - check_killer(ch,victim); -} - -void do_dirt( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - int chance; - - one_argument(argument,arg); - - if ( (chance = get_skill(ch,gsn_dirt)) == 0 - || (IS_NPC(ch) && !IS_SET(ch->off_flags,OFF_KICK_DIRT)) - || (!IS_NPC(ch) - && ch->level < skill_table[gsn_dirt].skill_level[ch->class])) - { - send_to_char("You get your feet dirty.\n\r",ch); - return; - } - - if (arg[0] == '\0') - { - victim = ch->fighting; - if (victim == NULL) - { - send_to_char("But you aren't in combat!\n\r",ch); - return; - } - } - - else if ((victim = get_char_room(ch,arg)) == NULL) - { - send_to_char("They aren't here.\n\r",ch); - return; - } - - if (IS_AFFECTED(victim,AFF_BLIND)) - { - act("$E's already been blinded.",ch,NULL,victim,TO_CHAR); - return; - } - - if (victim == ch) - { - send_to_char("Very funny.\n\r",ch); - return; - } - - if (is_safe(ch,victim)) - return; - - if (IS_NPC(victim) && - victim->fighting != NULL && - !is_same_group(ch,victim->fighting)) - { - send_to_char("Kill stealing is not permitted.\n\r",ch); - return; - } - - if (IS_AFFECTED(ch,AFF_CHARM) && ch->master == victim) - { - act("But $N is such a good friend!",ch,NULL,victim,TO_CHAR); - return; - } - - /* modifiers */ - - /* dexterity */ - chance += get_curr_stat(ch,STAT_DEX); - chance -= 2 * get_curr_stat(victim,STAT_DEX); - - /* speed */ - if (IS_SET(ch->off_flags,OFF_FAST) || IS_AFFECTED(ch,AFF_HASTE)) - chance += 10; - if (IS_SET(victim->off_flags,OFF_FAST) || IS_AFFECTED(victim,AFF_HASTE)) - chance -= 25; - - /* level */ - chance += (ch->level - victim->level) * 2; - - /* sloppy hack to prevent false zeroes */ - if (chance % 5 == 0) - chance += 1; - - /* terrain */ - - switch(ch->in_room->sector_type) - { - case(SECT_INSIDE): chance -= 20; break; - case(SECT_CITY): chance -= 10; break; - case(SECT_FIELD): chance += 5; break; - case(SECT_FOREST): break; - case(SECT_HILLS): break; - case(SECT_MOUNTAIN): chance -= 10; break; - case(SECT_WATER_SWIM): chance = 0; break; - case(SECT_WATER_NOSWIM): chance = 0; break; - case(SECT_AIR): chance = 0; break; - case(SECT_DESERT): chance += 10; break; - } - - if (chance == 0) - { - send_to_char("There isn't any dirt to kick.\n\r",ch); - return; - } - - /* now the attack */ - if (number_percent() < chance) - { - AFFECT_DATA af; - act("$n is blinded by the dirt in $s eyes!",victim,NULL,NULL,TO_ROOM); - act("$n kicks dirt in your eyes!",ch,NULL,victim,TO_VICT); - damage(ch,victim,number_range(2,5),gsn_dirt,DAM_NONE,FALSE); - send_to_char("You can't see a thing!\n\r",victim); - check_improve(ch,gsn_dirt,TRUE,2); - WAIT_STATE(ch,skill_table[gsn_dirt].beats); - - af.where = TO_AFFECTS; - af.type = gsn_dirt; - af.level = ch->level; - af.duration = 0; - af.location = APPLY_HITROLL; - af.modifier = -4; - af.bitvector = AFF_BLIND; - - affect_to_char(victim,&af); - } - else - { - damage(ch,victim,0,gsn_dirt,DAM_NONE,TRUE); - check_improve(ch,gsn_dirt,FALSE,2); - WAIT_STATE(ch,skill_table[gsn_dirt].beats); - } - check_killer(ch,victim); -} - -void do_trip( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - int chance; - - one_argument(argument,arg); - - if ( (chance = get_skill(ch,gsn_trip)) == 0 - || (IS_NPC(ch) && !IS_SET(ch->off_flags,OFF_TRIP)) - || (!IS_NPC(ch) - && ch->level < skill_table[gsn_trip].skill_level[ch->class])) - { - send_to_char("Tripping? What's that?\n\r",ch); - return; - } - - - if (arg[0] == '\0') - { - victim = ch->fighting; - if (victim == NULL) - { - send_to_char("But you aren't fighting anyone!\n\r",ch); - return; - } - } - - else if ((victim = get_char_room(ch,arg)) == NULL) - { - send_to_char("They aren't here.\n\r",ch); - return; - } - - if (is_safe(ch,victim)) - return; - - if (IS_NPC(victim) && - victim->fighting != NULL && - !is_same_group(ch,victim->fighting)) - { - send_to_char("Kill stealing is not permitted.\n\r",ch); - return; - } - - if (IS_AFFECTED(victim,AFF_FLYING)) - { - act("$S feet aren't on the ground.",ch,NULL,victim,TO_CHAR); - return; - } - - if (victim->position < POS_FIGHTING) - { - act("$N is already down.",ch,NULL,victim,TO_CHAR); - return; - } - - if (victim == ch) - { - send_to_char("You fall flat on your face!\n\r",ch); - WAIT_STATE(ch,2 * skill_table[gsn_trip].beats); - act("$n trips over $s own feet!",ch,NULL,NULL,TO_ROOM); - return; - } - - if (IS_AFFECTED(ch,AFF_CHARM) && ch->master == victim) - { - act("$N is your beloved master.",ch,NULL,victim,TO_CHAR); - return; - } - - /* modifiers */ - - /* size */ - if (ch->size < victim->size) - chance += (ch->size - victim->size) * 10; /* bigger = harder to trip */ - - /* dex */ - chance += get_curr_stat(ch,STAT_DEX); - chance -= get_curr_stat(victim,STAT_DEX) * 3 / 2; - - /* speed */ - if (IS_SET(ch->off_flags,OFF_FAST) || IS_AFFECTED(ch,AFF_HASTE)) - chance += 10; - if (IS_SET(victim->off_flags,OFF_FAST) || IS_AFFECTED(victim,AFF_HASTE)) - chance -= 20; - - /* level */ - chance += (ch->level - victim->level) * 2; - - - /* now the attack */ - if (number_percent() < chance) - { - act("$n trips you and you go down!",ch,NULL,victim,TO_VICT); - act("You trip $N and $N goes down!",ch,NULL,victim,TO_CHAR); - act("$n trips $N, sending $M to the ground.",ch,NULL,victim,TO_NOTVICT); - check_improve(ch,gsn_trip,TRUE,1); - - DAZE_STATE(victim,2 * PULSE_VIOLENCE); - WAIT_STATE(ch,skill_table[gsn_trip].beats); - victim->position = POS_RESTING; - damage(ch,victim,number_range(2, 2 + 2 * victim->size),gsn_trip, - DAM_BASH,TRUE); - } - else - { - damage(ch,victim,0,gsn_trip,DAM_BASH,TRUE); - WAIT_STATE(ch,skill_table[gsn_trip].beats*2/3); - check_improve(ch,gsn_trip,FALSE,1); - } - check_killer(ch,victim); -} - - - -void do_kill( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Kill whom?\n\r", ch ); - return; - } - - if ( ( victim = get_char_room( ch, arg ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } -/* Allow player killing - if ( !IS_NPC(victim) ) - { - if ( !IS_SET(victim->act, PLR_KILLER) - && !IS_SET(victim->act, PLR_THIEF) ) - { - send_to_char( "You must MURDER a player.\n\r", ch ); - return; - } - } -*/ - if ( victim == ch ) - { - send_to_char( "You hit yourself. Ouch!\n\r", ch ); - multi_hit( ch, ch, TYPE_UNDEFINED ); - return; - } - - if ( is_safe( ch, victim ) ) - return; - - if ( victim->fighting != NULL && - !is_same_group(ch,victim->fighting)) - { - send_to_char("Kill stealing is not permitted.\n\r",ch); - return; - } - - if ( IS_AFFECTED(ch, AFF_CHARM) && ch->master == victim ) - { - act( "$N is your beloved master.", ch, NULL, victim, TO_CHAR ); - return; - } - - if ( ch->position == POS_FIGHTING ) - { - send_to_char( "You do the best you can!\n\r", ch ); - return; - } - - WAIT_STATE( ch, 1 * PULSE_VIOLENCE ); - check_killer( ch, victim ); - multi_hit( ch, victim, TYPE_UNDEFINED ); - return; -} - - - -void do_murde( CHAR_DATA *ch, char *argument ) -{ - send_to_char( "If you want to MURDER, spell it out.\n\r", ch ); - return; -} - - - -void do_murder( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - - one_argument( argument, arg ); - - if ( arg[0] == '\0' ) - { - send_to_char( "Murder whom?\n\r", ch ); - return; - } - - if (IS_AFFECTED(ch,AFF_CHARM) || (IS_NPC(ch) && IS_SET(ch->act,ACT_PET))) - return; - - if ( ( victim = get_char_room( ch, arg ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - - if ( victim == ch ) - { - send_to_char( "Suicide is a mortal sin.\n\r", ch ); - return; - } - - if ( is_safe( ch, victim ) ) - return; - - if (IS_NPC(victim) && - victim->fighting != NULL && - !is_same_group(ch,victim->fighting)) - { - send_to_char("Kill stealing is not permitted.\n\r",ch); - return; - } - - if ( IS_AFFECTED(ch, AFF_CHARM) && ch->master == victim ) - { - act( "$N is your beloved master.", ch, NULL, victim, TO_CHAR ); - return; - } - - if ( ch->position == POS_FIGHTING ) - { - send_to_char( "You do the best you can!\n\r", ch ); - return; - } - - WAIT_STATE( ch, 1 * PULSE_VIOLENCE ); - if (IS_NPC(ch)) - sprintf(buf, "Help! I am being attacked by %s!",ch->short_descr); - else - sprintf( buf, "Help! I am being attacked by %s!", ch->name ); - do_function(victim, &do_yell, buf ); - check_killer( ch, victim ); - multi_hit( ch, victim, TYPE_UNDEFINED ); - return; -} - - - -void do_backstab( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - OBJ_DATA *obj; - - one_argument( argument, arg ); - - if (arg[0] == '\0') - { - send_to_char("Backstab whom?\n\r",ch); - return; - } - - if (ch->fighting != NULL) - { - send_to_char("You're facing the wrong end.\n\r",ch); - return; - } - - else if ((victim = get_char_room(ch,arg)) == NULL) - { - send_to_char("They aren't here.\n\r",ch); - return; - } - - if ( victim == ch ) - { - send_to_char( "How can you sneak up on yourself?\n\r", ch ); - return; - } - - if ( is_safe( ch, victim ) ) - return; - - if (IS_NPC(victim) && - victim->fighting != NULL && - !is_same_group(ch,victim->fighting)) - { - send_to_char("Kill stealing is not permitted.\n\r",ch); - return; - } - - if ( ( obj = get_eq_char( ch, WEAR_WIELD ) ) == NULL) - { - send_to_char( "You need to wield a weapon to backstab.\n\r", ch ); - return; - } - - if ( victim->hit < victim->max_hit / 3) - { - act( "$N is hurt and suspicious ... you can't sneak up.", - ch, NULL, victim, TO_CHAR ); - return; - } - - check_killer( ch, victim ); - WAIT_STATE( ch, skill_table[gsn_backstab].beats ); - if ( number_percent( ) < get_skill(ch,gsn_backstab) - || ( get_skill(ch,gsn_backstab) >= 2 && !IS_AWAKE(victim) ) ) - { - check_improve(ch,gsn_backstab,TRUE,1); - multi_hit( ch, victim, gsn_backstab ); - } - else - { - check_improve(ch,gsn_backstab,FALSE,1); - damage( ch, victim, 0, gsn_backstab,DAM_NONE,TRUE); - } - - return; -} - - - -void do_flee( CHAR_DATA *ch, char *argument ) -{ - ROOM_INDEX_DATA *was_in; - ROOM_INDEX_DATA *now_in; - CHAR_DATA *victim; - int attempt; - - if ( ( victim = ch->fighting ) == NULL ) - { - if ( ch->position == POS_FIGHTING ) - ch->position = POS_STANDING; - send_to_char( "You aren't fighting anyone.\n\r", ch ); - return; - } - - was_in = ch->in_room; - for ( attempt = 0; attempt < 6; attempt++ ) - { - EXIT_DATA *pexit; - int door; - - door = number_door( ); - if ( ( pexit = was_in->exit[door] ) == 0 - || pexit->u1.to_room == NULL - || IS_SET(pexit->exit_info, EX_CLOSED) - || number_range(0,ch->daze) != 0 - || ( IS_NPC(ch) - && IS_SET(pexit->u1.to_room->room_flags, ROOM_NO_MOB) ) ) - continue; - - move_char( ch, door, FALSE ); - if ( ( now_in = ch->in_room ) == was_in ) - continue; - - ch->in_room = was_in; - act( "$n has fled!", ch, NULL, NULL, TO_ROOM ); - ch->in_room = now_in; - - if ( !IS_NPC(ch) ) - { - send_to_char( "You flee from combat!\n\r", ch ); - if( (ch->class == 2) - && (number_percent() < 3*(ch->level/2) ) ) - send_to_char( "You snuck away safely.\n\r", ch); - else - { - send_to_char( "You lost 10 exp.\n\r", ch); - gain_exp( ch, -10 ); - } - } - - stop_fighting( ch, TRUE ); - return; - } - - send_to_char( "PANIC! You couldn't escape!\n\r", ch ); - return; -} - - - -void do_rescue( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - CHAR_DATA *fch; - - one_argument( argument, arg ); - if ( arg[0] == '\0' ) - { - send_to_char( "Rescue whom?\n\r", ch ); - return; - } - - if ( ( victim = get_char_room( ch, arg ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - - if ( victim == ch ) - { - send_to_char( "What about fleeing instead?\n\r", ch ); - return; - } - - if ( !IS_NPC(ch) && IS_NPC(victim) ) - { - send_to_char( "Doesn't need your help!\n\r", ch ); - return; - } - - if ( ch->fighting == victim ) - { - send_to_char( "Too late.\n\r", ch ); - return; - } - - if ( ( fch = victim->fighting ) == NULL ) - { - send_to_char( "That person is not fighting right now.\n\r", ch ); - return; - } - - if ( IS_NPC(fch) && !is_same_group(ch,victim)) - { - send_to_char("Kill stealing is not permitted.\n\r",ch); - return; - } - - WAIT_STATE( ch, skill_table[gsn_rescue].beats ); - if ( number_percent( ) > get_skill(ch,gsn_rescue)) - { - send_to_char( "You fail the rescue.\n\r", ch ); - check_improve(ch,gsn_rescue,FALSE,1); - return; - } - - act( "You rescue $N!", ch, NULL, victim, TO_CHAR ); - act( "$n rescues you!", ch, NULL, victim, TO_VICT ); - act( "$n rescues $N!", ch, NULL, victim, TO_NOTVICT ); - check_improve(ch,gsn_rescue,TRUE,1); - - stop_fighting( fch, FALSE ); - stop_fighting( victim, FALSE ); - - check_killer( ch, fch ); - set_fighting( ch, fch ); - set_fighting( fch, ch ); - return; -} - - - -void do_kick( CHAR_DATA *ch, char *argument ) -{ - CHAR_DATA *victim; - - if ( !IS_NPC(ch) - && ch->level < skill_table[gsn_kick].skill_level[ch->class] ) - { - send_to_char( - "You better leave the martial arts to fighters.\n\r", ch ); - return; - } - - if (IS_NPC(ch) && !IS_SET(ch->off_flags,OFF_KICK)) - return; - - if ( ( victim = ch->fighting ) == NULL ) - { - send_to_char( "You aren't fighting anyone.\n\r", ch ); - return; - } - - WAIT_STATE( ch, skill_table[gsn_kick].beats ); - if ( get_skill(ch,gsn_kick) > number_percent()) - { - damage(ch,victim,number_range( 1, ch->level ), gsn_kick,DAM_BASH,TRUE); - check_improve(ch,gsn_kick,TRUE,1); - } - else - { - damage( ch, victim, 0, gsn_kick,DAM_BASH,TRUE); - check_improve(ch,gsn_kick,FALSE,1); - } - check_killer(ch,victim); - return; -} - - - - -void do_disarm( CHAR_DATA *ch, char *argument ) -{ - CHAR_DATA *victim; - OBJ_DATA *obj; - int chance,hth,ch_weapon,vict_weapon,ch_vict_weapon; - - hth = 0; - - if ((chance = get_skill(ch,gsn_disarm)) == 0) - { - send_to_char( "You don't know how to disarm opponents.\n\r", ch ); - return; - } - - if ( get_eq_char( ch, WEAR_WIELD ) == NULL - && ((hth = get_skill(ch,gsn_hand_to_hand)) == 0 - || (IS_NPC(ch) && !IS_SET(ch->off_flags,OFF_DISARM)))) - { - send_to_char( "You must wield a weapon to disarm.\n\r", ch ); - return; - } - - if ( ( victim = ch->fighting ) == NULL ) - { - send_to_char( "You aren't fighting anyone.\n\r", ch ); - return; - } - - if ( ( obj = get_eq_char( victim, WEAR_WIELD ) ) == NULL ) - { - send_to_char( "Your opponent is not wielding a weapon.\n\r", ch ); - return; - } - - /* find weapon skills */ - ch_weapon = get_weapon_skill(ch,get_weapon_sn(ch)); - vict_weapon = get_weapon_skill(victim,get_weapon_sn(victim)); - ch_vict_weapon = get_weapon_skill(ch,get_weapon_sn(victim)); - - /* modifiers */ - - /* skill */ - if ( get_eq_char(ch,WEAR_WIELD) == NULL) - chance = chance * hth/150; - else - chance = chance * ch_weapon/100; - - chance += (ch_vict_weapon/2 - vict_weapon) / 2; - - /* dex vs. strength */ - chance += get_curr_stat(ch,STAT_DEX); - chance -= 2 * get_curr_stat(victim,STAT_STR); - - /* level */ - chance += (ch->level - victim->level) * 2; - - /* and now the attack */ - if (number_percent() < chance) - { - WAIT_STATE( ch, skill_table[gsn_disarm].beats ); - disarm( ch, victim ); - check_improve(ch,gsn_disarm,TRUE,1); - } - else - { - WAIT_STATE(ch,skill_table[gsn_disarm].beats); - act("You fail to disarm $N.",ch,NULL,victim,TO_CHAR); - act("$n tries to disarm you, but fails.",ch,NULL,victim,TO_VICT); - act("$n tries to disarm $N, but fails.",ch,NULL,victim,TO_NOTVICT); - check_improve(ch,gsn_disarm,FALSE,1); - } - check_killer(ch,victim); - return; -} - - - -void do_sla( CHAR_DATA *ch, char *argument ) -{ - send_to_char( "If you want to SLAY, spell it out.\n\r", ch ); - return; -} - - - -void do_slay( CHAR_DATA *ch, char *argument ) -{ - CHAR_DATA *victim; - char arg[MAX_INPUT_LENGTH]; - - one_argument( argument, arg ); - if ( arg[0] == '\0' ) - { - send_to_char( "Slay whom?\n\r", ch ); - return; - } - - if ( ( victim = get_char_room( ch, arg ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - - if ( ch == victim ) - { - send_to_char( "Suicide is a mortal sin.\n\r", ch ); - return; - } - - if ( !IS_NPC(victim) && victim->level >= get_trust(ch) ) - { - send_to_char( "You failed.\n\r", ch ); - return; - } - - act( "You slay $M in cold blood!", ch, NULL, victim, TO_CHAR ); - act( "$n slays you in cold blood!", ch, NULL, victim, TO_VICT ); - act( "$n slays $N in cold blood!", ch, NULL, victim, TO_NOTVICT ); - raw_kill( victim ); - return; -} diff --git a/archive/src/flags.c b/archive/src/flags.c deleted file mode 100644 index 068000d..0000000 --- a/archive/src/flags.c +++ /dev/null @@ -1,249 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#include -#else -#include -#include -#endif -#include -#include -#include -#include "merc.h" -#include "tables.h" - -int flag_lookup args( ( const char *name, const struct flag_type *flag_table) ); - -void do_flag(CHAR_DATA *ch, char *argument) -{ - char arg1[MAX_INPUT_LENGTH],arg2[MAX_INPUT_LENGTH],arg3[MAX_INPUT_LENGTH]; - char word[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - long *flag, old = 0, new = 0, marked = 0, pos; - char type; - const struct flag_type *flag_table; - - argument = one_argument(argument,arg1); - argument = one_argument(argument,arg2); - argument = one_argument(argument,arg3); - - type = argument[0]; - - if (type == '=' || type == '-' || type == '+') - argument = one_argument(argument,word); - - if (arg1[0] == '\0') - { - send_to_char("Syntax:\n\r",ch); - send_to_char(" flag mob \n\r",ch); - send_to_char(" flag char \n\r",ch); - send_to_char(" mob flags: act,aff,off,imm,res,vuln,form,part\n\r",ch); - send_to_char(" char flags: plr,comm,aff,imm,res,vuln,\n\r",ch); - send_to_char(" +: add flag, -: remove flag, = set equal to\n\r",ch); - send_to_char(" otherwise flag toggles the flags listed.\n\r",ch); - return; - } - - if (arg2[0] == '\0') - { - send_to_char("What do you wish to set flags on?\n\r",ch); - return; - } - - if (arg3[0] == '\0') - { - send_to_char("You need to specify a flag to set.\n\r",ch); - return; - } - - if (argument[0] == '\0') - { - send_to_char("Which flags do you wish to change?\n\r",ch); - return; - } - - if (!str_prefix(arg1,"mob") || !str_prefix(arg1,"char")) - { - victim = get_char_world(ch,arg2); - if (victim == NULL) - { - send_to_char("You can't find them.\n\r",ch); - return; - } - - /* select a flag to set */ - if (!str_prefix(arg3,"act")) - { - if (!IS_NPC(victim)) - { - send_to_char("Use plr for PCs.\n\r",ch); - return; - } - - flag = &victim->act; - flag_table = act_flags; - } - - else if (!str_prefix(arg3,"plr")) - { - if (IS_NPC(victim)) - { - send_to_char("Use act for NPCs.\n\r",ch); - return; - } - - flag = &victim->act; - flag_table = plr_flags; - } - - else if (!str_prefix(arg3,"aff")) - { - flag = &victim->affected_by; - flag_table = affect_flags; - } - - else if (!str_prefix(arg3,"immunity")) - { - flag = &victim->imm_flags; - flag_table = imm_flags; - } - - else if (!str_prefix(arg3,"resist")) - { - flag = &victim->res_flags; - flag_table = imm_flags; - } - - else if (!str_prefix(arg3,"vuln")) - { - flag = &victim->vuln_flags; - flag_table = imm_flags; - } - - else if (!str_prefix(arg3,"form")) - { - if (!IS_NPC(victim)) - { - send_to_char("Form can't be set on PCs.\n\r",ch); - return; - } - - flag = &victim->form; - flag_table = form_flags; - } - - else if (!str_prefix(arg3,"parts")) - { - if (!IS_NPC(victim)) - { - send_to_char("Parts can't be set on PCs.\n\r",ch); - return; - } - - flag = &victim->parts; - flag_table = part_flags; - } - - else if (!str_prefix(arg3,"comm")) - { - if (IS_NPC(victim)) - { - send_to_char("Comm can't be set on NPCs.\n\r",ch); - return; - } - - flag = &victim->comm; - flag_table = comm_flags; - } - - else - { - send_to_char("That's not an acceptable flag.\n\r",ch); - return; - } - - old = *flag; - victim->zone = NULL; - - if (type != '=') - new = old; - - /* mark the words */ - for (; ;) - { - argument = one_argument(argument,word); - - if (word[0] == '\0') - break; - - pos = flag_lookup(word,flag_table); - if (pos == 0) - { - send_to_char("That flag doesn't exist!\n\r",ch); - return; - } - else - SET_BIT(marked,pos); - } - - for (pos = 0; flag_table[pos].name != NULL; pos++) - { - if (!flag_table[pos].settable && IS_SET(old,flag_table[pos].bit)) - { - SET_BIT(new,flag_table[pos].bit); - continue; - } - - if (IS_SET(marked,flag_table[pos].bit)) - { - switch(type) - { - case '=': - case '+': - SET_BIT(new,flag_table[pos].bit); - break; - case '-': - REMOVE_BIT(new,flag_table[pos].bit); - break; - default: - if (IS_SET(new,flag_table[pos].bit)) - REMOVE_BIT(new,flag_table[pos].bit); - else - SET_BIT(new,flag_table[pos].bit); - } - } - } - *flag = new; - return; - } -} - - - - diff --git a/archive/src/handler.c b/archive/src/handler.c deleted file mode 100644 index cdc7b18..0000000 --- a/archive/src/handler.c +++ /dev/null @@ -1,2912 +0,0 @@ -/**************************************************************************r - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#endif -#include -#include -#include -#include -#include "merc.h" -#include "interp.h" -#include "magic.h" -#include "recycle.h" -#include "tables.h" - -/* - * Local functions. - */ -void affect_modify args( ( CHAR_DATA *ch, AFFECT_DATA *paf, bool fAdd ) ); - - -/* friend stuff -- for NPC's mostly */ -bool is_friend(CHAR_DATA *ch,CHAR_DATA *victim) -{ - if (is_same_group(ch,victim)) - return TRUE; - - - if (!IS_NPC(ch)) - return FALSE; - - if (!IS_NPC(victim)) - { - if (IS_SET(ch->off_flags,ASSIST_PLAYERS)) - return TRUE; - else - return FALSE; - } - - if (IS_AFFECTED(ch,AFF_CHARM)) - return FALSE; - - if (IS_SET(ch->off_flags,ASSIST_ALL)) - return TRUE; - - if (ch->group && ch->group == victim->group) - return TRUE; - - if (IS_SET(ch->off_flags,ASSIST_VNUM) - && ch->pIndexData == victim->pIndexData) - return TRUE; - - if (IS_SET(ch->off_flags,ASSIST_RACE) && ch->race == victim->race) - return TRUE; - - if (IS_SET(ch->off_flags,ASSIST_ALIGN) - && !IS_SET(ch->act,ACT_NOALIGN) && !IS_SET(victim->act,ACT_NOALIGN) - && ((IS_GOOD(ch) && IS_GOOD(victim)) - || (IS_EVIL(ch) && IS_EVIL(victim)) - || (IS_NEUTRAL(ch) && IS_NEUTRAL(victim)))) - return TRUE; - - return FALSE; -} - -/* returns number of people on an object */ -int count_users(OBJ_DATA *obj) -{ - CHAR_DATA *fch; - int count = 0; - - if (obj->in_room == NULL) - return 0; - - for (fch = obj->in_room->people; fch != NULL; fch = fch->next_in_room) - if (fch->on == obj) - count++; - - return count; -} - -/* returns material number */ -int material_lookup (const char *name) -{ - return 0; -} - -/* returns race number */ -int race_lookup (const char *name) -{ - int race; - - for ( race = 0; race_table[race].name != NULL; race++) - { - if (LOWER(name[0]) == LOWER(race_table[race].name[0]) - && !str_prefix( name,race_table[race].name)) - return race; - } - - return 0; -} - -int liq_lookup (const char *name) -{ - int liq; - - for ( liq = 0; liq_table[liq].liq_name != NULL; liq++) - { - if (LOWER(name[0]) == LOWER(liq_table[liq].liq_name[0]) - && !str_prefix(name,liq_table[liq].liq_name)) - return liq; - } - - return -1; -} - -int weapon_lookup (const char *name) -{ - int type; - - for (type = 0; weapon_table[type].name != NULL; type++) - { - if (LOWER(name[0]) == LOWER(weapon_table[type].name[0]) - && !str_prefix(name,weapon_table[type].name)) - return type; - } - - return -1; -} - -int weapon_type (const char *name) -{ - int type; - - for (type = 0; weapon_table[type].name != NULL; type++) - { - if (LOWER(name[0]) == LOWER(weapon_table[type].name[0]) - && !str_prefix(name,weapon_table[type].name)) - return weapon_table[type].type; - } - - return WEAPON_EXOTIC; -} - - -int item_lookup(const char *name) -{ - int type; - - for (type = 0; item_table[type].name != NULL; type++) - { - if (LOWER(name[0]) == LOWER(item_table[type].name[0]) - && !str_prefix(name,item_table[type].name)) - return item_table[type].type; - } - - return -1; -} - -char *item_name(int item_type) -{ - int type; - - for (type = 0; item_table[type].name != NULL; type++) - if (item_type == item_table[type].type) - return item_table[type].name; - return "none"; -} - -char *weapon_name( int weapon_type) -{ - int type; - - for (type = 0; weapon_table[type].name != NULL; type++) - if (weapon_type == weapon_table[type].type) - return weapon_table[type].name; - return "exotic"; -} - -int attack_lookup (const char *name) -{ - int att; - - for ( att = 0; attack_table[att].name != NULL; att++) - { - if (LOWER(name[0]) == LOWER(attack_table[att].name[0]) - && !str_prefix(name,attack_table[att].name)) - return att; - } - - return 0; -} - -/* returns a flag for wiznet */ -long wiznet_lookup (const char *name) -{ - int flag; - - for (flag = 0; wiznet_table[flag].name != NULL; flag++) - { - if (LOWER(name[0]) == LOWER(wiznet_table[flag].name[0]) - && !str_prefix(name,wiznet_table[flag].name)) - return flag; - } - - return -1; -} - -/* returns class number */ -int class_lookup (const char *name) -{ - int class; - - for ( class = 0; class < MAX_CLASS; class++) - { - if (LOWER(name[0]) == LOWER(class_table[class].name[0]) - && !str_prefix( name,class_table[class].name)) - return class; - } - - return -1; -} - -/* for immunity, vulnerabiltiy, and resistant - the 'globals' (magic and weapons) may be overriden - three other cases -- wood, silver, and iron -- are checked in fight.c */ - -int check_immune(CHAR_DATA *ch, int dam_type) -{ - int immune, def; - int bit; - - immune = -1; - def = IS_NORMAL; - - if (dam_type == DAM_NONE) - return immune; - - if (dam_type <= 3) - { - if (IS_SET(ch->imm_flags,IMM_WEAPON)) - def = IS_IMMUNE; - else if (IS_SET(ch->res_flags,RES_WEAPON)) - def = IS_RESISTANT; - else if (IS_SET(ch->vuln_flags,VULN_WEAPON)) - def = IS_VULNERABLE; - } - else /* magical attack */ - { - if (IS_SET(ch->imm_flags,IMM_MAGIC)) - def = IS_IMMUNE; - else if (IS_SET(ch->res_flags,RES_MAGIC)) - def = IS_RESISTANT; - else if (IS_SET(ch->vuln_flags,VULN_MAGIC)) - def = IS_VULNERABLE; - } - - /* set bits to check -- VULN etc. must ALL be the same or this will fail */ - switch (dam_type) - { - case(DAM_BASH): bit = IMM_BASH; break; - case(DAM_PIERCE): bit = IMM_PIERCE; break; - case(DAM_SLASH): bit = IMM_SLASH; break; - case(DAM_FIRE): bit = IMM_FIRE; break; - case(DAM_COLD): bit = IMM_COLD; break; - case(DAM_LIGHTNING): bit = IMM_LIGHTNING; break; - case(DAM_ACID): bit = IMM_ACID; break; - case(DAM_POISON): bit = IMM_POISON; break; - case(DAM_NEGATIVE): bit = IMM_NEGATIVE; break; - case(DAM_HOLY): bit = IMM_HOLY; break; - case(DAM_ENERGY): bit = IMM_ENERGY; break; - case(DAM_MENTAL): bit = IMM_MENTAL; break; - case(DAM_DISEASE): bit = IMM_DISEASE; break; - case(DAM_DROWNING): bit = IMM_DROWNING; break; - case(DAM_LIGHT): bit = IMM_LIGHT; break; - case(DAM_CHARM): bit = IMM_CHARM; break; - case(DAM_SOUND): bit = IMM_SOUND; break; - default: return def; - } - - if (IS_SET(ch->imm_flags,bit)) - immune = IS_IMMUNE; - else if (IS_SET(ch->res_flags,bit) && immune != IS_IMMUNE) - immune = IS_RESISTANT; - else if (IS_SET(ch->vuln_flags,bit)) - { - if (immune == IS_IMMUNE) - immune = IS_RESISTANT; - else if (immune == IS_RESISTANT) - immune = IS_NORMAL; - else - immune = IS_VULNERABLE; - } - - if (immune == -1) - return def; - else - return immune; -} - -bool is_clan(CHAR_DATA *ch) -{ - return ch->clan; -} - -bool is_same_clan(CHAR_DATA *ch, CHAR_DATA *victim) -{ - if (clan_table[ch->clan].independent) - return FALSE; - else - return (ch->clan == victim->clan); -} - -/* checks mob format */ -bool is_old_mob(CHAR_DATA *ch) -{ - if (ch->pIndexData == NULL) - return FALSE; - else if (ch->pIndexData->new_format) - return FALSE; - return TRUE; -} - -/* for returning skill information */ -int get_skill(CHAR_DATA *ch, int sn) -{ - int skill; - - if (sn == -1) /* shorthand for level based skills */ - { - skill = ch->level * 5 / 2; - } - - else if (sn < -1 || sn > MAX_SKILL) - { - bug("Bad sn %d in get_skill.",sn); - skill = 0; - } - - else if (!IS_NPC(ch)) - { - if (ch->level < skill_table[sn].skill_level[ch->class]) - skill = 0; - else - skill = ch->pcdata->learned[sn]; - } - - else /* mobiles */ - { - - - if (skill_table[sn].spell_fun != spell_null) - skill = 40 + 2 * ch->level; - - else if (sn == gsn_sneak || sn == gsn_hide) - skill = ch->level * 2 + 20; - - else if ((sn == gsn_dodge && IS_SET(ch->off_flags,OFF_DODGE)) - || (sn == gsn_parry && IS_SET(ch->off_flags,OFF_PARRY))) - skill = ch->level * 2; - - else if (sn == gsn_shield_block) - skill = 10 + 2 * ch->level; - - else if (sn == gsn_second_attack - && (IS_SET(ch->act,ACT_WARRIOR) || IS_SET(ch->act,ACT_THIEF))) - skill = 10 + 3 * ch->level; - - else if (sn == gsn_third_attack && IS_SET(ch->act,ACT_WARRIOR)) - skill = 4 * ch->level - 40; - - else if (sn == gsn_hand_to_hand) - skill = 40 + 2 * ch->level; - - else if (sn == gsn_trip && IS_SET(ch->off_flags,OFF_TRIP)) - skill = 10 + 3 * ch->level; - - else if (sn == gsn_bash && IS_SET(ch->off_flags,OFF_BASH)) - skill = 10 + 3 * ch->level; - - else if (sn == gsn_disarm - && (IS_SET(ch->off_flags,OFF_DISARM) - || IS_SET(ch->act,ACT_WARRIOR) - || IS_SET(ch->act,ACT_THIEF))) - skill = 20 + 3 * ch->level; - - else if (sn == gsn_berserk && IS_SET(ch->off_flags,OFF_BERSERK)) - skill = 3 * ch->level; - - else if (sn == gsn_kick) - skill = 10 + 3 * ch->level; - - else if (sn == gsn_backstab && IS_SET(ch->act,ACT_THIEF)) - skill = 20 + 2 * ch->level; - - else if (sn == gsn_rescue) - skill = 40 + ch->level; - - else if (sn == gsn_recall) - skill = 40 + ch->level; - - else if (sn == gsn_sword - || sn == gsn_dagger - || sn == gsn_spear - || sn == gsn_mace - || sn == gsn_axe - || sn == gsn_flail - || sn == gsn_whip - || sn == gsn_polearm) - skill = 40 + 5 * ch->level / 2; - - else - skill = 0; - } - - if (ch->daze > 0) - { - if (skill_table[sn].spell_fun != spell_null) - skill /= 2; - else - skill = 2 * skill / 3; - } - - if ( !IS_NPC(ch) && ch->pcdata->condition[COND_DRUNK] > 10 ) - skill = 9 * skill / 10; - - return URANGE(0,skill,100); -} - -/* for returning weapon information */ -int get_weapon_sn(CHAR_DATA *ch) -{ - OBJ_DATA *wield; - int sn; - - wield = get_eq_char( ch, WEAR_WIELD ); - if (wield == NULL || wield->item_type != ITEM_WEAPON) - sn = gsn_hand_to_hand; - else switch (wield->value[0]) - { - default : sn = -1; break; - case(WEAPON_SWORD): sn = gsn_sword; break; - case(WEAPON_DAGGER): sn = gsn_dagger; break; - case(WEAPON_SPEAR): sn = gsn_spear; break; - case(WEAPON_MACE): sn = gsn_mace; break; - case(WEAPON_AXE): sn = gsn_axe; break; - case(WEAPON_FLAIL): sn = gsn_flail; break; - case(WEAPON_WHIP): sn = gsn_whip; break; - case(WEAPON_POLEARM): sn = gsn_polearm; break; - } - return sn; -} - -int get_weapon_skill(CHAR_DATA *ch, int sn) -{ - int skill; - - /* -1 is exotic */ - if (IS_NPC(ch)) - { - if (sn == -1) - skill = 3 * ch->level; - else if (sn == gsn_hand_to_hand) - skill = 40 + 2 * ch->level; - else - skill = 40 + 5 * ch->level / 2; - } - - else - { - if (sn == -1) - skill = 3 * ch->level; - else - skill = ch->pcdata->learned[sn]; - } - - return URANGE(0,skill,100); -} - - -/* used to de-screw characters */ -void reset_char(CHAR_DATA *ch) -{ - int loc,mod,stat; - OBJ_DATA *obj; - AFFECT_DATA *af; - int i; - - if (IS_NPC(ch)) - return; - - if (ch->pcdata->perm_hit == 0 - || ch->pcdata->perm_mana == 0 - || ch->pcdata->perm_move == 0 - || ch->pcdata->last_level == 0) - { - /* do a FULL reset */ - for (loc = 0; loc < MAX_WEAR; loc++) - { - obj = get_eq_char(ch,loc); - if (obj == NULL) - continue; - if (!obj->enchanted) - for ( af = obj->pIndexData->affected; af != NULL; af = af->next ) - { - mod = af->modifier; - switch(af->location) - { - case APPLY_SEX: ch->sex -= mod; - if (ch->sex < 0 || ch->sex >2) - ch->sex = IS_NPC(ch) ? - 0 : - ch->pcdata->true_sex; - break; - case APPLY_MANA: ch->max_mana -= mod; break; - case APPLY_HIT: ch->max_hit -= mod; break; - case APPLY_MOVE: ch->max_move -= mod; break; - } - } - - for ( af = obj->affected; af != NULL; af = af->next ) - { - mod = af->modifier; - switch(af->location) - { - case APPLY_SEX: ch->sex -= mod; break; - case APPLY_MANA: ch->max_mana -= mod; break; - case APPLY_HIT: ch->max_hit -= mod; break; - case APPLY_MOVE: ch->max_move -= mod; break; - } - } - } - /* now reset the permanent stats */ - ch->pcdata->perm_hit = ch->max_hit; - ch->pcdata->perm_mana = ch->max_mana; - ch->pcdata->perm_move = ch->max_move; - ch->pcdata->last_level = ch->played/3600; - if (ch->pcdata->true_sex < 0 || ch->pcdata->true_sex > 2) - { if (ch->sex > 0 && ch->sex < 3) - ch->pcdata->true_sex = ch->sex; - else - ch->pcdata->true_sex = 0; - } - - } - - /* now restore the character to his/her true condition */ - for (stat = 0; stat < MAX_STATS; stat++) - ch->mod_stat[stat] = 0; - - if (ch->pcdata->true_sex < 0 || ch->pcdata->true_sex > 2) - ch->pcdata->true_sex = 0; - ch->sex = ch->pcdata->true_sex; - ch->max_hit = ch->pcdata->perm_hit; - ch->max_mana = ch->pcdata->perm_mana; - ch->max_move = ch->pcdata->perm_move; - - for (i = 0; i < 4; i++) - ch->armor[i] = 100; - - ch->hitroll = 0; - ch->damroll = 0; - ch->saving_throw = 0; - - /* now start adding back the effects */ - for (loc = 0; loc < MAX_WEAR; loc++) - { - obj = get_eq_char(ch,loc); - if (obj == NULL) - continue; - for (i = 0; i < 4; i++) - ch->armor[i] -= apply_ac( obj, loc, i ); - - if (!obj->enchanted) - for ( af = obj->pIndexData->affected; af != NULL; af = af->next ) - { - mod = af->modifier; - switch(af->location) - { - case APPLY_STR: ch->mod_stat[STAT_STR] += mod; break; - case APPLY_DEX: ch->mod_stat[STAT_DEX] += mod; break; - case APPLY_INT: ch->mod_stat[STAT_INT] += mod; break; - case APPLY_WIS: ch->mod_stat[STAT_WIS] += mod; break; - case APPLY_CON: ch->mod_stat[STAT_CON] += mod; break; - - case APPLY_SEX: ch->sex += mod; break; - case APPLY_MANA: ch->max_mana += mod; break; - case APPLY_HIT: ch->max_hit += mod; break; - case APPLY_MOVE: ch->max_move += mod; break; - - case APPLY_AC: - for (i = 0; i < 4; i ++) - ch->armor[i] += mod; - break; - case APPLY_HITROLL: ch->hitroll += mod; break; - case APPLY_DAMROLL: ch->damroll += mod; break; - - case APPLY_SAVES: ch->saving_throw += mod; break; - case APPLY_SAVING_ROD: ch->saving_throw += mod; break; - case APPLY_SAVING_PETRI: ch->saving_throw += mod; break; - case APPLY_SAVING_BREATH: ch->saving_throw += mod; break; - case APPLY_SAVING_SPELL: ch->saving_throw += mod; break; - } - } - - for ( af = obj->affected; af != NULL; af = af->next ) - { - mod = af->modifier; - switch(af->location) - { - case APPLY_STR: ch->mod_stat[STAT_STR] += mod; break; - case APPLY_DEX: ch->mod_stat[STAT_DEX] += mod; break; - case APPLY_INT: ch->mod_stat[STAT_INT] += mod; break; - case APPLY_WIS: ch->mod_stat[STAT_WIS] += mod; break; - case APPLY_CON: ch->mod_stat[STAT_CON] += mod; break; - - case APPLY_SEX: ch->sex += mod; break; - case APPLY_MANA: ch->max_mana += mod; break; - case APPLY_HIT: ch->max_hit += mod; break; - case APPLY_MOVE: ch->max_move += mod; break; - - case APPLY_AC: - for (i = 0; i < 4; i ++) - ch->armor[i] += mod; - break; - case APPLY_HITROLL: ch->hitroll += mod; break; - case APPLY_DAMROLL: ch->damroll += mod; break; - - case APPLY_SAVES: ch->saving_throw += mod; break; - case APPLY_SAVING_ROD: ch->saving_throw += mod; break; - case APPLY_SAVING_PETRI: ch->saving_throw += mod; break; - case APPLY_SAVING_BREATH: ch->saving_throw += mod; break; - case APPLY_SAVING_SPELL: ch->saving_throw += mod; break; - } - } - } - - /* now add back spell effects */ - for (af = ch->affected; af != NULL; af = af->next) - { - mod = af->modifier; - switch(af->location) - { - case APPLY_STR: ch->mod_stat[STAT_STR] += mod; break; - case APPLY_DEX: ch->mod_stat[STAT_DEX] += mod; break; - case APPLY_INT: ch->mod_stat[STAT_INT] += mod; break; - case APPLY_WIS: ch->mod_stat[STAT_WIS] += mod; break; - case APPLY_CON: ch->mod_stat[STAT_CON] += mod; break; - - case APPLY_SEX: ch->sex += mod; break; - case APPLY_MANA: ch->max_mana += mod; break; - case APPLY_HIT: ch->max_hit += mod; break; - case APPLY_MOVE: ch->max_move += mod; break; - - case APPLY_AC: - for (i = 0; i < 4; i ++) - ch->armor[i] += mod; - break; - case APPLY_HITROLL: ch->hitroll += mod; break; - case APPLY_DAMROLL: ch->damroll += mod; break; - - case APPLY_SAVES: ch->saving_throw += mod; break; - case APPLY_SAVING_ROD: ch->saving_throw += mod; break; - case APPLY_SAVING_PETRI: ch->saving_throw += mod; break; - case APPLY_SAVING_BREATH: ch->saving_throw += mod; break; - case APPLY_SAVING_SPELL: ch->saving_throw += mod; break; - } - } - - /* make sure sex is RIGHT!!!! */ - if (ch->sex < 0 || ch->sex > 2) - ch->sex = ch->pcdata->true_sex; -} - - -/* - * Retrieve a character's trusted level for permission checking. - */ -int get_trust( CHAR_DATA *ch ) -{ - if ( ch->desc != NULL && ch->desc->original != NULL ) - ch = ch->desc->original; - - if (ch->trust) - return ch->trust; - - if ( IS_NPC(ch) && ch->level >= LEVEL_HERO ) - return LEVEL_HERO - 1; - else - return ch->level; -} - - -/* - * Retrieve a character's age. - */ -int get_age( CHAR_DATA *ch ) -{ - return 17 + ( ch->played + (int) (current_time - ch->logon) ) / 72000; -} - -/* command for retrieving stats */ -int get_curr_stat( CHAR_DATA *ch, int stat ) -{ - int max; - - if (IS_NPC(ch) || ch->level > LEVEL_IMMORTAL) - max = 25; - - else - { - max = pc_race_table[ch->race].max_stats[stat] + 4; - - if (class_table[ch->class].attr_prime == stat) - max += 2; - - if ( ch->race == race_lookup("human")) - max += 1; - - max = UMIN(max,25); - } - - return URANGE(3,ch->perm_stat[stat] + ch->mod_stat[stat], max); -} - -/* command for returning max training score */ -int get_max_train( CHAR_DATA *ch, int stat ) -{ - int max; - - if (IS_NPC(ch) || ch->level > LEVEL_IMMORTAL) - return 25; - - max = pc_race_table[ch->race].max_stats[stat]; - if (class_table[ch->class].attr_prime == stat) - { if (ch->race == race_lookup("human")) - max += 3; - else - max += 2; - } - - return UMIN(max,25); -} - - -/* - * Retrieve a character's carry capacity. - */ -int can_carry_n( CHAR_DATA *ch ) -{ - if ( !IS_NPC(ch) && ch->level >= LEVEL_IMMORTAL ) - return 1000; - - if ( IS_NPC(ch) && IS_SET(ch->act, ACT_PET) ) - return 0; - - return MAX_WEAR + 2 * get_curr_stat(ch,STAT_DEX) + ch->level; -} - - - -/* - * Retrieve a character's carry capacity. - */ -int can_carry_w( CHAR_DATA *ch ) -{ - if ( !IS_NPC(ch) && ch->level >= LEVEL_IMMORTAL ) - return 10000000; - - if ( IS_NPC(ch) && IS_SET(ch->act, ACT_PET) ) - return 0; - - return str_app[get_curr_stat(ch,STAT_STR)].carry * 10 + ch->level * 25; -} - - - -/* - * See if a string is one of the names of an object. - */ - -bool is_name ( char *str, char *namelist ) -{ - char name[MAX_INPUT_LENGTH], part[MAX_INPUT_LENGTH]; - char *list, *string; - - /* fix crash on NULL namelist */ - if (namelist == NULL || namelist[0] == '\0') - return FALSE; - - /* fixed to prevent is_name on "" returning TRUE */ - if (str[0] == '\0') - return FALSE; - - string = str; - /* we need ALL parts of string to match part of namelist */ - for ( ; ; ) /* start parsing string */ - { - str = one_argument(str,part); - - if (part[0] == '\0' ) - return TRUE; - - /* check to see if this is part of namelist */ - list = namelist; - for ( ; ; ) /* start parsing namelist */ - { - list = one_argument(list,name); - if (name[0] == '\0') /* this name was not found */ - return FALSE; - - if (!str_prefix(string,name)) - return TRUE; /* full pattern match */ - - if (!str_prefix(part,name)) - break; - } - } -} - -bool is_exact_name(char *str, char *namelist ) -{ - char name[MAX_INPUT_LENGTH]; - - if (namelist == NULL) - return FALSE; - - for ( ; ; ) - { - namelist = one_argument( namelist, name ); - if ( name[0] == '\0' ) - return FALSE; - if ( !str_cmp( str, name ) ) - return TRUE; - } -} - -/* enchanted stuff for eq */ -void affect_enchant(OBJ_DATA *obj) -{ - /* okay, move all the old flags into new vectors if we have to */ - if (!obj->enchanted) - { - AFFECT_DATA *paf, *af_new; - obj->enchanted = TRUE; - - for (paf = obj->pIndexData->affected; - paf != NULL; paf = paf->next) - { - af_new = new_affect(); - - af_new->next = obj->affected; - obj->affected = af_new; - - af_new->where = paf->where; - af_new->type = UMAX(0,paf->type); - af_new->level = paf->level; - af_new->duration = paf->duration; - af_new->location = paf->location; - af_new->modifier = paf->modifier; - af_new->bitvector = paf->bitvector; - } - } -} - - -/* - * Apply or remove an affect to a character. - */ -void affect_modify( CHAR_DATA *ch, AFFECT_DATA *paf, bool fAdd ) -{ - OBJ_DATA *wield; - int mod,i; - - mod = paf->modifier; - - if ( fAdd ) - { - switch (paf->where) - { - case TO_AFFECTS: - SET_BIT(ch->affected_by, paf->bitvector); - break; - case TO_IMMUNE: - SET_BIT(ch->imm_flags,paf->bitvector); - break; - case TO_RESIST: - SET_BIT(ch->res_flags,paf->bitvector); - break; - case TO_VULN: - SET_BIT(ch->vuln_flags,paf->bitvector); - break; - } - } - else - { - switch (paf->where) - { - case TO_AFFECTS: - REMOVE_BIT(ch->affected_by, paf->bitvector); - break; - case TO_IMMUNE: - REMOVE_BIT(ch->imm_flags,paf->bitvector); - break; - case TO_RESIST: - REMOVE_BIT(ch->res_flags,paf->bitvector); - break; - case TO_VULN: - REMOVE_BIT(ch->vuln_flags,paf->bitvector); - break; - } - mod = 0 - mod; - } - - switch ( paf->location ) - { - default: - bug( "Affect_modify: unknown location %d.", paf->location ); - return; - - case APPLY_NONE: break; - case APPLY_STR: ch->mod_stat[STAT_STR] += mod; break; - case APPLY_DEX: ch->mod_stat[STAT_DEX] += mod; break; - case APPLY_INT: ch->mod_stat[STAT_INT] += mod; break; - case APPLY_WIS: ch->mod_stat[STAT_WIS] += mod; break; - case APPLY_CON: ch->mod_stat[STAT_CON] += mod; break; - case APPLY_SEX: ch->sex += mod; break; - case APPLY_CLASS: break; - case APPLY_LEVEL: break; - case APPLY_AGE: break; - case APPLY_HEIGHT: break; - case APPLY_WEIGHT: break; - case APPLY_MANA: ch->max_mana += mod; break; - case APPLY_HIT: ch->max_hit += mod; break; - case APPLY_MOVE: ch->max_move += mod; break; - case APPLY_GOLD: break; - case APPLY_EXP: break; - case APPLY_AC: - for (i = 0; i < 4; i ++) - ch->armor[i] += mod; - break; - case APPLY_HITROLL: ch->hitroll += mod; break; - case APPLY_DAMROLL: ch->damroll += mod; break; - case APPLY_SAVES: ch->saving_throw += mod; break; - case APPLY_SAVING_ROD: ch->saving_throw += mod; break; - case APPLY_SAVING_PETRI: ch->saving_throw += mod; break; - case APPLY_SAVING_BREATH: ch->saving_throw += mod; break; - case APPLY_SAVING_SPELL: ch->saving_throw += mod; break; - case APPLY_SPELL_AFFECT: break; - } - - /* - * Check for weapon wielding. - * Guard against recursion (for weapons with affects). - */ - if ( !IS_NPC(ch) && ( wield = get_eq_char( ch, WEAR_WIELD ) ) != NULL - && get_obj_weight(wield) > (str_app[get_curr_stat(ch,STAT_STR)].wield*10)) - { - static int depth; - - if ( depth == 0 ) - { - depth++; - act( "You drop $p.", ch, wield, NULL, TO_CHAR ); - act( "$n drops $p.", ch, wield, NULL, TO_ROOM ); - obj_from_char( wield ); - obj_to_room( wield, ch->in_room ); - depth--; - } - } - - return; -} - - -/* find an effect in an affect list */ -AFFECT_DATA *affect_find(AFFECT_DATA *paf, int sn) -{ - AFFECT_DATA *paf_find; - - for ( paf_find = paf; paf_find != NULL; paf_find = paf_find->next ) - { - if ( paf_find->type == sn ) - return paf_find; - } - - return NULL; -} - -/* fix object affects when removing one */ -void affect_check(CHAR_DATA *ch,int where,int vector) -{ - AFFECT_DATA *paf; - OBJ_DATA *obj; - - if (where == TO_OBJECT || where == TO_WEAPON || vector == 0) - return; - - for (paf = ch->affected; paf != NULL; paf = paf->next) - if (paf->where == where && paf->bitvector == vector) - { - switch (where) - { - case TO_AFFECTS: - SET_BIT(ch->affected_by,vector); - break; - case TO_IMMUNE: - SET_BIT(ch->imm_flags,vector); - break; - case TO_RESIST: - SET_BIT(ch->res_flags,vector); - break; - case TO_VULN: - SET_BIT(ch->vuln_flags,vector); - break; - } - return; - } - - for (obj = ch->carrying; obj != NULL; obj = obj->next_content) - { - if (obj->wear_loc == -1) - continue; - - for (paf = obj->affected; paf != NULL; paf = paf->next) - if (paf->where == where && paf->bitvector == vector) - { - switch (where) - { - case TO_AFFECTS: - SET_BIT(ch->affected_by,vector); - break; - case TO_IMMUNE: - SET_BIT(ch->imm_flags,vector); - break; - case TO_RESIST: - SET_BIT(ch->res_flags,vector); - break; - case TO_VULN: - SET_BIT(ch->vuln_flags,vector); - - } - return; - } - - if (obj->enchanted) - continue; - - for (paf = obj->pIndexData->affected; paf != NULL; paf = paf->next) - if (paf->where == where && paf->bitvector == vector) - { - switch (where) - { - case TO_AFFECTS: - SET_BIT(ch->affected_by,vector); - break; - case TO_IMMUNE: - SET_BIT(ch->imm_flags,vector); - break; - case TO_RESIST: - SET_BIT(ch->res_flags,vector); - break; - case TO_VULN: - SET_BIT(ch->vuln_flags,vector); - break; - } - return; - } - } -} - -/* - * Give an affect to a char. - */ -void affect_to_char( CHAR_DATA *ch, AFFECT_DATA *paf ) -{ - AFFECT_DATA *paf_new; - - paf_new = new_affect(); - - *paf_new = *paf; - - VALIDATE(paf); /* in case we missed it when we set up paf */ - paf_new->next = ch->affected; - ch->affected = paf_new; - - affect_modify( ch, paf_new, TRUE ); - return; -} - -/* give an affect to an object */ -void affect_to_obj(OBJ_DATA *obj, AFFECT_DATA *paf) -{ - AFFECT_DATA *paf_new; - - paf_new = new_affect(); - - *paf_new = *paf; - - VALIDATE(paf); /* in case we missed it when we set up paf */ - paf_new->next = obj->affected; - obj->affected = paf_new; - - /* apply any affect vectors to the object's extra_flags */ - if (paf->bitvector) - switch (paf->where) - { - case TO_OBJECT: - SET_BIT(obj->extra_flags,paf->bitvector); - break; - case TO_WEAPON: - if (obj->item_type == ITEM_WEAPON) - SET_BIT(obj->value[4],paf->bitvector); - break; - } - - - return; -} - - - -/* - * Remove an affect from a char. - */ -void affect_remove( CHAR_DATA *ch, AFFECT_DATA *paf ) -{ - int where; - int vector; - - if ( ch->affected == NULL ) - { - bug( "Affect_remove: no affect.", 0 ); - return; - } - - affect_modify( ch, paf, FALSE ); - where = paf->where; - vector = paf->bitvector; - - if ( paf == ch->affected ) - { - ch->affected = paf->next; - } - else - { - AFFECT_DATA *prev; - - for ( prev = ch->affected; prev != NULL; prev = prev->next ) - { - if ( prev->next == paf ) - { - prev->next = paf->next; - break; - } - } - - if ( prev == NULL ) - { - bug( "Affect_remove: cannot find paf.", 0 ); - return; - } - } - - free_affect(paf); - - affect_check(ch,where,vector); - return; -} - -void affect_remove_obj( OBJ_DATA *obj, AFFECT_DATA *paf) -{ - int where, vector; - if ( obj->affected == NULL ) - { - bug( "Affect_remove_object: no affect.", 0 ); - return; - } - - if (obj->carried_by != NULL && obj->wear_loc != -1) - affect_modify( obj->carried_by, paf, FALSE ); - - where = paf->where; - vector = paf->bitvector; - - /* remove flags from the object if needed */ - if (paf->bitvector) - switch( paf->where) - { - case TO_OBJECT: - REMOVE_BIT(obj->extra_flags,paf->bitvector); - break; - case TO_WEAPON: - if (obj->item_type == ITEM_WEAPON) - REMOVE_BIT(obj->value[4],paf->bitvector); - break; - } - - if ( paf == obj->affected ) - { - obj->affected = paf->next; - } - else - { - AFFECT_DATA *prev; - - for ( prev = obj->affected; prev != NULL; prev = prev->next ) - { - if ( prev->next == paf ) - { - prev->next = paf->next; - break; - } - } - - if ( prev == NULL ) - { - bug( "Affect_remove_object: cannot find paf.", 0 ); - return; - } - } - - free_affect(paf); - - if (obj->carried_by != NULL && obj->wear_loc != -1) - affect_check(obj->carried_by,where,vector); - return; -} - - - -/* - * Strip all affects of a given sn. - */ -void affect_strip( CHAR_DATA *ch, int sn ) -{ - AFFECT_DATA *paf; - AFFECT_DATA *paf_next; - - for ( paf = ch->affected; paf != NULL; paf = paf_next ) - { - paf_next = paf->next; - if ( paf->type == sn ) - affect_remove( ch, paf ); - } - - return; -} - - - -/* - * Return true if a char is affected by a spell. - */ -bool is_affected( CHAR_DATA *ch, int sn ) -{ - AFFECT_DATA *paf; - - for ( paf = ch->affected; paf != NULL; paf = paf->next ) - { - if ( paf->type == sn ) - return TRUE; - } - - return FALSE; -} - - - -/* - * Add or enhance an affect. - */ -void affect_join( CHAR_DATA *ch, AFFECT_DATA *paf ) -{ - AFFECT_DATA *paf_old; - bool found; - - found = FALSE; - for ( paf_old = ch->affected; paf_old != NULL; paf_old = paf_old->next ) - { - if ( paf_old->type == paf->type ) - { - paf->level = (paf->level += paf_old->level) / 2; - paf->duration += paf_old->duration; - paf->modifier += paf_old->modifier; - affect_remove( ch, paf_old ); - break; - } - } - - affect_to_char( ch, paf ); - return; -} - - - -/* - * Move a char out of a room. - */ -void char_from_room( CHAR_DATA *ch ) -{ - OBJ_DATA *obj; - - if ( ch->in_room == NULL ) - { - bug( "Char_from_room: NULL.", 0 ); - return; - } - - if ( !IS_NPC(ch) ) - --ch->in_room->area->nplayer; - - if ( ( obj = get_eq_char( ch, WEAR_LIGHT ) ) != NULL - && obj->item_type == ITEM_LIGHT - && obj->value[2] != 0 - && ch->in_room->light > 0 ) - --ch->in_room->light; - - if ( ch == ch->in_room->people ) - { - ch->in_room->people = ch->next_in_room; - } - else - { - CHAR_DATA *prev; - - for ( prev = ch->in_room->people; prev; prev = prev->next_in_room ) - { - if ( prev->next_in_room == ch ) - { - prev->next_in_room = ch->next_in_room; - break; - } - } - - if ( prev == NULL ) - bug( "Char_from_room: ch not found.", 0 ); - } - - ch->in_room = NULL; - ch->next_in_room = NULL; - ch->on = NULL; /* sanity check! */ - return; -} - - - -/* - * Move a char into a room. - */ -void char_to_room( CHAR_DATA *ch, ROOM_INDEX_DATA *pRoomIndex ) -{ - OBJ_DATA *obj; - - if ( pRoomIndex == NULL ) - { - ROOM_INDEX_DATA *room; - - bug( "Char_to_room: NULL.", 0 ); - - if ((room = get_room_index(ROOM_VNUM_TEMPLE)) != NULL) - char_to_room(ch,room); - - return; - } - - ch->in_room = pRoomIndex; - ch->next_in_room = pRoomIndex->people; - pRoomIndex->people = ch; - - if ( !IS_NPC(ch) ) - { - if (ch->in_room->area->empty) - { - ch->in_room->area->empty = FALSE; - ch->in_room->area->age = 0; - } - ++ch->in_room->area->nplayer; - } - - if ( ( obj = get_eq_char( ch, WEAR_LIGHT ) ) != NULL - && obj->item_type == ITEM_LIGHT - && obj->value[2] != 0 ) - ++ch->in_room->light; - - if (IS_AFFECTED(ch,AFF_PLAGUE)) - { - AFFECT_DATA *af, plague; - CHAR_DATA *vch; - - for ( af = ch->affected; af != NULL; af = af->next ) - { - if (af->type == gsn_plague) - break; - } - - if (af == NULL) - { - REMOVE_BIT(ch->affected_by,AFF_PLAGUE); - return; - } - - if (af->level == 1) - return; - - plague.where = TO_AFFECTS; - plague.type = gsn_plague; - plague.level = af->level - 1; - plague.duration = number_range(1,2 * plague.level); - plague.location = APPLY_STR; - plague.modifier = -5; - plague.bitvector = AFF_PLAGUE; - - for ( vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room) - { - if (!saves_spell(plague.level - 2,vch,DAM_DISEASE) - && !IS_IMMORTAL(vch) && - !IS_AFFECTED(vch,AFF_PLAGUE) && number_bits(6) == 0) - { - send_to_char("You feel hot and feverish.\n\r",vch); - act("$n shivers and looks very ill.",vch,NULL,NULL,TO_ROOM); - affect_join(vch,&plague); - } - } - } - - - return; -} - - - -/* - * Give an obj to a char. - */ -void obj_to_char( OBJ_DATA *obj, CHAR_DATA *ch ) -{ - obj->next_content = ch->carrying; - ch->carrying = obj; - obj->carried_by = ch; - obj->in_room = NULL; - obj->in_obj = NULL; - ch->carry_number += get_obj_number( obj ); - ch->carry_weight += get_obj_weight( obj ); -} - - - -/* - * Take an obj from its character. - */ -void obj_from_char( OBJ_DATA *obj ) -{ - CHAR_DATA *ch; - - if ( ( ch = obj->carried_by ) == NULL ) - { - bug( "Obj_from_char: null ch.", 0 ); - return; - } - - if ( obj->wear_loc != WEAR_NONE ) - unequip_char( ch, obj ); - - if ( ch->carrying == obj ) - { - ch->carrying = obj->next_content; - } - else - { - OBJ_DATA *prev; - - for ( prev = ch->carrying; prev != NULL; prev = prev->next_content ) - { - if ( prev->next_content == obj ) - { - prev->next_content = obj->next_content; - break; - } - } - - if ( prev == NULL ) - bug( "Obj_from_char: obj not in list.", 0 ); - } - - obj->carried_by = NULL; - obj->next_content = NULL; - ch->carry_number -= get_obj_number( obj ); - ch->carry_weight -= get_obj_weight( obj ); - return; -} - - - -/* - * Find the ac value of an obj, including position effect. - */ -int apply_ac( OBJ_DATA *obj, int iWear, int type ) -{ - if ( obj->item_type != ITEM_ARMOR ) - return 0; - - switch ( iWear ) - { - case WEAR_BODY: return 3 * obj->value[type]; - case WEAR_HEAD: return 2 * obj->value[type]; - case WEAR_LEGS: return 2 * obj->value[type]; - case WEAR_FEET: return obj->value[type]; - case WEAR_HANDS: return obj->value[type]; - case WEAR_ARMS: return obj->value[type]; - case WEAR_SHIELD: return obj->value[type]; - case WEAR_NECK_1: return obj->value[type]; - case WEAR_NECK_2: return obj->value[type]; - case WEAR_ABOUT: return 2 * obj->value[type]; - case WEAR_WAIST: return obj->value[type]; - case WEAR_WRIST_L: return obj->value[type]; - case WEAR_WRIST_R: return obj->value[type]; - case WEAR_HOLD: return obj->value[type]; - } - - return 0; -} - - - -/* - * Find a piece of eq on a character. - */ -OBJ_DATA *get_eq_char( CHAR_DATA *ch, int iWear ) -{ - OBJ_DATA *obj; - - if (ch == NULL) - return NULL; - - for ( obj = ch->carrying; obj != NULL; obj = obj->next_content ) - { - if ( obj->wear_loc == iWear ) - return obj; - } - - return NULL; -} - - - -/* - * Equip a char with an obj. - */ -void equip_char( CHAR_DATA *ch, OBJ_DATA *obj, int iWear ) -{ - AFFECT_DATA *paf; - int i; - - if ( get_eq_char( ch, iWear ) != NULL ) - { - bug( "Equip_char: already equipped (%d).", iWear ); - return; - } - - if ( ( IS_OBJ_STAT(obj, ITEM_ANTI_EVIL) && IS_EVIL(ch) ) - || ( IS_OBJ_STAT(obj, ITEM_ANTI_GOOD) && IS_GOOD(ch) ) - || ( IS_OBJ_STAT(obj, ITEM_ANTI_NEUTRAL) && IS_NEUTRAL(ch) ) ) - { - /* - * Thanks to Morgenes for the bug fix here! - */ - act( "You are zapped by $p and drop it.", ch, obj, NULL, TO_CHAR ); - act( "$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM ); - obj_from_char( obj ); - obj_to_room( obj, ch->in_room ); - return; - } - - for (i = 0; i < 4; i++) - ch->armor[i] -= apply_ac( obj, iWear,i ); - obj->wear_loc = iWear; - - if (!obj->enchanted) - for ( paf = obj->pIndexData->affected; paf != NULL; paf = paf->next ) - if ( paf->location != APPLY_SPELL_AFFECT ) - affect_modify( ch, paf, TRUE ); - for ( paf = obj->affected; paf != NULL; paf = paf->next ) - if ( paf->location == APPLY_SPELL_AFFECT ) - affect_to_char ( ch, paf ); - else - affect_modify( ch, paf, TRUE ); - - if ( obj->item_type == ITEM_LIGHT - && obj->value[2] != 0 - && ch->in_room != NULL ) - ++ch->in_room->light; - - return; -} - - - -/* - * Unequip a char with an obj. - */ -void unequip_char( CHAR_DATA *ch, OBJ_DATA *obj ) -{ - AFFECT_DATA *paf = NULL; - AFFECT_DATA *lpaf = NULL; - AFFECT_DATA *lpaf_next = NULL; - int i; - - if ( obj->wear_loc == WEAR_NONE ) - { - bug( "Unequip_char: already unequipped.", 0 ); - return; - } - - for (i = 0; i < 4; i++) - ch->armor[i] += apply_ac( obj, obj->wear_loc,i ); - obj->wear_loc = -1; - - if (!obj->enchanted) - for ( paf = obj->pIndexData->affected; paf != NULL; paf = paf->next ) - if ( paf->location == APPLY_SPELL_AFFECT ) - { - for ( lpaf = ch->affected; lpaf != NULL; lpaf = lpaf_next ) - { - lpaf_next = lpaf->next; - if ((lpaf->type == paf->type) && - (lpaf->level == paf->level) && - (lpaf->location == APPLY_SPELL_AFFECT)) - { - affect_remove( ch, lpaf ); - lpaf_next = NULL; - } - } - } - else - { - affect_modify( ch, paf, FALSE ); - affect_check(ch,paf->where,paf->bitvector); - } - - for ( paf = obj->affected; paf != NULL; paf = paf->next ) - if ( paf->location == APPLY_SPELL_AFFECT ) - { - bug ( "Norm-Apply: %d", 0 ); - for ( lpaf = ch->affected; lpaf != NULL; lpaf = lpaf_next ) - { - lpaf_next = lpaf->next; - if ((lpaf->type == paf->type) && - (lpaf->level == paf->level) && - (lpaf->location == APPLY_SPELL_AFFECT)) - { - bug ( "location = %d", lpaf->location ); - bug ( "type = %d", lpaf->type ); - affect_remove( ch, lpaf ); - lpaf_next = NULL; - } - } - } - else - { - affect_modify( ch, paf, FALSE ); - affect_check(ch,paf->where,paf->bitvector); - } - - if ( obj->item_type == ITEM_LIGHT - && obj->value[2] != 0 - && ch->in_room != NULL - && ch->in_room->light > 0 ) - --ch->in_room->light; - - return; -} - - - -/* - * Count occurrences of an obj in a list. - */ -int count_obj_list( OBJ_INDEX_DATA *pObjIndex, OBJ_DATA *list ) -{ - OBJ_DATA *obj; - int nMatch; - - nMatch = 0; - for ( obj = list; obj != NULL; obj = obj->next_content ) - { - if ( obj->pIndexData == pObjIndex ) - nMatch++; - } - - return nMatch; -} - - - -/* - * Move an obj out of a room. - */ -void obj_from_room( OBJ_DATA *obj ) -{ - ROOM_INDEX_DATA *in_room; - CHAR_DATA *ch; - - if ( ( in_room = obj->in_room ) == NULL ) - { - bug( "obj_from_room: NULL.", 0 ); - return; - } - - for (ch = in_room->people; ch != NULL; ch = ch->next_in_room) - if (ch->on == obj) - ch->on = NULL; - - if ( obj == in_room->contents ) - { - in_room->contents = obj->next_content; - } - else - { - OBJ_DATA *prev; - - for ( prev = in_room->contents; prev; prev = prev->next_content ) - { - if ( prev->next_content == obj ) - { - prev->next_content = obj->next_content; - break; - } - } - - if ( prev == NULL ) - { - bug( "Obj_from_room: obj not found.", 0 ); - return; - } - } - - obj->in_room = NULL; - obj->next_content = NULL; - return; -} - - - -/* - * Move an obj into a room. - */ -void obj_to_room( OBJ_DATA *obj, ROOM_INDEX_DATA *pRoomIndex ) -{ - obj->next_content = pRoomIndex->contents; - pRoomIndex->contents = obj; - obj->in_room = pRoomIndex; - obj->carried_by = NULL; - obj->in_obj = NULL; - return; -} - - - -/* - * Move an object into an object. - */ -void obj_to_obj( OBJ_DATA *obj, OBJ_DATA *obj_to ) -{ - obj->next_content = obj_to->contains; - obj_to->contains = obj; - obj->in_obj = obj_to; - obj->in_room = NULL; - obj->carried_by = NULL; - if (obj_to->pIndexData->vnum == OBJ_VNUM_PIT) - obj->cost = 0; - - for ( ; obj_to != NULL; obj_to = obj_to->in_obj ) - { - if ( obj_to->carried_by != NULL ) - { - obj_to->carried_by->carry_number += get_obj_number( obj ); - obj_to->carried_by->carry_weight += get_obj_weight( obj ) - * WEIGHT_MULT(obj_to) / 100; - } - } - - return; -} - - - -/* - * Move an object out of an object. - */ -void obj_from_obj( OBJ_DATA *obj ) -{ - OBJ_DATA *obj_from; - - if ( ( obj_from = obj->in_obj ) == NULL ) - { - bug( "Obj_from_obj: null obj_from.", 0 ); - return; - } - - if ( obj == obj_from->contains ) - { - obj_from->contains = obj->next_content; - } - else - { - OBJ_DATA *prev; - - for ( prev = obj_from->contains; prev; prev = prev->next_content ) - { - if ( prev->next_content == obj ) - { - prev->next_content = obj->next_content; - break; - } - } - - if ( prev == NULL ) - { - bug( "Obj_from_obj: obj not found.", 0 ); - return; - } - } - - obj->next_content = NULL; - obj->in_obj = NULL; - - for ( ; obj_from != NULL; obj_from = obj_from->in_obj ) - { - if ( obj_from->carried_by != NULL ) - { - obj_from->carried_by->carry_number -= get_obj_number( obj ); - obj_from->carried_by->carry_weight -= get_obj_weight( obj ) - * WEIGHT_MULT(obj_from) / 100; - } - } - - return; -} - - - -/* - * Extract an obj from the world. - */ -void extract_obj( OBJ_DATA *obj ) -{ - OBJ_DATA *obj_content; - OBJ_DATA *obj_next; - - if ( obj->in_room != NULL ) - obj_from_room( obj ); - else if ( obj->carried_by != NULL ) - obj_from_char( obj ); - else if ( obj->in_obj != NULL ) - obj_from_obj( obj ); - - for ( obj_content = obj->contains; obj_content; obj_content = obj_next ) - { - obj_next = obj_content->next_content; - extract_obj( obj_content ); - } - - if ( object_list == obj ) - { - object_list = obj->next; - } - else - { - OBJ_DATA *prev; - - for ( prev = object_list; prev != NULL; prev = prev->next ) - { - if ( prev->next == obj ) - { - prev->next = obj->next; - break; - } - } - - if ( prev == NULL ) - { - bug( "Extract_obj: obj %d not found.", obj->pIndexData->vnum ); - return; - } - } - - --obj->pIndexData->count; - free_obj(obj); - return; -} - - - -/* - * Extract a char from the world. - */ -void extract_char( CHAR_DATA *ch, bool fPull ) -{ - CHAR_DATA *wch; - OBJ_DATA *obj; - OBJ_DATA *obj_next; - - /* doesn't seem to be necessary - if ( ch->in_room == NULL ) - { - bug( "Extract_char: NULL.", 0 ); - return; - } - */ - - nuke_pets(ch); - ch->pet = NULL; /* just in case */ - - if ( fPull ) - - die_follower( ch ); - - stop_fighting( ch, TRUE ); - - for ( obj = ch->carrying; obj != NULL; obj = obj_next ) - { - obj_next = obj->next_content; - extract_obj( obj ); - } - - if (ch->in_room != NULL) - char_from_room( ch ); - - /* Death room is set in the clan tabe now */ - if ( !fPull ) - { - char_to_room(ch,get_room_index(clan_table[ch->clan].hall)); - return; - } - - if ( IS_NPC(ch) ) - --ch->pIndexData->count; - - if ( ch->desc != NULL && ch->desc->original != NULL ) - { - do_function(ch, &do_return, "" ); - ch->desc = NULL; - } - - for ( wch = char_list; wch != NULL; wch = wch->next ) - { - if ( wch->reply == ch ) - wch->reply = NULL; - } - - if ( ch == char_list ) - { - char_list = ch->next; - } - else - { - CHAR_DATA *prev; - - for ( prev = char_list; prev != NULL; prev = prev->next ) - { - if ( prev->next == ch ) - { - prev->next = ch->next; - break; - } - } - - if ( prev == NULL ) - { - bug( "Extract_char: char not found.", 0 ); - return; - } - } - - if ( ch->desc != NULL ) - ch->desc->character = NULL; - free_char( ch ); - return; -} - - - -/* - * Find a char in the room. - */ -CHAR_DATA *get_char_room( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *rch; - int number; - int count; - - number = number_argument( argument, arg ); - count = 0; - if ( !str_cmp( arg, "self" ) ) - return ch; - for ( rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room ) - { - if ( !can_see( ch, rch ) || !is_name( arg, rch->name ) ) - continue; - if ( ++count == number ) - return rch; - } - - return NULL; -} - - - - -/* - * Find a char in the world. - */ -CHAR_DATA *get_char_world( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *wch; - int number; - int count; - - if ( ( wch = get_char_room( ch, argument ) ) != NULL ) - return wch; - - number = number_argument( argument, arg ); - count = 0; - for ( wch = char_list; wch != NULL ; wch = wch->next ) - { - if ( wch->in_room == NULL || !can_see( ch, wch ) - || !is_name( arg, wch->name ) ) - continue; - if ( ++count == number ) - return wch; - } - - return NULL; -} - - - -/* - * Find some object with a given index data. - * Used by area-reset 'P' command. - */ -OBJ_DATA *get_obj_type( OBJ_INDEX_DATA *pObjIndex ) -{ - OBJ_DATA *obj; - - for ( obj = object_list; obj != NULL; obj = obj->next ) - { - if ( obj->pIndexData == pObjIndex ) - return obj; - } - - return NULL; -} - - -/* - * Find an obj in a list. - */ -OBJ_DATA *get_obj_list( CHAR_DATA *ch, char *argument, OBJ_DATA *list ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - int number; - int count; - - number = number_argument( argument, arg ); - count = 0; - for ( obj = list; obj != NULL; obj = obj->next_content ) - { - if ( can_see_obj( ch, obj ) && is_name( arg, obj->name ) ) - { - if ( ++count == number ) - return obj; - } - } - - return NULL; -} - - - -/* - * Find an obj in player's inventory. - */ -OBJ_DATA *get_obj_carry( CHAR_DATA *ch, char *argument, CHAR_DATA *viewer ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - int number; - int count; - - number = number_argument( argument, arg ); - count = 0; - for ( obj = ch->carrying; obj != NULL; obj = obj->next_content ) - { - if ( obj->wear_loc == WEAR_NONE - && (can_see_obj( viewer, obj ) ) - && is_name( arg, obj->name ) ) - { - if ( ++count == number ) - return obj; - } - } - - return NULL; -} - - - -/* - * Find an obj in player's equipment. - */ -OBJ_DATA *get_obj_wear( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - int number; - int count; - - number = number_argument( argument, arg ); - count = 0; - for ( obj = ch->carrying; obj != NULL; obj = obj->next_content ) - { - if ( obj->wear_loc != WEAR_NONE - && can_see_obj( ch, obj ) - && is_name( arg, obj->name ) ) - { - if ( ++count == number ) - return obj; - } - } - - return NULL; -} - - - -/* - * Find an obj in the room or in inventory. - */ -OBJ_DATA *get_obj_here( CHAR_DATA *ch, char *argument ) -{ - OBJ_DATA *obj; - - obj = get_obj_list( ch, argument, ch->in_room->contents ); - if ( obj != NULL ) - return obj; - - if ( ( obj = get_obj_carry( ch, argument, ch ) ) != NULL ) - return obj; - - if ( ( obj = get_obj_wear( ch, argument ) ) != NULL ) - return obj; - - return NULL; -} - - - -/* - * Find an obj in the world. - */ -OBJ_DATA *get_obj_world( CHAR_DATA *ch, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - OBJ_DATA *obj; - int number; - int count; - - if ( ( obj = get_obj_here( ch, argument ) ) != NULL ) - return obj; - - number = number_argument( argument, arg ); - count = 0; - for ( obj = object_list; obj != NULL; obj = obj->next ) - { - if ( can_see_obj( ch, obj ) && is_name( arg, obj->name ) ) - { - if ( ++count == number ) - return obj; - } - } - - return NULL; -} - -/* deduct cost from a character */ - -void deduct_cost(CHAR_DATA *ch, int cost) -{ - int silver = 0, gold = 0; - - silver = UMIN(ch->silver,cost); - - if (silver < cost) - { - gold = ((cost - silver + 99) / 100); - silver = cost - 100 * gold; - } - - ch->gold -= gold; - ch->silver -= silver; - - if (ch->gold < 0) - { - bug("deduct costs: gold %d < 0",ch->gold); - ch->gold = 0; - } - if (ch->silver < 0) - { - bug("deduct costs: silver %d < 0",ch->silver); - ch->silver = 0; - } -} -/* - * Create a 'money' obj. - */ -OBJ_DATA *create_money( int gold, int silver ) -{ - char buf[MAX_STRING_LENGTH]; - OBJ_DATA *obj; - - if ( gold < 0 || silver < 0 || (gold == 0 && silver == 0) ) - { - bug( "Create_money: zero or negative money.",UMIN(gold,silver)); - gold = UMAX(1,gold); - silver = UMAX(1,silver); - } - - if (gold == 0 && silver == 1) - { - obj = create_object( get_obj_index( OBJ_VNUM_SILVER_ONE ), 0 ); - } - else if (gold == 1 && silver == 0) - { - obj = create_object( get_obj_index( OBJ_VNUM_GOLD_ONE), 0 ); - } - else if (silver == 0) - { - obj = create_object( get_obj_index( OBJ_VNUM_GOLD_SOME ), 0 ); - sprintf( buf, obj->short_descr, gold ); - free_string( obj->short_descr ); - obj->short_descr = str_dup( buf ); - obj->value[1] = gold; - obj->cost = gold; - obj->weight = gold/5; - } - else if (gold == 0) - { - obj = create_object( get_obj_index( OBJ_VNUM_SILVER_SOME ), 0 ); - sprintf( buf, obj->short_descr, silver ); - free_string( obj->short_descr ); - obj->short_descr = str_dup( buf ); - obj->value[0] = silver; - obj->cost = silver; - obj->weight = silver/20; - } - - else - { - obj = create_object( get_obj_index( OBJ_VNUM_COINS ), 0 ); - sprintf( buf, obj->short_descr, silver, gold ); - free_string( obj->short_descr ); - obj->short_descr = str_dup( buf ); - obj->value[0] = silver; - obj->value[1] = gold; - obj->cost = 100 * gold + silver; - obj->weight = gold / 5 + silver / 20; - } - - return obj; -} - - - -/* - * Return # of objects which an object counts as. - * Thanks to Tony Chamberlain for the correct recursive code here. - */ -int get_obj_number( OBJ_DATA *obj ) -{ - int number; - - if (obj->item_type == ITEM_CONTAINER || obj->item_type == ITEM_MONEY - || obj->item_type == ITEM_GEM || obj->item_type == ITEM_JEWELRY) - number = 0; - else - number = 1; - - for ( obj = obj->contains; obj != NULL; obj = obj->next_content ) - number += get_obj_number( obj ); - - return number; -} - - -/* - * Return weight of an object, including weight of contents. - */ -int get_obj_weight( OBJ_DATA *obj ) -{ - int weight; - OBJ_DATA *tobj; - - weight = obj->weight; - for ( tobj = obj->contains; tobj != NULL; tobj = tobj->next_content ) - weight += get_obj_weight( tobj ) * WEIGHT_MULT(obj) / 100; - - return weight; -} - -int get_true_weight(OBJ_DATA *obj) -{ - int weight; - - weight = obj->weight; - for ( obj = obj->contains; obj != NULL; obj = obj->next_content ) - weight += get_obj_weight( obj ); - - return weight; -} - -/* - * True if room is dark. - */ -bool room_is_dark( ROOM_INDEX_DATA *pRoomIndex ) -{ - if ( pRoomIndex->light > 0 ) - return FALSE; - - if ( IS_SET(pRoomIndex->room_flags, ROOM_DARK) ) - return TRUE; - - if ( pRoomIndex->sector_type == SECT_INSIDE - || pRoomIndex->sector_type == SECT_CITY ) - return FALSE; - - if ( weather_info.sunlight == SUN_SET - || weather_info.sunlight == SUN_DARK ) - return TRUE; - - return FALSE; -} - - -bool is_room_owner(CHAR_DATA *ch, ROOM_INDEX_DATA *room) -{ - if (room->owner == NULL || room->owner[0] == '\0') - return FALSE; - - return is_name(ch->name,room->owner); -} - -/* - * True if room is private. - */ -bool room_is_private( ROOM_INDEX_DATA *pRoomIndex ) -{ - CHAR_DATA *rch; - int count; - - - if (pRoomIndex->owner != NULL && pRoomIndex->owner[0] != '\0') - return TRUE; - - count = 0; - for ( rch = pRoomIndex->people; rch != NULL; rch = rch->next_in_room ) - count++; - - if ( IS_SET(pRoomIndex->room_flags, ROOM_PRIVATE) && count >= 2 ) - return TRUE; - - if ( IS_SET(pRoomIndex->room_flags, ROOM_SOLITARY) && count >= 1 ) - return TRUE; - - if ( IS_SET(pRoomIndex->room_flags, ROOM_IMP_ONLY) ) - return TRUE; - - return FALSE; -} - -/* visibility on a room -- for entering and exits */ -bool can_see_room( CHAR_DATA *ch, ROOM_INDEX_DATA *pRoomIndex ) -{ - if (IS_SET(pRoomIndex->room_flags, ROOM_IMP_ONLY) - && get_trust(ch) < MAX_LEVEL) - return FALSE; - - if (IS_SET(pRoomIndex->room_flags, ROOM_GODS_ONLY) - && !IS_IMMORTAL(ch)) - return FALSE; - - if (IS_SET(pRoomIndex->room_flags, ROOM_HEROES_ONLY) - && !IS_IMMORTAL(ch)) - return FALSE; - - if (IS_SET(pRoomIndex->room_flags,ROOM_NEWBIES_ONLY) - && ch->level > 5 && !IS_IMMORTAL(ch)) - return FALSE; - - if (!IS_IMMORTAL(ch) && pRoomIndex->clan && ch->clan != pRoomIndex->clan) - return FALSE; - - return TRUE; -} - - - -/* - * True if char can see victim. - */ -bool can_see( CHAR_DATA *ch, CHAR_DATA *victim ) -{ -/* RT changed so that WIZ_INVIS has levels */ - if ( ch == victim ) - return TRUE; - - if ( get_trust(ch) < victim->invis_level) - return FALSE; - - - if (get_trust(ch) < victim->incog_level && ch->in_room != victim->in_room) - return FALSE; - - if ( (!IS_NPC(ch) && IS_SET(ch->act, PLR_HOLYLIGHT)) - || (IS_NPC(ch) && IS_IMMORTAL(ch))) - return TRUE; - - if ( IS_AFFECTED(ch, AFF_BLIND) ) - return FALSE; - - if ( room_is_dark( ch->in_room ) && !IS_AFFECTED(ch, AFF_INFRARED) ) - return FALSE; - - if ( IS_AFFECTED(victim, AFF_INVISIBLE) - && !IS_AFFECTED(ch, AFF_DETECT_INVIS) ) - return FALSE; - - /* sneaking */ - if ( IS_AFFECTED(victim, AFF_SNEAK) - && !IS_AFFECTED(ch,AFF_DETECT_HIDDEN) - && victim->fighting == NULL) - { - int chance; - chance = get_skill(victim,gsn_sneak); - chance += get_curr_stat(victim,STAT_DEX) * 3/2; - chance -= get_curr_stat(ch,STAT_INT) * 2; - chance -= ch->level - victim->level * 3/2; - - if (number_percent() < chance) - return FALSE; - } - - if ( IS_AFFECTED(victim, AFF_HIDE) - && !IS_AFFECTED(ch, AFF_DETECT_HIDDEN) - && victim->fighting == NULL) - return FALSE; - - return TRUE; -} - - - -/* - * True if char can see obj. - */ -bool can_see_obj( CHAR_DATA *ch, OBJ_DATA *obj ) -{ - if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_HOLYLIGHT) ) - return TRUE; - - if ( IS_SET(obj->extra_flags,ITEM_VIS_DEATH)) - return FALSE; - - if ( IS_AFFECTED( ch, AFF_BLIND ) && obj->item_type != ITEM_POTION) - return FALSE; - - if ( obj->item_type == ITEM_LIGHT && obj->value[2] != 0 ) - return TRUE; - - if ( IS_SET(obj->extra_flags, ITEM_INVIS) - && !IS_AFFECTED(ch, AFF_DETECT_INVIS) ) - return FALSE; - - if ( IS_OBJ_STAT(obj,ITEM_GLOW)) - return TRUE; - - if ( room_is_dark( ch->in_room ) && !IS_AFFECTED(ch, AFF_DARK_VISION) ) - return FALSE; - - return TRUE; -} - - - -/* - * True if char can drop obj. - */ -bool can_drop_obj( CHAR_DATA *ch, OBJ_DATA *obj ) -{ - if ( !IS_SET(obj->extra_flags, ITEM_NODROP) ) - return TRUE; - - if ( !IS_NPC(ch) && ch->level >= LEVEL_IMMORTAL ) - return TRUE; - - return FALSE; -} - - -/* - * Return ascii name of an affect location. - */ -char *affect_loc_name( int location ) -{ - switch ( location ) - { - case APPLY_NONE: return "none"; - case APPLY_STR: return "strength"; - case APPLY_DEX: return "dexterity"; - case APPLY_INT: return "intelligence"; - case APPLY_WIS: return "wisdom"; - case APPLY_CON: return "constitution"; - case APPLY_SEX: return "sex"; - case APPLY_CLASS: return "class"; - case APPLY_LEVEL: return "level"; - case APPLY_AGE: return "age"; - case APPLY_MANA: return "mana"; - case APPLY_HIT: return "hp"; - case APPLY_MOVE: return "moves"; - case APPLY_GOLD: return "gold"; - case APPLY_EXP: return "experience"; - case APPLY_AC: return "armor class"; - case APPLY_HITROLL: return "hit roll"; - case APPLY_DAMROLL: return "damage roll"; - case APPLY_SAVES: return "saves"; - case APPLY_SAVING_ROD: return "save vs rod"; - case APPLY_SAVING_PETRI: return "save vs petrification"; - case APPLY_SAVING_BREATH: return "save vs breath"; - case APPLY_SAVING_SPELL: return "save vs spell"; - case APPLY_SPELL_AFFECT: return "none"; - } - - bug( "Affect_location_name: unknown location %d.", location ); - return "(unknown)"; -} - - - -/* - * Return ascii name of an affect bit vector. - */ -char *affect_bit_name( int vector ) -{ - static char buf[512]; - - buf[0] = '\0'; - if ( vector & AFF_BLIND ) strcat( buf, " blind" ); - if ( vector & AFF_INVISIBLE ) strcat( buf, " invisible" ); - if ( vector & AFF_DETECT_EVIL ) strcat( buf, " detect_evil" ); - if ( vector & AFF_DETECT_GOOD ) strcat( buf, " detect_good" ); - if ( vector & AFF_DETECT_INVIS ) strcat( buf, " detect_invis" ); - if ( vector & AFF_DETECT_MAGIC ) strcat( buf, " detect_magic" ); - if ( vector & AFF_DETECT_HIDDEN ) strcat( buf, " detect_hidden" ); - if ( vector & AFF_SANCTUARY ) strcat( buf, " sanctuary" ); - if ( vector & AFF_FAERIE_FIRE ) strcat( buf, " faerie_fire" ); - if ( vector & AFF_INFRARED ) strcat( buf, " infrared" ); - if ( vector & AFF_CURSE ) strcat( buf, " curse" ); - if ( vector & AFF_POISON ) strcat( buf, " poison" ); - if ( vector & AFF_PROTECT_EVIL ) strcat( buf, " prot_evil" ); - if ( vector & AFF_PROTECT_GOOD ) strcat( buf, " prot_good" ); - if ( vector & AFF_SLEEP ) strcat( buf, " sleep" ); - if ( vector & AFF_SNEAK ) strcat( buf, " sneak" ); - if ( vector & AFF_HIDE ) strcat( buf, " hide" ); - if ( vector & AFF_CHARM ) strcat( buf, " charm" ); - if ( vector & AFF_FLYING ) strcat( buf, " flying" ); - if ( vector & AFF_PASS_DOOR ) strcat( buf, " pass_door" ); - if ( vector & AFF_BERSERK ) strcat( buf, " berserk" ); - if ( vector & AFF_CALM ) strcat( buf, " calm" ); - if ( vector & AFF_HASTE ) strcat( buf, " haste" ); - if ( vector & AFF_SLOW ) strcat( buf, " slow" ); - if ( vector & AFF_PLAGUE ) strcat( buf, " plague" ); - if ( vector & AFF_DARK_VISION ) strcat( buf, " dark_vision" ); - return ( buf[0] != '\0' ) ? buf+1 : "none"; -} - - - -/* - * Return ascii name of extra flags vector. - */ -char *extra_bit_name( int extra_flags ) -{ - static char buf[512]; - - buf[0] = '\0'; - if ( extra_flags & ITEM_GLOW ) strcat( buf, " glow" ); - if ( extra_flags & ITEM_HUM ) strcat( buf, " hum" ); - if ( extra_flags & ITEM_DARK ) strcat( buf, " dark" ); - if ( extra_flags & ITEM_LOCK ) strcat( buf, " lock" ); - if ( extra_flags & ITEM_EVIL ) strcat( buf, " evil" ); - if ( extra_flags & ITEM_INVIS ) strcat( buf, " invis" ); - if ( extra_flags & ITEM_MAGIC ) strcat( buf, " magic" ); - if ( extra_flags & ITEM_NODROP ) strcat( buf, " nodrop" ); - if ( extra_flags & ITEM_BLESS ) strcat( buf, " bless" ); - if ( extra_flags & ITEM_ANTI_GOOD ) strcat( buf, " anti-good" ); - if ( extra_flags & ITEM_ANTI_EVIL ) strcat( buf, " anti-evil" ); - if ( extra_flags & ITEM_ANTI_NEUTRAL ) strcat( buf, " anti-neutral" ); - if ( extra_flags & ITEM_NOREMOVE ) strcat( buf, " noremove" ); - if ( extra_flags & ITEM_INVENTORY ) strcat( buf, " inventory" ); - if ( extra_flags & ITEM_NOPURGE ) strcat( buf, " nopurge" ); - if ( extra_flags & ITEM_VIS_DEATH ) strcat( buf, " vis_death" ); - if ( extra_flags & ITEM_ROT_DEATH ) strcat( buf, " rot_death" ); - if ( extra_flags & ITEM_NOLOCATE ) strcat( buf, " no_locate" ); - if ( extra_flags & ITEM_SELL_EXTRACT ) strcat( buf, " sell_extract" ); - if ( extra_flags & ITEM_BURN_PROOF ) strcat( buf, " burn_proof" ); - if ( extra_flags & ITEM_NOUNCURSE ) strcat( buf, " no_uncurse" ); - return ( buf[0] != '\0' ) ? buf+1 : "none"; -} - -/* return ascii name of an act vector */ -char *act_bit_name( int act_flags ) -{ - static char buf[512]; - - buf[0] = '\0'; - - if (IS_SET(act_flags,ACT_IS_NPC)) - { - strcat(buf," npc"); - if (act_flags & ACT_SENTINEL ) strcat(buf, " sentinel"); - if (act_flags & ACT_SCAVENGER ) strcat(buf, " scavenger"); - if (act_flags & ACT_AGGRESSIVE ) strcat(buf, " aggressive"); - if (act_flags & ACT_STAY_AREA ) strcat(buf, " stay_area"); - if (act_flags & ACT_WIMPY ) strcat(buf, " wimpy"); - if (act_flags & ACT_PET ) strcat(buf, " pet"); - if (act_flags & ACT_TRAIN ) strcat(buf, " train"); - if (act_flags & ACT_PRACTICE ) strcat(buf, " practice"); - if (act_flags & ACT_UNDEAD ) strcat(buf, " undead"); - if (act_flags & ACT_CLERIC ) strcat(buf, " cleric"); - if (act_flags & ACT_MAGE ) strcat(buf, " mage"); - if (act_flags & ACT_THIEF ) strcat(buf, " thief"); - if (act_flags & ACT_WARRIOR ) strcat(buf, " warrior"); - if (act_flags & ACT_NOALIGN ) strcat(buf, " no_align"); - if (act_flags & ACT_NOPURGE ) strcat(buf, " no_purge"); - if (act_flags & ACT_IS_HEALER ) strcat(buf, " healer"); - if (act_flags & ACT_IS_CHANGER ) strcat(buf, " changer"); - if (act_flags & ACT_GAIN ) strcat(buf, " skill_train"); - if (act_flags & ACT_UPDATE_ALWAYS) strcat(buf," update_always"); - } - else - { - strcat(buf," player"); - if (act_flags & PLR_AUTOASSIST ) strcat(buf, " autoassist"); - if (act_flags & PLR_AUTOEXIT ) strcat(buf, " autoexit"); - if (act_flags & PLR_AUTOLOOT ) strcat(buf, " autoloot"); - if (act_flags & PLR_AUTOSAC ) strcat(buf, " autosac"); - if (act_flags & PLR_AUTOGOLD ) strcat(buf, " autogold"); - if (act_flags & PLR_AUTOSPLIT ) strcat(buf, " autosplit"); - if (act_flags & PLR_HOLYLIGHT ) strcat(buf, " holy_light"); - if (act_flags & PLR_CANLOOT ) strcat(buf, " loot_corpse"); - if (act_flags & PLR_NOSUMMON ) strcat(buf, " no_summon"); - if (act_flags & PLR_NOFOLLOW ) strcat(buf, " no_follow"); - if (act_flags & PLR_FREEZE ) strcat(buf, " frozen"); - if (act_flags & PLR_THIEF ) strcat(buf, " thief"); - if (act_flags & PLR_KILLER ) strcat(buf, " killer"); - } - return ( buf[0] != '\0' ) ? buf+1 : "none"; -} - -char *comm_bit_name(int comm_flags) -{ - static char buf[512]; - - buf[0] = '\0'; - - if (comm_flags & COMM_QUIET ) strcat(buf, " quiet"); - if (comm_flags & COMM_DEAF ) strcat(buf, " deaf"); - if (comm_flags & COMM_NOWIZ ) strcat(buf, " no_wiz"); - if (comm_flags & COMM_NOAUCTION ) strcat(buf, " no_auction"); - if (comm_flags & COMM_NOGOSSIP ) strcat(buf, " no_gossip"); - if (comm_flags & COMM_NOQUESTION ) strcat(buf, " no_question"); - if (comm_flags & COMM_NOMUSIC ) strcat(buf, " no_music"); - if (comm_flags & COMM_NOQUOTE ) strcat(buf, " no_quote"); - if (comm_flags & COMM_COMPACT ) strcat(buf, " compact"); - if (comm_flags & COMM_BRIEF ) strcat(buf, " brief"); - if (comm_flags & COMM_PROMPT ) strcat(buf, " prompt"); - if (comm_flags & COMM_COMBINE ) strcat(buf, " combine"); - if (comm_flags & COMM_NOEMOTE ) strcat(buf, " no_emote"); - if (comm_flags & COMM_NOSHOUT ) strcat(buf, " no_shout"); - if (comm_flags & COMM_NOTELL ) strcat(buf, " no_tell"); - if (comm_flags & COMM_NOCHANNELS ) strcat(buf, " no_channels"); - - - return ( buf[0] != '\0' ) ? buf+1 : "none"; -} - -char *imm_bit_name(int imm_flags) -{ - static char buf[512]; - - buf[0] = '\0'; - - if (imm_flags & IMM_SUMMON ) strcat(buf, " summon"); - if (imm_flags & IMM_CHARM ) strcat(buf, " charm"); - if (imm_flags & IMM_MAGIC ) strcat(buf, " magic"); - if (imm_flags & IMM_WEAPON ) strcat(buf, " weapon"); - if (imm_flags & IMM_BASH ) strcat(buf, " blunt"); - if (imm_flags & IMM_PIERCE ) strcat(buf, " piercing"); - if (imm_flags & IMM_SLASH ) strcat(buf, " slashing"); - if (imm_flags & IMM_FIRE ) strcat(buf, " fire"); - if (imm_flags & IMM_COLD ) strcat(buf, " cold"); - if (imm_flags & IMM_LIGHTNING ) strcat(buf, " lightning"); - if (imm_flags & IMM_ACID ) strcat(buf, " acid"); - if (imm_flags & IMM_POISON ) strcat(buf, " poison"); - if (imm_flags & IMM_NEGATIVE ) strcat(buf, " negative"); - if (imm_flags & IMM_HOLY ) strcat(buf, " holy"); - if (imm_flags & IMM_ENERGY ) strcat(buf, " energy"); - if (imm_flags & IMM_MENTAL ) strcat(buf, " mental"); - if (imm_flags & IMM_DISEASE ) strcat(buf, " disease"); - if (imm_flags & IMM_DROWNING ) strcat(buf, " drowning"); - if (imm_flags & IMM_LIGHT ) strcat(buf, " light"); - if (imm_flags & VULN_IRON ) strcat(buf, " iron"); - if (imm_flags & VULN_WOOD ) strcat(buf, " wood"); - if (imm_flags & VULN_SILVER ) strcat(buf, " silver"); - - return ( buf[0] != '\0' ) ? buf+1 : "none"; -} - -char *wear_bit_name(int wear_flags) -{ - static char buf[512]; - - buf [0] = '\0'; - if (wear_flags & ITEM_TAKE ) strcat(buf, " take"); - if (wear_flags & ITEM_WEAR_FINGER ) strcat(buf, " finger"); - if (wear_flags & ITEM_WEAR_NECK ) strcat(buf, " neck"); - if (wear_flags & ITEM_WEAR_BODY ) strcat(buf, " torso"); - if (wear_flags & ITEM_WEAR_HEAD ) strcat(buf, " head"); - if (wear_flags & ITEM_WEAR_LEGS ) strcat(buf, " legs"); - if (wear_flags & ITEM_WEAR_FEET ) strcat(buf, " feet"); - if (wear_flags & ITEM_WEAR_HANDS ) strcat(buf, " hands"); - if (wear_flags & ITEM_WEAR_ARMS ) strcat(buf, " arms"); - if (wear_flags & ITEM_WEAR_SHIELD ) strcat(buf, " shield"); - if (wear_flags & ITEM_WEAR_ABOUT ) strcat(buf, " body"); - if (wear_flags & ITEM_WEAR_WAIST ) strcat(buf, " waist"); - if (wear_flags & ITEM_WEAR_WRIST ) strcat(buf, " wrist"); - if (wear_flags & ITEM_WIELD ) strcat(buf, " wield"); - if (wear_flags & ITEM_HOLD ) strcat(buf, " hold"); - if (wear_flags & ITEM_NO_SAC ) strcat(buf, " nosac"); - if (wear_flags & ITEM_WEAR_FLOAT ) strcat(buf, " float"); - - return ( buf[0] != '\0' ) ? buf+1 : "none"; -} - -char *form_bit_name(int form_flags) -{ - static char buf[512]; - - buf[0] = '\0'; - if (form_flags & FORM_POISON ) strcat(buf, " poison"); - else if (form_flags & FORM_EDIBLE ) strcat(buf, " edible"); - if (form_flags & FORM_MAGICAL ) strcat(buf, " magical"); - if (form_flags & FORM_INSTANT_DECAY ) strcat(buf, " instant_rot"); - if (form_flags & FORM_OTHER ) strcat(buf, " other"); - if (form_flags & FORM_ANIMAL ) strcat(buf, " animal"); - if (form_flags & FORM_SENTIENT ) strcat(buf, " sentient"); - if (form_flags & FORM_UNDEAD ) strcat(buf, " undead"); - if (form_flags & FORM_CONSTRUCT ) strcat(buf, " construct"); - if (form_flags & FORM_MIST ) strcat(buf, " mist"); - if (form_flags & FORM_INTANGIBLE ) strcat(buf, " intangible"); - if (form_flags & FORM_BIPED ) strcat(buf, " biped"); - if (form_flags & FORM_CENTAUR ) strcat(buf, " centaur"); - if (form_flags & FORM_INSECT ) strcat(buf, " insect"); - if (form_flags & FORM_SPIDER ) strcat(buf, " spider"); - if (form_flags & FORM_CRUSTACEAN ) strcat(buf, " crustacean"); - if (form_flags & FORM_WORM ) strcat(buf, " worm"); - if (form_flags & FORM_BLOB ) strcat(buf, " blob"); - if (form_flags & FORM_MAMMAL ) strcat(buf, " mammal"); - if (form_flags & FORM_BIRD ) strcat(buf, " bird"); - if (form_flags & FORM_REPTILE ) strcat(buf, " reptile"); - if (form_flags & FORM_SNAKE ) strcat(buf, " snake"); - if (form_flags & FORM_DRAGON ) strcat(buf, " dragon"); - if (form_flags & FORM_AMPHIBIAN ) strcat(buf, " amphibian"); - if (form_flags & FORM_FISH ) strcat(buf, " fish"); - if (form_flags & FORM_COLD_BLOOD ) strcat(buf, " cold_blooded"); - - return ( buf[0] != '\0' ) ? buf+1 : "none"; -} - -char *part_bit_name(int part_flags) -{ - static char buf[512]; - - buf[0] = '\0'; - if (part_flags & PART_HEAD ) strcat(buf, " head"); - if (part_flags & PART_ARMS ) strcat(buf, " arms"); - if (part_flags & PART_LEGS ) strcat(buf, " legs"); - if (part_flags & PART_HEART ) strcat(buf, " heart"); - if (part_flags & PART_BRAINS ) strcat(buf, " brains"); - if (part_flags & PART_GUTS ) strcat(buf, " guts"); - if (part_flags & PART_HANDS ) strcat(buf, " hands"); - if (part_flags & PART_FEET ) strcat(buf, " feet"); - if (part_flags & PART_FINGERS ) strcat(buf, " fingers"); - if (part_flags & PART_EAR ) strcat(buf, " ears"); - if (part_flags & PART_EYE ) strcat(buf, " eyes"); - if (part_flags & PART_LONG_TONGUE ) strcat(buf, " long_tongue"); - if (part_flags & PART_EYESTALKS ) strcat(buf, " eyestalks"); - if (part_flags & PART_TENTACLES ) strcat(buf, " tentacles"); - if (part_flags & PART_FINS ) strcat(buf, " fins"); - if (part_flags & PART_WINGS ) strcat(buf, " wings"); - if (part_flags & PART_TAIL ) strcat(buf, " tail"); - if (part_flags & PART_CLAWS ) strcat(buf, " claws"); - if (part_flags & PART_FANGS ) strcat(buf, " fangs"); - if (part_flags & PART_HORNS ) strcat(buf, " horns"); - if (part_flags & PART_SCALES ) strcat(buf, " scales"); - - return ( buf[0] != '\0' ) ? buf+1 : "none"; -} - -char *weapon_bit_name(int weapon_flags) -{ - static char buf[512]; - - buf[0] = '\0'; - if (weapon_flags & WEAPON_FLAMING ) strcat(buf, " flaming"); - if (weapon_flags & WEAPON_FROST ) strcat(buf, " frost"); - if (weapon_flags & WEAPON_VAMPIRIC ) strcat(buf, " vampiric"); - if (weapon_flags & WEAPON_SHARP ) strcat(buf, " sharp"); - if (weapon_flags & WEAPON_VORPAL ) strcat(buf, " vorpal"); - if (weapon_flags & WEAPON_TWO_HANDS ) strcat(buf, " two-handed"); - if (weapon_flags & WEAPON_SHOCKING ) strcat(buf, " shocking"); - if (weapon_flags & WEAPON_POISON ) strcat(buf, " poison"); - - return ( buf[0] != '\0' ) ? buf+1 : "none"; -} - -char *cont_bit_name( int cont_flags) -{ - static char buf[512]; - - buf[0] = '\0'; - - if (cont_flags & CONT_CLOSEABLE ) strcat(buf, " closable"); - if (cont_flags & CONT_PICKPROOF ) strcat(buf, " pickproof"); - if (cont_flags & CONT_CLOSED ) strcat(buf, " closed"); - if (cont_flags & CONT_LOCKED ) strcat(buf, " locked"); - - return (buf[0] != '\0' ) ? buf+1 : "none"; -} - - -char *off_bit_name(int off_flags) -{ - static char buf[512]; - - buf[0] = '\0'; - - if (off_flags & OFF_AREA_ATTACK ) strcat(buf, " area attack"); - if (off_flags & OFF_BACKSTAB ) strcat(buf, " backstab"); - if (off_flags & OFF_BASH ) strcat(buf, " bash"); - if (off_flags & OFF_BERSERK ) strcat(buf, " berserk"); - if (off_flags & OFF_DISARM ) strcat(buf, " disarm"); - if (off_flags & OFF_DODGE ) strcat(buf, " dodge"); - if (off_flags & OFF_FADE ) strcat(buf, " fade"); - if (off_flags & OFF_FAST ) strcat(buf, " fast"); - if (off_flags & OFF_KICK ) strcat(buf, " kick"); - if (off_flags & OFF_KICK_DIRT ) strcat(buf, " kick_dirt"); - if (off_flags & OFF_PARRY ) strcat(buf, " parry"); - if (off_flags & OFF_RESCUE ) strcat(buf, " rescue"); - if (off_flags & OFF_TAIL ) strcat(buf, " tail"); - if (off_flags & OFF_TRIP ) strcat(buf, " trip"); - if (off_flags & OFF_CRUSH ) strcat(buf, " crush"); - if (off_flags & ASSIST_ALL ) strcat(buf, " assist_all"); - if (off_flags & ASSIST_ALIGN ) strcat(buf, " assist_align"); - if (off_flags & ASSIST_RACE ) strcat(buf, " assist_race"); - if (off_flags & ASSIST_PLAYERS ) strcat(buf, " assist_players"); - if (off_flags & ASSIST_GUARD ) strcat(buf, " assist_guard"); - if (off_flags & ASSIST_VNUM ) strcat(buf, " assist_vnum"); - - return ( buf[0] != '\0' ) ? buf+1 : "none"; -} diff --git a/archive/src/healer.c b/archive/src/healer.c deleted file mode 100644 index 916e21d..0000000 --- a/archive/src/healer.c +++ /dev/null @@ -1,196 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#include -#else -#include -#include -#endif -#include -#include -#include -#include "merc.h" -#include "magic.h" - -void do_heal(CHAR_DATA *ch, char *argument) -{ - CHAR_DATA *mob; - char arg[MAX_INPUT_LENGTH]; - int cost,sn; - SPELL_FUN *spell; - char *words; - - /* check for healer */ - for ( mob = ch->in_room->people; mob; mob = mob->next_in_room ) - { - if ( IS_NPC(mob) && IS_SET(mob->act, ACT_IS_HEALER) ) - break; - } - - if ( mob == NULL ) - { - send_to_char( "You can't do that here.\n\r", ch ); - return; - } - - one_argument(argument,arg); - - if (arg[0] == '\0') - { - /* display price list */ - act("$N says 'I offer the following spells:'",ch,NULL,mob,TO_CHAR); - send_to_char(" light: cure light wounds 10 gold\n\r",ch); - send_to_char(" serious: cure serious wounds 15 gold\n\r",ch); - send_to_char(" critic: cure critical wounds 25 gold\n\r",ch); - send_to_char(" heal: healing spell 50 gold\n\r",ch); - send_to_char(" blind: cure blindness 20 gold\n\r",ch); - send_to_char(" disease: cure disease 15 gold\n\r",ch); - send_to_char(" poison: cure poison 25 gold\n\r",ch); - send_to_char(" uncurse: remove curse 50 gold\n\r",ch); - send_to_char(" refresh: restore movement 5 gold\n\r",ch); - send_to_char(" mana: restore mana 10 gold\n\r",ch); - send_to_char(" Type heal to be healed.\n\r",ch); - return; - } - - if (!str_prefix(arg,"light")) - { - spell = spell_cure_light; - sn = skill_lookup("cure light"); - words = "judicandus dies"; - cost = 1000; - } - - else if (!str_prefix(arg,"serious")) - { - spell = spell_cure_serious; - sn = skill_lookup("cure serious"); - words = "judicandus gzfuajg"; - cost = 1600; - } - - else if (!str_prefix(arg,"critical")) - { - spell = spell_cure_critical; - sn = skill_lookup("cure critical"); - words = "judicandus qfuhuqar"; - cost = 2500; - } - - else if (!str_prefix(arg,"heal")) - { - spell = spell_heal; - sn = skill_lookup("heal"); - words = "pzar"; - cost = 5000; - } - - else if (!str_prefix(arg,"blindness")) - { - spell = spell_cure_blindness; - sn = skill_lookup("cure blindness"); - words = "judicandus noselacri"; - cost = 2000; - } - - else if (!str_prefix(arg,"disease")) - { - spell = spell_cure_disease; - sn = skill_lookup("cure disease"); - words = "judicandus eugzagz"; - cost = 1500; - } - - else if (!str_prefix(arg,"poison")) - { - spell = spell_cure_poison; - sn = skill_lookup("cure poison"); - words = "judicandus sausabru"; - cost = 2500; - } - - else if (!str_prefix(arg,"uncurse") || !str_prefix(arg,"curse")) - { - spell = spell_remove_curse; - sn = skill_lookup("remove curse"); - words = "candussido judifgz"; - cost = 5000; - } - - else if (!str_prefix(arg,"mana") || !str_prefix(arg,"energize")) - { - spell = NULL; - sn = -1; - words = "energizer"; - cost = 1000; - } - - - else if (!str_prefix(arg,"refresh") || !str_prefix(arg,"moves")) - { - spell = spell_refresh; - sn = skill_lookup("refresh"); - words = "candusima"; - cost = 500; - } - - else - { - act("$N says 'Type 'heal' for a list of spells.'", - ch,NULL,mob,TO_CHAR); - return; - } - - if (cost > (ch->gold * 100 + ch->silver)) - { - act("$N says 'You do not have enough gold for my services.'", - ch,NULL,mob,TO_CHAR); - return; - } - - WAIT_STATE(ch,PULSE_VIOLENCE); - - deduct_cost(ch,cost); - mob->gold += cost / 100; - mob->silver += cost % 100; - act("$n utters the words '$T'.",mob,NULL,words,TO_ROOM); - - if (spell == NULL) /* restore mana trap...kinda hackish */ - { - ch->mana += dice(2,8) + mob->level / 3; - ch->mana = UMIN(ch->mana,ch->max_mana); - send_to_char("A warm glow passes through you.\n\r",ch); - return; - } - - if (sn == -1) - return; - - spell(sn,mob->level,mob,ch,TARGET_CHAR); -} diff --git a/archive/src/interp.c b/archive/src/interp.c deleted file mode 100644 index 61b295c..0000000 --- a/archive/src/interp.c +++ /dev/null @@ -1,796 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#endif -#include -#include -#include -#include -#include -#include "merc.h" -#include "interp.h" - - -bool check_social args( ( CHAR_DATA *ch, char *command, - char *argument ) ); - -/* - * Command logging types. - */ -#define LOG_NORMAL 0 -#define LOG_ALWAYS 1 -#define LOG_NEVER 2 - - - -/* - * Log-all switch. - */ -bool fLogAll = FALSE; - - - -/* - * Command table. - */ -const struct cmd_type cmd_table [] = -{ - /* - * Common movement commands. - */ - { "north", do_north, POS_STANDING, 0, LOG_NEVER, 0 }, - { "east", do_east, POS_STANDING, 0, LOG_NEVER, 0 }, - { "south", do_south, POS_STANDING, 0, LOG_NEVER, 0 }, - { "west", do_west, POS_STANDING, 0, LOG_NEVER, 0 }, - { "up", do_up, POS_STANDING, 0, LOG_NEVER, 0 }, - { "down", do_down, POS_STANDING, 0, LOG_NEVER, 0 }, - - /* - * Common other commands. - * Placed here so one and two letter abbreviations work. - */ - { "at", do_at, POS_DEAD, L6, LOG_NORMAL, 1 }, - { "cast", do_cast, POS_FIGHTING, 0, LOG_NORMAL, 1 }, - { "auction", do_auction, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "buy", do_buy, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "channels", do_channels, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "exits", do_exits, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "get", do_get, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "goto", do_goto, POS_DEAD, L8, LOG_NORMAL, 1 }, - { "group", do_group, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "guild", do_guild, POS_DEAD, L4, LOG_ALWAYS, 1 }, - { "hit", do_kill, POS_FIGHTING, 0, LOG_NORMAL, 0 }, - { "inventory", do_inventory, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "kill", do_kill, POS_FIGHTING, 0, LOG_NORMAL, 1 }, - { "look", do_look, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "clan", do_clantalk, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "music", do_music, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "order", do_order, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "practice", do_practice, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "rest", do_rest, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "sit", do_sit, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "sockets", do_sockets, POS_DEAD, L4, LOG_NORMAL, 1 }, - { "stand", do_stand, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "tell", do_tell, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "unlock", do_unlock, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "wield", do_wear, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "wizhelp", do_wizhelp, POS_DEAD, IM, LOG_NORMAL, 1 }, - - /* - * Informational commands. - */ - { "affects", do_affects, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "areas", do_areas, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "bug", do_bug, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "changes", do_changes, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "commands", do_commands, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "compare", do_compare, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "consider", do_consider, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "count", do_count, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "credits", do_credits, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "equipment", do_equipment, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "examine", do_examine, POS_RESTING, 0, LOG_NORMAL, 1 }, -/* { "groups", do_groups, POS_SLEEPING, 0, LOG_NORMAL, 1 }, */ - { "help", do_help, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "idea", do_idea, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "info", do_groups, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "motd", do_motd, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "news", do_news, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "read", do_read, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "report", do_report, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "rules", do_rules, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "score", do_score, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "skills", do_skills, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "socials", do_socials, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "show", do_show, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "spells", do_spells, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "story", do_story, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "time", do_time, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "typo", do_typo, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "weather", do_weather, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "who", do_who, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "whois", do_whois, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "wizlist", do_wizlist, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "worth", do_worth, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - - /* - * Configuration commands. - */ - { "alia", do_alia, POS_DEAD, 0, LOG_NORMAL, 0 }, - { "alias", do_alias, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "autolist", do_autolist, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "autoassist", do_autoassist, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "autoexit", do_autoexit, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "autogold", do_autogold, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "autoloot", do_autoloot, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "autosac", do_autosac, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "autosplit", do_autosplit, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "brief", do_brief, POS_DEAD, 0, LOG_NORMAL, 1 }, -/* { "channels", do_channels, POS_DEAD, 0, LOG_NORMAL, 1 }, */ - { "combine", do_combine, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "compact", do_compact, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "description", do_description, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "delet", do_delet, POS_DEAD, 0, LOG_ALWAYS, 0 }, - { "delete", do_delete, POS_STANDING, 0, LOG_ALWAYS, 1 }, - { "nofollow", do_nofollow, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "noloot", do_noloot, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "nosummon", do_nosummon, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "outfit", do_outfit, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "password", do_password, POS_DEAD, 0, LOG_NEVER, 1 }, - { "prompt", do_prompt, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "scroll", do_scroll, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "title", do_title, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "unalias", do_unalias, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "wimpy", do_wimpy, POS_DEAD, 0, LOG_NORMAL, 1 }, - - /* - * Communication commands. - */ - { "afk", do_afk, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "answer", do_answer, POS_SLEEPING, 0, LOG_NORMAL, 1 }, -/* { "auction", do_auction, POS_SLEEPING, 0, LOG_NORMAL, 1 }, */ - { "deaf", do_deaf, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "emote", do_emote, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "pmote", do_pmote, POS_RESTING, 0, LOG_NORMAL, 1 }, - { ".", do_gossip, POS_SLEEPING, 0, LOG_NORMAL, 0 }, - { "gossip", do_gossip, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { ",", do_emote, POS_RESTING, 0, LOG_NORMAL, 0 }, - { "grats", do_grats, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "gtell", do_gtell, POS_DEAD, 0, LOG_NORMAL, 1 }, - { ";", do_gtell, POS_DEAD, 0, LOG_NORMAL, 0 }, -/* { "music", do_music, POS_SLEEPING, 0, LOG_NORMAL, 1 }, */ - { "note", do_note, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "pose", do_pose, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "question", do_question, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "quote", do_quote, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "quiet", do_quiet, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "reply", do_reply, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "replay", do_replay, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "say", do_say, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "'", do_say, POS_RESTING, 0, LOG_NORMAL, 0 }, - { "shout", do_shout, POS_RESTING, 3, LOG_NORMAL, 1 }, - { "unread", do_unread, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "yell", do_yell, POS_RESTING, 0, LOG_NORMAL, 1 }, - - /* - * Object manipulation commands. - */ - { "brandish", do_brandish, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "close", do_close, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "drink", do_drink, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "drop", do_drop, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "eat", do_eat, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "envenom", do_envenom, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "fill", do_fill, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "give", do_give, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "heal", do_heal, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "hold", do_wear, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "list", do_list, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "lock", do_lock, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "open", do_open, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "pick", do_pick, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "pour", do_pour, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "put", do_put, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "quaff", do_quaff, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "recite", do_recite, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "remove", do_remove, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "sell", do_sell, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "take", do_get, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "sacrifice", do_sacrifice, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "junk", do_sacrifice, POS_RESTING, 0, LOG_NORMAL, 0 }, - { "tap", do_sacrifice, POS_RESTING, 0, LOG_NORMAL, 0 }, -/* { "unlock", do_unlock, POS_RESTING, 0, LOG_NORMAL, 1 }, */ - { "value", do_value, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "wear", do_wear, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "zap", do_zap, POS_RESTING, 0, LOG_NORMAL, 1 }, - - /* - * Combat commands. - */ - { "backstab", do_backstab, POS_FIGHTING, 0, LOG_NORMAL, 1 }, - { "bash", do_bash, POS_FIGHTING, 0, LOG_NORMAL, 1 }, - { "bs", do_backstab, POS_FIGHTING, 0, LOG_NORMAL, 0 }, - { "berserk", do_berserk, POS_FIGHTING, 0, LOG_NORMAL, 1 }, - { "dirt", do_dirt, POS_FIGHTING, 0, LOG_NORMAL, 1 }, - { "disarm", do_disarm, POS_FIGHTING, 0, LOG_NORMAL, 1 }, - { "flee", do_flee, POS_FIGHTING, 0, LOG_NORMAL, 1 }, - { "kick", do_kick, POS_FIGHTING, 0, LOG_NORMAL, 1 }, - { "murde", do_murde, POS_FIGHTING, 0, LOG_NORMAL, 0 }, - { "murder", do_murder, POS_FIGHTING, 5, LOG_ALWAYS, 1 }, - { "rescue", do_rescue, POS_FIGHTING, 0, LOG_NORMAL, 0 }, - { "trip", do_trip, POS_FIGHTING, 0, LOG_NORMAL, 1 }, - - /* - * Miscellaneous commands. - */ - { "enter", do_enter, POS_STANDING, 0, LOG_NORMAL, 1 }, - { "follow", do_follow, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "gain", do_gain, POS_STANDING, 0, LOG_NORMAL, 1 }, - { "go", do_enter, POS_STANDING, 0, LOG_NORMAL, 0 }, -/* { "group", do_group, POS_SLEEPING, 0, LOG_NORMAL, 1 }, */ - { "groups", do_groups, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "hide", do_hide, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "play", do_play, POS_RESTING, 0, LOG_NORMAL, 1 }, -/* { "practice", do_practice, POS_SLEEPING, 0, LOG_NORMAL, 1 }, */ - { "qui", do_qui, POS_DEAD, 0, LOG_NORMAL, 0 }, - { "quit", do_quit, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "recall", do_recall, POS_FIGHTING, 0, LOG_NORMAL, 1 }, - { "/", do_recall, POS_FIGHTING, 0, LOG_NORMAL, 0 }, - { "rent", do_rent, POS_DEAD, 0, LOG_NORMAL, 0 }, - { "save", do_save, POS_DEAD, 0, LOG_NORMAL, 1 }, - { "sleep", do_sleep, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "sneak", do_sneak, POS_STANDING, 0, LOG_NORMAL, 1 }, - { "split", do_split, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "steal", do_steal, POS_STANDING, 0, LOG_NORMAL, 1 }, - { "train", do_train, POS_RESTING, 0, LOG_NORMAL, 1 }, - { "visible", do_visible, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "wake", do_wake, POS_SLEEPING, 0, LOG_NORMAL, 1 }, - { "where", do_where, POS_RESTING, 0, LOG_NORMAL, 1 }, - - - - /* - * Immortal commands. - */ - { "advance", do_advance, POS_DEAD, ML, LOG_ALWAYS, 1 }, - { "dump", do_dump, POS_DEAD, ML, LOG_ALWAYS, 0 }, - { "trust", do_trust, POS_DEAD, ML, LOG_ALWAYS, 1 }, - { "violate", do_violate, POS_DEAD, ML, LOG_ALWAYS, 1 }, - - { "allow", do_allow, POS_DEAD, L2, LOG_ALWAYS, 1 }, - { "ban", do_ban, POS_DEAD, L2, LOG_ALWAYS, 1 }, - { "deny", do_deny, POS_DEAD, L1, LOG_ALWAYS, 1 }, - { "disconnect", do_disconnect, POS_DEAD, L3, LOG_ALWAYS, 1 }, - { "flag", do_flag, POS_DEAD, L4, LOG_ALWAYS, 1 }, - { "freeze", do_freeze, POS_DEAD, L4, LOG_ALWAYS, 1 }, - { "permban", do_permban, POS_DEAD, L1, LOG_ALWAYS, 1 }, - { "protect", do_protect, POS_DEAD, L1, LOG_ALWAYS, 1 }, - { "reboo", do_reboo, POS_DEAD, L1, LOG_NORMAL, 0 }, - { "reboot", do_reboot, POS_DEAD, L1, LOG_ALWAYS, 1 }, - { "set", do_set, POS_DEAD, L2, LOG_ALWAYS, 1 }, - { "shutdow", do_shutdow, POS_DEAD, L1, LOG_NORMAL, 0 }, - { "shutdown", do_shutdown, POS_DEAD, L1, LOG_ALWAYS, 1 }, -/* { "sockets", do_sockets, POS_DEAD, L4, LOG_NORMAL, 1 }, */ - { "wizlock", do_wizlock, POS_DEAD, L2, LOG_ALWAYS, 1 }, - - { "force", do_force, POS_DEAD, L7, LOG_ALWAYS, 1 }, - { "load", do_load, POS_DEAD, L4, LOG_ALWAYS, 1 }, - { "newlock", do_newlock, POS_DEAD, L4, LOG_ALWAYS, 1 }, - { "nochannels", do_nochannels, POS_DEAD, L5, LOG_ALWAYS, 1 }, - { "noemote", do_noemote, POS_DEAD, L5, LOG_ALWAYS, 1 }, - { "noshout", do_noshout, POS_DEAD, L5, LOG_ALWAYS, 1 }, - { "notell", do_notell, POS_DEAD, L5, LOG_ALWAYS, 1 }, - { "pecho", do_pecho, POS_DEAD, L4, LOG_ALWAYS, 1 }, - { "pardon", do_pardon, POS_DEAD, L3, LOG_ALWAYS, 1 }, - { "purge", do_purge, POS_DEAD, L4, LOG_ALWAYS, 1 }, - { "restore", do_restore, POS_DEAD, L4, LOG_ALWAYS, 1 }, - { "sla", do_sla, POS_DEAD, L3, LOG_NORMAL, 0 }, - { "slay", do_slay, POS_DEAD, L3, LOG_ALWAYS, 1 }, - { "teleport", do_transfer, POS_DEAD, L5, LOG_ALWAYS, 1 }, - { "transfer", do_transfer, POS_DEAD, L5, LOG_ALWAYS, 1 }, - -/* { "at", do_at, POS_DEAD, L6, LOG_NORMAL, 1 }, */ - { "poofin", do_bamfin, POS_DEAD, L8, LOG_NORMAL, 1 }, - { "poofout", do_bamfout, POS_DEAD, L8, LOG_NORMAL, 1 }, - { "gecho", do_echo, POS_DEAD, L4, LOG_ALWAYS, 1 }, -/* { "goto", do_goto, POS_DEAD, L8, LOG_NORMAL, 1 }, */ - { "holylight", do_holylight, POS_DEAD, IM, LOG_NORMAL, 1 }, - { "incognito", do_incognito, POS_DEAD, IM, LOG_NORMAL, 1 }, - { "invis", do_invis, POS_DEAD, IM, LOG_NORMAL, 0 }, - { "log", do_log, POS_DEAD, L1, LOG_ALWAYS, 1 }, - { "memory", do_memory, POS_DEAD, IM, LOG_NORMAL, 1 }, - { "mwhere", do_mwhere, POS_DEAD, IM, LOG_NORMAL, 1 }, - { "owhere", do_owhere, POS_DEAD, IM, LOG_NORMAL, 1 }, - { "peace", do_peace, POS_DEAD, L5, LOG_NORMAL, 1 }, - { "penalty", do_penalty, POS_DEAD, L7, LOG_NORMAL, 1 }, - { "echo", do_recho, POS_DEAD, L6, LOG_ALWAYS, 1 }, - { "return", do_return, POS_DEAD, L6, LOG_NORMAL, 1 }, - { "snoop", do_snoop, POS_DEAD, L5, LOG_ALWAYS, 1 }, - { "stat", do_stat, POS_DEAD, IM, LOG_NORMAL, 1 }, - { "string", do_string, POS_DEAD, L5, LOG_ALWAYS, 1 }, - { "switch", do_switch, POS_DEAD, L6, LOG_ALWAYS, 1 }, - { "wizinvis", do_invis, POS_DEAD, IM, LOG_NORMAL, 1 }, - { "vnum", do_vnum, POS_DEAD, L4, LOG_NORMAL, 1 }, - { "zecho", do_zecho, POS_DEAD, L4, LOG_ALWAYS, 1 }, - - { "clone", do_clone, POS_DEAD, L5, LOG_ALWAYS, 1 }, - - { "wiznet", do_wiznet, POS_DEAD, IM, LOG_NORMAL, 1 }, - { "immtalk", do_immtalk, POS_DEAD, IM, LOG_NORMAL, 1 }, - { "imotd", do_imotd, POS_DEAD, IM, LOG_NORMAL, 1 }, - { ":", do_immtalk, POS_DEAD, IM, LOG_NORMAL, 0 }, - { "smote", do_smote, POS_DEAD, IM, LOG_NORMAL, 1 }, - { "prefi", do_prefi, POS_DEAD, IM, LOG_NORMAL, 0 }, - { "prefix", do_prefix, POS_DEAD, IM, LOG_NORMAL, 1 }, - - /* - * End of list. - */ - { "", 0, POS_DEAD, 0, LOG_NORMAL, 0 } -}; - - - - -/* - * The main entry point for executing commands. - * Can be recursively called from 'at', 'order', 'force'. - */ -void interpret( CHAR_DATA *ch, char *argument ) -{ - char command[MAX_INPUT_LENGTH]; - char logline[MAX_INPUT_LENGTH]; - int cmd; - int trust; - bool found; - - /* - * Strip leading spaces. - */ - while ( isspace(*argument) ) - argument++; - if ( argument[0] == '\0' ) - return; - - /* - * No hiding. - */ - REMOVE_BIT( ch->affected_by, AFF_HIDE ); - - /* - * Implement freeze command. - */ - if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_FREEZE) ) - { - send_to_char( "You're totally frozen!\n\r", ch ); - return; - } - - /* - * Grab the command word. - * Special parsing so ' can be a command, - * also no spaces needed after punctuation. - */ - strcpy( logline, argument ); - if ( !isalpha(argument[0]) && !isdigit(argument[0]) ) - { - command[0] = argument[0]; - command[1] = '\0'; - argument++; - while ( isspace(*argument) ) - argument++; - } - else - { - argument = one_argument( argument, command ); - } - - /* - * Look for command in command table. - */ - found = FALSE; - trust = get_trust( ch ); - for ( cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++ ) - { - if ( command[0] == cmd_table[cmd].name[0] - && !str_prefix( command, cmd_table[cmd].name ) - && cmd_table[cmd].level <= trust ) - { - found = TRUE; - break; - } - } - - /* - * Log and snoop. - */ - if ( cmd_table[cmd].log == LOG_NEVER ) - strcpy( logline, "" ); - - if ( ( !IS_NPC(ch) && IS_SET(ch->act, PLR_LOG) ) - || fLogAll - || cmd_table[cmd].log == LOG_ALWAYS ) - { - sprintf( log_buf, "Log %s: %s", ch->name, logline ); - wiznet(log_buf,ch,NULL,WIZ_SECURE,0,get_trust(ch)); - log_string( log_buf ); - } - - if ( ch->desc != NULL && ch->desc->snoop_by != NULL ) - { - write_to_buffer( ch->desc->snoop_by, "% ", 2 ); - write_to_buffer( ch->desc->snoop_by, logline, 0 ); - write_to_buffer( ch->desc->snoop_by, "\n\r", 2 ); - } - - if ( !found ) - { - /* - * Look for command in socials table. - */ - if ( !check_social( ch, command, argument ) ) - send_to_char( "Huh?\n\r", ch ); - return; - } - - /* - * Character not in position for command? - */ - if ( ch->position < cmd_table[cmd].position ) - { - switch( ch->position ) - { - case POS_DEAD: - send_to_char( "Lie still; you are DEAD.\n\r", ch ); - break; - - case POS_MORTAL: - case POS_INCAP: - send_to_char( "You are hurt far too bad for that.\n\r", ch ); - break; - - case POS_STUNNED: - send_to_char( "You are too stunned to do that.\n\r", ch ); - break; - - case POS_SLEEPING: - send_to_char( "In your dreams, or what?\n\r", ch ); - break; - - case POS_RESTING: - send_to_char( "Nah... You feel too relaxed...\n\r", ch); - break; - - case POS_SITTING: - send_to_char( "Better stand up first.\n\r",ch); - break; - - case POS_FIGHTING: - send_to_char( "No way! You are still fighting!\n\r", ch); - break; - - } - return; - } - - /* - * Dispatch the command. - */ - (*cmd_table[cmd].do_fun) ( ch, argument ); - - tail_chain( ); - return; -} - -/* function to keep argument safe in all commands -- no static strings */ -void do_function (CHAR_DATA *ch, DO_FUN *do_fun, char *argument) -{ - char *command_string; - - /* copy the string */ - command_string = str_dup(argument); - - /* dispatch the command */ - (*do_fun) (ch, command_string); - - /* free the string */ - free_string(command_string); -} - -bool check_social( CHAR_DATA *ch, char *command, char *argument ) -{ - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - int cmd; - bool found; - - found = FALSE; - for ( cmd = 0; social_table[cmd].name[0] != '\0'; cmd++ ) - { - if ( command[0] == social_table[cmd].name[0] - && !str_prefix( command, social_table[cmd].name ) ) - { - found = TRUE; - break; - } - } - - if ( !found ) - return FALSE; - - if ( !IS_NPC(ch) && IS_SET(ch->comm, COMM_NOEMOTE) ) - { - send_to_char( "You are anti-social!\n\r", ch ); - return TRUE; - } - - switch ( ch->position ) - { - case POS_DEAD: - send_to_char( "Lie still; you are DEAD.\n\r", ch ); - return TRUE; - - case POS_INCAP: - case POS_MORTAL: - send_to_char( "You are hurt far too bad for that.\n\r", ch ); - return TRUE; - - case POS_STUNNED: - send_to_char( "You are too stunned to do that.\n\r", ch ); - return TRUE; - - case POS_SLEEPING: - /* - * I just know this is the path to a 12" 'if' statement. :( - * But two players asked for it already! -- Furey - */ - if ( !str_cmp( social_table[cmd].name, "snore" ) ) - break; - send_to_char( "In your dreams, or what?\n\r", ch ); - return TRUE; - - } - - one_argument( argument, arg ); - victim = NULL; - if ( arg[0] == '\0' ) - { - act( social_table[cmd].others_no_arg, ch, NULL, victim, TO_ROOM ); - act( social_table[cmd].char_no_arg, ch, NULL, victim, TO_CHAR ); - } - else if ( ( victim = get_char_room( ch, arg ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - } - else if ( victim == ch ) - { - act( social_table[cmd].others_auto, ch, NULL, victim, TO_ROOM ); - act( social_table[cmd].char_auto, ch, NULL, victim, TO_CHAR ); - } - else - { - act( social_table[cmd].others_found, ch, NULL, victim, TO_NOTVICT ); - act( social_table[cmd].char_found, ch, NULL, victim, TO_CHAR ); - act( social_table[cmd].vict_found, ch, NULL, victim, TO_VICT ); - - if ( !IS_NPC(ch) && IS_NPC(victim) - && !IS_AFFECTED(victim, AFF_CHARM) - && IS_AWAKE(victim) - && victim->desc == NULL) - { - switch ( number_bits( 4 ) ) - { - case 0: - - case 1: case 2: case 3: case 4: - case 5: case 6: case 7: case 8: - act( social_table[cmd].others_found, - victim, NULL, ch, TO_NOTVICT ); - act( social_table[cmd].char_found, - victim, NULL, ch, TO_CHAR ); - act( social_table[cmd].vict_found, - victim, NULL, ch, TO_VICT ); - break; - - case 9: case 10: case 11: case 12: - act( "$n slaps $N.", victim, NULL, ch, TO_NOTVICT ); - act( "You slap $N.", victim, NULL, ch, TO_CHAR ); - act( "$n slaps you.", victim, NULL, ch, TO_VICT ); - break; - } - } - } - - return TRUE; -} - - - -/* - * Return true if an argument is completely numeric. - */ -bool is_number ( char *arg ) -{ - - if ( *arg == '\0' ) - return FALSE; - - if ( *arg == '+' || *arg == '-' ) - arg++; - - for ( ; *arg != '\0'; arg++ ) - { - if ( !isdigit( *arg ) ) - return FALSE; - } - - return TRUE; -} - - - -/* - * Given a string like 14.foo, return 14 and 'foo' - */ -int number_argument( char *argument, char *arg ) -{ - char *pdot; - int number; - - for ( pdot = argument; *pdot != '\0'; pdot++ ) - { - if ( *pdot == '.' ) - { - *pdot = '\0'; - number = atoi( argument ); - *pdot = '.'; - strcpy( arg, pdot+1 ); - return number; - } - } - - strcpy( arg, argument ); - return 1; -} - -/* - * Given a string like 14*foo, return 14 and 'foo' -*/ -int mult_argument(char *argument, char *arg) -{ - char *pdot; - int number; - - for ( pdot = argument; *pdot != '\0'; pdot++ ) - { - if ( *pdot == '*' ) - { - *pdot = '\0'; - number = atoi( argument ); - *pdot = '*'; - strcpy( arg, pdot+1 ); - return number; - } - } - - strcpy( arg, argument ); - return 1; -} - - - -/* - * Pick off one argument from a string and return the rest. - * Understands quotes. - */ -char *one_argument( char *argument, char *arg_first ) -{ - char cEnd; - - while ( isspace(*argument) ) - argument++; - - cEnd = ' '; - if ( *argument == '\'' || *argument == '"' ) - cEnd = *argument++; - - while ( *argument != '\0' ) - { - if ( *argument == cEnd ) - { - argument++; - break; - } - *arg_first = LOWER(*argument); - arg_first++; - argument++; - } - *arg_first = '\0'; - - while ( isspace(*argument) ) - argument++; - - return argument; -} - -/* - * Contributed by Alander. - */ -void do_commands( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - int cmd; - int col; - - col = 0; - for ( cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++ ) - { - if ( cmd_table[cmd].level < LEVEL_HERO - && cmd_table[cmd].level <= get_trust( ch ) - && cmd_table[cmd].show) - { - sprintf( buf, "%-12s", cmd_table[cmd].name ); - send_to_char( buf, ch ); - if ( ++col % 6 == 0 ) - send_to_char( "\n\r", ch ); - } - } - - if ( col % 6 != 0 ) - send_to_char( "\n\r", ch ); - return; -} - -void do_wizhelp( CHAR_DATA *ch, char *argument ) -{ - char buf[MAX_STRING_LENGTH]; - int cmd; - int col; - - col = 0; - for ( cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++ ) - { - if ( cmd_table[cmd].level >= LEVEL_HERO - && cmd_table[cmd].level <= get_trust( ch ) - && cmd_table[cmd].show) - { - sprintf( buf, "%-12s", cmd_table[cmd].name ); - send_to_char( buf, ch ); - if ( ++col % 6 == 0 ) - send_to_char( "\n\r", ch ); - } - } - - if ( col % 6 != 0 ) - send_to_char( "\n\r", ch ); - return; -} - diff --git a/archive/src/interp.h b/archive/src/interp.h deleted file mode 100644 index f731669..0000000 --- a/archive/src/interp.h +++ /dev/null @@ -1,298 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -/* this is a listing of all the commands and command related data */ - -/* wrapper function for safe command execution */ -void do_function args((CHAR_DATA *ch, DO_FUN *do_fun, char *argument)); - -/* for command types */ -#define ML MAX_LEVEL /* implementor */ -#define L1 MAX_LEVEL - 1 /* creator */ -#define L2 MAX_LEVEL - 2 /* supreme being */ -#define L3 MAX_LEVEL - 3 /* deity */ -#define L4 MAX_LEVEL - 4 /* god */ -#define L5 MAX_LEVEL - 5 /* immortal */ -#define L6 MAX_LEVEL - 6 /* demigod */ -#define L7 MAX_LEVEL - 7 /* angel */ -#define L8 MAX_LEVEL - 8 /* avatar */ -#define IM LEVEL_IMMORTAL /* avatar */ -#define HE LEVEL_HERO /* hero */ - -#define COM_INGORE 1 - - -/* - * Structure for a command in the command lookup table. - */ -struct cmd_type -{ - char * const name; - DO_FUN * do_fun; - sh_int position; - sh_int level; - sh_int log; - sh_int show; -}; - -/* the command table itself */ -extern const struct cmd_type cmd_table []; - -/* - * Command functions. - * Defined in act_*.c (mostly). - */ -DECLARE_DO_FUN( do_advance ); -DECLARE_DO_FUN( do_affects ); -DECLARE_DO_FUN( do_afk ); -DECLARE_DO_FUN( do_alia ); -DECLARE_DO_FUN( do_alias ); -DECLARE_DO_FUN( do_allow ); -DECLARE_DO_FUN( do_answer ); -DECLARE_DO_FUN( do_areas ); -DECLARE_DO_FUN( do_at ); -DECLARE_DO_FUN( do_auction ); -DECLARE_DO_FUN( do_autoassist ); -DECLARE_DO_FUN( do_autoexit ); -DECLARE_DO_FUN( do_autogold ); -DECLARE_DO_FUN( do_autolist ); -DECLARE_DO_FUN( do_autoloot ); -DECLARE_DO_FUN( do_autosac ); -DECLARE_DO_FUN( do_autosplit ); -DECLARE_DO_FUN( do_backstab ); -DECLARE_DO_FUN( do_bamfin ); -DECLARE_DO_FUN( do_bamfout ); -DECLARE_DO_FUN( do_ban ); -DECLARE_DO_FUN( do_bash ); -DECLARE_DO_FUN( do_berserk ); -DECLARE_DO_FUN( do_brandish ); -DECLARE_DO_FUN( do_brief ); -DECLARE_DO_FUN( do_bug ); -DECLARE_DO_FUN( do_buy ); -DECLARE_DO_FUN( do_cast ); -DECLARE_DO_FUN( do_changes ); -DECLARE_DO_FUN( do_channels ); -DECLARE_DO_FUN( do_clone ); -DECLARE_DO_FUN( do_close ); -DECLARE_DO_FUN( do_commands ); -DECLARE_DO_FUN( do_combine ); -DECLARE_DO_FUN( do_compact ); -DECLARE_DO_FUN( do_compare ); -DECLARE_DO_FUN( do_consider ); -DECLARE_DO_FUN( do_count ); -DECLARE_DO_FUN( do_credits ); -DECLARE_DO_FUN( do_deaf ); -DECLARE_DO_FUN( do_delet ); -DECLARE_DO_FUN( do_delete ); -DECLARE_DO_FUN( do_deny ); -DECLARE_DO_FUN( do_description ); -DECLARE_DO_FUN( do_dirt ); -DECLARE_DO_FUN( do_disarm ); -DECLARE_DO_FUN( do_disconnect ); -DECLARE_DO_FUN( do_down ); -DECLARE_DO_FUN( do_drink ); -DECLARE_DO_FUN( do_drop ); -DECLARE_DO_FUN( do_dump ); -DECLARE_DO_FUN( do_east ); -DECLARE_DO_FUN( do_eat ); -DECLARE_DO_FUN( do_echo ); -DECLARE_DO_FUN( do_emote ); -DECLARE_DO_FUN( do_enter ); -DECLARE_DO_FUN( do_envenom ); -DECLARE_DO_FUN( do_equipment ); -DECLARE_DO_FUN( do_examine ); -DECLARE_DO_FUN( do_exits ); -DECLARE_DO_FUN( do_fill ); -DECLARE_DO_FUN( do_flag ); -DECLARE_DO_FUN( do_flee ); -DECLARE_DO_FUN( do_follow ); -DECLARE_DO_FUN( do_force ); -DECLARE_DO_FUN( do_freeze ); -DECLARE_DO_FUN( do_gain ); -DECLARE_DO_FUN( do_get ); -DECLARE_DO_FUN( do_give ); -DECLARE_DO_FUN( do_gossip ); -DECLARE_DO_FUN( do_goto ); -DECLARE_DO_FUN( do_grats ); -DECLARE_DO_FUN( do_group ); -DECLARE_DO_FUN( do_groups ); -DECLARE_DO_FUN( do_gtell ); -DECLARE_DO_FUN( do_guild ); -DECLARE_DO_FUN( do_heal ); -DECLARE_DO_FUN( do_help ); -DECLARE_DO_FUN( do_hide ); -DECLARE_DO_FUN( do_holylight ); -DECLARE_DO_FUN( do_idea ); -DECLARE_DO_FUN( do_immtalk ); -DECLARE_DO_FUN( do_incognito ); -DECLARE_DO_FUN( do_clantalk ); -DECLARE_DO_FUN( do_imotd ); -DECLARE_DO_FUN( do_inventory ); -DECLARE_DO_FUN( do_invis ); -DECLARE_DO_FUN( do_kick ); -DECLARE_DO_FUN( do_kill ); -DECLARE_DO_FUN( do_list ); -DECLARE_DO_FUN( do_load ); -DECLARE_DO_FUN( do_lock ); -DECLARE_DO_FUN( do_log ); -DECLARE_DO_FUN( do_look ); -DECLARE_DO_FUN( do_memory ); -DECLARE_DO_FUN( do_mfind ); -DECLARE_DO_FUN( do_mload ); -DECLARE_DO_FUN( do_mset ); -DECLARE_DO_FUN( do_mstat ); -DECLARE_DO_FUN( do_mwhere ); -DECLARE_DO_FUN( do_motd ); -DECLARE_DO_FUN( do_murde ); -DECLARE_DO_FUN( do_murder ); -DECLARE_DO_FUN( do_music ); -DECLARE_DO_FUN( do_newlock ); -DECLARE_DO_FUN( do_news ); -DECLARE_DO_FUN( do_nochannels ); -DECLARE_DO_FUN( do_noemote ); -DECLARE_DO_FUN( do_nofollow ); -DECLARE_DO_FUN( do_noloot ); -DECLARE_DO_FUN( do_north ); -DECLARE_DO_FUN( do_noshout ); -DECLARE_DO_FUN( do_nosummon ); -DECLARE_DO_FUN( do_note ); -DECLARE_DO_FUN( do_notell ); -DECLARE_DO_FUN( do_ofind ); -DECLARE_DO_FUN( do_oload ); -DECLARE_DO_FUN( do_open ); -DECLARE_DO_FUN( do_order ); -DECLARE_DO_FUN( do_oset ); -DECLARE_DO_FUN( do_ostat ); -DECLARE_DO_FUN( do_outfit ); -DECLARE_DO_FUN( do_owhere ); -DECLARE_DO_FUN( do_pardon ); -DECLARE_DO_FUN( do_password ); -DECLARE_DO_FUN( do_peace ); -DECLARE_DO_FUN( do_pecho ); -DECLARE_DO_FUN( do_penalty ); -DECLARE_DO_FUN( do_permban ); -DECLARE_DO_FUN( do_pick ); -DECLARE_DO_FUN( do_play ); -DECLARE_DO_FUN( do_pmote ); -DECLARE_DO_FUN( do_pose ); -DECLARE_DO_FUN( do_pour ); -DECLARE_DO_FUN( do_practice ); -DECLARE_DO_FUN( do_prefi ); -DECLARE_DO_FUN( do_prefix ); -DECLARE_DO_FUN( do_prompt ); -DECLARE_DO_FUN( do_protect ); -DECLARE_DO_FUN( do_purge ); -DECLARE_DO_FUN( do_put ); -DECLARE_DO_FUN( do_quaff ); -DECLARE_DO_FUN( do_question ); -DECLARE_DO_FUN( do_qui ); -DECLARE_DO_FUN( do_quiet ); -DECLARE_DO_FUN( do_quit ); -DECLARE_DO_FUN( do_quote ); -DECLARE_DO_FUN( do_read ); -DECLARE_DO_FUN( do_reboo ); -DECLARE_DO_FUN( do_reboot ); -DECLARE_DO_FUN( do_recall ); -DECLARE_DO_FUN( do_recho ); -DECLARE_DO_FUN( do_recite ); -DECLARE_DO_FUN( do_remove ); -DECLARE_DO_FUN( do_rent ); -DECLARE_DO_FUN( do_replay ); -DECLARE_DO_FUN( do_reply ); -DECLARE_DO_FUN( do_report ); -DECLARE_DO_FUN( do_rescue ); -DECLARE_DO_FUN( do_rest ); -DECLARE_DO_FUN( do_restore ); -DECLARE_DO_FUN( do_return ); -DECLARE_DO_FUN( do_rset ); -DECLARE_DO_FUN( do_rstat ); -DECLARE_DO_FUN( do_rules ); -DECLARE_DO_FUN( do_sacrifice ); -DECLARE_DO_FUN( do_save ); -DECLARE_DO_FUN( do_say ); -DECLARE_DO_FUN( do_scan ); -DECLARE_DO_FUN( do_score ); -DECLARE_DO_FUN( do_scroll ); -DECLARE_DO_FUN( do_sell ); -DECLARE_DO_FUN( do_set ); -DECLARE_DO_FUN( do_shout ); -DECLARE_DO_FUN( do_show ); -DECLARE_DO_FUN( do_shutdow ); -DECLARE_DO_FUN( do_shutdown ); -DECLARE_DO_FUN( do_sit ); -DECLARE_DO_FUN( do_skills ); -DECLARE_DO_FUN( do_sla ); -DECLARE_DO_FUN( do_slay ); -DECLARE_DO_FUN( do_sleep ); -DECLARE_DO_FUN( do_slookup ); -DECLARE_DO_FUN( do_smote ); -DECLARE_DO_FUN( do_sneak ); -DECLARE_DO_FUN( do_snoop ); -DECLARE_DO_FUN( do_socials ); -DECLARE_DO_FUN( do_south ); -DECLARE_DO_FUN( do_sockets ); -DECLARE_DO_FUN( do_spells ); -DECLARE_DO_FUN( do_split ); -DECLARE_DO_FUN( do_sset ); -DECLARE_DO_FUN( do_stand ); -DECLARE_DO_FUN( do_stat ); -DECLARE_DO_FUN( do_steal ); -DECLARE_DO_FUN( do_story ); -DECLARE_DO_FUN( do_string ); -DECLARE_DO_FUN( do_switch ); -DECLARE_DO_FUN( do_tell ); -DECLARE_DO_FUN( do_time ); -DECLARE_DO_FUN( do_title ); -DECLARE_DO_FUN( do_train ); -DECLARE_DO_FUN( do_transfer ); -DECLARE_DO_FUN( do_trip ); -DECLARE_DO_FUN( do_trust ); -DECLARE_DO_FUN( do_typo ); -DECLARE_DO_FUN( do_unalias ); -DECLARE_DO_FUN( do_unlock ); -DECLARE_DO_FUN( do_unread ); -DECLARE_DO_FUN( do_up ); -DECLARE_DO_FUN( do_value ); -DECLARE_DO_FUN( do_visible ); -DECLARE_DO_FUN( do_violate ); -DECLARE_DO_FUN( do_vnum ); -DECLARE_DO_FUN( do_wake ); -DECLARE_DO_FUN( do_wear ); -DECLARE_DO_FUN( do_weather ); -DECLARE_DO_FUN( do_west ); -DECLARE_DO_FUN( do_where ); -DECLARE_DO_FUN( do_who ); -DECLARE_DO_FUN( do_whois ); -DECLARE_DO_FUN( do_wimpy ); -DECLARE_DO_FUN( do_wizhelp ); -DECLARE_DO_FUN( do_wizlock ); -DECLARE_DO_FUN( do_wizlist ); -DECLARE_DO_FUN( do_wiznet ); -DECLARE_DO_FUN( do_worth ); -DECLARE_DO_FUN( do_yell ); -DECLARE_DO_FUN( do_zap ); -DECLARE_DO_FUN( do_zecho ); diff --git a/archive/src/lookup.c b/archive/src/lookup.c deleted file mode 100644 index 512b964..0000000 --- a/archive/src/lookup.c +++ /dev/null @@ -1,106 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#endif -#include -#include -#include "merc.h" -#include "tables.h" - -int flag_lookup (const char *name, const struct flag_type *flag_table) -{ - int flag; - - for (flag = 0; flag_table[flag].name != NULL; flag++) - { - if (LOWER(name[0]) == LOWER(flag_table[flag].name[0]) - && !str_prefix(name,flag_table[flag].name)) - return flag_table[flag].bit; - } - - return 0; -} - -int clan_lookup(const char *name) -{ - int clan; - - for (clan = 0; clan < MAX_CLAN; clan++) - { - if (LOWER(name[0]) == LOWER(clan_table[clan].name[0]) - && !str_prefix(name,clan_table[clan].name)) - return clan; - } - - return 0; -} - -int position_lookup (const char *name) -{ - int pos; - - for (pos = 0; position_table[pos].name != NULL; pos++) - { - if (LOWER(name[0]) == LOWER(position_table[pos].name[0]) - && !str_prefix(name,position_table[pos].name)) - return pos; - } - - return -1; -} - -int sex_lookup (const char *name) -{ - int sex; - - for (sex = 0; sex_table[sex].name != NULL; sex++) - { - if (LOWER(name[0]) == LOWER(sex_table[sex].name[0]) - && !str_prefix(name,sex_table[sex].name)) - return sex; - } - - return -1; -} - -int size_lookup (const char *name) -{ - int size; - - for ( size = 0; size_table[size].name != NULL; size++) - { - if (LOWER(name[0]) == LOWER(size_table[size].name[0]) - && !str_prefix( name,size_table[size].name)) - return size; - } - - return -1; -} diff --git a/archive/src/lookup.h b/archive/src/lookup.h deleted file mode 100644 index bf43303..0000000 --- a/archive/src/lookup.h +++ /dev/null @@ -1,32 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - - -int clan_lookup args( (const char *name) ); -int position_lookup args( (const char *name) ); -int sex_lookup args( (const char *name) ); -int size_lookup args( (const char *name) ); diff --git a/archive/src/magic.c b/archive/src/magic.c deleted file mode 100644 index f8bfae6..0000000 --- a/archive/src/magic.c +++ /dev/null @@ -1,4699 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#endif -#include -#include -#include -#include -#include "merc.h" -#include "interp.h" -#include "magic.h" -#include "recycle.h" - -/* - * Local functions. - */ -void say_spell args( ( CHAR_DATA *ch, int sn ) ); - -/* imported functions */ -bool remove_obj args( ( CHAR_DATA *ch, int iWear, bool fReplace ) ); -void wear_obj args( ( CHAR_DATA *ch, OBJ_DATA *obj, bool fReplace ) ); - - - -/* - * Lookup a skill by name. - */ -int skill_lookup( const char *name ) -{ - int sn; - - for ( sn = 0; sn < MAX_SKILL; sn++ ) - { - if ( skill_table[sn].name == NULL ) - break; - if ( LOWER(name[0]) == LOWER(skill_table[sn].name[0]) - && !str_prefix( name, skill_table[sn].name ) ) - return sn; - } - - return -1; -} - -int find_spell( CHAR_DATA *ch, const char *name ) -{ - /* finds a spell the character can cast if possible */ - int sn, found = -1; - - if (IS_NPC(ch)) - return skill_lookup(name); - - for ( sn = 0; sn < MAX_SKILL; sn++ ) - { - if (skill_table[sn].name == NULL) - break; - if (LOWER(name[0]) == LOWER(skill_table[sn].name[0]) - && !str_prefix(name,skill_table[sn].name)) - { - if ( found == -1) - found = sn; - if (ch->level >= skill_table[sn].skill_level[ch->class] - && ch->pcdata->learned[sn] > 0) - return sn; - } - } - return found; -} - - - -/* - * Lookup a skill by slot number. - * Used for object loading. - */ -int slot_lookup( int slot ) -{ - extern bool fBootDb; - int sn; - - if ( slot <= 0 ) - return -1; - - for ( sn = 0; sn < MAX_SKILL; sn++ ) - { - if ( slot == skill_table[sn].slot ) - return sn; - } - - if ( fBootDb ) - { - bug( "Slot_lookup: bad slot %d.", slot ); - abort( ); - } - - return -1; -} - - - -/* - * Utter mystical words for an sn. - */ -void say_spell( CHAR_DATA *ch, int sn ) -{ - char buf [MAX_STRING_LENGTH]; - char buf2 [MAX_STRING_LENGTH]; - CHAR_DATA *rch; - char *pName; - int iSyl; - int length; - - struct syl_type - { - char * old; - char * new; - }; - - static const struct syl_type syl_table[] = - { - { " ", " " }, - { "ar", "abra" }, - { "au", "kada" }, - { "bless", "fido" }, - { "blind", "nose" }, - { "bur", "mosa" }, - { "cu", "judi" }, - { "de", "oculo" }, - { "en", "unso" }, - { "light", "dies" }, - { "lo", "hi" }, - { "mor", "zak" }, - { "move", "sido" }, - { "ness", "lacri" }, - { "ning", "illa" }, - { "per", "duda" }, - { "ra", "gru" }, - { "fresh", "ima" }, - { "re", "candus" }, - { "son", "sabru" }, - { "tect", "infra" }, - { "tri", "cula" }, - { "ven", "nofo" }, - { "a", "a" }, { "b", "b" }, { "c", "q" }, { "d", "e" }, - { "e", "z" }, { "f", "y" }, { "g", "o" }, { "h", "p" }, - { "i", "u" }, { "j", "y" }, { "k", "t" }, { "l", "r" }, - { "m", "w" }, { "n", "i" }, { "o", "a" }, { "p", "s" }, - { "q", "d" }, { "r", "f" }, { "s", "g" }, { "t", "h" }, - { "u", "j" }, { "v", "z" }, { "w", "x" }, { "x", "n" }, - { "y", "l" }, { "z", "k" }, - { "", "" } - }; - - buf[0] = '\0'; - for ( pName = skill_table[sn].name; *pName != '\0'; pName += length ) - { - for ( iSyl = 0; (length = strlen(syl_table[iSyl].old)) != 0; iSyl++ ) - { - if ( !str_prefix( syl_table[iSyl].old, pName ) ) - { - strcat( buf, syl_table[iSyl].new ); - break; - } - } - - if ( length == 0 ) - length = 1; - } - - sprintf( buf2, "$n utters the words, '%s'.", buf ); - sprintf( buf, "$n utters the words, '%s'.", skill_table[sn].name ); - - for ( rch = ch->in_room->people; rch; rch = rch->next_in_room ) - { - if ( rch != ch ) - act((!IS_NPC(rch) && ch->class==rch->class) ? buf : buf2, - ch, NULL, rch, TO_VICT ); - } - - return; -} - - - -/* - * Compute a saving throw. - * Negative apply's make saving throw better. - */ -bool saves_spell( int level, CHAR_DATA *victim, int dam_type ) -{ - int save; - - save = 50 + ( victim->level - level) * 5 - victim->saving_throw * 2; - if (IS_AFFECTED(victim,AFF_BERSERK)) - save += victim->level/2; - - switch(check_immune(victim,dam_type)) - { - case IS_IMMUNE: return TRUE; - case IS_RESISTANT: save += 2; break; - case IS_VULNERABLE: save -= 2; break; - } - - if (!IS_NPC(victim) && class_table[victim->class].fMana) - save = 9 * save / 10; - save = URANGE( 5, save, 95 ); - return number_percent( ) < save; -} - -/* RT save for dispels */ - -bool saves_dispel( int dis_level, int spell_level, int duration) -{ - int save; - - if (duration == -1) - spell_level += 5; - /* very hard to dispel permanent effects */ - - save = 50 + (spell_level - dis_level) * 5; - save = URANGE( 5, save, 95 ); - return number_percent( ) < save; -} - -/* co-routine for dispel magic and cancellation */ - -bool check_dispel( int dis_level, CHAR_DATA *victim, int sn) -{ - AFFECT_DATA *af; - - if (is_affected(victim, sn)) - { - for ( af = victim->affected; af != NULL; af = af->next ) - { - if ( af->type == sn ) - { - if (!saves_dispel(dis_level,af->level,af->duration)) - { - affect_strip(victim,sn); - if ( skill_table[sn].msg_off ) - { - send_to_char( skill_table[sn].msg_off, victim ); - send_to_char( "\n\r", victim ); - } - return TRUE; - } - else - af->level--; - } - } - } - return FALSE; -} - -/* for finding mana costs -- temporary version */ -int mana_cost (CHAR_DATA *ch, int min_mana, int level) -{ - if (ch->level + 2 == level) - return 1000; - return UMAX(min_mana,(100/(2 + ch->level - level))); -} - - - -/* - * The kludgy global is for spells who want more stuff from command line. - */ -char *target_name; - -void do_cast( CHAR_DATA *ch, char *argument ) -{ - char arg1[MAX_INPUT_LENGTH]; - char arg2[MAX_INPUT_LENGTH]; - CHAR_DATA *victim; - OBJ_DATA *obj; - void *vo; - int mana; - int sn; - int target; - - /* - * Switched NPC's can cast spells, but others can't. - */ - if ( IS_NPC(ch) && ch->desc == NULL) - return; - - target_name = one_argument( argument, arg1 ); - one_argument( target_name, arg2 ); - - if ( arg1[0] == '\0' ) - { - send_to_char( "Cast which what where?\n\r", ch ); - return; - } - - if ((sn = find_spell(ch,arg1)) < 1 - || skill_table[sn].spell_fun == spell_null - || (!IS_NPC(ch) && (ch->level < skill_table[sn].skill_level[ch->class] - || ch->pcdata->learned[sn] == 0))) - { - send_to_char( "You don't know any spells of that name.\n\r", ch ); - return; - } - - if ( ch->position < skill_table[sn].minimum_position ) - { - send_to_char( "You can't concentrate enough.\n\r", ch ); - return; - } - - if (ch->level + 2 == skill_table[sn].skill_level[ch->class]) - mana = 50; - else - mana = UMAX( - skill_table[sn].min_mana, - 100 / ( 2 + ch->level - skill_table[sn].skill_level[ch->class] ) ); - - /* - * Locate targets. - */ - victim = NULL; - obj = NULL; - vo = NULL; - target = TARGET_NONE; - - switch ( skill_table[sn].target ) - { - default: - bug( "Do_cast: bad target for sn %d.", sn ); - return; - - case TAR_IGNORE: - break; - - case TAR_CHAR_OFFENSIVE: - if ( arg2[0] == '\0' ) - { - if ( ( victim = ch->fighting ) == NULL ) - { - send_to_char( "Cast the spell on whom?\n\r", ch ); - return; - } - } - else - { - if ( ( victim = get_char_room( ch, target_name ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - } -/* - if ( ch == victim ) - { - send_to_char( "You can't do that to yourself.\n\r", ch ); - return; - } -*/ - - - if ( !IS_NPC(ch) ) - { - - if (is_safe(ch,victim) && victim != ch) - { - send_to_char("Not on that target.\n\r",ch); - return; - } - check_killer(ch,victim); - } - - if ( IS_AFFECTED(ch, AFF_CHARM) && ch->master == victim ) - { - send_to_char( "You can't do that on your own follower.\n\r", - ch ); - return; - } - - vo = (void *) victim; - target = TARGET_CHAR; - break; - - case TAR_CHAR_DEFENSIVE: - if ( arg2[0] == '\0' ) - { - victim = ch; - } - else - { - if ( ( victim = get_char_room( ch, target_name ) ) == NULL ) - { - send_to_char( "They aren't here.\n\r", ch ); - return; - } - } - - vo = (void *) victim; - target = TARGET_CHAR; - break; - - case TAR_CHAR_SELF: - if ( arg2[0] != '\0' && !is_name( target_name, ch->name ) ) - { - send_to_char( "You cannot cast this spell on another.\n\r", ch ); - return; - } - - vo = (void *) ch; - target = TARGET_CHAR; - break; - - case TAR_OBJ_INV: - if ( arg2[0] == '\0' ) - { - send_to_char( "What should the spell be cast upon?\n\r", ch ); - return; - } - - if ( ( obj = get_obj_carry( ch, target_name, ch ) ) == NULL ) - { - send_to_char( "You are not carrying that.\n\r", ch ); - return; - } - - vo = (void *) obj; - target = TARGET_OBJ; - break; - - case TAR_OBJ_CHAR_OFF: - if (arg2[0] == '\0') - { - if ((victim = ch->fighting) == NULL) - { - send_to_char("Cast the spell on whom or what?\n\r",ch); - return; - } - - target = TARGET_CHAR; - } - else if ((victim = get_char_room(ch,target_name)) != NULL) - { - target = TARGET_CHAR; - } - - if (target == TARGET_CHAR) /* check the sanity of the attack */ - { - if(is_safe_spell(ch,victim,FALSE) && victim != ch) - { - send_to_char("Not on that target.\n\r",ch); - return; - } - - if ( IS_AFFECTED(ch, AFF_CHARM) && ch->master == victim ) - { - send_to_char( "You can't do that on your own follower.\n\r", - ch ); - return; - } - - if (!IS_NPC(ch)) - check_killer(ch,victim); - - vo = (void *) victim; - } - else if ((obj = get_obj_here(ch,target_name)) != NULL) - { - vo = (void *) obj; - target = TARGET_OBJ; - } - else - { - send_to_char("You don't see that here.\n\r",ch); - return; - } - break; - - case TAR_OBJ_CHAR_DEF: - if (arg2[0] == '\0') - { - vo = (void *) ch; - target = TARGET_CHAR; - } - else if ((victim = get_char_room(ch,target_name)) != NULL) - { - vo = (void *) victim; - target = TARGET_CHAR; - } - else if ((obj = get_obj_carry(ch,target_name,ch)) != NULL) - { - vo = (void *) obj; - target = TARGET_OBJ; - } - else - { - send_to_char("You don't see that here.\n\r",ch); - return; - } - break; - } - - if ( !IS_NPC(ch) && ch->mana < mana ) - { - send_to_char( "You don't have enough mana.\n\r", ch ); - return; - } - - if ( str_cmp( skill_table[sn].name, "ventriloquate" ) ) - say_spell( ch, sn ); - - WAIT_STATE( ch, skill_table[sn].beats ); - - if ( number_percent( ) > get_skill(ch,sn) ) - { - send_to_char( "You lost your concentration.\n\r", ch ); - check_improve(ch,sn,FALSE,1); - ch->mana -= mana / 2; - } - else - { - ch->mana -= mana; - if (IS_NPC(ch) || class_table[ch->class].fMana) - /* class has spells */ - (*skill_table[sn].spell_fun) ( sn, ch->level, ch, vo,target); - else - (*skill_table[sn].spell_fun) (sn, 3 * ch->level/4, ch, vo,target); - check_improve(ch,sn,TRUE,1); - } - - if ((skill_table[sn].target == TAR_CHAR_OFFENSIVE - || (skill_table[sn].target == TAR_OBJ_CHAR_OFF && target == TARGET_CHAR)) - && victim != ch - && victim->master != ch) - { - CHAR_DATA *vch; - CHAR_DATA *vch_next; - - for ( vch = ch->in_room->people; vch; vch = vch_next ) - { - vch_next = vch->next_in_room; - if ( victim == vch && victim->fighting == NULL ) - { check_killer(victim,ch); - multi_hit( victim, ch, TYPE_UNDEFINED ); - break; - } - } - } - - return; -} - - - -/* - * Cast spells at targets using a magical object. - */ -void obj_cast_spell( int sn, int level, CHAR_DATA *ch, CHAR_DATA *victim, OBJ_DATA *obj ) -{ - void *vo; - int target = TARGET_NONE; - - if ( sn <= 0 ) - return; - - if ( sn >= MAX_SKILL || skill_table[sn].spell_fun == 0 ) - { - bug( "Obj_cast_spell: bad sn %d.", sn ); - return; - } - - switch ( skill_table[sn].target ) - { - default: - bug( "Obj_cast_spell: bad target for sn %d.", sn ); - return; - - case TAR_IGNORE: - vo = NULL; - break; - - case TAR_CHAR_OFFENSIVE: - if ( victim == NULL ) - victim = ch->fighting; - if ( victim == NULL ) - { - send_to_char( "You can't do that.\n\r", ch ); - return; - } - if (is_safe(ch,victim) && ch != victim) - { - send_to_char("Something isn't right...\n\r",ch); - return; - } - vo = (void *) victim; - target = TARGET_CHAR; - break; - - case TAR_CHAR_DEFENSIVE: - case TAR_CHAR_SELF: - if ( victim == NULL ) - victim = ch; - vo = (void *) victim; - target = TARGET_CHAR; - break; - - case TAR_OBJ_INV: - if ( obj == NULL ) - { - send_to_char( "You can't do that.\n\r", ch ); - return; - } - vo = (void *) obj; - target = TARGET_OBJ; - break; - - case TAR_OBJ_CHAR_OFF: - if ( victim == NULL && obj == NULL) - { if (ch->fighting != NULL) - victim = ch->fighting; - else - { - send_to_char("You can't do that.\n\r",ch); - return; - } - } - if (victim != NULL) - { - if (is_safe_spell(ch,victim,FALSE) && ch != victim) - { - send_to_char("Somehting isn't right...\n\r",ch); - return; - } - - vo = (void *) victim; - target = TARGET_CHAR; - } - else - { - vo = (void *) obj; - target = TARGET_OBJ; - } - break; - - - case TAR_OBJ_CHAR_DEF: - if (victim == NULL && obj == NULL) - { - vo = (void *) ch; - target = TARGET_CHAR; - } - else if (victim != NULL) - { - vo = (void *) victim; - target = TARGET_CHAR; - } - else - { - vo = (void *) obj; - target = TARGET_OBJ; - } - - break; - } - - target_name = ""; - (*skill_table[sn].spell_fun) ( sn, level, ch, vo,target); - - - - if ( (skill_table[sn].target == TAR_CHAR_OFFENSIVE - || (skill_table[sn].target == TAR_OBJ_CHAR_OFF && target == TARGET_CHAR)) - && victim != ch - && victim->master != ch ) - { - CHAR_DATA *vch; - CHAR_DATA *vch_next; - - for ( vch = ch->in_room->people; vch; vch = vch_next ) - { - vch_next = vch->next_in_room; - if ( victim == vch && victim->fighting == NULL ) - { - check_killer(victim,ch); - multi_hit( victim, ch, TYPE_UNDEFINED ); - break; - } - } - } - - return; -} - - - -/* - * Spell functions. - */ -void spell_acid_blast( int sn, int level, CHAR_DATA *ch, void *vo, int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int dam; - - dam = dice( level, 12 ); - if ( saves_spell( level, victim, DAM_ACID ) ) - dam /= 2; - damage( ch, victim, dam, sn, DAM_ACID, TRUE); - return; -} - - - -void spell_armor( int sn, int level, CHAR_DATA *ch, void *vo, int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( is_affected( victim, sn ) ) - { - if (victim == ch) - send_to_char("You are already armored.\n\r",ch); - else - act("$N is already armored.",ch,NULL,victim,TO_CHAR); - return; - } - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = 24; - af.modifier = -20; - af.location = APPLY_AC; - af.bitvector = 0; - affect_to_char( victim, &af ); - send_to_char( "You feel someone protecting you.\n\r", victim ); - if ( ch != victim ) - act("$N is protected by your magic.",ch,NULL,victim,TO_CHAR); - return; -} - - - -void spell_bless( int sn, int level, CHAR_DATA *ch, void *vo, int target) -{ - CHAR_DATA *victim; - OBJ_DATA *obj; - AFFECT_DATA af; - - /* deal with the object case first */ - if (target == TARGET_OBJ) - { - obj = (OBJ_DATA *) vo; - if (IS_OBJ_STAT(obj,ITEM_BLESS)) - { - act("$p is already blessed.",ch,obj,NULL,TO_CHAR); - return; - } - - if (IS_OBJ_STAT(obj,ITEM_EVIL)) - { - AFFECT_DATA *paf; - - paf = affect_find(obj->affected,gsn_curse); - if (!saves_dispel(level,paf != NULL ? paf->level : obj->level,0)) - { - if (paf != NULL) - affect_remove_obj(obj,paf); - act("$p glows a pale blue.",ch,obj,NULL,TO_ALL); - REMOVE_BIT(obj->extra_flags,ITEM_EVIL); - return; - } - else - { - act("The evil of $p is too powerful for you to overcome.", - ch,obj,NULL,TO_CHAR); - return; - } - } - - af.where = TO_OBJECT; - af.type = sn; - af.level = level; - af.duration = 6 + level; - af.location = APPLY_SAVES; - af.modifier = -1; - af.bitvector = ITEM_BLESS; - affect_to_obj(obj,&af); - - act("$p glows with a holy aura.",ch,obj,NULL,TO_ALL); - - if (obj->wear_loc != WEAR_NONE) - ch->saving_throw -= 1; - return; - } - - /* character target */ - victim = (CHAR_DATA *) vo; - - - if ( victim->position == POS_FIGHTING || is_affected( victim, sn ) ) - { - if (victim == ch) - send_to_char("You are already blessed.\n\r",ch); - else - act("$N already has divine favor.",ch,NULL,victim,TO_CHAR); - return; - } - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = 6+level; - af.location = APPLY_HITROLL; - af.modifier = level / 8; - af.bitvector = 0; - affect_to_char( victim, &af ); - - af.location = APPLY_SAVING_SPELL; - af.modifier = 0 - level / 8; - affect_to_char( victim, &af ); - send_to_char( "You feel righteous.\n\r", victim ); - if ( ch != victim ) - act("You grant $N the favor of your god.",ch,NULL,victim,TO_CHAR); - return; -} - - - -void spell_blindness( int sn, int level, CHAR_DATA *ch, void *vo, int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( IS_AFFECTED(victim, AFF_BLIND) || saves_spell(level,victim,DAM_OTHER)) - return; - - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.location = APPLY_HITROLL; - af.modifier = -4; - af.duration = 1+level; - af.bitvector = AFF_BLIND; - affect_to_char( victim, &af ); - send_to_char( "You are blinded!\n\r", victim ); - act("$n appears to be blinded.",victim,NULL,NULL,TO_ROOM); - return; -} - - - -void spell_burning_hands(int sn,int level, CHAR_DATA *ch, void *vo, int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - static const sh_int dam_each[] = - { - 0, - 0, 0, 0, 0, 14, 17, 20, 23, 26, 29, - 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, - 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, - 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, - 44, 44, 45, 45, 46, 46, 47, 47, 48, 48 - }; - int dam; - - level = UMIN(level, sizeof(dam_each)/sizeof(dam_each[0]) - 1); - level = UMAX(0, level); - dam = number_range( dam_each[level] / 2, dam_each[level] * 2 ); - if ( saves_spell( level, victim,DAM_FIRE) ) - dam /= 2; - damage( ch, victim, dam, sn, DAM_FIRE,TRUE); - return; -} - - - -void spell_call_lightning( int sn, int level,CHAR_DATA *ch,void *vo,int target) -{ - CHAR_DATA *vch; - CHAR_DATA *vch_next; - int dam; - - if ( !IS_OUTSIDE(ch) ) - { - send_to_char( "You must be out of doors.\n\r", ch ); - return; - } - - if ( weather_info.sky < SKY_RAINING ) - { - send_to_char( "You need bad weather.\n\r", ch ); - return; - } - - dam = dice(level/2, 8); - - send_to_char( "Mota's lightning strikes your foes!\n\r", ch ); - act( "$n calls Mota's lightning to strike $s foes!", - ch, NULL, NULL, TO_ROOM ); - - for ( vch = char_list; vch != NULL; vch = vch_next ) - { - vch_next = vch->next; - if ( vch->in_room == NULL ) - continue; - if ( vch->in_room == ch->in_room ) - { - if ( vch != ch && ( IS_NPC(ch) ? !IS_NPC(vch) : IS_NPC(vch) ) ) - damage( ch, vch, saves_spell( level,vch,DAM_LIGHTNING) - ? dam / 2 : dam, sn,DAM_LIGHTNING,TRUE); - continue; - } - - if ( vch->in_room->area == ch->in_room->area - && IS_OUTSIDE(vch) - && IS_AWAKE(vch) ) - send_to_char( "Lightning flashes in the sky.\n\r", vch ); - } - - return; -} - -/* RT calm spell stops all fighting in the room */ - -void spell_calm( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *vch; - int mlevel = 0; - int count = 0; - int high_level = 0; - int chance; - AFFECT_DATA af; - - /* get sum of all mobile levels in the room */ - for (vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room) - { - if (vch->position == POS_FIGHTING) - { - count++; - if (IS_NPC(vch)) - mlevel += vch->level; - else - mlevel += vch->level/2; - high_level = UMAX(high_level,vch->level); - } - } - - /* compute chance of stopping combat */ - chance = 4 * level - high_level + 2 * count; - - if (IS_IMMORTAL(ch)) /* always works */ - mlevel = 0; - - if (number_range(0, chance) >= mlevel) /* hard to stop large fights */ - { - for (vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room) - { - if (IS_NPC(vch) && (IS_SET(vch->imm_flags,IMM_MAGIC) || - IS_SET(vch->act,ACT_UNDEAD))) - return; - - if (IS_AFFECTED(vch,AFF_CALM) || IS_AFFECTED(vch,AFF_BERSERK) - || is_affected(vch,skill_lookup("frenzy"))) - return; - - send_to_char("A wave of calm passes over you.\n\r",vch); - - if (vch->fighting || vch->position == POS_FIGHTING) - stop_fighting(vch,FALSE); - - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level/4; - af.location = APPLY_HITROLL; - if (!IS_NPC(vch)) - af.modifier = -5; - else - af.modifier = -2; - af.bitvector = AFF_CALM; - affect_to_char(vch,&af); - - af.location = APPLY_DAMROLL; - affect_to_char(vch,&af); - } - } -} - -void spell_cancellation( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - bool found = FALSE; - - level += 2; - - if ((!IS_NPC(ch) && IS_NPC(victim) && - !(IS_AFFECTED(ch, AFF_CHARM) && ch->master == victim) ) || - (IS_NPC(ch) && !IS_NPC(victim)) ) - { - send_to_char("You failed, try dispel magic.\n\r",ch); - return; - } - - /* unlike dispel magic, the victim gets NO save */ - - /* begin running through the spells */ - - if (check_dispel(level,victim,skill_lookup("armor"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("bless"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("blindness"))) - { - found = TRUE; - act("$n is no longer blinded.",victim,NULL,NULL,TO_ROOM); - } - - if (check_dispel(level,victim,skill_lookup("calm"))) - { - found = TRUE; - act("$n no longer looks so peaceful...",victim,NULL,NULL,TO_ROOM); - } - - if (check_dispel(level,victim,skill_lookup("change sex"))) - { - found = TRUE; - act("$n looks more like $mself again.",victim,NULL,NULL,TO_ROOM); - } - - if (check_dispel(level,victim,skill_lookup("charm person"))) - { - found = TRUE; - act("$n regains $s free will.",victim,NULL,NULL,TO_ROOM); - } - - if (check_dispel(level,victim,skill_lookup("chill touch"))) - { - found = TRUE; - act("$n looks warmer.",victim,NULL,NULL,TO_ROOM); - } - - if (check_dispel(level,victim,skill_lookup("curse"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("detect evil"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("detect good"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("detect hidden"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("detect invis"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("detect magic"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("faerie fire"))) - { - act("$n's outline fades.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("fly"))) - { - act("$n falls to the ground!",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("frenzy"))) - { - act("$n no longer looks so wild.",victim,NULL,NULL,TO_ROOM);; - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("giant strength"))) - { - act("$n no longer looks so mighty.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("haste"))) - { - act("$n is no longer moving so quickly.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("infravision"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("invis"))) - { - act("$n fades into existance.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("mass invis"))) - { - act("$n fades into existance.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("pass door"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("protection evil"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("protection good"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("sanctuary"))) - { - act("The white aura around $n's body vanishes.", - victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("shield"))) - { - act("The shield protecting $n vanishes.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("sleep"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("slow"))) - { - act("$n is no longer moving so slowly.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("stone skin"))) - { - act("$n's skin regains its normal texture.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("weaken"))) - { - act("$n looks stronger.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (found) - send_to_char("Ok.\n\r",ch); - else - send_to_char("Spell failed.\n\r",ch); -} - -void spell_cause_light( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - damage( ch, (CHAR_DATA *) vo, dice(1, 8) + level / 3, sn,DAM_HARM,TRUE); - return; -} - - - -void spell_cause_critical(int sn,int level,CHAR_DATA *ch,void *vo,int target) -{ - damage( ch, (CHAR_DATA *) vo, dice(3, 8) + level - 6, sn,DAM_HARM,TRUE); - return; -} - - - -void spell_cause_serious(int sn,int level,CHAR_DATA *ch,void *vo,int target) -{ - damage( ch, (CHAR_DATA *) vo, dice(2, 8) + level / 2, sn,DAM_HARM,TRUE); - return; -} - -void spell_chain_lightning(int sn,int level,CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - CHAR_DATA *tmp_vict,*last_vict,*next_vict; - bool found; - int dam; - - /* first strike */ - - act("A lightning bolt leaps from $n's hand and arcs to $N.", - ch,NULL,victim,TO_ROOM); - act("A lightning bolt leaps from your hand and arcs to $N.", - ch,NULL,victim,TO_CHAR); - act("A lightning bolt leaps from $n's hand and hits you!", - ch,NULL,victim,TO_VICT); - - dam = dice(level,6); - if (saves_spell(level,victim,DAM_LIGHTNING)) - dam /= 3; - damage(ch,victim,dam,sn,DAM_LIGHTNING,TRUE); - last_vict = victim; - level -= 4; /* decrement damage */ - - /* new targets */ - while (level > 0) - { - found = FALSE; - for (tmp_vict = ch->in_room->people; - tmp_vict != NULL; - tmp_vict = next_vict) - { - next_vict = tmp_vict->next_in_room; - if (!is_safe_spell(ch,tmp_vict,TRUE) && tmp_vict != last_vict) - { - found = TRUE; - last_vict = tmp_vict; - act("The bolt arcs to $n!",tmp_vict,NULL,NULL,TO_ROOM); - act("The bolt hits you!",tmp_vict,NULL,NULL,TO_CHAR); - dam = dice(level,6); - if (saves_spell(level,tmp_vict,DAM_LIGHTNING)) - dam /= 3; - damage(ch,tmp_vict,dam,sn,DAM_LIGHTNING,TRUE); - level -= 4; /* decrement damage */ - } - } /* end target searching loop */ - - if (!found) /* no target found, hit the caster */ - { - if (ch == NULL) - return; - - if (last_vict == ch) /* no double hits */ - { - act("The bolt seems to have fizzled out.",ch,NULL,NULL,TO_ROOM); - act("The bolt grounds out through your body.", - ch,NULL,NULL,TO_CHAR); - return; - } - - last_vict = ch; - act("The bolt arcs to $n...whoops!",ch,NULL,NULL,TO_ROOM); - send_to_char("You are struck by your own lightning!\n\r",ch); - dam = dice(level,6); - if (saves_spell(level,ch,DAM_LIGHTNING)) - dam /= 3; - damage(ch,ch,dam,sn,DAM_LIGHTNING,TRUE); - level -= 4; /* decrement damage */ - if (ch == NULL) - return; - } - /* now go back and find more targets */ - } -} - - -void spell_change_sex( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( is_affected( victim, sn )) - { - if (victim == ch) - send_to_char("You've already been changed.\n\r",ch); - else - act("$N has already had $s(?) sex changed.",ch,NULL,victim,TO_CHAR); - return; - } - if (saves_spell(level , victim,DAM_OTHER)) - return; - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = 2 * level; - af.location = APPLY_SEX; - do - { - af.modifier = number_range( 0, 2 ) - victim->sex; - } - while ( af.modifier == 0 ); - af.bitvector = 0; - affect_to_char( victim, &af ); - send_to_char( "You feel different.\n\r", victim ); - act("$n doesn't look like $mself anymore...",victim,NULL,NULL,TO_ROOM); - return; -} - - - -void spell_charm_person( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if (is_safe(ch,victim)) return; - - if ( victim == ch ) - { - send_to_char( "You like yourself even better!\n\r", ch ); - return; - } - - if ( IS_AFFECTED(victim, AFF_CHARM) - || IS_AFFECTED(ch, AFF_CHARM) - || level < victim->level - || IS_SET(victim->imm_flags,IMM_CHARM) - || saves_spell( level, victim,DAM_CHARM) ) - return; - - - if (IS_SET(victim->in_room->room_flags,ROOM_LAW)) - { - send_to_char( - "The mayor does not allow charming in the city limits.\n\r",ch); - return; - } - - if ( victim->master ) - stop_follower( victim ); - add_follower( victim, ch ); - victim->leader = ch; - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = number_fuzzy( level / 4 ); - af.location = 0; - af.modifier = 0; - af.bitvector = AFF_CHARM; - affect_to_char( victim, &af ); - act( "Isn't $n just so nice?", ch, NULL, victim, TO_VICT ); - if ( ch != victim ) - act("$N looks at you with adoring eyes.",ch,NULL,victim,TO_CHAR); - return; -} - - - -void spell_chill_touch( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - static const sh_int dam_each[] = - { - 0, - 0, 0, 6, 7, 8, 9, 12, 13, 13, 13, - 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, - 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, - 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, - 24, 24, 24, 25, 25, 25, 26, 26, 26, 27 - }; - AFFECT_DATA af; - int dam; - - level = UMIN(level, sizeof(dam_each)/sizeof(dam_each[0]) - 1); - level = UMAX(0, level); - dam = number_range( dam_each[level] / 2, dam_each[level] * 2 ); - if ( !saves_spell( level, victim,DAM_COLD ) ) - { - act("$n turns blue and shivers.",victim,NULL,NULL,TO_ROOM); - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = 6; - af.location = APPLY_STR; - af.modifier = -1; - af.bitvector = 0; - affect_join( victim, &af ); - } - else - { - dam /= 2; - } - - damage( ch, victim, dam, sn, DAM_COLD,TRUE ); - return; -} - - - -void spell_colour_spray( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - static const sh_int dam_each[] = - { - 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 30, 35, 40, 45, 50, 55, 55, 55, 56, 57, - 58, 58, 59, 60, 61, 61, 62, 63, 64, 64, - 65, 66, 67, 67, 68, 69, 70, 70, 71, 72, - 73, 73, 74, 75, 76, 76, 77, 78, 79, 79 - }; - int dam; - - level = UMIN(level, sizeof(dam_each)/sizeof(dam_each[0]) - 1); - level = UMAX(0, level); - dam = number_range( dam_each[level] / 2, dam_each[level] * 2 ); - if ( saves_spell( level, victim,DAM_LIGHT) ) - dam /= 2; - else - spell_blindness(skill_lookup("blindness"), - level/2,ch,(void *) victim,TARGET_CHAR); - - damage( ch, victim, dam, sn, DAM_LIGHT,TRUE ); - return; -} - - - -void spell_continual_light(int sn,int level,CHAR_DATA *ch,void *vo,int target) -{ - OBJ_DATA *light; - - if (target_name[0] != '\0') /* do a glow on some object */ - { - light = get_obj_carry(ch,target_name,ch); - - if (light == NULL) - { - send_to_char("You don't see that here.\n\r",ch); - return; - } - - if (IS_OBJ_STAT(light,ITEM_GLOW)) - { - act("$p is already glowing.",ch,light,NULL,TO_CHAR); - return; - } - - SET_BIT(light->extra_flags,ITEM_GLOW); - act("$p glows with a white light.",ch,light,NULL,TO_ALL); - return; - } - - light = create_object( get_obj_index( OBJ_VNUM_LIGHT_BALL ), 0 ); - obj_to_room( light, ch->in_room ); - act( "$n twiddles $s thumbs and $p appears.", ch, light, NULL, TO_ROOM ); - act( "You twiddle your thumbs and $p appears.", ch, light, NULL, TO_CHAR ); - return; -} - - - -void spell_control_weather(int sn,int level,CHAR_DATA *ch,void *vo,int target) -{ - if ( !str_cmp( target_name, "better" ) ) - weather_info.change += dice( level / 3, 4 ); - else if ( !str_cmp( target_name, "worse" ) ) - weather_info.change -= dice( level / 3, 4 ); - else - send_to_char ("Do you want it to get better or worse?\n\r", ch ); - - send_to_char( "Ok.\n\r", ch ); - return; -} - - - -void spell_create_food( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - OBJ_DATA *mushroom; - - mushroom = create_object( get_obj_index( OBJ_VNUM_MUSHROOM ), 0 ); - mushroom->value[0] = level / 2; - mushroom->value[1] = level; - obj_to_room( mushroom, ch->in_room ); - act( "$p suddenly appears.", ch, mushroom, NULL, TO_ROOM ); - act( "$p suddenly appears.", ch, mushroom, NULL, TO_CHAR ); - return; -} - -void spell_create_rose( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - OBJ_DATA *rose; - rose = create_object(get_obj_index(OBJ_VNUM_ROSE), 0); - act("$n has created a beautiful red rose.",ch,rose,NULL,TO_ROOM); - send_to_char("You create a beautiful red rose.\n\r",ch); - obj_to_char(rose,ch); - return; -} - -void spell_create_spring(int sn,int level,CHAR_DATA *ch,void *vo,int target) -{ - OBJ_DATA *spring; - - spring = create_object( get_obj_index( OBJ_VNUM_SPRING ), 0 ); - spring->timer = level; - obj_to_room( spring, ch->in_room ); - act( "$p flows from the ground.", ch, spring, NULL, TO_ROOM ); - act( "$p flows from the ground.", ch, spring, NULL, TO_CHAR ); - return; -} - - - -void spell_create_water( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - OBJ_DATA *obj = (OBJ_DATA *) vo; - int water; - - if ( obj->item_type != ITEM_DRINK_CON ) - { - send_to_char( "It is unable to hold water.\n\r", ch ); - return; - } - - if ( obj->value[2] != LIQ_WATER && obj->value[1] != 0 ) - { - send_to_char( "It contains some other liquid.\n\r", ch ); - return; - } - - water = UMIN( - level * (weather_info.sky >= SKY_RAINING ? 4 : 2), - obj->value[0] - obj->value[1] - ); - - if ( water > 0 ) - { - obj->value[2] = LIQ_WATER; - obj->value[1] += water; - if ( !is_name( "water", obj->name ) ) - { - char buf[MAX_STRING_LENGTH]; - - sprintf( buf, "%s water", obj->name ); - free_string( obj->name ); - obj->name = str_dup( buf ); - } - act( "$p is filled.", ch, obj, NULL, TO_CHAR ); - } - - return; -} - - - -void spell_cure_blindness(int sn,int level,CHAR_DATA *ch,void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - - if ( !is_affected( victim, gsn_blindness ) ) - { - if (victim == ch) - send_to_char("You aren't blind.\n\r",ch); - else - act("$N doesn't appear to be blinded.",ch,NULL,victim,TO_CHAR); - return; - } - - if (check_dispel(level,victim,gsn_blindness)) - { - send_to_char( "Your vision returns!\n\r", victim ); - act("$n is no longer blinded.",victim,NULL,NULL,TO_ROOM); - } - else - send_to_char("Spell failed.\n\r",ch); -} - - - -void spell_cure_critical( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int heal; - - heal = dice(3, 8) + level - 6; - victim->hit = UMIN( victim->hit + heal, victim->max_hit ); - update_pos( victim ); - send_to_char( "You feel better!\n\r", victim ); - if ( ch != victim ) - send_to_char( "Ok.\n\r", ch ); - return; -} - -/* RT added to cure plague */ -void spell_cure_disease( int sn, int level, CHAR_DATA *ch,void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - - if ( !is_affected( victim, gsn_plague ) ) - { - if (victim == ch) - send_to_char("You aren't ill.\n\r",ch); - else - act("$N doesn't appear to be diseased.",ch,NULL,victim,TO_CHAR); - return; - } - - if (check_dispel(level,victim,gsn_plague)) - { - send_to_char("Your sores vanish.\n\r",victim); - act("$n looks relieved as $s sores vanish.",victim,NULL,NULL,TO_ROOM); - } - else - send_to_char("Spell failed.\n\r",ch); -} - - - -void spell_cure_light( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int heal; - - heal = dice(1, 8) + level / 3; - victim->hit = UMIN( victim->hit + heal, victim->max_hit ); - update_pos( victim ); - send_to_char( "You feel better!\n\r", victim ); - if ( ch != victim ) - send_to_char( "Ok.\n\r", ch ); - return; -} - - - -void spell_cure_poison( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - - if ( !is_affected( victim, gsn_poison ) ) - { - if (victim == ch) - send_to_char("You aren't poisoned.\n\r",ch); - else - act("$N doesn't appear to be poisoned.",ch,NULL,victim,TO_CHAR); - return; - } - - if (check_dispel(level,victim,gsn_poison)) - { - send_to_char("A warm feeling runs through your body.\n\r",victim); - act("$n looks much better.",victim,NULL,NULL,TO_ROOM); - } - else - send_to_char("Spell failed.\n\r",ch); -} - -void spell_cure_serious( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int heal; - - heal = dice(2, 8) + level /2 ; - victim->hit = UMIN( victim->hit + heal, victim->max_hit ); - update_pos( victim ); - send_to_char( "You feel better!\n\r", victim ); - if ( ch != victim ) - send_to_char( "Ok.\n\r", ch ); - return; -} - - - -void spell_curse( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim; - OBJ_DATA *obj; - AFFECT_DATA af; - - /* deal with the object case first */ - if (target == TARGET_OBJ) - { - obj = (OBJ_DATA *) vo; - if (IS_OBJ_STAT(obj,ITEM_EVIL)) - { - act("$p is already filled with evil.",ch,obj,NULL,TO_CHAR); - return; - } - - if (IS_OBJ_STAT(obj,ITEM_BLESS)) - { - AFFECT_DATA *paf; - - paf = affect_find(obj->affected,skill_lookup("bless")); - if (!saves_dispel(level,paf != NULL ? paf->level : obj->level,0)) - { - if (paf != NULL) - affect_remove_obj(obj,paf); - act("$p glows with a red aura.",ch,obj,NULL,TO_ALL); - REMOVE_BIT(obj->extra_flags,ITEM_BLESS); - return; - } - else - { - act("The holy aura of $p is too powerful for you to overcome.", - ch,obj,NULL,TO_CHAR); - return; - } - } - - af.where = TO_OBJECT; - af.type = sn; - af.level = level; - af.duration = 2 * level; - af.location = APPLY_SAVES; - af.modifier = +1; - af.bitvector = ITEM_EVIL; - affect_to_obj(obj,&af); - - act("$p glows with a malevolent aura.",ch,obj,NULL,TO_ALL); - - if (obj->wear_loc != WEAR_NONE) - ch->saving_throw += 1; - return; - } - - /* character curses */ - victim = (CHAR_DATA *) vo; - - if (IS_AFFECTED(victim,AFF_CURSE) || saves_spell(level,victim,DAM_NEGATIVE)) - return; - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = 2*level; - af.location = APPLY_HITROLL; - af.modifier = -1 * (level / 8); - af.bitvector = AFF_CURSE; - affect_to_char( victim, &af ); - - af.location = APPLY_SAVING_SPELL; - af.modifier = level / 8; - affect_to_char( victim, &af ); - - send_to_char( "You feel unclean.\n\r", victim ); - if ( ch != victim ) - act("$N looks very uncomfortable.",ch,NULL,victim,TO_CHAR); - return; -} - -/* RT replacement demonfire spell */ - -void spell_demonfire(int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int dam; - - if ( !IS_NPC(ch) && !IS_EVIL(ch) ) - { - victim = ch; - send_to_char("The demons turn upon you!\n\r",ch); - } - - ch->alignment = UMAX(-1000, ch->alignment - 50); - - if (victim != ch) - { - act("$n calls forth the demons of Hell upon $N!", - ch,NULL,victim,TO_ROOM); - act("$n has assailed you with the demons of Hell!", - ch,NULL,victim,TO_VICT); - send_to_char("You conjure forth the demons of hell!\n\r",ch); - } - dam = dice( level, 10 ); - if ( saves_spell( level, victim,DAM_NEGATIVE) ) - dam /= 2; - damage( ch, victim, dam, sn, DAM_NEGATIVE ,TRUE); - spell_curse(gsn_curse, 3 * level / 4, ch, (void *) victim,TARGET_CHAR); -} - -void spell_detect_evil( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( IS_AFFECTED(victim, AFF_DETECT_EVIL) ) - { - if (victim == ch) - send_to_char("You can already sense evil.\n\r",ch); - else - act("$N can already detect evil.",ch,NULL,victim,TO_CHAR); - return; - } - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level; - af.modifier = 0; - af.location = APPLY_NONE; - af.bitvector = AFF_DETECT_EVIL; - affect_to_char( victim, &af ); - send_to_char( "Your eyes tingle.\n\r", victim ); - if ( ch != victim ) - send_to_char( "Ok.\n\r", ch ); - return; -} - - -void spell_detect_good( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( IS_AFFECTED(victim, AFF_DETECT_GOOD) ) - { - if (victim == ch) - send_to_char("You can already sense good.\n\r",ch); - else - act("$N can already detect good.",ch,NULL,victim,TO_CHAR); - return; - } - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level; - af.modifier = 0; - af.location = APPLY_NONE; - af.bitvector = AFF_DETECT_GOOD; - affect_to_char( victim, &af ); - send_to_char( "Your eyes tingle.\n\r", victim ); - if ( ch != victim ) - send_to_char( "Ok.\n\r", ch ); - return; -} - - - -void spell_detect_hidden(int sn,int level,CHAR_DATA *ch,void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( IS_AFFECTED(victim, AFF_DETECT_HIDDEN) ) - { - if (victim == ch) - send_to_char("You are already as alert as you can be. \n\r",ch); - else - act("$N can already sense hidden lifeforms.",ch,NULL,victim,TO_CHAR); - return; - } - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level; - af.location = APPLY_NONE; - af.modifier = 0; - af.bitvector = AFF_DETECT_HIDDEN; - affect_to_char( victim, &af ); - send_to_char( "Your awareness improves.\n\r", victim ); - if ( ch != victim ) - send_to_char( "Ok.\n\r", ch ); - return; -} - - - -void spell_detect_invis( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( IS_AFFECTED(victim, AFF_DETECT_INVIS) ) - { - if (victim == ch) - send_to_char("You can already see invisible.\n\r",ch); - else - act("$N can already see invisible things.",ch,NULL,victim,TO_CHAR); - return; - } - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level; - af.modifier = 0; - af.location = APPLY_NONE; - af.bitvector = AFF_DETECT_INVIS; - affect_to_char( victim, &af ); - send_to_char( "Your eyes tingle.\n\r", victim ); - if ( ch != victim ) - send_to_char( "Ok.\n\r", ch ); - return; -} - - - -void spell_detect_magic( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( IS_AFFECTED(victim, AFF_DETECT_MAGIC) ) - { - if (victim == ch) - send_to_char("You can already sense magical auras.\n\r",ch); - else - act("$N can already detect magic.",ch,NULL,victim,TO_CHAR); - return; - } - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level; - af.modifier = 0; - af.location = APPLY_NONE; - af.bitvector = AFF_DETECT_MAGIC; - affect_to_char( victim, &af ); - send_to_char( "Your eyes tingle.\n\r", victim ); - if ( ch != victim ) - send_to_char( "Ok.\n\r", ch ); - return; -} - - - -void spell_detect_poison( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - OBJ_DATA *obj = (OBJ_DATA *) vo; - - if ( obj->item_type == ITEM_DRINK_CON || obj->item_type == ITEM_FOOD ) - { - if ( obj->value[3] != 0 ) - send_to_char( "You smell poisonous fumes.\n\r", ch ); - else - send_to_char( "It looks delicious.\n\r", ch ); - } - else - { - send_to_char( "It doesn't look poisoned.\n\r", ch ); - } - - return; -} - - - -void spell_dispel_evil( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int dam; - - if ( !IS_NPC(ch) && IS_EVIL(ch) ) - victim = ch; - - if ( IS_GOOD(victim) ) - { - act( "Mota protects $N.", ch, NULL, victim, TO_ROOM ); - return; - } - - if ( IS_NEUTRAL(victim) ) - { - act( "$N does not seem to be affected.", ch, NULL, victim, TO_CHAR ); - return; - } - - if (victim->hit > (ch->level * 4)) - dam = dice( level, 4 ); - else - dam = UMAX(victim->hit, dice(level,4)); - if ( saves_spell( level, victim,DAM_HOLY) ) - dam /= 2; - damage( ch, victim, dam, sn, DAM_HOLY ,TRUE); - return; -} - - -void spell_dispel_good( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int dam; - - if ( !IS_NPC(ch) && IS_GOOD(ch) ) - victim = ch; - - if ( IS_EVIL(victim) ) - { - act( "$N is protected by $S evil.", ch, NULL, victim, TO_ROOM ); - return; - } - - if ( IS_NEUTRAL(victim) ) - { - act( "$N does not seem to be affected.", ch, NULL, victim, TO_CHAR ); - return; - } - - if (victim->hit > (ch->level * 4)) - dam = dice( level, 4 ); - else - dam = UMAX(victim->hit, dice(level,4)); - if ( saves_spell( level, victim,DAM_NEGATIVE) ) - dam /= 2; - damage( ch, victim, dam, sn, DAM_NEGATIVE ,TRUE); - return; -} - - -/* modified for enhanced use */ - -void spell_dispel_magic( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - bool found = FALSE; - - if (saves_spell(level, victim,DAM_OTHER)) - { - send_to_char( "You feel a brief tingling sensation.\n\r",victim); - send_to_char( "You failed.\n\r", ch); - return; - } - - /* begin running through the spells */ - - if (check_dispel(level,victim,skill_lookup("armor"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("bless"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("blindness"))) - { - found = TRUE; - act("$n is no longer blinded.",victim,NULL,NULL,TO_ROOM); - } - - if (check_dispel(level,victim,skill_lookup("calm"))) - { - found = TRUE; - act("$n no longer looks so peaceful...",victim,NULL,NULL,TO_ROOM); - } - - if (check_dispel(level,victim,skill_lookup("change sex"))) - { - found = TRUE; - act("$n looks more like $mself again.",victim,NULL,NULL,TO_ROOM); - } - - if (check_dispel(level,victim,skill_lookup("charm person"))) - { - found = TRUE; - act("$n regains $s free will.",victim,NULL,NULL,TO_ROOM); - } - - if (check_dispel(level,victim,skill_lookup("chill touch"))) - { - found = TRUE; - act("$n looks warmer.",victim,NULL,NULL,TO_ROOM); - } - - if (check_dispel(level,victim,skill_lookup("curse"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("detect evil"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("detect good"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("detect hidden"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("detect invis"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("detect magic"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("faerie fire"))) - { - act("$n's outline fades.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("fly"))) - { - act("$n falls to the ground!",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("frenzy"))) - { - act("$n no longer looks so wild.",victim,NULL,NULL,TO_ROOM);; - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("giant strength"))) - { - act("$n no longer looks so mighty.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("haste"))) - { - act("$n is no longer moving so quickly.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("infravision"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("invis"))) - { - act("$n fades into existance.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("mass invis"))) - { - act("$n fades into existance.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("pass door"))) - found = TRUE; - - - if (check_dispel(level,victim,skill_lookup("protection evil"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("protection good"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("sanctuary"))) - { - act("The white aura around $n's body vanishes.", - victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (IS_AFFECTED(victim,AFF_SANCTUARY) - && !saves_dispel(level, victim->level,-1) - && !is_affected(victim,skill_lookup("sanctuary"))) - { - REMOVE_BIT(victim->affected_by,AFF_SANCTUARY); - act("The white aura around $n's body vanishes.", - victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("shield"))) - { - act("The shield protecting $n vanishes.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("sleep"))) - found = TRUE; - - if (check_dispel(level,victim,skill_lookup("slow"))) - { - act("$n is no longer moving so slowly.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("stone skin"))) - { - act("$n's skin regains its normal texture.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (check_dispel(level,victim,skill_lookup("weaken"))) - { - act("$n looks stronger.",victim,NULL,NULL,TO_ROOM); - found = TRUE; - } - - if (found) - send_to_char("Ok.\n\r",ch); - else - send_to_char("Spell failed.\n\r",ch); - return; -} - -void spell_earthquake( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *vch; - CHAR_DATA *vch_next; - - send_to_char( "The earth trembles beneath your feet!\n\r", ch ); - act( "$n makes the earth tremble and shiver.", ch, NULL, NULL, TO_ROOM ); - - for ( vch = char_list; vch != NULL; vch = vch_next ) - { - vch_next = vch->next; - if ( vch->in_room == NULL ) - continue; - if ( vch->in_room == ch->in_room ) - { - if ( vch != ch && !is_safe_spell(ch,vch,TRUE)) - { if (IS_AFFECTED(vch,AFF_FLYING)) - damage(ch,vch,0,sn,DAM_BASH,TRUE); - else - damage( ch,vch,level + dice(2, 8), sn, DAM_BASH,TRUE); - } - continue; - } - - if ( vch->in_room->area == ch->in_room->area ) - send_to_char( "The earth trembles and shivers.\n\r", vch ); - } - - return; -} - -void spell_enchant_armor( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - OBJ_DATA *obj = (OBJ_DATA *) vo; - AFFECT_DATA *paf; - int result, fail; - int ac_bonus, added; - bool ac_found = FALSE; - - if (obj->item_type != ITEM_ARMOR) - { - send_to_char("That isn't an armor.\n\r",ch); - return; - } - - if (obj->wear_loc != -1) - { - send_to_char("The item must be carried to be enchanted.\n\r",ch); - return; - } - - /* this means they have no bonus */ - ac_bonus = 0; - fail = 25; /* base 25% chance of failure */ - - /* find the bonuses */ - - if (!obj->enchanted) - for ( paf = obj->pIndexData->affected; paf != NULL; paf = paf->next ) - { - if ( paf->location == APPLY_AC ) - { - ac_bonus = paf->modifier; - ac_found = TRUE; - fail += 5 * (ac_bonus * ac_bonus); - } - - else /* things get a little harder */ - fail += 20; - } - - for ( paf = obj->affected; paf != NULL; paf = paf->next ) - { - if ( paf->location == APPLY_AC ) - { - ac_bonus = paf->modifier; - ac_found = TRUE; - fail += 5 * (ac_bonus * ac_bonus); - } - - else /* things get a little harder */ - fail += 20; - } - - /* apply other modifiers */ - fail -= level; - - if (IS_OBJ_STAT(obj,ITEM_BLESS)) - fail -= 15; - if (IS_OBJ_STAT(obj,ITEM_GLOW)) - fail -= 5; - - fail = URANGE(5,fail,85); - - result = number_percent(); - - /* the moment of truth */ - if (result < (fail / 5)) /* item destroyed */ - { - act("$p flares blindingly... and evaporates!",ch,obj,NULL,TO_CHAR); - act("$p flares blindingly... and evaporates!",ch,obj,NULL,TO_ROOM); - extract_obj(obj); - return; - } - - if (result < (fail / 3)) /* item disenchanted */ - { - AFFECT_DATA *paf_next; - - act("$p glows brightly, then fades...oops.",ch,obj,NULL,TO_CHAR); - act("$p glows brightly, then fades.",ch,obj,NULL,TO_ROOM); - obj->enchanted = TRUE; - - /* remove all affects */ - for (paf = obj->affected; paf != NULL; paf = paf_next) - { - paf_next = paf->next; - free_affect(paf); - } - obj->affected = NULL; - - /* clear all flags */ - obj->extra_flags = 0; - return; - } - - if ( result <= fail ) /* failed, no bad result */ - { - send_to_char("Nothing seemed to happen.\n\r",ch); - return; - } - - /* okay, move all the old flags into new vectors if we have to */ - if (!obj->enchanted) - { - AFFECT_DATA *af_new; - obj->enchanted = TRUE; - - for (paf = obj->pIndexData->affected; paf != NULL; paf = paf->next) - { - af_new = new_affect(); - - af_new->next = obj->affected; - obj->affected = af_new; - - af_new->where = paf->where; - af_new->type = UMAX(0,paf->type); - af_new->level = paf->level; - af_new->duration = paf->duration; - af_new->location = paf->location; - af_new->modifier = paf->modifier; - af_new->bitvector = paf->bitvector; - } - } - - if (result <= (90 - level/5)) /* success! */ - { - act("$p shimmers with a gold aura.",ch,obj,NULL,TO_CHAR); - act("$p shimmers with a gold aura.",ch,obj,NULL,TO_ROOM); - SET_BIT(obj->extra_flags, ITEM_MAGIC); - added = -1; - } - - else /* exceptional enchant */ - { - act("$p glows a brillant gold!",ch,obj,NULL,TO_CHAR); - act("$p glows a brillant gold!",ch,obj,NULL,TO_ROOM); - SET_BIT(obj->extra_flags,ITEM_MAGIC); - SET_BIT(obj->extra_flags,ITEM_GLOW); - added = -2; - } - - /* now add the enchantments */ - - if (obj->level < LEVEL_HERO) - obj->level = UMIN(LEVEL_HERO - 1,obj->level + 1); - - if (ac_found) - { - for ( paf = obj->affected; paf != NULL; paf = paf->next) - { - if ( paf->location == APPLY_AC) - { - paf->type = sn; - paf->modifier += added; - paf->level = UMAX(paf->level,level); - } - } - } - else /* add a new affect */ - { - paf = new_affect(); - - paf->where = TO_OBJECT; - paf->type = sn; - paf->level = level; - paf->duration = -1; - paf->location = APPLY_AC; - paf->modifier = added; - paf->bitvector = 0; - paf->next = obj->affected; - obj->affected = paf; - } - -} - - - - -void spell_enchant_weapon(int sn,int level,CHAR_DATA *ch, void *vo,int target) -{ - OBJ_DATA *obj = (OBJ_DATA *) vo; - AFFECT_DATA *paf; - int result, fail; - int hit_bonus, dam_bonus, added; - bool hit_found = FALSE, dam_found = FALSE; - - if (obj->item_type != ITEM_WEAPON) - { - send_to_char("That isn't a weapon.\n\r",ch); - return; - } - - if (obj->wear_loc != -1) - { - send_to_char("The item must be carried to be enchanted.\n\r",ch); - return; - } - - /* this means they have no bonus */ - hit_bonus = 0; - dam_bonus = 0; - fail = 25; /* base 25% chance of failure */ - - /* find the bonuses */ - - if (!obj->enchanted) - for ( paf = obj->pIndexData->affected; paf != NULL; paf = paf->next ) - { - if ( paf->location == APPLY_HITROLL ) - { - hit_bonus = paf->modifier; - hit_found = TRUE; - fail += 2 * (hit_bonus * hit_bonus); - } - - else if (paf->location == APPLY_DAMROLL ) - { - dam_bonus = paf->modifier; - dam_found = TRUE; - fail += 2 * (dam_bonus * dam_bonus); - } - - else /* things get a little harder */ - fail += 25; - } - - for ( paf = obj->affected; paf != NULL; paf = paf->next ) - { - if ( paf->location == APPLY_HITROLL ) - { - hit_bonus = paf->modifier; - hit_found = TRUE; - fail += 2 * (hit_bonus * hit_bonus); - } - - else if (paf->location == APPLY_DAMROLL ) - { - dam_bonus = paf->modifier; - dam_found = TRUE; - fail += 2 * (dam_bonus * dam_bonus); - } - - else /* things get a little harder */ - fail += 25; - } - - /* apply other modifiers */ - fail -= 3 * level/2; - - if (IS_OBJ_STAT(obj,ITEM_BLESS)) - fail -= 15; - if (IS_OBJ_STAT(obj,ITEM_GLOW)) - fail -= 5; - - fail = URANGE(5,fail,95); - - result = number_percent(); - - /* the moment of truth */ - if (result < (fail / 5)) /* item destroyed */ - { - act("$p shivers violently and explodes!",ch,obj,NULL,TO_CHAR); - act("$p shivers violently and explodeds!",ch,obj,NULL,TO_ROOM); - extract_obj(obj); - return; - } - - if (result < (fail / 2)) /* item disenchanted */ - { - AFFECT_DATA *paf_next; - - act("$p glows brightly, then fades...oops.",ch,obj,NULL,TO_CHAR); - act("$p glows brightly, then fades.",ch,obj,NULL,TO_ROOM); - obj->enchanted = TRUE; - - /* remove all affects */ - for (paf = obj->affected; paf != NULL; paf = paf_next) - { - paf_next = paf->next; - free_affect(paf); - } - obj->affected = NULL; - - /* clear all flags */ - obj->extra_flags = 0; - return; - } - - if ( result <= fail ) /* failed, no bad result */ - { - send_to_char("Nothing seemed to happen.\n\r",ch); - return; - } - - /* okay, move all the old flags into new vectors if we have to */ - if (!obj->enchanted) - { - AFFECT_DATA *af_new; - obj->enchanted = TRUE; - - for (paf = obj->pIndexData->affected; paf != NULL; paf = paf->next) - { - af_new = new_affect(); - - af_new->next = obj->affected; - obj->affected = af_new; - - af_new->where = paf->where; - af_new->type = UMAX(0,paf->type); - af_new->level = paf->level; - af_new->duration = paf->duration; - af_new->location = paf->location; - af_new->modifier = paf->modifier; - af_new->bitvector = paf->bitvector; - } - } - - if (result <= (100 - level/5)) /* success! */ - { - act("$p glows blue.",ch,obj,NULL,TO_CHAR); - act("$p glows blue.",ch,obj,NULL,TO_ROOM); - SET_BIT(obj->extra_flags, ITEM_MAGIC); - added = 1; - } - - else /* exceptional enchant */ - { - act("$p glows a brillant blue!",ch,obj,NULL,TO_CHAR); - act("$p glows a brillant blue!",ch,obj,NULL,TO_ROOM); - SET_BIT(obj->extra_flags,ITEM_MAGIC); - SET_BIT(obj->extra_flags,ITEM_GLOW); - added = 2; - } - - /* now add the enchantments */ - - if (obj->level < LEVEL_HERO - 1) - obj->level = UMIN(LEVEL_HERO - 1,obj->level + 1); - - if (dam_found) - { - for ( paf = obj->affected; paf != NULL; paf = paf->next) - { - if ( paf->location == APPLY_DAMROLL) - { - paf->type = sn; - paf->modifier += added; - paf->level = UMAX(paf->level,level); - if (paf->modifier > 4) - SET_BIT(obj->extra_flags,ITEM_HUM); - } - } - } - else /* add a new affect */ - { - paf = new_affect(); - - paf->where = TO_OBJECT; - paf->type = sn; - paf->level = level; - paf->duration = -1; - paf->location = APPLY_DAMROLL; - paf->modifier = added; - paf->bitvector = 0; - paf->next = obj->affected; - obj->affected = paf; - } - - if (hit_found) - { - for ( paf = obj->affected; paf != NULL; paf = paf->next) - { - if ( paf->location == APPLY_HITROLL) - { - paf->type = sn; - paf->modifier += added; - paf->level = UMAX(paf->level,level); - if (paf->modifier > 4) - SET_BIT(obj->extra_flags,ITEM_HUM); - } - } - } - else /* add a new affect */ - { - paf = new_affect(); - - paf->type = sn; - paf->level = level; - paf->duration = -1; - paf->location = APPLY_HITROLL; - paf->modifier = added; - paf->bitvector = 0; - paf->next = obj->affected; - obj->affected = paf; - } - -} - - - -/* - * Drain XP, MANA, HP. - * Caster gains HP. - */ -void spell_energy_drain( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int dam; - - if (victim != ch) - ch->alignment = UMAX(-1000, ch->alignment - 50); - - if ( saves_spell( level, victim,DAM_NEGATIVE) ) - { - send_to_char("You feel a momentary chill.\n\r",victim); - return; - } - - - if ( victim->level <= 2 ) - { - dam = ch->hit + 1; - } - else - { - gain_exp( victim, 0 - number_range( level/2, 3 * level / 2 ) ); - victim->mana /= 2; - victim->move /= 2; - dam = dice(1, level); - ch->hit += dam; - } - - send_to_char("You feel your life slipping away!\n\r",victim); - send_to_char("Wow....what a rush!\n\r",ch); - damage( ch, victim, dam, sn, DAM_NEGATIVE ,TRUE); - - return; -} - - - -void spell_fireball( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - static const sh_int dam_each[] = - { - 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 30, 35, 40, 45, 50, 55, - 60, 65, 70, 75, 80, 82, 84, 86, 88, 90, - 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, - 112, 114, 116, 118, 120, 122, 124, 126, 128, 130 - }; - int dam; - - level = UMIN(level, sizeof(dam_each)/sizeof(dam_each[0]) - 1); - level = UMAX(0, level); - dam = number_range( dam_each[level] / 2, dam_each[level] * 2 ); - if ( saves_spell( level, victim, DAM_FIRE) ) - dam /= 2; - damage( ch, victim, dam, sn, DAM_FIRE ,TRUE); - return; -} - - -void spell_fireproof(int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - OBJ_DATA *obj = (OBJ_DATA *) vo; - AFFECT_DATA af; - - if (IS_OBJ_STAT(obj,ITEM_BURN_PROOF)) - { - act("$p is already protected from burning.",ch,obj,NULL,TO_CHAR); - return; - } - - af.where = TO_OBJECT; - af.type = sn; - af.level = level; - af.duration = number_fuzzy(level / 4); - af.location = APPLY_NONE; - af.modifier = 0; - af.bitvector = ITEM_BURN_PROOF; - - affect_to_obj(obj,&af); - - act("You protect $p from fire.",ch,obj,NULL,TO_CHAR); - act("$p is surrounded by a protective aura.",ch,obj,NULL,TO_ROOM); -} - - - -void spell_flamestrike( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int dam; - - dam = dice(6 + level / 2, 8); - if ( saves_spell( level, victim,DAM_FIRE) ) - dam /= 2; - damage( ch, victim, dam, sn, DAM_FIRE ,TRUE); - return; -} - - - -void spell_faerie_fire( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( IS_AFFECTED(victim, AFF_FAERIE_FIRE) ) - return; - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level; - af.location = APPLY_AC; - af.modifier = 2 * level; - af.bitvector = AFF_FAERIE_FIRE; - affect_to_char( victim, &af ); - send_to_char( "You are surrounded by a pink outline.\n\r", victim ); - act( "$n is surrounded by a pink outline.", victim, NULL, NULL, TO_ROOM ); - return; -} - - - -void spell_faerie_fog( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *ich; - - act( "$n conjures a cloud of purple smoke.", ch, NULL, NULL, TO_ROOM ); - send_to_char( "You conjure a cloud of purple smoke.\n\r", ch ); - - for ( ich = ch->in_room->people; ich != NULL; ich = ich->next_in_room ) - { - if (ich->invis_level > 0) - continue; - - if ( ich == ch || saves_spell( level, ich,DAM_OTHER) ) - continue; - - affect_strip ( ich, gsn_invis ); - affect_strip ( ich, gsn_mass_invis ); - affect_strip ( ich, gsn_sneak ); - REMOVE_BIT ( ich->affected_by, AFF_HIDE ); - REMOVE_BIT ( ich->affected_by, AFF_INVISIBLE ); - REMOVE_BIT ( ich->affected_by, AFF_SNEAK ); - act( "$n is revealed!", ich, NULL, NULL, TO_ROOM ); - send_to_char( "You are revealed!\n\r", ich ); - } - - return; -} - -void spell_floating_disc( int sn, int level,CHAR_DATA *ch,void *vo,int target ) -{ - OBJ_DATA *disc, *floating; - - floating = get_eq_char(ch,WEAR_FLOAT); - if (floating != NULL && IS_OBJ_STAT(floating,ITEM_NOREMOVE)) - { - act("You can't remove $p.",ch,floating,NULL,TO_CHAR); - return; - } - - disc = create_object(get_obj_index(OBJ_VNUM_DISC), 0); - disc->value[0] = ch->level * 10; /* 10 pounds per level capacity */ - disc->value[3] = ch->level * 5; /* 5 pounds per level max per item */ - disc->timer = ch->level * 2 - number_range(0,level / 2); - - act("$n has created a floating black disc.",ch,NULL,NULL,TO_ROOM); - send_to_char("You create a floating disc.\n\r",ch); - obj_to_char(disc,ch); - wear_obj(ch,disc,TRUE); - return; -} - - -void spell_fly( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( IS_AFFECTED(victim, AFF_FLYING) ) - { - if (victim == ch) - send_to_char("You are already airborne.\n\r",ch); - else - act("$N doesn't need your help to fly.",ch,NULL,victim,TO_CHAR); - return; - } - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level + 3; - af.location = 0; - af.modifier = 0; - af.bitvector = AFF_FLYING; - affect_to_char( victim, &af ); - send_to_char( "Your feet rise off the ground.\n\r", victim ); - act( "$n's feet rise off the ground.", victim, NULL, NULL, TO_ROOM ); - return; -} - -/* RT clerical berserking spell */ - -void spell_frenzy(int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if (is_affected(victim,sn) || IS_AFFECTED(victim,AFF_BERSERK)) - { - if (victim == ch) - send_to_char("You are already in a frenzy.\n\r",ch); - else - act("$N is already in a frenzy.",ch,NULL,victim,TO_CHAR); - return; - } - - if (is_affected(victim,skill_lookup("calm"))) - { - if (victim == ch) - send_to_char("Why don't you just relax for a while?\n\r",ch); - else - act("$N doesn't look like $e wants to fight anymore.", - ch,NULL,victim,TO_CHAR); - return; - } - - if ((IS_GOOD(ch) && !IS_GOOD(victim)) || - (IS_NEUTRAL(ch) && !IS_NEUTRAL(victim)) || - (IS_EVIL(ch) && !IS_EVIL(victim)) - ) - { - act("Your god doesn't seem to like $N",ch,NULL,victim,TO_CHAR); - return; - } - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level / 3; - af.modifier = level / 6; - af.bitvector = 0; - - af.location = APPLY_HITROLL; - affect_to_char(victim,&af); - - af.location = APPLY_DAMROLL; - affect_to_char(victim,&af); - - af.modifier = 10 * (level / 12); - af.location = APPLY_AC; - affect_to_char(victim,&af); - - send_to_char("You are filled with holy wrath!\n\r",victim); - act("$n gets a wild look in $s eyes!",victim,NULL,NULL,TO_ROOM); -} - -/* RT ROM-style gate */ - -void spell_gate( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim; - bool gate_pet; - - if ( ( victim = get_char_world( ch, target_name ) ) == NULL - || victim == ch - || victim->in_room == NULL - || !can_see_room(ch,victim->in_room) - || IS_SET(victim->in_room->room_flags, ROOM_SAFE) - || IS_SET(victim->in_room->room_flags, ROOM_PRIVATE) - || IS_SET(victim->in_room->room_flags, ROOM_SOLITARY) - || IS_SET(victim->in_room->room_flags, ROOM_NO_RECALL) - || IS_SET(ch->in_room->room_flags, ROOM_NO_RECALL) - || victim->level >= level + 3 - || (is_clan(victim) && !is_same_clan(ch,victim)) - || (!IS_NPC(victim) && victim->level >= LEVEL_HERO) /* NOT trust */ - || (IS_NPC(victim) && IS_SET(victim->imm_flags,IMM_SUMMON)) - || (IS_NPC(victim) && saves_spell( level, victim,DAM_OTHER) ) ) - { - send_to_char( "You failed.\n\r", ch ); - return; - } - if (ch->pet != NULL && ch->in_room == ch->pet->in_room) - gate_pet = TRUE; - else - gate_pet = FALSE; - - act("$n steps through a gate and vanishes.",ch,NULL,NULL,TO_ROOM); - send_to_char("You step through a gate and vanish.\n\r",ch); - char_from_room(ch); - char_to_room(ch,victim->in_room); - - act("$n has arrived through a gate.",ch,NULL,NULL,TO_ROOM); - do_function(ch, &do_look, "auto"); - - if (gate_pet) - { - act("$n steps through a gate and vanishes.",ch->pet,NULL,NULL,TO_ROOM); - send_to_char("You step through a gate and vanish.\n\r",ch->pet); - char_from_room(ch->pet); - char_to_room(ch->pet,victim->in_room); - act("$n has arrived through a gate.",ch->pet,NULL,NULL,TO_ROOM); - do_function(ch->pet, &do_look, "auto"); - } -} - - - -void spell_giant_strength(int sn,int level,CHAR_DATA *ch,void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( is_affected( victim, sn ) ) - { - if (victim == ch) - send_to_char("You are already as strong as you can get!\n\r",ch); - else - act("$N can't get any stronger.",ch,NULL,victim,TO_CHAR); - return; - } - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level; - af.location = APPLY_STR; - af.modifier = 1 + (level >= 18) + (level >= 25) + (level >= 32); - af.bitvector = 0; - affect_to_char( victim, &af ); - send_to_char( "Your muscles surge with heightened power!\n\r", victim ); - act("$n's muscles surge with heightened power.",victim,NULL,NULL,TO_ROOM); - return; -} - - - -void spell_harm( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int dam; - - dam = UMAX( 20, victim->hit - dice(1,4) ); - if ( saves_spell( level, victim,DAM_HARM) ) - dam = UMIN( 50, dam / 2 ); - dam = UMIN( 100, dam ); - damage( ch, victim, dam, sn, DAM_HARM ,TRUE); - return; -} - -/* RT haste spell */ - -void spell_haste( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( is_affected( victim, sn ) || IS_AFFECTED(victim,AFF_HASTE) - || IS_SET(victim->off_flags,OFF_FAST)) - { - if (victim == ch) - send_to_char("You can't move any faster!\n\r",ch); - else - act("$N is already moving as fast as $E can.", - ch,NULL,victim,TO_CHAR); - return; - } - - if (IS_AFFECTED(victim,AFF_SLOW)) - { - if (!check_dispel(level,victim,skill_lookup("slow"))) - { - if (victim != ch) - send_to_char("Spell failed.\n\r",ch); - send_to_char("You feel momentarily faster.\n\r",victim); - return; - } - act("$n is moving less slowly.",victim,NULL,NULL,TO_ROOM); - return; - } - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - if (victim == ch) - af.duration = level/2; - else - af.duration = level/4; - af.location = APPLY_DEX; - af.modifier = 1 + (level >= 18) + (level >= 25) + (level >= 32); - af.bitvector = AFF_HASTE; - affect_to_char( victim, &af ); - send_to_char( "You feel yourself moving more quickly.\n\r", victim ); - act("$n is moving more quickly.",victim,NULL,NULL,TO_ROOM); - if ( ch != victim ) - send_to_char( "Ok.\n\r", ch ); - return; -} - - - -void spell_heal( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - victim->hit = UMIN( victim->hit + 100, victim->max_hit ); - update_pos( victim ); - send_to_char( "A warm feeling fills your body.\n\r", victim ); - if ( ch != victim ) - send_to_char( "Ok.\n\r", ch ); - return; -} - -void spell_heat_metal( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - OBJ_DATA *obj_lose, *obj_next; - int dam = 0; - bool fail = TRUE; - - if (!saves_spell(level + 2,victim,DAM_FIRE) - && !IS_SET(victim->imm_flags,IMM_FIRE)) - { - for ( obj_lose = victim->carrying; - obj_lose != NULL; - obj_lose = obj_next) - { - obj_next = obj_lose->next_content; - if ( number_range(1,2 * level) > obj_lose->level - && !saves_spell(level,victim,DAM_FIRE) - && !IS_OBJ_STAT(obj_lose,ITEM_NONMETAL) - && !IS_OBJ_STAT(obj_lose,ITEM_BURN_PROOF)) - { - switch ( obj_lose->item_type ) - { - case ITEM_ARMOR: - if (obj_lose->wear_loc != -1) /* remove the item */ - { - if (can_drop_obj(victim,obj_lose) - && (obj_lose->weight / 10) < - number_range(1,2 * get_curr_stat(victim,STAT_DEX)) - && remove_obj( victim, obj_lose->wear_loc, TRUE )) - { - act("$n yelps and throws $p to the ground!", - victim,obj_lose,NULL,TO_ROOM); - act("You remove and drop $p before it burns you.", - victim,obj_lose,NULL,TO_CHAR); - dam += (number_range(1,obj_lose->level) / 3); - obj_from_char(obj_lose); - obj_to_room(obj_lose, victim->in_room); - fail = FALSE; - } - else /* stuck on the body! ouch! */ - { - act("Your skin is seared by $p!", - victim,obj_lose,NULL,TO_CHAR); - dam += (number_range(1,obj_lose->level)); - fail = FALSE; - } - - } - else /* drop it if we can */ - { - if (can_drop_obj(victim,obj_lose)) - { - act("$n yelps and throws $p to the ground!", - victim,obj_lose,NULL,TO_ROOM); - act("You and drop $p before it burns you.", - victim,obj_lose,NULL,TO_CHAR); - dam += (number_range(1,obj_lose->level) / 6); - obj_from_char(obj_lose); - obj_to_room(obj_lose, victim->in_room); - fail = FALSE; - } - else /* cannot drop */ - { - act("Your skin is seared by $p!", - victim,obj_lose,NULL,TO_CHAR); - dam += (number_range(1,obj_lose->level) / 2); - fail = FALSE; - } - } - break; - case ITEM_WEAPON: - if (obj_lose->wear_loc != -1) /* try to drop it */ - { - if (IS_WEAPON_STAT(obj_lose,WEAPON_FLAMING)) - continue; - - if (can_drop_obj(victim,obj_lose) - && remove_obj(victim,obj_lose->wear_loc,TRUE)) - { - act("$n is burned by $p, and throws it to the ground.", - victim,obj_lose,NULL,TO_ROOM); - send_to_char( - "You throw your red-hot weapon to the ground!\n\r", - victim); - dam += 1; - obj_from_char(obj_lose); - obj_to_room(obj_lose,victim->in_room); - fail = FALSE; - } - else /* YOWCH! */ - { - send_to_char("Your weapon sears your flesh!\n\r", - victim); - dam += number_range(1,obj_lose->level); - fail = FALSE; - } - } - else /* drop it if we can */ - { - if (can_drop_obj(victim,obj_lose)) - { - act("$n throws a burning hot $p to the ground!", - victim,obj_lose,NULL,TO_ROOM); - act("You and drop $p before it burns you.", - victim,obj_lose,NULL,TO_CHAR); - dam += (number_range(1,obj_lose->level) / 6); - obj_from_char(obj_lose); - obj_to_room(obj_lose, victim->in_room); - fail = FALSE; - } - else /* cannot drop */ - { - act("Your skin is seared by $p!", - victim,obj_lose,NULL,TO_CHAR); - dam += (number_range(1,obj_lose->level) / 2); - fail = FALSE; - } - } - break; - } - } - } - } - if (fail) - { - send_to_char("Your spell had no effect.\n\r", ch); - send_to_char("You feel momentarily warmer.\n\r",victim); - } - else /* damage! */ - { - if (saves_spell(level,victim,DAM_FIRE)) - dam = 2 * dam / 3; - damage(ch,victim,dam,sn,DAM_FIRE,TRUE); - } -} - -/* RT really nasty high-level attack spell */ -void spell_holy_word(int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *vch; - CHAR_DATA *vch_next; - int dam; - int bless_num, curse_num, frenzy_num; - - bless_num = skill_lookup("bless"); - curse_num = skill_lookup("curse"); - frenzy_num = skill_lookup("frenzy"); - - act("$n utters a word of divine power!",ch,NULL,NULL,TO_ROOM); - send_to_char("You utter a word of divine power.\n\r",ch); - - for ( vch = ch->in_room->people; vch != NULL; vch = vch_next ) - { - vch_next = vch->next_in_room; - - if ((IS_GOOD(ch) && IS_GOOD(vch)) || - (IS_EVIL(ch) && IS_EVIL(vch)) || - (IS_NEUTRAL(ch) && IS_NEUTRAL(vch)) ) - { - send_to_char("You feel full more powerful.\n\r",vch); - spell_frenzy(frenzy_num,level,ch,(void *) vch,TARGET_CHAR); - spell_bless(bless_num,level,ch,(void *) vch,TARGET_CHAR); - } - - else if ((IS_GOOD(ch) && IS_EVIL(vch)) || - (IS_EVIL(ch) && IS_GOOD(vch)) ) - { - if (!is_safe_spell(ch,vch,TRUE)) - { - spell_curse(curse_num,level,ch,(void *) vch,TARGET_CHAR); - send_to_char("You are struck down!\n\r",vch); - dam = dice(level,6); - damage(ch,vch,dam,sn,DAM_ENERGY,TRUE); - } - } - - else if (IS_NEUTRAL(ch)) - { - if (!is_safe_spell(ch,vch,TRUE)) - { - spell_curse(curse_num,level/2,ch,(void *) vch,TARGET_CHAR); - send_to_char("You are struck down!\n\r",vch); - dam = dice(level,4); - damage(ch,vch,dam,sn,DAM_ENERGY,TRUE); - } - } - } - - send_to_char("You feel drained.\n\r",ch); - ch->move = 0; - ch->hit /= 2; -} - -void spell_identify( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - OBJ_DATA *obj = (OBJ_DATA *) vo; - char buf[MAX_STRING_LENGTH]; - AFFECT_DATA *paf; - - sprintf( buf, - "Object '%s' is type %s, extra flags %s.\n\rWeight is %d, value is %d, level is %d.\n\r", - - obj->name, - item_name(obj->item_type), - extra_bit_name( obj->extra_flags ), - obj->weight / 10, - obj->cost, - obj->level - ); - send_to_char( buf, ch ); - - switch ( obj->item_type ) - { - case ITEM_SCROLL: - case ITEM_POTION: - case ITEM_PILL: - sprintf( buf, "Level %d spells of:", obj->value[0] ); - send_to_char( buf, ch ); - - if ( obj->value[1] >= 0 && obj->value[1] < MAX_SKILL ) - { - send_to_char( " '", ch ); - send_to_char( skill_table[obj->value[1]].name, ch ); - send_to_char( "'", ch ); - } - - if ( obj->value[2] >= 0 && obj->value[2] < MAX_SKILL ) - { - send_to_char( " '", ch ); - send_to_char( skill_table[obj->value[2]].name, ch ); - send_to_char( "'", ch ); - } - - if ( obj->value[3] >= 0 && obj->value[3] < MAX_SKILL ) - { - send_to_char( " '", ch ); - send_to_char( skill_table[obj->value[3]].name, ch ); - send_to_char( "'", ch ); - } - - if (obj->value[4] >= 0 && obj->value[4] < MAX_SKILL) - { - send_to_char(" '",ch); - send_to_char(skill_table[obj->value[4]].name,ch); - send_to_char("'",ch); - } - - send_to_char( ".\n\r", ch ); - break; - - case ITEM_WAND: - case ITEM_STAFF: - sprintf( buf, "Has %d charges of level %d", - obj->value[2], obj->value[0] ); - send_to_char( buf, ch ); - - if ( obj->value[3] >= 0 && obj->value[3] < MAX_SKILL ) - { - send_to_char( " '", ch ); - send_to_char( skill_table[obj->value[3]].name, ch ); - send_to_char( "'", ch ); - } - - send_to_char( ".\n\r", ch ); - break; - - case ITEM_DRINK_CON: - sprintf(buf,"It holds %s-colored %s.\n\r", - liq_table[obj->value[2]].liq_color, - liq_table[obj->value[2]].liq_name); - send_to_char(buf,ch); - break; - - case ITEM_CONTAINER: - sprintf(buf,"Capacity: %d# Maximum weight: %d# flags: %s\n\r", - obj->value[0], obj->value[3], cont_bit_name(obj->value[1])); - send_to_char(buf,ch); - if (obj->value[4] != 100) - { - sprintf(buf,"Weight multiplier: %d%%\n\r", - obj->value[4]); - send_to_char(buf,ch); - } - 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/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) - sprintf(buf,"Damage is %dd%d (average %d).\n\r", - obj->value[1],obj->value[2], - (1 + obj->value[2]) * obj->value[1] / 2); - else - sprintf( buf, "Damage is %d to %d (average %d).\n\r", - obj->value[1], obj->value[2], - ( obj->value[1] + obj->value[2] ) / 2 ); - send_to_char( buf, ch ); - if (obj->value[4]) /* weapon flags */ - { - sprintf(buf,"Weapons flags: %s\n\r",weapon_bit_name(obj->value[4])); - send_to_char(buf,ch); - } - break; - - case ITEM_ARMOR: - sprintf( buf, - "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] ); - send_to_char( buf, ch ); - break; - } - - if (!obj->enchanted) - for ( paf = obj->pIndexData->affected; paf != NULL; paf = paf->next ) - { - if ( paf->location != APPLY_NONE && paf->modifier != 0 ) - { - sprintf( buf, "Affects %s by %d.\n\r", - affect_loc_name( paf->location ), paf->modifier ); - send_to_char(buf,ch); - if (paf->bitvector) - { - switch(paf->where) - { - case TO_AFFECTS: - sprintf(buf,"Adds %s affect.\n", - affect_bit_name(paf->bitvector)); - break; - case TO_OBJECT: - sprintf(buf,"Adds %s object flag.\n", - extra_bit_name(paf->bitvector)); - break; - case TO_IMMUNE: - sprintf(buf,"Adds immunity to %s.\n", - imm_bit_name(paf->bitvector)); - break; - case TO_RESIST: - sprintf(buf,"Adds resistance to %s.\n\r", - imm_bit_name(paf->bitvector)); - break; - case TO_VULN: - sprintf(buf,"Adds vulnerability to %s.\n\r", - imm_bit_name(paf->bitvector)); - break; - default: - sprintf(buf,"Unknown bit %d: %d\n\r", - paf->where,paf->bitvector); - break; - } - send_to_char( buf, ch ); - } - } - } - - for ( paf = obj->affected; paf != NULL; paf = paf->next ) - { - if ( paf->location != APPLY_NONE && paf->modifier != 0 ) - { - sprintf( buf, "Affects %s by %d", - affect_loc_name( paf->location ), paf->modifier ); - send_to_char( buf, ch ); - if ( paf->duration > -1) - sprintf(buf,", %d hours.\n\r",paf->duration); - else - sprintf(buf,".\n\r"); - send_to_char(buf,ch); - if (paf->bitvector) - { - switch(paf->where) - { - case TO_AFFECTS: - sprintf(buf,"Adds %s affect.\n", - affect_bit_name(paf->bitvector)); - break; - case TO_OBJECT: - sprintf(buf,"Adds %s object flag.\n", - extra_bit_name(paf->bitvector)); - break; - case TO_WEAPON: - sprintf(buf,"Adds %s weapon flags.\n", - weapon_bit_name(paf->bitvector)); - break; - case TO_IMMUNE: - sprintf(buf,"Adds immunity to %s.\n", - imm_bit_name(paf->bitvector)); - break; - case TO_RESIST: - sprintf(buf,"Adds resistance to %s.\n\r", - imm_bit_name(paf->bitvector)); - break; - case TO_VULN: - sprintf(buf,"Adds vulnerability to %s.\n\r", - imm_bit_name(paf->bitvector)); - break; - default: - sprintf(buf,"Unknown bit %d: %d\n\r", - paf->where,paf->bitvector); - break; - } - send_to_char(buf,ch); - } - } - } - - return; -} - - - -void spell_infravision( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( IS_AFFECTED(victim, AFF_INFRARED) ) - { - if (victim == ch) - send_to_char("You can already see in the dark.\n\r",ch); - else - act("$N already has infravision.\n\r",ch,NULL,victim,TO_CHAR); - return; - } - act( "$n's eyes glow red.\n\r", ch, NULL, NULL, TO_ROOM ); - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = 2 * level; - af.location = APPLY_NONE; - af.modifier = 0; - af.bitvector = AFF_INFRARED; - affect_to_char( victim, &af ); - send_to_char( "Your eyes glow red.\n\r", victim ); - return; -} - - - -void spell_invis( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim; - OBJ_DATA *obj; - AFFECT_DATA af; - - /* object invisibility */ - if (target == TARGET_OBJ) - { - obj = (OBJ_DATA *) vo; - - if (IS_OBJ_STAT(obj,ITEM_INVIS)) - { - act("$p is already invisible.",ch,obj,NULL,TO_CHAR); - return; - } - - af.where = TO_OBJECT; - af.type = sn; - af.level = level; - af.duration = level + 12; - af.location = APPLY_NONE; - af.modifier = 0; - af.bitvector = ITEM_INVIS; - affect_to_obj(obj,&af); - - act("$p fades out of sight.",ch,obj,NULL,TO_ALL); - return; - } - - /* character invisibility */ - victim = (CHAR_DATA *) vo; - - if ( IS_AFFECTED(victim, AFF_INVISIBLE) ) - return; - - act( "$n fades out of existence.", victim, NULL, NULL, TO_ROOM ); - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level + 12; - af.location = APPLY_NONE; - af.modifier = 0; - af.bitvector = AFF_INVISIBLE; - affect_to_char( victim, &af ); - send_to_char( "You fade out of existence.\n\r", victim ); - return; -} - - - -void spell_know_alignment(int sn,int level,CHAR_DATA *ch,void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - char *msg; - int ap; - - ap = victim->alignment; - - if ( ap > 700 ) msg = "$N has a pure and good aura."; - else if ( ap > 350 ) msg = "$N is of excellent moral character."; - else if ( ap > 100 ) msg = "$N is often kind and thoughtful."; - else if ( ap > -100 ) msg = "$N doesn't have a firm moral commitment."; - else if ( ap > -350 ) msg = "$N lies to $S friends."; - else if ( ap > -700 ) msg = "$N is a black-hearted murderer."; - else msg = "$N is the embodiment of pure evil!."; - - act( msg, ch, NULL, victim, TO_CHAR ); - return; -} - - - -void spell_lightning_bolt(int sn,int level,CHAR_DATA *ch,void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - static const sh_int dam_each[] = - { - 0, - 0, 0, 0, 0, 0, 0, 0, 0, 25, 28, - 31, 34, 37, 40, 40, 41, 42, 42, 43, 44, - 44, 45, 46, 46, 47, 48, 48, 49, 50, 50, - 51, 52, 52, 53, 54, 54, 55, 56, 56, 57, - 58, 58, 59, 60, 60, 61, 62, 62, 63, 64 - }; - int dam; - - level = UMIN(level, sizeof(dam_each)/sizeof(dam_each[0]) - 1); - level = UMAX(0, level); - dam = number_range( dam_each[level] / 2, dam_each[level] * 2 ); - if ( saves_spell( level, victim,DAM_LIGHTNING) ) - dam /= 2; - damage( ch, victim, dam, sn, DAM_LIGHTNING ,TRUE); - return; -} - - - -void spell_locate_object( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - char buf[MAX_INPUT_LENGTH]; - BUFFER *buffer; - OBJ_DATA *obj; - OBJ_DATA *in_obj; - bool found; - int number = 0, max_found; - - found = FALSE; - number = 0; - max_found = IS_IMMORTAL(ch) ? 200 : 2 * level; - - buffer = new_buf(); - - for ( obj = object_list; obj != NULL; obj = obj->next ) - { - if ( !can_see_obj( ch, obj ) || !is_name( target_name, obj->name ) - || IS_OBJ_STAT(obj,ITEM_NOLOCATE) || number_percent() > 2 * level - || ch->level < obj->level) - continue; - - 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)) - { - sprintf( buf, "one is carried by %s\n\r", - PERS(in_obj->carried_by, ch) ); - } - else - { - if (IS_IMMORTAL(ch) && in_obj->in_room != NULL) - sprintf( buf, "one is in %s [Room %d]\n\r", - in_obj->in_room->name, in_obj->in_room->vnum); - else - sprintf( buf, "one is in %s\n\r", - in_obj->in_room == NULL - ? "somewhere" : in_obj->in_room->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); - - return; -} - - - -void spell_magic_missile( int sn, int level, CHAR_DATA *ch,void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - static const sh_int dam_each[] = - { - 0, - 3, 3, 4, 4, 5, 6, 6, 6, 6, 6, - 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, - 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, - 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, - 13, 13, 13, 13, 13, 14, 14, 14, 14, 14 - }; - int dam; - - level = UMIN(level, sizeof(dam_each)/sizeof(dam_each[0]) - 1); - level = UMAX(0, level); - dam = number_range( dam_each[level] / 2, dam_each[level] * 2 ); - if ( saves_spell( level, victim,DAM_ENERGY) ) - dam /= 2; - damage( ch, victim, dam, sn, DAM_ENERGY ,TRUE); - return; -} - -void spell_mass_healing(int sn, int level, CHAR_DATA *ch, void *vo, int target) -{ - CHAR_DATA *gch; - int heal_num, refresh_num; - - heal_num = skill_lookup("heal"); - refresh_num = skill_lookup("refresh"); - - for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room ) - { - if ((IS_NPC(ch) && IS_NPC(gch)) || - (!IS_NPC(ch) && !IS_NPC(gch))) - { - spell_heal(heal_num,level,ch,(void *) gch,TARGET_CHAR); - spell_refresh(refresh_num,level,ch,(void *) gch,TARGET_CHAR); - } - } -} - - -void spell_mass_invis( int sn, int level, CHAR_DATA *ch, void *vo, int target ) -{ - AFFECT_DATA af; - CHAR_DATA *gch; - - for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room ) - { - if ( !is_same_group( gch, ch ) || IS_AFFECTED(gch, AFF_INVISIBLE) ) - continue; - act( "$n slowly fades out of existence.", gch, NULL, NULL, TO_ROOM ); - send_to_char( "You slowly fade out of existence.\n\r", gch ); - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level/2; - af.duration = 24; - af.location = APPLY_NONE; - af.modifier = 0; - af.bitvector = AFF_INVISIBLE; - affect_to_char( gch, &af ); - } - send_to_char( "Ok.\n\r", ch ); - - return; -} - - - -void spell_null( int sn, int level, CHAR_DATA *ch, void *vo, int target ) -{ - send_to_char( "That's not a spell!\n\r", ch ); - return; -} - - - -void spell_pass_door( int sn, int level, CHAR_DATA *ch, void *vo, int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( IS_AFFECTED(victim, AFF_PASS_DOOR) ) - { - if (victim == ch) - send_to_char("You are already out of phase.\n\r",ch); - else - act("$N is already shifted out of phase.",ch,NULL,victim,TO_CHAR); - return; - } - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = number_fuzzy( level / 4 ); - af.location = APPLY_NONE; - af.modifier = 0; - af.bitvector = AFF_PASS_DOOR; - affect_to_char( victim, &af ); - act( "$n turns translucent.", victim, NULL, NULL, TO_ROOM ); - send_to_char( "You turn translucent.\n\r", victim ); - return; -} - -/* RT plague spell, very nasty */ - -void spell_plague( int sn, int level, CHAR_DATA *ch, void *vo, int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if (saves_spell(level,victim,DAM_DISEASE) || - (IS_NPC(victim) && IS_SET(victim->act,ACT_UNDEAD))) - { - if (ch == victim) - send_to_char("You feel momentarily ill, but it passes.\n\r",ch); - else - act("$N seems to be unaffected.",ch,NULL,victim,TO_CHAR); - return; - } - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level * 3/4; - af.duration = level; - af.location = APPLY_STR; - af.modifier = -5; - af.bitvector = AFF_PLAGUE; - affect_join(victim,&af); - - send_to_char - ("You scream in agony as plague sores erupt from your skin.\n\r",victim); - act("$n screams in agony as plague sores erupt from $s skin.", - victim,NULL,NULL,TO_ROOM); -} - -void spell_poison( int sn, int level, CHAR_DATA *ch, void *vo, int target ) -{ - CHAR_DATA *victim; - OBJ_DATA *obj; - AFFECT_DATA af; - - - if (target == TARGET_OBJ) - { - obj = (OBJ_DATA *) vo; - - if (obj->item_type == ITEM_FOOD || obj->item_type == ITEM_DRINK_CON) - { - if (IS_OBJ_STAT(obj,ITEM_BLESS) || IS_OBJ_STAT(obj,ITEM_BURN_PROOF)) - { - act("Your spell fails to corrupt $p.",ch,obj,NULL,TO_CHAR); - return; - } - obj->value[3] = 1; - act("$p is infused with poisonous vapors.",ch,obj,NULL,TO_ALL); - return; - } - - if (obj->item_type == ITEM_WEAPON) - { - if (IS_WEAPON_STAT(obj,WEAPON_FLAMING) - || IS_WEAPON_STAT(obj,WEAPON_FROST) - || IS_WEAPON_STAT(obj,WEAPON_VAMPIRIC) - || IS_WEAPON_STAT(obj,WEAPON_SHARP) - || IS_WEAPON_STAT(obj,WEAPON_VORPAL) - || IS_WEAPON_STAT(obj,WEAPON_SHOCKING) - || IS_OBJ_STAT(obj,ITEM_BLESS) || IS_OBJ_STAT(obj,ITEM_BURN_PROOF)) - { - act("You can't seem to envenom $p.",ch,obj,NULL,TO_CHAR); - return; - } - - if (IS_WEAPON_STAT(obj,WEAPON_POISON)) - { - act("$p is already envenomed.",ch,obj,NULL,TO_CHAR); - return; - } - - af.where = TO_WEAPON; - af.type = sn; - af.level = level / 2; - af.duration = level/8; - af.location = 0; - af.modifier = 0; - af.bitvector = WEAPON_POISON; - affect_to_obj(obj,&af); - - act("$p is coated with deadly venom.",ch,obj,NULL,TO_ALL); - return; - } - - act("You can't poison $p.",ch,obj,NULL,TO_CHAR); - return; - } - - victim = (CHAR_DATA *) vo; - - if ( saves_spell( level, victim,DAM_POISON) ) - { - act("$n turns slightly green, but it passes.",victim,NULL,NULL,TO_ROOM); - send_to_char("You feel momentarily ill, but it passes.\n\r",victim); - return; - } - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level; - af.location = APPLY_STR; - af.modifier = -2; - af.bitvector = AFF_POISON; - affect_join( victim, &af ); - send_to_char( "You feel very sick.\n\r", victim ); - act("$n looks very ill.",victim,NULL,NULL,TO_ROOM); - return; -} - - - -void spell_protection_evil(int sn,int level,CHAR_DATA *ch,void *vo, int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( IS_AFFECTED(victim, AFF_PROTECT_EVIL) - || IS_AFFECTED(victim, AFF_PROTECT_GOOD)) - { - if (victim == ch) - send_to_char("You are already protected.\n\r",ch); - else - act("$N is already protected.",ch,NULL,victim,TO_CHAR); - return; - } - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = 24; - af.location = APPLY_SAVING_SPELL; - af.modifier = -1; - af.bitvector = AFF_PROTECT_EVIL; - affect_to_char( victim, &af ); - send_to_char( "You feel holy and pure.\n\r", victim ); - if ( ch != victim ) - act("$N is protected from evil.",ch,NULL,victim,TO_CHAR); - return; -} - -void spell_protection_good(int sn,int level,CHAR_DATA *ch,void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( IS_AFFECTED(victim, AFF_PROTECT_GOOD) - || IS_AFFECTED(victim, AFF_PROTECT_EVIL)) - { - if (victim == ch) - send_to_char("You are already protected.\n\r",ch); - else - act("$N is already protected.",ch,NULL,victim,TO_CHAR); - return; - } - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = 24; - af.location = APPLY_SAVING_SPELL; - af.modifier = -1; - af.bitvector = AFF_PROTECT_GOOD; - affect_to_char( victim, &af ); - send_to_char( "You feel aligned with darkness.\n\r", victim ); - if ( ch != victim ) - act("$N is protected from good.",ch,NULL,victim,TO_CHAR); - return; -} - - -void spell_ray_of_truth (int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int dam, align; - - if (IS_EVIL(ch) ) - { - victim = ch; - send_to_char("The energy explodes inside you!\n\r",ch); - } - - if (victim != ch) - { - act("$n raises $s hand, and a blinding ray of light shoots forth!", - ch,NULL,NULL,TO_ROOM); - send_to_char( - "You raise your hand and a blinding ray of light shoots forth!\n\r", - ch); - } - - if (IS_GOOD(victim)) - { - act("$n seems unharmed by the light.",victim,NULL,victim,TO_ROOM); - send_to_char("The light seems powerless to affect you.\n\r",victim); - return; - } - - dam = dice( level, 10 ); - if ( saves_spell( level, victim,DAM_HOLY) ) - dam /= 2; - - align = victim->alignment; - align -= 350; - - if (align < -1000) - align = -1000 + (align + 1000) / 3; - - dam = (dam * align * align) / 1000000; - - damage( ch, victim, dam, sn, DAM_HOLY ,TRUE); - spell_blindness(gsn_blindness, - 3 * level / 4, ch, (void *) victim,TARGET_CHAR); -} - - -void spell_recharge( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - OBJ_DATA *obj = (OBJ_DATA *) vo; - int chance, percent; - - if (obj->item_type != ITEM_WAND && obj->item_type != ITEM_STAFF) - { - send_to_char("That item does not carry charges.\n\r",ch); - return; - } - - if (obj->value[3] >= 3 * level / 2) - { - send_to_char("Your skills are not great enough for that.\n\r",ch); - return; - } - - if (obj->value[1] == 0) - { - send_to_char("That item has already been recharged once.\n\r",ch); - return; - } - - chance = 40 + 2 * level; - - chance -= obj->value[3]; /* harder to do high-level spells */ - chance -= (obj->value[1] - obj->value[2]) * - (obj->value[1] - obj->value[2]); - - chance = UMAX(level/2,chance); - - percent = number_percent(); - - if (percent < chance / 2) - { - act("$p glows softly.",ch,obj,NULL,TO_CHAR); - act("$p glows softly.",ch,obj,NULL,TO_ROOM); - obj->value[2] = UMAX(obj->value[1],obj->value[2]); - obj->value[1] = 0; - return; - } - - else if (percent <= chance) - { - int chargeback,chargemax; - - act("$p glows softly.",ch,obj,NULL,TO_CHAR); - act("$p glows softly.",ch,obj,NULL,TO_CHAR); - - chargemax = obj->value[1] - obj->value[2]; - - if (chargemax > 0) - chargeback = UMAX(1,chargemax * percent / 100); - else - chargeback = 0; - - obj->value[2] += chargeback; - obj->value[1] = 0; - return; - } - - else if (percent <= UMIN(95, 3 * chance / 2)) - { - send_to_char("Nothing seems to happen.\n\r",ch); - if (obj->value[1] > 1) - obj->value[1]--; - return; - } - - else /* whoops! */ - { - act("$p glows brightly and explodes!",ch,obj,NULL,TO_CHAR); - act("$p glows brightly and explodes!",ch,obj,NULL,TO_ROOM); - extract_obj(obj); - } -} - -void spell_refresh( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - victim->move = UMIN( victim->move + level, victim->max_move ); - if (victim->max_move == victim->move) - send_to_char("You feel fully refreshed!\n\r",victim); - else - send_to_char( "You feel less tired.\n\r", victim ); - if ( ch != victim ) - send_to_char( "Ok.\n\r", ch ); - return; -} - -void spell_remove_curse( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim; - OBJ_DATA *obj; - bool found = FALSE; - - /* do object cases first */ - if (target == TARGET_OBJ) - { - obj = (OBJ_DATA *) vo; - - if (IS_OBJ_STAT(obj,ITEM_NODROP) || IS_OBJ_STAT(obj,ITEM_NOREMOVE)) - { - if (!IS_OBJ_STAT(obj,ITEM_NOUNCURSE) - && !saves_dispel(level + 2,obj->level,0)) - { - REMOVE_BIT(obj->extra_flags,ITEM_NODROP); - REMOVE_BIT(obj->extra_flags,ITEM_NOREMOVE); - act("$p glows blue.",ch,obj,NULL,TO_ALL); - return; - } - - act("The curse on $p is beyond your power.",ch,obj,NULL,TO_CHAR); - return; - } - act("There doesn't seem to be a curse on $p.",ch,obj,NULL,TO_CHAR); - return; - } - - /* characters */ - victim = (CHAR_DATA *) vo; - - if (check_dispel(level,victim,gsn_curse)) - { - send_to_char("You feel better.\n\r",victim); - act("$n looks more relaxed.",victim,NULL,NULL,TO_ROOM); - } - - for (obj = victim->carrying; (obj != NULL && !found); obj = obj->next_content) - { - if ((IS_OBJ_STAT(obj,ITEM_NODROP) || IS_OBJ_STAT(obj,ITEM_NOREMOVE)) - && !IS_OBJ_STAT(obj,ITEM_NOUNCURSE)) - { /* attempt to remove curse */ - if (!saves_dispel(level,obj->level,0)) - { - found = TRUE; - REMOVE_BIT(obj->extra_flags,ITEM_NODROP); - REMOVE_BIT(obj->extra_flags,ITEM_NOREMOVE); - act("Your $p glows blue.",victim,obj,NULL,TO_CHAR); - act("$n's $p glows blue.",victim,obj,NULL,TO_ROOM); - } - } - } -} - -void spell_sanctuary( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( IS_AFFECTED(victim, AFF_SANCTUARY) ) - { - if (victim == ch) - send_to_char("You are already in sanctuary.\n\r",ch); - else - act("$N is already in sanctuary.",ch,NULL,victim,TO_CHAR); - return; - } - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level / 6; - af.location = APPLY_NONE; - af.modifier = 0; - af.bitvector = AFF_SANCTUARY; - affect_to_char( victim, &af ); - act( "$n is surrounded by a white aura.", victim, NULL, NULL, TO_ROOM ); - send_to_char( "You are surrounded by a white aura.\n\r", victim ); - return; -} - - - -void spell_shield( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( is_affected( victim, sn ) ) - { - if (victim == ch) - send_to_char("You are already shielded from harm.\n\r",ch); - else - act("$N is already protected by a shield.",ch,NULL,victim,TO_CHAR); - return; - } - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = 8 + level; - af.location = APPLY_AC; - af.modifier = -20; - af.bitvector = 0; - affect_to_char( victim, &af ); - act( "$n is surrounded by a force shield.", victim, NULL, NULL, TO_ROOM ); - send_to_char( "You are surrounded by a force shield.\n\r", victim ); - return; -} - - - -void spell_shocking_grasp(int sn,int level,CHAR_DATA *ch,void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - static const int dam_each[] = - { - 0, - 0, 0, 0, 0, 0, 0, 20, 25, 29, 33, - 36, 39, 39, 39, 40, 40, 41, 41, 42, 42, - 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, - 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, - 53, 53, 54, 54, 55, 55, 56, 56, 57, 57 - }; - int dam; - - level = UMIN(level, sizeof(dam_each)/sizeof(dam_each[0]) - 1); - level = UMAX(0, level); - dam = number_range( dam_each[level] / 2, dam_each[level] * 2 ); - if ( saves_spell( level, victim,DAM_LIGHTNING) ) - dam /= 2; - damage( ch, victim, dam, sn, DAM_LIGHTNING ,TRUE); - return; -} - - - -void spell_sleep( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( IS_AFFECTED(victim, AFF_SLEEP) - || (IS_NPC(victim) && IS_SET(victim->act,ACT_UNDEAD)) - || (level + 2) < victim->level - || saves_spell( level-4, victim,DAM_CHARM) ) - return; - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = 4 + level; - af.location = APPLY_NONE; - af.modifier = 0; - af.bitvector = AFF_SLEEP; - affect_join( victim, &af ); - - if ( IS_AWAKE(victim) ) - { - send_to_char( "You feel very sleepy ..... zzzzzz.\n\r", victim ); - act( "$n goes to sleep.", victim, NULL, NULL, TO_ROOM ); - victim->position = POS_SLEEPING; - } - return; -} - -void spell_slow( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( is_affected( victim, sn ) || IS_AFFECTED(victim,AFF_SLOW)) - { - if (victim == ch) - send_to_char("You can't move any slower!\n\r",ch); - else - act("$N can't get any slower than that.", - ch,NULL,victim,TO_CHAR); - return; - } - - if (saves_spell(level,victim,DAM_OTHER) - || IS_SET(victim->imm_flags,IMM_MAGIC)) - { - if (victim != ch) - send_to_char("Nothing seemed to happen.\n\r",ch); - send_to_char("You feel momentarily lethargic.\n\r",victim); - return; - } - - if (IS_AFFECTED(victim,AFF_HASTE)) - { - if (!check_dispel(level,victim,skill_lookup("haste"))) - { - if (victim != ch) - send_to_char("Spell failed.\n\r",ch); - send_to_char("You feel momentarily slower.\n\r",victim); - return; - } - - act("$n is moving less quickly.",victim,NULL,NULL,TO_ROOM); - return; - } - - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level/2; - af.location = APPLY_DEX; - af.modifier = -1 - (level >= 18) - (level >= 25) - (level >= 32); - af.bitvector = AFF_SLOW; - affect_to_char( victim, &af ); - send_to_char( "You feel yourself slowing d o w n...\n\r", victim ); - act("$n starts to move in slow motion.",victim,NULL,NULL,TO_ROOM); - return; -} - - - - -void spell_stone_skin( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( is_affected( ch, sn ) ) - { - if (victim == ch) - send_to_char("Your skin is already as hard as a rock.\n\r",ch); - else - act("$N is already as hard as can be.",ch,NULL,victim,TO_CHAR); - return; - } - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level; - af.location = APPLY_AC; - af.modifier = -40; - af.bitvector = 0; - affect_to_char( victim, &af ); - act( "$n's skin turns to stone.", victim, NULL, NULL, TO_ROOM ); - send_to_char( "Your skin turns to stone.\n\r", victim ); - return; -} - - - -void spell_summon( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim; - - if ( ( victim = get_char_world( ch, target_name ) ) == NULL - || victim == ch - || victim->in_room == NULL - || IS_SET(ch->in_room->room_flags, ROOM_SAFE) - || IS_SET(victim->in_room->room_flags, ROOM_SAFE) - || IS_SET(victim->in_room->room_flags, ROOM_PRIVATE) - || IS_SET(victim->in_room->room_flags, ROOM_SOLITARY) - || IS_SET(victim->in_room->room_flags, ROOM_NO_RECALL) - || (IS_NPC(victim) && IS_SET(victim->act,ACT_AGGRESSIVE)) - || victim->level >= level + 3 - || (!IS_NPC(victim) && victim->level >= LEVEL_IMMORTAL) - || victim->fighting != NULL - || (IS_NPC(victim) && IS_SET(victim->imm_flags,IMM_SUMMON)) - || (IS_NPC(victim) && victim->pIndexData->pShop != NULL) - || (!IS_NPC(victim) && IS_SET(victim->act,PLR_NOSUMMON)) - || (IS_NPC(victim) && saves_spell( level, victim,DAM_OTHER)) ) - - { - send_to_char( "You failed.\n\r", ch ); - return; - } - - act( "$n disappears suddenly.", victim, NULL, NULL, TO_ROOM ); - char_from_room( victim ); - char_to_room( victim, ch->in_room ); - act( "$n arrives suddenly.", victim, NULL, NULL, TO_ROOM ); - act( "$n has summoned you!", ch, NULL, victim, TO_VICT ); - do_function(victim, &do_look, "auto" ); - return; -} - - - -void spell_teleport( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - ROOM_INDEX_DATA *pRoomIndex; - - if ( victim->in_room == NULL - || IS_SET(victim->in_room->room_flags, ROOM_NO_RECALL) - || ( victim != ch && IS_SET(victim->imm_flags,IMM_SUMMON)) - || ( !IS_NPC(ch) && victim->fighting != NULL ) - || ( victim != ch - && ( saves_spell( level - 5, victim,DAM_OTHER)))) - { - send_to_char( "You failed.\n\r", ch ); - return; - } - - pRoomIndex = get_random_room(victim); - - if (victim != ch) - send_to_char("You have been teleported!\n\r",victim); - - act( "$n vanishes!", victim, NULL, NULL, TO_ROOM ); - char_from_room( victim ); - char_to_room( victim, pRoomIndex ); - act( "$n slowly fades into existence.", victim, NULL, NULL, TO_ROOM ); - do_function(victim, &do_look, "auto" ); - return; -} - - - -void spell_ventriloquate( int sn, int level, CHAR_DATA *ch,void *vo,int target) -{ - char buf1[MAX_STRING_LENGTH]; - char buf2[MAX_STRING_LENGTH]; - char speaker[MAX_INPUT_LENGTH]; - CHAR_DATA *vch; - - target_name = one_argument( target_name, speaker ); - - sprintf( buf1, "%s says '%s'.\n\r", speaker, target_name ); - sprintf( buf2, "Someone makes %s say '%s'.\n\r", speaker, target_name ); - buf1[0] = UPPER(buf1[0]); - - for ( vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room ) - { - if (!is_exact_name( speaker, vch->name) && IS_AWAKE(vch)) - send_to_char( saves_spell(level,vch,DAM_OTHER) ? buf2 : buf1, vch ); - } - - return; -} - - - -void spell_weaken( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - AFFECT_DATA af; - - if ( is_affected( victim, sn ) || saves_spell( level, victim,DAM_OTHER) ) - return; - - af.where = TO_AFFECTS; - af.type = sn; - af.level = level; - af.duration = level / 2; - af.location = APPLY_STR; - af.modifier = -1 * (level / 5); - af.bitvector = AFF_WEAKEN; - affect_to_char( victim, &af ); - send_to_char( "You feel your strength slip away.\n\r", victim ); - act("$n looks tired and weak.",victim,NULL,NULL,TO_ROOM); - return; -} - - - -/* RT recall spell is back */ - -void spell_word_of_recall( int sn, int level, CHAR_DATA *ch,void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - ROOM_INDEX_DATA *location; - - if (IS_NPC(victim)) - return; - - if ((location = get_room_index( ROOM_VNUM_TEMPLE)) == NULL) - { - send_to_char("You are completely lost.\n\r",victim); - return; - } - - if (IS_SET(victim->in_room->room_flags,ROOM_NO_RECALL) || - IS_AFFECTED(victim,AFF_CURSE)) - { - send_to_char("Spell failed.\n\r",victim); - return; - } - - if (victim->fighting != NULL) - stop_fighting(victim,TRUE); - - ch->move /= 2; - act("$n disappears.",victim,NULL,NULL,TO_ROOM); - char_from_room(victim); - char_to_room(victim,location); - act("$n appears in the room.",victim,NULL,NULL,TO_ROOM); - do_function(victim, &do_look, "auto"); -} - -/* - * NPC spells. - */ -void spell_acid_breath( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int dam,hp_dam,dice_dam,hpch; - - act("$n spits acid at $N.",ch,NULL,victim,TO_NOTVICT); - act("$n spits a stream of corrosive acid at you.",ch,NULL,victim,TO_VICT); - act("You spit acid at $N.",ch,NULL,victim,TO_CHAR); - - hpch = UMAX(12,ch->hit); - hp_dam = number_range(hpch/11 + 1, hpch/6); - dice_dam = dice(level,16); - - dam = UMAX(hp_dam + dice_dam/10,dice_dam + hp_dam/10); - - if (saves_spell(level,victim,DAM_ACID)) - { - acid_effect(victim,level/2,dam/4,TARGET_CHAR); - damage(ch,victim,dam/2,sn,DAM_ACID,TRUE); - } - else - { - acid_effect(victim,level,dam,TARGET_CHAR); - damage(ch,victim,dam,sn,DAM_ACID,TRUE); - } -} - - - -void spell_fire_breath( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - CHAR_DATA *vch, *vch_next; - int dam,hp_dam,dice_dam; - int hpch; - - act("$n breathes forth a cone of fire.",ch,NULL,victim,TO_NOTVICT); - act("$n breathes a cone of hot fire over you!",ch,NULL,victim,TO_VICT); - act("You breath forth a cone of fire.",ch,NULL,NULL,TO_CHAR); - - hpch = UMAX( 10, ch->hit ); - hp_dam = number_range( hpch/9+1, hpch/5 ); - dice_dam = dice(level,20); - - dam = UMAX(hp_dam + dice_dam /10, dice_dam + hp_dam / 10); - fire_effect(victim->in_room,level,dam/2,TARGET_ROOM); - - for (vch = victim->in_room->people; vch != NULL; vch = vch_next) - { - vch_next = vch->next_in_room; - - if (is_safe_spell(ch,vch,TRUE) - || (IS_NPC(vch) && IS_NPC(ch) - && (ch->fighting != vch || vch->fighting != ch))) - continue; - - if (vch == victim) /* full damage */ - { - if (saves_spell(level,vch,DAM_FIRE)) - { - fire_effect(vch,level/2,dam/4,TARGET_CHAR); - damage(ch,vch,dam/2,sn,DAM_FIRE,TRUE); - } - else - { - fire_effect(vch,level,dam,TARGET_CHAR); - damage(ch,vch,dam,sn,DAM_FIRE,TRUE); - } - } - else /* partial damage */ - { - if (saves_spell(level - 2,vch,DAM_FIRE)) - { - fire_effect(vch,level/4,dam/8,TARGET_CHAR); - damage(ch,vch,dam/4,sn,DAM_FIRE,TRUE); - } - else - { - fire_effect(vch,level/2,dam/4,TARGET_CHAR); - damage(ch,vch,dam/2,sn,DAM_FIRE,TRUE); - } - } - } -} - -void spell_frost_breath( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - CHAR_DATA *vch, *vch_next; - int dam,hp_dam,dice_dam, hpch; - - act("$n breathes out a freezing cone of frost!",ch,NULL,victim,TO_NOTVICT); - act("$n breathes a freezing cone of frost over you!", - ch,NULL,victim,TO_VICT); - act("You breath out a cone of frost.",ch,NULL,NULL,TO_CHAR); - - hpch = UMAX(12,ch->hit); - hp_dam = number_range(hpch/11 + 1, hpch/6); - dice_dam = dice(level,16); - - dam = UMAX(hp_dam + dice_dam/10,dice_dam + hp_dam/10); - cold_effect(victim->in_room,level,dam/2,TARGET_ROOM); - - for (vch = victim->in_room->people; vch != NULL; vch = vch_next) - { - vch_next = vch->next_in_room; - - if (is_safe_spell(ch,vch,TRUE) - || (IS_NPC(vch) && IS_NPC(ch) - && (ch->fighting != vch || vch->fighting != ch))) - continue; - - if (vch == victim) /* full damage */ - { - if (saves_spell(level,vch,DAM_COLD)) - { - cold_effect(vch,level/2,dam/4,TARGET_CHAR); - damage(ch,vch,dam/2,sn,DAM_COLD,TRUE); - } - else - { - cold_effect(vch,level,dam,TARGET_CHAR); - damage(ch,vch,dam,sn,DAM_COLD,TRUE); - } - } - else - { - if (saves_spell(level - 2,vch,DAM_COLD)) - { - cold_effect(vch,level/4,dam/8,TARGET_CHAR); - damage(ch,vch,dam/4,sn,DAM_COLD,TRUE); - } - else - { - cold_effect(vch,level/2,dam/4,TARGET_CHAR); - damage(ch,vch,dam/2,sn,DAM_COLD,TRUE); - } - } - } -} - - -void spell_gas_breath( int sn, int level, CHAR_DATA *ch, void *vo,int target ) -{ - CHAR_DATA *vch; - CHAR_DATA *vch_next; - int dam,hp_dam,dice_dam,hpch; - - act("$n breathes out a cloud of poisonous gas!",ch,NULL,NULL,TO_ROOM); - act("You breath out a cloud of poisonous gas.",ch,NULL,NULL,TO_CHAR); - - hpch = UMAX(16,ch->hit); - hp_dam = number_range(hpch/15+1,8); - dice_dam = dice(level,12); - - dam = UMAX(hp_dam + dice_dam/10,dice_dam + hp_dam/10); - poison_effect(ch->in_room,level,dam,TARGET_ROOM); - - for (vch = ch->in_room->people; vch != NULL; vch = vch_next) - { - vch_next = vch->next_in_room; - - if (is_safe_spell(ch,vch,TRUE) - || (IS_NPC(ch) && IS_NPC(vch) - && (ch->fighting == vch || vch->fighting == ch))) - continue; - - if (saves_spell(level,vch,DAM_POISON)) - { - poison_effect(vch,level/2,dam/4,TARGET_CHAR); - damage(ch,vch,dam/2,sn,DAM_POISON,TRUE); - } - else - { - poison_effect(vch,level,dam,TARGET_CHAR); - damage(ch,vch,dam,sn,DAM_POISON,TRUE); - } - } -} - -void spell_lightning_breath(int sn,int level,CHAR_DATA *ch,void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int dam,hp_dam,dice_dam,hpch; - - act("$n breathes a bolt of lightning at $N.",ch,NULL,victim,TO_NOTVICT); - act("$n breathes a bolt of lightning at you!",ch,NULL,victim,TO_VICT); - act("You breathe a bolt of lightning at $N.",ch,NULL,victim,TO_CHAR); - - hpch = UMAX(10,ch->hit); - hp_dam = number_range(hpch/9+1,hpch/5); - dice_dam = dice(level,20); - - dam = UMAX(hp_dam + dice_dam/10,dice_dam + hp_dam/10); - - if (saves_spell(level,victim,DAM_LIGHTNING)) - { - shock_effect(victim,level/2,dam/4,TARGET_CHAR); - damage(ch,victim,dam/2,sn,DAM_LIGHTNING,TRUE); - } - else - { - shock_effect(victim,level,dam,TARGET_CHAR); - damage(ch,victim,dam,sn,DAM_LIGHTNING,TRUE); - } -} - -/* - * Spells for mega1.are from Glop/Erkenbrand. - */ -void spell_general_purpose(int sn,int level,CHAR_DATA *ch,void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int dam; - - dam = number_range( 25, 100 ); - if ( saves_spell( level, victim, DAM_PIERCE) ) - dam /= 2; - damage( ch, victim, dam, sn, DAM_PIERCE ,TRUE); - return; -} - -void spell_high_explosive(int sn,int level,CHAR_DATA *ch,void *vo,int target) -{ - CHAR_DATA *victim = (CHAR_DATA *) vo; - int dam; - - dam = number_range( 30, 120 ); - if ( saves_spell( level, victim, DAM_PIERCE) ) - dam /= 2; - damage( ch, victim, dam, sn, DAM_PIERCE ,TRUE); - return; -} diff --git a/archive/src/magic.h b/archive/src/magic.h deleted file mode 100644 index 240e310..0000000 --- a/archive/src/magic.h +++ /dev/null @@ -1,130 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - - -/* - * Spell functions. - * Defined in magic.c. - */ -DECLARE_SPELL_FUN( spell_null ); -DECLARE_SPELL_FUN( spell_acid_blast ); -DECLARE_SPELL_FUN( spell_armor ); -DECLARE_SPELL_FUN( spell_bless ); -DECLARE_SPELL_FUN( spell_blindness ); -DECLARE_SPELL_FUN( spell_burning_hands ); -DECLARE_SPELL_FUN( spell_call_lightning ); -DECLARE_SPELL_FUN( spell_calm ); -DECLARE_SPELL_FUN( spell_cancellation ); -DECLARE_SPELL_FUN( spell_cause_critical ); -DECLARE_SPELL_FUN( spell_cause_light ); -DECLARE_SPELL_FUN( spell_cause_serious ); -DECLARE_SPELL_FUN( spell_change_sex ); -DECLARE_SPELL_FUN( spell_chain_lightning ); -DECLARE_SPELL_FUN( spell_charm_person ); -DECLARE_SPELL_FUN( spell_chill_touch ); -DECLARE_SPELL_FUN( spell_colour_spray ); -DECLARE_SPELL_FUN( spell_continual_light ); -DECLARE_SPELL_FUN( spell_control_weather ); -DECLARE_SPELL_FUN( spell_create_food ); -DECLARE_SPELL_FUN( spell_create_rose ); -DECLARE_SPELL_FUN( spell_create_spring ); -DECLARE_SPELL_FUN( spell_create_water ); -DECLARE_SPELL_FUN( spell_cure_blindness ); -DECLARE_SPELL_FUN( spell_cure_critical ); -DECLARE_SPELL_FUN( spell_cure_disease ); -DECLARE_SPELL_FUN( spell_cure_light ); -DECLARE_SPELL_FUN( spell_cure_poison ); -DECLARE_SPELL_FUN( spell_cure_serious ); -DECLARE_SPELL_FUN( spell_curse ); -DECLARE_SPELL_FUN( spell_demonfire ); -DECLARE_SPELL_FUN( spell_detect_evil ); -DECLARE_SPELL_FUN( spell_detect_good ); -DECLARE_SPELL_FUN( spell_detect_hidden ); -DECLARE_SPELL_FUN( spell_detect_invis ); -DECLARE_SPELL_FUN( spell_detect_magic ); -DECLARE_SPELL_FUN( spell_detect_poison ); -DECLARE_SPELL_FUN( spell_dispel_evil ); -DECLARE_SPELL_FUN( spell_dispel_good ); -DECLARE_SPELL_FUN( spell_dispel_magic ); -DECLARE_SPELL_FUN( spell_earthquake ); -DECLARE_SPELL_FUN( spell_enchant_armor ); -DECLARE_SPELL_FUN( spell_enchant_weapon ); -DECLARE_SPELL_FUN( spell_energy_drain ); -DECLARE_SPELL_FUN( spell_faerie_fire ); -DECLARE_SPELL_FUN( spell_faerie_fog ); -DECLARE_SPELL_FUN( spell_farsight ); -DECLARE_SPELL_FUN( spell_fireball ); -DECLARE_SPELL_FUN( spell_fireproof ); -DECLARE_SPELL_FUN( spell_flamestrike ); -DECLARE_SPELL_FUN( spell_floating_disc ); -DECLARE_SPELL_FUN( spell_fly ); -DECLARE_SPELL_FUN( spell_frenzy ); -DECLARE_SPELL_FUN( spell_gate ); -DECLARE_SPELL_FUN( spell_giant_strength ); -DECLARE_SPELL_FUN( spell_harm ); -DECLARE_SPELL_FUN( spell_haste ); -DECLARE_SPELL_FUN( spell_heal ); -DECLARE_SPELL_FUN( spell_heat_metal ); -DECLARE_SPELL_FUN( spell_holy_word ); -DECLARE_SPELL_FUN( spell_identify ); -DECLARE_SPELL_FUN( spell_infravision ); -DECLARE_SPELL_FUN( spell_invis ); -DECLARE_SPELL_FUN( spell_know_alignment ); -DECLARE_SPELL_FUN( spell_lightning_bolt ); -DECLARE_SPELL_FUN( spell_locate_object ); -DECLARE_SPELL_FUN( spell_magic_missile ); -DECLARE_SPELL_FUN( spell_mass_healing ); -DECLARE_SPELL_FUN( spell_mass_invis ); -DECLARE_SPELL_FUN( spell_nexus ); -DECLARE_SPELL_FUN( spell_pass_door ); -DECLARE_SPELL_FUN( spell_plague ); -DECLARE_SPELL_FUN( spell_poison ); -DECLARE_SPELL_FUN( spell_portal ); -DECLARE_SPELL_FUN( spell_protection_evil ); -DECLARE_SPELL_FUN( spell_protection_good ); -DECLARE_SPELL_FUN( spell_ray_of_truth ); -DECLARE_SPELL_FUN( spell_recharge ); -DECLARE_SPELL_FUN( spell_refresh ); -DECLARE_SPELL_FUN( spell_remove_curse ); -DECLARE_SPELL_FUN( spell_sanctuary ); -DECLARE_SPELL_FUN( spell_shocking_grasp ); -DECLARE_SPELL_FUN( spell_shield ); -DECLARE_SPELL_FUN( spell_sleep ); -DECLARE_SPELL_FUN( spell_slow ); -DECLARE_SPELL_FUN( spell_stone_skin ); -DECLARE_SPELL_FUN( spell_summon ); -DECLARE_SPELL_FUN( spell_teleport ); -DECLARE_SPELL_FUN( spell_ventriloquate ); -DECLARE_SPELL_FUN( spell_weaken ); -DECLARE_SPELL_FUN( spell_word_of_recall ); -DECLARE_SPELL_FUN( spell_acid_breath ); -DECLARE_SPELL_FUN( spell_fire_breath ); -DECLARE_SPELL_FUN( spell_frost_breath ); -DECLARE_SPELL_FUN( spell_gas_breath ); -DECLARE_SPELL_FUN( spell_lightning_breath ); -DECLARE_SPELL_FUN( spell_general_purpose ); -DECLARE_SPELL_FUN( spell_high_explosive ); diff --git a/archive/src/magic2.c b/archive/src/magic2.c deleted file mode 100644 index caa9722..0000000 --- a/archive/src/magic2.c +++ /dev/null @@ -1,174 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#endif -#include -#include -#include -#include -#include "merc.h" -#include "interp.h" -#include "magic.h" - - -extern char *target_name; - -void spell_farsight( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - if (IS_AFFECTED(ch,AFF_BLIND)) - { - send_to_char("Maybe it would help if you could see?\n\r",ch); - return; - } - - do_function(ch, &do_scan, target_name); -} - - -void spell_portal( int sn, int level, CHAR_DATA *ch, void *vo,int target) -{ - CHAR_DATA *victim; - OBJ_DATA *portal, *stone; - - if ( ( victim = get_char_world( ch, target_name ) ) == NULL - || victim == ch - || victim->in_room == NULL - || !can_see_room(ch,victim->in_room) - || IS_SET(victim->in_room->room_flags, ROOM_SAFE) - || IS_SET(victim->in_room->room_flags, ROOM_PRIVATE) - || IS_SET(victim->in_room->room_flags, ROOM_SOLITARY) - || IS_SET(victim->in_room->room_flags, ROOM_NO_RECALL) - || IS_SET(ch->in_room->room_flags, ROOM_NO_RECALL) - || victim->level >= level + 3 - || (!IS_NPC(victim) && victim->level >= LEVEL_HERO) /* NOT trust */ - || (IS_NPC(victim) && IS_SET(victim->imm_flags,IMM_SUMMON)) - || (IS_NPC(victim) && saves_spell( level, victim,DAM_NONE) ) - || (is_clan(victim) && !is_same_clan(ch,victim))) - { - send_to_char( "You failed.\n\r", ch ); - return; - } - - stone = get_eq_char(ch,WEAR_HOLD); - if (!IS_IMMORTAL(ch) - && (stone == NULL || stone->item_type != ITEM_WARP_STONE)) - { - send_to_char("You lack the proper component for this spell.\n\r",ch); - return; - } - - if (stone != NULL && stone->item_type == ITEM_WARP_STONE) - { - act("You draw upon the power of $p.",ch,stone,NULL,TO_CHAR); - act("It flares brightly and vanishes!",ch,stone,NULL,TO_CHAR); - extract_obj(stone); - } - - portal = create_object(get_obj_index(OBJ_VNUM_PORTAL),0); - portal->timer = 2 + level / 25; - portal->value[3] = victim->in_room->vnum; - - obj_to_room(portal,ch->in_room); - - act("$p rises up from the ground.",ch,portal,NULL,TO_ROOM); - act("$p rises up before you.",ch,portal,NULL,TO_CHAR); -} - -void spell_nexus( int sn, int level, CHAR_DATA *ch, void *vo, int target) -{ - CHAR_DATA *victim; - OBJ_DATA *portal, *stone; - ROOM_INDEX_DATA *to_room, *from_room; - - from_room = ch->in_room; - - if ( ( victim = get_char_world( ch, target_name ) ) == NULL - || victim == ch - || (to_room = victim->in_room) == NULL - || !can_see_room(ch,to_room) || !can_see_room(ch,from_room) - || IS_SET(to_room->room_flags, ROOM_SAFE) - || IS_SET(from_room->room_flags,ROOM_SAFE) - || IS_SET(to_room->room_flags, ROOM_PRIVATE) - || IS_SET(to_room->room_flags, ROOM_SOLITARY) - || IS_SET(to_room->room_flags, ROOM_NO_RECALL) - || IS_SET(from_room->room_flags,ROOM_NO_RECALL) - || victim->level >= level + 3 - || (!IS_NPC(victim) && victim->level >= LEVEL_HERO) /* NOT trust */ - || (IS_NPC(victim) && IS_SET(victim->imm_flags,IMM_SUMMON)) - || (IS_NPC(victim) && saves_spell( level, victim,DAM_NONE) ) - || (is_clan(victim) && !is_same_clan(ch,victim))) - { - send_to_char( "You failed.\n\r", ch ); - return; - } - - stone = get_eq_char(ch,WEAR_HOLD); - if (!IS_IMMORTAL(ch) - && (stone == NULL || stone->item_type != ITEM_WARP_STONE)) - { - send_to_char("You lack the proper component for this spell.\n\r",ch); - return; - } - - if (stone != NULL && stone->item_type == ITEM_WARP_STONE) - { - act("You draw upon the power of $p.",ch,stone,NULL,TO_CHAR); - act("It flares brightly and vanishes!",ch,stone,NULL,TO_CHAR); - extract_obj(stone); - } - - /* portal one */ - portal = create_object(get_obj_index(OBJ_VNUM_PORTAL),0); - portal->timer = 1 + level / 10; - portal->value[3] = to_room->vnum; - - obj_to_room(portal,from_room); - - act("$p rises up from the ground.",ch,portal,NULL,TO_ROOM); - act("$p rises up before you.",ch,portal,NULL,TO_CHAR); - - /* no second portal if rooms are the same */ - if (to_room == from_room) - return; - - /* portal two */ - portal = create_object(get_obj_index(OBJ_VNUM_PORTAL),0); - portal->timer = 1 + level/10; - portal->value[3] = from_room->vnum; - - obj_to_room(portal,to_room); - - if (to_room->people != NULL) - { - act("$p rises up from the ground.",to_room->people,portal,NULL,TO_ROOM); - act("$p rises up from the ground.",to_room->people,portal,NULL,TO_CHAR); - } -} diff --git a/archive/src/merc.h b/archive/src/merc.h deleted file mode 100644 index b20e342..0000000 --- a/archive/src/merc.h +++ /dev/null @@ -1,2322 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - - -/* - * Accommodate old non-Ansi compilers. - */ -#if defined(TRADITIONAL) -#define const -#define args( list ) ( ) -#define DECLARE_DO_FUN( fun ) void fun( ) -#define DECLARE_SPEC_FUN( fun ) bool fun( ) -#define DECLARE_SPELL_FUN( fun ) void fun( ) -#else -#define args( list ) list -#define DECLARE_DO_FUN( fun ) DO_FUN fun -#define DECLARE_SPEC_FUN( fun ) SPEC_FUN fun -#define DECLARE_SPELL_FUN( fun ) SPELL_FUN fun -#endif - - -/* - * Short scalar types. - * Diavolo reports AIX compiler has bugs with short types. - */ -#if !defined(FALSE) -#define FALSE 0 -#endif - -#if !defined(TRUE) -#define TRUE 1 -#endif - -#if defined(_AIX) -#if !defined(const) -#define const -#endif -typedef int sh_int; -typedef int bool; -#define unix -#else -typedef short int sh_int; -typedef unsigned char bool; -#endif - - - -/* - * Structure types. - */ -typedef struct affect_data AFFECT_DATA; -typedef struct area_data AREA_DATA; -typedef struct ban_data BAN_DATA; -typedef struct buf_type BUFFER; -typedef struct char_data CHAR_DATA; -typedef struct descriptor_data DESCRIPTOR_DATA; -typedef struct exit_data EXIT_DATA; -typedef struct extra_descr_data EXTRA_DESCR_DATA; -typedef struct help_data HELP_DATA; -typedef struct kill_data KILL_DATA; -typedef struct mem_data MEM_DATA; -typedef struct mob_index_data MOB_INDEX_DATA; -typedef struct note_data NOTE_DATA; -typedef struct obj_data OBJ_DATA; -typedef struct obj_index_data OBJ_INDEX_DATA; -typedef struct pc_data PC_DATA; -typedef struct gen_data GEN_DATA; -typedef struct reset_data RESET_DATA; -typedef struct room_index_data ROOM_INDEX_DATA; -typedef struct shop_data SHOP_DATA; -typedef struct time_info_data TIME_INFO_DATA; -typedef struct weather_data WEATHER_DATA; - - - -/* - * Function types. - */ -typedef void DO_FUN args( ( CHAR_DATA *ch, char *argument ) ); -typedef bool SPEC_FUN args( ( CHAR_DATA *ch ) ); -typedef void SPELL_FUN args( ( int sn, int level, CHAR_DATA *ch, void *vo, - int target ) ); - - - -/* - * String and memory management parameters. - */ -#define MAX_KEY_HASH 1024 -#define MAX_STRING_LENGTH 4608 -#define MAX_INPUT_LENGTH 256 -#define PAGELEN 22 - - - -/* - * Game parameters. - * Increase the max'es if you add more of something. - * Adjust the pulse numbers to suit yourself. - */ -#define MAX_SOCIALS 256 -#define MAX_SKILL 150 -#define MAX_GROUP 30 -#define MAX_IN_GROUP 15 -#define MAX_ALIAS 5 -#define MAX_CLASS 4 -#define MAX_PC_RACE 5 -#define MAX_CLAN 3 -#define MAX_DAMAGE_MESSAGE 41 -#define MAX_LEVEL 60 -#define LEVEL_HERO (MAX_LEVEL - 9) -#define LEVEL_IMMORTAL (MAX_LEVEL - 8) - -#define PULSE_PER_SECOND 4 -#define PULSE_VIOLENCE ( 3 * PULSE_PER_SECOND) -#define PULSE_MOBILE ( 4 * PULSE_PER_SECOND) -#define PULSE_MUSIC ( 6 * PULSE_PER_SECOND) -#define PULSE_TICK (60 * PULSE_PER_SECOND) -#define PULSE_AREA (120 * PULSE_PER_SECOND) - -#define IMPLEMENTOR MAX_LEVEL -#define CREATOR (MAX_LEVEL - 1) -#define SUPREME (MAX_LEVEL - 2) -#define DEITY (MAX_LEVEL - 3) -#define GOD (MAX_LEVEL - 4) -#define IMMORTAL (MAX_LEVEL - 5) -#define DEMI (MAX_LEVEL - 6) -#define ANGEL (MAX_LEVEL - 7) -#define AVATAR (MAX_LEVEL - 8) -#define HERO LEVEL_HERO - - - -/* - * Site ban structure. - */ - -#define BAN_SUFFIX A -#define BAN_PREFIX B -#define BAN_NEWBIES C -#define BAN_ALL D -#define BAN_PERMIT E -#define BAN_PERMANENT F - -struct ban_data -{ - BAN_DATA * next; - bool valid; - sh_int ban_flags; - sh_int level; - char * name; -}; - -struct buf_type -{ - BUFFER * next; - bool valid; - sh_int state; /* error state of the buffer */ - sh_int size; /* size in k */ - char * string; /* buffer's string */ -}; - - - -/* - * Time and weather stuff. - */ -#define SUN_DARK 0 -#define SUN_RISE 1 -#define SUN_LIGHT 2 -#define SUN_SET 3 - -#define SKY_CLOUDLESS 0 -#define SKY_CLOUDY 1 -#define SKY_RAINING 2 -#define SKY_LIGHTNING 3 - -struct time_info_data -{ - int hour; - int day; - int month; - int year; -}; - -struct weather_data -{ - int mmhg; - int change; - int sky; - int sunlight; -}; - - - -/* - * Connected state for a channel. - */ -#define CON_PLAYING 0 -#define CON_GET_NAME 1 -#define CON_GET_OLD_PASSWORD 2 -#define CON_CONFIRM_NEW_NAME 3 -#define CON_GET_NEW_PASSWORD 4 -#define CON_CONFIRM_NEW_PASSWORD 5 -#define CON_GET_NEW_RACE 6 -#define CON_GET_NEW_SEX 7 -#define CON_GET_NEW_CLASS 8 -#define CON_GET_ALIGNMENT 9 -#define CON_DEFAULT_CHOICE 10 -#define CON_GEN_GROUPS 11 -#define CON_PICK_WEAPON 12 -#define CON_READ_IMOTD 13 -#define CON_READ_MOTD 14 -#define CON_BREAK_CONNECT 15 - - - -/* - * Descriptor (channel) structure. - */ -struct descriptor_data -{ - DESCRIPTOR_DATA * next; - DESCRIPTOR_DATA * snoop_by; - CHAR_DATA * character; - CHAR_DATA * original; - bool valid; - char * host; - sh_int descriptor; - sh_int connected; - bool fcommand; - char inbuf [4 * MAX_INPUT_LENGTH]; - char incomm [MAX_INPUT_LENGTH]; - char inlast [MAX_INPUT_LENGTH]; - int repeat; - char * outbuf; - int outsize; - int outtop; - char * showstr_head; - char * showstr_point; -}; - - - -/* - * Attribute bonus structures. - */ -struct str_app_type -{ - sh_int tohit; - sh_int todam; - sh_int carry; - sh_int wield; -}; - -struct int_app_type -{ - sh_int learn; -}; - -struct wis_app_type -{ - sh_int practice; -}; - -struct dex_app_type -{ - sh_int defensive; -}; - -struct con_app_type -{ - sh_int hitp; - sh_int shock; -}; - - - -/* - * TO types for act. - */ -#define TO_ROOM 0 -#define TO_NOTVICT 1 -#define TO_VICT 2 -#define TO_CHAR 3 -#define TO_ALL 4 - - - -/* - * Help table types. - */ -struct help_data -{ - HELP_DATA * next; - sh_int level; - char * keyword; - char * text; -}; - - - -/* - * Shop types. - */ -#define MAX_TRADE 5 - -struct shop_data -{ - SHOP_DATA * next; /* Next shop in list */ - sh_int keeper; /* Vnum of shop keeper mob */ - sh_int buy_type [MAX_TRADE]; /* Item types shop will buy */ - sh_int profit_buy; /* Cost multiplier for buying */ - sh_int profit_sell; /* Cost multiplier for selling */ - sh_int open_hour; /* First opening hour */ - sh_int close_hour; /* First closing hour */ -}; - - - -/* - * Per-class stuff. - */ - -#define MAX_GUILD 2 -#define MAX_STATS 5 -#define STAT_STR 0 -#define STAT_INT 1 -#define STAT_WIS 2 -#define STAT_DEX 3 -#define STAT_CON 4 - -struct class_type -{ - char * name; /* the full name of the class */ - char who_name [4]; /* Three-letter name for 'who' */ - sh_int attr_prime; /* Prime attribute */ - sh_int weapon; /* First weapon */ - sh_int guild[MAX_GUILD]; /* Vnum of guild rooms */ - sh_int skill_adept; /* Maximum skill level */ - sh_int thac0_00; /* Thac0 for level 0 */ - sh_int thac0_32; /* Thac0 for level 32 */ - sh_int hp_min; /* Min hp gained on leveling */ - sh_int hp_max; /* Max hp gained on leveling */ - bool fMana; /* Class gains mana on level */ - char * base_group; /* base skills gained */ - char * default_group; /* default skills gained */ -}; - -struct item_type -{ - int type; - char * name; -}; - -struct weapon_type -{ - char * name; - sh_int vnum; - sh_int type; - sh_int *gsn; -}; - -struct wiznet_type -{ - char * name; - long flag; - int level; -}; - -struct attack_type -{ - char * name; /* name */ - char * noun; /* message */ - int damage; /* damage class */ -}; - -struct race_type -{ - char * name; /* call name of the race */ - bool pc_race; /* can be chosen by pcs */ - long act; /* act bits for the race */ - long aff; /* aff bits for the race */ - long off; /* off bits for the race */ - long imm; /* imm bits for the race */ - long res; /* res bits for the race */ - long vuln; /* vuln bits for the race */ - long form; /* default form flag for the race */ - long parts; /* default parts for the race */ -}; - - -struct pc_race_type /* additional data for pc races */ -{ - char * name; /* MUST be in race_type */ - char who_name[6]; - sh_int points; /* cost in points of the race */ - sh_int class_mult[MAX_CLASS]; /* exp multiplier for class, * 100 */ - char * skills[5]; /* bonus skills for the race */ - sh_int stats[MAX_STATS]; /* starting stats */ - sh_int max_stats[MAX_STATS]; /* maximum stats */ - sh_int size; /* aff bits for the race */ -}; - - -struct spec_type -{ - char * name; /* special function name */ - SPEC_FUN * function; /* the function */ -}; - - - -/* - * Data structure for notes. - */ - -#define NOTE_NOTE 0 -#define NOTE_IDEA 1 -#define NOTE_PENALTY 2 -#define NOTE_NEWS 3 -#define NOTE_CHANGES 4 -struct note_data -{ - NOTE_DATA * next; - bool valid; - sh_int type; - char * sender; - char * date; - char * to_list; - char * subject; - char * text; - time_t date_stamp; -}; - - - -/* - * An affect. - */ -struct affect_data -{ - AFFECT_DATA * next; - bool valid; - sh_int where; - sh_int type; - sh_int level; - sh_int duration; - sh_int location; - sh_int modifier; - int bitvector; -}; - -/* where definitions */ -#define TO_AFFECTS 0 -#define TO_OBJECT 1 -#define TO_IMMUNE 2 -#define TO_RESIST 3 -#define TO_VULN 4 -#define TO_WEAPON 5 - - -/* - * A kill structure (indexed by level). - */ -struct kill_data -{ - sh_int number; - sh_int killed; -}; - - - -/*************************************************************************** - * * - * VALUES OF INTEREST TO AREA BUILDERS * - * (Start of section ... start here) * - * * - ***************************************************************************/ - -/* - * Well known mob virtual numbers. - * Defined in #MOBILES. - */ -#define MOB_VNUM_FIDO 3090 -#define MOB_VNUM_CITYGUARD 3060 -#define MOB_VNUM_VAMPIRE 3404 - -#define MOB_VNUM_PATROLMAN 2106 -#define GROUP_VNUM_TROLLS 2100 -#define GROUP_VNUM_OGRES 2101 - - -/* RT ASCII conversions -- used so we can have letters in this file */ - -#define A 1 -#define B 2 -#define C 4 -#define D 8 -#define E 16 -#define F 32 -#define G 64 -#define H 128 - -#define I 256 -#define J 512 -#define K 1024 -#define L 2048 -#define M 4096 -#define N 8192 -#define O 16384 -#define P 32768 - -#define Q 65536 -#define R 131072 -#define S 262144 -#define T 524288 -#define U 1048576 -#define V 2097152 -#define W 4194304 -#define X 8388608 - -#define Y 16777216 -#define Z 33554432 -#define aa 67108864 /* doubled due to conflicts */ -#define bb 134217728 -#define cc 268435456 -#define dd 536870912 -#define ee 1073741824 - -/* - * ACT bits for mobs. - * Used in #MOBILES. - */ -#define ACT_IS_NPC (A) /* Auto set for mobs */ -#define ACT_SENTINEL (B) /* Stays in one room */ -#define ACT_SCAVENGER (C) /* Picks up objects */ -#define ACT_AGGRESSIVE (F) /* Attacks PC's */ -#define ACT_STAY_AREA (G) /* Won't leave area */ -#define ACT_WIMPY (H) -#define ACT_PET (I) /* Auto set for pets */ -#define ACT_TRAIN (J) /* Can train PC's */ -#define ACT_PRACTICE (K) /* Can practice PC's */ -#define ACT_UNDEAD (O) -#define ACT_CLERIC (Q) -#define ACT_MAGE (R) -#define ACT_THIEF (S) -#define ACT_WARRIOR (T) -#define ACT_NOALIGN (U) -#define ACT_NOPURGE (V) -#define ACT_OUTDOORS (W) -#define ACT_INDOORS (Y) -#define ACT_IS_HEALER (aa) -#define ACT_GAIN (bb) -#define ACT_UPDATE_ALWAYS (cc) -#define ACT_IS_CHANGER (dd) - -/* damage classes */ -#define DAM_NONE 0 -#define DAM_BASH 1 -#define DAM_PIERCE 2 -#define DAM_SLASH 3 -#define DAM_FIRE 4 -#define DAM_COLD 5 -#define DAM_LIGHTNING 6 -#define DAM_ACID 7 -#define DAM_POISON 8 -#define DAM_NEGATIVE 9 -#define DAM_HOLY 10 -#define DAM_ENERGY 11 -#define DAM_MENTAL 12 -#define DAM_DISEASE 13 -#define DAM_DROWNING 14 -#define DAM_LIGHT 15 -#define DAM_OTHER 16 -#define DAM_HARM 17 -#define DAM_CHARM 18 -#define DAM_SOUND 19 - -/* OFF bits for mobiles */ -#define OFF_AREA_ATTACK (A) -#define OFF_BACKSTAB (B) -#define OFF_BASH (C) -#define OFF_BERSERK (D) -#define OFF_DISARM (E) -#define OFF_DODGE (F) -#define OFF_FADE (G) -#define OFF_FAST (H) -#define OFF_KICK (I) -#define OFF_KICK_DIRT (J) -#define OFF_PARRY (K) -#define OFF_RESCUE (L) -#define OFF_TAIL (M) -#define OFF_TRIP (N) -#define OFF_CRUSH (O) -#define ASSIST_ALL (P) -#define ASSIST_ALIGN (Q) -#define ASSIST_RACE (R) -#define ASSIST_PLAYERS (S) -#define ASSIST_GUARD (T) -#define ASSIST_VNUM (U) - -/* return values for check_imm */ -#define IS_NORMAL 0 -#define IS_IMMUNE 1 -#define IS_RESISTANT 2 -#define IS_VULNERABLE 3 - -/* IMM bits for mobs */ -#define IMM_SUMMON (A) -#define IMM_CHARM (B) -#define IMM_MAGIC (C) -#define IMM_WEAPON (D) -#define IMM_BASH (E) -#define IMM_PIERCE (F) -#define IMM_SLASH (G) -#define IMM_FIRE (H) -#define IMM_COLD (I) -#define IMM_LIGHTNING (J) -#define IMM_ACID (K) -#define IMM_POISON (L) -#define IMM_NEGATIVE (M) -#define IMM_HOLY (N) -#define IMM_ENERGY (O) -#define IMM_MENTAL (P) -#define IMM_DISEASE (Q) -#define IMM_DROWNING (R) -#define IMM_LIGHT (S) -#define IMM_SOUND (T) -#define IMM_WOOD (X) -#define IMM_SILVER (Y) -#define IMM_IRON (Z) - -/* RES bits for mobs */ -#define RES_SUMMON (A) -#define RES_CHARM (B) -#define RES_MAGIC (C) -#define RES_WEAPON (D) -#define RES_BASH (E) -#define RES_PIERCE (F) -#define RES_SLASH (G) -#define RES_FIRE (H) -#define RES_COLD (I) -#define RES_LIGHTNING (J) -#define RES_ACID (K) -#define RES_POISON (L) -#define RES_NEGATIVE (M) -#define RES_HOLY (N) -#define RES_ENERGY (O) -#define RES_MENTAL (P) -#define RES_DISEASE (Q) -#define RES_DROWNING (R) -#define RES_LIGHT (S) -#define RES_SOUND (T) -#define RES_WOOD (X) -#define RES_SILVER (Y) -#define RES_IRON (Z) - -/* VULN bits for mobs */ -#define VULN_SUMMON (A) -#define VULN_CHARM (B) -#define VULN_MAGIC (C) -#define VULN_WEAPON (D) -#define VULN_BASH (E) -#define VULN_PIERCE (F) -#define VULN_SLASH (G) -#define VULN_FIRE (H) -#define VULN_COLD (I) -#define VULN_LIGHTNING (J) -#define VULN_ACID (K) -#define VULN_POISON (L) -#define VULN_NEGATIVE (M) -#define VULN_HOLY (N) -#define VULN_ENERGY (O) -#define VULN_MENTAL (P) -#define VULN_DISEASE (Q) -#define VULN_DROWNING (R) -#define VULN_LIGHT (S) -#define VULN_SOUND (T) -#define VULN_WOOD (X) -#define VULN_SILVER (Y) -#define VULN_IRON (Z) - -/* body form */ -#define FORM_EDIBLE (A) -#define FORM_POISON (B) -#define FORM_MAGICAL (C) -#define FORM_INSTANT_DECAY (D) -#define FORM_OTHER (E) /* defined by material bit */ - -/* actual form */ -#define FORM_ANIMAL (G) -#define FORM_SENTIENT (H) -#define FORM_UNDEAD (I) -#define FORM_CONSTRUCT (J) -#define FORM_MIST (K) -#define FORM_INTANGIBLE (L) - -#define FORM_BIPED (M) -#define FORM_CENTAUR (N) -#define FORM_INSECT (O) -#define FORM_SPIDER (P) -#define FORM_CRUSTACEAN (Q) -#define FORM_WORM (R) -#define FORM_BLOB (S) - -#define FORM_MAMMAL (V) -#define FORM_BIRD (W) -#define FORM_REPTILE (X) -#define FORM_SNAKE (Y) -#define FORM_DRAGON (Z) -#define FORM_AMPHIBIAN (aa) -#define FORM_FISH (bb) -#define FORM_COLD_BLOOD (cc) - -/* body parts */ -#define PART_HEAD (A) -#define PART_ARMS (B) -#define PART_LEGS (C) -#define PART_HEART (D) -#define PART_BRAINS (E) -#define PART_GUTS (F) -#define PART_HANDS (G) -#define PART_FEET (H) -#define PART_FINGERS (I) -#define PART_EAR (J) -#define PART_EYE (K) -#define PART_LONG_TONGUE (L) -#define PART_EYESTALKS (M) -#define PART_TENTACLES (N) -#define PART_FINS (O) -#define PART_WINGS (P) -#define PART_TAIL (Q) -/* for combat */ -#define PART_CLAWS (U) -#define PART_FANGS (V) -#define PART_HORNS (W) -#define PART_SCALES (X) -#define PART_TUSKS (Y) - - -/* - * Bits for 'affected_by'. - * Used in #MOBILES. - */ -#define AFF_BLIND (A) -#define AFF_INVISIBLE (B) -#define AFF_DETECT_EVIL (C) -#define AFF_DETECT_INVIS (D) -#define AFF_DETECT_MAGIC (E) -#define AFF_DETECT_HIDDEN (F) -#define AFF_DETECT_GOOD (G) -#define AFF_SANCTUARY (H) -#define AFF_FAERIE_FIRE (I) -#define AFF_INFRARED (J) -#define AFF_CURSE (K) -#define AFF_UNUSED_FLAG (L) /* unused */ -#define AFF_POISON (M) -#define AFF_PROTECT_EVIL (N) -#define AFF_PROTECT_GOOD (O) -#define AFF_SNEAK (P) -#define AFF_HIDE (Q) -#define AFF_SLEEP (R) -#define AFF_CHARM (S) -#define AFF_FLYING (T) -#define AFF_PASS_DOOR (U) -#define AFF_HASTE (V) -#define AFF_CALM (W) -#define AFF_PLAGUE (X) -#define AFF_WEAKEN (Y) -#define AFF_DARK_VISION (Z) -#define AFF_BERSERK (aa) -#define AFF_SWIM (bb) -#define AFF_REGENERATION (cc) -#define AFF_SLOW (dd) - - - - -/* - * Sex. - * Used in #MOBILES. - */ -#define SEX_NEUTRAL 0 -#define SEX_MALE 1 -#define SEX_FEMALE 2 - -/* AC types */ -#define AC_PIERCE 0 -#define AC_BASH 1 -#define AC_SLASH 2 -#define AC_EXOTIC 3 - -/* dice */ -#define DICE_NUMBER 0 -#define DICE_TYPE 1 -#define DICE_BONUS 2 - -/* size */ -#define SIZE_TINY 0 -#define SIZE_SMALL 1 -#define SIZE_MEDIUM 2 -#define SIZE_LARGE 3 -#define SIZE_HUGE 4 -#define SIZE_GIANT 5 - - - -/* - * Well known object virtual numbers. - * Defined in #OBJECTS. - */ -#define OBJ_VNUM_SILVER_ONE 1 -#define OBJ_VNUM_GOLD_ONE 2 -#define OBJ_VNUM_GOLD_SOME 3 -#define OBJ_VNUM_SILVER_SOME 4 -#define OBJ_VNUM_COINS 5 - -#define OBJ_VNUM_CORPSE_NPC 10 -#define OBJ_VNUM_CORPSE_PC 11 -#define OBJ_VNUM_SEVERED_HEAD 12 -#define OBJ_VNUM_TORN_HEART 13 -#define OBJ_VNUM_SLICED_ARM 14 -#define OBJ_VNUM_SLICED_LEG 15 -#define OBJ_VNUM_GUTS 16 -#define OBJ_VNUM_BRAINS 17 - -#define OBJ_VNUM_MUSHROOM 20 -#define OBJ_VNUM_LIGHT_BALL 21 -#define OBJ_VNUM_SPRING 22 -#define OBJ_VNUM_DISC 23 -#define OBJ_VNUM_PORTAL 25 - -#define OBJ_VNUM_ROSE 1001 - -#define OBJ_VNUM_PIT 3010 - -#define OBJ_VNUM_SCHOOL_MACE 3700 -#define OBJ_VNUM_SCHOOL_DAGGER 3701 -#define OBJ_VNUM_SCHOOL_SWORD 3702 -#define OBJ_VNUM_SCHOOL_SPEAR 3717 -#define OBJ_VNUM_SCHOOL_STAFF 3718 -#define OBJ_VNUM_SCHOOL_AXE 3719 -#define OBJ_VNUM_SCHOOL_FLAIL 3720 -#define OBJ_VNUM_SCHOOL_WHIP 3721 -#define OBJ_VNUM_SCHOOL_POLEARM 3722 - -#define OBJ_VNUM_SCHOOL_VEST 3703 -#define OBJ_VNUM_SCHOOL_SHIELD 3704 -#define OBJ_VNUM_SCHOOL_BANNER 3716 -#define OBJ_VNUM_MAP 3162 - -#define OBJ_VNUM_WHISTLE 2116 - - - -/* - * Item types. - * Used in #OBJECTS. - */ -#define ITEM_LIGHT 1 -#define ITEM_SCROLL 2 -#define ITEM_WAND 3 -#define ITEM_STAFF 4 -#define ITEM_WEAPON 5 -#define ITEM_TREASURE 8 -#define ITEM_ARMOR 9 -#define ITEM_POTION 10 -#define ITEM_CLOTHING 11 -#define ITEM_FURNITURE 12 -#define ITEM_TRASH 13 -#define ITEM_CONTAINER 15 -#define ITEM_DRINK_CON 17 -#define ITEM_KEY 18 -#define ITEM_FOOD 19 -#define ITEM_MONEY 20 -#define ITEM_BOAT 22 -#define ITEM_CORPSE_NPC 23 -#define ITEM_CORPSE_PC 24 -#define ITEM_FOUNTAIN 25 -#define ITEM_PILL 26 -#define ITEM_PROTECT 27 -#define ITEM_MAP 28 -#define ITEM_PORTAL 29 -#define ITEM_WARP_STONE 30 -#define ITEM_ROOM_KEY 31 -#define ITEM_GEM 32 -#define ITEM_JEWELRY 33 -#define ITEM_JUKEBOX 34 - - - -/* - * Extra flags. - * Used in #OBJECTS. - */ -#define ITEM_GLOW (A) -#define ITEM_HUM (B) -#define ITEM_DARK (C) -#define ITEM_LOCK (D) -#define ITEM_EVIL (E) -#define ITEM_INVIS (F) -#define ITEM_MAGIC (G) -#define ITEM_NODROP (H) -#define ITEM_BLESS (I) -#define ITEM_ANTI_GOOD (J) -#define ITEM_ANTI_EVIL (K) -#define ITEM_ANTI_NEUTRAL (L) -#define ITEM_NOREMOVE (M) -#define ITEM_INVENTORY (N) -#define ITEM_NOPURGE (O) -#define ITEM_ROT_DEATH (P) -#define ITEM_VIS_DEATH (Q) -#define ITEM_NONMETAL (S) -#define ITEM_NOLOCATE (T) -#define ITEM_MELT_DROP (U) -#define ITEM_HAD_TIMER (V) -#define ITEM_SELL_EXTRACT (W) -#define ITEM_BURN_PROOF (Y) -#define ITEM_NOUNCURSE (Z) - - -/* - * Wear flags. - * Used in #OBJECTS. - */ -#define ITEM_TAKE (A) -#define ITEM_WEAR_FINGER (B) -#define ITEM_WEAR_NECK (C) -#define ITEM_WEAR_BODY (D) -#define ITEM_WEAR_HEAD (E) -#define ITEM_WEAR_LEGS (F) -#define ITEM_WEAR_FEET (G) -#define ITEM_WEAR_HANDS (H) -#define ITEM_WEAR_ARMS (I) -#define ITEM_WEAR_SHIELD (J) -#define ITEM_WEAR_ABOUT (K) -#define ITEM_WEAR_WAIST (L) -#define ITEM_WEAR_WRIST (M) -#define ITEM_WIELD (N) -#define ITEM_HOLD (O) -#define ITEM_NO_SAC (P) -#define ITEM_WEAR_FLOAT (Q) - -/* weapon class */ -#define WEAPON_EXOTIC 0 -#define WEAPON_SWORD 1 -#define WEAPON_DAGGER 2 -#define WEAPON_SPEAR 3 -#define WEAPON_MACE 4 -#define WEAPON_AXE 5 -#define WEAPON_FLAIL 6 -#define WEAPON_WHIP 7 -#define WEAPON_POLEARM 8 - -/* weapon types */ -#define WEAPON_FLAMING (A) -#define WEAPON_FROST (B) -#define WEAPON_VAMPIRIC (C) -#define WEAPON_SHARP (D) -#define WEAPON_VORPAL (E) -#define WEAPON_TWO_HANDS (F) -#define WEAPON_SHOCKING (G) -#define WEAPON_POISON (H) - -/* gate flags */ -#define GATE_NORMAL_EXIT (A) -#define GATE_NOCURSE (B) -#define GATE_GOWITH (C) -#define GATE_BUGGY (D) -#define GATE_RANDOM (E) - -/* furniture flags */ -#define STAND_AT (A) -#define STAND_ON (B) -#define STAND_IN (C) -#define SIT_AT (D) -#define SIT_ON (E) -#define SIT_IN (F) -#define REST_AT (G) -#define REST_ON (H) -#define REST_IN (I) -#define SLEEP_AT (J) -#define SLEEP_ON (K) -#define SLEEP_IN (L) -#define PUT_AT (M) -#define PUT_ON (N) -#define PUT_IN (O) -#define PUT_INSIDE (P) - - - - -/* - * Apply types (for affects). - * Used in #OBJECTS. - */ -#define APPLY_NONE 0 -#define APPLY_STR 1 -#define APPLY_DEX 2 -#define APPLY_INT 3 -#define APPLY_WIS 4 -#define APPLY_CON 5 -#define APPLY_SEX 6 -#define APPLY_CLASS 7 -#define APPLY_LEVEL 8 -#define APPLY_AGE 9 -#define APPLY_HEIGHT 10 -#define APPLY_WEIGHT 11 -#define APPLY_MANA 12 -#define APPLY_HIT 13 -#define APPLY_MOVE 14 -#define APPLY_GOLD 15 -#define APPLY_EXP 16 -#define APPLY_AC 17 -#define APPLY_HITROLL 18 -#define APPLY_DAMROLL 19 -#define APPLY_SAVES 20 -#define APPLY_SAVING_PARA 20 -#define APPLY_SAVING_ROD 21 -#define APPLY_SAVING_PETRI 22 -#define APPLY_SAVING_BREATH 23 -#define APPLY_SAVING_SPELL 24 -#define APPLY_SPELL_AFFECT 25 - -/* - * Values for containers (value[1]). - * Used in #OBJECTS. - */ -#define CONT_CLOSEABLE 1 -#define CONT_PICKPROOF 2 -#define CONT_CLOSED 4 -#define CONT_LOCKED 8 -#define CONT_PUT_ON 16 - - - -/* - * Well known room virtual numbers. - * Defined in #ROOMS. - */ -#define ROOM_VNUM_LIMBO 2 -#define ROOM_VNUM_CHAT 1200 -#define ROOM_VNUM_TEMPLE 3001 -#define ROOM_VNUM_ALTAR 3054 -#define ROOM_VNUM_SCHOOL 3700 -#define ROOM_VNUM_BALANCE 4500 -#define ROOM_VNUM_CIRCLE 4400 -#define ROOM_VNUM_DEMISE 4201 -#define ROOM_VNUM_HONOR 4300 - - - -/* - * Room flags. - * Used in #ROOMS. - */ -#define ROOM_DARK (A) -#define ROOM_NO_MOB (C) -#define ROOM_INDOORS (D) - -#define ROOM_PRIVATE (J) -#define ROOM_SAFE (K) -#define ROOM_SOLITARY (L) -#define ROOM_PET_SHOP (M) -#define ROOM_NO_RECALL (N) -#define ROOM_IMP_ONLY (O) -#define ROOM_GODS_ONLY (P) -#define ROOM_HEROES_ONLY (Q) -#define ROOM_NEWBIES_ONLY (R) -#define ROOM_LAW (S) -#define ROOM_NOWHERE (T) - - - -/* - * Directions. - * Used in #ROOMS. - */ -#define DIR_NORTH 0 -#define DIR_EAST 1 -#define DIR_SOUTH 2 -#define DIR_WEST 3 -#define DIR_UP 4 -#define DIR_DOWN 5 - - - -/* - * Exit flags. - * Used in #ROOMS. - */ -#define EX_ISDOOR (A) -#define EX_CLOSED (B) -#define EX_LOCKED (C) -#define EX_PICKPROOF (F) -#define EX_NOPASS (G) -#define EX_EASY (H) -#define EX_HARD (I) -#define EX_INFURIATING (J) -#define EX_NOCLOSE (K) -#define EX_NOLOCK (L) - - - -/* - * Sector types. - * Used in #ROOMS. - */ -#define SECT_INSIDE 0 -#define SECT_CITY 1 -#define SECT_FIELD 2 -#define SECT_FOREST 3 -#define SECT_HILLS 4 -#define SECT_MOUNTAIN 5 -#define SECT_WATER_SWIM 6 -#define SECT_WATER_NOSWIM 7 -#define SECT_UNUSED 8 -#define SECT_AIR 9 -#define SECT_DESERT 10 -#define SECT_MAX 11 - - - -/* - * Equpiment wear locations. - * Used in #RESETS. - */ -#define WEAR_NONE -1 -#define WEAR_LIGHT 0 -#define WEAR_FINGER_L 1 -#define WEAR_FINGER_R 2 -#define WEAR_NECK_1 3 -#define WEAR_NECK_2 4 -#define WEAR_BODY 5 -#define WEAR_HEAD 6 -#define WEAR_LEGS 7 -#define WEAR_FEET 8 -#define WEAR_HANDS 9 -#define WEAR_ARMS 10 -#define WEAR_SHIELD 11 -#define WEAR_ABOUT 12 -#define WEAR_WAIST 13 -#define WEAR_WRIST_L 14 -#define WEAR_WRIST_R 15 -#define WEAR_WIELD 16 -#define WEAR_HOLD 17 -#define WEAR_FLOAT 18 -#define MAX_WEAR 19 - - - -/*************************************************************************** - * * - * VALUES OF INTEREST TO AREA BUILDERS * - * (End of this section ... stop here) * - * * - ***************************************************************************/ - -/* - * Conditions. - */ -#define COND_DRUNK 0 -#define COND_FULL 1 -#define COND_THIRST 2 -#define COND_HUNGER 3 - - - -/* - * Positions. - */ -#define POS_DEAD 0 -#define POS_MORTAL 1 -#define POS_INCAP 2 -#define POS_STUNNED 3 -#define POS_SLEEPING 4 -#define POS_RESTING 5 -#define POS_SITTING 6 -#define POS_FIGHTING 7 -#define POS_STANDING 8 - - - -/* - * ACT bits for players. - */ -#define PLR_IS_NPC (A) /* Don't EVER set. */ - -/* RT auto flags */ -#define PLR_AUTOASSIST (C) -#define PLR_AUTOEXIT (D) -#define PLR_AUTOLOOT (E) -#define PLR_AUTOSAC (F) -#define PLR_AUTOGOLD (G) -#define PLR_AUTOSPLIT (H) - -/* RT personal flags */ -#define PLR_HOLYLIGHT (N) -#define PLR_CANLOOT (P) -#define PLR_NOSUMMON (Q) -#define PLR_NOFOLLOW (R) -/* 2 bits reserved, S-T */ - -/* penalty flags */ -#define PLR_PERMIT (U) -#define PLR_LOG (W) -#define PLR_DENY (X) -#define PLR_FREEZE (Y) -#define PLR_THIEF (Z) -#define PLR_KILLER (aa) - - -/* RT comm flags -- may be used on both mobs and chars */ -#define COMM_QUIET (A) -#define COMM_DEAF (B) -#define COMM_NOWIZ (C) -#define COMM_NOAUCTION (D) -#define COMM_NOGOSSIP (E) -#define COMM_NOQUESTION (F) -#define COMM_NOMUSIC (G) -#define COMM_NOCLAN (H) -#define COMM_NOQUOTE (I) -#define COMM_SHOUTSOFF (J) - -/* display flags */ -#define COMM_COMPACT (L) -#define COMM_BRIEF (M) -#define COMM_PROMPT (N) -#define COMM_COMBINE (O) -#define COMM_TELNET_GA (P) -#define COMM_SHOW_AFFECTS (Q) -#define COMM_NOGRATS (R) - -/* penalties */ -#define COMM_NOEMOTE (T) -#define COMM_NOSHOUT (U) -#define COMM_NOTELL (V) -#define COMM_NOCHANNELS (W) -#define COMM_SNOOP_PROOF (Y) -#define COMM_AFK (Z) - -/* WIZnet flags */ -#define WIZ_ON (A) -#define WIZ_TICKS (B) -#define WIZ_LOGINS (C) -#define WIZ_SITES (D) -#define WIZ_LINKS (E) -#define WIZ_DEATHS (F) -#define WIZ_RESETS (G) -#define WIZ_MOBDEATHS (H) -#define WIZ_FLAGS (I) -#define WIZ_PENALTIES (J) -#define WIZ_SACCING (K) -#define WIZ_LEVELS (L) -#define WIZ_SECURE (M) -#define WIZ_SWITCHES (N) -#define WIZ_SNOOPS (O) -#define WIZ_RESTORE (P) -#define WIZ_LOAD (Q) -#define WIZ_NEWBIE (R) -#define WIZ_PREFIX (S) -#define WIZ_SPAM (T) - -/* - * Prototype for a mob. - * This is the in-memory version of #MOBILES. - */ -struct mob_index_data -{ - MOB_INDEX_DATA * next; - SPEC_FUN * spec_fun; - SHOP_DATA * pShop; - sh_int vnum; - sh_int group; - bool new_format; - sh_int count; - sh_int killed; - char * player_name; - char * short_descr; - char * long_descr; - char * description; - long act; - long affected_by; - sh_int alignment; - sh_int level; - sh_int hitroll; - sh_int hit[3]; - sh_int mana[3]; - sh_int damage[3]; - sh_int ac[4]; - sh_int dam_type; - long off_flags; - long imm_flags; - long res_flags; - long vuln_flags; - sh_int start_pos; - sh_int default_pos; - sh_int sex; - sh_int race; - long wealth; - long form; - long parts; - sh_int size; - char * material; -}; - - - -/* memory settings */ -#define MEM_CUSTOMER A -#define MEM_SELLER B -#define MEM_HOSTILE C -#define MEM_AFRAID D - -/* memory for mobs */ -struct mem_data -{ - MEM_DATA *next; - bool valid; - int id; - int reaction; - time_t when; -}; - - -/* - * One character (PC or NPC). - */ -struct char_data -{ - CHAR_DATA * next; - CHAR_DATA * next_in_room; - CHAR_DATA * master; - CHAR_DATA * leader; - CHAR_DATA * fighting; - CHAR_DATA * reply; - CHAR_DATA * pet; - MEM_DATA * memory; - SPEC_FUN * spec_fun; - MOB_INDEX_DATA * pIndexData; - DESCRIPTOR_DATA * desc; - AFFECT_DATA * affected; - NOTE_DATA * pnote; - OBJ_DATA * carrying; - OBJ_DATA * on; - ROOM_INDEX_DATA * in_room; - ROOM_INDEX_DATA * was_in_room; - AREA_DATA * zone; - PC_DATA * pcdata; - GEN_DATA * gen_data; - bool valid; - char * name; - long id; - sh_int version; - char * short_descr; - char * long_descr; - char * description; - char * prompt; - char * prefix; - sh_int group; - sh_int clan; - sh_int sex; - sh_int class; - sh_int race; - sh_int level; - sh_int trust; - int played; - int lines; /* for the pager */ - time_t logon; - sh_int timer; - sh_int wait; - sh_int daze; - sh_int hit; - sh_int max_hit; - sh_int mana; - sh_int max_mana; - sh_int move; - sh_int max_move; - long gold; - long silver; - int exp; - long act; - long comm; /* RT added to pad the vector */ - long wiznet; /* wiz stuff */ - long imm_flags; - long res_flags; - long vuln_flags; - sh_int invis_level; - sh_int incog_level; - long affected_by; - sh_int position; - sh_int practice; - sh_int train; - sh_int carry_weight; - sh_int carry_number; - sh_int saving_throw; - sh_int alignment; - sh_int hitroll; - sh_int damroll; - sh_int armor[4]; - sh_int wimpy; - /* stats */ - sh_int perm_stat[MAX_STATS]; - sh_int mod_stat[MAX_STATS]; - /* parts stuff */ - long form; - long parts; - sh_int size; - char* material; - /* mobile stuff */ - long off_flags; - sh_int damage[3]; - sh_int dam_type; - sh_int start_pos; - sh_int default_pos; -}; - - - -/* - * Data which only PC's have. - */ -struct pc_data -{ - PC_DATA * next; - BUFFER * buffer; - bool valid; - char * pwd; - char * bamfin; - char * bamfout; - char * title; - time_t last_note; - time_t last_idea; - time_t last_penalty; - time_t last_news; - time_t last_changes; - sh_int perm_hit; - sh_int perm_mana; - sh_int perm_move; - sh_int true_sex; - int last_level; - sh_int condition [4]; - sh_int learned [MAX_SKILL]; - bool group_known [MAX_GROUP]; - sh_int points; - bool confirm_delete; - char * alias[MAX_ALIAS]; - char * alias_sub[MAX_ALIAS]; -}; - -/* Data for generating characters -- only used during generation */ -struct gen_data -{ - GEN_DATA *next; - bool valid; - bool skill_chosen[MAX_SKILL]; - bool group_chosen[MAX_GROUP]; - int points_chosen; -}; - - - -/* - * Liquids. - */ -#define LIQ_WATER 0 - -struct liq_type -{ - char * liq_name; - char * liq_color; - sh_int liq_affect[5]; -}; - - - -/* - * Extra description data for a room or object. - */ -struct extra_descr_data -{ - EXTRA_DESCR_DATA *next; /* Next in list */ - bool valid; - char *keyword; /* Keyword in look/examine */ - char *description; /* What to see */ -}; - - - -/* - * Prototype for an object. - */ -struct obj_index_data -{ - OBJ_INDEX_DATA * next; - EXTRA_DESCR_DATA * extra_descr; - AFFECT_DATA * affected; - bool new_format; - char * name; - char * short_descr; - char * description; - sh_int vnum; - sh_int reset_num; - char * material; - sh_int item_type; - int extra_flags; - int wear_flags; - sh_int level; - sh_int condition; - sh_int count; - sh_int weight; - int cost; - int value[5]; -}; - - - -/* - * One object. - */ -struct obj_data -{ - OBJ_DATA * next; - OBJ_DATA * next_content; - OBJ_DATA * contains; - OBJ_DATA * in_obj; - OBJ_DATA * on; - CHAR_DATA * carried_by; - EXTRA_DESCR_DATA * extra_descr; - AFFECT_DATA * affected; - OBJ_INDEX_DATA * pIndexData; - ROOM_INDEX_DATA * in_room; - bool valid; - bool enchanted; - char * owner; - char * name; - char * short_descr; - char * description; - sh_int item_type; - int extra_flags; - int wear_flags; - sh_int wear_loc; - sh_int weight; - int cost; - sh_int level; - sh_int condition; - char * material; - sh_int timer; - int value [5]; -}; - - - -/* - * Exit data. - */ -struct exit_data -{ - union - { - ROOM_INDEX_DATA * to_room; - sh_int vnum; - } u1; - sh_int exit_info; - sh_int key; - char * keyword; - char * description; -}; - - - -/* - * Reset commands: - * '*': comment - * 'M': read a mobile - * 'O': read an object - * 'P': put object in object - * 'G': give object to mobile - * 'E': equip object to mobile - * 'D': set state of door - * 'R': randomize room exits - * 'S': stop (end of list) - */ - -/* - * Area-reset definition. - */ -struct reset_data -{ - RESET_DATA * next; - char command; - sh_int arg1; - sh_int arg2; - sh_int arg3; - sh_int arg4; -}; - - - -/* - * Area definition. - */ -struct area_data -{ - AREA_DATA * next; - RESET_DATA * reset_first; - RESET_DATA * reset_last; - char * file_name; - char * name; - char * credits; - sh_int age; - sh_int nplayer; - sh_int low_range; - sh_int high_range; - sh_int min_vnum; - sh_int max_vnum; - bool empty; -}; - - - -/* - * Room type. - */ -struct room_index_data -{ - ROOM_INDEX_DATA * next; - CHAR_DATA * people; - OBJ_DATA * contents; - EXTRA_DESCR_DATA * extra_descr; - AREA_DATA * area; - EXIT_DATA * exit [6]; - EXIT_DATA * old_exit[6]; - char * name; - char * description; - char * owner; - sh_int vnum; - int room_flags; - sh_int light; - sh_int sector_type; - sh_int heal_rate; - sh_int mana_rate; - sh_int clan; -}; - - - -/* - * Types of attacks. - * Must be non-overlapping with spell/skill types, - * but may be arbitrary beyond that. - */ -#define TYPE_UNDEFINED -1 -#define TYPE_HIT 1000 - - - -/* - * Target types. - */ -#define TAR_IGNORE 0 -#define TAR_CHAR_OFFENSIVE 1 -#define TAR_CHAR_DEFENSIVE 2 -#define TAR_CHAR_SELF 3 -#define TAR_OBJ_INV 4 -#define TAR_OBJ_CHAR_DEF 5 -#define TAR_OBJ_CHAR_OFF 6 - -#define TARGET_CHAR 0 -#define TARGET_OBJ 1 -#define TARGET_ROOM 2 -#define TARGET_NONE 3 - - - -/* - * Skills include spells as a particular case. - */ -struct skill_type -{ - char * name; /* Name of skill */ - sh_int skill_level[MAX_CLASS]; /* Level needed by class */ - sh_int rating[MAX_CLASS]; /* How hard it is to learn */ - SPELL_FUN * spell_fun; /* Spell pointer (for spells) */ - sh_int target; /* Legal targets */ - sh_int minimum_position; /* Position for caster / user */ - sh_int * pgsn; /* Pointer to associated gsn */ - sh_int slot; /* Slot for #OBJECT loading */ - sh_int min_mana; /* Minimum mana used */ - sh_int beats; /* Waiting time after use */ - char * noun_damage; /* Damage message */ - char * msg_off; /* Wear off message */ - char * msg_obj; /* Wear off message for obects */ -}; - -struct group_type -{ - char * name; - sh_int rating[MAX_CLASS]; - char * spells[MAX_IN_GROUP]; -}; - - - -/* - * These are skill_lookup return values for common skills and spells. - */ -extern sh_int gsn_backstab; -extern sh_int gsn_dodge; -extern sh_int gsn_envenom; -extern sh_int gsn_hide; -extern sh_int gsn_peek; -extern sh_int gsn_pick_lock; -extern sh_int gsn_sneak; -extern sh_int gsn_steal; - -extern sh_int gsn_disarm; -extern sh_int gsn_enhanced_damage; -extern sh_int gsn_kick; -extern sh_int gsn_parry; -extern sh_int gsn_rescue; -extern sh_int gsn_second_attack; -extern sh_int gsn_third_attack; - -extern sh_int gsn_blindness; -extern sh_int gsn_charm_person; -extern sh_int gsn_curse; -extern sh_int gsn_invis; -extern sh_int gsn_mass_invis; -extern sh_int gsn_plague; -extern sh_int gsn_poison; -extern sh_int gsn_sleep; -extern sh_int gsn_fly; -extern sh_int gsn_sanctuary; - -/* new gsns */ -extern sh_int gsn_axe; -extern sh_int gsn_dagger; -extern sh_int gsn_flail; -extern sh_int gsn_mace; -extern sh_int gsn_polearm; -extern sh_int gsn_shield_block; -extern sh_int gsn_spear; -extern sh_int gsn_sword; -extern sh_int gsn_whip; - -extern sh_int gsn_bash; -extern sh_int gsn_berserk; -extern sh_int gsn_dirt; -extern sh_int gsn_hand_to_hand; -extern sh_int gsn_trip; - -extern sh_int gsn_fast_healing; -extern sh_int gsn_haggle; -extern sh_int gsn_lore; -extern sh_int gsn_meditation; - -extern sh_int gsn_scrolls; -extern sh_int gsn_staves; -extern sh_int gsn_wands; -extern sh_int gsn_recall; - - - -/* - * Utility macros. - */ -#define IS_VALID(data) ((data) != NULL && (data)->valid) -#define VALIDATE(data) ((data)->valid = TRUE) -#define INVALIDATE(data) ((data)->valid = FALSE) -#define UMIN(a, b) ((a) < (b) ? (a) : (b)) -#define UMAX(a, b) ((a) > (b) ? (a) : (b)) -#define URANGE(a, b, c) ((b) < (a) ? (a) : ((b) > (c) ? (c) : (b))) -#define LOWER(c) ((c) >= 'A' && (c) <= 'Z' ? (c)+'a'-'A' : (c)) -#define UPPER(c) ((c) >= 'a' && (c) <= 'z' ? (c)+'A'-'a' : (c)) -#define IS_SET(flag, bit) ((flag) & (bit)) -#define SET_BIT(var, bit) ((var) |= (bit)) -#define REMOVE_BIT(var, bit) ((var) &= ~(bit)) - - - -/* - * Character macros. - */ -#define IS_NPC(ch) (IS_SET((ch)->act, ACT_IS_NPC)) -#define IS_IMMORTAL(ch) (get_trust(ch) >= LEVEL_IMMORTAL) -#define IS_HERO(ch) (get_trust(ch) >= LEVEL_HERO) -#define IS_TRUSTED(ch,level) (get_trust((ch)) >= (level)) -#define IS_AFFECTED(ch, sn) (IS_SET((ch)->affected_by, (sn))) - -#define GET_AGE(ch) ((int) (17 + ((ch)->played \ - + current_time - (ch)->logon )/72000)) - -#define IS_GOOD(ch) (ch->alignment >= 350) -#define IS_EVIL(ch) (ch->alignment <= -350) -#define IS_NEUTRAL(ch) (!IS_GOOD(ch) && !IS_EVIL(ch)) - -#define IS_AWAKE(ch) (ch->position > POS_SLEEPING) -#define GET_AC(ch,type) ((ch)->armor[type] \ - + ( IS_AWAKE(ch) \ - ? dex_app[get_curr_stat(ch,STAT_DEX)].defensive : 0 )) -#define GET_HITROLL(ch) \ - ((ch)->hitroll+str_app[get_curr_stat(ch,STAT_STR)].tohit) -#define GET_DAMROLL(ch) \ - ((ch)->damroll+str_app[get_curr_stat(ch,STAT_STR)].todam) - -#define IS_OUTSIDE(ch) (!IS_SET( \ - (ch)->in_room->room_flags, \ - ROOM_INDOORS)) - -#define WAIT_STATE(ch, npulse) ((ch)->wait = UMAX((ch)->wait, (npulse))) -#define DAZE_STATE(ch, npulse) ((ch)->daze = UMAX((ch)->daze, (npulse))) -#define get_carry_weight(ch) ((ch)->carry_weight + (ch)->silver/10 + \ - (ch)->gold * 2 / 5) - -#define act(format,ch,arg1,arg2,type)\ - act_new((format),(ch),(arg1),(arg2),(type),POS_RESTING) - -/* - * Object macros. - */ -#define CAN_WEAR(obj, part) (IS_SET((obj)->wear_flags, (part))) -#define IS_OBJ_STAT(obj, stat) (IS_SET((obj)->extra_flags, (stat))) -#define IS_WEAPON_STAT(obj,stat)(IS_SET((obj)->value[4],(stat))) -#define WEIGHT_MULT(obj) ((obj)->item_type == ITEM_CONTAINER ? \ - (obj)->value[4] : 100) - - - -/* - * Description macros. - */ -#define PERS(ch, looker) ( can_see( looker, (ch) ) ? \ - ( IS_NPC(ch) ? (ch)->short_descr \ - : (ch)->name ) : "someone" ) - -/* - * Structure for a social in the socials table. - */ -struct social_type -{ - char name[20]; - char * char_no_arg; - char * others_no_arg; - char * char_found; - char * others_found; - char * vict_found; - char * char_not_found; - char * char_auto; - char * others_auto; -}; - - - -/* - * Global constants. - */ -extern const struct str_app_type str_app [26]; -extern const struct int_app_type int_app [26]; -extern const struct wis_app_type wis_app [26]; -extern const struct dex_app_type dex_app [26]; -extern const struct con_app_type con_app [26]; - -extern const struct class_type class_table [MAX_CLASS]; -extern const struct weapon_type weapon_table []; -extern const struct item_type item_table []; -extern const struct wiznet_type wiznet_table []; -extern const struct attack_type attack_table []; -extern const struct race_type race_table []; -extern const struct pc_race_type pc_race_table []; -extern const struct spec_type spec_table []; -extern const struct liq_type liq_table []; -extern const struct skill_type skill_table [MAX_SKILL]; -extern const struct group_type group_table [MAX_GROUP]; -extern struct social_type social_table [MAX_SOCIALS]; -extern char * const title_table [MAX_CLASS] - [MAX_LEVEL+1] - [2]; - - - -/* - * Global variables. - */ -extern HELP_DATA * help_first; -extern SHOP_DATA * shop_first; - -extern CHAR_DATA * char_list; -extern DESCRIPTOR_DATA * descriptor_list; -extern OBJ_DATA * object_list; - -extern char bug_buf []; -extern time_t current_time; -extern bool fLogAll; -extern FILE * fpReserve; -extern KILL_DATA kill_table []; -extern char log_buf []; -extern TIME_INFO_DATA time_info; -extern WEATHER_DATA weather_info; - -/* - * OS-dependent declarations. - * These are all very standard library functions, - * but some systems have incomplete or non-ansi header files. - */ -#if defined(_AIX) -char * crypt args( ( const char *key, const char *salt ) ); -#endif - -#if defined(apollo) -int atoi args( ( const char *string ) ); -void * calloc args( ( unsigned nelem, size_t size ) ); -char * crypt args( ( const char *key, const char *salt ) ); -#endif - -#if defined(hpux) -char * crypt args( ( const char *key, const char *salt ) ); -#endif - -#if defined(linux) -char * crypt args( ( const char *key, const char *salt ) ); -#endif - -#if defined(macintosh) -#define NOCRYPT -#if defined(unix) -#undef unix -#endif -#endif - -#if defined(MIPS_OS) -char * crypt args( ( const char *key, const char *salt ) ); -#endif - -#if defined(MSDOS) -#define NOCRYPT -#if defined(unix) -#undef unix -#endif -#endif - -#if defined(NeXT) -char * crypt args( ( const char *key, const char *salt ) ); -#endif - -#if defined(sequent) -char * crypt args( ( const char *key, const char *salt ) ); -int fclose args( ( FILE *stream ) ); -int fprintf args( ( FILE *stream, const char *format, ... ) ); -int fread args( ( void *ptr, int size, int n, FILE *stream ) ); -int fseek args( ( FILE *stream, long offset, int ptrname ) ); -void perror args( ( const char *s ) ); -int ungetc args( ( int c, FILE *stream ) ); -#endif - -#if defined(sun) -char * crypt args( ( const char *key, const char *salt ) ); -int fclose args( ( FILE *stream ) ); -int fprintf args( ( FILE *stream, const char *format, ... ) ); -#if defined(SYSV) -siz_t fread args( ( void *ptr, size_t size, size_t n, - FILE *stream) ); -#elif !defined(__SVR4) -int fread args( ( void *ptr, int size, int n, FILE *stream ) ); -#endif -int fseek args( ( FILE *stream, long offset, int ptrname ) ); -void perror args( ( const char *s ) ); -int ungetc args( ( int c, FILE *stream ) ); -#endif - -#if defined(ultrix) -char * crypt args( ( const char *key, const char *salt ) ); -#endif - - - -/* - * The crypt(3) function is not available on some operating systems. - * In particular, the U.S. Government prohibits its export from the - * United States to foreign countries. - * Turn on NOCRYPT to keep passwords in plain text. - */ -#if defined(NOCRYPT) -#define crypt(s1, s2) (s1) -#endif - - - -/* - * Data files used by the server. - * - * AREA_LIST contains a list of areas to boot. - * All files are read in completely at bootup. - * Most output files (bug, idea, typo, shutdown) are append-only. - * - * The NULL_FILE is held open so that we have a stream handle in reserve, - * so players can go ahead and telnet to all the other descriptors. - * Then we close it whenever we need to open a file (e.g. a save file). - */ -#if defined(macintosh) -#define PLAYER_DIR "" /* Player files */ -#define TEMP_FILE "romtmp" -#define NULL_FILE "proto.are" /* To reserve one stream */ -#endif - -#if defined(MSDOS) -#define PLAYER_DIR "" /* Player files */ -#define TEMP_FILE "romtmp" -#define NULL_FILE "nul" /* To reserve one stream */ -#endif - -#if defined(unix) -#define PLAYER_DIR "../../player/" /* Player files */ -#define GOD_DIR "../../gods/" /* list of gods */ -#define TEMP_FILE "../../player/romtmp" -#define NULL_FILE "/dev/null" /* To reserve one stream */ -#endif - -#define AREA_LIST "area.lst" /* List of areas*/ -#define BUG_FILE "bugs.txt" /* For 'bug' and bug()*/ -#define TYPO_FILE "typos.txt" /* For 'typo'*/ -#define NOTE_FILE "notes.not"/* For 'notes'*/ -#define IDEA_FILE "ideas.not" -#define PENALTY_FILE "penal.not" -#define NEWS_FILE "news.not" -#define CHANGES_FILE "chang.not" -#define SHUTDOWN_FILE "shutdown.txt"/* For 'shutdown'*/ -#define BAN_FILE "ban.txt" -#define MUSIC_FILE "music.txt" - - - -/* - * Our function prototypes. - * One big lump ... this is every function in Merc. - */ -#define CD CHAR_DATA -#define MID MOB_INDEX_DATA -#define OD OBJ_DATA -#define OID OBJ_INDEX_DATA -#define RID ROOM_INDEX_DATA -#define SF SPEC_FUN -#define AD AFFECT_DATA - -/* act_comm.c */ -void check_sex args( ( CHAR_DATA *ch) ); -void add_follower args( ( CHAR_DATA *ch, CHAR_DATA *master ) ); -void stop_follower args( ( CHAR_DATA *ch ) ); -void nuke_pets args( ( CHAR_DATA *ch ) ); -void die_follower args( ( CHAR_DATA *ch ) ); -bool is_same_group args( ( CHAR_DATA *ach, CHAR_DATA *bch ) ); - -/* act_enter.c */ -RID *get_random_room args ( (CHAR_DATA *ch) ); - -/* act_info.c */ -void set_title args( ( CHAR_DATA *ch, char *title ) ); - -/* act_move.c */ -void move_char args( ( CHAR_DATA *ch, int door, bool follow ) ); - -/* act_obj.c */ -bool can_loot args( (CHAR_DATA *ch, OBJ_DATA *obj) ); -void get_obj args( ( CHAR_DATA *ch, OBJ_DATA *obj, - OBJ_DATA *container ) ); - -/* act_wiz.c */ -void wiznet args( (char *string, CHAR_DATA *ch, OBJ_DATA *obj, - long flag, long flag_skip, int min_level ) ); -/* alias.c */ -void substitute_alias args( (DESCRIPTOR_DATA *d, char *input) ); - -/* ban.c */ -bool check_ban args( ( char *site, int type) ); - - -/* comm.c */ -void show_string args( ( struct descriptor_data *d, char *input) ); -void close_socket args( ( DESCRIPTOR_DATA *dclose ) ); -void write_to_buffer args( ( DESCRIPTOR_DATA *d, const char *txt, - int length ) ); -void send_to_char args( ( const char *txt, CHAR_DATA *ch ) ); -void page_to_char args( ( const char *txt, CHAR_DATA *ch ) ); -void act args( ( const char *format, CHAR_DATA *ch, - const void *arg1, const void *arg2, int type ) ); -void act_new args( ( const char *format, CHAR_DATA *ch, - const void *arg1, const void *arg2, int type, - int min_pos) ); - -/* db.c */ -char * print_flags args( ( int flag )); -void boot_db args( ( void ) ); -void area_update args( ( void ) ); -CD * create_mobile args( ( MOB_INDEX_DATA *pMobIndex ) ); -void clone_mobile args( ( CHAR_DATA *parent, CHAR_DATA *clone) ); -OD * create_object args( ( OBJ_INDEX_DATA *pObjIndex, int level ) ); -void clone_object args( ( OBJ_DATA *parent, OBJ_DATA *clone ) ); -void clear_char args( ( CHAR_DATA *ch ) ); -char * get_extra_descr args( ( const char *name, EXTRA_DESCR_DATA *ed ) ); -MID * get_mob_index args( ( int vnum ) ); -OID * get_obj_index args( ( int vnum ) ); -RID * get_room_index args( ( int vnum ) ); -char fread_letter args( ( FILE *fp ) ); -int fread_number args( ( FILE *fp ) ); -long fread_flag args( ( FILE *fp ) ); -char * fread_string args( ( FILE *fp ) ); -char * fread_string_eol args(( FILE *fp ) ); -void fread_to_eol args( ( FILE *fp ) ); -char * fread_word args( ( FILE *fp ) ); -long flag_convert args( ( char letter) ); -void * alloc_mem args( ( int sMem ) ); -void * alloc_perm args( ( int sMem ) ); -void free_mem args( ( void *pMem, int sMem ) ); -char * str_dup args( ( const char *str ) ); -void free_string args( ( char *pstr ) ); -int number_fuzzy args( ( int number ) ); -int number_range args( ( int from, int to ) ); -int number_percent args( ( void ) ); -int number_door args( ( void ) ); -int number_bits args( ( int width ) ); -long number_mm args( ( void ) ); -int dice args( ( int number, int size ) ); -int interpolate args( ( int level, int value_00, int value_32 ) ); -void smash_tilde args( ( char *str ) ); -bool str_cmp args( ( const char *astr, const char *bstr ) ); -bool str_prefix args( ( const char *astr, const char *bstr ) ); -bool str_infix args( ( const char *astr, const char *bstr ) ); -bool str_suffix args( ( const char *astr, const char *bstr ) ); -char * capitalize args( ( const char *str ) ); -void append_file args( ( CHAR_DATA *ch, char *file, char *str ) ); -void bug args( ( const char *str, int param ) ); -void log_string args( ( const char *str ) ); -void tail_chain args( ( void ) ); - -/* effect.c */ -void acid_effect args( (void *vo, int level, int dam, int target) ); -void cold_effect args( (void *vo, int level, int dam, int target) ); -void fire_effect args( (void *vo, int level, int dam, int target) ); -void poison_effect args( (void *vo, int level, int dam, int target) ); -void shock_effect args( (void *vo, int level, int dam, int target) ); - - -/* fight.c */ -bool is_safe args( (CHAR_DATA *ch, CHAR_DATA *victim ) ); -bool is_safe_spell args( (CHAR_DATA *ch, CHAR_DATA *victim, bool area ) ); -void violence_update args( ( void ) ); -void multi_hit args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dt ) ); -bool damage args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dam, - int dt, int class, bool show ) ); -bool damage_old args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dam, - int dt, int class, bool show ) ); -void update_pos args( ( CHAR_DATA *victim ) ); -void stop_fighting args( ( CHAR_DATA *ch, bool fBoth ) ); -void check_killer args( ( CHAR_DATA *ch, CHAR_DATA *victim) ); - -/* handler.c */ -AD *affect_find args( (AFFECT_DATA *paf, int sn)); -void affect_check args( (CHAR_DATA *ch, int where, int vector) ); -int count_users args( (OBJ_DATA *obj) ); -void deduct_cost args( (CHAR_DATA *ch, int cost) ); -void affect_enchant args( (OBJ_DATA *obj) ); -int check_immune args( (CHAR_DATA *ch, int dam_type) ); -int liq_lookup args( ( const char *name) ); -int material_lookup args( ( const char *name) ); -int weapon_lookup args( ( const char *name) ); -int weapon_type args( ( const char *name) ); -char *weapon_name args( ( int weapon_Type) ); -int item_lookup args( ( const char *name) ); -char *item_name args( ( int item_type) ); -int attack_lookup args( ( const char *name) ); -int race_lookup args( ( const char *name) ); -long wiznet_lookup args( ( const char *name) ); -int class_lookup args( ( const char *name) ); -bool is_clan args( (CHAR_DATA *ch) ); -bool is_same_clan args( (CHAR_DATA *ch, CHAR_DATA *victim)); -bool is_old_mob args ( (CHAR_DATA *ch) ); -int get_skill args( ( CHAR_DATA *ch, int sn ) ); -int get_weapon_sn args( ( CHAR_DATA *ch ) ); -int get_weapon_skill args(( CHAR_DATA *ch, int sn ) ); -int get_age args( ( CHAR_DATA *ch ) ); -void reset_char args( ( CHAR_DATA *ch ) ); -int get_trust args( ( CHAR_DATA *ch ) ); -int get_curr_stat args( ( CHAR_DATA *ch, int stat ) ); -int get_max_train args( ( CHAR_DATA *ch, int stat ) ); -int can_carry_n args( ( CHAR_DATA *ch ) ); -int can_carry_w args( ( CHAR_DATA *ch ) ); -bool is_name args( ( char *str, char *namelist ) ); -bool is_exact_name args( ( char *str, char *namelist ) ); -void affect_to_char args( ( CHAR_DATA *ch, AFFECT_DATA *paf ) ); -void affect_to_obj args( ( OBJ_DATA *obj, AFFECT_DATA *paf ) ); -void affect_remove args( ( CHAR_DATA *ch, AFFECT_DATA *paf ) ); -void affect_remove_obj args( (OBJ_DATA *obj, AFFECT_DATA *paf ) ); -void affect_strip args( ( CHAR_DATA *ch, int sn ) ); -bool is_affected args( ( CHAR_DATA *ch, int sn ) ); -void affect_join args( ( CHAR_DATA *ch, AFFECT_DATA *paf ) ); -void char_from_room args( ( CHAR_DATA *ch ) ); -void char_to_room args( ( CHAR_DATA *ch, ROOM_INDEX_DATA *pRoomIndex ) ); -void obj_to_char args( ( OBJ_DATA *obj, CHAR_DATA *ch ) ); -void obj_from_char args( ( OBJ_DATA *obj ) ); -int apply_ac args( ( OBJ_DATA *obj, int iWear, int type ) ); -OD * get_eq_char args( ( CHAR_DATA *ch, int iWear ) ); -void equip_char args( ( CHAR_DATA *ch, OBJ_DATA *obj, int iWear ) ); -void unequip_char args( ( CHAR_DATA *ch, OBJ_DATA *obj ) ); -int count_obj_list args( ( OBJ_INDEX_DATA *obj, OBJ_DATA *list ) ); -void obj_from_room args( ( OBJ_DATA *obj ) ); -void obj_to_room args( ( OBJ_DATA *obj, ROOM_INDEX_DATA *pRoomIndex ) ); -void obj_to_obj args( ( OBJ_DATA *obj, OBJ_DATA *obj_to ) ); -void obj_from_obj args( ( OBJ_DATA *obj ) ); -void extract_obj args( ( OBJ_DATA *obj ) ); -void extract_char args( ( CHAR_DATA *ch, bool fPull ) ); -CD * get_char_room args( ( CHAR_DATA *ch, char *argument ) ); -CD * get_char_world args( ( CHAR_DATA *ch, char *argument ) ); -OD * get_obj_type args( ( OBJ_INDEX_DATA *pObjIndexData ) ); -OD * get_obj_list args( ( CHAR_DATA *ch, char *argument, - OBJ_DATA *list ) ); -OD * get_obj_carry args( ( CHAR_DATA *ch, char *argument, - CHAR_DATA *viewer ) ); -OD * get_obj_wear args( ( CHAR_DATA *ch, char *argument ) ); -OD * get_obj_here args( ( CHAR_DATA *ch, char *argument ) ); -OD * get_obj_world args( ( CHAR_DATA *ch, char *argument ) ); -OD * create_money args( ( int gold, int silver ) ); -int get_obj_number args( ( OBJ_DATA *obj ) ); -int get_obj_weight args( ( OBJ_DATA *obj ) ); -int get_true_weight args( ( OBJ_DATA *obj ) ); -bool room_is_dark args( ( ROOM_INDEX_DATA *pRoomIndex ) ); -bool is_room_owner args( ( CHAR_DATA *ch, ROOM_INDEX_DATA *room) ); -bool room_is_private args( ( ROOM_INDEX_DATA *pRoomIndex ) ); -bool can_see args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); -bool can_see_obj args( ( CHAR_DATA *ch, OBJ_DATA *obj ) ); -bool can_see_room args( ( CHAR_DATA *ch, ROOM_INDEX_DATA *pRoomIndex) ); -bool can_drop_obj args( ( CHAR_DATA *ch, OBJ_DATA *obj ) ); -char * affect_loc_name args( ( int location ) ); -char * affect_bit_name args( ( int vector ) ); -char * extra_bit_name args( ( int extra_flags ) ); -char * wear_bit_name args( ( int wear_flags ) ); -char * act_bit_name args( ( int act_flags ) ); -char * off_bit_name args( ( int off_flags ) ); -char * imm_bit_name args( ( int imm_flags ) ); -char * form_bit_name args( ( int form_flags ) ); -char * part_bit_name args( ( int part_flags ) ); -char * weapon_bit_name args( ( int weapon_flags ) ); -char * comm_bit_name args( ( int comm_flags ) ); -char * cont_bit_name args( ( int cont_flags) ); - - -/* interp.c */ -void interpret args( ( CHAR_DATA *ch, char *argument ) ); -bool is_number args( ( char *arg ) ); -int number_argument args( ( char *argument, char *arg ) ); -int mult_argument args( ( char *argument, char *arg) ); -char * one_argument args( ( char *argument, char *arg_first ) ); - -/* magic.c */ -int find_spell args( ( CHAR_DATA *ch, const char *name) ); -int mana_cost (CHAR_DATA *ch, int min_mana, int level); -int skill_lookup args( ( const char *name ) ); -int slot_lookup args( ( int slot ) ); -bool saves_spell args( ( int level, CHAR_DATA *victim, int dam_type ) ); -void obj_cast_spell args( ( int sn, int level, CHAR_DATA *ch, - CHAR_DATA *victim, OBJ_DATA *obj ) ); -/* save.c */ -void save_char_obj args( ( CHAR_DATA *ch ) ); -bool load_char_obj args( ( DESCRIPTOR_DATA *d, char *name ) ); - -/* skills.c */ -bool parse_gen_groups args( ( CHAR_DATA *ch,char *argument ) ); -void list_group_costs args( ( CHAR_DATA *ch ) ); -void list_group_known args( ( CHAR_DATA *ch ) ); -int exp_per_level args( ( CHAR_DATA *ch, int points ) ); -void check_improve args( ( CHAR_DATA *ch, int sn, bool success, - int multiplier ) ); -int group_lookup args( (const char *name) ); -void gn_add args( ( CHAR_DATA *ch, int gn) ); -void gn_remove args( ( CHAR_DATA *ch, int gn) ); -void group_add args( ( CHAR_DATA *ch, const char *name, bool deduct) ); -void group_remove args( ( CHAR_DATA *ch, const char *name) ); - -/* special.c */ -SF * spec_lookup args( ( const char *name ) ); -char * spec_name args( ( SPEC_FUN *function ) ); - -/* teleport.c */ -RID * room_by_name args( ( char *target, int level, bool error) ); - -/* update.c */ -void advance_level args( ( CHAR_DATA *ch, bool hide ) ); -void gain_exp args( ( CHAR_DATA *ch, int gain ) ); -void gain_condition args( ( CHAR_DATA *ch, int iCond, int value ) ); -void update_handler args( ( void ) ); - -#undef CD -#undef MID -#undef OD -#undef OID -#undef RID -#undef SF -#undef AD diff --git a/archive/src/music.c b/archive/src/music.c deleted file mode 100644 index 5883daa..0000000 --- a/archive/src/music.c +++ /dev/null @@ -1,350 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#include -#endif -#include -#include -#include -#include -#include "merc.h" -#include "music.h" -#include "recycle.h" - -int channel_songs[MAX_GLOBAL + 1]; -struct song_data song_table[MAX_SONGS]; - -void song_update(void) -{ - OBJ_DATA *obj; - CHAR_DATA *victim; - ROOM_INDEX_DATA *room; - DESCRIPTOR_DATA *d; - char buf[MAX_STRING_LENGTH]; - char *line; - int i; - - /* do the global song, if any */ - if (channel_songs[1] >= MAX_SONGS) - channel_songs[1] = -1; - - if (channel_songs[1] > -1) - { - if (channel_songs[0] >= MAX_LINES - || channel_songs[0] >= song_table[channel_songs[1]].lines) - { - channel_songs[0] = -1; - - /* advance songs */ - for (i = 1; i < MAX_GLOBAL; i++) - channel_songs[i] = channel_songs[i+1]; - channel_songs[MAX_GLOBAL] = -1; - } - else - { - if (channel_songs[0] < 0) - { - sprintf(buf,"Music: %s, %s", - song_table[channel_songs[1]].group, - song_table[channel_songs[1]].name); - channel_songs[0] = 0; - } - else - { - sprintf(buf,"Music: '%s'", - song_table[channel_songs[1]].lyrics[channel_songs[0]]); - channel_songs[0]++; - } - - for (d = descriptor_list; d != NULL; d = d->next) - { - victim = d->original ? d->original : d->character; - - if ( d->connected == CON_PLAYING && - !IS_SET(victim->comm,COMM_NOMUSIC) && - !IS_SET(victim->comm,COMM_QUIET) ) - act_new("$t",d->character,buf,NULL,TO_CHAR,POS_SLEEPING); - } - } - } - - for (obj = object_list; obj != NULL; obj = obj->next) - { - if (obj->item_type != ITEM_JUKEBOX || obj->value[1] < 0) - continue; - - if (obj->value[1] >= MAX_SONGS) - { - obj->value[1] = -1; - continue; - } - - /* find which room to play in */ - - if ((room = obj->in_room) == NULL) - { - if (obj->carried_by == NULL) - continue; - else - if ((room = obj->carried_by->in_room) == NULL) - continue; - } - - if (obj->value[0] < 0) - { - sprintf(buf,"$p starts playing %s, %s.", - song_table[obj->value[1]].group,song_table[obj->value[1]].name); - if (room->people != NULL) - act(buf,room->people,obj,NULL,TO_ALL); - obj->value[0] = 0; - continue; - } - else - { - if (obj->value[0] >= MAX_LINES - || obj->value[0] >= song_table[obj->value[1]].lines) - { - - obj->value[0] = -1; - - /* scroll songs forward */ - obj->value[1] = obj->value[2]; - obj->value[2] = obj->value[3]; - obj->value[3] = obj->value[4]; - obj->value[4] = -1; - continue; - } - - line = song_table[obj->value[1]].lyrics[obj->value[0]]; - obj->value[0]++; - } - - sprintf(buf,"$p bops: '%s'",line); - if (room->people != NULL) - act(buf,room->people,obj,NULL,TO_ALL); - } -} - - - -void load_songs(void) -{ - FILE *fp; - int count = 0, lines, i; - char letter; - - /* reset global */ - for (i = 0; i <= MAX_GLOBAL; i++) - channel_songs[i] = -1; - - if ((fp = fopen(MUSIC_FILE,"r")) == NULL) - { - bug("Couldn't open music file, no songs available.",0); - fclose(fp); - return; - } - - for (count = 0; count < MAX_SONGS; count++) - { - letter = fread_letter(fp); - if (letter == '#') - { - if (count < MAX_SONGS) - song_table[count].name = NULL; - fclose(fp); - return; - } - else - ungetc(letter,fp); - - song_table[count].group = fread_string(fp); - song_table[count].name = fread_string(fp); - - /* read lyrics */ - lines = 0; - - for ( ; ;) - { - letter = fread_letter(fp); - - if (letter == '~') - { - song_table[count].lines = lines; - break; - } - else - ungetc(letter,fp); - - if (lines >= MAX_LINES) - { - bug("Too many lines in a song -- limit is %d.",MAX_LINES); - break; - } - - song_table[count].lyrics[lines] = fread_string_eol(fp); - lines++; - } - } -} - -void do_play(CHAR_DATA *ch, char *argument) -{ - OBJ_DATA *juke; - char *str,arg[MAX_INPUT_LENGTH]; - int song,i; - bool global = FALSE; - - str = one_argument(argument,arg); - - for (juke = ch->in_room->contents; juke != NULL; juke = juke->next_content) - if (juke->item_type == ITEM_JUKEBOX && can_see_obj(ch,juke)) - break; - - if (argument[0] == '\0') - { - send_to_char("Play what?\n\r",ch); - return; - } - - if (juke == NULL) - { - send_to_char("You see nothing to play.\n\r",ch); - return; - } - - if (!str_cmp(arg,"list")) - { - BUFFER *buffer; - char buf[MAX_STRING_LENGTH]; - int col = 0; - bool artist = FALSE, match = FALSE; - - buffer = new_buf(); - argument = str; - argument = one_argument(argument,arg); - - if (!str_cmp(arg,"artist")) - artist = TRUE; - - if (argument[0] != '\0') - match = TRUE; - - sprintf(buf,"%s has the following songs available:\n\r", - juke->short_descr); - add_buf(buffer,capitalize(buf)); - - for (i = 0; i < MAX_SONGS; i++) - { - if (song_table[i].name == NULL) - break; - - if (artist && (!match - || !str_prefix(argument,song_table[i].group))) - sprintf(buf,"%-39s %-39s\n\r", - song_table[i].group,song_table[i].name); - else if (!artist && (!match - || !str_prefix(argument,song_table[i].name))) - sprintf(buf,"%-35s ",song_table[i].name); - else - continue; - add_buf(buffer,buf); - if (!artist && ++col % 2 == 0) - add_buf(buffer,"\n\r"); - } - if (!artist && col % 2 != 0) - add_buf(buffer,"\n\r"); - - page_to_char(buf_string(buffer),ch); - free_buf(buffer); - return; - } - - if (!str_cmp(arg,"loud")) - { - argument = str; - global = TRUE; - } - - if (argument[0] == '\0') - { - send_to_char("Play what?\n\r",ch); - return; - } - - if ((global && channel_songs[MAX_GLOBAL] > -1) - || (!global && juke->value[4] > -1)) - { - send_to_char("The jukebox is full up right now.\n\r",ch); - return; - } - - for (song = 0; song < MAX_SONGS; song++) - { - if (song_table[song].name == NULL) - { - send_to_char("That song isn't available.\n\r",ch); - return; - } - if (!str_prefix(argument,song_table[song].name)) - break; - } - - if (song >= MAX_SONGS) - { - send_to_char("That song isn't available.\n\r",ch); - return; - } - - send_to_char("Coming right up.\n\r",ch); - - if (global) - { - for (i = 1; i <= MAX_GLOBAL; i++) - if (channel_songs[i] < 0) - { - if (i == 1) - channel_songs[0] = -1; - channel_songs[i] = song; - return; - } - } - else - { - for (i = 1; i < 5; i++) - if (juke->value[i] < 0) - { - if (i == 1) - juke->value[0] = -1; - juke->value[i] = song; - return; - } - } -} diff --git a/archive/src/music.h b/archive/src/music.h deleted file mode 100644 index 15bc0e1..0000000 --- a/archive/src/music.h +++ /dev/null @@ -1,43 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#define MAX_SONGS 20 -#define MAX_LINES 100 /* this boils down to about 1k per song */ -#define MAX_GLOBAL 10 /* max songs the global jukebox can hold */ - -struct song_data -{ - char *group; - char *name; - char *lyrics[MAX_LINES]; - int lines; -}; - -extern struct song_data song_table[MAX_SONGS]; - -void song_update args( (void) ); -void load_songs args( (void) ); diff --git a/archive/src/note.c b/archive/src/note.c deleted file mode 100644 index ae5ebc5..0000000 --- a/archive/src/note.c +++ /dev/null @@ -1,960 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#include -#endif -#include -#include -#include -#include -#include -#include "merc.h" -#include "recycle.h" -#include "tables.h" - -/* globals from db.c for load_notes */ -#if !defined(macintosh) -extern int _filbuf args( (FILE *) ); -#endif -extern FILE * fpArea; -extern char strArea[MAX_INPUT_LENGTH]; - -/* local procedures */ -void load_thread(char *name, NOTE_DATA **list, int type, time_t free_time); -void parse_note(CHAR_DATA *ch, char *argument, int type); -bool hide_note(CHAR_DATA *ch, NOTE_DATA *pnote); - -NOTE_DATA *note_list; -NOTE_DATA *idea_list; -NOTE_DATA *penalty_list; -NOTE_DATA *news_list; -NOTE_DATA *changes_list; - -int count_spool(CHAR_DATA *ch, NOTE_DATA *spool) -{ - int count = 0; - NOTE_DATA *pnote; - - for (pnote = spool; pnote != NULL; pnote = pnote->next) - if (!hide_note(ch,pnote)) - count++; - - return count; -} - -void do_unread(CHAR_DATA *ch) -{ - char buf[MAX_STRING_LENGTH]; - int count; - bool found = FALSE; - - if (IS_NPC(ch)) - return; - - if ((count = count_spool(ch,news_list)) > 0) - { - found = TRUE; - sprintf(buf,"There %s %d new news article%s waiting.\n\r", - count > 1 ? "are" : "is",count, count > 1 ? "s" : ""); - send_to_char(buf,ch); - } - if ((count = count_spool(ch,changes_list)) > 0) - { - found = TRUE; - sprintf(buf,"There %s %d change%s waiting to be read.\n\r", - count > 1 ? "are" : "is", count, count > 1 ? "s" : ""); - send_to_char(buf,ch); - } - if ((count = count_spool(ch,note_list)) > 0) - { - found = TRUE; - sprintf(buf,"You have %d new note%s waiting.\n\r", - count, count > 1 ? "s" : ""); - send_to_char(buf,ch); - } - if ((count = count_spool(ch,idea_list)) > 0) - { - found = TRUE; - sprintf(buf,"You have %d unread idea%s to peruse.\n\r", - count, count > 1 ? "s" : ""); - send_to_char(buf,ch); - } - if (IS_TRUSTED(ch,ANGEL) && (count = count_spool(ch,penalty_list)) > 0) - { - found = TRUE; - sprintf(buf,"%d %s been added.\n\r", - count, count > 1 ? "penalties have" : "penalty has"); - send_to_char(buf,ch); - } - - if (!found) - send_to_char("You have no unread notes.\n\r",ch); -} - -void do_note(CHAR_DATA *ch,char *argument) -{ - parse_note(ch,argument,NOTE_NOTE); -} - -void do_idea(CHAR_DATA *ch,char *argument) -{ - parse_note(ch,argument,NOTE_IDEA); -} - -void do_penalty(CHAR_DATA *ch,char *argument) -{ - parse_note(ch,argument,NOTE_PENALTY); -} - -void do_news(CHAR_DATA *ch,char *argument) -{ - parse_note(ch,argument,NOTE_NEWS); -} - -void do_changes(CHAR_DATA *ch,char *argument) -{ - parse_note(ch,argument,NOTE_CHANGES); -} - -void save_notes(int type) -{ - FILE *fp; - char *name; - NOTE_DATA *pnote; - - switch (type) - { - default: - return; - case NOTE_NOTE: - name = NOTE_FILE; - pnote = note_list; - break; - case NOTE_IDEA: - name = IDEA_FILE; - pnote = idea_list; - break; - case NOTE_PENALTY: - name = PENALTY_FILE; - pnote = penalty_list; - break; - case NOTE_NEWS: - name = NEWS_FILE; - pnote = news_list; - break; - case NOTE_CHANGES: - name = CHANGES_FILE; - pnote = changes_list; - break; - } - - fclose( fpReserve ); - if ( ( fp = fopen( name, "w" ) ) == NULL ) - { - perror( name ); - } - else - { - for ( ; pnote != NULL; pnote = pnote->next ) - { - fprintf( fp, "Sender %s~\n", pnote->sender); - fprintf( fp, "Date %s~\n", pnote->date); - fprintf( fp, "Stamp %ld\n", pnote->date_stamp); - fprintf( fp, "To %s~\n", pnote->to_list); - fprintf( fp, "Subject %s~\n", pnote->subject); - fprintf( fp, "Text\n%s~\n", pnote->text); - } - fclose( fp ); - fpReserve = fopen( NULL_FILE, "r" ); - return; - } -} -void load_notes(void) -{ - load_thread(NOTE_FILE,¬e_list, NOTE_NOTE, 14*24*60*60); - load_thread(IDEA_FILE,&idea_list, NOTE_IDEA, 28*24*60*60); - load_thread(PENALTY_FILE,&penalty_list, NOTE_PENALTY, 0); - load_thread(NEWS_FILE,&news_list, NOTE_NEWS, 0); - load_thread(CHANGES_FILE,&changes_list,NOTE_CHANGES, 0); -} - -void load_thread(char *name, NOTE_DATA **list, int type, time_t free_time) -{ - FILE *fp; - NOTE_DATA *pnotelast; - - if ( ( fp = fopen( name, "r" ) ) == NULL ) - return; - - pnotelast = NULL; - for ( ; ; ) - { - NOTE_DATA *pnote; - char letter; - - do - { - letter = getc( fp ); - if ( feof(fp) ) - { - fclose( fp ); - return; - } - } - while ( isspace(letter) ); - ungetc( letter, fp ); - - pnote = alloc_perm( sizeof(*pnote) ); - - if ( str_cmp( fread_word( fp ), "sender" ) ) - break; - pnote->sender = fread_string( fp ); - - if ( str_cmp( fread_word( fp ), "date" ) ) - break; - pnote->date = fread_string( fp ); - - if ( str_cmp( fread_word( fp ), "stamp" ) ) - break; - pnote->date_stamp = fread_number(fp); - - if ( str_cmp( fread_word( fp ), "to" ) ) - break; - pnote->to_list = fread_string( fp ); - - if ( str_cmp( fread_word( fp ), "subject" ) ) - break; - pnote->subject = fread_string( fp ); - - if ( str_cmp( fread_word( fp ), "text" ) ) - break; - pnote->text = fread_string( fp ); - - if (free_time && pnote->date_stamp < current_time - free_time) - { - free_note(pnote); - continue; - } - - pnote->type = type; - - if (*list == NULL) - *list = pnote; - else - pnotelast->next = pnote; - - pnotelast = pnote; - } - - strcpy( strArea, NOTE_FILE ); - fpArea = fp; - bug( "Load_notes: bad key word.", 0 ); - exit( 1 ); - return; -} - -void append_note(NOTE_DATA *pnote) -{ - FILE *fp; - char *name; - NOTE_DATA **list; - NOTE_DATA *last; - - switch(pnote->type) - { - default: - return; - case NOTE_NOTE: - name = NOTE_FILE; - list = ¬e_list; - break; - case NOTE_IDEA: - name = IDEA_FILE; - list = &idea_list; - break; - case NOTE_PENALTY: - name = PENALTY_FILE; - list = &penalty_list; - break; - case NOTE_NEWS: - name = NEWS_FILE; - list = &news_list; - break; - case NOTE_CHANGES: - name = CHANGES_FILE; - list = &changes_list; - break; - } - - if (*list == NULL) - *list = pnote; - else - { - for ( last = *list; last->next != NULL; last = last->next); - last->next = pnote; - } - - fclose(fpReserve); - if ( ( fp = fopen(name, "a" ) ) == NULL ) - { - perror(name); - } - else - { - fprintf( fp, "Sender %s~\n", pnote->sender); - fprintf( fp, "Date %s~\n", pnote->date); - fprintf( fp, "Stamp %ld\n", pnote->date_stamp); - fprintf( fp, "To %s~\n", pnote->to_list); - fprintf( fp, "Subject %s~\n", pnote->subject); - fprintf( fp, "Text\n%s~\n", pnote->text); - fclose( fp ); - } - fpReserve = fopen( NULL_FILE, "r" ); -} - -bool is_note_to( CHAR_DATA *ch, NOTE_DATA *pnote ) -{ - if ( !str_cmp( ch->name, pnote->sender ) ) - return TRUE; - - if ( is_exact_name( "all", pnote->to_list ) ) - return TRUE; - - if ( IS_IMMORTAL(ch) && is_exact_name( "immortal", pnote->to_list ) ) - return TRUE; - - if (ch->clan && is_exact_name(clan_table[ch->clan].name,pnote->to_list)) - return TRUE; - - if (is_exact_name( ch->name, pnote->to_list ) ) - return TRUE; - - return FALSE; -} - - - -void note_attach( CHAR_DATA *ch, int type ) -{ - NOTE_DATA *pnote; - - if ( ch->pnote != NULL ) - return; - - pnote = new_note(); - - pnote->next = NULL; - pnote->sender = str_dup( ch->name ); - pnote->date = str_dup( "" ); - pnote->to_list = str_dup( "" ); - pnote->subject = str_dup( "" ); - pnote->text = str_dup( "" ); - pnote->type = type; - ch->pnote = pnote; - return; -} - - - -void note_remove( CHAR_DATA *ch, NOTE_DATA *pnote, bool delete) -{ - char to_new[MAX_INPUT_LENGTH]; - char to_one[MAX_INPUT_LENGTH]; - NOTE_DATA *prev; - NOTE_DATA **list; - char *to_list; - - if (!delete) - { - /* make a new list */ - to_new[0] = '\0'; - to_list = pnote->to_list; - while ( *to_list != '\0' ) - { - to_list = one_argument( to_list, to_one ); - if ( to_one[0] != '\0' && str_cmp( ch->name, to_one ) ) - { - strcat( to_new, " " ); - strcat( to_new, to_one ); - } - } - /* Just a simple recipient removal? */ - if ( str_cmp( ch->name, pnote->sender ) && to_new[0] != '\0' ) - { - free_string( pnote->to_list ); - pnote->to_list = str_dup( to_new + 1 ); - return; - } - } - /* nuke the whole note */ - - switch(pnote->type) - { - default: - return; - case NOTE_NOTE: - list = ¬e_list; - break; - case NOTE_IDEA: - list = &idea_list; - break; - case NOTE_PENALTY: - list = &penalty_list; - break; - case NOTE_NEWS: - list = &news_list; - break; - case NOTE_CHANGES: - list = &changes_list; - break; - } - - /* - * Remove note from linked list. - */ - if ( pnote == *list ) - { - *list = pnote->next; - } - else - { - for ( prev = *list; prev != NULL; prev = prev->next ) - { - if ( prev->next == pnote ) - break; - } - - if ( prev == NULL ) - { - bug( "Note_remove: pnote not found.", 0 ); - return; - } - - prev->next = pnote->next; - } - - save_notes(pnote->type); - free_note(pnote); - return; -} - -bool hide_note (CHAR_DATA *ch, NOTE_DATA *pnote) -{ - time_t last_read; - - if (IS_NPC(ch)) - return TRUE; - - switch (pnote->type) - { - default: - return TRUE; - case NOTE_NOTE: - last_read = ch->pcdata->last_note; - break; - case NOTE_IDEA: - last_read = ch->pcdata->last_idea; - break; - case NOTE_PENALTY: - last_read = ch->pcdata->last_penalty; - break; - case NOTE_NEWS: - last_read = ch->pcdata->last_news; - break; - case NOTE_CHANGES: - last_read = ch->pcdata->last_changes; - break; - } - - if (pnote->date_stamp <= last_read) - return TRUE; - - if (!str_cmp(ch->name,pnote->sender)) - return TRUE; - - if (!is_note_to(ch,pnote)) - return TRUE; - - return FALSE; -} - -void update_read(CHAR_DATA *ch, NOTE_DATA *pnote) -{ - time_t stamp; - - if (IS_NPC(ch)) - return; - - stamp = pnote->date_stamp; - - switch (pnote->type) - { - default: - return; - case NOTE_NOTE: - ch->pcdata->last_note = UMAX(ch->pcdata->last_note,stamp); - break; - case NOTE_IDEA: - ch->pcdata->last_idea = UMAX(ch->pcdata->last_idea,stamp); - break; - case NOTE_PENALTY: - ch->pcdata->last_penalty = UMAX(ch->pcdata->last_penalty,stamp); - break; - case NOTE_NEWS: - ch->pcdata->last_news = UMAX(ch->pcdata->last_news,stamp); - break; - case NOTE_CHANGES: - ch->pcdata->last_changes = UMAX(ch->pcdata->last_changes,stamp); - break; - } -} - -void parse_note( CHAR_DATA *ch, char *argument, int type ) -{ - BUFFER *buffer; - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - NOTE_DATA *pnote; - NOTE_DATA **list; - char *list_name; - int vnum; - int anum; - - if ( IS_NPC(ch) ) - return; - - switch(type) - { - default: - return; - case NOTE_NOTE: - list = ¬e_list; - list_name = "notes"; - break; - case NOTE_IDEA: - list = &idea_list; - list_name = "ideas"; - break; - case NOTE_PENALTY: - list = &penalty_list; - list_name = "penalties"; - break; - case NOTE_NEWS: - list = &news_list; - list_name = "news"; - break; - case NOTE_CHANGES: - list = &changes_list; - list_name = "changes"; - break; - } - - argument = one_argument( argument, arg ); - smash_tilde( argument ); - - if ( arg[0] == '\0' || !str_prefix( arg, "read" ) ) - { - bool fAll; - - if ( !str_cmp( argument, "all" ) ) - { - fAll = TRUE; - anum = 0; - } - - else if ( argument[0] == '\0' || !str_prefix(argument, "next")) - /* read next unread note */ - { - vnum = 0; - for ( pnote = *list; pnote != NULL; pnote = pnote->next) - { - if (!hide_note(ch,pnote)) - { - sprintf( buf, "[%3d] %s: %s\n\r%s\n\rTo: %s\n\r", - vnum, - pnote->sender, - pnote->subject, - pnote->date, - pnote->to_list); - send_to_char( buf, ch ); - page_to_char( pnote->text, ch ); - update_read(ch,pnote); - return; - } - else if (is_note_to(ch,pnote)) - vnum++; - } - sprintf(buf,"You have no unread %s.\n\r",list_name); - send_to_char(buf,ch); - return; - } - - else if ( is_number( argument ) ) - { - fAll = FALSE; - anum = atoi( argument ); - } - else - { - send_to_char( "Read which number?\n\r", ch ); - return; - } - - vnum = 0; - for ( pnote = *list; pnote != NULL; pnote = pnote->next ) - { - if ( is_note_to( ch, pnote ) && ( vnum++ == anum || fAll ) ) - { - sprintf( buf, "[%3d] %s: %s\n\r%s\n\rTo: %s\n\r", - vnum - 1, - pnote->sender, - pnote->subject, - pnote->date, - pnote->to_list - ); - send_to_char( buf, ch ); - page_to_char( pnote->text, ch ); - update_read(ch,pnote); - return; - } - } - - sprintf(buf,"There aren't that many %s.\n\r",list_name); - send_to_char(buf,ch); - return; - } - - if ( !str_prefix( arg, "list" ) ) - { - vnum = 0; - for ( pnote = *list; pnote != NULL; pnote = pnote->next ) - { - if ( is_note_to( ch, pnote ) ) - { - sprintf( buf, "[%3d%s] %s: %s\n\r", - vnum, hide_note(ch,pnote) ? " " : "N", - pnote->sender, pnote->subject ); - send_to_char( buf, ch ); - vnum++; - } - } - if (!vnum) - { - switch(type) - { - case NOTE_NOTE: - send_to_char("There are no notes for you.\n\r",ch); - break; - case NOTE_IDEA: - send_to_char("There are no ideas for you.\n\r",ch); - break; - case NOTE_PENALTY: - send_to_char("There are no penalties for you.\n\r",ch); - break; - case NOTE_NEWS: - send_to_char("There is no news for you.\n\r",ch); - break; - case NOTE_CHANGES: - send_to_char("There are no changes for you.\n\r",ch); - break; - } - } - return; - } - - if ( !str_prefix( arg, "remove" ) ) - { - if ( !is_number( argument ) ) - { - send_to_char( "Note remove which number?\n\r", ch ); - return; - } - - anum = atoi( argument ); - vnum = 0; - for ( pnote = *list; pnote != NULL; pnote = pnote->next ) - { - if ( is_note_to( ch, pnote ) && vnum++ == anum ) - { - note_remove( ch, pnote, FALSE ); - send_to_char( "Ok.\n\r", ch ); - return; - } - } - - sprintf(buf,"There aren't that many %s.",list_name); - send_to_char(buf,ch); - return; - } - - if ( !str_prefix( arg, "delete" ) && get_trust(ch) >= MAX_LEVEL - 1) - { - if ( !is_number( argument ) ) - { - send_to_char( "Note delete which number?\n\r", ch ); - return; - } - - anum = atoi( argument ); - vnum = 0; - for ( pnote = *list; pnote != NULL; pnote = pnote->next ) - { - if ( is_note_to( ch, pnote ) && vnum++ == anum ) - { - note_remove( ch, pnote,TRUE ); - send_to_char( "Ok.\n\r", ch ); - return; - } - } - - sprintf(buf,"There aren't that many %s.",list_name); - send_to_char(buf,ch); - return; - } - - if (!str_prefix(arg,"catchup")) - { - switch(type) - { - case NOTE_NOTE: - ch->pcdata->last_note = current_time; - break; - case NOTE_IDEA: - ch->pcdata->last_idea = current_time; - break; - case NOTE_PENALTY: - ch->pcdata->last_penalty = current_time; - break; - case NOTE_NEWS: - ch->pcdata->last_news = current_time; - break; - case NOTE_CHANGES: - ch->pcdata->last_changes = current_time; - break; - } - return; - } - - /* below this point only certain people can edit notes */ - if ((type == NOTE_NEWS && !IS_TRUSTED(ch,ANGEL)) - || (type == NOTE_CHANGES && !IS_TRUSTED(ch,CREATOR))) - { - sprintf(buf,"You aren't high enough level to write %s.",list_name); - send_to_char(buf,ch); - return; - } - - if ( !str_cmp( arg, "+" ) ) - { - note_attach( ch,type ); - if (ch->pnote->type != type) - { - send_to_char( - "You already have a different note in progress.\n\r",ch); - return; - } - - if (strlen(ch->pnote->text)+strlen(argument) >= 4096) - { - send_to_char( "Note too long.\n\r", ch ); - return; - } - - buffer = new_buf(); - - add_buf(buffer,ch->pnote->text); - add_buf(buffer,argument); - add_buf(buffer,"\n\r"); - free_string( ch->pnote->text ); - ch->pnote->text = str_dup( buf_string(buffer) ); - free_buf(buffer); - send_to_char( "Ok.\n\r", ch ); - return; - } - - if (!str_cmp(arg,"-")) - { - int len; - bool found = FALSE; - - note_attach(ch,type); - if (ch->pnote->type != type) - { - send_to_char( - "You already have a different note in progress.\n\r",ch); - return; - } - - if (ch->pnote->text == NULL || ch->pnote->text[0] == '\0') - { - send_to_char("No lines left to remove.\n\r",ch); - return; - } - - strcpy(buf,ch->pnote->text); - - for (len = strlen(buf); len > 0; len--) - { - if (buf[len] == '\r') - { - if (!found) /* back it up */ - { - if (len > 0) - len--; - found = TRUE; - } - else /* found the second one */ - { - buf[len + 1] = '\0'; - free_string(ch->pnote->text); - ch->pnote->text = str_dup(buf); - return; - } - } - } - buf[0] = '\0'; - free_string(ch->pnote->text); - ch->pnote->text = str_dup(buf); - return; - } - - if ( !str_prefix( arg, "subject" ) ) - { - note_attach( ch,type ); - if (ch->pnote->type != type) - { - send_to_char( - "You already have a different note in progress.\n\r",ch); - return; - } - - free_string( ch->pnote->subject ); - ch->pnote->subject = str_dup( argument ); - send_to_char( "Ok.\n\r", ch ); - return; - } - - if ( !str_prefix( arg, "to" ) ) - { - note_attach( ch,type ); - if (ch->pnote->type != type) - { - send_to_char( - "You already have a different note in progress.\n\r",ch); - return; - } - free_string( ch->pnote->to_list ); - ch->pnote->to_list = str_dup( argument ); - send_to_char( "Ok.\n\r", ch ); - return; - } - - if ( !str_prefix( arg, "clear" ) ) - { - if ( ch->pnote != NULL ) - { - free_note(ch->pnote); - ch->pnote = NULL; - } - - send_to_char( "Ok.\n\r", ch ); - return; - } - - if ( !str_prefix( arg, "show" ) ) - { - if ( ch->pnote == NULL ) - { - send_to_char( "You have no note in progress.\n\r", ch ); - return; - } - - if (ch->pnote->type != type) - { - send_to_char("You aren't working on that kind of note.\n\r",ch); - return; - } - - sprintf( buf, "%s: %s\n\rTo: %s\n\r", - ch->pnote->sender, - ch->pnote->subject, - ch->pnote->to_list - ); - send_to_char( buf, ch ); - send_to_char( ch->pnote->text, ch ); - return; - } - - if ( !str_prefix( arg, "post" ) || !str_prefix(arg, "send")) - { - char *strtime; - - if ( ch->pnote == NULL ) - { - send_to_char( "You have no note in progress.\n\r", ch ); - return; - } - - if (ch->pnote->type != type) - { - send_to_char("You aren't working on that kind of note.\n\r",ch); - return; - } - - if (!str_cmp(ch->pnote->to_list,"")) - { - send_to_char( - "You need to provide a recipient (name, all, or immortal).\n\r", - ch); - return; - } - - if (!str_cmp(ch->pnote->subject,"")) - { - send_to_char("You need to provide a subject.\n\r",ch); - return; - } - - ch->pnote->next = NULL; - strtime = ctime( ¤t_time ); - strtime[strlen(strtime)-1] = '\0'; - ch->pnote->date = str_dup( strtime ); - ch->pnote->date_stamp = current_time; - - append_note(ch->pnote); - ch->pnote = NULL; - return; - } - - send_to_char( "You can't do that.\n\r", ch ); - return; -} - diff --git a/archive/src/recycle.c b/archive/src/recycle.c deleted file mode 100644 index 8239101..0000000 --- a/archive/src/recycle.c +++ /dev/null @@ -1,652 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#include -#else -#include -#include -#endif -#include -#include -#include -#include "merc.h" -#include "recycle.h" - -/* stuff for recyling notes */ -NOTE_DATA *note_free; - -NOTE_DATA *new_note() -{ - NOTE_DATA *note; - - if (note_free == NULL) - note = alloc_perm(sizeof(*note)); - else - { - note = note_free; - note_free = note_free->next; - } - VALIDATE(note); - return note; -} - -void free_note(NOTE_DATA *note) -{ - if (!IS_VALID(note)) - return; - - free_string( note->text ); - free_string( note->subject ); - free_string( note->to_list ); - free_string( note->date ); - free_string( note->sender ); - INVALIDATE(note); - - note->next = note_free; - note_free = note; -} - - -/* stuff for recycling ban structures */ -BAN_DATA *ban_free; - -BAN_DATA *new_ban(void) -{ - static BAN_DATA ban_zero; - BAN_DATA *ban; - - if (ban_free == NULL) - ban = alloc_perm(sizeof(*ban)); - else - { - ban = ban_free; - ban_free = ban_free->next; - } - - *ban = ban_zero; - VALIDATE(ban); - ban->name = &str_empty[0]; - return ban; -} - -void free_ban(BAN_DATA *ban) -{ - if (!IS_VALID(ban)) - return; - - free_string(ban->name); - INVALIDATE(ban); - - ban->next = ban_free; - ban_free = ban; -} - -/* stuff for recycling descriptors */ -DESCRIPTOR_DATA *descriptor_free; - -DESCRIPTOR_DATA *new_descriptor(void) -{ - static DESCRIPTOR_DATA d_zero; - DESCRIPTOR_DATA *d; - - if (descriptor_free == NULL) - d = alloc_perm(sizeof(*d)); - else - { - d = descriptor_free; - descriptor_free = descriptor_free->next; - } - - *d = d_zero; - VALIDATE(d); - return d; -} - -void free_descriptor(DESCRIPTOR_DATA *d) -{ - if (!IS_VALID(d)) - return; - - free_string( d->host ); - free_mem( d->outbuf, d->outsize ); - INVALIDATE(d); - d->next = descriptor_free; - descriptor_free = d; -} - -/* stuff for recycling gen_data */ -GEN_DATA *gen_data_free; - -GEN_DATA *new_gen_data(void) -{ - static GEN_DATA gen_zero; - GEN_DATA *gen; - - if (gen_data_free == NULL) - gen = alloc_perm(sizeof(*gen)); - else - { - gen = gen_data_free; - gen_data_free = gen_data_free->next; - } - *gen = gen_zero; - VALIDATE(gen); - return gen; -} - -void free_gen_data(GEN_DATA *gen) -{ - if (!IS_VALID(gen)) - return; - - INVALIDATE(gen); - - gen->next = gen_data_free; - gen_data_free = gen; -} - -/* stuff for recycling extended descs */ -EXTRA_DESCR_DATA *extra_descr_free; - -EXTRA_DESCR_DATA *new_extra_descr(void) -{ - EXTRA_DESCR_DATA *ed; - - if (extra_descr_free == NULL) - ed = alloc_perm(sizeof(*ed)); - else - { - ed = extra_descr_free; - extra_descr_free = extra_descr_free->next; - } - - ed->keyword = &str_empty[0]; - ed->description = &str_empty[0]; - VALIDATE(ed); - return ed; -} - -void free_extra_descr(EXTRA_DESCR_DATA *ed) -{ - if (!IS_VALID(ed)) - return; - - free_string(ed->keyword); - free_string(ed->description); - INVALIDATE(ed); - - ed->next = extra_descr_free; - extra_descr_free = ed; -} - - -/* stuff for recycling affects */ -AFFECT_DATA *affect_free; - -AFFECT_DATA *new_affect(void) -{ - static AFFECT_DATA af_zero; - AFFECT_DATA *af; - - if (affect_free == NULL) - af = alloc_perm(sizeof(*af)); - else - { - af = affect_free; - affect_free = affect_free->next; - } - - *af = af_zero; - - - VALIDATE(af); - return af; -} - -void free_affect(AFFECT_DATA *af) -{ - if (!IS_VALID(af)) - return; - - INVALIDATE(af); - af->next = affect_free; - affect_free = af; -} - -/* stuff for recycling objects */ -OBJ_DATA *obj_free; - -OBJ_DATA *new_obj(void) -{ - static OBJ_DATA obj_zero; - OBJ_DATA *obj; - - if (obj_free == NULL) - obj = alloc_perm(sizeof(*obj)); - else - { - obj = obj_free; - obj_free = obj_free->next; - } - *obj = obj_zero; - VALIDATE(obj); - - return obj; -} - -void free_obj(OBJ_DATA *obj) -{ - AFFECT_DATA *paf, *paf_next; - EXTRA_DESCR_DATA *ed, *ed_next; - - if (!IS_VALID(obj)) - return; - - for (paf = obj->affected; paf != NULL; paf = paf_next) - { - paf_next = paf->next; - free_affect(paf); - } - obj->affected = NULL; - - for (ed = obj->extra_descr; ed != NULL; ed = ed_next ) - { - ed_next = ed->next; - free_extra_descr(ed); - } - obj->extra_descr = NULL; - - free_string( obj->name ); - free_string( obj->description ); - free_string( obj->short_descr ); - free_string( obj->owner ); - INVALIDATE(obj); - - obj->next = obj_free; - obj_free = obj; -} - - -/* stuff for recyling characters */ -CHAR_DATA *char_free; - -CHAR_DATA *new_char (void) -{ - static CHAR_DATA ch_zero; - CHAR_DATA *ch; - int i; - - if (char_free == NULL) - ch = alloc_perm(sizeof(*ch)); - else - { - ch = char_free; - char_free = char_free->next; - } - - *ch = ch_zero; - VALIDATE(ch); - ch->name = &str_empty[0]; - ch->short_descr = &str_empty[0]; - ch->long_descr = &str_empty[0]; - ch->description = &str_empty[0]; - ch->prompt = &str_empty[0]; - ch->prefix = &str_empty[0]; - ch->logon = current_time; - ch->lines = PAGELEN; - for (i = 0; i < 4; i++) - ch->armor[i] = 100; - ch->position = POS_STANDING; - ch->hit = 20; - ch->max_hit = 20; - ch->mana = 100; - ch->max_mana = 100; - ch->move = 100; - ch->max_move = 100; - for (i = 0; i < MAX_STATS; i ++) - { - ch->perm_stat[i] = 13; - ch->mod_stat[i] = 0; - } - - return ch; -} - - -void free_char (CHAR_DATA *ch) -{ - OBJ_DATA *obj; - OBJ_DATA *obj_next; - AFFECT_DATA *paf; - AFFECT_DATA *paf_next; - - if (!IS_VALID(ch)) - return; - - if (IS_NPC(ch)) - mobile_count--; - - for (obj = ch->carrying; obj != NULL; obj = obj_next) - { - obj_next = obj->next_content; - extract_obj(obj); - } - - for (paf = ch->affected; paf != NULL; paf = paf_next) - { - paf_next = paf->next; - affect_remove(ch,paf); - } - - free_string(ch->name); - free_string(ch->short_descr); - free_string(ch->long_descr); - free_string(ch->description); - free_string(ch->prompt); - free_string(ch->prefix); - free_note (ch->pnote); - free_pcdata(ch->pcdata); - - ch->next = char_free; - char_free = ch; - - INVALIDATE(ch); - return; -} - -PC_DATA *pcdata_free; - -PC_DATA *new_pcdata(void) -{ - int alias; - - static PC_DATA pcdata_zero; - PC_DATA *pcdata; - - if (pcdata_free == NULL) - pcdata = alloc_perm(sizeof(*pcdata)); - else - { - pcdata = pcdata_free; - pcdata_free = pcdata_free->next; - } - - *pcdata = pcdata_zero; - - for (alias = 0; alias < MAX_ALIAS; alias++) - { - pcdata->alias[alias] = NULL; - pcdata->alias_sub[alias] = NULL; - } - - pcdata->buffer = new_buf(); - - VALIDATE(pcdata); - return pcdata; -} - - -void free_pcdata(PC_DATA *pcdata) -{ - int alias; - - if (!IS_VALID(pcdata)) - return; - - free_string(pcdata->pwd); - free_string(pcdata->bamfin); - free_string(pcdata->bamfout); - free_string(pcdata->title); - free_buf(pcdata->buffer); - - for (alias = 0; alias < MAX_ALIAS; alias++) - { - free_string(pcdata->alias[alias]); - free_string(pcdata->alias_sub[alias]); - } - INVALIDATE(pcdata); - pcdata->next = pcdata_free; - pcdata_free = pcdata; - - return; -} - - - - -/* stuff for setting ids */ -long last_pc_id; -long last_mob_id; - -long get_pc_id(void) -{ - int val; - - val = (current_time <= last_pc_id) ? last_pc_id + 1 : current_time; - last_pc_id = val; - return val; -} - -long get_mob_id(void) -{ - last_mob_id++; - return last_mob_id; -} - -MEM_DATA *mem_data_free; - -/* procedures and constants needed for buffering */ - -BUFFER *buf_free; - -MEM_DATA *new_mem_data(void) -{ - MEM_DATA *memory; - - if (mem_data_free == NULL) - memory = alloc_mem(sizeof(*memory)); - else - { - memory = mem_data_free; - mem_data_free = mem_data_free->next; - } - - memory->next = NULL; - memory->id = 0; - memory->reaction = 0; - memory->when = 0; - VALIDATE(memory); - - return memory; -} - -void free_mem_data(MEM_DATA *memory) -{ - if (!IS_VALID(memory)) - return; - - memory->next = mem_data_free; - mem_data_free = memory; - INVALIDATE(memory); -} - - - -/* buffer sizes */ -const int buf_size[MAX_BUF_LIST] = -{ - 16,32,64,128,256,1024,2048,4096,8192,16384 -}; - -/* local procedure for finding the next acceptable size */ -/* -1 indicates out-of-boundary error */ -int get_size (int val) -{ - int i; - - for (i = 0; i < MAX_BUF_LIST; i++) - if (buf_size[i] >= val) - { - return buf_size[i]; - } - - return -1; -} - -BUFFER *new_buf() -{ - BUFFER *buffer; - - if (buf_free == NULL) - buffer = alloc_perm(sizeof(*buffer)); - else - { - buffer = buf_free; - buf_free = buf_free->next; - } - - buffer->next = NULL; - buffer->state = BUFFER_SAFE; - buffer->size = get_size(BASE_BUF); - - buffer->string = alloc_mem(buffer->size); - buffer->string[0] = '\0'; - VALIDATE(buffer); - - return buffer; -} - -BUFFER *new_buf_size(int size) -{ - BUFFER *buffer; - - if (buf_free == NULL) - buffer = alloc_perm(sizeof(*buffer)); - else - { - buffer = buf_free; - buf_free = buf_free->next; - } - - buffer->next = NULL; - buffer->state = BUFFER_SAFE; - buffer->size = get_size(size); - if (buffer->size == -1) - { - bug("new_buf: buffer size %d too large.",size); - exit(1); - } - buffer->string = alloc_mem(buffer->size); - buffer->string[0] = '\0'; - VALIDATE(buffer); - - return buffer; -} - - -void free_buf(BUFFER *buffer) -{ - if (!IS_VALID(buffer)) - return; - - free_mem(buffer->string,buffer->size); - buffer->string = NULL; - buffer->size = 0; - buffer->state = BUFFER_FREED; - INVALIDATE(buffer); - - buffer->next = buf_free; - buf_free = buffer; -} - - -bool add_buf(BUFFER *buffer, char *string) -{ - int len; - char *oldstr; - int oldsize; - - oldstr = buffer->string; - oldsize = buffer->size; - - if (buffer->state == BUFFER_OVERFLOW) /* don't waste time on bad strings! */ - return FALSE; - - len = strlen(buffer->string) + strlen(string) + 1; - - while (len >= buffer->size) /* increase the buffer size */ - { - buffer->size = get_size(buffer->size + 1); - { - if (buffer->size == -1) /* overflow */ - { - buffer->size = oldsize; - buffer->state = BUFFER_OVERFLOW; - bug("buffer overflow past size %d",buffer->size); - return FALSE; - } - } - } - - if (buffer->size != oldsize) - { - buffer->string = alloc_mem(buffer->size); - - strcpy(buffer->string,oldstr); - free_mem(oldstr,oldsize); - } - - strcat(buffer->string,string); - return TRUE; -} - - -void clear_buf(BUFFER *buffer) -{ - buffer->string[0] = '\0'; - buffer->state = BUFFER_SAFE; -} - - -char *buf_string(BUFFER *buffer) -{ - return buffer->string; -} - - - - - - - - - - - - diff --git a/archive/src/recycle.h b/archive/src/recycle.h deleted file mode 100644 index 873b4b1..0000000 --- a/archive/src/recycle.h +++ /dev/null @@ -1,112 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -/* externs */ -extern char str_empty[1]; -extern int mobile_count; - -/* stuff for providing a crash-proof buffer */ - -#define MAX_BUF 16384 -#define MAX_BUF_LIST 10 -#define BASE_BUF 1024 - -/* valid states */ -#define BUFFER_SAFE 0 -#define BUFFER_OVERFLOW 1 -#define BUFFER_FREED 2 - -/* note recycling */ -#define ND NOTE_DATA -ND *new_note args( (void) ); -void free_note args( (NOTE_DATA *note) ); -#undef ND - -/* ban data recycling */ -#define BD BAN_DATA -BD *new_ban args( (void) ); -void free_ban args( (BAN_DATA *ban) ); -#undef BD - -/* descriptor recycling */ -#define DD DESCRIPTOR_DATA -DD *new_descriptor args( (void) ); -void free_descriptor args( (DESCRIPTOR_DATA *d) ); -#undef DD - -/* char gen data recycling */ -#define GD GEN_DATA -GD *new_gen_data args( (void) ); -void free_gen_data args( (GEN_DATA * gen) ); -#undef GD - -/* extra descr recycling */ -#define ED EXTRA_DESCR_DATA -ED *new_extra_descr args( (void) ); -void free_extra_descr args( (EXTRA_DESCR_DATA *ed) ); -#undef ED - -/* affect recycling */ -#define AD AFFECT_DATA -AD *new_affect args( (void) ); -void free_affect args( (AFFECT_DATA *af) ); -#undef AD - -/* object recycling */ -#define OD OBJ_DATA -OD *new_obj args( (void) ); -void free_obj args( (OBJ_DATA *obj) ); -#undef OD - -/* character recyling */ -#define CD CHAR_DATA -#define PD PC_DATA -CD *new_char args( (void) ); -void free_char args( (CHAR_DATA *ch) ); -PD *new_pcdata args( (void) ); -void free_pcdata args( (PC_DATA *pcdata) ); -#undef PD -#undef CD - - -/* mob id and memory procedures */ -#define MD MEM_DATA -long get_pc_id args( (void) ); -long get_mob_id args( (void) ); -MD *new_mem_data args( (void) ); -void free_mem_data args( ( MEM_DATA *memory) ); -MD *find_memory args( (MEM_DATA *memory, long id) ); -#undef MD - -/* buffer procedures */ - -BUFFER *new_buf args( (void) ); -BUFFER *new_buf_size args( (int size) ); -void free_buf args( (BUFFER *buffer) ); -bool add_buf args( (BUFFER *buffer, char *string) ); -void clear_buf args( (BUFFER *buffer) ); -char *buf_string args( (BUFFER *buffer) ); diff --git a/archive/src/save.c b/archive/src/save.c deleted file mode 100644 index 9f9a60c..0000000 --- a/archive/src/save.c +++ /dev/null @@ -1,1665 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#endif -#include -#include -#include -#include -#include -#include -#include "merc.h" -#include "recycle.h" -#include "lookup.h" -#include "tables.h" - -#if !defined(macintosh) -extern int _filbuf args( (FILE *) ); -#endif - - -int rename(const char *oldfname, const char *newfname); - -char *print_flags(int flag) -{ - int count, pos = 0; - static char buf[52]; - - - for (count = 0; count < 32; count++) - { - if (IS_SET(flag,1<desc != NULL && ch->desc->original != NULL ) - ch = ch->desc->original; - -#if defined(unix) - /* create god log */ - if (IS_IMMORTAL(ch) || ch->level >= LEVEL_IMMORTAL) - { - fclose(fpReserve); - sprintf(strsave, "%s%s",GOD_DIR, capitalize(ch->name)); - if ((fp = fopen(strsave,"w")) == NULL) - { - bug("Save_char_obj: fopen",0); - perror(strsave); - } - - fprintf(fp,"Lev %2d Trust %2d %s%s\n", - ch->level, get_trust(ch), ch->name, ch->pcdata->title); - fclose( fp ); - fpReserve = fopen( NULL_FILE, "r" ); - } -#endif - - fclose( fpReserve ); - sprintf( strsave, "%s%s", PLAYER_DIR, capitalize( ch->name ) ); - if ( ( fp = fopen( TEMP_FILE, "w" ) ) == NULL ) - { - bug( "Save_char_obj: fopen", 0 ); - perror( strsave ); - } - else - { - fwrite_char( ch, fp ); - if ( ch->carrying != NULL ) - fwrite_obj( ch, ch->carrying, fp, 0 ); - /* save the pets */ - if (ch->pet != NULL && ch->pet->in_room == ch->in_room) - fwrite_pet(ch->pet,fp); - fprintf( fp, "#END\n" ); - } - fclose( fp ); - rename(TEMP_FILE,strsave); - fpReserve = fopen( NULL_FILE, "r" ); - return; -} - - - -/* - * Write the char. - */ -void fwrite_char( CHAR_DATA *ch, FILE *fp ) -{ - AFFECT_DATA *paf; - int sn, gn, pos; - - fprintf( fp, "#%s\n", IS_NPC(ch) ? "MOB" : "PLAYER" ); - - fprintf( fp, "Name %s~\n", ch->name ); - fprintf( fp, "Id %ld\n", ch->id ); - fprintf( fp, "LogO %ld\n", current_time ); - fprintf( fp, "Vers %d\n", 5 ); - if (ch->short_descr[0] != '\0') - fprintf( fp, "ShD %s~\n", ch->short_descr ); - if( ch->long_descr[0] != '\0') - fprintf( fp, "LnD %s~\n", ch->long_descr ); - if (ch->description[0] != '\0') - fprintf( fp, "Desc %s~\n", ch->description ); - if (ch->prompt != NULL || !str_cmp(ch->prompt,"<%hhp %mm %vmv> ")) - fprintf( fp, "Prom %s~\n", ch->prompt ); - fprintf( fp, "Race %s~\n", pc_race_table[ch->race].name ); - if (ch->clan) - fprintf( fp, "Clan %s~\n",clan_table[ch->clan].name); - fprintf( fp, "Sex %d\n", ch->sex ); - fprintf( fp, "Cla %d\n", ch->class ); - fprintf( fp, "Levl %d\n", ch->level ); - if (ch->trust != 0) - fprintf( fp, "Tru %d\n", ch->trust ); - fprintf( fp, "Plyd %d\n", - ch->played + (int) (current_time - ch->logon) ); - fprintf( fp, "Not %ld %ld %ld %ld %ld\n", - ch->pcdata->last_note,ch->pcdata->last_idea,ch->pcdata->last_penalty, - ch->pcdata->last_news,ch->pcdata->last_changes ); - fprintf( fp, "Scro %d\n", ch->lines ); - fprintf( fp, "Room %d\n", - ( ch->in_room == get_room_index( ROOM_VNUM_LIMBO ) - && ch->was_in_room != NULL ) - ? ch->was_in_room->vnum - : ch->in_room == NULL ? 3001 : ch->in_room->vnum ); - - fprintf( fp, "HMV %d %d %d %d %d %d\n", - ch->hit, ch->max_hit, ch->mana, ch->max_mana, ch->move, ch->max_move ); - if (ch->gold > 0) - fprintf( fp, "Gold %ld\n", ch->gold ); - else - fprintf( fp, "Gold %d\n", 0 ); - if (ch->silver > 0) - fprintf( fp, "Silv %ld\n",ch->silver ); - else - fprintf( fp, "Silv %d\n",0 ); - fprintf( fp, "Exp %d\n", ch->exp ); - if (ch->act != 0) - fprintf( fp, "Act %s\n", print_flags(ch->act)); - if (ch->affected_by != 0) - fprintf( fp, "AfBy %s\n", print_flags(ch->affected_by)); - fprintf( fp, "Comm %s\n", print_flags(ch->comm)); - if (ch->wiznet) - fprintf( fp, "Wizn %s\n", print_flags(ch->wiznet)); - if (ch->invis_level) - fprintf( fp, "Invi %d\n", ch->invis_level ); - if (ch->incog_level) - fprintf(fp,"Inco %d\n",ch->incog_level); - fprintf( fp, "Pos %d\n", - ch->position == POS_FIGHTING ? POS_STANDING : ch->position ); - if (ch->practice != 0) - fprintf( fp, "Prac %d\n", ch->practice ); - if (ch->train != 0) - fprintf( fp, "Trai %d\n", ch->train ); - if (ch->saving_throw != 0) - fprintf( fp, "Save %d\n", ch->saving_throw); - fprintf( fp, "Alig %d\n", ch->alignment ); - if (ch->hitroll != 0) - fprintf( fp, "Hit %d\n", ch->hitroll ); - if (ch->damroll != 0) - fprintf( fp, "Dam %d\n", ch->damroll ); - fprintf( fp, "ACs %d %d %d %d\n", - ch->armor[0],ch->armor[1],ch->armor[2],ch->armor[3]); - if (ch->wimpy !=0 ) - fprintf( fp, "Wimp %d\n", ch->wimpy ); - fprintf( fp, "Attr %d %d %d %d %d\n", - ch->perm_stat[STAT_STR], - ch->perm_stat[STAT_INT], - ch->perm_stat[STAT_WIS], - ch->perm_stat[STAT_DEX], - ch->perm_stat[STAT_CON] ); - - fprintf (fp, "AMod %d %d %d %d %d\n", - ch->mod_stat[STAT_STR], - ch->mod_stat[STAT_INT], - ch->mod_stat[STAT_WIS], - ch->mod_stat[STAT_DEX], - ch->mod_stat[STAT_CON] ); - - if ( IS_NPC(ch) ) - { - fprintf( fp, "Vnum %d\n", ch->pIndexData->vnum ); - } - else - { - fprintf( fp, "Pass %s~\n", ch->pcdata->pwd ); - if (ch->pcdata->bamfin[0] != '\0') - fprintf( fp, "Bin %s~\n", ch->pcdata->bamfin); - if (ch->pcdata->bamfout[0] != '\0') - fprintf( fp, "Bout %s~\n", ch->pcdata->bamfout); - fprintf( fp, "Titl %s~\n", ch->pcdata->title ); - fprintf( fp, "Pnts %d\n", ch->pcdata->points ); - fprintf( fp, "TSex %d\n", ch->pcdata->true_sex ); - fprintf( fp, "LLev %d\n", ch->pcdata->last_level ); - fprintf( fp, "HMVP %d %d %d\n", ch->pcdata->perm_hit, - ch->pcdata->perm_mana, - ch->pcdata->perm_move); - fprintf( fp, "Cnd %d %d %d %d\n", - ch->pcdata->condition[0], - ch->pcdata->condition[1], - ch->pcdata->condition[2], - ch->pcdata->condition[3] ); - - /* write alias */ - for (pos = 0; pos < MAX_ALIAS; pos++) - { - if (ch->pcdata->alias[pos] == NULL - || ch->pcdata->alias_sub[pos] == NULL) - break; - - fprintf(fp,"Alias %s %s~\n",ch->pcdata->alias[pos], - ch->pcdata->alias_sub[pos]); - } - - for ( sn = 0; sn < MAX_SKILL; sn++ ) - { - if ( skill_table[sn].name != NULL && ch->pcdata->learned[sn] > 0 ) - { - fprintf( fp, "Sk %d '%s'\n", - ch->pcdata->learned[sn], skill_table[sn].name ); - } - } - - for ( gn = 0; gn < MAX_GROUP; gn++ ) - { - if ( group_table[gn].name != NULL && ch->pcdata->group_known[gn]) - { - fprintf( fp, "Gr '%s'\n",group_table[gn].name); - } - } - } - - for ( paf = ch->affected; paf != NULL; paf = paf->next ) - { - if (paf->type < 0 || paf->type>= MAX_SKILL) - continue; - - fprintf( fp, "Affc '%s' %3d %3d %3d %3d %3d %10d\n", - skill_table[paf->type].name, - paf->where, - paf->level, - paf->duration, - paf->modifier, - paf->location, - paf->bitvector - ); - } - - fprintf( fp, "End\n\n" ); - return; -} - -/* write a pet */ -void fwrite_pet( CHAR_DATA *pet, FILE *fp) -{ - AFFECT_DATA *paf; - - fprintf(fp,"#PET\n"); - - fprintf(fp,"Vnum %d\n",pet->pIndexData->vnum); - - fprintf(fp,"Name %s~\n", pet->name); - fprintf(fp,"LogO %ld\n", current_time); - if (pet->short_descr != pet->pIndexData->short_descr) - fprintf(fp,"ShD %s~\n", pet->short_descr); - if (pet->long_descr != pet->pIndexData->long_descr) - fprintf(fp,"LnD %s~\n", pet->long_descr); - if (pet->description != pet->pIndexData->description) - fprintf(fp,"Desc %s~\n", pet->description); - if (pet->race != pet->pIndexData->race) - fprintf(fp,"Race %s~\n", race_table[pet->race].name); - if (pet->clan) - fprintf( fp, "Clan %s~\n",clan_table[pet->clan].name); - fprintf(fp,"Sex %d\n", pet->sex); - if (pet->level != pet->pIndexData->level) - fprintf(fp,"Levl %d\n", pet->level); - fprintf(fp, "HMV %d %d %d %d %d %d\n", - pet->hit, pet->max_hit, pet->mana, pet->max_mana, pet->move, pet->max_move); - if (pet->gold > 0) - fprintf(fp,"Gold %ld\n",pet->gold); - if (pet->silver > 0) - fprintf(fp,"Silv %ld\n",pet->silver); - if (pet->exp > 0) - fprintf(fp, "Exp %d\n", pet->exp); - if (pet->act != pet->pIndexData->act) - fprintf(fp, "Act %s\n", print_flags(pet->act)); - if (pet->affected_by != pet->pIndexData->affected_by) - fprintf(fp, "AfBy %s\n", print_flags(pet->affected_by)); - if (pet->comm != 0) - fprintf(fp, "Comm %s\n", print_flags(pet->comm)); - fprintf(fp,"Pos %d\n", pet->position = POS_FIGHTING ? POS_STANDING : pet->position); - if (pet->saving_throw != 0) - fprintf(fp, "Save %d\n", pet->saving_throw); - if (pet->alignment != pet->pIndexData->alignment) - fprintf(fp, "Alig %d\n", pet->alignment); - if (pet->hitroll != pet->pIndexData->hitroll) - fprintf(fp, "Hit %d\n", pet->hitroll); - if (pet->damroll != pet->pIndexData->damage[DICE_BONUS]) - fprintf(fp, "Dam %d\n", pet->damroll); - fprintf(fp, "ACs %d %d %d %d\n", - pet->armor[0],pet->armor[1],pet->armor[2],pet->armor[3]); - fprintf(fp, "Attr %d %d %d %d %d\n", - pet->perm_stat[STAT_STR], pet->perm_stat[STAT_INT], - pet->perm_stat[STAT_WIS], pet->perm_stat[STAT_DEX], - pet->perm_stat[STAT_CON]); - fprintf(fp, "AMod %d %d %d %d %d\n", - pet->mod_stat[STAT_STR], pet->mod_stat[STAT_INT], - pet->mod_stat[STAT_WIS], pet->mod_stat[STAT_DEX], - pet->mod_stat[STAT_CON]); - - for ( paf = pet->affected; paf != NULL; paf = paf->next ) - { - if (paf->type < 0 || paf->type >= MAX_SKILL) - continue; - - fprintf(fp, "Affc '%s' %3d %3d %3d %3d %3d %10d\n", - skill_table[paf->type].name, - paf->where, paf->level, paf->duration, paf->modifier,paf->location, - paf->bitvector); - } - - fprintf(fp,"End\n"); - return; -} - -/* - * Write an object and its contents. - */ -void fwrite_obj( CHAR_DATA *ch, OBJ_DATA *obj, FILE *fp, int iNest ) -{ - EXTRA_DESCR_DATA *ed; - AFFECT_DATA *paf; - - /* - * Slick recursion to write lists backwards, - * so loading them will load in forwards order. - */ - if ( obj->next_content != NULL ) - fwrite_obj( ch, obj->next_content, fp, iNest ); - - /* - * Castrate storage characters. - */ - if ( (ch->level < obj->level - 2 && obj->item_type != ITEM_CONTAINER) - || obj->item_type == ITEM_KEY - || (obj->item_type == ITEM_MAP && !obj->value[0])) - return; - - fprintf( fp, "#O\n" ); - fprintf( fp, "Vnum %d\n", obj->pIndexData->vnum ); - if (!obj->pIndexData->new_format) - fprintf( fp, "Oldstyle\n"); - if (obj->enchanted) - fprintf( fp,"Enchanted\n"); - fprintf( fp, "Nest %d\n", iNest ); - - /* these data are only used if they do not match the defaults */ - - if ( obj->name != obj->pIndexData->name) - fprintf( fp, "Name %s~\n", obj->name ); - if ( obj->short_descr != obj->pIndexData->short_descr) - fprintf( fp, "ShD %s~\n", obj->short_descr ); - if ( obj->description != obj->pIndexData->description) - fprintf( fp, "Desc %s~\n", obj->description ); - if ( obj->extra_flags != obj->pIndexData->extra_flags) - fprintf( fp, "ExtF %d\n", obj->extra_flags ); - if ( obj->wear_flags != obj->pIndexData->wear_flags) - fprintf( fp, "WeaF %d\n", obj->wear_flags ); - if ( obj->item_type != obj->pIndexData->item_type) - fprintf( fp, "Ityp %d\n", obj->item_type ); - if ( obj->weight != obj->pIndexData->weight) - fprintf( fp, "Wt %d\n", obj->weight ); - if ( obj->condition != obj->pIndexData->condition) - fprintf( fp, "Cond %d\n", obj->condition ); - - /* variable data */ - - fprintf( fp, "Wear %d\n", obj->wear_loc ); - if (obj->level != obj->pIndexData->level) - fprintf( fp, "Lev %d\n", obj->level ); - if (obj->timer != 0) - fprintf( fp, "Time %d\n", obj->timer ); - fprintf( fp, "Cost %d\n", obj->cost ); - if (obj->value[0] != obj->pIndexData->value[0] - || obj->value[1] != obj->pIndexData->value[1] - || obj->value[2] != obj->pIndexData->value[2] - || obj->value[3] != obj->pIndexData->value[3] - || obj->value[4] != obj->pIndexData->value[4]) - fprintf( fp, "Val %d %d %d %d %d\n", - obj->value[0], obj->value[1], obj->value[2], obj->value[3], - obj->value[4] ); - - switch ( obj->item_type ) - { - case ITEM_POTION: - case ITEM_SCROLL: - case ITEM_PILL: - if ( obj->value[1] > 0 ) - { - fprintf( fp, "Spell 1 '%s'\n", - skill_table[obj->value[1]].name ); - } - - if ( obj->value[2] > 0 ) - { - fprintf( fp, "Spell 2 '%s'\n", - skill_table[obj->value[2]].name ); - } - - if ( obj->value[3] > 0 ) - { - fprintf( fp, "Spell 3 '%s'\n", - skill_table[obj->value[3]].name ); - } - - break; - - case ITEM_STAFF: - case ITEM_WAND: - if ( obj->value[3] > 0 ) - { - fprintf( fp, "Spell 3 '%s'\n", - skill_table[obj->value[3]].name ); - } - - break; - } - - for ( paf = obj->affected; paf != NULL; paf = paf->next ) - { - if (paf->type < 0 || paf->type >= MAX_SKILL) - continue; - fprintf( fp, "Affc '%s' %3d %3d %3d %3d %3d %10d\n", - skill_table[paf->type].name, - paf->where, - paf->level, - paf->duration, - paf->modifier, - paf->location, - paf->bitvector - ); - } - - for ( ed = obj->extra_descr; ed != NULL; ed = ed->next ) - { - fprintf( fp, "ExDe %s~ %s~\n", - ed->keyword, ed->description ); - } - - fprintf( fp, "End\n\n" ); - - if ( obj->contains != NULL ) - fwrite_obj( ch, obj->contains, fp, iNest + 1 ); - - return; -} - - - -/* - * Load a char and inventory into a new ch structure. - */ -bool load_char_obj( DESCRIPTOR_DATA *d, char *name ) -{ - char strsave[MAX_INPUT_LENGTH]; - char buf[100]; - CHAR_DATA *ch; - FILE *fp; - bool found; - int stat; - - ch = new_char(); - ch->pcdata = new_pcdata(); - - d->character = ch; - ch->desc = d; - ch->name = str_dup( name ); - ch->id = get_pc_id(); - ch->race = race_lookup("human"); - ch->act = PLR_NOSUMMON; - ch->comm = COMM_COMBINE - | COMM_PROMPT; - ch->prompt = str_dup("<%hhp %mm %vmv> "); - ch->pcdata->confirm_delete = FALSE; - ch->pcdata->pwd = str_dup( "" ); - ch->pcdata->bamfin = str_dup( "" ); - ch->pcdata->bamfout = str_dup( "" ); - ch->pcdata->title = str_dup( "" ); - for (stat =0; stat < MAX_STATS; stat++) - ch->perm_stat[stat] = 13; - ch->pcdata->condition[COND_THIRST] = 48; - ch->pcdata->condition[COND_FULL] = 48; - ch->pcdata->condition[COND_HUNGER] = 48; - - found = FALSE; - fclose( fpReserve ); - - #if defined(unix) - /* decompress if .gz file exists */ - sprintf( strsave, "%s%s%s", PLAYER_DIR, capitalize(name),".gz"); - if ( ( fp = fopen( strsave, "r" ) ) != NULL ) - { - fclose(fp); - sprintf(buf,"gzip -dfq %s",strsave); - system(buf); - } - #endif - - sprintf( strsave, "%s%s", PLAYER_DIR, capitalize( name ) ); - if ( ( fp = fopen( strsave, "r" ) ) != NULL ) - { - int iNest; - - for ( iNest = 0; iNest < MAX_NEST; iNest++ ) - rgObjNest[iNest] = NULL; - - found = TRUE; - for ( ; ; ) - { - char letter; - char *word; - - letter = fread_letter( fp ); - if ( letter == '*' ) - { - fread_to_eol( fp ); - continue; - } - - if ( letter != '#' ) - { - bug( "Load_char_obj: # not found.", 0 ); - break; - } - - word = fread_word( fp ); - if ( !str_cmp( word, "PLAYER" ) ) fread_char ( ch, fp ); - else if ( !str_cmp( word, "OBJECT" ) ) fread_obj ( ch, fp ); - else if ( !str_cmp( word, "O" ) ) fread_obj ( ch, fp ); - else if ( !str_cmp( word, "PET" ) ) fread_pet ( ch, fp ); - else if ( !str_cmp( word, "END" ) ) break; - else - { - bug( "Load_char_obj: bad section.", 0 ); - break; - } - } - fclose( fp ); - } - - fpReserve = fopen( NULL_FILE, "r" ); - - - /* initialize race */ - if (found) - { - int i; - - if (ch->race == 0) - ch->race = race_lookup("human"); - - ch->size = pc_race_table[ch->race].size; - ch->dam_type = 17; /*punch */ - - for (i = 0; i < 5; i++) - { - if (pc_race_table[ch->race].skills[i] == NULL) - break; - group_add(ch,pc_race_table[ch->race].skills[i],FALSE); - } - ch->affected_by = ch->affected_by|race_table[ch->race].aff; - ch->imm_flags = ch->imm_flags | race_table[ch->race].imm; - ch->res_flags = ch->res_flags | race_table[ch->race].res; - ch->vuln_flags = ch->vuln_flags | race_table[ch->race].vuln; - ch->form = race_table[ch->race].form; - ch->parts = race_table[ch->race].parts; - } - - - /* RT initialize skills */ - - if (found && ch->version < 2) /* need to add the new skills */ - { - group_add(ch,"rom basics",FALSE); - group_add(ch,class_table[ch->class].base_group,FALSE); - group_add(ch,class_table[ch->class].default_group,TRUE); - ch->pcdata->learned[gsn_recall] = 50; - } - - /* fix levels */ - if (found && ch->version < 3 && (ch->level > 35 || ch->trust > 35)) - { - switch (ch->level) - { - case(40) : ch->level = 60; break; /* imp -> imp */ - case(39) : ch->level = 58; break; /* god -> supreme */ - case(38) : ch->level = 56; break; /* deity -> god */ - case(37) : ch->level = 53; break; /* angel -> demigod */ - } - - switch (ch->trust) - { - case(40) : ch->trust = 60; break; /* imp -> imp */ - case(39) : ch->trust = 58; break; /* god -> supreme */ - case(38) : ch->trust = 56; break; /* deity -> god */ - case(37) : ch->trust = 53; break; /* angel -> demigod */ - case(36) : ch->trust = 51; break; /* hero -> hero */ - } - } - - /* ream gold */ - if (found && ch->version < 4) - { - ch->gold /= 100; - } - return found; -} - - - -/* - * Read in a char. - */ - -#if defined(KEY) -#undef KEY -#endif - -#define KEY( literal, field, value ) \ - if ( !str_cmp( word, literal ) ) \ - { \ - field = value; \ - fMatch = TRUE; \ - break; \ - } - -/* provided to free strings */ -#if defined(KEYS) -#undef KEYS -#endif - -#define KEYS( literal, field, value ) \ - if ( !str_cmp( word, literal ) ) \ - { \ - free_string(field); \ - field = value; \ - fMatch = TRUE; \ - break; \ - } - -void fread_char( CHAR_DATA *ch, FILE *fp ) -{ - char buf[MAX_STRING_LENGTH]; - char *word; - bool fMatch; - int count = 0; - int lastlogoff = current_time; - int percent; - - sprintf(buf,"Loading %s.",ch->name); - log_string(buf); - - for ( ; ; ) - { - word = feof( fp ) ? "End" : fread_word( fp ); - fMatch = FALSE; - - switch ( UPPER(word[0]) ) - { - case '*': - fMatch = TRUE; - fread_to_eol( fp ); - break; - - case 'A': - KEY( "Act", ch->act, fread_flag( fp ) ); - KEY( "AffectedBy", ch->affected_by, fread_flag( fp ) ); - KEY( "AfBy", ch->affected_by, fread_flag( fp ) ); - KEY( "Alignment", ch->alignment, fread_number( fp ) ); - KEY( "Alig", ch->alignment, fread_number( fp ) ); - - if (!str_cmp( word, "Alia")) - { - if (count >= MAX_ALIAS) - { - fread_to_eol(fp); - fMatch = TRUE; - break; - } - - ch->pcdata->alias[count] = str_dup(fread_word(fp)); - ch->pcdata->alias_sub[count] = str_dup(fread_word(fp)); - count++; - fMatch = TRUE; - break; - } - - if (!str_cmp( word, "Alias")) - { - if (count >= MAX_ALIAS) - { - fread_to_eol(fp); - fMatch = TRUE; - break; - } - - ch->pcdata->alias[count] = str_dup(fread_word(fp)); - ch->pcdata->alias_sub[count] = fread_string(fp); - count++; - fMatch = TRUE; - break; - } - - if (!str_cmp( word, "AC") || !str_cmp(word,"Armor")) - { - fread_to_eol(fp); - fMatch = TRUE; - break; - } - - if (!str_cmp(word,"ACs")) - { - int i; - - for (i = 0; i < 4; i++) - ch->armor[i] = fread_number(fp); - fMatch = TRUE; - break; - } - - if (!str_cmp(word, "AffD")) - { - AFFECT_DATA *paf; - int sn; - - paf = new_affect(); - - sn = skill_lookup(fread_word(fp)); - if (sn < 0) - bug("Fread_char: unknown skill.",0); - else - paf->type = sn; - - paf->level = fread_number( fp ); - paf->duration = fread_number( fp ); - paf->modifier = fread_number( fp ); - paf->location = fread_number( fp ); - paf->bitvector = fread_number( fp ); - paf->next = ch->affected; - ch->affected = paf; - fMatch = TRUE; - break; - } - - if (!str_cmp(word, "Affc")) - { - AFFECT_DATA *paf; - int sn; - - paf = new_affect(); - - sn = skill_lookup(fread_word(fp)); - if (sn < 0) - bug("Fread_char: unknown skill.",0); - else - paf->type = sn; - - paf->where = fread_number(fp); - paf->level = fread_number( fp ); - paf->duration = fread_number( fp ); - paf->modifier = fread_number( fp ); - paf->location = fread_number( fp ); - paf->bitvector = fread_number( fp ); - paf->next = ch->affected; - ch->affected = paf; - fMatch = TRUE; - break; - } - - if ( !str_cmp( word, "AttrMod" ) || !str_cmp(word,"AMod")) - { - int stat; - for (stat = 0; stat < MAX_STATS; stat ++) - ch->mod_stat[stat] = fread_number(fp); - fMatch = TRUE; - break; - } - - if ( !str_cmp( word, "AttrPerm" ) || !str_cmp(word,"Attr")) - { - int stat; - - for (stat = 0; stat < MAX_STATS; stat++) - ch->perm_stat[stat] = fread_number(fp); - fMatch = TRUE; - break; - } - break; - - case 'B': - KEY( "Bamfin", ch->pcdata->bamfin, fread_string( fp ) ); - KEY( "Bamfout", ch->pcdata->bamfout, fread_string( fp ) ); - KEY( "Bin", ch->pcdata->bamfin, fread_string( fp ) ); - KEY( "Bout", ch->pcdata->bamfout, fread_string( fp ) ); - break; - - case 'C': - KEY( "Class", ch->class, fread_number( fp ) ); - KEY( "Cla", ch->class, fread_number( fp ) ); - KEY( "Clan", ch->clan, clan_lookup(fread_string(fp))); - - if ( !str_cmp( word, "Condition" ) || !str_cmp(word,"Cond")) - { - ch->pcdata->condition[0] = fread_number( fp ); - ch->pcdata->condition[1] = fread_number( fp ); - ch->pcdata->condition[2] = fread_number( fp ); - fMatch = TRUE; - break; - } - if (!str_cmp(word,"Cnd")) - { - ch->pcdata->condition[0] = fread_number( fp ); - ch->pcdata->condition[1] = fread_number( fp ); - ch->pcdata->condition[2] = fread_number( fp ); - ch->pcdata->condition[3] = fread_number( fp ); - fMatch = TRUE; - break; - } - KEY("Comm", ch->comm, fread_flag( fp ) ); - - break; - - case 'D': - KEY( "Damroll", ch->damroll, fread_number( fp ) ); - KEY( "Dam", ch->damroll, fread_number( fp ) ); - KEY( "Description", ch->description, fread_string( fp ) ); - KEY( "Desc", ch->description, fread_string( fp ) ); - break; - - case 'E': - if ( !str_cmp( word, "End" ) ) - { - /* adjust hp mana move up -- here for speed's sake */ - percent = (current_time - lastlogoff) * 25 / ( 2 * 60 * 60); - - percent = UMIN(percent,100); - - if (percent > 0 && !IS_AFFECTED(ch,AFF_POISON) - && !IS_AFFECTED(ch,AFF_PLAGUE)) - { - ch->hit += (ch->max_hit - ch->hit) * percent / 100; - ch->mana += (ch->max_mana - ch->mana) * percent / 100; - ch->move += (ch->max_move - ch->move)* percent / 100; - } - return; - } - KEY( "Exp", ch->exp, fread_number( fp ) ); - break; - - case 'G': - KEY( "Gold", ch->gold, fread_number( fp ) ); - if ( !str_cmp( word, "Group" ) || !str_cmp(word,"Gr")) - { - int gn; - char *temp; - - temp = fread_word( fp ) ; - gn = group_lookup(temp); - /* gn = group_lookup( fread_word( fp ) ); */ - if ( gn < 0 ) - { - fprintf(stderr,"%s",temp); - bug( "Fread_char: unknown group. ", 0 ); - } - else - gn_add(ch,gn); - fMatch = TRUE; - } - break; - - case 'H': - KEY( "Hitroll", ch->hitroll, fread_number( fp ) ); - KEY( "Hit", ch->hitroll, fread_number( fp ) ); - - if ( !str_cmp( word, "HpManaMove" ) || !str_cmp(word,"HMV")) - { - ch->hit = fread_number( fp ); - ch->max_hit = fread_number( fp ); - ch->mana = fread_number( fp ); - ch->max_mana = fread_number( fp ); - ch->move = fread_number( fp ); - ch->max_move = fread_number( fp ); - fMatch = TRUE; - break; - } - - if ( !str_cmp( word, "HpManaMovePerm" ) || !str_cmp(word,"HMVP")) - { - ch->pcdata->perm_hit = fread_number( fp ); - ch->pcdata->perm_mana = fread_number( fp ); - ch->pcdata->perm_move = fread_number( fp ); - fMatch = TRUE; - break; - } - - break; - - case 'I': - KEY( "Id", ch->id, fread_number( fp ) ); - KEY( "InvisLevel", ch->invis_level, fread_number( fp ) ); - KEY( "Inco", ch->incog_level, fread_number( fp ) ); - KEY( "Invi", ch->invis_level, fread_number( fp ) ); - break; - - case 'L': - KEY( "LastLevel", ch->pcdata->last_level, fread_number( fp ) ); - KEY( "LLev", ch->pcdata->last_level, fread_number( fp ) ); - KEY( "Level", ch->level, fread_number( fp ) ); - KEY( "Lev", ch->level, fread_number( fp ) ); - KEY( "Levl", ch->level, fread_number( fp ) ); - KEY( "LogO", lastlogoff, fread_number( fp ) ); - KEY( "LongDescr", ch->long_descr, fread_string( fp ) ); - KEY( "LnD", ch->long_descr, fread_string( fp ) ); - break; - - case 'N': - KEYS( "Name", ch->name, fread_string( fp ) ); - KEY( "Note", ch->pcdata->last_note, fread_number( fp ) ); - if (!str_cmp(word,"Not")) - { - ch->pcdata->last_note = fread_number(fp); - ch->pcdata->last_idea = fread_number(fp); - ch->pcdata->last_penalty = fread_number(fp); - ch->pcdata->last_news = fread_number(fp); - ch->pcdata->last_changes = fread_number(fp); - fMatch = TRUE; - break; - } - break; - - case 'P': - KEY( "Password", ch->pcdata->pwd, fread_string( fp ) ); - KEY( "Pass", ch->pcdata->pwd, fread_string( fp ) ); - KEY( "Played", ch->played, fread_number( fp ) ); - KEY( "Plyd", ch->played, fread_number( fp ) ); - KEY( "Points", ch->pcdata->points, fread_number( fp ) ); - KEY( "Pnts", ch->pcdata->points, fread_number( fp ) ); - KEY( "Position", ch->position, fread_number( fp ) ); - KEY( "Pos", ch->position, fread_number( fp ) ); - KEY( "Practice", ch->practice, fread_number( fp ) ); - KEY( "Prac", ch->practice, fread_number( fp ) ); - KEYS( "Prompt", ch->prompt, fread_string( fp ) ); - KEY( "Prom", ch->prompt, fread_string( fp ) ); - break; - - case 'R': - KEY( "Race", ch->race, - race_lookup(fread_string( fp )) ); - - if ( !str_cmp( word, "Room" ) ) - { - ch->in_room = get_room_index( fread_number( fp ) ); - if ( ch->in_room == NULL ) - ch->in_room = get_room_index( ROOM_VNUM_LIMBO ); - fMatch = TRUE; - break; - } - - break; - - case 'S': - KEY( "SavingThrow", ch->saving_throw, fread_number( fp ) ); - KEY( "Save", ch->saving_throw, fread_number( fp ) ); - KEY( "Scro", ch->lines, fread_number( fp ) ); - KEY( "Sex", ch->sex, fread_number( fp ) ); - KEY( "ShortDescr", ch->short_descr, fread_string( fp ) ); - KEY( "ShD", ch->short_descr, fread_string( fp ) ); - KEY( "Silv", ch->silver, fread_number( fp ) ); - - - if ( !str_cmp( word, "Skill" ) || !str_cmp(word,"Sk")) - { - int sn; - int value; - char *temp; - - value = fread_number( fp ); - temp = fread_word( fp ) ; - sn = skill_lookup(temp); - /* sn = skill_lookup( fread_word( fp ) ); */ - if ( sn < 0 ) - { - fprintf(stderr,"%s",temp); - bug( "Fread_char: unknown skill. ", 0 ); - } - else - ch->pcdata->learned[sn] = value; - fMatch = TRUE; - } - - break; - - case 'T': - KEY( "TrueSex", ch->pcdata->true_sex, fread_number( fp ) ); - KEY( "TSex", ch->pcdata->true_sex, fread_number( fp ) ); - KEY( "Trai", ch->train, fread_number( fp ) ); - KEY( "Trust", ch->trust, fread_number( fp ) ); - KEY( "Tru", ch->trust, fread_number( fp ) ); - - if ( !str_cmp( word, "Title" ) || !str_cmp( word, "Titl")) - { - ch->pcdata->title = fread_string( fp ); - if (ch->pcdata->title[0] != '.' && ch->pcdata->title[0] != ',' - && ch->pcdata->title[0] != '!' && ch->pcdata->title[0] != '?') - { - sprintf( buf, " %s", ch->pcdata->title ); - free_string( ch->pcdata->title ); - ch->pcdata->title = str_dup( buf ); - } - fMatch = TRUE; - break; - } - - break; - - case 'V': - KEY( "Version", ch->version, fread_number ( fp ) ); - KEY( "Vers", ch->version, fread_number ( fp ) ); - if ( !str_cmp( word, "Vnum" ) ) - { - ch->pIndexData = get_mob_index( fread_number( fp ) ); - fMatch = TRUE; - break; - } - break; - - case 'W': - KEY( "Wimpy", ch->wimpy, fread_number( fp ) ); - KEY( "Wimp", ch->wimpy, fread_number( fp ) ); - KEY( "Wizn", ch->wiznet, fread_flag( fp ) ); - break; - } - - if ( !fMatch ) - { - bug( "Fread_char: no match.", 0 ); - fread_to_eol( fp ); - } - } -} - -/* load a pet from the forgotten reaches */ -void fread_pet( CHAR_DATA *ch, FILE *fp ) -{ - char *word; - CHAR_DATA *pet; - bool fMatch; - int lastlogoff = current_time; - int percent; - - /* first entry had BETTER be the vnum or we barf */ - word = feof(fp) ? "END" : fread_word(fp); - if (!str_cmp(word,"Vnum")) - { - int vnum; - - vnum = fread_number(fp); - if (get_mob_index(vnum) == NULL) - { - bug("Fread_pet: bad vnum %d.",vnum); - pet = create_mobile(get_mob_index(MOB_VNUM_FIDO)); - } - else - pet = create_mobile(get_mob_index(vnum)); - } - else - { - bug("Fread_pet: no vnum in file.",0); - pet = create_mobile(get_mob_index(MOB_VNUM_FIDO)); - } - - for ( ; ; ) - { - word = feof(fp) ? "END" : fread_word(fp); - fMatch = FALSE; - - switch (UPPER(word[0])) - { - case '*': - fMatch = TRUE; - fread_to_eol(fp); - break; - - case 'A': - KEY( "Act", pet->act, fread_flag(fp)); - KEY( "AfBy", pet->affected_by, fread_flag(fp)); - KEY( "Alig", pet->alignment, fread_number(fp)); - - if (!str_cmp(word,"ACs")) - { - int i; - - for (i = 0; i < 4; i++) - pet->armor[i] = fread_number(fp); - fMatch = TRUE; - break; - } - - if (!str_cmp(word,"AffD")) - { - AFFECT_DATA *paf; - int sn; - - paf = new_affect(); - - sn = skill_lookup(fread_word(fp)); - if (sn < 0) - bug("Fread_char: unknown skill.",0); - else - paf->type = sn; - - paf->level = fread_number(fp); - paf->duration = fread_number(fp); - paf->modifier = fread_number(fp); - paf->location = fread_number(fp); - paf->bitvector = fread_number(fp); - paf->next = pet->affected; - pet->affected = paf; - fMatch = TRUE; - break; - } - - if (!str_cmp(word,"Affc")) - { - AFFECT_DATA *paf; - int sn; - - paf = new_affect(); - - sn = skill_lookup(fread_word(fp)); - if (sn < 0) - bug("Fread_char: unknown skill.",0); - else - paf->type = sn; - - paf->where = fread_number(fp); - paf->level = fread_number(fp); - paf->duration = fread_number(fp); - paf->modifier = fread_number(fp); - paf->location = fread_number(fp); - paf->bitvector = fread_number(fp); - paf->next = pet->affected; - pet->affected = paf; - fMatch = TRUE; - break; - } - - if (!str_cmp(word,"AMod")) - { - int stat; - - for (stat = 0; stat < MAX_STATS; stat++) - pet->mod_stat[stat] = fread_number(fp); - fMatch = TRUE; - break; - } - - if (!str_cmp(word,"Attr")) - { - int stat; - - for (stat = 0; stat < MAX_STATS; stat++) - pet->perm_stat[stat] = fread_number(fp); - fMatch = TRUE; - break; - } - break; - - case 'C': - KEY( "Clan", pet->clan, clan_lookup(fread_string(fp))); - KEY( "Comm", pet->comm, fread_flag(fp)); - break; - - case 'D': - KEY( "Dam", pet->damroll, fread_number(fp)); - KEY( "Desc", pet->description, fread_string(fp)); - break; - - case 'E': - if (!str_cmp(word,"End")) - { - pet->leader = ch; - pet->master = ch; - ch->pet = pet; - /* adjust hp mana move up -- here for speed's sake */ - percent = (current_time - lastlogoff) * 25 / ( 2 * 60 * 60); - - if (percent > 0 && !IS_AFFECTED(ch,AFF_POISON) - && !IS_AFFECTED(ch,AFF_PLAGUE)) - { - percent = UMIN(percent,100); - pet->hit += (pet->max_hit - pet->hit) * percent / 100; - pet->mana += (pet->max_mana - pet->mana) * percent / 100; - pet->move += (pet->max_move - pet->move)* percent / 100; - } - return; - } - KEY( "Exp", pet->exp, fread_number(fp)); - break; - - case 'G': - KEY( "Gold", pet->gold, fread_number(fp)); - break; - - case 'H': - KEY( "Hit", pet->hitroll, fread_number(fp)); - - if (!str_cmp(word,"HMV")) - { - pet->hit = fread_number(fp); - pet->max_hit = fread_number(fp); - pet->mana = fread_number(fp); - pet->max_mana = fread_number(fp); - pet->move = fread_number(fp); - pet->max_move = fread_number(fp); - fMatch = TRUE; - break; - } - break; - - case 'L': - KEY( "Levl", pet->level, fread_number(fp)); - KEY( "LnD", pet->long_descr, fread_string(fp)); - KEY( "LogO", lastlogoff, fread_number(fp)); - break; - - case 'N': - KEY( "Name", pet->name, fread_string(fp)); - break; - - case 'P': - KEY( "Pos", pet->position, fread_number(fp)); - break; - - case 'R': - KEY( "Race", pet->race, race_lookup(fread_string(fp))); - break; - - case 'S' : - KEY( "Save", pet->saving_throw, fread_number(fp)); - KEY( "Sex", pet->sex, fread_number(fp)); - KEY( "ShD", pet->short_descr, fread_string(fp)); - KEY( "Silv", pet->silver, fread_number( fp ) ); - break; - - if ( !fMatch ) - { - bug("Fread_pet: no match.",0); - fread_to_eol(fp); - } - - } - } -} - - - -void fread_obj( CHAR_DATA *ch, FILE *fp ) -{ - OBJ_DATA *obj; - char *word; - int iNest; - bool fMatch; - bool fNest; - bool fVnum; - bool first; - bool new_format; /* to prevent errors */ - bool make_new; /* update object */ - - fVnum = FALSE; - obj = NULL; - first = TRUE; /* used to counter fp offset */ - new_format = FALSE; - make_new = FALSE; - - word = feof( fp ) ? "End" : fread_word( fp ); - if (!str_cmp(word,"Vnum" )) - { - int vnum; - first = FALSE; /* fp will be in right place */ - - vnum = fread_number( fp ); - if ( get_obj_index( vnum ) == NULL ) - { - bug( "Fread_obj: bad vnum %d.", vnum ); - } - else - { - obj = create_object(get_obj_index(vnum),-1); - new_format = TRUE; - } - - } - - if (obj == NULL) /* either not found or old style */ - { - obj = new_obj(); - obj->name = str_dup( "" ); - obj->short_descr = str_dup( "" ); - obj->description = str_dup( "" ); - } - - fNest = FALSE; - fVnum = TRUE; - iNest = 0; - - for ( ; ; ) - { - if (first) - first = FALSE; - else - word = feof( fp ) ? "End" : fread_word( fp ); - fMatch = FALSE; - - switch ( UPPER(word[0]) ) - { - case '*': - fMatch = TRUE; - fread_to_eol( fp ); - break; - - case 'A': - if (!str_cmp(word,"AffD")) - { - AFFECT_DATA *paf; - int sn; - - paf = new_affect(); - - sn = skill_lookup(fread_word(fp)); - if (sn < 0) - bug("Fread_obj: unknown skill.",0); - else - paf->type = sn; - - paf->level = fread_number( fp ); - paf->duration = fread_number( fp ); - paf->modifier = fread_number( fp ); - paf->location = fread_number( fp ); - paf->bitvector = fread_number( fp ); - paf->next = obj->affected; - obj->affected = paf; - fMatch = TRUE; - break; - } - if (!str_cmp(word,"Affc")) - { - AFFECT_DATA *paf; - int sn; - - paf = new_affect(); - - sn = skill_lookup(fread_word(fp)); - if (sn < 0) - bug("Fread_obj: unknown skill.",0); - else - paf->type = sn; - - paf->where = fread_number( fp ); - paf->level = fread_number( fp ); - paf->duration = fread_number( fp ); - paf->modifier = fread_number( fp ); - paf->location = fread_number( fp ); - paf->bitvector = fread_number( fp ); - paf->next = obj->affected; - obj->affected = paf; - fMatch = TRUE; - break; - } - break; - - case 'C': - KEY( "Cond", obj->condition, fread_number( fp ) ); - KEY( "Cost", obj->cost, fread_number( fp ) ); - break; - - case 'D': - KEY( "Description", obj->description, fread_string( fp ) ); - KEY( "Desc", obj->description, fread_string( fp ) ); - break; - - case 'E': - - if ( !str_cmp( word, "Enchanted")) - { - obj->enchanted = TRUE; - fMatch = TRUE; - break; - } - - KEY( "ExtraFlags", obj->extra_flags, fread_number( fp ) ); - KEY( "ExtF", obj->extra_flags, fread_number( fp ) ); - - if ( !str_cmp( word, "ExtraDescr" ) || !str_cmp(word,"ExDe")) - { - EXTRA_DESCR_DATA *ed; - - ed = new_extra_descr(); - - ed->keyword = fread_string( fp ); - ed->description = fread_string( fp ); - ed->next = obj->extra_descr; - obj->extra_descr = ed; - fMatch = TRUE; - } - - if ( !str_cmp( word, "End" ) ) - { - if ( !fNest || !fVnum || obj->pIndexData == NULL) - { - bug( "Fread_obj: incomplete object.", 0 ); - free_obj(obj); - return; - } - else - { - if (!new_format) - { - obj->next = object_list; - object_list = obj; - obj->pIndexData->count++; - } - - if (!obj->pIndexData->new_format - && obj->item_type == ITEM_ARMOR - && obj->value[1] == 0) - { - obj->value[1] = obj->value[0]; - obj->value[2] = obj->value[0]; - } - if (make_new) - { - int wear; - - wear = obj->wear_loc; - extract_obj(obj); - - obj = create_object(obj->pIndexData,0); - obj->wear_loc = wear; - } - if ( iNest == 0 || rgObjNest[iNest] == NULL ) - obj_to_char( obj, ch ); - else - obj_to_obj( obj, rgObjNest[iNest-1] ); - return; - } - } - break; - - case 'I': - KEY( "ItemType", obj->item_type, fread_number( fp ) ); - KEY( "Ityp", obj->item_type, fread_number( fp ) ); - break; - - case 'L': - KEY( "Level", obj->level, fread_number( fp ) ); - KEY( "Lev", obj->level, fread_number( fp ) ); - break; - - case 'N': - KEY( "Name", obj->name, fread_string( fp ) ); - - if ( !str_cmp( word, "Nest" ) ) - { - iNest = fread_number( fp ); - if ( iNest < 0 || iNest >= MAX_NEST ) - { - bug( "Fread_obj: bad nest %d.", iNest ); - } - else - { - rgObjNest[iNest] = obj; - fNest = TRUE; - } - fMatch = TRUE; - } - break; - - case 'O': - if ( !str_cmp( word,"Oldstyle" ) ) - { - if (obj->pIndexData != NULL && obj->pIndexData->new_format) - make_new = TRUE; - fMatch = TRUE; - } - break; - - - case 'S': - KEY( "ShortDescr", obj->short_descr, fread_string( fp ) ); - KEY( "ShD", obj->short_descr, fread_string( fp ) ); - - if ( !str_cmp( word, "Spell" ) ) - { - int iValue; - int sn; - - iValue = fread_number( fp ); - sn = skill_lookup( fread_word( fp ) ); - if ( iValue < 0 || iValue > 3 ) - { - bug( "Fread_obj: bad iValue %d.", iValue ); - } - else if ( sn < 0 ) - { - bug( "Fread_obj: unknown skill.", 0 ); - } - else - { - obj->value[iValue] = sn; - } - fMatch = TRUE; - break; - } - - break; - - case 'T': - KEY( "Timer", obj->timer, fread_number( fp ) ); - KEY( "Time", obj->timer, fread_number( fp ) ); - break; - - case 'V': - if ( !str_cmp( word, "Values" ) || !str_cmp(word,"Vals")) - { - obj->value[0] = fread_number( fp ); - obj->value[1] = fread_number( fp ); - obj->value[2] = fread_number( fp ); - obj->value[3] = fread_number( fp ); - if (obj->item_type == ITEM_WEAPON && obj->value[0] == 0) - obj->value[0] = obj->pIndexData->value[0]; - fMatch = TRUE; - break; - } - - if ( !str_cmp( word, "Val" ) ) - { - obj->value[0] = fread_number( fp ); - obj->value[1] = fread_number( fp ); - obj->value[2] = fread_number( fp ); - obj->value[3] = fread_number( fp ); - obj->value[4] = fread_number( fp ); - fMatch = TRUE; - break; - } - - if ( !str_cmp( word, "Vnum" ) ) - { - int vnum; - - vnum = fread_number( fp ); - if ( ( obj->pIndexData = get_obj_index( vnum ) ) == NULL ) - bug( "Fread_obj: bad vnum %d.", vnum ); - else - fVnum = TRUE; - fMatch = TRUE; - break; - } - break; - - case 'W': - KEY( "WearFlags", obj->wear_flags, fread_number( fp ) ); - KEY( "WeaF", obj->wear_flags, fread_number( fp ) ); - KEY( "WearLoc", obj->wear_loc, fread_number( fp ) ); - KEY( "Wear", obj->wear_loc, fread_number( fp ) ); - KEY( "Weight", obj->weight, fread_number( fp ) ); - KEY( "Wt", obj->weight, fread_number( fp ) ); - break; - - } - - if ( !fMatch ) - { - bug( "Fread_obj: no match.", 0 ); - fread_to_eol( fp ); - } - } -} diff --git a/archive/src/scan.c b/archive/src/scan.c deleted file mode 100644 index 0ab17a5..0000000 --- a/archive/src/scan.c +++ /dev/null @@ -1,127 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#endif -#include -#include -#include -#include -#include "merc.h" - -char *const distance[4]= -{ -"right here.", "nearby to the %s.", "not far %s.", "off in the distance %s." -}; - -void scan_list args((ROOM_INDEX_DATA *scan_room, CHAR_DATA *ch, - sh_int depth, sh_int door)); -void scan_char args((CHAR_DATA *victim, CHAR_DATA *ch, - sh_int depth, sh_int door)); -void do_scan(CHAR_DATA *ch, char *argument) -{ - extern char *const dir_name[]; - char arg1[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH]; - ROOM_INDEX_DATA *scan_room; - EXIT_DATA *pExit; - sh_int door, depth; - - argument = one_argument(argument, arg1); - - if (arg1[0] == '\0') - { - act("$n looks all around.", ch, NULL, NULL, TO_ROOM); - send_to_char("Looking around you see:\n\r", ch); - scan_list(ch->in_room, ch, 0, -1); - - for (door=0;door<6;door++) - { - if ((pExit = ch ->in_room->exit[door]) != NULL) - scan_list(pExit->u1.to_room, ch, 1, door); - } - return; - } - else if (!str_cmp(arg1, "n") || !str_cmp(arg1, "north")) door = 0; - else if (!str_cmp(arg1, "e") || !str_cmp(arg1, "east")) door = 1; - else if (!str_cmp(arg1, "s") || !str_cmp(arg1, "south")) door = 2; - else if (!str_cmp(arg1, "w") || !str_cmp(arg1, "west")) door = 3; - else if (!str_cmp(arg1, "u") || !str_cmp(arg1, "up" )) door = 4; - else if (!str_cmp(arg1, "d") || !str_cmp(arg1, "down")) door = 5; - else { send_to_char("Which way do you want to scan?\n\r", ch); return; } - - act("You peer intently $T.", ch, NULL, dir_name[door], TO_CHAR); - act("$n peers intently $T.", ch, NULL, dir_name[door], TO_ROOM); - sprintf(buf, "Looking %s you see:\n\r", dir_name[door]); - - scan_room = ch->in_room; - - for (depth = 1; depth < 4; depth++) - { - if ((pExit = scan_room->exit[door]) != NULL) - { - scan_room = pExit->u1.to_room; - scan_list(pExit->u1.to_room, ch, depth, door); - } - } - return; -} - -void scan_list(ROOM_INDEX_DATA *scan_room, CHAR_DATA *ch, sh_int depth, - sh_int door) -{ - CHAR_DATA *rch; - - if (scan_room == NULL) return; - for (rch=scan_room->people; rch != NULL; rch=rch->next_in_room) - { - if (rch == ch) continue; - if (!IS_NPC(rch) && rch->invis_level > get_trust(ch)) continue; - if (can_see(ch, rch)) scan_char(rch, ch, depth, door); - } - return; -} - -void scan_char(CHAR_DATA *victim, CHAR_DATA *ch, sh_int depth, sh_int door) -{ - extern char *const dir_name[]; - extern char *const distance[]; - char buf[MAX_INPUT_LENGTH], buf2[MAX_INPUT_LENGTH]; - - buf[0] = '\0'; - - strcat(buf, PERS(victim, ch)); - strcat(buf, ", "); - sprintf(buf2, distance[depth], dir_name[door]); - strcat(buf, buf2); - strcat(buf, "\n\r"); - - send_to_char(buf, ch); - return; -} diff --git a/archive/src/skills.c b/archive/src/skills.c deleted file mode 100644 index 37fe86a..0000000 --- a/archive/src/skills.c +++ /dev/null @@ -1,1069 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#include -#else -#include -#include -#endif -#include -#include -#include -#include "merc.h" -#include "interp.h" -#include "magic.h" -#include "recycle.h" - -/* used to get new skills */ -void do_gain(CHAR_DATA *ch, char *argument) -{ - char buf[MAX_STRING_LENGTH]; - char arg[MAX_INPUT_LENGTH]; - CHAR_DATA *trainer; - int gn = 0, sn = 0; - - if (IS_NPC(ch)) - return; - - /* find a trainer */ - for ( trainer = ch->in_room->people; - trainer != NULL; - trainer = trainer->next_in_room) - if (IS_NPC(trainer) && IS_SET(trainer->act,ACT_GAIN)) - break; - - if (trainer == NULL || !can_see(ch,trainer)) - { - send_to_char("You can't do that here.\n\r",ch); - return; - } - - one_argument(argument,arg); - - if (arg[0] == '\0') - { - do_function(trainer, &do_say, "Pardon me?"); - return; - } - - if (!str_prefix(arg,"list")) - { - int col; - - col = 0; - - sprintf(buf, "%-18s %-5s %-18s %-5s %-18s %-5s\n\r", - "group","cost","group","cost","group","cost"); - send_to_char(buf,ch); - - for (gn = 0; gn < MAX_GROUP; gn++) - { - if (group_table[gn].name == NULL) - break; - - if (!ch->pcdata->group_known[gn] - && group_table[gn].rating[ch->class] > 0) - { - sprintf(buf,"%-18s %-5d ", - group_table[gn].name,group_table[gn].rating[ch->class]); - send_to_char(buf,ch); - if (++col % 3 == 0) - send_to_char("\n\r",ch); - } - } - if (col % 3 != 0) - send_to_char("\n\r",ch); - - send_to_char("\n\r",ch); - - col = 0; - - sprintf(buf, "%-18s %-5s %-18s %-5s %-18s %-5s\n\r", - "skill","cost","skill","cost","skill","cost"); - send_to_char(buf,ch); - - for (sn = 0; sn < MAX_SKILL; sn++) - { - if (skill_table[sn].name == NULL) - break; - - if (!ch->pcdata->learned[sn] - && skill_table[sn].rating[ch->class] > 0 - && skill_table[sn].spell_fun == spell_null) - { - sprintf(buf,"%-18s %-5d ", - skill_table[sn].name,skill_table[sn].rating[ch->class]); - send_to_char(buf,ch); - if (++col % 3 == 0) - send_to_char("\n\r",ch); - } - } - if (col % 3 != 0) - send_to_char("\n\r",ch); - return; - } - - if (!str_prefix(arg,"convert")) - { - if (ch->practice < 10) - { - act("$N tells you 'You are not yet ready.'", - ch,NULL,trainer,TO_CHAR); - return; - } - - act("$N helps you apply your practice to training", - ch,NULL,trainer,TO_CHAR); - ch->practice -= 10; - ch->train +=1 ; - return; - } - - if (!str_prefix(arg,"points")) - { - if (ch->train < 2) - { - act("$N tells you 'You are not yet ready.'", - ch,NULL,trainer,TO_CHAR); - return; - } - - if (ch->pcdata->points <= 40) - { - act("$N tells you 'There would be no point in that.'", - ch,NULL,trainer,TO_CHAR); - return; - } - - act("$N trains you, and you feel more at ease with your skills.", - ch,NULL,trainer,TO_CHAR); - - ch->train -= 2; - ch->pcdata->points -= 1; - ch->exp = exp_per_level(ch,ch->pcdata->points) * ch->level; - return; - } - - /* else add a group/skill */ - - gn = group_lookup(argument); - if (gn > 0) - { - if (ch->pcdata->group_known[gn]) - { - act("$N tells you 'You already know that group!'", - ch,NULL,trainer,TO_CHAR); - return; - } - - if (group_table[gn].rating[ch->class] <= 0) - { - act("$N tells you 'That group is beyond your powers.'", - ch,NULL,trainer,TO_CHAR); - return; - } - - if (ch->train < group_table[gn].rating[ch->class]) - { - act("$N tells you 'You are not yet ready for that group.'", - ch,NULL,trainer,TO_CHAR); - return; - } - - /* add the group */ - gn_add(ch,gn); - act("$N trains you in the art of $t", - ch,group_table[gn].name,trainer,TO_CHAR); - ch->train -= group_table[gn].rating[ch->class]; - return; - } - - sn = skill_lookup(argument); - if (sn > -1) - { - if (skill_table[sn].spell_fun != spell_null) - { - act("$N tells you 'You must learn the full group.'", - ch,NULL,trainer,TO_CHAR); - return; - } - - - if (ch->pcdata->learned[sn]) - { - act("$N tells you 'You already know that skill!'", - ch,NULL,trainer,TO_CHAR); - return; - } - - if (skill_table[sn].rating[ch->class] <= 0) - { - act("$N tells you 'That skill is beyond your powers.'", - ch,NULL,trainer,TO_CHAR); - return; - } - - if (ch->train < skill_table[sn].rating[ch->class]) - { - act("$N tells you 'You are not yet ready for that skill.'", - ch,NULL,trainer,TO_CHAR); - return; - } - - /* add the skill */ - ch->pcdata->learned[sn] = 1; - act("$N trains you in the art of $t", - ch,skill_table[sn].name,trainer,TO_CHAR); - ch->train -= skill_table[sn].rating[ch->class]; - return; - } - - act("$N tells you 'I do not understand...'",ch,NULL,trainer,TO_CHAR); -} - - - - -/* RT spells and skills show the players spells (or skills) */ - -void do_spells(CHAR_DATA *ch, char *argument) -{ - BUFFER *buffer; - char arg[MAX_INPUT_LENGTH]; - char spell_list[LEVEL_HERO + 1][MAX_STRING_LENGTH]; - char spell_columns[LEVEL_HERO + 1]; - int sn, level, min_lev = 1, max_lev = LEVEL_HERO, mana; - bool fAll = FALSE, found = FALSE; - char buf[MAX_STRING_LENGTH]; - - if (IS_NPC(ch)) - return; - - if (argument[0] != '\0') - { - fAll = TRUE; - - if (str_prefix(argument,"all")) - { - argument = one_argument(argument,arg); - if (!is_number(arg)) - { - send_to_char("Arguments must be numerical or all.\n\r",ch); - return; - } - max_lev = atoi(arg); - - if (max_lev < 1 || max_lev > LEVEL_HERO) - { - sprintf(buf,"Levels must be between 1 and %d.\n\r",LEVEL_HERO); - send_to_char(buf,ch); - return; - } - - if (argument[0] != '\0') - { - argument = one_argument(argument,arg); - if (!is_number(arg)) - { - send_to_char("Arguments must be numerical or all.\n\r",ch); - return; - } - min_lev = max_lev; - max_lev = atoi(arg); - - if (max_lev < 1 || max_lev > LEVEL_HERO) - { - sprintf(buf, - "Levels must be between 1 and %d.\n\r",LEVEL_HERO); - send_to_char(buf,ch); - return; - } - - if (min_lev > max_lev) - { - send_to_char("That would be silly.\n\r",ch); - return; - } - } - } - } - - - /* initialize data */ - for (level = 0; level < LEVEL_HERO + 1; level++) - { - spell_columns[level] = 0; - spell_list[level][0] = '\0'; - } - - for (sn = 0; sn < MAX_SKILL; sn++) - { - if (skill_table[sn].name == NULL ) - break; - - if ((level = skill_table[sn].skill_level[ch->class]) < LEVEL_HERO + 1 - && (fAll || level <= ch->level) - && level >= min_lev && level <= max_lev - && skill_table[sn].spell_fun != spell_null - && ch->pcdata->learned[sn] > 0) - { - found = TRUE; - level = skill_table[sn].skill_level[ch->class]; - if (ch->level < level) - sprintf(buf,"%-18s n/a ", skill_table[sn].name); - else - { - mana = UMAX(skill_table[sn].min_mana, - 100/(2 + ch->level - level)); - sprintf(buf,"%-18s %3d mana ",skill_table[sn].name,mana); - } - - if (spell_list[level][0] == '\0') - sprintf(spell_list[level],"\n\rLevel %2d: %s",level,buf); - else /* append */ - { - if ( ++spell_columns[level] % 2 == 0) - strcat(spell_list[level],"\n\r "); - strcat(spell_list[level],buf); - } - } - } - - /* return results */ - - if (!found) - { - send_to_char("No spells found.\n\r",ch); - return; - } - - buffer = new_buf(); - for (level = 0; level < LEVEL_HERO + 1; level++) - if (spell_list[level][0] != '\0') - add_buf(buffer,spell_list[level]); - add_buf(buffer,"\n\r"); - page_to_char(buf_string(buffer),ch); - free_buf(buffer); -} - -void do_skills(CHAR_DATA *ch, char *argument) -{ - BUFFER *buffer; - char arg[MAX_INPUT_LENGTH]; - char skill_list[LEVEL_HERO + 1][MAX_STRING_LENGTH]; - char skill_columns[LEVEL_HERO + 1]; - int sn, level, min_lev = 1, max_lev = LEVEL_HERO; - bool fAll = FALSE, found = FALSE; - char buf[MAX_STRING_LENGTH]; - - if (IS_NPC(ch)) - return; - - if (argument[0] != '\0') - { - fAll = TRUE; - - if (str_prefix(argument,"all")) - { - argument = one_argument(argument,arg); - if (!is_number(arg)) - { - send_to_char("Arguments must be numerical or all.\n\r",ch); - return; - } - max_lev = atoi(arg); - - if (max_lev < 1 || max_lev > LEVEL_HERO) - { - sprintf(buf,"Levels must be between 1 and %d.\n\r",LEVEL_HERO); - send_to_char(buf,ch); - return; - } - - if (argument[0] != '\0') - { - argument = one_argument(argument,arg); - if (!is_number(arg)) - { - send_to_char("Arguments must be numerical or all.\n\r",ch); - return; - } - min_lev = max_lev; - max_lev = atoi(arg); - - if (max_lev < 1 || max_lev > LEVEL_HERO) - { - sprintf(buf, - "Levels must be between 1 and %d.\n\r",LEVEL_HERO); - send_to_char(buf,ch); - return; - } - - if (min_lev > max_lev) - { - send_to_char("That would be silly.\n\r",ch); - return; - } - } - } - } - - - /* initialize data */ - for (level = 0; level < LEVEL_HERO + 1; level++) - { - skill_columns[level] = 0; - skill_list[level][0] = '\0'; - } - - for (sn = 0; sn < MAX_SKILL; sn++) - { - if (skill_table[sn].name == NULL ) - break; - - if ((level = skill_table[sn].skill_level[ch->class]) < LEVEL_HERO + 1 - && (fAll || level <= ch->level) - && level >= min_lev && level <= max_lev - && skill_table[sn].spell_fun == spell_null - && ch->pcdata->learned[sn] > 0) - { - found = TRUE; - level = skill_table[sn].skill_level[ch->class]; - if (ch->level < level) - sprintf(buf,"%-18s n/a ", skill_table[sn].name); - else - sprintf(buf,"%-18s %3d%% ",skill_table[sn].name, - ch->pcdata->learned[sn]); - - if (skill_list[level][0] == '\0') - sprintf(skill_list[level],"\n\rLevel %2d: %s",level,buf); - else /* append */ - { - if ( ++skill_columns[level] % 2 == 0) - strcat(skill_list[level],"\n\r "); - strcat(skill_list[level],buf); - } - } - } - - /* return results */ - - if (!found) - { - send_to_char("No skills found.\n\r",ch); - return; - } - - buffer = new_buf(); - for (level = 0; level < LEVEL_HERO + 1; level++) - if (skill_list[level][0] != '\0') - add_buf(buffer,skill_list[level]); - add_buf(buffer,"\n\r"); - page_to_char(buf_string(buffer),ch); - free_buf(buffer); -} - -/* shows skills, groups and costs (only if not bought) */ -void list_group_costs(CHAR_DATA *ch) -{ - char buf[100]; - int gn,sn,col; - - if (IS_NPC(ch)) - return; - - col = 0; - - sprintf(buf,"%-18s %-5s %-18s %-5s %-18s %-5s\n\r","group","cp","group","cp","group","cp"); - send_to_char(buf,ch); - - for (gn = 0; gn < MAX_GROUP; gn++) - { - if (group_table[gn].name == NULL) - break; - - if (!ch->gen_data->group_chosen[gn] - && !ch->pcdata->group_known[gn] - && group_table[gn].rating[ch->class] > 0) - { - sprintf(buf,"%-18s %-5d ",group_table[gn].name, - group_table[gn].rating[ch->class]); - send_to_char(buf,ch); - if (++col % 3 == 0) - send_to_char("\n\r",ch); - } - } - if ( col % 3 != 0 ) - send_to_char( "\n\r", ch ); - send_to_char("\n\r",ch); - - col = 0; - - sprintf(buf,"%-18s %-5s %-18s %-5s %-18s %-5s\n\r","skill","cp","skill","cp","skill","cp"); - send_to_char(buf,ch); - - for (sn = 0; sn < MAX_SKILL; sn++) - { - if (skill_table[sn].name == NULL) - break; - - if (!ch->gen_data->skill_chosen[sn] - && ch->pcdata->learned[sn] == 0 - && skill_table[sn].spell_fun == spell_null - && skill_table[sn].rating[ch->class] > 0) - { - sprintf(buf,"%-18s %-5d ",skill_table[sn].name, - skill_table[sn].rating[ch->class]); - send_to_char(buf,ch); - if (++col % 3 == 0) - send_to_char("\n\r",ch); - } - } - if ( col % 3 != 0 ) - send_to_char( "\n\r", ch ); - send_to_char("\n\r",ch); - - sprintf(buf,"Creation points: %d\n\r",ch->pcdata->points); - send_to_char(buf,ch); - sprintf(buf,"Experience per level: %d\n\r", - exp_per_level(ch,ch->gen_data->points_chosen)); - send_to_char(buf,ch); - return; -} - - -void list_group_chosen(CHAR_DATA *ch) -{ - char buf[100]; - int gn,sn,col; - - if (IS_NPC(ch)) - return; - - col = 0; - - sprintf(buf,"%-18s %-5s %-18s %-5s %-18s %-5s","group","cp","group","cp","group","cp\n\r"); - send_to_char(buf,ch); - - for (gn = 0; gn < MAX_GROUP; gn++) - { - if (group_table[gn].name == NULL) - break; - - if (ch->gen_data->group_chosen[gn] - && group_table[gn].rating[ch->class] > 0) - { - sprintf(buf,"%-18s %-5d ",group_table[gn].name, - group_table[gn].rating[ch->class]); - send_to_char(buf,ch); - if (++col % 3 == 0) - send_to_char("\n\r",ch); - } - } - if ( col % 3 != 0 ) - send_to_char( "\n\r", ch ); - send_to_char("\n\r",ch); - - col = 0; - - sprintf(buf,"%-18s %-5s %-18s %-5s %-18s %-5s","skill","cp","skill","cp","skill","cp\n\r"); - send_to_char(buf,ch); - - for (sn = 0; sn < MAX_SKILL; sn++) - { - if (skill_table[sn].name == NULL) - break; - - if (ch->gen_data->skill_chosen[sn] - && skill_table[sn].rating[ch->class] > 0) - { - sprintf(buf,"%-18s %-5d ",skill_table[sn].name, - skill_table[sn].rating[ch->class]); - send_to_char(buf,ch); - if (++col % 3 == 0) - send_to_char("\n\r",ch); - } - } - if ( col % 3 != 0 ) - send_to_char( "\n\r", ch ); - send_to_char("\n\r",ch); - - sprintf(buf,"Creation points: %d\n\r",ch->gen_data->points_chosen); - send_to_char(buf,ch); - sprintf(buf,"Experience per level: %d\n\r", - exp_per_level(ch,ch->gen_data->points_chosen)); - send_to_char(buf,ch); - return; -} - -int exp_per_level(CHAR_DATA *ch, int points) -{ - int expl,inc; - - if (IS_NPC(ch)) - return 1000; - - expl = 1000; - inc = 500; - - if (points < 40) - return 1000 * (pc_race_table[ch->race].class_mult[ch->class] ? - pc_race_table[ch->race].class_mult[ch->class]/100 : 1); - - /* processing */ - points -= 40; - - while (points > 9) - { - expl += inc; - points -= 10; - if (points > 9) - { - expl += inc; - inc *= 2; - points -= 10; - } - } - - expl += points * inc / 10; - - return expl * pc_race_table[ch->race].class_mult[ch->class]/100; -} - -/* this procedure handles the input parsing for the skill generator */ -bool parse_gen_groups(CHAR_DATA *ch,char *argument) -{ - char arg[MAX_INPUT_LENGTH]; - char buf[100]; - int gn,sn,i; - - if (argument[0] == '\0') - return FALSE; - - argument = one_argument(argument,arg); - - if (!str_prefix(arg,"help")) - { - if (argument[0] == '\0') - { - do_function(ch, &do_help, "group help"); - return TRUE; - } - - do_function(ch, &do_help, argument); - return TRUE; - } - - if (!str_prefix(arg,"add")) - { - if (argument[0] == '\0') - { - send_to_char("You must provide a skill name.\n\r",ch); - return TRUE; - } - - gn = group_lookup(argument); - if (gn != -1) - { - if (ch->gen_data->group_chosen[gn] - || ch->pcdata->group_known[gn]) - { - send_to_char("You already know that group!\n\r",ch); - return TRUE; - } - - if (group_table[gn].rating[ch->class] < 1) - { - send_to_char("That group is not available.\n\r",ch); - return TRUE; - } - - /* Close security hole */ - if (ch->gen_data->points_chosen + group_table[gn].rating[ch->class] - > 300) - { - send_to_char( - "You cannot take more than 300 creation points.\n\r", ch); - return TRUE; - } - - sprintf(buf,"%s group added\n\r",group_table[gn].name); - send_to_char(buf,ch); - ch->gen_data->group_chosen[gn] = TRUE; - ch->gen_data->points_chosen += group_table[gn].rating[ch->class]; - gn_add(ch,gn); - ch->pcdata->points += group_table[gn].rating[ch->class]; - return TRUE; - } - - sn = skill_lookup(argument); - if (sn != -1) - { - if (ch->gen_data->skill_chosen[sn] - || ch->pcdata->learned[sn] > 0) - { - send_to_char("You already know that skill!\n\r",ch); - return TRUE; - } - - if (skill_table[sn].rating[ch->class] < 1 - || skill_table[sn].spell_fun != spell_null) - { - send_to_char("That skill is not available.\n\r",ch); - return TRUE; - } - - /* Close security hole */ - if (ch->gen_data->points_chosen + skill_table[sn].rating[ch->class] - > 300) - { - send_to_char( - "You cannot take more than 300 creation points.\n\r", ch); - return TRUE; - } - sprintf(buf, "%s skill added\n\r",skill_table[sn].name); - send_to_char(buf,ch); - ch->gen_data->skill_chosen[sn] = TRUE; - ch->gen_data->points_chosen += skill_table[sn].rating[ch->class]; - ch->pcdata->learned[sn] = 1; - ch->pcdata->points += skill_table[sn].rating[ch->class]; - return TRUE; - } - - send_to_char("No skills or groups by that name...\n\r",ch); - return TRUE; - } - - if (!strcmp(arg,"drop")) - { - if (argument[0] == '\0') - { - send_to_char("You must provide a skill to drop.\n\r",ch); - return TRUE; - } - - gn = group_lookup(argument); - if (gn != -1 && ch->gen_data->group_chosen[gn]) - { - send_to_char("Group dropped.\n\r",ch); - ch->gen_data->group_chosen[gn] = FALSE; - ch->gen_data->points_chosen -= group_table[gn].rating[ch->class]; - gn_remove(ch,gn); - for (i = 0; i < MAX_GROUP; i++) - { - if (ch->gen_data->group_chosen[gn]) - gn_add(ch,gn); - } - ch->pcdata->points -= group_table[gn].rating[ch->class]; - return TRUE; - } - - sn = skill_lookup(argument); - if (sn != -1 && ch->gen_data->skill_chosen[sn]) - { - send_to_char("Skill dropped.\n\r",ch); - ch->gen_data->skill_chosen[sn] = FALSE; - ch->gen_data->points_chosen -= skill_table[sn].rating[ch->class]; - ch->pcdata->learned[sn] = 0; - ch->pcdata->points -= skill_table[sn].rating[ch->class]; - return TRUE; - } - - send_to_char("You haven't bought any such skill or group.\n\r",ch); - return TRUE; - } - - if (!str_prefix(arg,"premise")) - { - do_function(ch, &do_help, "premise"); - return TRUE; - } - - if (!str_prefix(arg,"list")) - { - list_group_costs(ch); - return TRUE; - } - - if (!str_prefix(arg,"learned")) - { - list_group_chosen(ch); - return TRUE; - } - - if (!str_prefix(arg,"info")) - { - do_function(ch, &do_groups, argument); - return TRUE; - } - - return FALSE; -} - - - - - - -/* shows all groups, or the sub-members of a group */ -void do_groups(CHAR_DATA *ch, char *argument) -{ - char buf[100]; - int gn,sn,col; - - if (IS_NPC(ch)) - return; - - col = 0; - - if (argument[0] == '\0') - { /* show all groups */ - - for (gn = 0; gn < MAX_GROUP; gn++) - { - if (group_table[gn].name == NULL) - break; - if (ch->pcdata->group_known[gn]) - { - sprintf(buf,"%-20s ",group_table[gn].name); - send_to_char(buf,ch); - if (++col % 3 == 0) - send_to_char("\n\r",ch); - } - } - if ( col % 3 != 0 ) - send_to_char( "\n\r", ch ); - sprintf(buf,"Creation points: %d\n\r",ch->pcdata->points); - send_to_char(buf,ch); - return; - } - - if (!str_cmp(argument,"all")) /* show all groups */ - { - for (gn = 0; gn < MAX_GROUP; gn++) - { - if (group_table[gn].name == NULL) - break; - sprintf(buf,"%-20s ",group_table[gn].name); - send_to_char(buf,ch); - if (++col % 3 == 0) - send_to_char("\n\r",ch); - } - if ( col % 3 != 0 ) - send_to_char( "\n\r", ch ); - return; - } - - - /* show the sub-members of a group */ - gn = group_lookup(argument); - if (gn == -1) - { - send_to_char("No group of that name exist.\n\r",ch); - send_to_char( - "Type 'groups all' or 'info all' for a full listing.\n\r",ch); - return; - } - - for (sn = 0; sn < MAX_IN_GROUP; sn++) - { - if (group_table[gn].spells[sn] == NULL) - break; - sprintf(buf,"%-20s ",group_table[gn].spells[sn]); - send_to_char(buf,ch); - if (++col % 3 == 0) - send_to_char("\n\r",ch); - } - if ( col % 3 != 0 ) - send_to_char( "\n\r", ch ); -} - -/* checks for skill improvement */ -void check_improve( CHAR_DATA *ch, int sn, bool success, int multiplier ) -{ - int chance; - char buf[100]; - - if (IS_NPC(ch)) - return; - - if (ch->level < skill_table[sn].skill_level[ch->class] - || skill_table[sn].rating[ch->class] == 0 - || ch->pcdata->learned[sn] == 0 - || ch->pcdata->learned[sn] == 100) - return; /* skill is not known */ - - /* check to see if the character has a chance to learn */ - chance = 10 * int_app[get_curr_stat(ch,STAT_INT)].learn; - chance /= ( multiplier - * skill_table[sn].rating[ch->class] - * 4); - chance += ch->level; - - if (number_range(1,1000) > chance) - return; - - /* now that the character has a CHANCE to learn, see if they really have */ - - if (success) - { - chance = URANGE(5,100 - ch->pcdata->learned[sn], 95); - if (number_percent() < chance) - { - sprintf(buf,"You have become better at %s!\n\r", - skill_table[sn].name); - send_to_char(buf,ch); - ch->pcdata->learned[sn]++; - gain_exp(ch,2 * skill_table[sn].rating[ch->class]); - } - } - - else - { - chance = URANGE(5,ch->pcdata->learned[sn]/2,30); - if (number_percent() < chance) - { - sprintf(buf, - "You learn from your mistakes, and your %s skill improves.\n\r", - skill_table[sn].name); - send_to_char(buf,ch); - ch->pcdata->learned[sn] += number_range(1,3); - ch->pcdata->learned[sn] = UMIN(ch->pcdata->learned[sn],100); - gain_exp(ch,2 * skill_table[sn].rating[ch->class]); - } - } -} - -/* returns a group index number given the name */ -int group_lookup( const char *name ) -{ - int gn; - - for ( gn = 0; gn < MAX_GROUP; gn++ ) - { - if ( group_table[gn].name == NULL ) - break; - if ( LOWER(name[0]) == LOWER(group_table[gn].name[0]) - && !str_prefix( name, group_table[gn].name ) ) - return gn; - } - - return -1; -} - -/* recursively adds a group given its number -- uses group_add */ -void gn_add( CHAR_DATA *ch, int gn) -{ - int i; - - ch->pcdata->group_known[gn] = TRUE; - for ( i = 0; i < MAX_IN_GROUP; i++) - { - if (group_table[gn].spells[i] == NULL) - break; - group_add(ch,group_table[gn].spells[i],FALSE); - } -} - -/* recusively removes a group given its number -- uses group_remove */ -void gn_remove( CHAR_DATA *ch, int gn) -{ - int i; - - ch->pcdata->group_known[gn] = FALSE; - - for ( i = 0; i < MAX_IN_GROUP; i ++) - { - if (group_table[gn].spells[i] == NULL) - break; - group_remove(ch,group_table[gn].spells[i]); - } -} - -/* use for processing a skill or group for addition */ -void group_add( CHAR_DATA *ch, const char *name, bool deduct) -{ - int sn,gn; - - if (IS_NPC(ch)) /* NPCs do not have skills */ - return; - - sn = skill_lookup(name); - - if (sn != -1) - { - if (ch->pcdata->learned[sn] == 0) /* i.e. not known */ - { - ch->pcdata->learned[sn] = 1; - if (deduct) - ch->pcdata->points += skill_table[sn].rating[ch->class]; - } - return; - } - - /* now check groups */ - - gn = group_lookup(name); - - if (gn != -1) - { - if (ch->pcdata->group_known[gn] == FALSE) - { - ch->pcdata->group_known[gn] = TRUE; - if (deduct) - ch->pcdata->points += group_table[gn].rating[ch->class]; - } - gn_add(ch,gn); /* make sure all skills in the group are known */ - } -} - -/* used for processing a skill or group for deletion -- no points back! */ - -void group_remove(CHAR_DATA *ch, const char *name) -{ - int sn, gn; - - sn = skill_lookup(name); - - if (sn != -1) - { - ch->pcdata->learned[sn] = 0; - return; - } - - /* now check groups */ - - gn = group_lookup(name); - - if (gn != -1 && ch->pcdata->group_known[gn] == TRUE) - { - ch->pcdata->group_known[gn] = FALSE; - gn_remove(ch,gn); /* be sure to call gn_add on all remaining groups */ - } -} diff --git a/archive/src/special.c b/archive/src/special.c deleted file mode 100644 index c067408..0000000 --- a/archive/src/special.c +++ /dev/null @@ -1,1042 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#include -#else -#include -#endif -#include -#include -#include -#include -#include "merc.h" -#include "interp.h" -#include "magic.h" - -/* - * The following special functions are available for mobiles. - */ -DECLARE_SPEC_FUN( spec_breath_any ); -DECLARE_SPEC_FUN( spec_breath_acid ); -DECLARE_SPEC_FUN( spec_breath_fire ); -DECLARE_SPEC_FUN( spec_breath_frost ); -DECLARE_SPEC_FUN( spec_breath_gas ); -DECLARE_SPEC_FUN( spec_breath_lightning ); -DECLARE_SPEC_FUN( spec_cast_adept ); -DECLARE_SPEC_FUN( spec_cast_cleric ); -DECLARE_SPEC_FUN( spec_cast_judge ); -DECLARE_SPEC_FUN( spec_cast_mage ); -DECLARE_SPEC_FUN( spec_cast_undead ); -DECLARE_SPEC_FUN( spec_executioner ); -DECLARE_SPEC_FUN( spec_fido ); -DECLARE_SPEC_FUN( spec_guard ); -DECLARE_SPEC_FUN( spec_janitor ); -DECLARE_SPEC_FUN( spec_mayor ); -DECLARE_SPEC_FUN( spec_poison ); -DECLARE_SPEC_FUN( spec_thief ); -DECLARE_SPEC_FUN( spec_nasty ); -DECLARE_SPEC_FUN( spec_troll_member ); -DECLARE_SPEC_FUN( spec_ogre_member ); -DECLARE_SPEC_FUN( spec_patrolman ); - -/* the function table */ -const struct spec_type spec_table[] = -{ - { "spec_breath_any", spec_breath_any }, - { "spec_breath_acid", spec_breath_acid }, - { "spec_breath_fire", spec_breath_fire }, - { "spec_breath_frost", spec_breath_frost }, - { "spec_breath_gas", spec_breath_gas }, - { "spec_breath_lightning", spec_breath_lightning }, - { "spec_cast_adept", spec_cast_adept }, - { "spec_cast_cleric", spec_cast_cleric }, - { "spec_cast_judge", spec_cast_judge }, - { "spec_cast_mage", spec_cast_mage }, - { "spec_cast_undead", spec_cast_undead }, - { "spec_executioner", spec_executioner }, - { "spec_fido", spec_fido }, - { "spec_guard", spec_guard }, - { "spec_janitor", spec_janitor }, - { "spec_mayor", spec_mayor }, - { "spec_poison", spec_poison }, - { "spec_thief", spec_thief }, - { "spec_nasty", spec_nasty }, - { "spec_troll_member", spec_troll_member }, - { "spec_ogre_member", spec_ogre_member }, - { "spec_patrolman", spec_patrolman }, - { NULL, NULL } -}; - -/* - * Given a name, return the appropriate spec fun. - */ -SPEC_FUN *spec_lookup( const char *name ) -{ - int i; - - for ( i = 0; spec_table[i].name != NULL; i++) - { - if (LOWER(name[0]) == LOWER(spec_table[i].name[0]) - && !str_prefix( name,spec_table[i].name)) - return spec_table[i].function; - } - - return 0; -} - -char *spec_name( SPEC_FUN *function) -{ - int i; - - for (i = 0; spec_table[i].function != NULL; i++) - { - if (function == spec_table[i].function) - return spec_table[i].name; - } - - return NULL; -} - -bool spec_troll_member( CHAR_DATA *ch) -{ - CHAR_DATA *vch, *victim = NULL; - int count = 0; - char *message; - - if (!IS_AWAKE(ch) || IS_AFFECTED(ch,AFF_CALM) || ch->in_room == NULL - || IS_AFFECTED(ch,AFF_CHARM) || ch->fighting != NULL) - return FALSE; - - /* find an ogre to beat up */ - for (vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room) - { - if (!IS_NPC(vch) || ch == vch) - continue; - - if (vch->pIndexData->vnum == MOB_VNUM_PATROLMAN) - return FALSE; - - if (vch->pIndexData->group == GROUP_VNUM_OGRES - && ch->level > vch->level - 2 && !is_safe(ch,vch)) - { - if (number_range(0,count) == 0) - victim = vch; - - count++; - } - } - - if (victim == NULL) - return FALSE; - - /* say something, then raise hell */ - switch (number_range(0,6)) - { - default: message = NULL; break; - case 0: message = "$n yells 'I've been looking for you, punk!'"; - break; - case 1: message = "With a scream of rage, $n attacks $N."; - break; - case 2: message = - "$n says 'What's slimy Ogre trash like you doing around here?'"; - break; - case 3: message = "$n cracks his knuckles and says 'Do ya feel lucky?'"; - break; - case 4: message = "$n says 'There's no cops to save you this time!'"; - break; - case 5: message = "$n says 'Time to join your brother, spud.'"; - break; - case 6: message = "$n says 'Let's rock.'"; - break; - } - - if (message != NULL) - act(message,ch,NULL,victim,TO_ALL); - multi_hit( ch, victim, TYPE_UNDEFINED ); - return TRUE; -} - -bool spec_ogre_member( CHAR_DATA *ch) -{ - CHAR_DATA *vch, *victim = NULL; - int count = 0; - char *message; - - if (!IS_AWAKE(ch) || IS_AFFECTED(ch,AFF_CALM) || ch->in_room == NULL - || IS_AFFECTED(ch,AFF_CHARM) || ch->fighting != NULL) - return FALSE; - - /* find an troll to beat up */ - for (vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room) - { - if (!IS_NPC(vch) || ch == vch) - continue; - - if (vch->pIndexData->vnum == MOB_VNUM_PATROLMAN) - return FALSE; - - if (vch->pIndexData->group == GROUP_VNUM_TROLLS - && ch->level > vch->level - 2 && !is_safe(ch,vch)) - { - if (number_range(0,count) == 0) - victim = vch; - - count++; - } - } - - if (victim == NULL) - return FALSE; - - /* say something, then raise hell */ - switch (number_range(0,6)) - { - default: message = NULL; break; - case 0: message = "$n yells 'I've been looking for you, punk!'"; - break; - case 1: message = "With a scream of rage, $n attacks $N.'"; - break; - case 2: message = - "$n says 'What's Troll filth like you doing around here?'"; - break; - case 3: message = "$n cracks his knuckles and says 'Do ya feel lucky?'"; - break; - case 4: message = "$n says 'There's no cops to save you this time!'"; - break; - case 5: message = "$n says 'Time to join your brother, spud.'"; - break; - case 6: message = "$n says 'Let's rock.'"; - break; - } - - if (message != NULL) - act(message,ch,NULL,victim,TO_ALL); - multi_hit( ch, victim, TYPE_UNDEFINED ); - return TRUE; -} - -bool spec_patrolman(CHAR_DATA *ch) -{ - CHAR_DATA *vch,*victim = NULL; - OBJ_DATA *obj; - char *message; - int count = 0; - - if (!IS_AWAKE(ch) || IS_AFFECTED(ch,AFF_CALM) || ch->in_room == NULL - || IS_AFFECTED(ch,AFF_CHARM) || ch->fighting != NULL) - return FALSE; - - /* look for a fight in the room */ - for (vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room) - { - if (vch == ch) - continue; - - if (vch->fighting != NULL) /* break it up! */ - { - if (number_range(0,count) == 0) - victim = (vch->level > vch->fighting->level) - ? vch : vch->fighting; - count++; - } - } - - if (victim == NULL || (IS_NPC(victim) && victim->spec_fun == ch->spec_fun)) - return FALSE; - - if (((obj = get_eq_char(ch,WEAR_NECK_1)) != NULL - && obj->pIndexData->vnum == OBJ_VNUM_WHISTLE) - || ((obj = get_eq_char(ch,WEAR_NECK_2)) != NULL - && obj->pIndexData->vnum == OBJ_VNUM_WHISTLE)) - { - act("You blow down hard on $p.",ch,obj,NULL,TO_CHAR); - act("$n blows on $p, ***WHEEEEEEEEEEEET***",ch,obj,NULL,TO_ROOM); - - for ( vch = char_list; vch != NULL; vch = vch->next ) - { - if ( vch->in_room == NULL ) - continue; - - if (vch->in_room != ch->in_room - && vch->in_room->area == ch->in_room->area) - send_to_char( "You hear a shrill whistling sound.\n\r", vch ); - } - } - - switch (number_range(0,6)) - { - default: message = NULL; break; - case 0: message = "$n yells 'All roit! All roit! break it up!'"; - break; - case 1: message = - "$n says 'Society's to blame, but what's a bloke to do?'"; - break; - case 2: message = - "$n mumbles 'bloody kids will be the death of us all.'"; - break; - case 3: message = "$n shouts 'Stop that! Stop that!' and attacks."; - break; - case 4: message = "$n pulls out his billy and goes to work."; - break; - case 5: message = - "$n sighs in resignation and proceeds to break up the fight."; - break; - case 6: message = "$n says 'Settle down, you hooligans!'"; - break; - } - - if (message != NULL) - act(message,ch,NULL,NULL,TO_ALL); - - multi_hit(ch,victim,TYPE_UNDEFINED); - - return TRUE; -} - - -bool spec_nasty( CHAR_DATA *ch ) -{ - CHAR_DATA *victim, *v_next; - long gold; - - if (!IS_AWAKE(ch)) { - return FALSE; - } - - if (ch->position != POS_FIGHTING) { - for ( victim = ch->in_room->people; victim != NULL; victim = v_next) - { - v_next = victim->next_in_room; - if (!IS_NPC(victim) - && (victim->level > ch->level) - && (victim->level < ch->level + 10)) - { - do_function(ch, &do_backstab, victim->name); - if (ch->position != POS_FIGHTING) - { - do_function(ch, &do_murder, victim->name); - } - - /* should steal some coins right away? :) */ - return TRUE; - } - } - return FALSE; /* No one to attack */ - } - - /* okay, we must be fighting.... steal some coins and flee */ - if ( (victim = ch->fighting) == NULL) - return FALSE; /* let's be paranoid.... */ - - switch ( number_bits(2) ) - { - case 0: act( "$n rips apart your coin purse, spilling your gold!", - ch, NULL, victim, TO_VICT); - act( "You slash apart $N's coin purse and gather his gold.", - ch, NULL, victim, TO_CHAR); - act( "$N's coin purse is ripped apart!", - ch, NULL, victim, TO_NOTVICT); - gold = victim->gold / 10; /* steal 10% of his gold */ - victim->gold -= gold; - ch->gold += gold; - return TRUE; - - case 1: do_function(ch, &do_flee, ""); - return TRUE; - - default: return FALSE; - } -} - -/* - * Core procedure for dragons. - */ -bool dragon( CHAR_DATA *ch, char *spell_name ) -{ - CHAR_DATA *victim; - CHAR_DATA *v_next; - int sn; - - if ( ch->position != POS_FIGHTING ) - return FALSE; - - for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) - { - v_next = victim->next_in_room; - if ( victim->fighting == ch && number_bits( 3 ) == 0 ) - break; - } - - if ( victim == NULL ) - return FALSE; - - if ( ( sn = skill_lookup( spell_name ) ) < 0 ) - return FALSE; - (*skill_table[sn].spell_fun) ( sn, ch->level, ch, victim, TARGET_CHAR); - return TRUE; -} - - - -/* - * Special procedures for mobiles. - */ -bool spec_breath_any( CHAR_DATA *ch ) -{ - if ( ch->position != POS_FIGHTING ) - return FALSE; - - switch ( number_bits( 3 ) ) - { - case 0: return spec_breath_fire ( ch ); - case 1: - case 2: return spec_breath_lightning ( ch ); - case 3: return spec_breath_gas ( ch ); - case 4: return spec_breath_acid ( ch ); - case 5: - case 6: - case 7: return spec_breath_frost ( ch ); - } - - return FALSE; -} - - - -bool spec_breath_acid( CHAR_DATA *ch ) -{ - return dragon( ch, "acid breath" ); -} - - - -bool spec_breath_fire( CHAR_DATA *ch ) -{ - return dragon( ch, "fire breath" ); -} - - - -bool spec_breath_frost( CHAR_DATA *ch ) -{ - return dragon( ch, "frost breath" ); -} - - - -bool spec_breath_gas( CHAR_DATA *ch ) -{ - int sn; - - if ( ch->position != POS_FIGHTING ) - return FALSE; - - if ( ( sn = skill_lookup( "gas breath" ) ) < 0 ) - return FALSE; - (*skill_table[sn].spell_fun) ( sn, ch->level, ch, NULL,TARGET_CHAR); - return TRUE; -} - - - -bool spec_breath_lightning( CHAR_DATA *ch ) -{ - return dragon( ch, "lightning breath" ); -} - - - -bool spec_cast_adept( CHAR_DATA *ch ) -{ - CHAR_DATA *victim; - CHAR_DATA *v_next; - - if ( !IS_AWAKE(ch) ) - return FALSE; - - for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) - { - v_next = victim->next_in_room; - if ( victim != ch && can_see( ch, victim ) && number_bits( 1 ) == 0 - && !IS_NPC(victim) && victim->level < 11) - break; - } - - if ( victim == NULL ) - return FALSE; - - switch ( number_bits( 4 ) ) - { - case 0: - act( "$n utters the word 'abrazak'.", ch, NULL, NULL, TO_ROOM ); - spell_armor( skill_lookup( "armor" ), ch->level,ch,victim,TARGET_CHAR); - return TRUE; - - case 1: - act( "$n utters the word 'fido'.", ch, NULL, NULL, TO_ROOM ); - spell_bless( skill_lookup( "bless" ), ch->level,ch,victim,TARGET_CHAR); - return TRUE; - - case 2: - act("$n utters the words 'judicandus noselacri'.",ch,NULL,NULL,TO_ROOM); - spell_cure_blindness( skill_lookup( "cure blindness" ), - ch->level, ch, victim,TARGET_CHAR); - return TRUE; - - case 3: - act("$n utters the words 'judicandus dies'.", ch,NULL, NULL, TO_ROOM ); - spell_cure_light( skill_lookup( "cure light" ), - ch->level, ch, victim,TARGET_CHAR); - return TRUE; - - case 4: - act( "$n utters the words 'judicandus sausabru'.",ch,NULL,NULL,TO_ROOM); - spell_cure_poison( skill_lookup( "cure poison" ), - ch->level, ch, victim,TARGET_CHAR); - return TRUE; - - case 5: - act("$n utters the word 'candusima'.", ch, NULL, NULL, TO_ROOM ); - spell_refresh( skill_lookup("refresh"),ch->level,ch,victim,TARGET_CHAR); - return TRUE; - - case 6: - act("$n utters the words 'judicandus eugzagz'.",ch,NULL,NULL,TO_ROOM); - spell_cure_disease(skill_lookup("cure disease"), - ch->level,ch,victim,TARGET_CHAR); - } - - return FALSE; -} - - - -bool spec_cast_cleric( CHAR_DATA *ch ) -{ - CHAR_DATA *victim; - CHAR_DATA *v_next; - char *spell; - int sn; - - if ( ch->position != POS_FIGHTING ) - return FALSE; - - for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) - { - v_next = victim->next_in_room; - if ( victim->fighting == ch && number_bits( 2 ) == 0 ) - break; - } - - if ( victim == NULL ) - return FALSE; - - for ( ;; ) - { - int min_level; - - switch ( number_bits( 4 ) ) - { - case 0: min_level = 0; spell = "blindness"; break; - case 1: min_level = 3; spell = "cause serious"; break; - case 2: min_level = 7; spell = "earthquake"; break; - case 3: min_level = 9; spell = "cause critical"; break; - case 4: min_level = 10; spell = "dispel evil"; break; - case 5: min_level = 12; spell = "curse"; break; - case 6: min_level = 12; spell = "change sex"; break; - case 7: min_level = 13; spell = "flamestrike"; break; - case 8: - case 9: - case 10: min_level = 15; spell = "harm"; break; - case 11: min_level = 15; spell = "plague"; break; - default: min_level = 16; spell = "dispel magic"; break; - } - - if ( ch->level >= min_level ) - break; - } - - if ( ( sn = skill_lookup( spell ) ) < 0 ) - return FALSE; - (*skill_table[sn].spell_fun) ( sn, ch->level, ch, victim,TARGET_CHAR); - return TRUE; -} - -bool spec_cast_judge( CHAR_DATA *ch ) -{ - CHAR_DATA *victim; - CHAR_DATA *v_next; - char *spell; - int sn; - - if ( ch->position != POS_FIGHTING ) - return FALSE; - - for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) - { - v_next = victim->next_in_room; - if ( victim->fighting == ch && number_bits( 2 ) == 0 ) - break; - } - - if ( victim == NULL ) - return FALSE; - - spell = "high explosive"; - if ( ( sn = skill_lookup( spell ) ) < 0 ) - return FALSE; - (*skill_table[sn].spell_fun) ( sn, ch->level, ch, victim,TARGET_CHAR); - return TRUE; -} - - - -bool spec_cast_mage( CHAR_DATA *ch ) -{ - CHAR_DATA *victim; - CHAR_DATA *v_next; - char *spell; - int sn; - - if ( ch->position != POS_FIGHTING ) - return FALSE; - - for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) - { - v_next = victim->next_in_room; - if ( victim->fighting == ch && number_bits( 2 ) == 0 ) - break; - } - - if ( victim == NULL ) - return FALSE; - - for ( ;; ) - { - int min_level; - - switch ( number_bits( 4 ) ) - { - case 0: min_level = 0; spell = "blindness"; break; - case 1: min_level = 3; spell = "chill touch"; break; - case 2: min_level = 7; spell = "weaken"; break; - case 3: min_level = 8; spell = "teleport"; break; - case 4: min_level = 11; spell = "colour spray"; break; - case 5: min_level = 12; spell = "change sex"; break; - case 6: min_level = 13; spell = "energy drain"; break; - case 7: - case 8: - case 9: min_level = 15; spell = "fireball"; break; - case 10: min_level = 20; spell = "plague"; break; - default: min_level = 20; spell = "acid blast"; break; - } - - if ( ch->level >= min_level ) - break; - } - - if ( ( sn = skill_lookup( spell ) ) < 0 ) - return FALSE; - (*skill_table[sn].spell_fun) ( sn, ch->level, ch, victim,TARGET_CHAR); - return TRUE; -} - - - -bool spec_cast_undead( CHAR_DATA *ch ) -{ - CHAR_DATA *victim; - CHAR_DATA *v_next; - char *spell; - int sn; - - if ( ch->position != POS_FIGHTING ) - return FALSE; - - for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) - { - v_next = victim->next_in_room; - if ( victim->fighting == ch && number_bits( 2 ) == 0 ) - break; - } - - if ( victim == NULL ) - return FALSE; - - for ( ;; ) - { - int min_level; - - switch ( number_bits( 4 ) ) - { - case 0: min_level = 0; spell = "curse"; break; - case 1: min_level = 3; spell = "weaken"; break; - case 2: min_level = 6; spell = "chill touch"; break; - case 3: min_level = 9; spell = "blindness"; break; - case 4: min_level = 12; spell = "poison"; break; - case 5: min_level = 15; spell = "energy drain"; break; - case 6: min_level = 18; spell = "harm"; break; - case 7: min_level = 21; spell = "teleport"; break; - case 8: min_level = 20; spell = "plague"; break; - default: min_level = 18; spell = "harm"; break; - } - - if ( ch->level >= min_level ) - break; - } - - if ( ( sn = skill_lookup( spell ) ) < 0 ) - return FALSE; - (*skill_table[sn].spell_fun) ( sn, ch->level, ch, victim,TARGET_CHAR); - return TRUE; -} - - -bool spec_executioner( CHAR_DATA *ch ) -{ - char buf[MAX_STRING_LENGTH]; - CHAR_DATA *victim; - CHAR_DATA *v_next; - char *crime; - - if ( !IS_AWAKE(ch) || ch->fighting != NULL ) - return FALSE; - - crime = ""; - for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) - { - v_next = victim->next_in_room; - - if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_KILLER) - && can_see(ch,victim)) - { crime = "KILLER"; break; } - - if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_THIEF) - && can_see(ch,victim)) - { crime = "THIEF"; break; } - } - - if ( victim == NULL ) - return FALSE; - - sprintf( buf, "%s is a %s! PROTECT THE INNOCENT! MORE BLOOOOD!!!", - victim->name, crime ); - REMOVE_BIT(ch->comm,COMM_NOSHOUT); - do_function(ch, &do_yell, buf ); - multi_hit( ch, victim, TYPE_UNDEFINED ); - return TRUE; -} - - - -bool spec_fido( CHAR_DATA *ch ) -{ - OBJ_DATA *corpse; - OBJ_DATA *c_next; - OBJ_DATA *obj; - OBJ_DATA *obj_next; - - if ( !IS_AWAKE(ch) ) - return FALSE; - - for ( corpse = ch->in_room->contents; corpse != NULL; corpse = c_next ) - { - c_next = corpse->next_content; - if ( corpse->item_type != ITEM_CORPSE_NPC ) - continue; - - act( "$n savagely devours a corpse.", ch, NULL, NULL, TO_ROOM ); - for ( obj = corpse->contains; obj; obj = obj_next ) - { - obj_next = obj->next_content; - obj_from_obj( obj ); - obj_to_room( obj, ch->in_room ); - } - extract_obj( corpse ); - return TRUE; - } - - return FALSE; -} - - - -bool spec_guard( CHAR_DATA *ch ) -{ - char buf[MAX_STRING_LENGTH]; - CHAR_DATA *victim; - CHAR_DATA *v_next; - CHAR_DATA *ech; - char *crime; - int max_evil; - - if ( !IS_AWAKE(ch) || ch->fighting != NULL ) - return FALSE; - - max_evil = 300; - ech = NULL; - crime = ""; - - for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) - { - v_next = victim->next_in_room; - - if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_KILLER) - && can_see(ch,victim)) - { crime = "KILLER"; break; } - - if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_THIEF) - && can_see(ch,victim)) - { crime = "THIEF"; break; } - - if ( victim->fighting != NULL - && victim->fighting != ch - && victim->alignment < max_evil ) - { - max_evil = victim->alignment; - ech = victim; - } - } - - if ( victim != NULL ) - { - sprintf( buf, "%s is a %s! PROTECT THE INNOCENT!! BANZAI!!", - victim->name, crime ); - REMOVE_BIT(ch->comm,COMM_NOSHOUT); - do_function(ch, &do_yell, buf ); - multi_hit( ch, victim, TYPE_UNDEFINED ); - return TRUE; - } - - if ( ech != NULL ) - { - act( "$n screams 'PROTECT THE INNOCENT!! BANZAI!!", - ch, NULL, NULL, TO_ROOM ); - multi_hit( ch, ech, TYPE_UNDEFINED ); - return TRUE; - } - - return FALSE; -} - - - -bool spec_janitor( CHAR_DATA *ch ) -{ - OBJ_DATA *trash; - OBJ_DATA *trash_next; - - if ( !IS_AWAKE(ch) ) - return FALSE; - - for ( trash = ch->in_room->contents; trash != NULL; trash = trash_next ) - { - trash_next = trash->next_content; - if ( !IS_SET( trash->wear_flags, ITEM_TAKE ) || !can_loot(ch,trash)) - continue; - if ( trash->item_type == ITEM_DRINK_CON - || trash->item_type == ITEM_TRASH - || trash->cost < 10 ) - { - act( "$n picks up some trash.", ch, NULL, NULL, TO_ROOM ); - obj_from_room( trash ); - obj_to_char( trash, ch ); - return TRUE; - } - } - - return FALSE; -} - - - -bool spec_mayor( CHAR_DATA *ch ) -{ - static const char open_path[] = - "W3a3003b33000c111d0d111Oe333333Oe22c222112212111a1S."; - - static const char close_path[] = - "W3a3003b33000c111d0d111CE333333CE22c222112212111a1S."; - - static const char *path; - static int pos; - static bool move; - - if ( !move ) - { - if ( time_info.hour == 6 ) - { - path = open_path; - move = TRUE; - pos = 0; - } - - if ( time_info.hour == 20 ) - { - path = close_path; - move = TRUE; - pos = 0; - } - } - - if ( ch->fighting != NULL ) - return spec_cast_mage( ch ); - if ( !move || ch->position < POS_SLEEPING ) - return FALSE; - - switch ( path[pos] ) - { - case '0': - case '1': - case '2': - case '3': - move_char( ch, path[pos] - '0', FALSE ); - break; - - case 'W': - ch->position = POS_STANDING; - act( "$n awakens and groans loudly.", ch, NULL, NULL, TO_ROOM ); - break; - - case 'S': - ch->position = POS_SLEEPING; - act( "$n lies down and falls asleep.", ch, NULL, NULL, TO_ROOM ); - break; - - case 'a': - act( "$n says 'Hello Honey!'", ch, NULL, NULL, TO_ROOM ); - break; - - case 'b': - act( "$n says 'What a view! I must do something about that dump!'", - ch, NULL, NULL, TO_ROOM ); - break; - - case 'c': - act( "$n says 'Vandals! Youngsters have no respect for anything!'", - ch, NULL, NULL, TO_ROOM ); - break; - - case 'd': - act( "$n says 'Good day, citizens!'", ch, NULL, NULL, TO_ROOM ); - break; - - case 'e': - act( "$n says 'I hereby declare the city of Midgaard open!'", - ch, NULL, NULL, TO_ROOM ); - break; - - case 'E': - act( "$n says 'I hereby declare the city of Midgaard closed!'", - ch, NULL, NULL, TO_ROOM ); - break; - - case 'O': -/* do_function(ch, &do_unlock, "gate" ); */ - do_function(ch, &do_open, "gate" ); - break; - - case 'C': - do_function(ch, &do_close, "gate" ); -/* do_function(ch, &do_lock, "gate" ); */ - break; - - case '.' : - move = FALSE; - break; - } - - pos++; - return FALSE; -} - - - -bool spec_poison( CHAR_DATA *ch ) -{ - CHAR_DATA *victim; - - if ( ch->position != POS_FIGHTING - || ( victim = ch->fighting ) == NULL - || number_percent( ) > 2 * ch->level ) - return FALSE; - - act( "You bite $N!", ch, NULL, victim, TO_CHAR ); - act( "$n bites $N!", ch, NULL, victim, TO_NOTVICT ); - act( "$n bites you!", ch, NULL, victim, TO_VICT ); - spell_poison( gsn_poison, ch->level, ch, victim,TARGET_CHAR); - return TRUE; -} - - - -bool spec_thief( CHAR_DATA *ch ) -{ - CHAR_DATA *victim; - CHAR_DATA *v_next; - long gold,silver; - - if ( ch->position != POS_STANDING ) - return FALSE; - - for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) - { - v_next = victim->next_in_room; - - if ( IS_NPC(victim) - || victim->level >= LEVEL_IMMORTAL - || number_bits( 5 ) != 0 - || !can_see(ch,victim)) - continue; - - if ( IS_AWAKE(victim) && number_range( 0, ch->level ) == 0 ) - { - act( "You discover $n's hands in your wallet!", - ch, NULL, victim, TO_VICT ); - act( "$N discovers $n's hands in $S wallet!", - ch, NULL, victim, TO_NOTVICT ); - return TRUE; - } - else - { - gold = victim->gold * UMIN(number_range(1,20),ch->level / 2) / 100; - gold = UMIN(gold, ch->level * ch->level * 10 ); - ch->gold += gold; - victim->gold -= gold; - silver = victim->silver * UMIN(number_range(1,20),ch->level/2)/100; - silver = UMIN(silver,ch->level*ch->level * 25); - ch->silver += silver; - victim->silver -= silver; - return TRUE; - } - } - - return FALSE; -} - diff --git a/archive/src/tables.c b/archive/src/tables.c deleted file mode 100644 index aa2f326..0000000 --- a/archive/src/tables.c +++ /dev/null @@ -1,322 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#endif -#include -#include -#include "merc.h" -#include "tables.h" - -/* for clans */ -const struct clan_type clan_table[MAX_CLAN] = -{ - /* name, who entry, death-transfer room, independent */ - /* independent should be FALSE if is a real clan */ - { "", "", ROOM_VNUM_ALTAR, TRUE }, - { "loner", "[ Loner ] ", ROOM_VNUM_ALTAR, TRUE }, - { "rom", "[ ROM ] ", ROOM_VNUM_ALTAR, FALSE } -}; - -/* for position */ -const struct position_type position_table[] = -{ - { "dead", "dead" }, - { "mortally wounded", "mort" }, - { "incapacitated", "incap" }, - { "stunned", "stun" }, - { "sleeping", "sleep" }, - { "resting", "rest" }, - { "sitting", "sit" }, - { "fighting", "fight" }, - { "standing", "stand" }, - { NULL, NULL } -}; - -/* for sex */ -const struct sex_type sex_table[] = -{ - { "none" }, - { "male" }, - { "female" }, - { "either" }, - { NULL } -}; - -/* for sizes */ -const struct size_type size_table[] = -{ - { "tiny" }, - { "small" }, - { "medium" }, - { "large" }, - { "huge", }, - { "giant" }, - { NULL } -}; - -/* various flag tables */ -const struct flag_type act_flags[] = -{ - { "npc", A, FALSE }, - { "sentinel", B, TRUE }, - { "scavenger", C, TRUE }, - { "aggressive", F, TRUE }, - { "stay_area", G, TRUE }, - { "wimpy", H, TRUE }, - { "pet", I, TRUE }, - { "train", J, TRUE }, - { "practice", K, TRUE }, - { "undead", O, TRUE }, - { "cleric", Q, TRUE }, - { "mage", R, TRUE }, - { "thief", S, TRUE }, - { "warrior", T, TRUE }, - { "noalign", U, TRUE }, - { "nopurge", V, TRUE }, - { "outdoors", W, TRUE }, - { "indoors", Y, TRUE }, - { "healer", aa, TRUE }, - { "gain", bb, TRUE }, - { "update_always", cc, TRUE }, - { "changer", dd, TRUE }, - { NULL, 0, FALSE } -}; - -const struct flag_type plr_flags[] = -{ - { "npc", A, FALSE }, - { "autoassist", C, FALSE }, - { "autoexit", D, FALSE }, - { "autoloot", E, FALSE }, - { "autosac", F, FALSE }, - { "autogold", G, FALSE }, - { "autosplit", H, FALSE }, - { "holylight", N, FALSE }, - { "can_loot", P, FALSE }, - { "nosummon", Q, FALSE }, - { "nofollow", R, FALSE }, - { "permit", U, TRUE }, - { "log", W, FALSE }, - { "deny", X, FALSE }, - { "freeze", Y, FALSE }, - { "thief", Z, FALSE }, - { "killer", aa, FALSE }, - { NULL, 0, 0 } -}; - -const struct flag_type affect_flags[] = -{ - { "blind", A, TRUE }, - { "invisible", B, TRUE }, - { "detect_evil", C, TRUE }, - { "detect_invis", D, TRUE }, - { "detect_magic", E, TRUE }, - { "detect_hidden", F, TRUE }, - { "detect_good", G, TRUE }, - { "sanctuary", H, TRUE }, - { "faerie_fire", I, TRUE }, - { "infrared", J, TRUE }, - { "curse", K, TRUE }, - { "poison", M, TRUE }, - { "protect_evil", N, TRUE }, - { "protect_good", O, TRUE }, - { "sneak", P, TRUE }, - { "hide", Q, TRUE }, - { "sleep", R, TRUE }, - { "charm", S, TRUE }, - { "flying", T, TRUE }, - { "pass_door", U, TRUE }, - { "haste", V, TRUE }, - { "calm", W, TRUE }, - { "plague", X, TRUE }, - { "weaken", Y, TRUE }, - { "dark_vision", Z, TRUE }, - { "berserk", aa, TRUE }, - { "swim", bb, TRUE }, - { "regeneration", cc, TRUE }, - { "slow", dd, TRUE }, - { NULL, 0, 0 } -}; - -const struct flag_type off_flags[] = -{ - { "area_attack", A, TRUE }, - { "backstab", B, TRUE }, - { "bash", C, TRUE }, - { "berserk", D, TRUE }, - { "disarm", E, TRUE }, - { "dodge", F, TRUE }, - { "fade", G, TRUE }, - { "fast", H, TRUE }, - { "kick", I, TRUE }, - { "dirt_kick", J, TRUE }, - { "parry", K, TRUE }, - { "rescue", L, TRUE }, - { "tail", M, TRUE }, - { "trip", N, TRUE }, - { "crush", O, TRUE }, - { "assist_all", P, TRUE }, - { "assist_align", Q, TRUE }, - { "assist_race", R, TRUE }, - { "assist_players", S, TRUE }, - { "assist_guard", T, TRUE }, - { "assist_vnum", U, TRUE }, - { NULL, 0, 0 } -}; - -const struct flag_type imm_flags[] = -{ - { "summon", A, TRUE }, - { "charm", B, TRUE }, - { "magic", C, TRUE }, - { "weapon", D, TRUE }, - { "bash", E, TRUE }, - { "pierce", F, TRUE }, - { "slash", G, TRUE }, - { "fire", H, TRUE }, - { "cold", I, TRUE }, - { "lightning", J, TRUE }, - { "acid", K, TRUE }, - { "poison", L, TRUE }, - { "negative", M, TRUE }, - { "holy", N, TRUE }, - { "energy", O, TRUE }, - { "mental", P, TRUE }, - { "disease", Q, TRUE }, - { "drowning", R, TRUE }, - { "light", S, TRUE }, - { "sound", T, TRUE }, - { "wood", X, TRUE }, - { "silver", Y, TRUE }, - { "iron", Z, TRUE }, - { NULL, 0, 0 } -}; - -const struct flag_type form_flags[] = -{ - { "edible", FORM_EDIBLE, TRUE }, - { "poison", FORM_POISON, TRUE }, - { "magical", FORM_MAGICAL, TRUE }, - { "instant_decay", FORM_INSTANT_DECAY, TRUE }, - { "other", FORM_OTHER, TRUE }, - { "animal", FORM_ANIMAL, TRUE }, - { "sentient", FORM_SENTIENT, TRUE }, - { "undead", FORM_UNDEAD, TRUE }, - { "construct", FORM_CONSTRUCT, TRUE }, - { "mist", FORM_MIST, TRUE }, - { "intangible", FORM_INTANGIBLE, TRUE }, - { "biped", FORM_BIPED, TRUE }, - { "centaur", FORM_CENTAUR, TRUE }, - { "insect", FORM_INSECT, TRUE }, - { "spider", FORM_SPIDER, TRUE }, - { "crustacean", FORM_CRUSTACEAN, TRUE }, - { "worm", FORM_WORM, TRUE }, - { "blob", FORM_BLOB, TRUE }, - { "mammal", FORM_MAMMAL, TRUE }, - { "bird", FORM_BIRD, TRUE }, - { "reptile", FORM_REPTILE, TRUE }, - { "snake", FORM_SNAKE, TRUE }, - { "dragon", FORM_DRAGON, TRUE }, - { "amphibian", FORM_AMPHIBIAN, TRUE }, - { "fish", FORM_FISH , TRUE }, - { "cold_blood", FORM_COLD_BLOOD, TRUE }, - { NULL, 0, 0 } -}; - -const struct flag_type part_flags[] = -{ - { "head", PART_HEAD, TRUE }, - { "arms", PART_ARMS, TRUE }, - { "legs", PART_LEGS, TRUE }, - { "heart", PART_HEART, TRUE }, - { "brains", PART_BRAINS, TRUE }, - { "guts", PART_GUTS, TRUE }, - { "hands", PART_HANDS, TRUE }, - { "feet", PART_FEET, TRUE }, - { "fingers", PART_FINGERS, TRUE }, - { "ear", PART_EAR, TRUE }, - { "eye", PART_EYE, TRUE }, - { "long_tongue", PART_LONG_TONGUE, TRUE }, - { "eyestalks", PART_EYESTALKS, TRUE }, - { "tentacles", PART_TENTACLES, TRUE }, - { "fins", PART_FINS, TRUE }, - { "wings", PART_WINGS, TRUE }, - { "tail", PART_TAIL, TRUE }, - { "claws", PART_CLAWS, TRUE }, - { "fangs", PART_FANGS, TRUE }, - { "horns", PART_HORNS, TRUE }, - { "scales", PART_SCALES, TRUE }, - { "tusks", PART_TUSKS, TRUE }, - { NULL, 0, 0 } -}; - -const struct flag_type comm_flags[] = -{ - { "quiet", COMM_QUIET, TRUE }, - { "deaf", COMM_DEAF, TRUE }, - { "nowiz", COMM_NOWIZ, TRUE }, - { "noclangossip", COMM_NOAUCTION, TRUE }, - { "nogossip", COMM_NOGOSSIP, TRUE }, - { "noquestion", COMM_NOQUESTION, TRUE }, - { "nomusic", COMM_NOMUSIC, TRUE }, - { "noclan", COMM_NOCLAN, TRUE }, - { "noquote", COMM_NOQUOTE, TRUE }, - { "shoutsoff", COMM_SHOUTSOFF, TRUE }, - { "compact", COMM_COMPACT, TRUE }, - { "brief", COMM_BRIEF, TRUE }, - { "prompt", COMM_PROMPT, TRUE }, - { "combine", COMM_COMBINE, TRUE }, - { "telnet_ga", COMM_TELNET_GA, TRUE }, - { "show_affects", COMM_SHOW_AFFECTS, TRUE }, - { "nograts", COMM_NOGRATS, TRUE }, - { "noemote", COMM_NOEMOTE, FALSE }, - { "noshout", COMM_NOSHOUT, FALSE }, - { "notell", COMM_NOTELL, FALSE }, - { "nochannels", COMM_NOCHANNELS, FALSE }, - { "snoop_proof", COMM_SNOOP_PROOF, FALSE }, - { "afk", COMM_AFK, TRUE }, - { NULL, 0, 0 } -}; - - - - - - - - - - - - - - - diff --git a/archive/src/tables.h b/archive/src/tables.h deleted file mode 100644 index acddf6c..0000000 --- a/archive/src/tables.h +++ /dev/null @@ -1,81 +0,0 @@ -/*************************************************************************** - * 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-1998 Russ Taylor * -* ROM has been brought to you by the ROM consortium * -* Russ Taylor (rtaylor@efn.org) * -* Russ Taylor (rtaylor@hypercube.org) * -* Gabrielle Taylor (gtaylor@hypercube.org) * -* By using this code, you have agreed to follow the terms of the * -* ROM license, in the file Rom24/doc/rom.license * -***************************************************************************/ - -struct flag_type -{ - char *name; - int bit; - bool settable; -}; - -struct clan_type -{ - char *name; - char *who_name; - sh_int hall; - bool independent; /* true for loners */ -}; - -struct position_type -{ - char *name; - char *short_name; -}; - -struct sex_type -{ - char *name; -}; - -struct size_type -{ - char *name; -}; - -/* game tables */ -extern const struct clan_type clan_table[MAX_CLAN]; -extern const struct position_type position_table[]; -extern const struct sex_type sex_table[]; -extern const struct size_type size_table[]; - -/* flag tables */ -extern const struct flag_type act_flags[]; -extern const struct flag_type plr_flags[]; -extern const struct flag_type affect_flags[]; -extern const struct flag_type off_flags[]; -extern const struct flag_type imm_flags[]; -extern const struct flag_type form_flags[]; -extern const struct flag_type part_flags[]; -extern const struct flag_type comm_flags[]; -extern const struct flag_type extra_flags[]; -extern const struct flag_type wear_flags[]; -extern const struct flag_type weapon_flags[]; -extern const struct flag_type container_flags[]; -extern const struct flag_type portal_flags[]; -extern const struct flag_type room_flags[]; -extern const struct flag_type exit_flags[]; - diff --git a/archive/src/telnet.h b/archive/src/telnet.h deleted file mode 100644 index 94a7330..0000000 --- a/archive/src/telnet.h +++ /dev/null @@ -1,87 +0,0 @@ -/* @(#)telnet.h 1.7 88/08/19 SMI; from UCB 5.1 5/30/85 */ -/* - * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -/* - * Definitions for the TELNET protocol. - */ - -#ifndef _arpa_telnet_h -#define _arpa_telnet_h - -#define IAC 255 /* interpret as command: */ -#define DONT 254 /* you are not to use option */ -#define DO 253 /* please, you use option */ -#define WONT 252 /* I won't use option */ -#define WILL 251 /* I will use option */ -#define SB 250 /* interpret as subnegotiation */ -#define GA 249 /* you may reverse the line */ -#define EL 248 /* erase the current line */ -#define EC 247 /* erase the current character */ -#define AYT 246 /* are you there */ -#define AO 245 /* abort output--but let prog finish */ -#define IP 244 /* interrupt process--permanently */ -#define BREAK 243 /* break */ -#define DM 242 /* data mark--for connect. cleaning */ -#define NOP 241 /* nop */ -#define SE 240 /* end sub negotiation */ -#define EOR 239 /* end of record (transparent mode) */ - -#define SYNCH 242 /* for telfunc calls */ - -#ifdef TELCMDS -char *telcmds[] = { - "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", - "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", -}; -#endif - -/* telnet options */ -#define TELOPT_BINARY 0 /* 8-bit data path */ -#define TELOPT_ECHO 1 /* echo */ -#define TELOPT_RCP 2 /* prepare to reconnect */ -#define TELOPT_SGA 3 /* suppress go ahead */ -#define TELOPT_NAMS 4 /* approximate message size */ -#define TELOPT_STATUS 5 /* give status */ -#define TELOPT_TM 6 /* timing mark */ -#define TELOPT_RCTE 7 /* remote controlled transmission and echo */ -#define TELOPT_NAOL 8 /* negotiate about output line width */ -#define TELOPT_NAOP 9 /* negotiate about output page size */ -#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */ -#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */ -#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */ -#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */ -#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */ -#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */ -#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */ -#define TELOPT_XASCII 17 /* extended ascic character set */ -#define TELOPT_LOGOUT 18 /* force logout */ -#define TELOPT_BM 19 /* byte macro */ -#define TELOPT_DET 20 /* data entry terminal */ -#define TELOPT_SUPDUP 21 /* supdup protocol */ -#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */ -#define TELOPT_SNDLOC 23 /* send location */ -#define TELOPT_TTYPE 24 /* terminal type */ -#define TELOPT_EOR 25 /* end or record */ -#define TELOPT_EXOPL 255 /* extended-options-list */ - -#ifdef TELOPTS -#define NTELOPTS (1+TELOPT_EOR) -char *telopts[NTELOPTS] = { - "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", - "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP", - "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", - "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", - "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT", - "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", -}; -#endif - -/* sub-option qualifiers */ -#define TELQUAL_IS 0 /* option is... */ -#define TELQUAL_SEND 1 /* send option */ - -#endif /*!_arpa_telnet_h*/ diff --git a/archive/src/update.c b/archive/src/update.c deleted file mode 100644 index c17d348..0000000 --- a/archive/src/update.c +++ /dev/null @@ -1,1127 +0,0 @@ -/*************************************************************************** - * 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-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 * -***************************************************************************/ - -#if defined(macintosh) -#include -#else -#include -#endif -#include -#include -#include -#include "merc.h" -#include "interp.h" -#include "music.h" - -/* - * Local functions. - */ -int hit_gain args( ( CHAR_DATA *ch ) ); -int mana_gain args( ( CHAR_DATA *ch ) ); -int move_gain args( ( CHAR_DATA *ch ) ); -void mobile_update args( ( void ) ); -void weather_update args( ( void ) ); -void char_update args( ( void ) ); -void obj_update args( ( void ) ); -void aggr_update args( ( void ) ); - -/* used for saving */ - -int save_number = 0; - - - -/* - * Advancement stuff. - */ -void advance_level( CHAR_DATA *ch, bool hide ) -{ - char buf[MAX_STRING_LENGTH]; - int add_hp; - int add_mana; - int add_move; - int add_prac; - - ch->pcdata->last_level = - ( ch->played + (int) (current_time - ch->logon) ) / 3600; - - sprintf( buf, "the %s", - title_table [ch->class] [ch->level] [ch->sex == SEX_FEMALE ? 1 : 0] ); - set_title( ch, buf ); - - add_hp = con_app[get_curr_stat(ch,STAT_CON)].hitp + number_range( - class_table[ch->class].hp_min, - class_table[ch->class].hp_max ); - add_mana = number_range(2,(2*get_curr_stat(ch,STAT_INT) - + get_curr_stat(ch,STAT_WIS))/5); - if (!class_table[ch->class].fMana) - add_mana /= 2; - add_move = number_range( 1, (get_curr_stat(ch,STAT_CON) - + get_curr_stat(ch,STAT_DEX))/6 ); - add_prac = wis_app[get_curr_stat(ch,STAT_WIS)].practice; - - add_hp = add_hp * 9/10; - add_mana = add_mana * 9/10; - add_move = add_move * 9/10; - - add_hp = UMAX( 2, add_hp ); - add_mana = UMAX( 2, add_mana ); - add_move = UMAX( 6, add_move ); - - ch->max_hit += add_hp; - ch->max_mana += add_mana; - ch->max_move += add_move; - ch->practice += add_prac; - ch->train += 1; - - ch->pcdata->perm_hit += add_hp; - ch->pcdata->perm_mana += add_mana; - ch->pcdata->perm_move += add_move; - - if (!hide) - { - sprintf(buf, - "You gain %d hit point%s, %d mana, %d move, and %d practice%s.\n\r", - add_hp, add_hp == 1 ? "" : "s", add_mana, add_move, - add_prac, add_prac == 1 ? "" : "s"); - send_to_char( buf, ch ); - } - return; -} - - - -void gain_exp( CHAR_DATA *ch, int gain ) -{ - char buf[MAX_STRING_LENGTH]; - - if ( IS_NPC(ch) || ch->level >= LEVEL_HERO ) - return; - - ch->exp = UMAX( exp_per_level(ch,ch->pcdata->points), ch->exp + gain ); - while ( ch->level < LEVEL_HERO && ch->exp >= - exp_per_level(ch,ch->pcdata->points) * (ch->level+1) ) - { - send_to_char( "You raise a level!! ", ch ); - ch->level += 1; - sprintf(buf,"%s gained level %d",ch->name,ch->level); - log_string(buf); - sprintf(buf,"$N has attained level %d!",ch->level); - wiznet(buf,ch,NULL,WIZ_LEVELS,0,0); - advance_level(ch,FALSE); - save_char_obj(ch); - } - - return; -} - - - -/* - * Regeneration stuff. - */ -int hit_gain( CHAR_DATA *ch ) -{ - int gain; - int number; - - if (ch->in_room == NULL) - return 0; - - if ( IS_NPC(ch) ) - { - gain = 5 + ch->level; - if (IS_AFFECTED(ch,AFF_REGENERATION)) - gain *= 2; - - switch(ch->position) - { - default : gain /= 2; break; - case POS_SLEEPING: gain = 3 * gain/2; break; - case POS_RESTING: break; - case POS_FIGHTING: gain /= 3; break; - } - - - } - else - { - gain = UMAX(3,get_curr_stat(ch,STAT_CON) - 3 + ch->level/2); - gain += class_table[ch->class].hp_max - 10; - number = number_percent(); - if (number < get_skill(ch,gsn_fast_healing)) - { - gain += number * gain / 100; - if (ch->hit < ch->max_hit) - check_improve(ch,gsn_fast_healing,TRUE,8); - } - - switch ( ch->position ) - { - default: gain /= 4; break; - case POS_SLEEPING: break; - case POS_RESTING: gain /= 2; break; - case POS_FIGHTING: gain /= 6; break; - } - - if ( ch->pcdata->condition[COND_HUNGER] == 0 ) - gain /= 2; - - if ( ch->pcdata->condition[COND_THIRST] == 0 ) - gain /= 2; - - } - - gain = gain * ch->in_room->heal_rate / 100; - - if (ch->on != NULL && ch->on->item_type == ITEM_FURNITURE) - gain = gain * ch->on->value[3] / 100; - - if ( IS_AFFECTED(ch, AFF_POISON) ) - gain /= 4; - - if (IS_AFFECTED(ch, AFF_PLAGUE)) - gain /= 8; - - if (IS_AFFECTED(ch,AFF_HASTE) || IS_AFFECTED(ch,AFF_SLOW)) - gain /=2 ; - - return UMIN(gain, ch->max_hit - ch->hit); -} - - - -int mana_gain( CHAR_DATA *ch ) -{ - int gain; - int number; - - if (ch->in_room == NULL) - return 0; - - if ( IS_NPC(ch) ) - { - gain = 5 + ch->level; - switch (ch->position) - { - default: gain /= 2; break; - case POS_SLEEPING: gain = 3 * gain/2; break; - case POS_RESTING: break; - case POS_FIGHTING: gain /= 3; break; - } - } - else - { - gain = (get_curr_stat(ch,STAT_WIS) - + get_curr_stat(ch,STAT_INT) + ch->level) / 2; - number = number_percent(); - if (number < get_skill(ch,gsn_meditation)) - { - gain += number * gain / 100; - if (ch->mana < ch->max_mana) - check_improve(ch,gsn_meditation,TRUE,8); - } - if (!class_table[ch->class].fMana) - gain /= 2; - - switch ( ch->position ) - { - default: gain /= 4; break; - case POS_SLEEPING: break; - case POS_RESTING: gain /= 2; break; - case POS_FIGHTING: gain /= 6; break; - } - - if ( ch->pcdata->condition[COND_HUNGER] == 0 ) - gain /= 2; - - if ( ch->pcdata->condition[COND_THIRST] == 0 ) - gain /= 2; - - } - - gain = gain * ch->in_room->mana_rate / 100; - - if (ch->on != NULL && ch->on->item_type == ITEM_FURNITURE) - gain = gain * ch->on->value[4] / 100; - - if ( IS_AFFECTED( ch, AFF_POISON ) ) - gain /= 4; - - if (IS_AFFECTED(ch, AFF_PLAGUE)) - gain /= 8; - - if (IS_AFFECTED(ch,AFF_HASTE) || IS_AFFECTED(ch,AFF_SLOW)) - gain /=2 ; - - return UMIN(gain, ch->max_mana - ch->mana); -} - - - -int move_gain( CHAR_DATA *ch ) -{ - int gain; - - if (ch->in_room == NULL) - return 0; - - if ( IS_NPC(ch) ) - { - gain = ch->level; - } - else - { - gain = UMAX( 15, ch->level ); - - switch ( ch->position ) - { - case POS_SLEEPING: gain += get_curr_stat(ch,STAT_DEX); break; - case POS_RESTING: gain += get_curr_stat(ch,STAT_DEX) / 2; break; - } - - if ( ch->pcdata->condition[COND_HUNGER] == 0 ) - gain /= 2; - - if ( ch->pcdata->condition[COND_THIRST] == 0 ) - gain /= 2; - } - - gain = gain * ch->in_room->heal_rate/100; - - if (ch->on != NULL && ch->on->item_type == ITEM_FURNITURE) - gain = gain * ch->on->value[3] / 100; - - if ( IS_AFFECTED(ch, AFF_POISON) ) - gain /= 4; - - if (IS_AFFECTED(ch, AFF_PLAGUE)) - gain /= 8; - - if (IS_AFFECTED(ch,AFF_HASTE) || IS_AFFECTED(ch,AFF_SLOW)) - gain /=2 ; - - return UMIN(gain, ch->max_move - ch->move); -} - - - -void gain_condition( CHAR_DATA *ch, int iCond, int value ) -{ - int condition; - - if ( value == 0 || IS_NPC(ch) || ch->level >= LEVEL_IMMORTAL) - return; - - condition = ch->pcdata->condition[iCond]; - if (condition == -1) - return; - ch->pcdata->condition[iCond] = URANGE( 0, condition + value, 48 ); - - if ( ch->pcdata->condition[iCond] == 0 ) - { - switch ( iCond ) - { - case COND_HUNGER: - send_to_char( "You are hungry.\n\r", ch ); - break; - - case COND_THIRST: - send_to_char( "You are thirsty.\n\r", ch ); - break; - - case COND_DRUNK: - if ( condition != 0 ) - send_to_char( "You are sober.\n\r", ch ); - break; - } - } - - return; -} - - - -/* - * Mob autonomous action. - * This function takes 25% to 35% of ALL Merc cpu time. - * -- Furey - */ -void mobile_update( void ) -{ - CHAR_DATA *ch; - CHAR_DATA *ch_next; - EXIT_DATA *pexit; - int door; - - /* Examine all mobs. */ - for ( ch = char_list; ch != NULL; ch = ch_next ) - { - ch_next = ch->next; - - if ( !IS_NPC(ch) || ch->in_room == NULL || IS_AFFECTED(ch,AFF_CHARM)) - continue; - - if (ch->in_room->area->empty && !IS_SET(ch->act,ACT_UPDATE_ALWAYS)) - continue; - - /* Examine call for special procedure */ - if ( ch->spec_fun != 0 ) - { - if ( (*ch->spec_fun) ( ch ) ) - continue; - } - - if (ch->pIndexData->pShop != NULL) /* give him some gold */ - if ((ch->gold * 100 + ch->silver) < ch->pIndexData->wealth) - { - ch->gold += ch->pIndexData->wealth * number_range(1,20)/5000000; - ch->silver += ch->pIndexData->wealth * number_range(1,20)/50000; - } - - - /* That's all for sleeping / busy monster, and empty zones */ - if ( ch->position != POS_STANDING ) - continue; - - /* Scavenge */ - if ( IS_SET(ch->act, ACT_SCAVENGER) - && ch->in_room->contents != NULL - && number_bits( 6 ) == 0 ) - { - OBJ_DATA *obj; - OBJ_DATA *obj_best; - int max; - - max = 1; - obj_best = 0; - for ( obj = ch->in_room->contents; obj; obj = obj->next_content ) - { - if ( CAN_WEAR(obj, ITEM_TAKE) && can_loot(ch, obj) - && obj->cost > max && obj->cost > 0) - { - obj_best = obj; - max = obj->cost; - } - } - - if ( obj_best ) - { - obj_from_room( obj_best ); - obj_to_char( obj_best, ch ); - act( "$n gets $p.", ch, obj_best, NULL, TO_ROOM ); - } - } - - /* Wander */ - if ( !IS_SET(ch->act, ACT_SENTINEL) - && number_bits(3) == 0 - && ( door = number_bits( 5 ) ) <= 5 - && ( pexit = ch->in_room->exit[door] ) != NULL - && pexit->u1.to_room != NULL - && !IS_SET(pexit->exit_info, EX_CLOSED) - && !IS_SET(pexit->u1.to_room->room_flags, ROOM_NO_MOB) - && ( !IS_SET(ch->act, ACT_STAY_AREA) - || pexit->u1.to_room->area == ch->in_room->area ) - && ( !IS_SET(ch->act, ACT_OUTDOORS) - || !IS_SET(pexit->u1.to_room->room_flags,ROOM_INDOORS)) - && ( !IS_SET(ch->act, ACT_INDOORS) - || IS_SET(pexit->u1.to_room->room_flags,ROOM_INDOORS))) - { - move_char( ch, door, FALSE ); - } - } - - return; -} - - - -/* - * Update the weather. - */ -void weather_update( void ) -{ - char buf[MAX_STRING_LENGTH]; - DESCRIPTOR_DATA *d; - int diff; - - buf[0] = '\0'; - - switch ( ++time_info.hour ) - { - case 5: - weather_info.sunlight = SUN_LIGHT; - strcat( buf, "The day has begun.\n\r" ); - break; - - case 6: - weather_info.sunlight = SUN_RISE; - strcat( buf, "The sun rises in the east.\n\r" ); - break; - - case 19: - weather_info.sunlight = SUN_SET; - strcat( buf, "The sun slowly disappears in the west.\n\r" ); - break; - - case 20: - weather_info.sunlight = SUN_DARK; - strcat( buf, "The night has begun.\n\r" ); - break; - - case 24: - time_info.hour = 0; - time_info.day++; - break; - } - - if ( time_info.day >= 35 ) - { - time_info.day = 0; - time_info.month++; - } - - if ( time_info.month >= 17 ) - { - time_info.month = 0; - time_info.year++; - } - - /* - * Weather change. - */ - if ( time_info.month >= 9 && time_info.month <= 16 ) - diff = weather_info.mmhg > 985 ? -2 : 2; - else - diff = weather_info.mmhg > 1015 ? -2 : 2; - - weather_info.change += diff * dice(1, 4) + dice(2, 6) - dice(2, 6); - weather_info.change = UMAX(weather_info.change, -12); - weather_info.change = UMIN(weather_info.change, 12); - - weather_info.mmhg += weather_info.change; - weather_info.mmhg = UMAX(weather_info.mmhg, 960); - weather_info.mmhg = UMIN(weather_info.mmhg, 1040); - - switch ( weather_info.sky ) - { - default: - bug( "Weather_update: bad sky %d.", weather_info.sky ); - weather_info.sky = SKY_CLOUDLESS; - break; - - case SKY_CLOUDLESS: - if ( weather_info.mmhg < 990 - || ( weather_info.mmhg < 1010 && number_bits( 2 ) == 0 ) ) - { - strcat( buf, "The sky is getting cloudy.\n\r" ); - weather_info.sky = SKY_CLOUDY; - } - break; - - case SKY_CLOUDY: - if ( weather_info.mmhg < 970 - || ( weather_info.mmhg < 990 && number_bits( 2 ) == 0 ) ) - { - strcat( buf, "It starts to rain.\n\r" ); - weather_info.sky = SKY_RAINING; - } - - if ( weather_info.mmhg > 1030 && number_bits( 2 ) == 0 ) - { - strcat( buf, "The clouds disappear.\n\r" ); - weather_info.sky = SKY_CLOUDLESS; - } - break; - - case SKY_RAINING: - if ( weather_info.mmhg < 970 && number_bits( 2 ) == 0 ) - { - strcat( buf, "Lightning flashes in the sky.\n\r" ); - weather_info.sky = SKY_LIGHTNING; - } - - if ( weather_info.mmhg > 1030 - || ( weather_info.mmhg > 1010 && number_bits( 2 ) == 0 ) ) - { - strcat( buf, "The rain stopped.\n\r" ); - weather_info.sky = SKY_CLOUDY; - } - break; - - case SKY_LIGHTNING: - if ( weather_info.mmhg > 1010 - || ( weather_info.mmhg > 990 && number_bits( 2 ) == 0 ) ) - { - strcat( buf, "The lightning has stopped.\n\r" ); - weather_info.sky = SKY_RAINING; - break; - } - break; - } - - if ( buf[0] != '\0' ) - { - for ( d = descriptor_list; d != NULL; d = d->next ) - { - if ( d->connected == CON_PLAYING - && IS_OUTSIDE(d->character) - && IS_AWAKE(d->character) ) - send_to_char( buf, d->character ); - } - } - - return; -} - - - -/* - * Update all chars, including mobs. -*/ -void char_update( void ) -{ - CHAR_DATA *ch; - CHAR_DATA *ch_next; - CHAR_DATA *ch_quit; - - ch_quit = NULL; - - /* update save counter */ - save_number++; - - if (save_number > 29) - save_number = 0; - - for ( ch = char_list; ch != NULL; ch = ch_next ) - { - AFFECT_DATA *paf; - AFFECT_DATA *paf_next; - - ch_next = ch->next; - - if ( ch->timer > 30 ) - ch_quit = ch; - - if ( ch->position >= POS_STUNNED ) - { - /* check to see if we need to go home */ - if (IS_NPC(ch) && ch->zone != NULL && ch->zone != ch->in_room->area - && ch->desc == NULL && ch->fighting == NULL - && !IS_AFFECTED(ch,AFF_CHARM) && number_percent() < 5) - { - act("$n wanders on home.",ch,NULL,NULL,TO_ROOM); - extract_char(ch,TRUE); - continue; - } - - if ( ch->hit < ch->max_hit ) - ch->hit += hit_gain(ch); - else - ch->hit = ch->max_hit; - - if ( ch->mana < ch->max_mana ) - ch->mana += mana_gain(ch); - else - ch->mana = ch->max_mana; - - if ( ch->move < ch->max_move ) - ch->move += move_gain(ch); - else - ch->move = ch->max_move; - } - - if ( ch->position == POS_STUNNED ) - update_pos( ch ); - - if ( !IS_NPC(ch) && ch->level < LEVEL_IMMORTAL ) - { - OBJ_DATA *obj; - - if ( ( obj = get_eq_char( ch, WEAR_LIGHT ) ) != NULL - && obj->item_type == ITEM_LIGHT - && obj->value[2] > 0 ) - { - if ( --obj->value[2] == 0 && ch->in_room != NULL ) - { - --ch->in_room->light; - act( "$p goes out.", ch, obj, NULL, TO_ROOM ); - act( "$p flickers and goes out.", ch, obj, NULL, TO_CHAR ); - extract_obj( obj ); - } - else if ( obj->value[2] <= 5 && ch->in_room != NULL) - act("$p flickers.",ch,obj,NULL,TO_CHAR); - } - - if (IS_IMMORTAL(ch)) - ch->timer = 0; - - if ( ++ch->timer >= 12 ) - { - if ( ch->was_in_room == NULL && ch->in_room != NULL ) - { - ch->was_in_room = ch->in_room; - if ( ch->fighting != NULL ) - stop_fighting( ch, TRUE ); - act( "$n disappears into the void.", - ch, NULL, NULL, TO_ROOM ); - send_to_char( "You disappear into the void.\n\r", ch ); - if (ch->level > 1) - save_char_obj( ch ); - char_from_room( ch ); - char_to_room( ch, get_room_index( ROOM_VNUM_LIMBO ) ); - } - } - - gain_condition( ch, COND_DRUNK, -1 ); - gain_condition( ch, COND_FULL, ch->size > SIZE_MEDIUM ? -4 : -2 ); - gain_condition( ch, COND_THIRST, -1 ); - gain_condition( ch, COND_HUNGER, ch->size > SIZE_MEDIUM ? -2 : -1); - } - - for ( paf = ch->affected; paf != NULL; paf = paf_next ) - { - paf_next = paf->next; - if ( paf->duration > 0 ) - { - paf->duration--; - if (number_range(0,4) == 0 && paf->level > 0) - paf->level--; /* spell strength fades with time */ - } - else if ( paf->duration < 0 ) - ; - else - { - if ( paf_next == NULL - || paf_next->type != paf->type - || paf_next->duration > 0 ) - { - if ( paf->type > 0 && skill_table[paf->type].msg_off ) - { - send_to_char( skill_table[paf->type].msg_off, ch ); - send_to_char( "\n\r", ch ); - } - } - - affect_remove( ch, paf ); - } - } - - /* - * Careful with the damages here, - * MUST NOT refer to ch after damage taken, - * as it may be lethal damage (on NPC). - */ - - if (is_affected(ch, gsn_plague) && ch != NULL) - { - AFFECT_DATA *af, plague; - CHAR_DATA *vch; - int dam; - - if (ch->in_room == NULL) - continue; - - act("$n writhes in agony as plague sores erupt from $s skin.", - ch,NULL,NULL,TO_ROOM); - send_to_char("You writhe in agony from the plague.\n\r",ch); - for ( af = ch->affected; af != NULL; af = af->next ) - { - if (af->type == gsn_plague) - break; - } - - if (af == NULL) - { - REMOVE_BIT(ch->affected_by,AFF_PLAGUE); - continue; - } - - if (af->level == 1) - continue; - - plague.where = TO_AFFECTS; - plague.type = gsn_plague; - plague.level = af->level - 1; - plague.duration = number_range(1,2 * plague.level); - plague.location = APPLY_STR; - plague.modifier = -5; - plague.bitvector = AFF_PLAGUE; - - for ( vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room) - { - if (!saves_spell(plague.level - 2,vch,DAM_DISEASE) - && !IS_IMMORTAL(vch) - && !IS_AFFECTED(vch,AFF_PLAGUE) && number_bits(4) == 0) - { - send_to_char("You feel hot and feverish.\n\r",vch); - act("$n shivers and looks very ill.",vch,NULL,NULL,TO_ROOM); - affect_join(vch,&plague); - } - } - - dam = UMIN(ch->level,af->level/5+1); - ch->mana -= dam; - ch->move -= dam; - damage( ch, ch, dam, gsn_plague,DAM_DISEASE,FALSE); - } - else if ( IS_AFFECTED(ch, AFF_POISON) && ch != NULL - && !IS_AFFECTED(ch,AFF_SLOW)) - - { - AFFECT_DATA *poison; - - poison = affect_find(ch->affected,gsn_poison); - - if (poison != NULL) - { - act( "$n shivers and suffers.", ch, NULL, NULL, TO_ROOM ); - send_to_char( "You shiver and suffer.\n\r", ch ); - damage(ch,ch,poison->level/10 + 1,gsn_poison, - DAM_POISON,FALSE); - } - } - - else if ( ch->position == POS_INCAP && number_range(0,1) == 0) - { - damage( ch, ch, 1, TYPE_UNDEFINED, DAM_NONE,FALSE); - } - else if ( ch->position == POS_MORTAL ) - { - damage( ch, ch, 1, TYPE_UNDEFINED, DAM_NONE,FALSE); - } - } - - /* - * Autosave and autoquit. - * Check that these chars still exist. - */ - for ( ch = char_list; ch != NULL; ch = ch_next ) - { - ch_next = ch->next; - - if (ch->desc != NULL && ch->desc->descriptor % 30 == save_number) - { - save_char_obj(ch); - } - - if (ch == ch_quit) - { - do_function(ch, &do_quit, "" ); - } - } - - return; -} - - - - -/* - * Update all objs. - * This function is performance sensitive. - */ -void obj_update( void ) -{ - OBJ_DATA *obj; - OBJ_DATA *obj_next; - AFFECT_DATA *paf, *paf_next; - - for ( obj = object_list; obj != NULL; obj = obj_next ) - { - CHAR_DATA *rch; - char *message; - - obj_next = obj->next; - - /* go through affects and decrement */ - for ( paf = obj->affected; paf != NULL; paf = paf_next ) - { - paf_next = paf->next; - if ( paf->duration > 0 ) - { - paf->duration--; - if (number_range(0,4) == 0 && paf->level > 0) - paf->level--; /* spell strength fades with time */ - } - else if ( paf->duration < 0 ) - ; - else - { - if ( paf_next == NULL - || paf_next->type != paf->type - || paf_next->duration > 0 ) - { - if ( paf->type > 0 && skill_table[paf->type].msg_obj ) - { - if (obj->carried_by != NULL) - { - rch = obj->carried_by; - act(skill_table[paf->type].msg_obj, - rch,obj,NULL,TO_CHAR); - } - if (obj->in_room != NULL - && obj->in_room->people != NULL) - { - rch = obj->in_room->people; - act(skill_table[paf->type].msg_obj, - rch,obj,NULL,TO_ALL); - } - } - } - - affect_remove_obj( obj, paf ); - } - } - - - if ( obj->timer <= 0 || --obj->timer > 0 ) - continue; - - switch ( obj->item_type ) - { - default: message = "$p crumbles into dust."; break; - case ITEM_FOUNTAIN: message = "$p dries up."; break; - case ITEM_CORPSE_NPC: message = "$p decays into dust."; break; - case ITEM_CORPSE_PC: message = "$p decays into dust."; break; - case ITEM_FOOD: message = "$p decomposes."; break; - case ITEM_POTION: message = "$p has evaporated from disuse."; - break; - case ITEM_PORTAL: message = "$p fades out of existence."; break; - case ITEM_CONTAINER: - if (CAN_WEAR(obj,ITEM_WEAR_FLOAT)) - if (obj->contains) - message = - "$p flickers and vanishes, spilling its contents on the floor."; - else - message = "$p flickers and vanishes."; - else - message = "$p crumbles into dust."; - break; - } - - if ( obj->carried_by != NULL ) - { - if (IS_NPC(obj->carried_by) - && obj->carried_by->pIndexData->pShop != NULL) - obj->carried_by->silver += obj->cost/5; - else - { - act( message, obj->carried_by, obj, NULL, TO_CHAR ); - if ( obj->wear_loc == WEAR_FLOAT) - act(message,obj->carried_by,obj,NULL,TO_ROOM); - } - } - else if ( obj->in_room != NULL - && ( rch = obj->in_room->people ) != NULL ) - { - if (! (obj->in_obj && obj->in_obj->pIndexData->vnum == OBJ_VNUM_PIT - && !CAN_WEAR(obj->in_obj,ITEM_TAKE))) - { - act( message, rch, obj, NULL, TO_ROOM ); - act( message, rch, obj, NULL, TO_CHAR ); - } - } - - if ((obj->item_type == ITEM_CORPSE_PC || obj->wear_loc == WEAR_FLOAT) - && obj->contains) - { /* save the contents */ - OBJ_DATA *t_obj, *next_obj; - - for (t_obj = obj->contains; t_obj != NULL; t_obj = next_obj) - { - next_obj = t_obj->next_content; - obj_from_obj(t_obj); - - if (obj->in_obj) /* in another object */ - obj_to_obj(t_obj,obj->in_obj); - - else if (obj->carried_by) /* carried */ - if (obj->wear_loc == WEAR_FLOAT) - if (obj->carried_by->in_room == NULL) - extract_obj(t_obj); - else - obj_to_room(t_obj,obj->carried_by->in_room); - else - obj_to_char(t_obj,obj->carried_by); - - else if (obj->in_room == NULL) /* destroy it */ - extract_obj(t_obj); - - else /* to a room */ - obj_to_room(t_obj,obj->in_room); - } - } - - extract_obj( obj ); - } - - return; -} - - - -/* - * Aggress. - * - * for each mortal PC - * for each mob in room - * aggress on some random PC - * - * This function takes 25% to 35% of ALL Merc cpu time. - * Unfortunately, checking on each PC move is too tricky, - * because we don't the mob to just attack the first PC - * who leads the party into the room. - * - * -- Furey - */ -void aggr_update( void ) -{ - CHAR_DATA *wch; - CHAR_DATA *wch_next; - CHAR_DATA *ch; - CHAR_DATA *ch_next; - CHAR_DATA *vch; - CHAR_DATA *vch_next; - CHAR_DATA *victim; - - for ( wch = char_list; wch != NULL; wch = wch_next ) - { - wch_next = wch->next; - if ( IS_NPC(wch) - || wch->level >= LEVEL_IMMORTAL - || wch->in_room == NULL - || wch->in_room->area->empty) - continue; - - for ( ch = wch->in_room->people; ch != NULL; ch = ch_next ) - { - int count; - - ch_next = ch->next_in_room; - - if ( !IS_NPC(ch) - || !IS_SET(ch->act, ACT_AGGRESSIVE) - || IS_SET(ch->in_room->room_flags,ROOM_SAFE) - || IS_AFFECTED(ch,AFF_CALM) - || ch->fighting != NULL - || IS_AFFECTED(ch, AFF_CHARM) - || !IS_AWAKE(ch) - || ( IS_SET(ch->act, ACT_WIMPY) && IS_AWAKE(wch) ) - || !can_see( ch, wch ) - || number_bits(1) == 0) - continue; - - /* - * Ok we have a 'wch' player character and a 'ch' npc aggressor. - * Now make the aggressor fight a RANDOM pc victim in the room, - * giving each 'vch' an equal chance of selection. - */ - count = 0; - victim = NULL; - for ( vch = wch->in_room->people; vch != NULL; vch = vch_next ) - { - vch_next = vch->next_in_room; - - if ( !IS_NPC(vch) - && vch->level < LEVEL_IMMORTAL - && ch->level >= vch->level - 5 - && ( !IS_SET(ch->act, ACT_WIMPY) || !IS_AWAKE(vch) ) - && can_see( ch, vch ) ) - { - if ( number_range( 0, count ) == 0 ) - victim = vch; - count++; - } - } - - if ( victim == NULL ) - continue; - - multi_hit( ch, victim, TYPE_UNDEFINED ); - } - } - - return; -} - - - -/* - * Handle all kinds of updates. - * Called once per pulse from game loop. - * Random times to defeat tick-timing clients and players. - */ - -void update_handler( void ) -{ - static int pulse_area; - static int pulse_mobile; - static int pulse_violence; - static int pulse_point; - static int pulse_music; - - if ( --pulse_area <= 0 ) - { - pulse_area = PULSE_AREA; - /* number_range( PULSE_AREA / 2, 3 * PULSE_AREA / 2 ); */ - area_update ( ); - } - - if ( --pulse_music <= 0 ) - { - pulse_music = PULSE_MUSIC; - song_update(); - } - - if ( --pulse_mobile <= 0 ) - { - pulse_mobile = PULSE_MOBILE; - mobile_update ( ); - } - - if ( --pulse_violence <= 0 ) - { - pulse_violence = PULSE_VIOLENCE; - violence_update ( ); - } - - if ( --pulse_point <= 0 ) - { - wiznet("TICK!",NULL,NULL,WIZ_TICKS,0,0); - pulse_point = PULSE_TICK; -/* number_range( PULSE_TICK / 2, 3 * PULSE_TICK / 2 ); */ - weather_update ( ); - char_update ( ); - obj_update ( ); - } - - aggr_update( ); - tail_chain( ); - return; -} From d25371e4a6c71c3db5f528c53f7d0e2844cb7d1c Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Wed, 1 Dec 2021 18:41:34 -0800 Subject: [PATCH 12/40] default to show exits and fixed bug with item location on equip --- src/rom24/__init__.py | 2 +- src/rom24/living.py | 24 ++++++++++++++++++------ src/rom24/nanny.py | 1 + 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/rom24/__init__.py b/src/rom24/__init__.py index 2dcb709..3c3f083 100644 --- a/src/rom24/__init__.py +++ b/src/rom24/__init__.py @@ -17,7 +17,7 @@ LOGGING_LEVEL = os.environ.get(f"{LIBRARY_NAME.upper()}_LOGGING_LEVEL", logging.DEBUG) LOG_ALL_THE_THINGS = os.environ.get(f"{LIBRARY_NAME.upper()}_LOG_ALL_THE_THINGS") LOGGING_FORMATTER = os.environ.get( - f"{LIBRARY_NAME.upper()}_LOGGING_VERBOSITY", "normal" + f"{LIBRARY_NAME.upper()}_LOGGING_VERBOSITY", "verbose" ) diff --git a/src/rom24/living.py b/src/rom24/living.py index 835f47a..72bc48f 100644 --- a/src/rom24/living.py +++ b/src/rom24/living.py @@ -941,11 +941,18 @@ def raw_equip(self, item, to_location): self.in_room.available_light += 1 def can_equip(self, item, loc, should_replace=False, wverbose=False): - if item.environment: - try: - item.environment.get(item) - except: - return + logger.debug("Checking if user %s can equip %s at %s", self.name, item, loc) + # if item.environment: + # logger.debug("item.environment: %s", item.environment) + # try: + # item.environment.get(item) + # logger.debug("item.environment: %s", item.environment) + # logger.debug("Successfully ran item.environment.get(item)") + # except: + # logger.debug("item.environment: %s", item.environment) + # logger.exception("Encountered an exception trying to get the item from the environment.") + # return + if (item.flags.anti_evil and self.is_evil()) or (item.flags.anti_good and self.is_good()) \ or (item.flags.anti_neutral and self.is_neutral()): handler_game.act("You are zapped by $p and drop it.", self, item, None, merc.TO_CHAR) @@ -958,6 +965,7 @@ def can_equip(self, item, loc, should_replace=False, wverbose=False): return False if not self.is_npc(): if loc == 'main_hand': + if item.get_weight() > (const.str_app[self.stat(merc.STAT_STR)].wield * 10): if wverbose: self.send('That weapon is too heavy for you to wield.\n') @@ -966,10 +974,13 @@ def can_equip(self, item, loc, should_replace=False, wverbose=False): if self.slots.off_hand and self.size < merc.SIZE_LARGE: if wverbose: self.send('You need two hands free for that weapon.\n') + return False elif self.size < merc.SIZE_LARGE: + if wverbose: self.send('That weapon is too large for you to wield.\n') + return False else: return True @@ -999,7 +1010,6 @@ def equip(self, item, replace: bool=False, verbose: bool=False, verbose_all: boo :return: :rtype: """ location = None - if not item.equips_to: if verbose: self.send("You can't wear, wield, or hold that.\n") @@ -1012,6 +1022,7 @@ def equip(self, item, replace: bool=False, verbose: bool=False, verbose_all: boo self.raw_equip(item, to_loc) return else: + possible_slots = item.equips_to & self.slots.available if len(possible_slots) > 0: if not verbose: @@ -1038,6 +1049,7 @@ def equip(self, item, replace: bool=False, verbose: bool=False, verbose_all: boo if not success: return else: + # Get first location for equipping. location = [k for k in overlap][0] self.raw_equip(item, location) if verbose_all: diff --git a/src/rom24/nanny.py b/src/rom24/nanny.py index 09031c4..b7aa068 100644 --- a/src/rom24/nanny.py +++ b/src/rom24/nanny.py @@ -217,6 +217,7 @@ def con_get_new_race(self): ch.vuln_flags.set_bit(const.race_table[race.name].vuln) ch.form.set_bit(const.race_table[race.name].form) ch.parts.set_bit(const.race_table[race.name].parts) + ch.act.set_bit(merc.PLR_AUTOEXIT) # add skills */ for i in race.skills: From 63635b0a158b60ce96193b1efec8ce030cb1be52 Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Wed, 1 Dec 2021 19:35:43 -0800 Subject: [PATCH 13/40] Improving owhere to have vnums too --- src/rom24/commands/do_owhere.py | 10 +++++----- src/rom24/living.py | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/rom24/commands/do_owhere.py b/src/rom24/commands/do_owhere.py index 5ead69c..769c8bd 100644 --- a/src/rom24/commands/do_owhere.py +++ b/src/rom24/commands/do_owhere.py @@ -37,13 +37,13 @@ def do_owhere(ch, argument): content = content.in_item if content.in_living and ch.can_see(content.in_living) and content.in_living.in_room: - ch.send("%3d) %s is carried by %s [[Room %d]]\n" % ( - number, item.short_descr, state_checks.PERS(content.in_living, ch), content.in_living.in_room.vnum )) + ch.send("%3d) %s (%s) is carried by %s [[Room %d]]\n" % ( + number,item.short_descr, item.vnum, state_checks.PERS(content.in_living, ch), content.in_living.in_room.vnum )) elif content.in_room and ch.can_see_room(content.in_room.instance_id): - ch.send("%3d) %s is in %s [[Room %d]]\n" % ( - number, item.short_descr, content.in_room.name, content.in_room.vnum)) + ch.send("%3d) %s (%s) is in %s [[Room %d]]\n" % ( + number, item.short_descr, item.vnum, content.in_room.name, content.in_room.vnum)) else: - ch.send("%3d) %s is somewhere\n" % (number, item.short_descr)) + ch.send("%3d) %s (%s) is somewhere\n" % (number, item.short_descr, item.vnum)) if number >= max_found: break diff --git a/src/rom24/living.py b/src/rom24/living.py index 72bc48f..9ac7115 100644 --- a/src/rom24/living.py +++ b/src/rom24/living.py @@ -941,7 +941,6 @@ def raw_equip(self, item, to_location): self.in_room.available_light += 1 def can_equip(self, item, loc, should_replace=False, wverbose=False): - logger.debug("Checking if user %s can equip %s at %s", self.name, item, loc) # if item.environment: # logger.debug("item.environment: %s", item.environment) # try: From d5becc05723ce3399d3ad01c26b3a16ab97116cc Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Wed, 1 Dec 2021 19:36:12 -0800 Subject: [PATCH 14/40] Removing old setup file --- setup | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100755 setup diff --git a/setup b/setup deleted file mode 100755 index 1a50762..0000000 --- a/setup +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -git remote add upstream git@bitbucket.org:mudbytes/pyom.git -#cd Rom24/pysrc/ -#git clone git@bitbucket.org:quixadhal/miniboa.git miniboa_git -#ln -sv miniboa_git/miniboa . - -# If you're on Windows, you probably have to hand-move the -# miniboa subdirectory out of the miniboa_git directory, -# since symbolic links aren't directly supported. - -# Changed my mind. Since it was my repo anyways, I'll just -# put the miniboa sources directly in here. Much simpler. -# I will leave the setup as comments though, for reference. From a6600254e2a47b9af7a38db8c4bf7c5c2be36e02 Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Wed, 1 Dec 2021 19:54:38 -0800 Subject: [PATCH 15/40] Remove egg info and update gitignore --- .gitignore | 3 +- src/rom24.egg-info/PKG-INFO | 11 - src/rom24.egg-info/SOURCES.txt | 377 ------------------------ src/rom24.egg-info/dependency_links.txt | 1 - src/rom24.egg-info/entry_points.txt | 3 - src/rom24.egg-info/requires.txt | 2 - src/rom24.egg-info/top_level.txt | 1 - 7 files changed, 2 insertions(+), 396 deletions(-) delete mode 100644 src/rom24.egg-info/PKG-INFO delete mode 100644 src/rom24.egg-info/SOURCES.txt delete mode 100644 src/rom24.egg-info/dependency_links.txt delete mode 100644 src/rom24.egg-info/entry_points.txt delete mode 100644 src/rom24.egg-info/requires.txt delete mode 100644 src/rom24.egg-info/top_level.txt diff --git a/.gitignore b/.gitignore index 801ad13..fcbd8a6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ __pycache__/ .idea/ venv/ data/ -instance_tracker.txt \ No newline at end of file +instance_tracker.txt +*.egg-info/ diff --git a/src/rom24.egg-info/PKG-INFO b/src/rom24.egg-info/PKG-INFO deleted file mode 100644 index afb724d..0000000 --- a/src/rom24.egg-info/PKG-INFO +++ /dev/null @@ -1,11 +0,0 @@ -Metadata-Version: 1.2 -Name: rom24 -Version: 0.0.0a0 -Summary: Attempt at properly packaging rom24 python. -Home-page: UNKNOWN -Author: Micheal Taylor -Author-email: bubthegreat@gmail.com -License: UNKNOWN -Description: UNKNOWN -Platform: UNKNOWN -Requires-Python: >=3.6.6 diff --git a/src/rom24.egg-info/SOURCES.txt b/src/rom24.egg-info/SOURCES.txt deleted file mode 100644 index 0218d63..0000000 --- a/src/rom24.egg-info/SOURCES.txt +++ /dev/null @@ -1,377 +0,0 @@ -README.md -setup.py -src/rom24/__init__.py -src/rom24/affects.py -src/rom24/auth.py -src/rom24/bit.py -src/rom24/comm.py -src/rom24/const.py -src/rom24/data_loader.py -src/rom24/db.py -src/rom24/effects.py -src/rom24/environment.py -src/rom24/equipment.py -src/rom24/fight.py -src/rom24/game_utils.py -src/rom24/handler_ch.py -src/rom24/handler_game.py -src/rom24/handler_item.py -src/rom24/handler_log.py -src/rom24/handler_magic.py -src/rom24/handler_npc.py -src/rom24/handler_pc.py -src/rom24/handler_room.py -src/rom24/hotfix.py -src/rom24/immortal.py -src/rom24/instance.py -src/rom24/interp.py -src/rom24/inventory.py -src/rom24/item_flags.py -src/rom24/living.py -src/rom24/magic.py -src/rom24/merc.py -src/rom24/nanny.py -src/rom24/object_creator.py -src/rom24/physical.py -src/rom24/pyom.py -src/rom24/pyprogs.py -src/rom24/save.py -src/rom24/settings.py -src/rom24/shell.py -src/rom24/shop_utils.py -src/rom24/skills.py -src/rom24/special.py -src/rom24/state_checks.py -src/rom24/sys_utils.py -src/rom24/tables.py -src/rom24/type_bypass.py -src/rom24/update.py -src/rom24/world_classes.py -src/rom24.egg-info/PKG-INFO -src/rom24.egg-info/SOURCES.txt -src/rom24.egg-info/dependency_links.txt -src/rom24.egg-info/entry_points.txt -src/rom24.egg-info/requires.txt -src/rom24.egg-info/top_level.txt -src/rom24/commands/__init__.py -src/rom24/commands/do_advance.py -src/rom24/commands/do_affects.py -src/rom24/commands/do_afk.py -src/rom24/commands/do_alias.py -src/rom24/commands/do_answer.py -src/rom24/commands/do_apickle.py -src/rom24/commands/do_areas.py -src/rom24/commands/do_at.py -src/rom24/commands/do_auction.py -src/rom24/commands/do_authenticator.py -src/rom24/commands/do_autoassist.py -src/rom24/commands/do_autoexit.py -src/rom24/commands/do_autogold.py -src/rom24/commands/do_autolist.py -src/rom24/commands/do_autoloot.py -src/rom24/commands/do_autosac.py -src/rom24/commands/do_autosplit.py -src/rom24/commands/do_backstab.py -src/rom24/commands/do_bamfin.py -src/rom24/commands/do_bamfout.py -src/rom24/commands/do_bash.py -src/rom24/commands/do_berserk.py -src/rom24/commands/do_brandish.py -src/rom24/commands/do_brief.py -src/rom24/commands/do_bug.py -src/rom24/commands/do_buy.py -src/rom24/commands/do_cast.py -src/rom24/commands/do_channels.py -src/rom24/commands/do_clantalk.py -src/rom24/commands/do_clone.py -src/rom24/commands/do_close.py -src/rom24/commands/do_combine.py -src/rom24/commands/do_commands.py -src/rom24/commands/do_compact.py -src/rom24/commands/do_compare.py -src/rom24/commands/do_consider.py -src/rom24/commands/do_count.py -src/rom24/commands/do_deaf.py -src/rom24/commands/do_debug.py -src/rom24/commands/do_delete.py -src/rom24/commands/do_deny.py -src/rom24/commands/do_description.py -src/rom24/commands/do_dirt.py -src/rom24/commands/do_disarm.py -src/rom24/commands/do_disconnect.py -src/rom24/commands/do_down.py -src/rom24/commands/do_drink.py -src/rom24/commands/do_drop.py -src/rom24/commands/do_dump.py -src/rom24/commands/do_east.py -src/rom24/commands/do_eat.py -src/rom24/commands/do_echo.py -src/rom24/commands/do_emote.py -src/rom24/commands/do_enter.py -src/rom24/commands/do_envenom.py -src/rom24/commands/do_equipment.py -src/rom24/commands/do_examine.py -src/rom24/commands/do_exits.py -src/rom24/commands/do_fill.py -src/rom24/commands/do_flags.py -src/rom24/commands/do_flee.py -src/rom24/commands/do_follow.py -src/rom24/commands/do_force.py -src/rom24/commands/do_freeze.py -src/rom24/commands/do_freset.py -src/rom24/commands/do_gain.py -src/rom24/commands/do_get.py -src/rom24/commands/do_give.py -src/rom24/commands/do_gossip.py -src/rom24/commands/do_goto.py -src/rom24/commands/do_grats.py -src/rom24/commands/do_group.py -src/rom24/commands/do_groups.py -src/rom24/commands/do_gtell.py -src/rom24/commands/do_guild.py -src/rom24/commands/do_heal.py -src/rom24/commands/do_help.py -src/rom24/commands/do_hide.py -src/rom24/commands/do_holylight.py -src/rom24/commands/do_immtalk.py -src/rom24/commands/do_incognito.py -src/rom24/commands/do_inventory.py -src/rom24/commands/do_invis.py -src/rom24/commands/do_kick.py -src/rom24/commands/do_kill.py -src/rom24/commands/do_list.py -src/rom24/commands/do_load.py -src/rom24/commands/do_lock.py -src/rom24/commands/do_log.py -src/rom24/commands/do_look.py -src/rom24/commands/do_memory.py -src/rom24/commands/do_mfind.py -src/rom24/commands/do_mload.py -src/rom24/commands/do_mset.py -src/rom24/commands/do_mstat.py -src/rom24/commands/do_murder.py -src/rom24/commands/do_music.py -src/rom24/commands/do_mwhere.py -src/rom24/commands/do_newlock.py -src/rom24/commands/do_nochannels.py -src/rom24/commands/do_noemote.py -src/rom24/commands/do_nofollow.py -src/rom24/commands/do_noloot.py -src/rom24/commands/do_north.py -src/rom24/commands/do_noshout.py -src/rom24/commands/do_nosummon.py -src/rom24/commands/do_notell.py -src/rom24/commands/do_ofind.py -src/rom24/commands/do_oload.py -src/rom24/commands/do_omni.py -src/rom24/commands/do_open.py -src/rom24/commands/do_order.py -src/rom24/commands/do_oset.py -src/rom24/commands/do_ostat.py -src/rom24/commands/do_outfit.py -src/rom24/commands/do_owhere.py -src/rom24/commands/do_pardon.py -src/rom24/commands/do_password.py -src/rom24/commands/do_peace.py -src/rom24/commands/do_pecho.py -src/rom24/commands/do_pick.py -src/rom24/commands/do_pmote.py -src/rom24/commands/do_pose.py -src/rom24/commands/do_pour.py -src/rom24/commands/do_practice.py -src/rom24/commands/do_prefix.py -src/rom24/commands/do_prompt.py -src/rom24/commands/do_protect.py -src/rom24/commands/do_purge.py -src/rom24/commands/do_put.py -src/rom24/commands/do_quaff.py -src/rom24/commands/do_question.py -src/rom24/commands/do_quiet.py -src/rom24/commands/do_quit.py -src/rom24/commands/do_quote.py -src/rom24/commands/do_reboot.py -src/rom24/commands/do_recall.py -src/rom24/commands/do_recho.py -src/rom24/commands/do_recite.py -src/rom24/commands/do_reload.py -src/rom24/commands/do_remove.py -src/rom24/commands/do_rent.py -src/rom24/commands/do_replay.py -src/rom24/commands/do_reply.py -src/rom24/commands/do_report.py -src/rom24/commands/do_rescue.py -src/rom24/commands/do_rest.py -src/rom24/commands/do_restore.py -src/rom24/commands/do_return.py -src/rom24/commands/do_rstat.py -src/rom24/commands/do_sacrifice.py -src/rom24/commands/do_save.py -src/rom24/commands/do_say.py -src/rom24/commands/do_score.py -src/rom24/commands/do_scroll.py -src/rom24/commands/do_sell.py -src/rom24/commands/do_set.py -src/rom24/commands/do_shout.py -src/rom24/commands/do_show.py -src/rom24/commands/do_shutdown.py -src/rom24/commands/do_sit.py -src/rom24/commands/do_skills.py -src/rom24/commands/do_slay.py -src/rom24/commands/do_sleep.py -src/rom24/commands/do_slookup.py -src/rom24/commands/do_smote.py -src/rom24/commands/do_sneak.py -src/rom24/commands/do_snoop.py -src/rom24/commands/do_socials.py -src/rom24/commands/do_sockets.py -src/rom24/commands/do_south.py -src/rom24/commands/do_spells.py -src/rom24/commands/do_split.py -src/rom24/commands/do_sset.py -src/rom24/commands/do_stand.py -src/rom24/commands/do_stat.py -src/rom24/commands/do_steal.py -src/rom24/commands/do_string.py -src/rom24/commands/do_switch.py -src/rom24/commands/do_tabledump.py -src/rom24/commands/do_tableload.py -src/rom24/commands/do_tell.py -src/rom24/commands/do_term.py -src/rom24/commands/do_time.py -src/rom24/commands/do_title.py -src/rom24/commands/do_train.py -src/rom24/commands/do_transfer.py -src/rom24/commands/do_trip.py -src/rom24/commands/do_trust.py -src/rom24/commands/do_typo.py -src/rom24/commands/do_unalias.py -src/rom24/commands/do_unlock.py -src/rom24/commands/do_up.py -src/rom24/commands/do_value.py -src/rom24/commands/do_violate.py -src/rom24/commands/do_visible.py -src/rom24/commands/do_vnum.py -src/rom24/commands/do_wake.py -src/rom24/commands/do_wear.py -src/rom24/commands/do_weather.py -src/rom24/commands/do_west.py -src/rom24/commands/do_where.py -src/rom24/commands/do_who.py -src/rom24/commands/do_whois.py -src/rom24/commands/do_wimpy.py -src/rom24/commands/do_wizhelp.py -src/rom24/commands/do_wizlock.py -src/rom24/commands/do_wiznet.py -src/rom24/commands/do_worth.py -src/rom24/commands/do_yell.py -src/rom24/commands/do_zap.py -src/rom24/commands/do_zecho.py -src/rom24/database/__init__.py -src/rom24/database/tracker.py -src/rom24/database/read/__init__.py -src/rom24/database/read/read_tables.py -src/rom24/database/write/__init__.py -src/rom24/database/write/write_tables.py -src/rom24/miniboa/__init__.py -src/rom24/miniboa/asyncio.py -src/rom24/miniboa/colors.py -src/rom24/miniboa/telnet.py -src/rom24/miniboa/terminal.py -src/rom24/spells/__init__.py -src/rom24/spells/spell_acid_blast.py -src/rom24/spells/spell_acid_breath.py -src/rom24/spells/spell_armor.py -src/rom24/spells/spell_bless.py -src/rom24/spells/spell_blindness.py -src/rom24/spells/spell_burning_hands.py -src/rom24/spells/spell_call_lightning.py -src/rom24/spells/spell_calm.py -src/rom24/spells/spell_cancellation.py -src/rom24/spells/spell_cause_critical.py -src/rom24/spells/spell_cause_light.py -src/rom24/spells/spell_cause_serious.py -src/rom24/spells/spell_chain_lightning.py -src/rom24/spells/spell_change_sex.py -src/rom24/spells/spell_charm_person.py -src/rom24/spells/spell_chill_touch.py -src/rom24/spells/spell_colour_spray.py -src/rom24/spells/spell_continual_light.py -src/rom24/spells/spell_control_weather.py -src/rom24/spells/spell_create_food.py -src/rom24/spells/spell_create_rose.py -src/rom24/spells/spell_create_spring.py -src/rom24/spells/spell_create_water.py -src/rom24/spells/spell_cure_blindness.py -src/rom24/spells/spell_cure_critical.py -src/rom24/spells/spell_cure_disease.py -src/rom24/spells/spell_cure_light.py -src/rom24/spells/spell_cure_poison.py -src/rom24/spells/spell_cure_serious.py -src/rom24/spells/spell_curse.py -src/rom24/spells/spell_demonfire.py -src/rom24/spells/spell_detect_evil.py -src/rom24/spells/spell_detect_good.py -src/rom24/spells/spell_detect_hidden.py -src/rom24/spells/spell_detect_invis.py -src/rom24/spells/spell_detect_magic.py -src/rom24/spells/spell_detect_poison.py -src/rom24/spells/spell_dispel_evil.py -src/rom24/spells/spell_dispel_good.py -src/rom24/spells/spell_dispel_magic.py -src/rom24/spells/spell_earthquake.py -src/rom24/spells/spell_enchant_armor.py -src/rom24/spells/spell_enchant_weapon.py -src/rom24/spells/spell_energy_drain.py -src/rom24/spells/spell_faerie_fire.py -src/rom24/spells/spell_faerie_fog.py -src/rom24/spells/spell_farsight.py -src/rom24/spells/spell_fire_breath.py -src/rom24/spells/spell_fireball.py -src/rom24/spells/spell_fireproof.py -src/rom24/spells/spell_flamestrike.py -src/rom24/spells/spell_floating_disc.py -src/rom24/spells/spell_fly.py -src/rom24/spells/spell_frenzy.py -src/rom24/spells/spell_frost_breath.py -src/rom24/spells/spell_gas_breath.py -src/rom24/spells/spell_gate.py -src/rom24/spells/spell_general_purpose.py -src/rom24/spells/spell_giant_strength.py -src/rom24/spells/spell_harm.py -src/rom24/spells/spell_haste.py -src/rom24/spells/spell_heal.py -src/rom24/spells/spell_heat_metal.py -src/rom24/spells/spell_high_explosive.py -src/rom24/spells/spell_holy_word.py -src/rom24/spells/spell_identify.py -src/rom24/spells/spell_infravision.py -src/rom24/spells/spell_invis.py -src/rom24/spells/spell_know_alignment.py -src/rom24/spells/spell_lightning_bolt.py -src/rom24/spells/spell_lightning_breath.py -src/rom24/spells/spell_locate_object.py -src/rom24/spells/spell_magic_missile.py -src/rom24/spells/spell_mass_healing.py -src/rom24/spells/spell_mass_invis.py -src/rom24/spells/spell_nexus.py -src/rom24/spells/spell_pass_door.py -src/rom24/spells/spell_plague.py -src/rom24/spells/spell_poison.py -src/rom24/spells/spell_portal.py -src/rom24/spells/spell_protection_evil.py -src/rom24/spells/spell_protection_good.py -src/rom24/spells/spell_ray_of_truth.py -src/rom24/spells/spell_recharge.py -src/rom24/spells/spell_refresh.py -src/rom24/spells/spell_remove_curse.py -src/rom24/spells/spell_sanctuary.py -src/rom24/spells/spell_shield.py -src/rom24/spells/spell_shocking_grasp.py -src/rom24/spells/spell_sleep.py -src/rom24/spells/spell_slow.py -src/rom24/spells/spell_stone_skin.py -src/rom24/spells/spell_summon.py -src/rom24/spells/spell_teleport.py -src/rom24/spells/spell_ventriloquate.py -src/rom24/spells/spell_weaken.py -src/rom24/spells/spell_word_of_recall.py \ No newline at end of file diff --git a/src/rom24.egg-info/dependency_links.txt b/src/rom24.egg-info/dependency_links.txt deleted file mode 100644 index 8b13789..0000000 --- a/src/rom24.egg-info/dependency_links.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/rom24.egg-info/entry_points.txt b/src/rom24.egg-info/entry_points.txt deleted file mode 100644 index 0260ed7..0000000 --- a/src/rom24.egg-info/entry_points.txt +++ /dev/null @@ -1,3 +0,0 @@ -[console_scripts] -rom24 = rom24.pyom:pyom - diff --git a/src/rom24.egg-info/requires.txt b/src/rom24.egg-info/requires.txt deleted file mode 100644 index e874e3d..0000000 --- a/src/rom24.egg-info/requires.txt +++ /dev/null @@ -1,2 +0,0 @@ -ipdb -psutil diff --git a/src/rom24.egg-info/top_level.txt b/src/rom24.egg-info/top_level.txt deleted file mode 100644 index a91bf62..0000000 --- a/src/rom24.egg-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -rom24 From 613ce9ea443bd5a183464e5dee55e5ce8a346e96 Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Wed, 1 Dec 2021 21:46:11 -0800 Subject: [PATCH 16/40] Trying some more things. --- src/area/help.are | 25 +++++++++++++++++++-- src/rom24/comm.py | 5 +++++ src/rom24/commands/{do_at.py => do_doat.py} | 2 +- src/rom24/commands/do_get.py | 3 +++ src/rom24/commands/do_smote.py | 1 - src/rom24/commands/do_term.py | 4 ++-- src/rom24/commands/do_wizhelp.py | 13 ++++++----- src/rom24/db.py | 12 +--------- src/rom24/handler_item.py | 8 ++++--- src/rom24/handler_magic.py | 1 + src/rom24/interp.py | 2 +- 11 files changed, 50 insertions(+), 26 deletions(-) rename src/rom24/commands/{do_at.py => do_doat.py} (90%) diff --git a/src/area/help.are b/src/area/help.are index b7a0880..b728d66 100644 --- a/src/area/help.are +++ b/src/area/help.are @@ -1021,6 +1021,12 @@ is only usable by creators and implementors. Restore should be used sparingly or not at all. ~ +56 DEBUG~ +Syntax: debug + +Safely execute commands and get valuable debugging information. +~ + 57 SLAY~ Syntax: slay @@ -1028,6 +1034,21 @@ Slay kills a character in cold blood, no saving throw. Best not to use this command on players if you enjoy being a god. ~ +57 OWHERE~ +Syntax: owhere + +owhere command will allow you to find the vnum and location of keywords. The +result is the short description, vnum, and then the room or mob that carries It +along with the room vnum. + +<551hp 218m 454mv> owhere vorpal + 1) the Vorpal Blade (10407) is carried by skeletal warrior [Room 10426] + 2) the Vorpal Blade (10407) is carried by skeletal warrior [Room 10428] + +see also: OLOAD + +~ + 55 TRANSFER TELEPORT~ Syntax: transfer transfer all @@ -1040,8 +1061,8 @@ should almost never be used, as 100 players popping into one room can have horrible effects on slow links. Teleport is a synonym for transfer. ~ -54 AT~ -Syntax: at +54 DOAT~ +Syntax: doat At executes the given command (which may have arguments) at the given location. The location may be specified as a vnum, as the name of diff --git a/src/rom24/comm.py b/src/rom24/comm.py index dd3b5f0..d8859a1 100644 --- a/src/rom24/comm.py +++ b/src/rom24/comm.py @@ -242,6 +242,7 @@ def game_loop(server): logger.info("Pyom is ready to rock on port %d", server.port) done = False + errors = 0 while not done: try: server.poll() @@ -249,3 +250,7 @@ def game_loop(server): update_handler() except Exception as e: logger.exception("Exception %s caught - continuing loop.", e) + # Protect us from infinite errors. + errors += 1 + if errors > 50: + done = True diff --git a/src/rom24/commands/do_at.py b/src/rom24/commands/do_doat.py similarity index 90% rename from src/rom24/commands/do_at.py rename to src/rom24/commands/do_doat.py index dcf9c6d..30246d0 100644 --- a/src/rom24/commands/do_at.py +++ b/src/rom24/commands/do_doat.py @@ -37,4 +37,4 @@ def do_at(ch, argument): break -interp.register_command(interp.cmd_type('at', do_at, merc.POS_DEAD, merc.L6, merc.LOG_NORMAL, 1)) +interp.register_command(interp.cmd_type('doat', do_at, merc.POS_DEAD, merc.L6, merc.LOG_NORMAL, 1)) diff --git a/src/rom24/commands/do_get.py b/src/rom24/commands/do_get.py index d486626..0fed9e6 100644 --- a/src/rom24/commands/do_get.py +++ b/src/rom24/commands/do_get.py @@ -12,6 +12,7 @@ def do_get(ch, argument): + logger.info("%s tried to get %s", ch.name, argument) argument, arg1 = game_utils.read_word(argument) argument, arg2 = game_utils.read_word(argument) if arg2 == "from": @@ -21,6 +22,7 @@ def do_get(ch, argument): if not arg1: ch.send("Get what?\n") return + if not arg2: if not arg1.startswith('all'): # 'get obj' @@ -28,6 +30,7 @@ def do_get(ch, argument): if not item: handler_game.act("I see no $T here.", ch, None, arg1, merc.TO_CHAR) return + logger.info("Handling get item for %s", item) handler_item.get_item(ch, item, None) else: # 'get all' or 'get all.obj' diff --git a/src/rom24/commands/do_smote.py b/src/rom24/commands/do_smote.py index fb0cb53..feb287b 100644 --- a/src/rom24/commands/do_smote.py +++ b/src/rom24/commands/do_smote.py @@ -9,7 +9,6 @@ def do_smote(ch, argument): - matches = 0 if not ch.is_npc() and ch.comm.is_set(merc.COMM_NOEMOTE): ch.send("You can't show your emotions.\n") return diff --git a/src/rom24/commands/do_term.py b/src/rom24/commands/do_term.py index 939894c..35b27d6 100644 --- a/src/rom24/commands/do_term.py +++ b/src/rom24/commands/do_term.py @@ -10,7 +10,7 @@ def usage(ch): ch.send('Usage: term [[ttype]] [[cols N]] [[rows N]]\n') - ch.send(' valid ttypes are %s.\n\n' % ', '.join(miniboa.TERMINAL_TYPES)) + ch.send(' valid ttypes are %s.\n\n' % ', '.join(miniboa.colors.TERMINAL_TYPES)) def do_term(ch, argument): @@ -46,7 +46,7 @@ def do_term(ch, argument): ch.send('Invalid argument: %s\n\n' % a) usage(ch) return - elif not got_type and a.lower() in miniboa.TERMINAL_TYPES: + elif not got_type and a.lower() in miniboa.colors.TERMINAL_TYPES: ch.desc.terminal_type = a.lower() got_type = True changed = True diff --git a/src/rom24/commands/do_wizhelp.py b/src/rom24/commands/do_wizhelp.py index 3904187..e48046d 100644 --- a/src/rom24/commands/do_wizhelp.py +++ b/src/rom24/commands/do_wizhelp.py @@ -9,11 +9,14 @@ def do_wizhelp(ch, argument): col = 0 for key, cmd in interp.cmd_table.items(): - if merc.LEVEL_HERO <= cmd.level <= ch.trust and cmd.show: - ch.send("%-12s" % key) - col += 1 - if col % 6 == 0: - ch.send("\n") + try: + if merc.LEVEL_HERO <= cmd.level <= ch.trust and cmd.show: + ch.send("%-12s" % key) + col += 1 + if col % 6 == 0: + ch.send("\n") + except: + logger.exception("Error parsing %s: %s", key, cmd) if col % 6 != 0: ch.send("\n") return diff --git a/src/rom24/db.py b/src/rom24/db.py index e465cd2..0d35941 100644 --- a/src/rom24/db.py +++ b/src/rom24/db.py @@ -296,17 +296,7 @@ def g_e_reset(pReset, last, level, npc): limit = pReset.arg2 if itemTemplate.count < limit or random.randint(0, 4) == 0: - item = object_creator.create_item(itemTemplate, - min(game_utils.number_fuzzy(level), merc.LEVEL_HERO - 1)) - # error message if it is too high */ - if item.level > npc.level + 3 \ - or (item.item_type == merc.ITEM_WEAPON - and pReset.command == 'E' - and item.level < npc.level - 5 - and item.level < 45): - logger.error("Err: obj %s (%d) -- %d, mob %s (%d) -- %d", - item.short_descr, item.vnum, item.level, - npc.short_descr, npc.vnum, npc.level) + item = object_creator.create_item(itemTemplate, min(game_utils.number_fuzzy(level), merc.LEVEL_HERO - 1)) else: return last, level, npc npc.put(item) diff --git a/src/rom24/handler_item.py b/src/rom24/handler_item.py index 32b194c..3aba954 100644 --- a/src/rom24/handler_item.py +++ b/src/rom24/handler_item.py @@ -573,9 +573,6 @@ def load_inventory(self, player_name: str=None): if not isinstance(obj, Items): raise TypeError('Could not load instance %r!' % number) -images = ['*.jpg', '*.jpeg', '*.png', '*.tif', '*.tiff'] -matches = [] - def get_item(ch, item, this_container): # variables for AUTOSPLIT @@ -593,6 +590,8 @@ def get_item(ch, item, this_container): and (state_checks.get_carry_weight(ch) + item.get_weight() > ch.can_carry_w()): handler_game.act("$d: you can't carry that much weight.", ch, None, item.name, merc.TO_CHAR) return + + # Make sure nobody is using the item before we allow someone to get it. if item.in_room: for gch_id in item.in_room.people[:]: gch = instance.characters[gch_id] @@ -601,6 +600,7 @@ def get_item(ch, item, this_container): if on_item.instance_id in item.in_room.items: handler_game.act("$N appears to be using $p.", ch, item, gch, merc.TO_CHAR) return + # Get things from a container. if this_container: if this_container.vnum == merc.OBJ_VNUM_PIT and ch.trust < item.level: ch.send("You are not powerful enough to use it.\n") @@ -611,10 +611,12 @@ def get_item(ch, item, this_container): handler_game.act("$n gets $p from $P.", ch, item, this_container, merc.TO_ROOM) item.flags.had_timer = False this_container.get(item) + # Get a normal thing. else: handler_game.act("You get $p.", ch, item, this_container, merc.TO_CHAR) handler_game.act("$n gets $p.", ch, item, this_container, merc.TO_ROOM) ch.in_room.get(item) + if item.item_type == merc.ITEM_MONEY: ch.silver += item.value[0] ch.gold += item.value[1] diff --git a/src/rom24/handler_magic.py b/src/rom24/handler_magic.py index dc1afc9..ffa441a 100644 --- a/src/rom24/handler_magic.py +++ b/src/rom24/handler_magic.py @@ -10,6 +10,7 @@ from rom24 import handler_game from rom24 import state_checks from rom24 import game_utils +from rom24 import instance #Magic functions def say_spell(ch, spell): diff --git a/src/rom24/interp.py b/src/rom24/interp.py index 3677d93..84affe3 100644 --- a/src/rom24/interp.py +++ b/src/rom24/interp.py @@ -27,7 +27,7 @@ def __init__(self, name, do_fun, position, level, log, show, default_arg=None): cmd_table['west'] = None cmd_table['up'] = None cmd_table['down'] = None -cmd_table['at'] = None +cmd_table['doat'] = None cmd_table['buy'] = None cmd_table['cast'] = None cmd_table['follow'] = None From a24bd4e2b17babf8f757117029188a3aaaaf9e3f Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Wed, 1 Dec 2021 22:49:22 -0800 Subject: [PATCH 17/40] Update README.md --- README.md | 56 +++++-------------------------------------------------- 1 file changed, 5 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index b328790..2bc928f 100644 --- a/README.md +++ b/README.md @@ -1,52 +1,19 @@ ## Welcome to the Pyom project! ## -*Pyom* is a re-authoring of the *Rom DikuMUD* derivative, using version 3 of the -python programming language. We've tried to use as few external modules as +*rom24* is a re-authoring of the *Rom DikuMUD* derivative using python3. +We've tried to use as few external modules as possible, but are using the excellent *Miniboa* telnet stack as our core. -In most cases, we're trying to keep the overall feel of the code to be -familiar to people who have worked on the original C implementation of Rom. -Changes are being made where they have to be, often due to *Rom* relying on C -specific memory handling tricks, or where it simplifies something by -re-factoring it. - -For example, the old **send_to_char()** function has been replaced by a send() -method in the character class, giving us the much simpler **ch.send()** method. - The initial goal of the project is to provide a fully working copy of *Rom*, in python, which can act as a stepping stone to help others convert their aging C dikurivatives to a more modern language. On today's hardware, there is little value in over-optimizing such a small project, and a great deal to gain by allowing fast and easy coding. -We've included a modified version of *Miniboa*. The original can be found [here](https://code.google.com/p/miniboa/). - -and for Python 3, [here](https://code.google.com/p/miniboa-py3/). - -You are, of course, required to follow all the licenses of everything this -code was derived from. This includes the *Miniboa* license, and the licenses -for *Rom*, *Merc*, and *DikuMUD*. - -The original C source and data files are included for comparison. The root -of the python project itself is in **./Rom24/pysrc/**, and this should be used as -the source directory for any IDE you might use. +Licensing is still in force, please see the docs for licensing information. ## Installation and Usage ## -### Windows ### - -1. Grab and install a copy of the latest version of Python3 (currently tested on 3.4.x) -1. Ensure that the Python directory is available on your PATH environment variable -1. Open a new command prompt window -1. Navigate to "~/pyom/Rom24/pysrc/" -1. Run "python pyom.py" - -If all went well, you should be seeing a barrage of initialization messages and the MUD will be booting up. By default the MUD uses port 1337. You can connect to localhost:1337 and login. - -A basic interactive shell is available in **shell.py**. Various configuration -options can be adjusted in **settings.py**. If you're running from a command -line - ``` cd PyRom pip install -e . @@ -56,20 +23,7 @@ rom24 ## Configuring an Implementor Character ## -An Implementor is a superadmin/root/GM/immortal that has all privilages. To set your first character up as an Implementor: - -1. Create a character -1. Get to level 2 -1. Save and log out -1. Locate your character file in "~pyom/Rom24/player/.json" -1. Open and modify the Trust (Tru) and Level (Levl) variables to 60 -1. Save the file -1. Log back into your character -1. If you have access to commands like "load" "restore" and "vnum" then you are an implementor - -This isn't finished, and we're still learning python, so things may be -flat-out broken, or done in a really inefficient or silly way, as we unlearn -bad habits C has taught us. +This isn't finished. In case you found this elsewhere, the actual up-to-date home of the project is [here](https://bitbucket.org/mudbytes/pyom). @@ -78,4 +32,4 @@ You can also contact our project lead, Davion, via PM at [mudbytes](http://www.m We hope you have fun with this, and find it useful! - -Quixadhal. \ No newline at end of file + -Quixadhal. From 0d22f1493c614981517b456ce0fda74b712afd0e Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Wed, 1 Dec 2021 23:10:54 -0800 Subject: [PATCH 18/40] Update README.md --- README.md | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 2bc928f..5850991 100644 --- a/README.md +++ b/README.md @@ -19,17 +19,28 @@ cd PyRom pip install -e . rom24 ``` - should get things started. If +Normal python install via pip should get things started. -## Configuring an Implementor Character ## +The more up-to-date home of the project that this was not forked from is [here](https://bitbucket.org/mudbytes/pyom). -This isn't finished. +## TO DO ## -In case you found this elsewhere, the actual up-to-date home of the project -is [here](https://bitbucket.org/mudbytes/pyom). +* Straighten out legacy loads vs. new loads and remove anything legacy +* Make data consistently relative and make it deployable in docker with volumes +* Add docker and compose for simple local build and testing +* Start adding basic type checking +* start adding some unit testing +* Move to a more functional paradigm for as much as possible to improve iteration speed (less stateful class shenanigans is better imho) +* Add docstrings to everything as I figure out what the hell it's doing +* Make sure licensing and credits are all still there +* Fix lots and lots of bugs +* Investigate sqllite or another alternative instead of straight json files for performance and sanity +* Change to a real data structure instead of custom class json hooks +* add debug logging everywhere under the sun so it's easier to tell why things are breaking +* Refactor to remove circular dependencies (This is going to be a lot of work, and means stateful classes and functions will have to be redone) but will be worth it. -You can also contact our project lead, Davion, via PM at [mudbytes](http://www.mudbytes.net/). +## Contributing ## -We hope you have fun with this, and find it useful! +For the love of god, someone please help - I'm doing this because it's fun, but it's more fun to do it together! Just PR changes - I'm not going to be very picky as long as they're an improvement. - -Quixadhal. +Even if you just pull it and test it locally to open bugs, opening bugs is awesome and appreciated. If you're interested in becoming an owner on the repo, send me an email at bubthegreat@gmail.com From ac254f56eb449c2f94c91c3e95fab2b7b0330fcb Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Wed, 1 Dec 2021 23:15:39 -0800 Subject: [PATCH 19/40] Added scan command --- src/rom24/commands/do_scan.py | 81 +++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 src/rom24/commands/do_scan.py diff --git a/src/rom24/commands/do_scan.py b/src/rom24/commands/do_scan.py new file mode 100644 index 0000000..b310673 --- /dev/null +++ b/src/rom24/commands/do_scan.py @@ -0,0 +1,81 @@ +import logging + +logger = logging.getLogger(__name__) + +from rom24 import merc +from rom24 import handler_game +from rom24 import game_utils +from rom24 import instance +from rom24 import interp +from rom24 import state_checks + + +distance = ["right here.", "nearby to the %s.", "not far %s.", "off in the distance %s."] + +# Thanks to Zrin for auto-exit part. +def do_scan(ch, argument): + argument, arg1 = game_utils.read_word(argument) + + if not arg1: + handler_game.act("$n looks all around.", ch, None, None, merc.TO_ROOM) + ch.send("Looking around you see:\n") + scan_list(ch.in_room, ch, 0, -1) + + for door, pexit in enumerate(ch.in_room.exit): + if pexit is not None and pexit.to_room: + scan_room = instance.rooms[pexit.to_room] + scan_list(scan_room, ch, 1, door) + return + + if arg1.startswith("n"): + door = 0 + elif arg1.startswith("e"): + door = 1 + elif arg1.startswith("s"): + door = 2 + elif arg1.startswith("w"): + door = 3 + elif arg1.startswith("u"): + door = 4 + elif arg1.startswith("d"): + door = 5 + else: + ch.send("Which way do you want to scan?\n") + return + + handler_game.act("You peer intently $T.", ch, None, merc.dir_name[door], merc.TO_CHAR) + handler_game.act("$n peers intently $T.", ch, None, merc.dir_name[door], merc.TO_ROOM) + + scan_room = ch.in_room + + for depth in range(1,4): + pexit = scan_room.exit[door] + if pexit: + scan_room = instance.rooms[pexit.to_room] + scan_list(scan_room, ch, depth, door) + + return + +def scan_list(scan_room, ch, depth, door): + if not scan_room: + return + + for person_id in scan_room.people: + person = instance.characters[person_id] + if person == ch: continue + if person.is_pc and person.invis_level > ch.trust: continue + if ch.can_see(person): scan_ch(person, ch, depth, door) + return + +def scan_ch(victim, ch, depth, door): + buf = state_checks.PERS(victim, ch) + buf = buf + ", " + if door != -1: + buf2 = distance[depth] % (merc.dir_name[door]) + else: + buf2 = distance[depth] + buf = buf + buf2 + "\n" + ch.send(buf) + return + +interp.register_command(interp.cmd_type('scan', do_scan, merc.POS_STANDING, 0, merc.LOG_NORMAL, 1)) \ No newline at end of file From 7611869e876b1ab4cbcc022ff4b6c3816eb2bc96 Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Wed, 1 Dec 2021 23:19:01 -0800 Subject: [PATCH 20/40] Adding black formatting --- requirements.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/requirements.txt b/requirements.txt index 755a1d2..89330e4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,4 @@ psutil ipdb +mypy +black From c89e710b314d1824968367a55382d7cb11784cb6 Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Wed, 1 Dec 2021 23:24:45 -0800 Subject: [PATCH 21/40] Adding black for autoformatting and formatted --- src/rom24/affects.py | 18 +- src/rom24/auth.py | 50 +- src/rom24/bit.py | 108 +- src/rom24/comm.py | 137 +- src/rom24/commands/do_advance.py | 9 +- src/rom24/commands/do_affects.py | 9 +- src/rom24/commands/do_afk.py | 4 +- src/rom24/commands/do_alias.py | 9 +- src/rom24/commands/do_answer.py | 23 +- src/rom24/commands/do_apickle.py | 20 +- src/rom24/commands/do_areas.py | 4 +- src/rom24/commands/do_auction.py | 24 +- src/rom24/commands/do_authenticator.py | 57 +- src/rom24/commands/do_autoassist.py | 4 +- src/rom24/commands/do_autoexit.py | 4 +- src/rom24/commands/do_autogold.py | 4 +- src/rom24/commands/do_autolist.py | 4 +- src/rom24/commands/do_autoloot.py | 4 +- src/rom24/commands/do_autosac.py | 4 +- src/rom24/commands/do_autosplit.py | 4 +- src/rom24/commands/do_backstab.py | 40 +- src/rom24/commands/do_bamfin.py | 4 +- src/rom24/commands/do_bamfout.py | 4 +- src/rom24/commands/do_bash.py | 87 +- src/rom24/commands/do_berserk.py | 32 +- src/rom24/commands/do_brandish.py | 23 +- src/rom24/commands/do_brief.py | 4 +- src/rom24/commands/do_bug.py | 4 +- src/rom24/commands/do_buy.py | 71 +- src/rom24/commands/do_cast.py | 33 +- src/rom24/commands/do_channels.py | 4 +- src/rom24/commands/do_clantalk.py | 18 +- src/rom24/commands/do_clone.py | 29 +- src/rom24/commands/do_close.py | 13 +- src/rom24/commands/do_combine.py | 4 +- src/rom24/commands/do_commands.py | 4 +- src/rom24/commands/do_compact.py | 4 +- src/rom24/commands/do_compare.py | 12 +- src/rom24/commands/do_consider.py | 4 +- src/rom24/commands/do_count.py | 18 +- src/rom24/commands/do_deaf.py | 8 +- src/rom24/commands/do_debug.py | 19 +- src/rom24/commands/do_delete.py | 13 +- src/rom24/commands/do_deny.py | 13 +- src/rom24/commands/do_description.py | 12 +- src/rom24/commands/do_dirt.py | 67 +- src/rom24/commands/do_disarm.py | 35 +- src/rom24/commands/do_disconnect.py | 10 +- src/rom24/commands/do_doat.py | 11 +- src/rom24/commands/do_down.py | 5 +- src/rom24/commands/do_drink.py | 24 +- src/rom24/commands/do_drop.py | 36 +- src/rom24/commands/do_dump.py | 6 +- src/rom24/commands/do_east.py | 4 +- src/rom24/commands/do_eat.py | 4 +- src/rom24/commands/do_echo.py | 4 +- src/rom24/commands/do_emote.py | 8 +- src/rom24/commands/do_enter.py | 116 +- src/rom24/commands/do_envenom.py | 45 +- src/rom24/commands/do_equipment.py | 12 +- src/rom24/commands/do_examine.py | 19 +- src/rom24/commands/do_exits.py | 23 +- src/rom24/commands/do_fill.py | 22 +- src/rom24/commands/do_flags.py | 133 +- src/rom24/commands/do_flee.py | 28 +- src/rom24/commands/do_follow.py | 20 +- src/rom24/commands/do_force.py | 28 +- src/rom24/commands/do_freeze.py | 23 +- src/rom24/commands/do_freset.py | 4 +- src/rom24/commands/do_gain.py | 129 +- src/rom24/commands/do_get.py | 43 +- src/rom24/commands/do_give.py | 67 +- src/rom24/commands/do_gossip.py | 27 +- src/rom24/commands/do_goto.py | 19 +- src/rom24/commands/do_grats.py | 23 +- src/rom24/commands/do_group.py | 82 +- src/rom24/commands/do_groups.py | 8 +- src/rom24/commands/do_gtell.py | 21 +- src/rom24/commands/do_guild.py | 4 +- src/rom24/commands/do_heal.py | 20 +- src/rom24/commands/do_help.py | 44 +- src/rom24/commands/do_hide.py | 9 +- src/rom24/commands/do_holylight.py | 6 +- src/rom24/commands/do_immtalk.py | 19 +- src/rom24/commands/do_incognito.py | 6 +- src/rom24/commands/do_inventory.py | 4 +- src/rom24/commands/do_invis.py | 20 +- src/rom24/commands/do_kick.py | 23 +- src/rom24/commands/do_kill.py | 8 +- src/rom24/commands/do_list.py | 27 +- src/rom24/commands/do_load.py | 4 +- src/rom24/commands/do_lock.py | 16 +- src/rom24/commands/do_log.py | 6 +- src/rom24/commands/do_look.py | 49 +- src/rom24/commands/do_memory.py | 6 +- src/rom24/commands/do_mfind.py | 4 +- src/rom24/commands/do_mload.py | 13 +- src/rom24/commands/do_mset.py | 21 +- src/rom24/commands/do_mstat.py | 181 +- src/rom24/commands/do_murder.py | 13 +- src/rom24/commands/do_music.py | 22 +- src/rom24/commands/do_mwhere.py | 48 +- src/rom24/commands/do_newlock.py | 4 +- src/rom24/commands/do_nochannels.py | 24 +- src/rom24/commands/do_noemote.py | 22 +- src/rom24/commands/do_nofollow.py | 4 +- src/rom24/commands/do_noloot.py | 4 +- src/rom24/commands/do_north.py | 4 +- src/rom24/commands/do_noshout.py | 23 +- src/rom24/commands/do_nosummon.py | 5 +- src/rom24/commands/do_notell.py | 22 +- src/rom24/commands/do_ofind.py | 9 +- src/rom24/commands/do_oload.py | 8 +- src/rom24/commands/do_omni.py | 4 +- src/rom24/commands/do_open.py | 8 +- src/rom24/commands/do_order.py | 23 +- src/rom24/commands/do_oset.py | 5 +- src/rom24/commands/do_ostat.py | 132 +- src/rom24/commands/do_outfit.py | 16 +- src/rom24/commands/do_owhere.py | 44 +- src/rom24/commands/do_pardon.py | 4 +- src/rom24/commands/do_password.py | 4 +- src/rom24/commands/do_peace.py | 4 +- src/rom24/commands/do_pecho.py | 4 +- src/rom24/commands/do_pick.py | 38 +- src/rom24/commands/do_pmote.py | 4 +- src/rom24/commands/do_pose.py | 34 +- src/rom24/commands/do_pour.py | 74 +- src/rom24/commands/do_practice.py | 37 +- src/rom24/commands/do_prefix.py | 9 +- src/rom24/commands/do_prompt.py | 4 +- src/rom24/commands/do_protect.py | 18 +- src/rom24/commands/do_purge.py | 12 +- src/rom24/commands/do_put.py | 46 +- src/rom24/commands/do_quaff.py | 5 +- src/rom24/commands/do_question.py | 22 +- src/rom24/commands/do_quiet.py | 4 +- src/rom24/commands/do_quit.py | 14 +- src/rom24/commands/do_quote.py | 24 +- src/rom24/commands/do_reboot.py | 9 +- src/rom24/commands/do_recall.py | 17 +- src/rom24/commands/do_recho.py | 4 +- src/rom24/commands/do_recite.py | 8 +- src/rom24/commands/do_reload.py | 4 +- src/rom24/commands/do_remove.py | 4 +- src/rom24/commands/do_rent.py | 4 +- src/rom24/commands/do_replay.py | 4 +- src/rom24/commands/do_reply.py | 50 +- src/rom24/commands/do_report.py | 25 +- src/rom24/commands/do_rescue.py | 12 +- src/rom24/commands/do_rest.py | 73 +- src/rom24/commands/do_restore.py | 13 +- src/rom24/commands/do_return.py | 18 +- src/rom24/commands/do_rstat.py | 53 +- src/rom24/commands/do_sacrifice.py | 33 +- src/rom24/commands/do_save.py | 6 +- src/rom24/commands/do_say.py | 11 +- src/rom24/commands/do_scan.py | 33 +- src/rom24/commands/do_score.py | 102 +- src/rom24/commands/do_scroll.py | 9 +- src/rom24/commands/do_sell.py | 33 +- src/rom24/commands/do_set.py | 4 +- src/rom24/commands/do_shout.py | 14 +- src/rom24/commands/do_show.py | 4 +- src/rom24/commands/do_shutdown.py | 8 +- src/rom24/commands/do_sit.py | 37 +- src/rom24/commands/do_skills.py | 17 +- src/rom24/commands/do_slay.py | 8 +- src/rom24/commands/do_sleep.py | 28 +- src/rom24/commands/do_slookup.py | 14 +- src/rom24/commands/do_smote.py | 6 +- src/rom24/commands/do_sneak.py | 8 +- src/rom24/commands/do_snoop.py | 25 +- src/rom24/commands/do_socials.py | 4 +- src/rom24/commands/do_sockets.py | 30 +- src/rom24/commands/do_south.py | 4 +- src/rom24/commands/do_spells.py | 17 +- src/rom24/commands/do_split.py | 36 +- src/rom24/commands/do_sset.py | 6 +- src/rom24/commands/do_stand.py | 34 +- src/rom24/commands/do_stat.py | 4 +- src/rom24/commands/do_steal.py | 51 +- src/rom24/commands/do_string.py | 4 +- src/rom24/commands/do_switch.py | 24 +- src/rom24/commands/do_tabledump.py | 7 +- src/rom24/commands/do_tableload.py | 6 +- src/rom24/commands/do_tell.py | 39 +- src/rom24/commands/do_term.py | 30 +- src/rom24/commands/do_time.py | 61 +- src/rom24/commands/do_title.py | 4 +- src/rom24/commands/do_train.py | 23 +- src/rom24/commands/do_transfer.py | 33 +- src/rom24/commands/do_trip.py | 78 +- src/rom24/commands/do_trust.py | 4 +- src/rom24/commands/do_typo.py | 4 +- src/rom24/commands/do_unalias.py | 4 +- src/rom24/commands/do_unlock.py | 11 +- src/rom24/commands/do_up.py | 4 +- src/rom24/commands/do_value.py | 24 +- src/rom24/commands/do_violate.py | 12 +- src/rom24/commands/do_visible.py | 4 +- src/rom24/commands/do_vnum.py | 4 +- src/rom24/commands/do_wake.py | 6 +- src/rom24/commands/do_wear.py | 12 +- src/rom24/commands/do_weather.py | 16 +- src/rom24/commands/do_west.py | 4 +- src/rom24/commands/do_where.py | 44 +- src/rom24/commands/do_who.py | 30 +- src/rom24/commands/do_whois.py | 18 +- src/rom24/commands/do_wimpy.py | 4 +- src/rom24/commands/do_wizhelp.py | 4 +- src/rom24/commands/do_wizlock.py | 4 +- src/rom24/commands/do_wiznet.py | 10 +- src/rom24/commands/do_worth.py | 15 +- src/rom24/commands/do_yell.py | 16 +- src/rom24/commands/do_zap.py | 40 +- src/rom24/commands/do_zecho.py | 12 +- src/rom24/const.py | 53 +- src/rom24/data_loader.py | 178 +- src/rom24/database/read/read_tables.py | 14 +- src/rom24/database/tracker.py | 116 +- src/rom24/database/write/__init__.py | 2 +- src/rom24/database/write/write_tables.py | 8 +- src/rom24/db.py | 161 +- src/rom24/effects.py | 52 +- src/rom24/environment.py | 69 +- src/rom24/equipment.py | 66 +- src/rom24/fight.py | 438 ++-- src/rom24/game_utils.py | 424 +-- src/rom24/handler_ch.py | 149 +- src/rom24/handler_game.py | 93 +- src/rom24/handler_item.py | 366 ++- src/rom24/handler_log.py | 82 +- src/rom24/handler_magic.py | 108 +- src/rom24/handler_npc.py | 45 +- src/rom24/handler_pc.py | 214 +- src/rom24/handler_room.py | 155 +- src/rom24/hotfix.py | 53 +- src/rom24/immortal.py | 2 +- src/rom24/instance.py | 91 +- src/rom24/interp.py | 40 +- src/rom24/inventory.py | 6 +- src/rom24/item_flags.py | 496 ++-- src/rom24/living.py | 593 +++-- src/rom24/magic.py | 3 - src/rom24/merc.py | 482 ++-- src/rom24/miniboa/asyncio.py | 31 +- src/rom24/miniboa/colors.py | 2762 +++++++++++++++++--- src/rom24/miniboa/telnet.py | 115 +- src/rom24/miniboa/terminal.py | 83 +- src/rom24/nanny.py | 126 +- src/rom24/object_creator.py | 182 +- src/rom24/pyom.py | 8 +- src/rom24/pyprogs.py | 142 +- src/rom24/save.py | 242 +- src/rom24/settings.py | 57 +- src/rom24/shell.py | 3 +- src/rom24/shop_utils.py | 33 +- src/rom24/skills.py | 157 +- src/rom24/special.py | 356 ++- src/rom24/spells/spell_acid_blast.py | 22 +- src/rom24/spells/spell_acid_breath.py | 26 +- src/rom24/spells/spell_armor.py | 26 +- src/rom24/spells/spell_bless.py | 46 +- src/rom24/spells/spell_blindness.py | 26 +- src/rom24/spells/spell_burning_hands.py | 81 +- src/rom24/spells/spell_call_lightning.py | 46 +- src/rom24/spells/spell_calm.py | 38 +- src/rom24/spells/spell_cancellation.py | 91 +- src/rom24/spells/spell_cause_critical.py | 22 +- src/rom24/spells/spell_cause_light.py | 26 +- src/rom24/spells/spell_cause_serious.py | 26 +- src/rom24/spells/spell_chain_lightning.py | 75 +- src/rom24/spells/spell_change_sex.py | 34 +- src/rom24/spells/spell_charm_person.py | 41 +- src/rom24/spells/spell_chill_touch.py | 81 +- src/rom24/spells/spell_colour_spray.py | 85 +- src/rom24/spells/spell_continual_light.py | 38 +- src/rom24/spells/spell_control_weather.py | 22 +- src/rom24/spells/spell_create_food.py | 27 +- src/rom24/spells/spell_create_rose.py | 26 +- src/rom24/spells/spell_create_spring.py | 26 +- src/rom24/spells/spell_create_water.py | 27 +- src/rom24/spells/spell_cure_blindness.py | 30 +- src/rom24/spells/spell_cure_critical.py | 22 +- src/rom24/spells/spell_cure_disease.py | 34 +- src/rom24/spells/spell_cure_light.py | 22 +- src/rom24/spells/spell_cure_poison.py | 30 +- src/rom24/spells/spell_cure_serious.py | 22 +- src/rom24/spells/spell_curse.py | 47 +- src/rom24/spells/spell_demonfire.py | 42 +- src/rom24/spells/spell_detect_evil.py | 28 +- src/rom24/spells/spell_detect_good.py | 28 +- src/rom24/spells/spell_detect_hidden.py | 28 +- src/rom24/spells/spell_detect_invis.py | 28 +- src/rom24/spells/spell_detect_magic.py | 28 +- src/rom24/spells/spell_detect_poison.py | 23 +- src/rom24/spells/spell_dispel_evil.py | 26 +- src/rom24/spells/spell_dispel_good.py | 26 +- src/rom24/spells/spell_dispel_magic.py | 101 +- src/rom24/spells/spell_earthquake.py | 30 +- src/rom24/spells/spell_enchant_armor.py | 35 +- src/rom24/spells/spell_enchant_weapon.py | 34 +- src/rom24/spells/spell_energy_drain.py | 22 +- src/rom24/spells/spell_faerie_fire.py | 28 +- src/rom24/spells/spell_faerie_fog.py | 32 +- src/rom24/spells/spell_farsight.py | 22 +- src/rom24/spells/spell_fire_breath.py | 34 +- src/rom24/spells/spell_fireball.py | 81 +- src/rom24/spells/spell_fireproof.py | 36 +- src/rom24/spells/spell_flamestrike.py | 22 +- src/rom24/spells/spell_floating_disc.py | 26 +- src/rom24/spells/spell_fly.py | 28 +- src/rom24/spells/spell_frenzy.py | 54 +- src/rom24/spells/spell_frost_breath.py | 38 +- src/rom24/spells/spell_gas_breath.py | 34 +- src/rom24/spells/spell_gate.py | 66 +- src/rom24/spells/spell_general_purpose.py | 22 +- src/rom24/spells/spell_giant_strength.py | 30 +- src/rom24/spells/spell_harm.py | 22 +- src/rom24/spells/spell_haste.py | 38 +- src/rom24/spells/spell_heal.py | 22 +- src/rom24/spells/spell_heat_metal.py | 151 +- src/rom24/spells/spell_high_explosive.py | 23 +- src/rom24/spells/spell_holy_word.py | 49 +- src/rom24/spells/spell_identify.py | 150 +- src/rom24/spells/spell_infravision.py | 26 +- src/rom24/spells/spell_invis.py | 24 +- src/rom24/spells/spell_know_alignment.py | 22 +- src/rom24/spells/spell_lightning_bolt.py | 81 +- src/rom24/spells/spell_lightning_breath.py | 34 +- src/rom24/spells/spell_locate_object.py | 42 +- src/rom24/spells/spell_magic_missile.py | 81 +- src/rom24/spells/spell_mass_healing.py | 32 +- src/rom24/spells/spell_mass_invis.py | 26 +- src/rom24/spells/spell_nexus.py | 83 +- src/rom24/spells/spell_pass_door.py | 28 +- src/rom24/spells/spell_plague.py | 37 +- src/rom24/spells/spell_poison.py | 65 +- src/rom24/spells/spell_portal.py | 68 +- src/rom24/spells/spell_protection_evil.py | 27 +- src/rom24/spells/spell_protection_good.py | 27 +- src/rom24/spells/spell_ray_of_truth.py | 38 +- src/rom24/spells/spell_recharge.py | 30 +- src/rom24/spells/spell_refresh.py | 22 +- src/rom24/spells/spell_remove_curse.py | 40 +- src/rom24/spells/spell_sanctuary.py | 32 +- src/rom24/spells/spell_shield.py | 30 +- src/rom24/spells/spell_shocking_grasp.py | 81 +- src/rom24/spells/spell_sleep.py | 32 +- src/rom24/spells/spell_slow.py | 40 +- src/rom24/spells/spell_stone_skin.py | 26 +- src/rom24/spells/spell_summon.py | 58 +- src/rom24/spells/spell_teleport.py | 42 +- src/rom24/spells/spell_ventriloquate.py | 4 +- src/rom24/spells/spell_weaken.py | 26 +- src/rom24/spells/spell_word_of_recall.py | 26 +- src/rom24/state_checks.py | 18 +- src/rom24/sys_utils.py | 41 +- src/rom24/tables.py | 7 +- src/rom24/type_bypass.py | 7 +- src/rom24/uait/legacy_loads.py | 263 +- src/rom24/update.py | 329 ++- src/rom24/world_classes.py | 126 +- 364 files changed, 13115 insertions(+), 5291 deletions(-) diff --git a/src/rom24/affects.py b/src/rom24/affects.py index 7bef2db..474fa4a 100644 --- a/src/rom24/affects.py +++ b/src/rom24/affects.py @@ -1,4 +1,3 @@ - import copy import json import logging @@ -32,7 +31,7 @@ def to_json(self, outer_encoder=None): else: tmp_dict[k] = v - cls_name = '__class__/' + __name__ + '.' + self.__class__.__name__ + cls_name = "__class__/" + __name__ + "." + self.__class__.__name__ return {cls_name: outer_encoder(tmp_dict)} @classmethod @@ -40,7 +39,7 @@ def from_json(cls, data, outer_decoder=None): if outer_decoder is None: outer_decoder = json.JSONDecoder.decode - cls_name = '__class__/' + __name__ + '.' + cls.__name__ + cls_name = "__class__/" + __name__ + "." + cls.__name__ if cls_name in data: tmp_data = outer_decoder(data[cls_name]) return cls(**tmp_data) @@ -50,7 +49,9 @@ def is_affected(self, aff): if isinstance(aff, const.skill_type): aff = aff.name if type(aff) == str: - return True if [paf for paf in self.affected if paf.type == aff][:1] else False + return ( + True if [paf for paf in self.affected if paf.type == aff][:1] else False + ) return self.affected_by.is_set(aff) def affect_add(self, paf): @@ -72,6 +73,7 @@ def affect_join(self, paf): self.affect_add(paf) return + # * Remove an affect from a char. def affect_remove(self, paf): if not self.affected: @@ -218,8 +220,12 @@ def affect_modify(self, paf, fAdd): # * Check for weapon wielding. # * Guard against recursion (for weapons with affects). wield = self.slots.main_hand - if not self.is_npc() and wield \ - and wield.get_weight() > (const.str_app[self.stat(merc.STAT_STR)].wield * 10): + if ( + not self.is_npc() + and wield + and wield.get_weight() + > (const.str_app[self.stat(merc.STAT_STR)].wield * 10) + ): global depth if depth == 0: depth += 1 diff --git a/src/rom24/auth.py b/src/rom24/auth.py index b5e0a62..9b23fb5 100644 --- a/src/rom24/auth.py +++ b/src/rom24/auth.py @@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -__author__ = 'quixadhal' +__author__ = "quixadhal" import time import struct @@ -65,7 +65,8 @@ class is initialized, it is passed that secret key. If no secret is enter a 6 digit number, zero-padded. This number can then be passed to the verify() method, which will return True or False. """ - def __init__(self, s: str='ABCDEFGHIJKLMNOP'): + + def __init__(self, s: str = "ABCDEFGHIJKLMNOP"): """ Initializes the class with a secret key, using an application-wide default if none is provided. @@ -75,12 +76,12 @@ def __init__(self, s: str='ABCDEFGHIJKLMNOP'): :return: :rtype: """ - if '-' in s: - s = s.replace('-', '') - self._raw_secret = s.upper().rjust(16, 'A')[0:16] + if "-" in s: + s = s.replace("-", "") + self._raw_secret = s.upper().rjust(16, "A")[0:16] self._secret = base64.b32decode(self._raw_secret.encode()) - def time_code(self, moment: int=None): + def time_code(self, moment: int = None): """ Returns a string indicating the current valid token which will be generated, and which should be matched to authenticate the user. @@ -93,14 +94,14 @@ def time_code(self, moment: int=None): if moment is None: moment = time.time() moment = int(moment // 30) - time_bytes = struct.pack('>q', moment) + time_bytes = struct.pack(">q", moment) hash_digest = hmac.HMAC(self._secret, time_bytes, hashlib.sha1).digest() offset = hash_digest[-1] & 0x0F - truncated_digest = hash_digest[offset:offset + 4] - code = struct.unpack('>L', truncated_digest)[0] + truncated_digest = hash_digest[offset : offset + 4] + code = struct.unpack(">L", truncated_digest)[0] code &= 0x7FFFFFFF code %= 1000000 - return '%06d' % code + return "%06d" % code def verify(self, token): """ @@ -118,7 +119,7 @@ def verify(self, token): :rtype: bool """ if isinstance(token, int): - token = '%06d' % token + token = "%06d" % token trials = [self.time_code(time.time() + offset) for offset in (-30, 0, 30)] if token in trials: return True @@ -137,7 +138,7 @@ def secret(self): :rtype: str """ token = self._raw_secret.lower() - return '-'.join((token[0:4], token[4:8], token[8:12], token[12:16])) + return "-".join((token[0:4], token[4:8], token[8:12], token[12:16])) @secret.setter def secret(self, s: str): @@ -149,9 +150,9 @@ def secret(self, s: str): :return: :rtype: """ - if '-' in s: - s = s.replace('-', '') - self._raw_secret = s.upper().rjust(16, 'A')[0:16] + if "-" in s: + s = s.replace("-", "") + self._raw_secret = s.upper().rjust(16, "A")[0:16] self._secret = base64.b32decode(self._raw_secret.encode()) def __repr__(self): @@ -176,10 +177,10 @@ def to_json(self, outer_encoder=None): if outer_encoder is None: outer_encoder = json.JSONEncoder.default - cls_name = '__class__/' + __name__ + '.' + self.__class__.__name__ + cls_name = "__class__/" + __name__ + "." + self.__class__.__name__ return { cls_name: { - 'secret': outer_encoder(self._raw_secret), + "secret": outer_encoder(self._raw_secret), } } @@ -199,14 +200,17 @@ def from_json(cls, data, outer_decoder=None): if outer_decoder is None: outer_decoder = json.JSONDecoder.decode - cls_name = '__class__/' + __name__ + '.' + cls.__name__ + cls_name = "__class__/" + __name__ + "." + cls.__name__ if cls_name in data: - return cls(s=outer_decoder(data[cls_name]['secret'])) + return cls(s=outer_decoder(data[cls_name]["secret"])) return data -def random_base32_token(length: int=16, rng=random.SystemRandom(), - charset='ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'): +def random_base32_token( + length: int = 16, + rng=random.SystemRandom(), + charset="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", +): """ This method just provides a quick way to obtain a proper key to use for a 2-factor authentication secret key. @@ -220,5 +224,5 @@ def random_base32_token(length: int=16, rng=random.SystemRandom(), :return: A 16-character base32 encoded token :rtype: str """ - token = ''.join(rng.choice(charset) for i in range(length)) - return '-'.join((token[0:4], token[4:8], token[8:12], token[12:16])) + token = "".join(rng.choice(charset) for i in range(length)) + return "-".join((token[0:4], token[4:8], token[8:12], token[12:16])) diff --git a/src/rom24/bit.py b/src/rom24/bit.py index fc18892..61f50d3 100644 --- a/src/rom24/bit.py +++ b/src/rom24/bit.py @@ -1,6 +1,7 @@ import json from collections import OrderedDict import logging + logger = logging.getLogger(__name__) from rom24 import game_utils @@ -28,7 +29,8 @@ class Bit: the name OR numerical value, and you can still use the numbers if you like. """ - def __init__(self, default: int=0, flags: OrderedDict=None): + + def __init__(self, default: int = 0, flags: OrderedDict = None): """ The constructor allows you to specify the default value, as well as providing an ordered dict which will be used for @@ -96,114 +98,156 @@ def __isub__(self, other): def __mul__(self, other): if isinstance(other, int): return Bit(self.bits * other, self.flags) - raise TypeError('You can only multiply a Bit() value by an integer, not a ' + repr(other)) + raise TypeError( + "You can only multiply a Bit() value by an integer, not a " + repr(other) + ) def __rmul__(self, other): if isinstance(other, int): return Bit(other * self.bits, self.flags) - raise TypeError('You can only multiply a Bit() value by an integer, not a ' + repr(other)) + raise TypeError( + "You can only multiply a Bit() value by an integer, not a " + repr(other) + ) def __imul__(self, other): if isinstance(other, int): self.bits *= other return self - raise TypeError('You can only multiply a Bit() value by an integer, not a ' + repr(other)) + raise TypeError( + "You can only multiply a Bit() value by an integer, not a " + repr(other) + ) def __truediv__(self, other): if isinstance(other, int): return Bit(self.bits // other, self.flags) - raise TypeError('You can only divide a Bit() value by an integer, not a ' + repr(other)) + raise TypeError( + "You can only divide a Bit() value by an integer, not a " + repr(other) + ) def __rtruediv__(self, other): if isinstance(other, int): return Bit(other // self.bits, self.flags) - raise TypeError('You can only divide a Bit() value by an integer, not a ' + repr(other)) + raise TypeError( + "You can only divide a Bit() value by an integer, not a " + repr(other) + ) def __itruediv__(self, other): if isinstance(other, int): self.bits //= other return self - raise TypeError('You can only divide a Bit() value by an integer, not a ' + repr(other)) + raise TypeError( + "You can only divide a Bit() value by an integer, not a " + repr(other) + ) def __floordiv__(self, other): if isinstance(other, int): return Bit(self.bits // other, self.flags) - raise TypeError('You can only divide a Bit() value by an integer, not a ' + repr(other)) + raise TypeError( + "You can only divide a Bit() value by an integer, not a " + repr(other) + ) def __rfloordiv__(self, other): if isinstance(other, int): return Bit(other // self.bits, self.flags) - raise TypeError('You can only divide a Bit() value by an integer, not a ' + repr(other)) + raise TypeError( + "You can only divide a Bit() value by an integer, not a " + repr(other) + ) def __ifloordiv__(self, other): if isinstance(other, int): self.bits //= other return self - raise TypeError('You can only divide a Bit() value by an integer, not a ' + repr(other)) + raise TypeError( + "You can only divide a Bit() value by an integer, not a " + repr(other) + ) def __mod__(self, other): if isinstance(other, int): return Bit(self.bits % other, self.flags) - raise TypeError('You can only get the integer modulo of a Bit() value, not a ' + repr(other)) + raise TypeError( + "You can only get the integer modulo of a Bit() value, not a " + repr(other) + ) def __rmod__(self, other): if isinstance(other, int): return Bit(other % self.bits, self.flags) - raise TypeError('You can only get the integer modulo of a Bit() value, not a ' + repr(other)) + raise TypeError( + "You can only get the integer modulo of a Bit() value, not a " + repr(other) + ) def __imod__(self, other): if isinstance(other, int): self.bits %= other return self - raise TypeError('You can only get the integer modulo of a Bit() value, not a ' + repr(other)) + raise TypeError( + "You can only get the integer modulo of a Bit() value, not a " + repr(other) + ) def __pow__(self, power, modulo=None): if isinstance(power, int): return Bit(self.bits ** power, self.flags) - raise TypeError('You can only raise a Bit() value to an integer power, not a ' + repr(power)) + raise TypeError( + "You can only raise a Bit() value to an integer power, not a " + repr(power) + ) def __rpow__(self, power, modulo=None): if isinstance(power, int): return Bit(power ** self.bits, self.flags) - raise TypeError('You can only raise a Bit() value to an integer power, not a ' + repr(power)) + raise TypeError( + "You can only raise a Bit() value to an integer power, not a " + repr(power) + ) def __ipow__(self, power, modulo=None): if isinstance(power, int): self.bits **= power return self - raise TypeError('You can only raise a Bit() value to an integer power, not a ' + repr(power)) + raise TypeError( + "You can only raise a Bit() value to an integer power, not a " + repr(power) + ) def __lshift__(self, other): if isinstance(other, int): return Bit(self.bits << other, self.flags) - raise TypeError('You can only shift a Bit() value by an integer, not a ' + repr(other)) + raise TypeError( + "You can only shift a Bit() value by an integer, not a " + repr(other) + ) def __rlshift__(self, other): if isinstance(other, int): return Bit(other << self.bits, self.flags) - raise TypeError('You can only shift a Bit() value by an integer, not a ' + repr(other)) + raise TypeError( + "You can only shift a Bit() value by an integer, not a " + repr(other) + ) def __ilshift__(self, other): if isinstance(other, int): self.bits <<= other return self - raise TypeError('You can only shift a Bit() value by an integer, not a ' + repr(other)) + raise TypeError( + "You can only shift a Bit() value by an integer, not a " + repr(other) + ) def __rshift__(self, other): if isinstance(other, int): return Bit(self.bits >> other, self.flags) - raise TypeError('You can only shift a Bit() value by an integer, not a ' + repr(other)) + raise TypeError( + "You can only shift a Bit() value by an integer, not a " + repr(other) + ) def __rrshift__(self, other): if isinstance(other, int): return Bit(other >> self.bits, self.flags) - raise TypeError('You can only shift a Bit() value by an integer, not a ' + repr(other)) + raise TypeError( + "You can only shift a Bit() value by an integer, not a " + repr(other) + ) def __irshift__(self, other): if isinstance(other, int): self.bits >>= other return self - raise TypeError('You can only shift a Bit() value by an integer, not a ' + repr(other)) + raise TypeError( + "You can only shift a Bit() value by an integer, not a " + repr(other) + ) def __and__(self, other): return Bit(self.bits & self.from_name(other), self.flags) @@ -251,7 +295,7 @@ def __int__(self): return self.bits def __getattr__(self, name): - if not name.startswith('is_'): + if not name.startswith("is_"): raise AttributeError flags = self.flags flag = state_checks.name_lookup(flags, name[3:]) @@ -288,7 +332,7 @@ def read_bits(self, area, default=0): self.set_bit(default) return area - #lets you chose the flag table. so act/plr flags will save correctly. + # lets you chose the flag table. so act/plr flags will save correctly. def print_flags(self, flags): holder = self._flags self._flags = flags @@ -305,7 +349,7 @@ def from_name(self, name): bitstring = repr(name) else: name = name.strip() - bitstring = name.split(' ') + bitstring = name.split(" ") bits = 0 flags = self.flags for tok in flags.values(): @@ -336,11 +380,11 @@ def to_json(self, outer_encoder=None): if outer_encoder is None: outer_encoder = json.JSONEncoder.default - cls_name = '__class__/' + __name__ + '.' + self.__class__.__name__ + cls_name = "__class__/" + __name__ + "." + self.__class__.__name__ return { cls_name: { - 'bits': outer_encoder(self.bits), - 'flags': outer_encoder(self.flags), + "bits": outer_encoder(self.bits), + "flags": outer_encoder(self.flags), } } @@ -360,8 +404,10 @@ def from_json(cls, data, outer_decoder=None): if outer_decoder is None: outer_decoder = json.JSONDecoder.decode - cls_name = '__class__/' + __name__ + '.' + cls.__name__ + cls_name = "__class__/" + __name__ + "." + cls.__name__ if cls_name in data: - return cls(default=outer_decoder(data[cls_name]['bits']), - flags=outer_decoder(data[cls_name]['flags'])) + return cls( + default=outer_decoder(data[cls_name]["bits"]), + flags=outer_decoder(data[cls_name]["flags"]), + ) return data diff --git a/src/rom24/comm.py b/src/rom24/comm.py index d8859a1..89b92b4 100644 --- a/src/rom24/comm.py +++ b/src/rom24/comm.py @@ -1,4 +1,3 @@ - from collections import OrderedDict from types import MethodType import random @@ -19,6 +18,7 @@ done = False + def process_input(): for d in merc.descriptor_list: if d.active and d.cmd_ready and d.connected: @@ -40,7 +40,7 @@ def is_connected(self, state): def process_output(self): ch = handler_ch.CH(self) if ch and self.is_connected(nanny.con_playing) and self.send_buffer: - #/* battle prompt */ + # /* battle prompt */ if ch.fighting: victim = ch.fighting if victim and ch.can_see(victim): @@ -84,7 +84,7 @@ def init_descriptor(d): d.original = None d.snoop_by = None d.close = d.deactivate - #Gain control over process output without messing with miniboa. + # Gain control over process output without messing with miniboa. d.miniboa_send = d.socket_send d.socket_send = MethodType(process_output, d) merc.descriptor_list.append(d) @@ -92,15 +92,16 @@ def init_descriptor(d): d.request_naws() -#Check if already playing. +# Check if already playing. def check_playing(d, name): for dold in merc.descriptor_list: - if dold != d and dold.character \ - and dold.connected != nanny.con_get_name \ - and dold.connected != nanny.con_get_old_password \ - and name == (dold.original.name - if dold.original - else dold.character.name): + if ( + dold != d + and dold.character + and dold.connected != nanny.con_get_name + and dold.connected != nanny.con_get_old_password + and name == (dold.original.name if dold.original else dold.character.name) + ): d.send("That character is already playing.\n") d.send("Do you wish to connect anyway (Y/N)?") d.set_connected(nanny.con_break_connect) @@ -108,11 +109,14 @@ def check_playing(d, name): return False -#Look for link-dead player to reconnect. +# Look for link-dead player to reconnect. def check_reconnect(d, name, fConn): for ch in instance.players.values(): - if not ch.is_npc() and (not fConn or not ch.desc) \ - and d.character.name == ch.name: + if ( + not ch.is_npc() + and (not fConn or not ch.desc) + and d.character.name == ch.name + ): if not fConn: d.character.pwd = ch.pwd else: @@ -124,7 +128,9 @@ def check_reconnect(d, name, fConn): ch.send("Reconnecting. Type replay to see missed tells.\n") handler_game.act("$n has reconnected.", ch, None, None, merc.TO_ROOM) logger.info("%s@%s reconnected.", ch.name, d.host) - handler_game.wiznet("$N groks the fullness of $S link.", ch, None, merc.WIZ_LINKS, 0, 0) + handler_game.wiznet( + "$N groks the fullness of $S link.", ch, None, merc.WIZ_LINKS, 0, 0 + ) d.set_connected(nanny.con_playing) return True return False @@ -136,8 +142,8 @@ def close_socket(d): d.active = False -#* Bust a prompt (player settable prompt) -#* coded by Morgenes for Aldara Mud +# * Bust a prompt (player settable prompt) +# * coded by Morgenes for Aldara Mud def bust_a_prompt(ch): dir_name = ["N", "E", "S", "W", "U", "D"] room = ch.in_room @@ -152,62 +158,68 @@ def bust_a_prompt(ch): replace = OrderedDict() found = False for door, pexit in enumerate(room.exit): - if pexit and (pexit.to_room and ch.can_see_room(pexit.to_room) - or (ch.is_affected(merc.AFF_INFRARED) - and not ch.is_affected(merc.AFF_BLIND))) \ - and not pexit.exit_info.is_set(merc.EX_CLOSED): + if ( + pexit + and ( + pexit.to_room + and ch.can_see_room(pexit.to_room) + or ( + ch.is_affected(merc.AFF_INFRARED) + and not ch.is_affected(merc.AFF_BLIND) + ) + ) + and not pexit.exit_info.is_set(merc.EX_CLOSED) + ): found = True doors += dir_name[door] if not found: - replace['%e'] = "none" + replace["%e"] = "none" else: - replace['%e'] = doors - replace['%c'] = '\n' - replace['%h'] = '%s' % ch.hit - replace['%H'] = "%s" % ch.max_hit - replace['%m'] = "%d" % ch.mana - replace['%M'] = "%d" % ch.max_mana - replace['%v'] = "%d" % ch.move - replace['%V'] = "%d" % ch.max_move - replace['%x'] = "%d" % ch.exp - replace['%X'] = "%d" % (0 if ch.is_npc() - else (ch.level + 1) * ch.exp_per_level(ch.points) - ch.exp) - replace['%g'] = "%ld" % ch.gold - replace['%s'] = "%ld" % ch.silver + replace["%e"] = doors + replace["%c"] = "\n" + replace["%h"] = "%s" % ch.hit + replace["%H"] = "%s" % ch.max_hit + replace["%m"] = "%d" % ch.mana + replace["%M"] = "%d" % ch.max_mana + replace["%v"] = "%d" % ch.move + replace["%V"] = "%d" % ch.max_move + replace["%x"] = "%d" % ch.exp + replace["%X"] = "%d" % ( + 0 if ch.is_npc() else (ch.level + 1) * ch.exp_per_level(ch.points) - ch.exp + ) + replace["%g"] = "%ld" % ch.gold + replace["%s"] = "%ld" % ch.silver if ch.level > 9: - replace['%a'] = "%d" % ch.alignment + replace["%a"] = "%d" % ch.alignment else: - replace['%a'] = "%s" % "good" \ - if ch.is_good() \ - else "evil" \ - if ch.is_evil() \ - else "neutral" - + replace["%a"] = ( + "%s" % "good" if ch.is_good() else "evil" if ch.is_evil() else "neutral" + ) + if ch.in_room: - if (not ch.is_npc() - and ch.act.is_set(merc.PLR_HOLYLIGHT)) \ - or (not ch.is_affected(merc.AFF_BLIND) - and not ch.in_room.is_dark()): - replace['%r'] = ch.in_room.name - else: - replace['%r'] = "darkness" + if (not ch.is_npc() and ch.act.is_set(merc.PLR_HOLYLIGHT)) or ( + not ch.is_affected(merc.AFF_BLIND) and not ch.in_room.is_dark() + ): + replace["%r"] = ch.in_room.name + else: + replace["%r"] = "darkness" else: - replace['%r'] = " " - + replace["%r"] = " " + if ch.is_immortal() and ch.in_room: - replace['%R'] = "%d" % ch.in_room.vnum + replace["%R"] = "%d" % ch.in_room.vnum else: - replace['%R'] = " " - + replace["%R"] = " " + if ch.is_immortal() and ch.in_room: - replace['%z'] = "%s" % instance.area_templates[ch.in_room.area].name + replace["%z"] = "%s" % instance.area_templates[ch.in_room.area].name else: - replace['%z'] = " " - - #replace['%%'] = '%' + replace["%z"] = " " + + # replace['%%'] = '%' prompt = ch.prompt prompt = game_utils.mass_replace(prompt, replace) - + ch.send(prompt) if ch.prefix: ch.send(ch.prefix) @@ -226,16 +238,17 @@ def is_reconnecting(d, name): def game_loop(server): from rom24.update import update_handler from rom24.pyom import startup_time - #import sysutils + + # import sysutils global done db.boot_db() boot_time = time.time() - #boot_snapshot = sysutils.ResourceSnapshot() - #logger.info(boot_snapshot.log_data()) + # boot_snapshot = sysutils.ResourceSnapshot() + # logger.info(boot_snapshot.log_data()) - logger.info('Pyom database booted in %.3f seconds', (boot_time - startup_time)) + logger.info("Pyom database booted in %.3f seconds", (boot_time - startup_time)) logger.info("Saving instances") instance.save() logger.info("Beginning server polling.") diff --git a/src/rom24/commands/do_advance.py b/src/rom24/commands/do_advance.py index 894df36..62e1be0 100644 --- a/src/rom24/commands/do_advance.py +++ b/src/rom24/commands/do_advance.py @@ -7,9 +7,10 @@ from rom24 import update from rom24 import interp + def do_advance(ch, argument): - argument, arg1 = game_utils.read_word(argument) - argument, arg2 = game_utils.read_word(argument) + argument, arg1 = game_utils.read_word(argument) + argument, arg2 = game_utils.read_word(argument) if not arg1 or not arg2 or not arg2.isdigit(): ch.send("Syntax: advance .\n") @@ -63,4 +64,6 @@ def do_advance(ch, argument): return -interp.register_command(interp.cmd_type('advance', do_advance, merc.POS_DEAD, merc.ML, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("advance", do_advance, merc.POS_DEAD, merc.ML, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_affects.py b/src/rom24/commands/do_affects.py index 4426f7e..c39699f 100644 --- a/src/rom24/commands/do_affects.py +++ b/src/rom24/commands/do_affects.py @@ -19,7 +19,10 @@ def do_affects(ch, argument): else: ch.send("Spell: %-15s" % paf.type.name) if ch.level >= 20: - ch.send(": modifies %s by %d " % (merc.affect_loc_name(paf.location), paf.modifier)) + ch.send( + ": modifies %s by %d " + % (merc.affect_loc_name(paf.location), paf.modifier) + ) if paf.duration == -1: ch.send("permanently") else: @@ -30,4 +33,6 @@ def do_affects(ch, argument): ch.send("You are not affected by any spells.\n") -interp.register_command(interp.cmd_type('affects', do_affects, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("affects", do_affects, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_afk.py b/src/rom24/commands/do_afk.py index 71bc196..47a2ea7 100644 --- a/src/rom24/commands/do_afk.py +++ b/src/rom24/commands/do_afk.py @@ -16,4 +16,6 @@ def do_afk(ch, argument): ch.comm.set_bit(merc.COMM_AFK) -interp.register_command(interp.cmd_type('afk', do_afk, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("afk", do_afk, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_alias.py b/src/rom24/commands/do_alias.py index 13db0af..caf022b 100644 --- a/src/rom24/commands/do_alias.py +++ b/src/rom24/commands/do_alias.py @@ -50,10 +50,15 @@ def do_alias(ch, argument): ch.send("%s is now aliased to '%s'.\n" % (arg, arg2)) return + def do_alia(ch, argument): ch.send("I'm sorry, alias must be entered in full.\n") return -interp.register_command(interp.cmd_type('alias', do_alias, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) -interp.register_command(interp.cmd_type('alia', do_alia, merc.POS_DEAD, 0, merc.LOG_NORMAL, 0)) +interp.register_command( + interp.cmd_type("alias", do_alias, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) +interp.register_command( + interp.cmd_type("alia", do_alia, merc.POS_DEAD, 0, merc.LOG_NORMAL, 0) +) diff --git a/src/rom24/commands/do_answer.py b/src/rom24/commands/do_answer.py index 8850da8..7471e55 100644 --- a/src/rom24/commands/do_answer.py +++ b/src/rom24/commands/do_answer.py @@ -26,12 +26,25 @@ def do_answer(ch, argument): ch.send("The gods have revoked your channel priviliges.\n") return ch.comm.rem_bit(merc.COMM_NOQUESTION) - ch.send("You answer '%s'\n" % argument ) + ch.send("You answer '%s'\n" % argument) for d in merc.descriptor_list: victim = handler_ch.CH(d) - if d.is_connected(nanny.con_playing) and d.character != ch \ - and not victim.comm.is_set(merc.COMM_NOQUESTION) and not victim.comm.is_set(merc.COMM_QUIET): - handler_game.act("$n answers '$t'", ch, argument, d.character, merc.TO_VICT, merc.POS_SLEEPING) + if ( + d.is_connected(nanny.con_playing) + and d.character != ch + and not victim.comm.is_set(merc.COMM_NOQUESTION) + and not victim.comm.is_set(merc.COMM_QUIET) + ): + handler_game.act( + "$n answers '$t'", + ch, + argument, + d.character, + merc.TO_VICT, + merc.POS_SLEEPING, + ) -interp.register_command(interp.cmd_type('answer', do_answer, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("answer", do_answer, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_apickle.py b/src/rom24/commands/do_apickle.py index 5b0a803..e1134a8 100644 --- a/src/rom24/commands/do_apickle.py +++ b/src/rom24/commands/do_apickle.py @@ -1,4 +1,4 @@ -__author__ = 'syn' +__author__ = "syn" import logging @@ -14,25 +14,29 @@ def do_apickle(ch, argument): ch.send("Saving areas to pickle format..\n\n") save.area_pickler() - open(os.path.join(settings.LEGACY_AREA_DIR, settings.PAREA_LIST), 'w').close() # lets write a clean list - open(os.path.join(settings.LEGACY_AREA_DIR, settings.SOCIAL_LIST), 'w').close() - with open(os.path.join(settings.LEGACY_AREA_DIR, settings.PAREA_LIST), 'a') as alf: + open( + os.path.join(settings.LEGACY_AREA_DIR, settings.PAREA_LIST), "w" + ).close() # lets write a clean list + open(os.path.join(settings.LEGACY_AREA_DIR, settings.SOCIAL_LIST), "w").close() + with open(os.path.join(settings.LEGACY_AREA_DIR, settings.PAREA_LIST), "a") as alf: ch.send("Writing Area List...\n\n") for area in merc.area_list: - als = ("%s\n" % area.name) + als = "%s\n" % area.name alf.write(als) alf.write("$") alf.close() ch.send("Area List Saved.\n\n") - with open(os.path.join(settings.LEGACY_AREA_DIR, settings.SOCIAL_LIST), 'a') as slf: + with open(os.path.join(settings.LEGACY_AREA_DIR, settings.SOCIAL_LIST), "a") as slf: ch.send("Writing Social List...\n\n") for social in merc.social_list: - sls = ("%s\n" % social.name) + sls = "%s\n" % social.name slf.write(sls) slf.write("$") slf.close() ch.send("Social List Saved.\n\n") return -interp.register_command(interp.cmd_type('apickle', do_apickle, merc.POS_DEAD, merc.ML, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("apickle", do_apickle, merc.POS_DEAD, merc.ML, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_areas.py b/src/rom24/commands/do_areas.py index bb62b42..2b1ce79 100644 --- a/src/rom24/commands/do_areas.py +++ b/src/rom24/commands/do_areas.py @@ -19,4 +19,6 @@ def do_areas(ch, argument): ch.send("\n") -interp.register_command(interp.cmd_type('areas', do_areas, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("areas", do_areas, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_auction.py b/src/rom24/commands/do_auction.py index f48df36..1c1da1f 100644 --- a/src/rom24/commands/do_auction.py +++ b/src/rom24/commands/do_auction.py @@ -26,13 +26,25 @@ def do_auction(ch, argument): return ch.comm.rem_bit(merc.COMM_NOAUCTION) - ch.send("You auction '%s'\n" % argument ) + ch.send("You auction '%s'\n" % argument) for d in merc.descriptor_list: victim = handler_ch.CH(d) - if d.is_connected(nanny.con_playing) and d.character != ch \ - and not victim.comm.is_set(merc.COMM_NOAUCTION) \ - and not victim.comm.is_set(merc.COMM_QUIET): - handler_game.act("$n auctions '$t'", ch, argument, d.character, merc.TO_VICT, merc.POS_DEAD) + if ( + d.is_connected(nanny.con_playing) + and d.character != ch + and not victim.comm.is_set(merc.COMM_NOAUCTION) + and not victim.comm.is_set(merc.COMM_QUIET) + ): + handler_game.act( + "$n auctions '$t'", + ch, + argument, + d.character, + merc.TO_VICT, + merc.POS_DEAD, + ) -interp.register_command(interp.cmd_type('auction', do_auction, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("auction", do_auction, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_authenticator.py b/src/rom24/commands/do_authenticator.py index 57b605f..e5ba974 100644 --- a/src/rom24/commands/do_authenticator.py +++ b/src/rom24/commands/do_authenticator.py @@ -1,7 +1,8 @@ -__author__ = 'quixadhal' +__author__ = "quixadhal" import hashlib import logging + logger = logging.getLogger(__name__) from rom24 import auth @@ -18,58 +19,74 @@ def do_authenticator(ch, argument): argument, arg2 = game_utils.read_word(argument, False) if not arg1 or not arg2: - ch.send('Authenticator %s.\n' % ('active' if ch.auth else 'disabled')) - ch.send('Usage: authenticator [token]\n') + ch.send("Authenticator %s.\n" % ("active" if ch.auth else "disabled")) + ch.send("Usage: authenticator [token]\n") if ch.auth: import time import sys_utils - trials = [ch.auth.time_code(time.time() + offset) for offset in (-30, 0, 30)] - ch.send('DEBUG: %s - %s, %r\n' % (sys_utils.sysTimeStamp(time.time()), ch.auth.secret, trials)) + + trials = [ + ch.auth.time_code(time.time() + offset) for offset in (-30, 0, 30) + ] + ch.send( + "DEBUG: %s - %s, %r\n" + % (sys_utils.sysTimeStamp(time.time()), ch.auth.secret, trials) + ) return arg1 = arg1.lower() - if arg1 == 'on' or arg1 == 'activate' or arg1 == 'enable' or arg1 == 'add': + if arg1 == "on" or arg1 == "activate" or arg1 == "enable" or arg1 == "add": if ch.auth: - ch.send('Authentication is already active.\n') + ch.send("Authentication is already active.\n") return else: pwd = hashlib.sha512(arg2.encode()).hexdigest() if pwd != ch.pwd: - ch.send('Wrong password. Operation cancelled.\n') + ch.send("Wrong password. Operation cancelled.\n") return else: secret = auth.random_base32_token() ch.auth = auth.TwoFactorAuth(secret) ch.save() - ch.send('Authentication is now active!\n') - ch.send('You must now use Google Authenticator to log in.\n') - ch.send('Please add a new time-based account to your authenticator, using %s as the code.\n' % - ch.auth.secret) - ch.send('If you don\'t have a smartphone app, you can get a Windows version at https://winauth.com/\n') + ch.send("Authentication is now active!\n") + ch.send("You must now use Google Authenticator to log in.\n") + ch.send( + "Please add a new time-based account to your authenticator, using %s as the code.\n" + % ch.auth.secret + ) + ch.send( + "If you don't have a smartphone app, you can get a Windows version at https://winauth.com/\n" + ) return - if arg1 == 'off' or arg1 == 'deactivate' or arg1 == 'disable' or arg1 == 'remove': + if arg1 == "off" or arg1 == "deactivate" or arg1 == "disable" or arg1 == "remove": if not ch.auth: - ch.send('Authentication is not active.\n') + ch.send("Authentication is not active.\n") return else: pwd = hashlib.sha512(arg2.encode()).hexdigest() if pwd != ch.pwd: - ch.send('Wrong password. Operation cancelled.\n') + ch.send("Wrong password. Operation cancelled.\n") return else: argument, arg3 = game_utils.read_word(argument, False) if not arg3: - ch.send('You must provide the current auth token to remove your authenticator.\n') + ch.send( + "You must provide the current auth token to remove your authenticator.\n" + ) return elif not ch.auth.verify(arg3): - ch.send('Incorrect token. Operation cancelled.\n') + ch.send("Incorrect token. Operation cancelled.\n") return else: ch.auth = None ch.save() - ch.send('Authentication is now disabled.\n') + ch.send("Authentication is now disabled.\n") return -interp.register_command(interp.cmd_type('authenticator', do_authenticator, merc.POS_DEAD, 0, merc.LOG_NEVER, 1)) +interp.register_command( + interp.cmd_type( + "authenticator", do_authenticator, merc.POS_DEAD, 0, merc.LOG_NEVER, 1 + ) +) diff --git a/src/rom24/commands/do_autoassist.py b/src/rom24/commands/do_autoassist.py index 26b7512..3eebb78 100644 --- a/src/rom24/commands/do_autoassist.py +++ b/src/rom24/commands/do_autoassist.py @@ -18,4 +18,6 @@ def do_autoassist(ch, argument): ch.act.set_bit(merc.PLR_AUTOASSIST) -interp.register_command(interp.cmd_type('autoassist', do_autoassist, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("autoassist", do_autoassist, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_autoexit.py b/src/rom24/commands/do_autoexit.py index b377aff..a130ee8 100644 --- a/src/rom24/commands/do_autoexit.py +++ b/src/rom24/commands/do_autoexit.py @@ -18,4 +18,6 @@ def do_autoexit(ch, argument): ch.act.set_bit(merc.PLR_AUTOEXIT) -interp.register_command(interp.cmd_type('autoexit', do_autoexit, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("autoexit", do_autoexit, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_autogold.py b/src/rom24/commands/do_autogold.py index 7d7298b..df94910 100644 --- a/src/rom24/commands/do_autogold.py +++ b/src/rom24/commands/do_autogold.py @@ -19,4 +19,6 @@ def do_autogold(ch, argument): ch.act.set_bit(merc.PLR_AUTOGOLD) -interp.register_command(interp.cmd_type('autogold', do_autogold, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("autogold", do_autogold, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_autolist.py b/src/rom24/commands/do_autolist.py index 104cac3..ef3bc1f 100644 --- a/src/rom24/commands/do_autolist.py +++ b/src/rom24/commands/do_autolist.py @@ -80,4 +80,6 @@ def do_autolist(ch, argument): ch.send("You accept followers.\n") -interp.register_command(interp.cmd_type('autolist', do_autolist, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("autolist", do_autolist, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_autoloot.py b/src/rom24/commands/do_autoloot.py index b78be13..6b84799 100644 --- a/src/rom24/commands/do_autoloot.py +++ b/src/rom24/commands/do_autoloot.py @@ -18,4 +18,6 @@ def do_autoloot(ch, argument): ch.act.set_bit(merc.PLR_AUTOLOOT) -interp.register_command(interp.cmd_type('autoloot', do_autoloot, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("autoloot", do_autoloot, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_autosac.py b/src/rom24/commands/do_autosac.py index 4dceaf2..eca86db 100644 --- a/src/rom24/commands/do_autosac.py +++ b/src/rom24/commands/do_autosac.py @@ -17,4 +17,6 @@ def do_autosac(ch, argument): ch.act.set_bit(merc.PLR_AUTOSAC) -interp.register_command(interp.cmd_type('autosac', do_autosac, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("autosac", do_autosac, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_autosplit.py b/src/rom24/commands/do_autosplit.py index e90c025..48cd677 100644 --- a/src/rom24/commands/do_autosplit.py +++ b/src/rom24/commands/do_autosplit.py @@ -18,4 +18,6 @@ def do_autosplit(ch, argument): ch.act.set_bit(merc.PLR_AUTOSPLIT) -interp.register_command(interp.cmd_type('autosplit', do_autosplit, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("autosplit", do_autosplit, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_backstab.py b/src/rom24/commands/do_backstab.py index 4c1ea65..2589aeb 100644 --- a/src/rom24/commands/do_backstab.py +++ b/src/rom24/commands/do_backstab.py @@ -32,28 +32,44 @@ def do_backstab(ch, argument): return if fight.is_safe(ch, victim): return - if victim.is_npc() and victim.fighting and not ch.is_same_group(victim.fighting): + if ( + victim.is_npc() + and victim.fighting + and not ch.is_same_group(victim.fighting) + ): ch.send("Kill stealing is not permitted.\n") return - item = ch.get_eq('main_hand') + item = ch.get_eq("main_hand") if not item: ch.send("You need to wield a weapon to backstab.\n") return if victim.hit < victim.max_hit // 3: - handler_game.act("$N is hurt and suspicious ... you can't sneak up.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N is hurt and suspicious ... you can't sneak up.", + ch, + None, + victim, + merc.TO_CHAR, + ) return fight.check_killer(ch, victim) - state_checks.WAIT_STATE(ch, const.skill_table['backstab'].beats ) - if random.randint(1, 99) < ch.get_skill('backstab') \ - or (ch.get_skill('backstab') >= 2 and not state_checks.IS_AWAKE(victim)): + state_checks.WAIT_STATE(ch, const.skill_table["backstab"].beats) + if random.randint(1, 99) < ch.get_skill("backstab") or ( + ch.get_skill("backstab") >= 2 and not state_checks.IS_AWAKE(victim) + ): if ch.is_pc: - ch.check_improve('backstab',True,1) - fight.multi_hit(ch, victim, 'backstab') + ch.check_improve("backstab", True, 1) + fight.multi_hit(ch, victim, "backstab") else: if ch.is_pc: - ch.check_improve('backstab', False, 1) - fight.damage(ch, victim, 0, 'backstab', merc.DAM_NONE, True) + ch.check_improve("backstab", False, 1) + fight.damage(ch, victim, 0, "backstab", merc.DAM_NONE, True) return -interp.register_command(interp.cmd_type('backstab', do_backstab, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 1)) -interp.register_command(interp.cmd_type('bs', do_backstab, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 0)) + +interp.register_command( + interp.cmd_type("backstab", do_backstab, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 1) +) +interp.register_command( + interp.cmd_type("bs", do_backstab, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 0) +) diff --git a/src/rom24/commands/do_bamfin.py b/src/rom24/commands/do_bamfin.py index ec18426..59ab934 100644 --- a/src/rom24/commands/do_bamfin.py +++ b/src/rom24/commands/do_bamfin.py @@ -19,4 +19,6 @@ def do_bamfin(ch, argument): return -interp.register_command(interp.cmd_type('poofin', do_bamfin, merc.POS_DEAD, merc.L8, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("poofin", do_bamfin, merc.POS_DEAD, merc.L8, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_bamfout.py b/src/rom24/commands/do_bamfout.py index d81a8db..ea23cc1 100644 --- a/src/rom24/commands/do_bamfout.py +++ b/src/rom24/commands/do_bamfout.py @@ -19,4 +19,6 @@ def do_bamfout(ch, argument): return -interp.register_command(interp.cmd_type('poofout', do_bamfout, merc.POS_DEAD, merc.L8, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("poofout", do_bamfout, merc.POS_DEAD, merc.L8, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_bash.py b/src/rom24/commands/do_bash.py index ba8d8e8..260b672 100644 --- a/src/rom24/commands/do_bash.py +++ b/src/rom24/commands/do_bash.py @@ -14,9 +14,15 @@ def do_bash(ch, argument): arghold, arg = game_utils.read_word(argument) - chance = ch.get_skill('bash') - if chance == 0 or (ch.is_npc() and not ch.off_flags.is_set(merc.OFF_BASH)) \ - or (not ch.is_npc() and ch.level < const.skill_table['bash'].skill_level[ch.guild.name] ): + chance = ch.get_skill("bash") + if ( + chance == 0 + or (ch.is_npc() and not ch.off_flags.is_set(merc.OFF_BASH)) + or ( + not ch.is_npc() + and ch.level < const.skill_table["bash"].skill_level[ch.guild.name] + ) + ): ch.send("Bashing? What's that?\n\r") return victim = None @@ -31,12 +37,14 @@ def do_bash(ch, argument): ch.send("They aren't here.\n") return if victim.position < merc.POS_FIGHTING: - handler_game.act("You'll have to let $M get back up first.",ch,None,victim, merc.TO_CHAR) + handler_game.act( + "You'll have to let $M get back up first.", ch, None, victim, merc.TO_CHAR + ) return if victim == ch: ch.send("You try to bash your brains out, but fail.\n") return - if fight.is_safe(ch,victim): + if fight.is_safe(ch, victim): return if victim.is_npc() and victim.fighting and not ch.is_same_group(victim.fighting): ch.send("Kill stealing is not permitted.\n\r") @@ -58,42 +66,75 @@ def do_bash(ch, argument): chance -= (victim.stat(merc.STAT_DEX) * 4) // 3 chance -= state_checks.GET_AC(victim, merc.AC_BASH) // 25 # speed */ - if (ch.is_npc() and ch.off_flags.is_set(merc.OFF_FAST)) or ch.is_affected(merc.AFF_HASTE): + if (ch.is_npc() and ch.off_flags.is_set(merc.OFF_FAST)) or ch.is_affected( + merc.AFF_HASTE + ): chance += 10 - if (victim.is_npc() and victim.off_flags.is_set(merc.OFF_FAST)) or victim.is_affected(merc.AFF_HASTE): + if ( + victim.is_npc() and victim.off_flags.is_set(merc.OFF_FAST) + ) or victim.is_affected(merc.AFF_HASTE): chance -= 30 # level - chance += (ch.level - victim.level) - if not victim.is_npc() and chance < victim.get_skill('dodge'): + chance += ch.level - victim.level + if not victim.is_npc() and chance < victim.get_skill("dodge"): pass # act("$n tries to bash you, but you dodge it.",ch,None,victim,TO_VICT) # act("$N dodges your bash, you fall flat on your face.",ch,None,victim,TO_CHAR) # WAIT_STATE(ch,const.skill_table['bash'].beats) # return - chance -= 3 * (victim.get_skill('dodge') - chance) + chance -= 3 * (victim.get_skill("dodge") - chance) # now the attack */ - if random.randint(1,99) < chance: - handler_game.act("$n sends you sprawling with a powerful bash!", ch,None,victim, merc.TO_VICT) - handler_game.act("You slam into $N, and send $M flying!",ch,None,victim, merc.TO_CHAR) - handler_game.act("$n sends $N sprawling with a powerful bash.", ch,None,victim, merc.TO_NOTVICT) + if random.randint(1, 99) < chance: + handler_game.act( + "$n sends you sprawling with a powerful bash!", + ch, + None, + victim, + merc.TO_VICT, + ) + handler_game.act( + "You slam into $N, and send $M flying!", ch, None, victim, merc.TO_CHAR + ) + handler_game.act( + "$n sends $N sprawling with a powerful bash.", + ch, + None, + victim, + merc.TO_NOTVICT, + ) if not ch.is_npc(): if ch.is_pc: - ch.check_improve('bash',True,1) + ch.check_improve("bash", True, 1) state_checks.DAZE_STATE(victim, 3 * merc.PULSE_VIOLENCE) - state_checks.WAIT_STATE(ch,const.skill_table['bash'].beats) + state_checks.WAIT_STATE(ch, const.skill_table["bash"].beats) victim.position = merc.POS_RESTING - fight.damage(ch,victim,random.randint(2,2 + 2 * ch.size + chance // 20),'bash', merc.DAM_BASH,False) + fight.damage( + ch, + victim, + random.randint(2, 2 + 2 * ch.size + chance // 20), + "bash", + merc.DAM_BASH, + False, + ) else: - fight.damage(ch, victim, 0, 'bash', merc.DAM_BASH,False) + fight.damage(ch, victim, 0, "bash", merc.DAM_BASH, False) handler_game.act("You fall flat on your face!", ch, None, victim, merc.TO_CHAR) handler_game.act("$n falls flat on $s face.", ch, None, victim, merc.TO_NOTVICT) - handler_game.act("You evade $n's bash, causing $m to fall flat on $s face.", ch, None, victim, merc.TO_VICT) + handler_game.act( + "You evade $n's bash, causing $m to fall flat on $s face.", + ch, + None, + victim, + merc.TO_VICT, + ) if not ch.is_npc(): if ch.is_pc: - ch.check_improve('bash',False,1) + ch.check_improve("bash", False, 1) ch.position = merc.POS_RESTING - state_checks.WAIT_STATE(ch, const.skill_table['bash'].beats * 3 // 2) - fight.check_killer(ch,victim) + state_checks.WAIT_STATE(ch, const.skill_table["bash"].beats * 3 // 2) + fight.check_killer(ch, victim) -interp.register_command(interp.cmd_type('bash', do_bash, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("bash", do_bash, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_berserk.py b/src/rom24/commands/do_berserk.py index 1f1f46f..2b6aefd 100644 --- a/src/rom24/commands/do_berserk.py +++ b/src/rom24/commands/do_berserk.py @@ -12,13 +12,23 @@ def do_berserk(ch, argument): - chance = ch.get_skill('berserk') - if chance == 0 or (ch.is_npc() and not ch.off_flags.is_set(merc.OFF_BERSERK)) \ - or (not ch.is_npc() and ch.level < const.skill_table['berserk'].skill_level[ch.guild.name]): + chance = ch.get_skill("berserk") + if ( + chance == 0 + or (ch.is_npc() and not ch.off_flags.is_set(merc.OFF_BERSERK)) + or ( + not ch.is_npc() + and ch.level < const.skill_table["berserk"].skill_level[ch.guild.name] + ) + ): ch.send("You turn red in the face, but nothing happens.\n") return - if ch.is_affected(merc.AFF_BERSERK) or state_checks.is_affected(ch, 'berserk') or state_checks.is_affected(ch, "frenzy"): + if ( + ch.is_affected(merc.AFF_BERSERK) + or state_checks.is_affected(ch, "berserk") + or state_checks.is_affected(ch, "frenzy") + ): ch.send("You get a little madder.\n") return if ch.is_affected(merc.AFF_CALM): @@ -44,13 +54,15 @@ def do_berserk(ch, argument): ch.hit += ch.level * 2 ch.hit = min(ch.hit, ch.max_hit) ch.send("Your pulse races as you are consumed by rage!\n") - handler_game.act("$n gets a wild look in $s eyes.", ch, None, None, merc.TO_ROOM) + handler_game.act( + "$n gets a wild look in $s eyes.", ch, None, None, merc.TO_ROOM + ) if not ch.is_npc(): if ch.is_pc: - ch.check_improve( 'berserk', True, 2) + ch.check_improve("berserk", True, 2) af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS - af.type = 'berserk' + af.type = "berserk" af.level = ch.level af.duration = game_utils.number_fuzzy(ch.level // 8) af.modifier = max(1, ch.level // 5) @@ -73,7 +85,9 @@ def do_berserk(ch, argument): ch.send("Your pulse speeds up, but nothing happens.\n") if not ch.is_npc(): if ch.is_pc: - ch.check_improve('berserk', False, 2) + ch.check_improve("berserk", False, 2) -interp.register_command(interp.cmd_type('berserk', do_berserk, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("berserk", do_berserk, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_brandish.py b/src/rom24/commands/do_brandish.py index bde20b1..8a17bdc 100644 --- a/src/rom24/commands/do_brandish.py +++ b/src/rom24/commands/do_brandish.py @@ -13,7 +13,7 @@ def do_brandish(ch, argument): - staff = ch.get_eq('held') + staff = ch.get_eq("held") if not staff: ch.send("You hold nothing in your hand.\n") return @@ -28,7 +28,10 @@ def do_brandish(ch, argument): if staff.value[2] > 0: handler_game.act("$n brandishes $p.", ch, staff, None, merc.TO_ROOM) handler_game.act("You brandish $p.", ch, staff, None, merc.TO_CHAR) - if ch.level < staff.level or random.randint(1, 99) >= 20 + ch.get_skill("staves") * 4 / 5: + if ( + ch.level < staff.level + or random.randint(1, 99) >= 20 + ch.get_skill("staves") * 4 / 5 + ): handler_game.act("You fail to invoke $p.", ch, staff, None, merc.TO_CHAR) handler_game.act("...and nothing happens.", ch, None, None, merc.TO_ROOM) if ch.is_pc: @@ -52,14 +55,22 @@ def do_brandish(ch, argument): else: logger.error("BUG: Do_brandish: bad target for sn %s.", sn) return - handler_magic.obj_cast_spell(staff.value[3], staff.value[0], ch, vch, None) + handler_magic.obj_cast_spell( + staff.value[3], staff.value[0], ch, vch, None + ) if ch.is_pc: ch.check_improve("staves", True, 2) staff.value[2] -= 1 if staff.value[2] <= 0: - handler_game.act("$n's $p blazes bright and is gone.", ch, staff, None, merc.TO_ROOM) - handler_game.act("Your $p blazes bright and is gone.", ch, staff, None, merc.TO_CHAR) + handler_game.act( + "$n's $p blazes bright and is gone.", ch, staff, None, merc.TO_ROOM + ) + handler_game.act( + "Your $p blazes bright and is gone.", ch, staff, None, merc.TO_CHAR + ) staff.extract() -interp.register_command(interp.cmd_type('brandish', do_brandish, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("brandish", do_brandish, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_brief.py b/src/rom24/commands/do_brief.py index 401c654..28318e1 100644 --- a/src/rom24/commands/do_brief.py +++ b/src/rom24/commands/do_brief.py @@ -15,4 +15,6 @@ def do_brief(ch, argument): ch.comm.set_bit(merc.COMM_BRIEF) -interp.register_command(interp.cmd_type('brief', do_brief, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("brief", do_brief, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_bug.py b/src/rom24/commands/do_bug.py index 334569f..43c0a5a 100644 --- a/src/rom24/commands/do_bug.py +++ b/src/rom24/commands/do_bug.py @@ -14,4 +14,6 @@ def do_bug(ch, argument): return -interp.register_command(interp.cmd_type('bug', do_bug, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("bug", do_bug, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_buy.py b/src/rom24/commands/do_buy.py index 3306a9b..bb2d433 100644 --- a/src/rom24/commands/do_buy.py +++ b/src/rom24/commands/do_buy.py @@ -59,7 +59,7 @@ def do_buy(ch, argument): cost -= cost // 2 * roll // 100 ch.send("You haggle the price down to %d coins.\n" % cost) if ch.is_pc: - ch.check_improve( "haggle", True, 4) + ch.check_improve("haggle", True, 4) ch.deduct_cost(cost) pet = object_creator.create_mobile(pet.pIndexData) pet.act = state_checks.SET_BIT(pet.act, handler_game.act_PET) @@ -69,7 +69,10 @@ def do_buy(ch, argument): argument, arg = merc.read_word(argument) if arg: pet.name = "%s %s" % (pet.name, arg) - pet.description = "%sA neck tag says 'I belong to %s'.\n" % (pet.description, ch.name) + pet.description = "%sA neck tag says 'I belong to %s'.\n" % ( + pet.description, + ch.name, + ) pet.put(ch.in_room) merc.add_follower(pet, ch) pet.leader = ch @@ -82,16 +85,22 @@ def do_buy(ch, argument): if not keeper: return number, arg = game_utils.number_argument(argument) - #TODO: Allow multiple purchase arguments. - #number = 1 - #number, arg = merc.mult_argument(argument) + # TODO: Allow multiple purchase arguments. + # number = 1 + # number, arg = merc.mult_argument(argument) obj = shop_utils.get_obj_keeper(ch, keeper, arg) cost = shop_utils.get_cost(keeper, obj, True) if number < 1 or number > 99: handler_game.act("$n tells you 'Get real!", keeper, None, ch, merc.TO_VICT) return if cost <= 0 or not ch.can_see_item(obj): - handler_game.act("$n tells you 'I don't sell that -- try 'list''.", keeper, None, ch, merc.TO_VICT) + handler_game.act( + "$n tells you 'I don't sell that -- try 'list''.", + keeper, + None, + ch, + merc.TO_VICT, + ) ch.reply = keeper return items = [] @@ -103,18 +112,38 @@ def do_buy(ch, argument): items.append(t_obj) count += 1 if count < number: - handler_game.act("$n tells you 'I don't have that many in stock.", keeper, None, ch, merc.TO_VICT) + handler_game.act( + "$n tells you 'I don't have that many in stock.", + keeper, + None, + ch, + merc.TO_VICT, + ) ch.reply = keeper return if (ch.silver + ch.gold * 100) < cost * number: if number > 1: - handler_game.act("$n tells you 'You can't afford to buy that many.", keeper, obj, ch, merc.TO_VICT) + handler_game.act( + "$n tells you 'You can't afford to buy that many.", + keeper, + obj, + ch, + merc.TO_VICT, + ) else: - handler_game.act("$n tells you 'You can't afford to buy $p'.", keeper, obj, ch, merc.TO_VICT) + handler_game.act( + "$n tells you 'You can't afford to buy $p'.", + keeper, + obj, + ch, + merc.TO_VICT, + ) ch.reply = keeper return if obj.level > ch.level: - handler_game.act("$n tells you 'You can't use $p yet'.", keeper, obj, ch, merc.TO_VICT) + handler_game.act( + "$n tells you 'You can't use $p yet'.", keeper, obj, ch, merc.TO_VICT + ) ch.reply = keeper return if ch.carry_number + number * obj.get_number() > ch.can_carry_n(): @@ -129,14 +158,22 @@ def do_buy(ch, argument): cost -= obj.cost // 2 * roll // 100 handler_game.act("You haggle with $N.", ch, None, keeper, merc.TO_CHAR) if ch.is_pc: - ch.check_improve( "haggle", True, 4) + ch.check_improve("haggle", True, 4) if number > 1: handler_game.act("$n buys $p[[%d]]." % number, ch, obj, None, merc.TO_ROOM) - handler_game.act("You buy $p[[%d]] for %d silver." % (number, cost * number), ch, obj, None, merc.TO_CHAR) + handler_game.act( + "You buy $p[[%d]] for %d silver." % (number, cost * number), + ch, + obj, + None, + merc.TO_CHAR, + ) else: handler_game.act("$n buys $p.", ch, obj, None, merc.TO_ROOM) - handler_game.act("You buy $p for %d silver." % cost, ch, obj, None, merc.TO_CHAR) + handler_game.act( + "You buy $p for %d silver." % cost, ch, obj, None, merc.TO_CHAR + ) ch.deduct_cost(cost * number) keeper.gold += cost * number / 100 @@ -145,7 +182,9 @@ def do_buy(ch, argument): if obj.flags.shop_inventory: items = [] for count in range(number): - t_obj = object_creator.create_item(instance.item_templates[obj.vnum], obj.level) + t_obj = object_creator.create_item( + instance.item_templates[obj.vnum], obj.level + ) items.append(t_obj) for t_obj in items[:]: if not obj.flags.shop_inventory: @@ -159,4 +198,6 @@ def do_buy(ch, argument): t_obj.cost = cost -interp.register_command(interp.cmd_type('buy', do_buy, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("buy", do_buy, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_cast.py b/src/rom24/commands/do_cast.py index 9458121..a6baa35 100644 --- a/src/rom24/commands/do_cast.py +++ b/src/rom24/commands/do_cast.py @@ -25,10 +25,17 @@ def do_cast(ch, argument): ch.send("Cast which what where?\n") return sn = handler_magic.find_spell(ch, arg1) - if not sn or sn.spell_fun is None \ - or (not ch.is_npc() - and (ch.level < sn.skill_level[ch.guild.name] - or ch.learned.get(sn.name, 0) == 0)): + if ( + not sn + or sn.spell_fun is None + or ( + not ch.is_npc() + and ( + ch.level < sn.skill_level[ch.guild.name] + or ch.learned.get(sn.name, 0) == 0 + ) + ) + ): ch.send("You don't know any spells of that name.\n") return if ch.position < sn.minimum_position: @@ -157,7 +164,7 @@ def do_cast(ch, argument): if random.randint(1, 99) > ch.get_skill(sn.name): ch.send("You lost your concentration.\n") if ch.is_pc: - ch.check_improve( sn, False, 1) + ch.check_improve(sn, False, 1) ch.mana -= mana // 2 else: ch.mana -= mana @@ -167,10 +174,16 @@ def do_cast(ch, argument): else: sn.spell_fun(sn, 3 * ch.level // 4, ch, vo, target) if ch.is_pc: - ch.check_improve( sn, True, 1) + ch.check_improve(sn, True, 1) - if (sn.target == merc.TAR_CHAR_OFFENSIVE or (sn.target == merc.TAR_OBJ_CHAR_OFF and target == merc.TARGET_CHAR)) \ - and victim != ch and victim.master != ch: + if ( + ( + sn.target == merc.TAR_CHAR_OFFENSIVE + or (sn.target == merc.TAR_OBJ_CHAR_OFF and target == merc.TARGET_CHAR) + ) + and victim != ch + and victim.master != ch + ): for vch_id in ch.in_room.people[:]: vch = instance.characters[vch_id] if victim == vch and not victim.fighting: @@ -180,4 +193,6 @@ def do_cast(ch, argument): return -interp.register_command(interp.cmd_type('cast', do_cast, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("cast", do_cast, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_channels.py b/src/rom24/commands/do_channels.py index 9ec4005..122083c 100644 --- a/src/rom24/commands/do_channels.py +++ b/src/rom24/commands/do_channels.py @@ -84,4 +84,6 @@ def do_channels(ch, argument): ch.send("You cannot show emotions.\n") -interp.register_command(interp.cmd_type('channels', do_channels, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("channels", do_channels, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_clantalk.py b/src/rom24/commands/do_clantalk.py index 0de4daa..2aaca01 100644 --- a/src/rom24/commands/do_clantalk.py +++ b/src/rom24/commands/do_clantalk.py @@ -28,10 +28,18 @@ def do_clantalk(ch, argument): ch.send("You clan '%s'\n" % argument) for d in merc.descriptor_list: - if d.is_connected(nanny.con_playing) and d.character != ch and ch.is_same_clan(d.character) \ - and not state_checks.IS_SET(d.character.comm, merc.COMM_NOCLAN) and not state_checks.IS_SET(d.character.comm, - merc.COMM_QUIET): - merc.act("$n clans '$t'", ch, argument, d.character, merc.TO_VICT, merc.POS_DEAD) + if ( + d.is_connected(nanny.con_playing) + and d.character != ch + and ch.is_same_clan(d.character) + and not state_checks.IS_SET(d.character.comm, merc.COMM_NOCLAN) + and not state_checks.IS_SET(d.character.comm, merc.COMM_QUIET) + ): + merc.act( + "$n clans '$t'", ch, argument, d.character, merc.TO_VICT, merc.POS_DEAD + ) -interp.register_command(interp.cmd_type('clan', do_clantalk, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1)) \ No newline at end of file +interp.register_command( + interp.cmd_type("clan", do_clantalk, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_clone.py b/src/rom24/commands/do_clone.py index 21f638c..df85fe7 100644 --- a/src/rom24/commands/do_clone.py +++ b/src/rom24/commands/do_clone.py @@ -52,17 +52,21 @@ def do_clone(ch, argument): handler_game.act("$n has created $p.", ch, clone, None, merc.TO_ROOM) handler_game.act("You clone $p.", ch, clone, None, merc.TO_CHAR) - handler_game.wiznet("$N clones $p.", ch, clone, merc.WIZ_LOAD, merc.WIZ_SECURE, ch.trust) + handler_game.wiznet( + "$N clones $p.", ch, clone, merc.WIZ_LOAD, merc.WIZ_SECURE, ch.trust + ) return elif mob: if not state_checks.IS_NPC(mob): ch.send("You can only clone mobiles.\n") return - if (mob.level > 20 and not state_checks.IS_TRUSTED(ch, merc.L4)) \ - or (mob.level > 10 and not state_checks.IS_TRUSTED(ch, merc.L5)) \ - or (mob.level > 5 and not state_checks.IS_TRUSTED(ch, merc.L6)) \ - or (mob.level > 0 and not state_checks.IS_TRUSTED(ch, merc.L7)) \ - or not state_checks.IS_TRUSTED(ch, merc.L8): + if ( + (mob.level > 20 and not state_checks.IS_TRUSTED(ch, merc.L4)) + or (mob.level > 10 and not state_checks.IS_TRUSTED(ch, merc.L5)) + or (mob.level > 5 and not state_checks.IS_TRUSTED(ch, merc.L6)) + or (mob.level > 0 and not state_checks.IS_TRUSTED(ch, merc.L7)) + or not state_checks.IS_TRUSTED(ch, merc.L8) + ): ch.send("Your powers are not great enough for such a task.\n") return clone = object_creator.create_mobile(mob.vnum) @@ -78,8 +82,17 @@ def do_clone(ch, argument): clone.put(ch.in_room) handler_game.act("$n has created $N.", ch, None, clone, merc.TO_ROOM) handler_game.act("You clone $N.", ch, None, clone, merc.TO_CHAR) - handler_game.wiznet("$N clones %s." % clone.short_descr, ch, None, merc.WIZ_LOAD, merc.WIZ_SECURE, ch.trust) + handler_game.wiznet( + "$N clones %s." % clone.short_descr, + ch, + None, + merc.WIZ_LOAD, + merc.WIZ_SECURE, + ch.trust, + ) return -interp.register_command(interp.cmd_type('clone', do_clone, merc.POS_DEAD, merc.L5, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("clone", do_clone, merc.POS_DEAD, merc.L5, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_close.py b/src/rom24/commands/do_close.py index d3a09cf..cccb294 100644 --- a/src/rom24/commands/do_close.py +++ b/src/rom24/commands/do_close.py @@ -22,8 +22,9 @@ def do_close(ch, argument): if obj: # portal stuff */ if obj.item_type == merc.ITEM_PORTAL: - if not state_checks.IS_SET(obj.value[1], merc.EX_ISDOOR) or state_checks.IS_SET(obj.value[1], - merc.EX_NOCLOSE): + if not state_checks.IS_SET( + obj.value[1], merc.EX_ISDOOR + ) or state_checks.IS_SET(obj.value[1], merc.EX_NOCLOSE): ch.send("You can't do that.\n") return if state_checks.IS_SET(obj.value[1], merc.EX_CLOSED): @@ -65,7 +66,11 @@ def do_close(ch, argument): pexit_rev.exit_info.set_bit(merc.EX_CLOSED) for rch_id in to_room.people[:]: rch = instance.characters[rch_id] - handler_game.act("The $d closes.", rch, None, pexit_rev.keyword, merc.TO_CHAR) + handler_game.act( + "The $d closes.", rch, None, pexit_rev.keyword, merc.TO_CHAR + ) -interp.register_command(interp.cmd_type('close', do_close, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("close", do_close, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_combine.py b/src/rom24/commands/do_combine.py index a023b27..160eef8 100644 --- a/src/rom24/commands/do_combine.py +++ b/src/rom24/commands/do_combine.py @@ -15,4 +15,6 @@ def do_combine(ch, argument): ch.comm.set_bit(merc.COMM_COMBINE) -interp.register_command(interp.cmd_type('combine', do_combine, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("combine", do_combine, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_commands.py b/src/rom24/commands/do_commands.py index 98fcabf..8b4e65a 100644 --- a/src/rom24/commands/do_commands.py +++ b/src/rom24/commands/do_commands.py @@ -19,4 +19,6 @@ def do_commands(ch, argument): return -interp.register_command(interp.cmd_type('commands', do_commands, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("commands", do_commands, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_compact.py b/src/rom24/commands/do_compact.py index af3911c..e9c87a2 100644 --- a/src/rom24/commands/do_compact.py +++ b/src/rom24/commands/do_compact.py @@ -15,4 +15,6 @@ def do_compact(ch, argument): ch.comm.set_bit(merc.COMM_COMPACT) -interp.register_command(interp.cmd_type('compact', do_compact, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("compact", do_compact, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_compare.py b/src/rom24/commands/do_compare.py index 42d5db5..153284a 100644 --- a/src/rom24/commands/do_compare.py +++ b/src/rom24/commands/do_compare.py @@ -22,8 +22,12 @@ def do_compare(ch, argument): obj2 = None if not arg2: for obj2 in ch.inventory[:]: - if obj2.equipped_to and ch.can_see_item(obj2) and obj1.item_type == obj2.item_type \ - and (obj1.equips_to & obj2.equips_to & ~merc.ITEM_TAKE) != 0: + if ( + obj2.equipped_to + and ch.can_see_item(obj2) + and obj1.item_type == obj2.item_type + and (obj1.equips_to & obj2.equips_to & ~merc.ITEM_TAKE) != 0 + ): break if not obj2: @@ -63,4 +67,6 @@ def do_compare(ch, argument): return -interp.register_command(interp.cmd_type('compare', do_compare, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("compare", do_compare, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_consider.py b/src/rom24/commands/do_consider.py index bbe7932..fd78622 100644 --- a/src/rom24/commands/do_consider.py +++ b/src/rom24/commands/do_consider.py @@ -40,4 +40,6 @@ def do_consider(ch, argument): return -interp.register_command(interp.cmd_type('consider', do_consider, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("consider", do_consider, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_count.py b/src/rom24/commands/do_count.py index ead0ffc..6919ded 100644 --- a/src/rom24/commands/do_count.py +++ b/src/rom24/commands/do_count.py @@ -7,20 +7,30 @@ from rom24 import interp from rom24 import nanny -#TODO: Known broken +# TODO: Known broken # for keeping track of the player count max_on = 0 def do_count(ch, argument): global max_on - count = len([d for d in merc.descriptor_list if d.is_connected(nanny.con_playing) and ch.can_see(handler_ch.CH(d))]) + count = len( + [ + d + for d in merc.descriptor_list + if d.is_connected(nanny.con_playing) and ch.can_see(handler_ch.CH(d)) + ] + ) max_on = max(count, max_on) if max_on == count: ch.send("There are %d characters on, the most so far today.\n" % count) else: - ch.send("There are %d characters on, the most on today was %d.\n" % (count, max_on)) + ch.send( + "There are %d characters on, the most on today was %d.\n" % (count, max_on) + ) -interp.register_command(interp.cmd_type('count', do_count, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("count", do_count, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_deaf.py b/src/rom24/commands/do_deaf.py index 7addacd..c079c9f 100644 --- a/src/rom24/commands/do_deaf.py +++ b/src/rom24/commands/do_deaf.py @@ -10,10 +10,12 @@ def do_deaf(ch, argument): if ch.comm.is_set(merc.COMM_DEAF): ch.send("You can now hear tells again.\n") - ch.comm.rem_bit( merc.COMM_DEAF) + ch.comm.rem_bit(merc.COMM_DEAF) else: ch.send("From now on, you won't hear tells.\n") - ch.comm.set_bit( merc.COMM_DEAF) + ch.comm.set_bit(merc.COMM_DEAF) -interp.register_command(interp.cmd_type('deaf', do_deaf, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("deaf", do_deaf, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_debug.py b/src/rom24/commands/do_debug.py index c51c456..1fdb17f 100644 --- a/src/rom24/commands/do_debug.py +++ b/src/rom24/commands/do_debug.py @@ -10,17 +10,22 @@ def do_debug(ch, argument): if not argument: - ch.send("Syntax: debug " - "\n\n " - "Safely execute commands and " - "get valuable debugging " - "information.\n") + ch.send( + "Syntax: debug " + "\n\n " + "Safely execute commands and " + "get valuable debugging " + "information.\n" + ) return safety, word = game_utils.read_word(argument) - if word.startswith('debug'): + if word.startswith("debug"): ch.send("Nope.\n") return handler_pc.Pc.interpret(ch, argument) return -interp.register_command(interp.cmd_type('debug', do_debug, merc.POS_DEAD, merc.ML, merc.LOG_NORMAL, 1)) + +interp.register_command( + interp.cmd_type("debug", do_debug, merc.POS_DEAD, merc.ML, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_delete.py b/src/rom24/commands/do_delete.py index 9a9cff1..7d8b80a 100644 --- a/src/rom24/commands/do_delete.py +++ b/src/rom24/commands/do_delete.py @@ -9,6 +9,7 @@ from rom24 import settings from rom24 import fight + def do_delete(ch, argument): if ch.is_npc(): return @@ -19,7 +20,7 @@ def do_delete(ch, argument): ch.confirm_delete = False return else: - pfile = os.path.join(settings.PLAYER_DIR, ch.name + '.json') + pfile = os.path.join(settings.PLAYER_DIR, ch.name + ".json") handler_game.wiznet("$N turns $Mself into line noise.", ch, None, 0, 0, 0) fight.stop_fighting(ch, True) ch.do_quit("") @@ -35,8 +36,14 @@ def do_delete(ch, argument): ch.confirm_delete = True handler_game.wiznet("$N is contemplating deletion.", ch, None, 0, 0, ch.trust) + def do_delet(ch, argument): ch.send("You must type the full command to delete yourself.\n") -interp.register_command(interp.cmd_type('delete', do_delete, merc.POS_STANDING, 0, merc.LOG_ALWAYS, 1)) -interp.register_command(interp.cmd_type('delet', do_delet, merc.POS_DEAD, 0, merc.LOG_ALWAYS, 0)) + +interp.register_command( + interp.cmd_type("delete", do_delete, merc.POS_STANDING, 0, merc.LOG_ALWAYS, 1) +) +interp.register_command( + interp.cmd_type("delet", do_delet, merc.POS_DEAD, 0, merc.LOG_ALWAYS, 0) +) diff --git a/src/rom24/commands/do_deny.py b/src/rom24/commands/do_deny.py index ad78060..7649c01 100644 --- a/src/rom24/commands/do_deny.py +++ b/src/rom24/commands/do_deny.py @@ -27,7 +27,14 @@ def do_deny(ch, argument): return victim.act = state_checks.SET_BIT(victim.act, merc.PLR_DENY) victim.send("You are denied access!\n") - handler_game.wiznet("$N denies access to %s" % victim.name, ch, None, merc.WIZ_PENALTIES, merc.WIZ_SECURE, 0) + handler_game.wiznet( + "$N denies access to %s" % victim.name, + ch, + None, + merc.WIZ_PENALTIES, + merc.WIZ_SECURE, + 0, + ) ch.send("OK.\n") victim.save(logout=True, force=True) fight.stop_fighting(victim, True) @@ -35,4 +42,6 @@ def do_deny(ch, argument): return -interp.register_command(interp.cmd_type("deny", do_deny, merc.POS_DEAD, merc.L1, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("deny", do_deny, merc.POS_DEAD, merc.L1, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_description.py b/src/rom24/commands/do_description.py index 3de4e09..cfce183 100644 --- a/src/rom24/commands/do_description.py +++ b/src/rom24/commands/do_description.py @@ -8,13 +8,13 @@ def do_description(ch, argument): if argument: - if argument[0] == '-': + if argument[0] == "-": if not ch.description: ch.send("No lines left to remove.\n") return - buf = ch.description.split('\n') + buf = ch.description.split("\n") buf.pop() - ch.description = '\n'.join(buf) + ch.description = "\n".join(buf) if len(buf) > 1: ch.send("Your description is:\n") ch.send(ch.description if ch.description else "(None).\n") @@ -23,7 +23,7 @@ def do_description(ch, argument): ch.description = "" ch.send("Description cleared.\n") return - if argument[0] == '+': + if argument[0] == "+": argument = argument[1:].lstrip() if len(argument) + len(ch.description) >= 1024: @@ -36,4 +36,6 @@ def do_description(ch, argument): return -interp.register_command(interp.cmd_type('description', do_description, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("description", do_description, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_dirt.py b/src/rom24/commands/do_dirt.py index 070c250..6757cea 100644 --- a/src/rom24/commands/do_dirt.py +++ b/src/rom24/commands/do_dirt.py @@ -14,9 +14,15 @@ def do_dirt(ch, argument): arghold, arg = game_utils.read_word(argument) - chance = ch.get_skill('dirt kicking') - if chance == 0 or (ch.is_npc() and not ch.off_flags.is_set(merc.OFF_KICK_DIRT)) \ - or ( not ch.is_npc() and ch.level < const.skill_table['dirt kicking'].skill_level[ch.guild.name]): + chance = ch.get_skill("dirt kicking") + if ( + chance == 0 + or (ch.is_npc() and not ch.off_flags.is_set(merc.OFF_KICK_DIRT)) + or ( + not ch.is_npc() + and ch.level < const.skill_table["dirt kicking"].skill_level[ch.guild.name] + ) + ): ch.send("You get your feet dirty.\n") return if not arg: @@ -29,7 +35,7 @@ def do_dirt(ch, argument): if victim is None: ch.send("They aren't here.\n") return - if victim.is_affected( merc.AFF_BLIND): + if victim.is_affected(merc.AFF_BLIND): handler_game.act("$E's already been blinded.", ch, None, victim, merc.TO_CHAR) return if victim == ch: @@ -37,11 +43,17 @@ def do_dirt(ch, argument): return if fight.is_safe(ch, victim): return - if victim.is_npc() and victim.fighting is not None and not ch.is_same_group(victim.fighting): + if ( + victim.is_npc() + and victim.fighting is not None + and not ch.is_same_group(victim.fighting) + ): ch.send("Kill stealing is not permitted.\n") return if ch.is_affected(merc.AFF_CHARM) and ch.master == victim: - handler_game.act("But $N is such a good friend!", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "But $N is such a good friend!", ch, None, victim, merc.TO_CHAR + ) return # modifiers @@ -50,9 +62,13 @@ def do_dirt(ch, argument): chance -= 2 * victim.stat(merc.STAT_DEX) # speed - if (ch.is_npc() and ch.off_flags.is_set(merc.OFF_FAST)) or ch.is_affected(merc.AFF_HASTE): + if (ch.is_npc() and ch.off_flags.is_set(merc.OFF_FAST)) or ch.is_affected( + merc.AFF_HASTE + ): chance += 10 - if (victim.is_npc() and victim.off_flags.is_set(merc.OFF_FAST)) or victim.is_affected( merc.AFF_HASTE): + if ( + victim.is_npc() and victim.off_flags.is_set(merc.OFF_FAST) + ) or victim.is_affected(merc.AFF_HASTE): chance -= 25 # level chance += (ch.level - victim.level) * 2 @@ -62,11 +78,12 @@ def do_dirt(ch, argument): chance += 1 # terrain nochance = [merc.SECT_WATER_SWIM, merc.SECT_WATER_NOSWIM, merc.SECT_AIR] - modifiers = {merc.SECT_INSIDE: -20, - merc.SECT_CITY: -10, - merc.SECT_FIELD: 5, - merc.SECT_MOUNTAIN: -10, - merc.SECT_DESERT: 10 + modifiers = { + merc.SECT_INSIDE: -20, + merc.SECT_CITY: -10, + merc.SECT_FIELD: 5, + merc.SECT_MOUNTAIN: -10, + merc.SECT_DESERT: 10, } if ch.in_room.sector_type in nochance: chance = 0 @@ -78,16 +95,20 @@ def do_dirt(ch, argument): return # now the attack if random.randint(1, 99) < chance: - handler_game.act("$n is blinded by the dirt in $s eyes!", victim, None, None, merc.TO_ROOM) + handler_game.act( + "$n is blinded by the dirt in $s eyes!", victim, None, None, merc.TO_ROOM + ) handler_game.act("$n kicks dirt in your eyes!", ch, None, victim, merc.TO_VICT) - fight.damage(ch, victim, random.randint(2, 5), 'dirt kicking', merc.DAM_NONE, False) + fight.damage( + ch, victim, random.randint(2, 5), "dirt kicking", merc.DAM_NONE, False + ) victim.send("You can't see a thing!\n") if ch.is_pc: - ch.check_improve( 'dirt kicking', True, 2) - state_checks.WAIT_STATE(ch, const.skill_table['dirt kicking'].beats) + ch.check_improve("dirt kicking", True, 2) + state_checks.WAIT_STATE(ch, const.skill_table["dirt kicking"].beats) af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS - af.type = 'dirt kicking' + af.type = "dirt kicking" af.level = ch.level af.duration = 0 af.location = merc.APPLY_HITROLL @@ -95,11 +116,13 @@ def do_dirt(ch, argument): af.bitvector = merc.AFF_BLIND victim.affect_add(af) else: - fight.damage(ch, victim, 0, 'dirt kicking', merc.DAM_NONE, True) + fight.damage(ch, victim, 0, "dirt kicking", merc.DAM_NONE, True) if ch.is_pc: - ch.check_improve( 'dirt kicking', False, 2) - state_checks.WAIT_STATE(ch, const.skill_table['dirt kicking'].beats) + ch.check_improve("dirt kicking", False, 2) + state_checks.WAIT_STATE(ch, const.skill_table["dirt kicking"].beats) fight.check_killer(ch, victim) -interp.register_command(interp.cmd_type('dirt', do_dirt, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("dirt", do_dirt, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_disarm.py b/src/rom24/commands/do_disarm.py index 0692ccd..e5a8737 100644 --- a/src/rom24/commands/do_disarm.py +++ b/src/rom24/commands/do_disarm.py @@ -13,20 +13,23 @@ def do_disarm(ch, argument): hth = 0 - chance = ch.get_skill('disarm') + chance = ch.get_skill("disarm") if chance == 0: ch.send("You don't know how to disarm opponents.\n") return - hth = ch.get_skill('hand to hand') - if not ch.get_eq('main_hand') \ - and hth == 0 or (ch.is_npc() and not ch.off_flags.is_set(merc.OFF_DISARM)): + hth = ch.get_skill("hand to hand") + if ( + not ch.get_eq("main_hand") + and hth == 0 + or (ch.is_npc() and not ch.off_flags.is_set(merc.OFF_DISARM)) + ): ch.send("You must wield a weapon to disarm.\n") return victim = ch.fighting if not victim: ch.send("You aren't fighting anyone.\n") return - item = victim.get_eq('main_hand') + item = victim.get_eq("main_hand") if not item: ch.send("Your opponent is not wielding a weapon.\n") return @@ -39,7 +42,7 @@ def do_disarm(ch, argument): # modifiers # skill - if not ch.get_eq('main_hand'): + if not ch.get_eq("main_hand"): chance = chance * hth // 150 else: chance = chance * ch_weapon // 100 @@ -55,19 +58,25 @@ def do_disarm(ch, argument): # and now the attack if random.randint(1, 99) < chance: - state_checks.WAIT_STATE(ch, const.skill_table['disarm'].beats) + state_checks.WAIT_STATE(ch, const.skill_table["disarm"].beats) fight.disarm(ch, victim) if ch.is_pc: - ch.check_improve('disarm', True, 1) + ch.check_improve("disarm", True, 1) else: - state_checks.WAIT_STATE(ch, const.skill_table['disarm'].beats) + state_checks.WAIT_STATE(ch, const.skill_table["disarm"].beats) handler_game.act("You fail to disarm $N.", ch, None, victim, merc.TO_CHAR) - handler_game.act("$n tries to disarm you, but fails.", ch, None, victim, merc.TO_VICT) - handler_game.act("$n tries to disarm $N, but fails.", ch, None, victim, merc.TO_NOTVICT) + handler_game.act( + "$n tries to disarm you, but fails.", ch, None, victim, merc.TO_VICT + ) + handler_game.act( + "$n tries to disarm $N, but fails.", ch, None, victim, merc.TO_NOTVICT + ) if ch.is_pc: - ch.check_improve('disarm', False, 1) + ch.check_improve("disarm", False, 1) fight.check_killer(ch, victim) return -interp.register_command(interp.cmd_type('disarm', do_disarm, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("disarm", do_disarm, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_disconnect.py b/src/rom24/commands/do_disconnect.py index f7f9a80..26cbbfc 100644 --- a/src/rom24/commands/do_disconnect.py +++ b/src/rom24/commands/do_disconnect.py @@ -26,7 +26,9 @@ def do_disconnect(ch, argument): ch.send("They aren't here.\n") return if victim.desc is None: - handler_game.act("$N doesn't have a descriptor.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N doesn't have a descriptor.", ch, None, victim, merc.TO_CHAR + ) return for d in merc.descriptor_list: if d == victim.desc: @@ -38,4 +40,8 @@ def do_disconnect(ch, argument): return -interp.register_command(interp.cmd_type('disconnect', do_disconnect, merc.POS_DEAD, merc.L3, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type( + "disconnect", do_disconnect, merc.POS_DEAD, merc.L3, merc.LOG_ALWAYS, 1 + ) +) diff --git a/src/rom24/commands/do_doat.py b/src/rom24/commands/do_doat.py index 30246d0..1e049f2 100644 --- a/src/rom24/commands/do_doat.py +++ b/src/rom24/commands/do_doat.py @@ -17,8 +17,11 @@ def do_at(ch, argument): if not location: ch.send("No such location.\n") return - if not ch.is_room_owner(location) and location.is_private() \ - and ch.trust < merc.MAX_LEVEL: + if ( + not ch.is_room_owner(location) + and location.is_private() + and ch.trust < merc.MAX_LEVEL + ): ch.send("That room is private right now.\n") return original = ch.in_room @@ -37,4 +40,6 @@ def do_at(ch, argument): break -interp.register_command(interp.cmd_type('doat', do_at, merc.POS_DEAD, merc.L6, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("doat", do_at, merc.POS_DEAD, merc.L6, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_down.py b/src/rom24/commands/do_down.py index 7a6cb72..0b1d27d 100644 --- a/src/rom24/commands/do_down.py +++ b/src/rom24/commands/do_down.py @@ -6,9 +6,12 @@ from rom24 import interp from rom24 import merc + def do_down(ch, argument): handler_ch.move_char(ch, merc.DIR_DOWN, False) return -interp.register_command(interp.cmd_type('down', do_down, merc.POS_STANDING, 0, merc.LOG_NEVER, 0)) +interp.register_command( + interp.cmd_type("down", do_down, merc.POS_STANDING, 0, merc.LOG_NEVER, 0) +) diff --git a/src/rom24/commands/do_drink.py b/src/rom24/commands/do_drink.py index 6378df1..322d7b6 100644 --- a/src/rom24/commands/do_drink.py +++ b/src/rom24/commands/do_drink.py @@ -56,12 +56,22 @@ def do_drink(ch, argument): if not ch.is_npc() and not ch.is_immortal() and ch.condition[merc.COND_FULL] > 45: ch.send("You're too full to drink more.\n") return - handler_game.act("$n drinks $T from $p.", ch, obj, const.liq_table[liquid].name, merc.TO_ROOM) - handler_game.act("You drink $T from $p.", ch, obj, const.liq_table[liquid].name, merc.TO_CHAR) - update.gain_condition(ch, merc.COND_DRUNK, amount * const.liq_table[liquid].proof / 36) + handler_game.act( + "$n drinks $T from $p.", ch, obj, const.liq_table[liquid].name, merc.TO_ROOM + ) + handler_game.act( + "You drink $T from $p.", ch, obj, const.liq_table[liquid].name, merc.TO_CHAR + ) + update.gain_condition( + ch, merc.COND_DRUNK, amount * const.liq_table[liquid].proof / 36 + ) update.gain_condition(ch, merc.COND_FULL, amount * const.liq_table[liquid].full / 4) - update.gain_condition(ch, merc.COND_THIRST, amount * const.liq_table[liquid].thirst / 10) - update.gain_condition(ch, merc.COND_HUNGER, amount * const.liq_table[liquid].food / 2) + update.gain_condition( + ch, merc.COND_THIRST, amount * const.liq_table[liquid].thirst / 10 + ) + update.gain_condition( + ch, merc.COND_HUNGER, amount * const.liq_table[liquid].food / 2 + ) if not ch.is_npc() and ch.condition[merc.COND_DRUNK] > 10: ch.send("You feel drunk.\n") if not ch.is_npc() and ch.condition[merc.COND_FULL] > 40: @@ -86,4 +96,6 @@ def do_drink(ch, argument): return -interp.register_command(interp.cmd_type('drink', do_drink, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("drink", do_drink, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_drop.py b/src/rom24/commands/do_drop.py index a57a44d..5cd0936 100644 --- a/src/rom24/commands/do_drop.py +++ b/src/rom24/commands/do_drop.py @@ -23,7 +23,9 @@ def do_drop(ch, argument): silver = 0 amount = int(arg) argument, arg = game_utils.read_word(argument) - if amount <= 0 or (arg != "coins" and arg != "coin" and arg != "gold" and arg != "silver"): + if amount <= 0 or ( + arg != "coins" and arg != "coin" and arg != "gold" and arg != "silver" + ): ch.send("Sorry, you can't do that.\n") return if arg == "coins" or arg == "coin" or arg == "silver": @@ -82,24 +84,36 @@ def do_drop(ch, argument): found = False for item_id in ch.inventory[:]: item = instance.items[item_id] - if (len(arg) == 3 or arg[4:] in item.name) \ - and ch.can_see_item(item) \ - and not item.equipped_to \ - and ch.can_drop_item(item): + if ( + (len(arg) == 3 or arg[4:] in item.name) + and ch.can_see_item(item) + and not item.equipped_to + and ch.can_drop_item(item) + ): found = True ch.get(item) ch.in_room.put(item) handler_game.act("$n drops $p.", ch, item, None, merc.TO_ROOM) handler_game.act("You drop $p.", ch, item, None, merc.TO_CHAR) if item.flags.melt_drop: - handler_game.act("$p dissolves into smoke.", ch, item, None, merc.TO_ROOM) - handler_game.act("$p dissolves into smoke.", ch, item, None, merc.TO_CHAR) + handler_game.act( + "$p dissolves into smoke.", ch, item, None, merc.TO_ROOM + ) + handler_game.act( + "$p dissolves into smoke.", ch, item, None, merc.TO_CHAR + ) item.extract() if not found: - if arg == 'all': - handler_game.act("You are not carrying anything.", ch, None, arg, merc.TO_CHAR) + if arg == "all": + handler_game.act( + "You are not carrying anything.", ch, None, arg, merc.TO_CHAR + ) else: - handler_game.act("You are not carrying any $T.", ch, None, arg[4:], merc.TO_CHAR) + handler_game.act( + "You are not carrying any $T.", ch, None, arg[4:], merc.TO_CHAR + ) -interp.register_command(interp.cmd_type('drop', do_drop, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("drop", do_drop, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_dump.py b/src/rom24/commands/do_dump.py index 3b4c8fd..fb2c4bb 100644 --- a/src/rom24/commands/do_dump.py +++ b/src/rom24/commands/do_dump.py @@ -5,9 +5,11 @@ from rom24 import merc from rom24 import interp -#TODO: Known broken +# TODO: Known broken def do_dump(ch, argument): pass -interp.register_command(interp.cmd_type('dump', do_dump, merc.POS_DEAD, merc.ML, merc.LOG_ALWAYS, 0)) +interp.register_command( + interp.cmd_type("dump", do_dump, merc.POS_DEAD, merc.ML, merc.LOG_ALWAYS, 0) +) diff --git a/src/rom24/commands/do_east.py b/src/rom24/commands/do_east.py index 751a162..afb645d 100644 --- a/src/rom24/commands/do_east.py +++ b/src/rom24/commands/do_east.py @@ -12,4 +12,6 @@ def do_east(ch, argument): return -interp.register_command(interp.cmd_type('east', do_east, merc.POS_STANDING, 0, merc.LOG_NEVER, 0)) +interp.register_command( + interp.cmd_type("east", do_east, merc.POS_STANDING, 0, merc.LOG_NEVER, 0) +) diff --git a/src/rom24/commands/do_eat.py b/src/rom24/commands/do_eat.py index 1f755ea..91bb8c7 100644 --- a/src/rom24/commands/do_eat.py +++ b/src/rom24/commands/do_eat.py @@ -58,4 +58,6 @@ def do_eat(ch, argument): return -interp.register_command(interp.cmd_type('eat', do_eat, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("eat", do_eat, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_echo.py b/src/rom24/commands/do_echo.py index 361c1dd..542b4d3 100644 --- a/src/rom24/commands/do_echo.py +++ b/src/rom24/commands/do_echo.py @@ -19,4 +19,6 @@ def do_echo(ch, argument): return -interp.register_command(interp.cmd_type('gecho', do_echo, merc.POS_DEAD, merc.L4, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("gecho", do_echo, merc.POS_DEAD, merc.L4, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_emote.py b/src/rom24/commands/do_emote.py index 92fdc3f..ffaee0b 100644 --- a/src/rom24/commands/do_emote.py +++ b/src/rom24/commands/do_emote.py @@ -19,5 +19,9 @@ def do_emote(ch, argument): return -interp.register_command(interp.cmd_type('emote', do_emote, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) -interp.register_command(interp.cmd_type(',', do_emote, merc.POS_RESTING, 0, merc.LOG_NORMAL, 0)) +interp.register_command( + interp.cmd_type("emote", do_emote, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) +interp.register_command( + interp.cmd_type(",", do_emote, merc.POS_RESTING, 0, merc.LOG_NORMAL, 0) +) diff --git a/src/rom24/commands/do_enter.py b/src/rom24/commands/do_enter.py index 499e309..75bfe24 100644 --- a/src/rom24/commands/do_enter.py +++ b/src/rom24/commands/do_enter.py @@ -22,29 +22,53 @@ def do_enter(ch, argument): if not portal: ch.send("You don't see that here.\n") return - if portal.item_type != merc.ITEM_PORTAL \ - or (state_checks.IS_SET(portal.value[1], merc.EX_CLOSED) and not state_checks.IS_TRUSTED(ch, merc.L7)): + if portal.item_type != merc.ITEM_PORTAL or ( + state_checks.IS_SET(portal.value[1], merc.EX_CLOSED) + and not state_checks.IS_TRUSTED(ch, merc.L7) + ): ch.send("You can't seem to find a way in.\n") return - if not state_checks.IS_TRUSTED(ch, merc.L7) and not state_checks.IS_SET(portal.value[2], merc.GATE_NOCURSE) \ - and (ch.is_affected(merc.AFF_CURSE) or state_checks.IS_SET(old_room.room_flags, merc.ROOM_NO_RECALL)): + if ( + not state_checks.IS_TRUSTED(ch, merc.L7) + and not state_checks.IS_SET(portal.value[2], merc.GATE_NOCURSE) + and ( + ch.is_affected(merc.AFF_CURSE) + or state_checks.IS_SET(old_room.room_flags, merc.ROOM_NO_RECALL) + ) + ): ch.send("Something prevents you from leaving...\n") return location = None - if state_checks.IS_SET(portal.value[2], merc.GATE_RANDOM) or portal.value[3] == -1: + if ( + state_checks.IS_SET(portal.value[2], merc.GATE_RANDOM) + or portal.value[3] == -1 + ): location = handler_room.get_random_room(ch) portal.value[3] = location.vnum # for record keeping :) - elif state_checks.IS_SET(portal.value[2], merc.GATE_BUGGY) and (random.randint(1, 99) < 5): + elif state_checks.IS_SET(portal.value[2], merc.GATE_BUGGY) and ( + random.randint(1, 99) < 5 + ): location = handler_room.get_random_room(ch) else: location = instance.rooms[portal.value[3]] - if not location or location == old_room \ - or not ch.can_see_room(location.instance_id) \ - or (location.is_private() and not state_checks.IS_TRUSTED(ch, merc.MAX_LEVEL)): - handler_game.act("$p doesn't seem to go anywhere.", ch, portal, None, merc.TO_CHAR) + if ( + not location + or location == old_room + or not ch.can_see_room(location.instance_id) + or ( + location.is_private() + and not state_checks.IS_TRUSTED(ch, merc.MAX_LEVEL) + ) + ): + handler_game.act( + "$p doesn't seem to go anywhere.", ch, portal, None, merc.TO_CHAR + ) return - if ch.is_npc() and ch.act.is_set(merc.ACT_AGGRESSIVE) \ - and state_checks.IS_SET(location.room_flags, merc.ROOM_LAW): + if ( + ch.is_npc() + and ch.act.is_set(merc.ACT_AGGRESSIVE) + and state_checks.IS_SET(location.room_flags, merc.ROOM_LAW) + ): ch.send("Something prevents you from leaving...\n") return handler_game.act("$n steps into $p.", ch, portal, None, merc.TO_ROOM) @@ -52,16 +76,26 @@ def do_enter(ch, argument): if state_checks.IS_SET(portal.value[2], merc.GATE_NORMAL_EXIT): handler_game.act("You enter $p.", ch, portal, None, merc.TO_CHAR) else: - handler_game.act("You walk through $p and find yourself somewhere else:...", ch, portal, None, merc.TO_CHAR) + handler_game.act( + "You walk through $p and find yourself somewhere else:...", + ch, + portal, + None, + merc.TO_CHAR, + ) ch.in_room.get(ch) location.put(ch) - if state_checks.IS_SET(portal.value[2], merc.GATE_GOWITH): # take the gate along + if state_checks.IS_SET( + portal.value[2], merc.GATE_GOWITH + ): # take the gate along portal.get() portal.put(location) if state_checks.IS_SET(portal.value[2], merc.GATE_NORMAL_EXIT): handler_game.act("$n has arrived.", ch, portal, None, merc.TO_ROOM) else: - handler_game.act("$n has arrived through $p.", ch, portal, None, merc.TO_ROOM) + handler_game.act( + "$n has arrived through $p.", ch, portal, None, merc.TO_ROOM + ) ch.do_look("auto") # charges @@ -77,29 +111,57 @@ def do_enter(ch, argument): if not portal or portal.value[0] == -1: # no following through dead portals continue - if fch.master == ch and state_checks.IS_AFFECTED(fch, merc.AFF_CHARM) \ - and fch.position < merc.POS_STANDING: + if ( + fch.master == ch + and state_checks.IS_AFFECTED(fch, merc.AFF_CHARM) + and fch.position < merc.POS_STANDING + ): fch.do_stand("") if fch.master == ch and fch.position == merc.POS_STANDING: - if state_checks.IS_SET(ch.in_room.room_flags, merc.ROOM_LAW) \ - and (state_checks.IS_NPC(fch) and fch.act.is_set(merc.ACT_AGGRESSIVE)): - handler_game.act("You can't bring $N into the city.", ch, None, fch, merc.TO_CHAR) - handler_game.act("You aren't allowed in the city.", fch, None, None, merc.TO_CHAR) + if state_checks.IS_SET(ch.in_room.room_flags, merc.ROOM_LAW) and ( + state_checks.IS_NPC(fch) and fch.act.is_set(merc.ACT_AGGRESSIVE) + ): + handler_game.act( + "You can't bring $N into the city.", ch, None, fch, merc.TO_CHAR + ) + handler_game.act( + "You aren't allowed in the city.", fch, None, None, merc.TO_CHAR + ) continue handler_game.act("You follow $N.", fch, None, ch, merc.TO_CHAR) fch.do_enter(argument) if portal and portal.value[0] == -1: - handler_game.act("$p fades out of existence.", ch, portal, None, merc.TO_CHAR) + handler_game.act( + "$p fades out of existence.", ch, portal, None, merc.TO_CHAR + ) if ch.in_room == old_room: - handler_game.act("$p fades out of existence.", ch, portal, None, merc.TO_ROOM) + handler_game.act( + "$p fades out of existence.", ch, portal, None, merc.TO_ROOM + ) elif old_room.people: - handler_game.act("$p fades out of existence.", old_room.people, portal, None, merc.TO_CHAR) - handler_game.act("$p fades out of existence.", old_room.people, portal, None, merc.TO_ROOM) + handler_game.act( + "$p fades out of existence.", + old_room.people, + portal, + None, + merc.TO_CHAR, + ) + handler_game.act( + "$p fades out of existence.", + old_room.people, + portal, + None, + merc.TO_ROOM, + ) portal.extract() return ch.send("Nope, can't do it.\n") return -interp.register_command(interp.cmd_type('enter', do_enter, merc.POS_STANDING, 0, merc.LOG_NORMAL, 1)) -interp.register_command(interp.cmd_type('go', do_enter, merc.POS_STANDING, 0, merc.LOG_NORMAL, 0)) +interp.register_command( + interp.cmd_type("enter", do_enter, merc.POS_STANDING, 0, merc.LOG_NORMAL, 1) +) +interp.register_command( + interp.cmd_type("go", do_enter, merc.POS_STANDING, 0, merc.LOG_NORMAL, 0) +) diff --git a/src/rom24/commands/do_envenom.py b/src/rom24/commands/do_envenom.py index ad8fedf..a2f8eff 100644 --- a/src/rom24/commands/do_envenom.py +++ b/src/rom24/commands/do_envenom.py @@ -20,7 +20,7 @@ def do_envenom(ch, argument): if not item: ch.send("You don't have that item.\n") return - skill = ch.get_skill('envenom') + skill = ch.get_skill("envenom") if skill < 1: ch.send("Are you crazy? You'd poison yourself!\n") return @@ -29,26 +29,43 @@ def do_envenom(ch, argument): handler_game.act("You fail to poison $p.", ch, item, None, merc.TO_CHAR) return if random.randint(1, 99) < skill: # success! - handler_game.act("$n treats $p with deadly poison.", ch, item, None, merc.TO_ROOM) - handler_game.act("You treat $p with deadly poison.", ch, item, None, merc.TO_CHAR) + handler_game.act( + "$n treats $p with deadly poison.", ch, item, None, merc.TO_ROOM + ) + handler_game.act( + "You treat $p with deadly poison.", ch, item, None, merc.TO_CHAR + ) if not item.value[3]: item.value[3] = 1 if ch.is_pc: - ch.check_improve( "envenom", True, 4) + ch.check_improve("envenom", True, 4) state_checks.WAIT_STATE(ch, const.skill_table["envenom"].beats) return handler_game.act("You fail to poison $p.", ch, item, None, merc.TO_CHAR) if not item.value[3]: if ch.is_pc: - ch.check_improve( "envenom", False, 4) + ch.check_improve("envenom", False, 4) state_checks.WAIT_STATE(ch, const.skill_table["envenom"].beats) return if item.item_type == merc.ITEM_WEAPON: - if item.flags.flaming or item.flags.frost or item.flags.vampiric or item.flags.sharp \ - or item.flags.vorpal or item.flags.shocking or item.flags.bless or item.flags.burn_proof: - handler_game.act("You can't seem to envenom $p.", ch, item, None, merc.TO_CHAR) + if ( + item.flags.flaming + or item.flags.frost + or item.flags.vampiric + or item.flags.sharp + or item.flags.vorpal + or item.flags.shocking + or item.flags.bless + or item.flags.burn_proof + ): + handler_game.act( + "You can't seem to envenom $p.", ch, item, None, merc.TO_CHAR + ) return - if item.value[3] < 0 or const.attack_table[item.value[3]].damage == merc.DAM_BASH: + if ( + item.value[3] < 0 + or const.attack_table[item.value[3]].damage == merc.DAM_BASH + ): ch.send("You can only envenom edged weapons.\n") return if state_checks.IS_WEAPON_STAT(item, merc.WEAPON_POISON): @@ -66,10 +83,12 @@ def do_envenom(ch, argument): af.bitvector = merc.WEAPON_POISON item.affect_add(af) - handler_game.act("$n coats $p with deadly venom.", ch, item, None, merc.TO_ROOM) + handler_game.act( + "$n coats $p with deadly venom.", ch, item, None, merc.TO_ROOM + ) handler_game.act("You coat $p with venom.", ch, item, None, merc.TO_CHAR) if ch.is_pc: - ch.check_improve( "envenom", True, 3) + ch.check_improve("envenom", True, 3) state_checks.WAIT_STATE(ch, const.skill_table["envenom"].beats) return else: @@ -82,4 +101,6 @@ def do_envenom(ch, argument): return -interp.register_command(interp.cmd_type('envenom', do_envenom, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("envenom", do_envenom, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_equipment.py b/src/rom24/commands/do_equipment.py index a7d4168..1939ef0 100644 --- a/src/rom24/commands/do_equipment.py +++ b/src/rom24/commands/do_equipment.py @@ -14,8 +14,12 @@ def do_equipment(ch, argument): item = ch.get_eq(slot) if not item: continue - if item.flags.two_handed and ch.equipped['off_hand'] == item.instance_id and 'off_hand' in slot: - continue + if ( + item.flags.two_handed + and ch.equipped["off_hand"] == item.instance_id + and "off_hand" in slot + ): + continue else: ch.send(merc.eq_slot_strings[slot]) if ch.can_see_item(item): @@ -27,4 +31,6 @@ def do_equipment(ch, argument): ch.send("Nothing.\n") -interp.register_command(interp.cmd_type('equipment', do_equipment, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("equipment", do_equipment, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_examine.py b/src/rom24/commands/do_examine.py index 1b985f0..6104bd2 100644 --- a/src/rom24/commands/do_examine.py +++ b/src/rom24/commands/do_examine.py @@ -32,13 +32,20 @@ def do_examine(ch, argument): else: buf = "There are %d silver coins in the pile.\n" % obj.value[0] else: - buf = "There are %d gold and %d silver coins in the pile.\n" % (obj.value[1], obj.value[0]) + buf = "There are %d gold and %d silver coins in the pile.\n" % ( + obj.value[1], + obj.value[0], + ) ch.send(buf) - elif obj.item_type == merc.ITEM_DRINK_CON \ - or obj.item_type == merc.ITEM_CONTAINER \ - or obj.item_type == merc.ITEM_CORPSE_NPC \ - or obj.item_type == merc.ITEM_CORPSE_PC: + elif ( + obj.item_type == merc.ITEM_DRINK_CON + or obj.item_type == merc.ITEM_CONTAINER + or obj.item_type == merc.ITEM_CORPSE_NPC + or obj.item_type == merc.ITEM_CORPSE_PC + ): ch.do_look("in %s" % arg) -interp.register_command(interp.cmd_type('examine', do_examine, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("examine", do_examine, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_exits.py b/src/rom24/commands/do_exits.py index 48c4eab..8031659 100644 --- a/src/rom24/commands/do_exits.py +++ b/src/rom24/commands/do_exits.py @@ -10,7 +10,7 @@ # Thanks to Zrin for auto-exit part. def do_exits(ch, argument): fAuto = argument == "auto" - buf = '' + buf = "" if not ch.check_blind(): return if fAuto: @@ -21,10 +21,13 @@ def do_exits(ch, argument): buf += "Obvious exits:\n" found = False for door, pexit in enumerate(ch.in_room.exit): - if pexit \ - and (ch.act.is_set(merc.PLR_OMNI) - or (ch.can_see_room(pexit.to_room) - and not pexit.exit_info.is_set(merc.EX_CLOSED))): + if pexit and ( + ch.act.is_set(merc.PLR_OMNI) + or ( + ch.can_see_room(pexit.to_room) + and not pexit.exit_info.is_set(merc.EX_CLOSED) + ) + ): found = True if pexit.is_broken: buf += " #%s#" % (merc.dir_name[door]) @@ -38,8 +41,10 @@ def do_exits(ch, argument): if ch.act.is_set(merc.PLR_OMNI): buf += "(%d)" % pto_room.vnum elif pto_room: - buf += "%-5s - %s" % (merc.dir_name[door].capitalize(), - "Too dark to tell" if pto_room.is_dark() else pto_room.name) + buf += "%-5s - %s" % ( + merc.dir_name[door].capitalize(), + "Too dark to tell" if pto_room.is_dark() else pto_room.name, + ) if ch.is_immortal(): buf += " (room %d)\n" % pto_room.vnum else: @@ -52,4 +57,6 @@ def do_exits(ch, argument): return -interp.register_command(interp.cmd_type('exits', do_exits, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("exits", do_exits, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_fill.py b/src/rom24/commands/do_fill.py index 752f5c0..9c4eb7a 100644 --- a/src/rom24/commands/do_fill.py +++ b/src/rom24/commands/do_fill.py @@ -36,13 +36,25 @@ def do_fill(ch, argument): if obj.value[1] >= obj.value[0]: ch.send("Your container is full.\n") return - handler_game.act("You fill $p with %s from $P." % const.liq_table[fountain.value[2]].name, ch, obj, fountain, - merc.TO_CHAR) - handler_game.act("$n fills $p with %s from $P." % const.liq_table[fountain.value[2]].name, ch, obj, fountain, - merc.TO_ROOM) + handler_game.act( + "You fill $p with %s from $P." % const.liq_table[fountain.value[2]].name, + ch, + obj, + fountain, + merc.TO_CHAR, + ) + handler_game.act( + "$n fills $p with %s from $P." % const.liq_table[fountain.value[2]].name, + ch, + obj, + fountain, + merc.TO_ROOM, + ) obj.value[2] = fountain.value[2] obj.value[1] = obj.value[0] return -interp.register_command(interp.cmd_type('fill', do_fill, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("fill", do_fill, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_flags.py b/src/rom24/commands/do_flags.py index 642dc0d..182fdbd 100644 --- a/src/rom24/commands/do_flags.py +++ b/src/rom24/commands/do_flags.py @@ -7,9 +7,9 @@ from rom24 import game_utils from rom24 import tables -__author__ = 'venom' +__author__ = "venom" -#int flag_lookup args( ( const char *name, const struct flag_type *flag_table) ); +# int flag_lookup args( ( const char *name, const struct flag_type *flag_table) ); def do_flags(ch, argument): @@ -17,18 +17,18 @@ def do_flags(ch, argument): frem = None fequals = None - if '+' in argument: - argument.strip('+') + if "+" in argument: + argument.strip("+") fadd = True - elif '-' in argument: - argument.strip('-') + elif "-" in argument: + argument.strip("-") frem = True - elif '=' in argument: - argument.strip('=') + elif "=" in argument: + argument.strip("=") fequals = True victim = None - + f_argument, arg1 = game_utils.read_word(argument) f_argument, arg2 = game_utils.read_word(f_argument) f_argument, arg3 = game_utils.read_word(f_argument) @@ -61,22 +61,22 @@ def do_flags(ch, argument): ch.send("Which flags do you wish to change?\n") return - if arg1 in ('mob', 'npc', 'character', 'char'): + if arg1 in ("mob", "npc", "character", "char"): victim = ch.get_char_world(arg2) else: - ch.send('You cannot find them.') + ch.send("You cannot find them.") return - if arg3.startswith('act'): + if arg3.startswith("act"): if not victim.is_npc(): ch.send("Use plr for PCs.\n") return for comp_flag in tables.act_flags.values(): if not in_flags: - ch.send('No flags to set.') + ch.send("No flags to set.") return if not comp_flag.name in in_flags: - ch.send('Flag %s does not exist' % comp_flag.name) + ch.send("Flag %s does not exist" % comp_flag.name) in_flags.discard(comp_flag.name) continue else: @@ -87,15 +87,19 @@ def do_flags(ch, argument): victim.act.set_bit(comp_flag.bit) elif frem: victim.act.rem_bit(comp_flag.bit) - ch.send('Act flags: {disp_flags}\n Have been set.'.format(disp_flags=(item for item in in_flags))) + ch.send( + "Act flags: {disp_flags}\n Have been set.".format( + disp_flags=(item for item in in_flags) + ) + ) - if arg3.startswith('plr'): + if arg3.startswith("plr"): if victim.is_npc(): ch.send("Use act for NPCs.\n") return for comp_flag in in_flags: if not comp_flag not in tables.plr_flags: - ch.send('Flag %s does not exist' % comp_flag.name) + ch.send("Flag %s does not exist" % comp_flag.name) in_flags.discard(comp_flag.name) continue else: @@ -106,15 +110,19 @@ def do_flags(ch, argument): victim.act.set_bit(tables.plr_flags[comp_flag].bit) elif frem: victim.act.rem_bit(tables.plr_flags[comp_flag].bit) - ch.send('Plr flags: {disp_flags}\n Have been set.'.format(disp_flags=(item for item in in_flags))) + ch.send( + "Plr flags: {disp_flags}\n Have been set.".format( + disp_flags=(item for item in in_flags) + ) + ) - if arg3.startswith('aff'): + if arg3.startswith("aff"): for comp_flag in tables.affect_flags.values(): if not in_flags: - ch.send('No flags to set.') + ch.send("No flags to set.") return if not comp_flag.name in in_flags: - ch.send('Flag %s does not exist' % comp_flag.name) + ch.send("Flag %s does not exist" % comp_flag.name) in_flags.discard(comp_flag.name) continue else: @@ -125,15 +133,19 @@ def do_flags(ch, argument): victim.affected_by.set_bit(comp_flag.bit) elif frem: victim.affected_by.rem_bit(comp_flag.bit) - ch.send('Affect flags: {disp_flags}\n Have been set.'.format(disp_flags=(item for item in in_flags))) + ch.send( + "Affect flags: {disp_flags}\n Have been set.".format( + disp_flags=(item for item in in_flags) + ) + ) - if arg3.startswith('vuln'): + if arg3.startswith("vuln"): for comp_flag in tables.imm_flags.values(): if not in_flags: - ch.send('No flags to set.') + ch.send("No flags to set.") return if not comp_flag.name in in_flags: - ch.send('Flag %s does not exist' % comp_flag.name) + ch.send("Flag %s does not exist" % comp_flag.name) in_flags.discard(comp_flag.name) continue else: @@ -144,15 +156,19 @@ def do_flags(ch, argument): victim.vuln_flags.set_bit(comp_flag.bit) elif frem: victim.vuln_flags.rem_bit(comp_flag.bit) - ch.send('Vuln flags: {disp_flags}\n Have been set.'.format(disp_flags=(item for item in in_flags))) + ch.send( + "Vuln flags: {disp_flags}\n Have been set.".format( + disp_flags=(item for item in in_flags) + ) + ) - if arg3.startswith('immunity'): + if arg3.startswith("immunity"): for comp_flag in tables.imm_flags.values(): if not in_flags: - ch.send('No flags to set.') + ch.send("No flags to set.") return if not comp_flag.name in in_flags: - ch.send('Flag %s does not exist' % comp_flag.name) + ch.send("Flag %s does not exist" % comp_flag.name) in_flags.discard(comp_flag.name) continue else: @@ -163,15 +179,19 @@ def do_flags(ch, argument): victim.imm_flags.set_bit(comp_flag.bit) elif frem: victim.imm_flags.rem_bit(comp_flag.bit) - ch.send('Immunity flags: {disp_flags}\n Have been set.'.format(disp_flags=(item for item in in_flags))) + ch.send( + "Immunity flags: {disp_flags}\n Have been set.".format( + disp_flags=(item for item in in_flags) + ) + ) - if arg3.startswith('resist'): + if arg3.startswith("resist"): for comp_flag in tables.imm_flags.values(): if not in_flags: - ch.send('No flags to set.') + ch.send("No flags to set.") return if not comp_flag.name in in_flags: - ch.send('Flag %s does not exist' % comp_flag.name) + ch.send("Flag %s does not exist" % comp_flag.name) in_flags.discard(comp_flag.name) continue else: @@ -182,18 +202,22 @@ def do_flags(ch, argument): victim.res_flags.set_bit(comp_flag.bit) elif frem: victim.res_flags.rem_bit(comp_flag.bit) - ch.send('Resist flags: {disp_flags}\n Have been set.'.format(disp_flags=(item for item in in_flags))) + ch.send( + "Resist flags: {disp_flags}\n Have been set.".format( + disp_flags=(item for item in in_flags) + ) + ) - if arg3.startswith('form'): + if arg3.startswith("form"): if not victim.is_npc(): ch.send("Form can't be set on PCs.\n") return for comp_flag in tables.form_flags.values(): if not in_flags: - ch.send('No flags to set.') + ch.send("No flags to set.") return if not comp_flag.name in in_flags: - ch.send('Flag %s does not exist' % comp_flag.name) + ch.send("Flag %s does not exist" % comp_flag.name) in_flags.discard(comp_flag.name) continue else: @@ -204,18 +228,22 @@ def do_flags(ch, argument): victim.form_flags.set_bit(comp_flag.bit) elif frem: victim.form_flags.rem_bit(comp_flag.bit) - ch.send('Form flags: {disp_flags}\n Have been set.'.format(disp_flags=(item for item in in_flags))) + ch.send( + "Form flags: {disp_flags}\n Have been set.".format( + disp_flags=(item for item in in_flags) + ) + ) - if arg3.startswith('parts'): + if arg3.startswith("parts"): if not victim.is_npc(): ch.send("Parts can't be set on PCs.\n") return for comp_flag in tables.part_flags.values(): if not in_flags: - ch.send('No flags to set.') + ch.send("No flags to set.") return if not comp_flag.name in in_flags: - ch.send('Flag %s does not exist' % comp_flag.name) + ch.send("Flag %s does not exist" % comp_flag.name) in_flags.discard(comp_flag.name) continue else: @@ -226,18 +254,22 @@ def do_flags(ch, argument): victim.parts.set_bit(comp_flag.bit) elif frem: victim.parts.rem_bit(comp_flag.bit) - ch.send('Parts flags: {disp_flags}\n Have been set.'.format(disp_flags=(item for item in in_flags))) + ch.send( + "Parts flags: {disp_flags}\n Have been set.".format( + disp_flags=(item for item in in_flags) + ) + ) - if arg3.startswith('comm'): + if arg3.startswith("comm"): if victim.is_npc(): ch.send("Comm can't be set on NPCs.\n") return for comp_flag in tables.comm_flags.values(): if not in_flags: - ch.send('No flags to set.') + ch.send("No flags to set.") return if not comp_flag.name in in_flags: - ch.send('Flag %s does not exist' % comp_flag.name) + ch.send("Flag %s does not exist" % comp_flag.name) in_flags.discard(comp_flag.name) continue else: @@ -248,6 +280,13 @@ def do_flags(ch, argument): victim.comm.set_bit(comp_flag.bit) elif frem: victim.comm.rem_bit(comp_flag.bit) - ch.send('Comm flags: {disp_flags}\n Have been set.'.format(disp_flags=(item for item in in_flags))) + ch.send( + "Comm flags: {disp_flags}\n Have been set.".format( + disp_flags=(item for item in in_flags) + ) + ) + -interp.register_command(interp.cmd_type('flag', do_flags, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("flag", do_flags, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_flee.py b/src/rom24/commands/do_flee.py index d588002..a97fe7c 100644 --- a/src/rom24/commands/do_flee.py +++ b/src/rom24/commands/do_flee.py @@ -14,7 +14,7 @@ from rom24 import instance -def do_flee( ch, argument ): +def do_flee(ch, argument): victim = ch.fighting if not victim: if ch.position == merc.POS_FIGHTING: @@ -26,12 +26,18 @@ def do_flee( ch, argument ): for attempt in range(6): door = handler_room.number_door() pexit = was_in.exit[door] - if not pexit \ - or not pexit.to_room \ - or pexit.exit_info.is_set(merc.EX_CLOSED) \ - or random.randint(0, ch.daze) != 0 \ - or (ch.is_npc() - and state_checks.IS_SET(instance.rooms[pexit.to_room].room_flags, merc.ROOM_NO_MOB)): + if ( + not pexit + or not pexit.to_room + or pexit.exit_info.is_set(merc.EX_CLOSED) + or random.randint(0, ch.daze) != 0 + or ( + ch.is_npc() + and state_checks.IS_SET( + instance.rooms[pexit.to_room].room_flags, merc.ROOM_NO_MOB + ) + ) + ): continue handler_ch.move_char(ch, door, False) @@ -44,7 +50,9 @@ def do_flee( ch, argument ): if not ch.is_npc(): ch.send("You flee from combat!\n") - if ch.guild.name == 'thief' and (random.randint(1, 99) < 3 * (ch.level // 2)): + if ch.guild.name == "thief" and ( + random.randint(1, 99) < 3 * (ch.level // 2) + ): ch.send("You snuck away safely.\n") else: ch.send("You lost 10 exp.\n") @@ -56,4 +64,6 @@ def do_flee( ch, argument ): return -interp.register_command(interp.cmd_type('flee', do_flee, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("flee", do_flee, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_follow.py b/src/rom24/commands/do_follow.py index 86d0425..2dedbef 100644 --- a/src/rom24/commands/do_follow.py +++ b/src/rom24/commands/do_follow.py @@ -20,7 +20,9 @@ def do_follow(ch, argument): ch.send("They aren't here.\n") return if ch.is_affected(merc.AFF_CHARM) and ch.master: - handler_game.act("But you'd rather follow $N!", ch, None, ch.master, merc.TO_CHAR) + handler_game.act( + "But you'd rather follow $N!", ch, None, ch.master, merc.TO_CHAR + ) return if victim == ch: if ch.master is None: @@ -28,10 +30,14 @@ def do_follow(ch, argument): return handler_ch.stop_follower(ch) return - if not victim.is_npc() \ - and victim.act.is_set(merc.PLR_NOFOLLOW) \ - and not ch.is_immortal(): - handler_game.act("$N doesn't seem to want any followers.\n", ch, None, victim, merc.TO_CHAR) + if ( + not victim.is_npc() + and victim.act.is_set(merc.PLR_NOFOLLOW) + and not ch.is_immortal() + ): + handler_game.act( + "$N doesn't seem to want any followers.\n", ch, None, victim, merc.TO_CHAR + ) return ch.act.rem_bit(merc.PLR_NOFOLLOW) if ch.master: @@ -40,4 +46,6 @@ def do_follow(ch, argument): return -interp.register_command(interp.cmd_type('follow', do_follow, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("follow", do_follow, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_force.py b/src/rom24/commands/do_force.py index 90058ea..bac41db 100644 --- a/src/rom24/commands/do_force.py +++ b/src/rom24/commands/do_force.py @@ -29,13 +29,17 @@ def do_force(ch, argument): for vch in instance.characters.values(): if not vch.is_npc() and vch.trust < ch.trust: handler_game.act(buf, ch, None, vch, merc.TO_VICT) - vch.interpret( argument) + vch.interpret(argument) elif arg == "players": if ch.trust < merc.MAX_LEVEL - 2: ch.send("Not at your level!\n") return for vch in instance.characters.values(): - if not vch.is_npc() and vch.trust < ch.trust and vch.level < merc.LEVEL_HERO: + if ( + not vch.is_npc() + and vch.trust < ch.trust + and vch.level < merc.LEVEL_HERO + ): handler_game.act(buf, ch, None, vch, merc.TO_VICT) vch.interpret(argument) elif arg == "gods": @@ -43,7 +47,11 @@ def do_force(ch, argument): ch.send("Not at your level!\n") return for vch in instance.characters.values(): - if not vch.is_npc() and vch.trust < ch.trust and vch.level >= merc.LEVEL_HERO: + if ( + not vch.is_npc() + and vch.trust < ch.trust + and vch.level >= merc.LEVEL_HERO + ): handler_game.act(buf, ch, None, vch, merc.TO_VICT) vch.interpret(argument) else: @@ -54,8 +62,12 @@ def do_force(ch, argument): if victim == ch: ch.send("Aye aye, right away!\n") return - if not ch.is_room_owner(victim.in_room) and ch.in_room != victim.in_room \ - and victim.in_room.is_private() and not state_checks.IS_TRUSTED(ch, merc.MAX_LEVEL): + if ( + not ch.is_room_owner(victim.in_room) + and ch.in_room != victim.in_room + and victim.in_room.is_private() + and not state_checks.IS_TRUSTED(ch, merc.MAX_LEVEL) + ): ch.send("That character is in a private room.\n") return if victim.is_pc and victim.trust >= ch.trust: @@ -65,10 +77,12 @@ def do_force(ch, argument): ch.send("Not at your level!\n") return handler_game.act(buf, ch, None, victim, merc.TO_VICT) - #TODO: Known broken. NPCs don't have interpret, so we'll have to figure this out. + # TODO: Known broken. NPCs don't have interpret, so we'll have to figure this out. victim.interpret(argument) ch.send("Ok.\n") return -interp.register_command(interp.cmd_type('force', do_force, merc.POS_DEAD, merc.L7, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("force", do_force, merc.POS_DEAD, merc.L7, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_freeze.py b/src/rom24/commands/do_freeze.py index 9b6ebaf..6ea63b6 100644 --- a/src/rom24/commands/do_freeze.py +++ b/src/rom24/commands/do_freeze.py @@ -28,16 +28,31 @@ def do_freeze(ch, argument): victim.act.rem_bit(merc.PLR_FREEZE) victim.send("You can play again.\n") ch.send("FREEZE removed.\n") - handler_game.wiznet("$N thaws %s." % victim.name, ch, None, merc.WIZ_PENALTIES, merc.WIZ_SECURE, 0) + handler_game.wiznet( + "$N thaws %s." % victim.name, + ch, + None, + merc.WIZ_PENALTIES, + merc.WIZ_SECURE, + 0, + ) else: state_checks.SET_BIT(victim.act, merc.PLR_FREEZE) victim.send("You can't do ANYthing!\n") ch.send("FREEZE set.\n") - handler_game.wiznet("$N puts %s in the deep freeze." % victim.name, ch, None, merc.WIZ_PENALTIES, - merc.WIZ_SECURE, 0) + handler_game.wiznet( + "$N puts %s in the deep freeze." % victim.name, + ch, + None, + merc.WIZ_PENALTIES, + merc.WIZ_SECURE, + 0, + ) victim.save(force=True) return -interp.register_command(interp.cmd_type('freeze', do_freeze, merc.POS_DEAD, merc.L4, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("freeze", do_freeze, merc.POS_DEAD, merc.L4, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_freset.py b/src/rom24/commands/do_freset.py index 6eff5a1..af5c20f 100644 --- a/src/rom24/commands/do_freset.py +++ b/src/rom24/commands/do_freset.py @@ -15,4 +15,6 @@ def do_freset(ch, argument): ch.send("Area reset.\n") -interp.register_command(interp.cmd_type('freset', do_freset, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("freset", do_freset, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_gain.py b/src/rom24/commands/do_gain.py index 0094fb7..7c5147c 100644 --- a/src/rom24/commands/do_gain.py +++ b/src/rom24/commands/do_gain.py @@ -11,7 +11,7 @@ from rom24 import handler_game from rom24 import instance -#TODO: Known broken. Probably needs some significant cleanup, doesn't appear to be granting skills properly. Needs more testing with non-immortal characters. +# TODO: Known broken. Probably needs some significant cleanup, doesn't appear to be granting skills properly. Needs more testing with non-immortal characters. def do_gain(ch, argument): if ch.is_npc(): return @@ -30,7 +30,10 @@ def do_gain(ch, argument): return if "list".startswith(arg): col = 0 - ch.send("%-18s %-5s %-18s %-5s %-18s %-5s\n" % ("group", "cost", "group", "cost", "group", "cost")) + ch.send( + "%-18s %-5s %-18s %-5s %-18s %-5s\n" + % ("group", "cost", "group", "cost", "group", "cost") + ) for gn, group in const.group_table.items(): if gn not in ch.group_known and group.rating[ch.guild.name] > 0: ch.send("%-18s %-5d " % (group.name, group.rating[ch.guild.name])) @@ -41,13 +44,21 @@ def do_gain(ch, argument): ch.send("\n") ch.send("\n") col = 0 - ch.send("%-18s %-5s %-18s %-5s %-18s %-5s\n" % ("skill", "cost", "skill", "cost", "skill", "cost")) + ch.send( + "%-18s %-5s %-18s %-5s %-18s %-5s\n" + % ("skill", "cost", "skill", "cost", "skill", "cost") + ) for sn, skill in const.skill_table.items(): - if sn not in ch.learned \ - and skill.rating[ch.guild.name] > 0 \ - and skill.spell_fun == magic.spell_null: - ch.send("%-18s %-5d " % (const.skill_table[sn].name, skill.rating[ch.guild.name])) + if ( + sn not in ch.learned + and skill.rating[ch.guild.name] > 0 + and skill.spell_fun == magic.spell_null + ): + ch.send( + "%-18s %-5d " + % (const.skill_table[sn].name, skill.rating[ch.guild.name]) + ) col += 1 if (col % 3) == 0: ch.send("\n") @@ -57,22 +68,44 @@ def do_gain(ch, argument): if "convert".startswith(arg): if ch.practice < 10: - handler_game.act("$N tells you 'You are not yet ready.'", ch, None, trainer, merc.TO_CHAR) + handler_game.act( + "$N tells you 'You are not yet ready.'", ch, None, trainer, merc.TO_CHAR + ) return - handler_game.act("$N helps you apply your practice to training", ch, None, trainer, merc.TO_CHAR) + handler_game.act( + "$N helps you apply your practice to training", + ch, + None, + trainer, + merc.TO_CHAR, + ) ch.practice -= 10 ch.train += 1 return if "points".startswith(arg): if ch.train < 2: - handler_game.act("$N tells you 'You are not yet ready.'", ch, None, trainer, merc.TO_CHAR) + handler_game.act( + "$N tells you 'You are not yet ready.'", ch, None, trainer, merc.TO_CHAR + ) return if ch.points <= 40: - handler_game.act("$N tells you 'There would be no point in that.'", ch, None, trainer, merc.TO_CHAR) + handler_game.act( + "$N tells you 'There would be no point in that.'", + ch, + None, + trainer, + merc.TO_CHAR, + ) return - handler_game.act("$N trains you, and you feel more at ease with your skills.", ch, None, trainer, merc.TO_CHAR) + handler_game.act( + "$N trains you, and you feel more at ease with your skills.", + ch, + None, + trainer, + merc.TO_CHAR, + ) ch.train -= 2 ch.points -= 1 ch.exp = ch.exp_per_level(ch.points) * ch.level @@ -80,44 +113,94 @@ def do_gain(ch, argument): if argument.lower() in const.group_table: gn = const.group_table[argument.lower()] if gn.name in ch.group_known: - handler_game.act("$N tells you 'You already know that group!'", ch, None, trainer, merc.TO_CHAR) + handler_game.act( + "$N tells you 'You already know that group!'", + ch, + None, + trainer, + merc.TO_CHAR, + ) return if gn.rating[ch.guild.name] <= 0: - handler_game.act("$N tells you 'That group is beyond your powers.'", ch, None, trainer, merc.TO_CHAR) + handler_game.act( + "$N tells you 'That group is beyond your powers.'", + ch, + None, + trainer, + merc.TO_CHAR, + ) return if ch.train < gn.rating[ch.guild.name]: - handler_game.act("$N tells you 'You are not yet ready for that group.'", ch, None, trainer, merc.TO_CHAR) + handler_game.act( + "$N tells you 'You are not yet ready for that group.'", + ch, + None, + trainer, + merc.TO_CHAR, + ) return # add the group skills.gn_add(ch, gn) - handler_game.act("$N trains you in the art of $t", ch, gn.name, trainer, merc.TO_CHAR) + handler_game.act( + "$N trains you in the art of $t", ch, gn.name, trainer, merc.TO_CHAR + ) ch.train -= gn.rating[ch.guild.name] return if argument.lower() in const.skill_table: sn = const.skill_table[argument.lower()] if sn.spell_fun is not None: - handler_game.act("$N tells you 'You must learn the full group.'", ch, None, trainer, merc.TO_CHAR) + handler_game.act( + "$N tells you 'You must learn the full group.'", + ch, + None, + trainer, + merc.TO_CHAR, + ) return if sn.name in ch.learned: - handler_game.act("$N tells you 'You already know that skill!'", ch, None, trainer, merc.TO_CHAR) + handler_game.act( + "$N tells you 'You already know that skill!'", + ch, + None, + trainer, + merc.TO_CHAR, + ) return if sn.rating[ch.guild.name] <= 0: - handler_game.act("$N tells you 'That skill is beyond your powers.'", ch, None, trainer, merc.TO_CHAR) + handler_game.act( + "$N tells you 'That skill is beyond your powers.'", + ch, + None, + trainer, + merc.TO_CHAR, + ) return if ch.train < sn.rating[ch.guild.name]: - handler_game.act("$N tells you 'You are not yet ready for that skill.'", ch, None, trainer, merc.TO_CHAR) + handler_game.act( + "$N tells you 'You are not yet ready for that skill.'", + ch, + None, + trainer, + merc.TO_CHAR, + ) return # add the skill ch.learned[sn.name] = 1 - handler_game.act("$N trains you in the art of $t", ch, sn.name, trainer, merc.TO_CHAR) + handler_game.act( + "$N trains you in the art of $t", ch, sn.name, trainer, merc.TO_CHAR + ) ch.train -= sn.rating[ch.guild.name] return - handler_game.act("$N tells you 'I do not understand...'", ch, None, trainer, merc.TO_CHAR) + handler_game.act( + "$N tells you 'I do not understand...'", ch, None, trainer, merc.TO_CHAR + ) return -interp.register_command(interp.cmd_type('gain', do_gain, merc.POS_STANDING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("gain", do_gain, merc.POS_STANDING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_get.py b/src/rom24/commands/do_get.py index 0fed9e6..13ca9fe 100644 --- a/src/rom24/commands/do_get.py +++ b/src/rom24/commands/do_get.py @@ -22,9 +22,9 @@ def do_get(ch, argument): if not arg1: ch.send("Get what?\n") return - + if not arg2: - if not arg1.startswith('all'): + if not arg1.startswith("all"): # 'get obj' item = ch.get_item_list(arg1, ch.in_room.items) if not item: @@ -43,7 +43,9 @@ def do_get(ch, argument): if len(arg1) == 3: ch.send("I see nothing here.\n") else: - handler_game.act("I see no $T here.", ch, None, arg1[4:], merc.TO_CHAR) + handler_game.act( + "I see no $T here.", ch, None, arg1[4:], merc.TO_CHAR + ) else: # 'get ... container' if arg2.startswith("all"): @@ -57,17 +59,24 @@ def do_get(ch, argument): if not ch.can_loot(container): ch.send("You can't do that.\n") return - elif container.item_type != merc.ITEM_CONTAINER and container.item_type != merc.ITEM_CORPSE_NPC: + elif ( + container.item_type != merc.ITEM_CONTAINER + and container.item_type != merc.ITEM_CORPSE_NPC + ): ch.send("That's not a container.\n") return if state_checks.IS_SET(container.value[1], merc.CONT_CLOSED): - handler_game.act("The $d is closed.", ch, None, container.name, merc.TO_CHAR) + handler_game.act( + "The $d is closed.", ch, None, container.name, merc.TO_CHAR + ) return - if not arg1.startswith('all'): + if not arg1.startswith("all"): # 'get obj container' item = ch.get_item_list(arg1, container.inventory) if not item is None: - handler_game.act("I see nothing like that in the $T.", ch, None, arg2, merc.TO_CHAR) + handler_game.act( + "I see nothing like that in the $T.", ch, None, arg2, merc.TO_CHAR + ) return handler_item.get_item(ch, item, container) else: @@ -83,10 +92,22 @@ def do_get(ch, argument): handler_item.get_item(ch, item, container) if not found: if len(arg1) == 3: - handler_game.act("I see nothing in the $T.", ch, None, arg2, merc.TO_CHAR) + handler_game.act( + "I see nothing in the $T.", ch, None, arg2, merc.TO_CHAR + ) else: - handler_game.act("I see nothing like that in the $T.", ch, None, arg2, merc.TO_CHAR) + handler_game.act( + "I see nothing like that in the $T.", + ch, + None, + arg2, + merc.TO_CHAR, + ) -interp.register_command(interp.cmd_type('get', do_get, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) -interp.register_command(interp.cmd_type('take', do_get, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("get", do_get, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) +interp.register_command( + interp.cmd_type("take", do_get, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_give.py b/src/rom24/commands/do_give.py index 230992f..42dd7b4 100644 --- a/src/rom24/commands/do_give.py +++ b/src/rom24/commands/do_give.py @@ -19,7 +19,9 @@ def do_give(ch, argument): if arg1.isdigit(): # 'give NNNN coins victim' amount = int(arg1) - if amount <= 0 or (arg2 != "coins" and arg2 != "coin" and arg2 != "gold" and arg2 != "silver"): + if amount <= 0 or ( + arg2 != "coins" and arg2 != "coin" and arg2 != "gold" and arg2 != "silver" + ): ch.send("Sorry, you can't do that.\n") return silver = arg2 != "gold" @@ -31,7 +33,7 @@ def do_give(ch, argument): if not victim: ch.send("They aren't here.\n") return - if ( not silver and ch.gold < amount) or (silver and ch.silver < amount): + if (not silver and ch.gold < amount) or (silver and ch.silver < amount): ch.send("You haven't got that much.\n") return if silver: @@ -41,9 +43,21 @@ def do_give(ch, argument): ch.gold -= amount victim.gold += amount - handler_game.act("$n gives you %d %s." % (amount, "silver" if silver else "gold"), ch, None, victim, merc.TO_VICT) + handler_game.act( + "$n gives you %d %s." % (amount, "silver" if silver else "gold"), + ch, + None, + victim, + merc.TO_VICT, + ) handler_game.act("$n gives $N some coins.", ch, None, victim, merc.TO_NOTVICT) - handler_game.act("You give $N %d %s." % (amount, "silver" if silver else "gold"), ch, None, victim, merc.TO_CHAR) + handler_game.act( + "You give $N %d %s." % (amount, "silver" if silver else "gold"), + ch, + None, + victim, + merc.TO_CHAR, + ) if victim.is_npc() and victim.act.is_set(merc.ACT_IS_CHANGER): change = 95 * amount / 100 / 100 if silver else 95 * amount @@ -52,15 +66,32 @@ def do_give(ch, argument): if silver and change > victim.gold: victim.gold += change if change < 1 and victim.can_see(ch): - handler_game.act("$n tells you 'I'm sorry, you did not give me enough to change.'", victim, None, ch, - merc.TO_VICT) + handler_game.act( + "$n tells you 'I'm sorry, you did not give me enough to change.'", + victim, + None, + ch, + merc.TO_VICT, + ) ch.reply = victim - victim.do_give("%d %s %s" % (amount, "silver" if silver else "gold", ch.name)) + victim.do_give( + "%d %s %s" % (amount, "silver" if silver else "gold", ch.name) + ) elif victim.can_see(ch): - victim.do_give("%d %s %s" % (change, "gold" if silver else "silver", ch.name)) + victim.do_give( + "%d %s %s" % (change, "gold" if silver else "silver", ch.name) + ) if silver: - victim.do_give("%d silver %s" % ((95 * amount / 100 - change * 100), ch.name)) - handler_game.act("$n tells you 'Thank you, come again.'", victim, None, ch, merc.TO_VICT) + victim.do_give( + "%d silver %s" % ((95 * amount / 100 - change * 100), ch.name) + ) + handler_game.act( + "$n tells you 'Thank you, come again.'", + victim, + None, + ch, + merc.TO_VICT, + ) ch.reply = victim return item = ch.get_item_carry(arg1, ch) @@ -75,7 +106,13 @@ def do_give(ch, argument): ch.send("They aren't here.\n") return if victim.is_npc() and victim.pShop is not None: - handler_game.act("$N tells you 'Sorry, you'll have to sell that.'", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N tells you 'Sorry, you'll have to sell that.'", + ch, + None, + victim, + merc.TO_CHAR, + ) ch.reply = victim return if not ch.can_drop_item(item): @@ -85,7 +122,9 @@ def do_give(ch, argument): handler_game.act("$N has $S hands full.", ch, None, victim, merc.TO_CHAR) return if state_checks.get_carry_weight(victim) + item.get_weight() > victim.can_carry_w(): - handler_game.act("$N can't carry that much weight.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N can't carry that much weight.", ch, None, victim, merc.TO_CHAR + ) return if not victim.can_see_item(item): handler_game.act("$N can't see it.", ch, None, victim, merc.TO_CHAR) @@ -98,4 +137,6 @@ def do_give(ch, argument): return -interp.register_command(interp.cmd_type('give', do_give, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("give", do_give, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_gossip.py b/src/rom24/commands/do_gossip.py index 4e2e3c0..9b7d77f 100644 --- a/src/rom24/commands/do_gossip.py +++ b/src/rom24/commands/do_gossip.py @@ -29,12 +29,25 @@ def do_gossip(ch, argument): ch.send("You gossip '%s'\n" % argument) for d in merc.descriptor_list: victim = handler_ch.CH(d) - if d.is_connected(nanny.con_playing) \ - and d.character != ch \ - and not victim.comm.is_set(merc.COMM_NOGOSSIP) \ - and not victim.comm.is_set(merc.COMM_QUIET): - handler_game.act("$n gossips '$t'", ch, argument, d.character, merc.TO_VICT, merc.POS_SLEEPING) + if ( + d.is_connected(nanny.con_playing) + and d.character != ch + and not victim.comm.is_set(merc.COMM_NOGOSSIP) + and not victim.comm.is_set(merc.COMM_QUIET) + ): + handler_game.act( + "$n gossips '$t'", + ch, + argument, + d.character, + merc.TO_VICT, + merc.POS_SLEEPING, + ) -interp.register_command(interp.cmd_type('.', do_gossip, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 0)) -interp.register_command(interp.cmd_type('gossip', do_gossip, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type(".", do_gossip, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 0) +) +interp.register_command( + interp.cmd_type("gossip", do_gossip, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_goto.py b/src/rom24/commands/do_goto.py index 7c7dc4e..e7667f6 100644 --- a/src/rom24/commands/do_goto.py +++ b/src/rom24/commands/do_goto.py @@ -19,8 +19,11 @@ def do_goto(ch, argument): ch.send("No such location.\n") return count = len(location.people) - if not ch.is_room_owner(location) and location.is_private() \ - and (count > 1 or ch.trust < merc.MAX_LEVEL): + if ( + not ch.is_room_owner(location) + and location.is_private() + and (count > 1 or ch.trust < merc.MAX_LEVEL) + ): ch.send("That room is private right now.\n") return if ch.fighting: @@ -31,7 +34,9 @@ def do_goto(ch, argument): if ch.is_npc() and ch.bamfout: handler_game.act("$t", ch, ch.bamfout, rch, merc.TO_VICT) else: - handler_game.act("$n leaves in a swirling mist.", ch, None, rch, merc.TO_VICT) + handler_game.act( + "$n leaves in a swirling mist.", ch, None, rch, merc.TO_VICT + ) location.put(ch.in_room.get(ch)) for rch_id in ch.in_room.people[:]: @@ -40,9 +45,13 @@ def do_goto(ch, argument): if ch.is_npc() and ch.bamfin: handler_game.act("$t", ch, ch.bamfin, rch, merc.TO_VICT) else: - handler_game.act("$n appears in a swirling mist.", ch, None, rch, merc.TO_VICT) + handler_game.act( + "$n appears in a swirling mist.", ch, None, rch, merc.TO_VICT + ) ch.do_look("auto") return -interp.register_command(interp.cmd_type('goto', do_goto, merc.POS_DEAD, merc.L8, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("goto", do_goto, merc.POS_DEAD, merc.L8, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_grats.py b/src/rom24/commands/do_grats.py index 6630c5c..e2ce54a 100644 --- a/src/rom24/commands/do_grats.py +++ b/src/rom24/commands/do_grats.py @@ -28,11 +28,22 @@ def do_grats(ch, argument): ch.send("You grats '%s'\n" % argument) for d in merc.descriptor_list: victim = handler_ch.CH(d) - if d.is_connected(nanny.con_playing) \ - and d.character != ch \ - and not victim.comm.is_set(merc.COMM_NOGRATS)\ - and not victim.comm.is_set(merc.COMM_QUIET): - handler_game.act("$n grats '$t'", ch, argument, d.character, merc.TO_VICT, merc.POS_SLEEPING) + if ( + d.is_connected(nanny.con_playing) + and d.character != ch + and not victim.comm.is_set(merc.COMM_NOGRATS) + and not victim.comm.is_set(merc.COMM_QUIET) + ): + handler_game.act( + "$n grats '$t'", + ch, + argument, + d.character, + merc.TO_VICT, + merc.POS_SLEEPING, + ) -interp.register_command(interp.cmd_type('grats', do_grats, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("grats", do_grats, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_group.py b/src/rom24/commands/do_group.py index 6399c50..d56da5b 100644 --- a/src/rom24/commands/do_group.py +++ b/src/rom24/commands/do_group.py @@ -18,14 +18,21 @@ def do_group(ch, argument): for gch in instance.characters.values(): if gch.is_same_group(ch): - ch.send("[[%2d %s]] %-16s %4d/%4d hp %4d/%4d mana %4d/%4d mv %5d xp\n" % ( - gch.level, - "Mob" if state_checks.IS_NPC(gch) else gch.guild.who_name, - state_checks.PERS(gch, ch), - gch.hit, gch.max_hit, - gch.mana, gch.max_mana, - gch.move, gch.max_move, - gch.exp)) + ch.send( + "[[%2d %s]] %-16s %4d/%4d hp %4d/%4d mana %4d/%4d mv %5d xp\n" + % ( + gch.level, + "Mob" if state_checks.IS_NPC(gch) else gch.guild.who_name, + state_checks.PERS(gch, ch), + gch.hit, + gch.max_hit, + gch.mana, + gch.max_mana, + gch.move, + gch.max_move, + gch.exp, + ) + ) return victim = ch.get_char_room(arg) if not victim: @@ -35,26 +42,63 @@ def do_group(ch, argument): ch.send("But you are following someone else:!\n") return if victim.master != ch and ch != victim: - handler_game.act("$N isn't following you.", ch, None, victim, merc.TO_CHAR, merc.POS_SLEEPING) + handler_game.act( + "$N isn't following you.", ch, None, victim, merc.TO_CHAR, merc.POS_SLEEPING + ) return - if victim.is_affected( merc.AFF_CHARM): + if victim.is_affected(merc.AFF_CHARM): ch.send("You can't remove charmed mobs from your group.\n") return if ch.is_affected(merc.AFF_CHARM): - handler_game.act("You like your master too much to leave $m!", ch, None, victim, merc.TO_VICT, - merc.POS_SLEEPING) + handler_game.act( + "You like your master too much to leave $m!", + ch, + None, + victim, + merc.TO_VICT, + merc.POS_SLEEPING, + ) return if victim.is_same_group(ch) and ch != victim: victim.leader = None - handler_game.act("$n removes $N from $s group.", ch, None, victim, merc.TO_NOTVICT, merc.POS_RESTING) - handler_game.act("$n removes you from $s group.", ch, None, victim, merc.TO_VICT, merc.POS_SLEEPING) - handler_game.act("You remove $N from your group.", ch, None, victim, merc.TO_CHAR, merc.POS_SLEEPING) + handler_game.act( + "$n removes $N from $s group.", + ch, + None, + victim, + merc.TO_NOTVICT, + merc.POS_RESTING, + ) + handler_game.act( + "$n removes you from $s group.", + ch, + None, + victim, + merc.TO_VICT, + merc.POS_SLEEPING, + ) + handler_game.act( + "You remove $N from your group.", + ch, + None, + victim, + merc.TO_CHAR, + merc.POS_SLEEPING, + ) return victim.leader = ch - handler_game.act("$N joins $n's group.", ch, None, victim, merc.TO_NOTVICT, merc.POS_RESTING) - handler_game.act("You join $n's group.", ch, None, victim, merc.TO_VICT, merc.POS_SLEEPING) - handler_game.act("$N joins your group.", ch, None, victim, merc.TO_CHAR, merc.POS_SLEEPING) + handler_game.act( + "$N joins $n's group.", ch, None, victim, merc.TO_NOTVICT, merc.POS_RESTING + ) + handler_game.act( + "You join $n's group.", ch, None, victim, merc.TO_VICT, merc.POS_SLEEPING + ) + handler_game.act( + "$N joins your group.", ch, None, victim, merc.TO_CHAR, merc.POS_SLEEPING + ) return -interp.register_command(interp.cmd_type('group', do_group, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("group", do_group, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_groups.py b/src/rom24/commands/do_groups.py index 87f708a..75492f3 100644 --- a/src/rom24/commands/do_groups.py +++ b/src/rom24/commands/do_groups.py @@ -53,5 +53,9 @@ def do_groups(ch, argument): ch.send("\n") -interp.register_command(interp.cmd_type('info', do_groups, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1)) -interp.register_command(interp.cmd_type('groups', do_groups, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("info", do_groups, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1) +) +interp.register_command( + interp.cmd_type("groups", do_groups, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_gtell.py b/src/rom24/commands/do_gtell.py index 201e60f..e94df97 100644 --- a/src/rom24/commands/do_gtell.py +++ b/src/rom24/commands/do_gtell.py @@ -18,14 +18,27 @@ def do_gtell(ch, argument): found = False for gch in instance.characters.values(): if gch.is_same_group(ch): - handler_game.act("$n tells the group '$t'", ch, argument, gch, merc.TO_VICT, merc.POS_SLEEPING) + handler_game.act( + "$n tells the group '$t'", + ch, + argument, + gch, + merc.TO_VICT, + merc.POS_SLEEPING, + ) found = True if found: - handler_game.act("$n tells the group '$t'", ch, argument, ch, merc.TO_CHAR, merc.POS_SLEEPING) + handler_game.act( + "$n tells the group '$t'", ch, argument, ch, merc.TO_CHAR, merc.POS_SLEEPING + ) else: ch.send("You do not have a group.\n") return -interp.register_command(interp.cmd_type('gtell', do_gtell, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) -interp.register_command(interp.cmd_type(';', do_gtell, merc.POS_DEAD, 0, merc.LOG_NORMAL, 0)) +interp.register_command( + interp.cmd_type("gtell", do_gtell, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) +interp.register_command( + interp.cmd_type(";", do_gtell, merc.POS_DEAD, 0, merc.LOG_NORMAL, 0) +) diff --git a/src/rom24/commands/do_guild.py b/src/rom24/commands/do_guild.py index f3fae49..298704d 100644 --- a/src/rom24/commands/do_guild.py +++ b/src/rom24/commands/do_guild.py @@ -41,4 +41,6 @@ def do_guild(ch, argument): ch.send("dbeug") -interp.register_command(interp.cmd_type('guild', do_guild, merc.POS_DEAD, merc.L4, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("guild", do_guild, merc.POS_DEAD, merc.L4, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_heal.py b/src/rom24/commands/do_heal.py index df8994a..2a58253 100644 --- a/src/rom24/commands/do_heal.py +++ b/src/rom24/commands/do_heal.py @@ -24,7 +24,9 @@ def do_heal(ch, argument): argument, arg = game_utils.read_word(argument) if not arg: # display price list - handler_game.act("$N says 'I offer the following spells:'", ch, None, mob, merc.TO_CHAR) + handler_game.act( + "$N says 'I offer the following spells:'", ch, None, mob, merc.TO_CHAR + ) ch.send(" light: cure light wounds 10 gold\n") ch.send(" serious: cure serious wounds 15 gold\n") ch.send(" critic: cure critical wounds 25 gold\n") @@ -92,10 +94,18 @@ def do_heal(ch, argument): words = "candusima" cost = 500 else: - handler_game.act("$N says 'Type 'heal' for a list of spells.'", ch, None, mob, merc.TO_CHAR) + handler_game.act( + "$N says 'Type 'heal' for a list of spells.'", ch, None, mob, merc.TO_CHAR + ) return if cost > (ch.gold * 100 + ch.silver): - handler_game.act("$N says 'You do not have enough gold for my services.'", ch, None, mob, merc.TO_CHAR) + handler_game.act( + "$N says 'You do not have enough gold for my services.'", + ch, + None, + mob, + merc.TO_CHAR, + ) return state_checks.WAIT_STATE(ch, merc.PULSE_VIOLENCE) @@ -114,4 +124,6 @@ def do_heal(ch, argument): spell(sn, mob.level, mob, ch, merc.TARGET_CHAR) -interp.register_command(interp.cmd_type('heal', do_heal, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("heal", do_heal, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_help.py b/src/rom24/commands/do_help.py index bb72c98..3ff1436 100644 --- a/src/rom24/commands/do_help.py +++ b/src/rom24/commands/do_help.py @@ -11,7 +11,11 @@ def do_help(ch, argument): if not argument: argument = "summary" - found = [h for h in merc.help_list if h.level <= ch.trust and argument.lower() in h.keyword.lower()] + found = [ + h + for h in merc.help_list + if h.level <= ch.trust and argument.lower() in h.keyword.lower() + ] for pHelp in found: if ch.desc.is_connected(nanny.con_playing): @@ -19,21 +23,41 @@ def do_help(ch, argument): ch.send(pHelp.keyword) ch.send("\n") text = pHelp.text - if pHelp.text[0] == '.': + if pHelp.text[0] == ".": text = pHelp.text[1:] ch.send(text + "\n") # small hack :) - if ch.desc and ch.desc.connected != nanny.con_playing and ch.desc.connected != nanny.con_gen_groups: + if ( + ch.desc + and ch.desc.connected != nanny.con_playing + and ch.desc.connected != nanny.con_gen_groups + ): break if not found: ch.send("No help on that word.\n") -interp.register_command(interp.cmd_type('help', do_help, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) -interp.register_command(interp.cmd_type('motd', do_help, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1, 'motd')) -interp.register_command(interp.cmd_type('imotd', do_help, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1, 'imotd')) -interp.register_command(interp.cmd_type('rules', do_help, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1, 'rules')) -interp.register_command(interp.cmd_type('story', do_help, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1, 'story')) -interp.register_command(interp.cmd_type('wizlist', do_help, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1, 'wizlist')) -interp.register_command(interp.cmd_type('credits', do_help, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1, 'credits')) +interp.register_command( + interp.cmd_type("help", do_help, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) +interp.register_command( + interp.cmd_type("motd", do_help, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1, "motd") +) +interp.register_command( + interp.cmd_type( + "imotd", do_help, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1, "imotd" + ) +) +interp.register_command( + interp.cmd_type("rules", do_help, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1, "rules") +) +interp.register_command( + interp.cmd_type("story", do_help, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1, "story") +) +interp.register_command( + interp.cmd_type("wizlist", do_help, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1, "wizlist") +) +interp.register_command( + interp.cmd_type("credits", do_help, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1, "credits") +) diff --git a/src/rom24/commands/do_hide.py b/src/rom24/commands/do_hide.py index 0e1f489..c3c94e6 100644 --- a/src/rom24/commands/do_hide.py +++ b/src/rom24/commands/do_hide.py @@ -16,12 +16,13 @@ def do_hide(ch, argument): if random.randint(1, 99) < ch.get_skill("hide"): ch.affected_by.set_bit(merc.AFF_HIDE) if ch.is_pc: - ch.check_improve( "hide", True, 3) + ch.check_improve("hide", True, 3) else: if ch.is_pc: - ch.check_improve( "hide", False, 3) + ch.check_improve("hide", False, 3) return -interp.register_command(interp.cmd_type('hide', do_hide, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) - +interp.register_command( + interp.cmd_type("hide", do_hide, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_holylight.py b/src/rom24/commands/do_holylight.py index 123396e..efec999 100644 --- a/src/rom24/commands/do_holylight.py +++ b/src/rom24/commands/do_holylight.py @@ -18,4 +18,8 @@ def do_holylight(ch, argument): return -interp.register_command(interp.cmd_type('holylight', do_holylight, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type( + "holylight", do_holylight, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1 + ) +) diff --git a/src/rom24/commands/do_immtalk.py b/src/rom24/commands/do_immtalk.py index 83d7a9a..33c3cbd 100644 --- a/src/rom24/commands/do_immtalk.py +++ b/src/rom24/commands/do_immtalk.py @@ -22,10 +22,19 @@ def do_immtalk(ch, argument): ch.comm.rem_bit(merc.COMM_NOWIZ) handler_game.act("$n: $t", ch, argument, None, merc.TO_CHAR, merc.POS_DEAD) for d in merc.descriptor_list: - if d.is_connected(nanny.con_playing) and state_checks.IS_IMMORTAL(d.character) \ - and not state_checks.IS_SET(d.character.comm, merc.COMM_NOWIZ): - handler_game.act("$n: $t", ch, argument, d.character, merc.TO_VICT, merc.POS_DEAD) + if ( + d.is_connected(nanny.con_playing) + and state_checks.IS_IMMORTAL(d.character) + and not state_checks.IS_SET(d.character.comm, merc.COMM_NOWIZ) + ): + handler_game.act( + "$n: $t", ch, argument, d.character, merc.TO_VICT, merc.POS_DEAD + ) -interp.register_command(interp.cmd_type('immtalk', do_immtalk, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1)) -interp.register_command(interp.cmd_type(':', do_immtalk, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 0)) +interp.register_command( + interp.cmd_type("immtalk", do_immtalk, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1) +) +interp.register_command( + interp.cmd_type(":", do_immtalk, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 0) +) diff --git a/src/rom24/commands/do_incognito.py b/src/rom24/commands/do_incognito.py index 9d0d1af..8e19678 100644 --- a/src/rom24/commands/do_incognito.py +++ b/src/rom24/commands/do_incognito.py @@ -35,4 +35,8 @@ def do_incognito(ch, argument): return -interp.register_command(interp.cmd_type('incognito', do_incognito, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type( + "incognito", do_incognito, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1 + ) +) diff --git a/src/rom24/commands/do_inventory.py b/src/rom24/commands/do_inventory.py index e87e63f..2e23a84 100644 --- a/src/rom24/commands/do_inventory.py +++ b/src/rom24/commands/do_inventory.py @@ -13,4 +13,6 @@ def do_inventory(ch, argument): return -interp.register_command(interp.cmd_type('inventory', do_inventory, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("inventory", do_inventory, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_invis.py b/src/rom24/commands/do_invis.py index fc3bc90..4644cd4 100644 --- a/src/rom24/commands/do_invis.py +++ b/src/rom24/commands/do_invis.py @@ -15,11 +15,15 @@ def do_invis(ch, argument): # take the default path if ch.invis_level: ch.invis_level = 0 - handler_game.act("$n slowly fades into existence.", ch, None, None, merc.TO_ROOM) + handler_game.act( + "$n slowly fades into existence.", ch, None, None, merc.TO_ROOM + ) ch.send("You slowly fade back into existence.\n") else: ch.invis_level = ch.trust - handler_game.act("$n slowly fades into thin air.", ch, None, None, merc.TO_ROOM) + handler_game.act( + "$n slowly fades into thin air.", ch, None, None, merc.TO_ROOM + ) ch.send("You slowly vanish into thin air.\n") else: # do the level thing @@ -30,10 +34,16 @@ def do_invis(ch, argument): else: ch.reply = None ch.invis_level = level - handler_game.act("$n slowly fades into thin air.", ch, None, None, merc.TO_ROOM) + handler_game.act( + "$n slowly fades into thin air.", ch, None, None, merc.TO_ROOM + ) ch.send("You slowly vanish into thin air.\n") return -interp.register_command(interp.cmd_type('invis', do_invis, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 0)) -interp.register_command(interp.cmd_type('wizinvis', do_invis, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("invis", do_invis, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 0) +) +interp.register_command( + interp.cmd_type("wizinvis", do_invis, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_kick.py b/src/rom24/commands/do_kick.py index ac094d4..149e9e7 100644 --- a/src/rom24/commands/do_kick.py +++ b/src/rom24/commands/do_kick.py @@ -11,7 +11,10 @@ def do_kick(ch, argument): - if not ch.is_npc() and ch.level < const.skill_table['kick'].skill_level[ch.guild.name]: + if ( + not ch.is_npc() + and ch.level < const.skill_table["kick"].skill_level[ch.guild.name] + ): ch.send("You better leave the martial arts to fighters.\n") return if ch.is_npc() and not ch.off_flags.is_set(merc.OFF_KICK): @@ -21,17 +24,21 @@ def do_kick(ch, argument): ch.send("You aren't fighting anyone.\n") return - state_checks.WAIT_STATE(ch, const.skill_table['kick'].beats) - if ch.get_skill('kick') > random.randint(1, 99): - fight.damage(ch, victim, random.randint(1, ch.level), 'kick', merc.DAM_BASH, True) + state_checks.WAIT_STATE(ch, const.skill_table["kick"].beats) + if ch.get_skill("kick") > random.randint(1, 99): + fight.damage( + ch, victim, random.randint(1, ch.level), "kick", merc.DAM_BASH, True + ) if ch.is_pc: - ch.check_improve( 'kick', True, 1) + ch.check_improve("kick", True, 1) else: - fight.damage(ch, victim, 0, 'kick', merc.DAM_BASH, True) + fight.damage(ch, victim, 0, "kick", merc.DAM_BASH, True) if ch.is_pc: - ch.check_improve( 'kick', False, 1) + ch.check_improve("kick", False, 1) fight.check_killer(ch, victim) return -interp.register_command(interp.cmd_type('kick', do_kick, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("kick", do_kick, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_kill.py b/src/rom24/commands/do_kill.py index c95cae8..5131058 100644 --- a/src/rom24/commands/do_kill.py +++ b/src/rom24/commands/do_kill.py @@ -47,5 +47,9 @@ def do_kill(ch, argument): return -interp.register_command(interp.cmd_type('hit', do_kill, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 0)) -interp.register_command(interp.cmd_type('kill', do_kill, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("hit", do_kill, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 0) +) +interp.register_command( + interp.cmd_type("kill", do_kill, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_list.py b/src/rom24/commands/do_list.py index 0f97c7e..14ece42 100644 --- a/src/rom24/commands/do_list.py +++ b/src/rom24/commands/do_list.py @@ -32,7 +32,10 @@ def do_list(ch, argument): if not found: found = True ch.send("Pets for sale:\n") - ch.send("[[%2d]] %8d - %s\n" % (pet.level, 10 * pet.level * pet.level, pet.short_descr)) + ch.send( + "[[%2d]] %8d - %s\n" + % (pet.level, 10 * pet.level * pet.level, pet.short_descr) + ) if not found: ch.send("Sorry, we're out of pets right now.\n") return @@ -45,8 +48,12 @@ def do_list(ch, argument): for item_id in keeper.inventory[:]: item = instance.items[item_id] cost = shop_utils.get_cost(keeper, item, True) - if not item.equipped_to and ch.can_see_item(item) and cost > 0 \ - and (not arg or arg in item.name.lower()): + if ( + not item.equipped_to + and ch.can_see_item(item) + and cost > 0 + and (not arg or arg in item.name.lower()) + ): if item.inventory: items[(item.vnum, item.short_descr)] = (item.vnum, -1) else: @@ -62,10 +69,20 @@ def do_list(ch, argument): for k, p in items.items(): item, count = p cost = shop_utils.get_cost(keeper, item, True) - ch.send("[[%2d %5d %2s ]] %s" % (item.level, cost, ("--" if item.flags.shop_inventory else count), item.short_descr)) + ch.send( + "[[%2d %5d %2s ]] %s" + % ( + item.level, + cost, + ("--" if item.flags.shop_inventory else count), + item.short_descr, + ) + ) if ch.act.is_set(merc.PLR_OMNI): ch.send("(%d)" % item.vnum) ch.send("\n") -interp.register_command(interp.cmd_type('list', do_list, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("list", do_list, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_load.py b/src/rom24/commands/do_load.py index a0afac1..25dd8cc 100644 --- a/src/rom24/commands/do_load.py +++ b/src/rom24/commands/do_load.py @@ -24,4 +24,6 @@ def do_load(ch, argument): ch.do_load("") -interp.register_command(interp.cmd_type('load', do_load, merc.POS_DEAD, merc.L4, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("load", do_load, merc.POS_DEAD, merc.L4, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_lock.py b/src/rom24/commands/do_lock.py index a7198e9..3353c91 100644 --- a/src/rom24/commands/do_lock.py +++ b/src/rom24/commands/do_lock.py @@ -19,8 +19,9 @@ def do_lock(ch, argument): if obj: # portal stuff if obj.item_type == merc.ITEM_PORTAL: - if not state_checks.IS_SET(obj.value[1], merc.EX_ISDOOR) or state_checks.IS_SET(obj.value[1], - merc.EX_NOCLOSE): + if not state_checks.IS_SET( + obj.value[1], merc.EX_ISDOOR + ) or state_checks.IS_SET(obj.value[1], merc.EX_NOCLOSE): ch.send("You can't do that.\n") return if not state_checks.IS_SET(obj.value[1], merc.EX_CLOSED): @@ -82,9 +83,14 @@ def do_lock(ch, argument): handler_game.act("$n locks the $d.", ch, None, pexit.keyword, merc.TO_ROOM) # lock the other side to_room = pexit.to_room - if to_room and to_room.exit[merc.rev_dir[door]] != 0 \ - and to_room.exit[merc.rev_dir[door]].to_room == ch.in_room: + if ( + to_room + and to_room.exit[merc.rev_dir[door]] != 0 + and to_room.exit[merc.rev_dir[door]].to_room == ch.in_room + ): to_room.exit[merc.rev_dir[door]].exit_info.set_bit(merc.EX_LOCKED) -interp.register_command(interp.cmd_type('lock', do_lock, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("lock", do_lock, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_log.py b/src/rom24/commands/do_log.py index 6915924..9de4a29 100644 --- a/src/rom24/commands/do_log.py +++ b/src/rom24/commands/do_log.py @@ -14,7 +14,7 @@ def do_log(ch, argument): ch.send("Log whom?\n") return if arg == "all": - #TODO: fix this by either adding it to merc, or figuring out an alternative + # TODO: fix this by either adding it to merc, or figuring out an alternative if fLogAll: fLogAll = False ch.send("Log ALL off.\n") @@ -39,4 +39,6 @@ def do_log(ch, argument): return -interp.register_command(interp.cmd_type('log', do_log, merc.POS_DEAD, merc.L1, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("log", do_log, merc.POS_DEAD, merc.L1, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_look.py b/src/rom24/commands/do_look.py index da4356b..cff2248 100644 --- a/src/rom24/commands/do_look.py +++ b/src/rom24/commands/do_look.py @@ -24,8 +24,11 @@ def do_look(ch, argument): if not ch.check_blind(): return room = ch.in_room - if not ch.is_npc() and not ch.act.is_set(merc.PLR_HOLYLIGHT) \ - and ch.in_room.is_dark(): + if ( + not ch.is_npc() + and not ch.act.is_set(merc.PLR_HOLYLIGHT) + and ch.in_room.is_dark() + ): ch.send("It is pitch black ... \n") handler_ch.show_char_to_char(room.people, ch) return @@ -36,17 +39,17 @@ def do_look(ch, argument): if not arg1 or arg1 == "auto": # 'look' or 'look auto' ch.send(room.name) - if ch.is_immortal() \ - and (ch.is_npc() - or (ch.act.is_set(merc.PLR_HOLYLIGHT) - or ch.act.is_set(merc.PLR_OMNI))): - ch.send(" Room[[{room.instance_id}]] Template[[{room.vnum}]]".format(room=room)) + if ch.is_immortal() and ( + ch.is_npc() + or (ch.act.is_set(merc.PLR_HOLYLIGHT) or ch.act.is_set(merc.PLR_OMNI)) + ): + ch.send( + " Room[[{room.instance_id}]] Template[[{room.vnum}]]".format(room=room) + ) ch.send("\n") - if not arg1 or (not ch.is_npc() - and not ch.comm.is_set(merc.COMM_BRIEF)): + if not arg1 or (not ch.is_npc() and not ch.comm.is_set(merc.COMM_BRIEF)): ch.send(" %s\n" % room.description) - if not ch.is_npc() \ - and ch.act.is_set(merc.PLR_AUTOEXIT): + if not ch.is_npc() and ch.act.is_set(merc.PLR_AUTOEXIT): ch.send("\n") ch.do_exits("auto") handler_ch.show_list_to_char(room.items, ch, False, False) @@ -72,10 +75,15 @@ def do_look(ch, argument): amnt = "abount half-" else: amnt = "more than half-" - ch.send("It's %sfilled with a %s liquid.\n" % ( - amnt, const.liq_table[item.value[2]].color)) - elif item_type == merc.ITEM_CONTAINER or item_type == merc.ITEM_CORPSE_NPC \ - or item_type == merc.ITEM_CORPSE_PC: + ch.send( + "It's %sfilled with a %s liquid.\n" + % (amnt, const.liq_table[item.value[2]].color) + ) + elif ( + item_type == merc.ITEM_CONTAINER + or item_type == merc.ITEM_CORPSE_NPC + or item_type == merc.ITEM_CORPSE_PC + ): if state_checks.IS_SET(item.value[1], merc.CONT_CLOSED): ch.send("It is closed.\n") return @@ -135,8 +143,7 @@ def do_look(ch, argument): ch.send("You do not see that here.\n") return # 'look direction' - if door not in room.exit \ - or not room.exit[door]: + if door not in room.exit or not room.exit[door]: ch.send("Nothing special there.\n") return pexit = room.exit[door] @@ -153,5 +160,9 @@ def do_look(ch, argument): return -interp.register_command(interp.cmd_type('look', do_look, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) -interp.register_command(interp.cmd_type('read', do_look, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("look", do_look, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) +interp.register_command( + interp.cmd_type("read", do_look, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_memory.py b/src/rom24/commands/do_memory.py index 609b7c7..1a23e22 100644 --- a/src/rom24/commands/do_memory.py +++ b/src/rom24/commands/do_memory.py @@ -5,9 +5,11 @@ from rom24 import merc from rom24 import interp -#TODO: Known broken. +# TODO: Known broken. def do_memory(ch, argument): pass -interp.register_command(interp.cmd_type('memory', do_memory, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("memory", do_memory, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_mfind.py b/src/rom24/commands/do_mfind.py index 9063d47..6c12680 100644 --- a/src/rom24/commands/do_mfind.py +++ b/src/rom24/commands/do_mfind.py @@ -29,4 +29,6 @@ def do_mfind(ch, argument): return -interp.register_command(interp.cmd_type('mfind', do_mfind, merc.POS_DEAD, merc.L4, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("mfind", do_mfind, merc.POS_DEAD, merc.L4, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_mload.py b/src/rom24/commands/do_mload.py index be98ab3..330d1ce 100644 --- a/src/rom24/commands/do_mload.py +++ b/src/rom24/commands/do_mload.py @@ -23,9 +23,18 @@ def do_mload(ch, argument): victim = object_creator.create_mobile(template) ch.in_room.put(victim) handler_game.act("$n has created $N!", ch, None, victim, merc.TO_ROOM) - handler_game.wiznet("$N loads %s." % victim.short_descr, ch, None, merc.WIZ_LOAD, merc.WIZ_SECURE, ch.trust) + handler_game.wiznet( + "$N loads %s." % victim.short_descr, + ch, + None, + merc.WIZ_LOAD, + merc.WIZ_SECURE, + ch.trust, + ) ch.send("Ok.\n") return -interp.register_command(interp.cmd_type('mload', do_mload, merc.POS_DEAD, merc.L4, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("mload", do_mload, merc.POS_DEAD, merc.L4, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_mset.py b/src/rom24/commands/do_mset.py index 6efe34f..eff55d8 100644 --- a/src/rom24/commands/do_mset.py +++ b/src/rom24/commands/do_mset.py @@ -9,6 +9,7 @@ from rom24 import game_utils from rom24 import state_checks + def do_mset(ch, argument): argument, arg1 = game_utils.read_word(argument) argument, arg2 = game_utils.read_word(argument) @@ -33,14 +34,18 @@ def do_mset(ch, argument): # Set something. if arg2 == "str": if value < 3 or value > victim.get_max_train(merc.STAT_STR): - ch.send("Strength range is 3 to %d\n." % victim.get_max_train(merc.STAT_STR)) + ch.send( + "Strength range is 3 to %d\n." % victim.get_max_train(merc.STAT_STR) + ) return victim.perm_stat[merc.STAT_STR] = value ch.send("Str set to %d.\n" % value) return if arg2 == "int": if value < 3 or value > victim.get_max_train(merc.STAT_INT): - ch.send("Intelligence range is 3 to %d.\n" % victim.get_max_train(merc.STAT_INT)) + ch.send( + "Intelligence range is 3 to %d.\n" % victim.get_max_train(merc.STAT_INT) + ) return ch.send("Int set to %d.\n" % value) victim.perm_stat[merc.STAT_INT] = value @@ -53,14 +58,18 @@ def do_mset(ch, argument): return if arg2 == "dex": if value < 3 or value > victim.get_max_train(merc.STAT_DEX): - ch.send("Dexterity range is 3 to %d.\n" % victim.get_max_train(merc.STAT_DEX)) + ch.send( + "Dexterity range is 3 to %d.\n" % victim.get_max_train(merc.STAT_DEX) + ) return ch.send("Dex set to %d.\n" % value) victim.perm_stat[merc.STAT_DEX] = value return if arg2 == "con": if value < 3 or value > victim.get_max_train(merc.STAT_CON): - ch.send("Constitution range is 3 to %d.\n" % victim.get_max_train(merc.STAT_CON)) + ch.send( + "Constitution range is 3 to %d.\n" % victim.get_max_train(merc.STAT_CON) + ) return ch.send("Con set to %d.\n" % value) victim.perm_stat[merc.STAT_CON] = value @@ -215,4 +224,6 @@ def do_mset(ch, argument): ch.do_mset("") -interp.register_command(interp.cmd_type('mset', do_mset, merc.POS_DEAD, merc.L2, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("mset", do_mset, merc.POS_DEAD, merc.L2, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_mstat.py b/src/rom24/commands/do_mstat.py index 8ec04fb..5db656b 100644 --- a/src/rom24/commands/do_mstat.py +++ b/src/rom24/commands/do_mstat.py @@ -21,54 +21,113 @@ def do_mstat(ch, argument): ch.send("They aren't here.\n") return ch.send("Name: %s\n" % victim.name) - ch.send("Vnum: %d Format: %s Race: %s Group: %d Sex: %s Room: %d\n" % ( - 0 if not victim.is_npc() else victim.vnum, - "pc" if not victim.is_npc() else "new", - victim.race.name, - 0 if not victim.is_npc() else victim.group, tables.sex_table[victim.sex], - 0 if not victim.in_room else victim.in_room.vnum )) + ch.send( + "Vnum: %d Format: %s Race: %s Group: %d Sex: %s Room: %d\n" + % ( + 0 if not victim.is_npc() else victim.vnum, + "pc" if not victim.is_npc() else "new", + victim.race.name, + 0 if not victim.is_npc() else victim.group, + tables.sex_table[victim.sex], + 0 if not victim.in_room else victim.in_room.vnum, + ) + ) if victim.is_npc(): ch.send("Count: %d Killed: %d\n" % (victim.count, victim.killed)) - ch.send("Str: %d(%d) Int: %d(%d) Wis: %d(%d) Dex: %d(%d) Con: %d(%d)\n" % ( - victim.perm_stat[merc.STAT_STR], victim.stat(merc.STAT_STR), - victim.perm_stat[merc.STAT_INT], victim.stat(merc.STAT_INT), - victim.perm_stat[merc.STAT_WIS], victim.stat(merc.STAT_WIS), - victim.perm_stat[merc.STAT_DEX], victim.stat(merc.STAT_DEX), - victim.perm_stat[merc.STAT_CON], victim.stat(merc.STAT_CON))) - ch.send("Hp: %d/%d Mana: %d/%d Move: %d/%d Practices: %d\n" % ( - victim.hit, victim.max_hit, - victim.mana, victim.max_mana, - victim.move, victim.max_move, - 0 if victim.is_npc() else victim.practice )) - ch.send("Lv: %d Class: %s Align: %d Gold: %ld Silver: %ld Exp: %d\n" % ( - victim.level, - "mobile" if victim.is_npc() else victim.guild.name, - victim.alignment, victim.gold, victim.silver, victim.exp )) - ch.send("Armor: pierce: %d bash: %d slash: %d magic: %d\n" % ( - state_checks.GET_AC(victim, merc.AC_PIERCE), state_checks.GET_AC(victim, merc.AC_BASH), - state_checks.GET_AC(victim, merc.AC_SLASH), state_checks.GET_AC(victim, merc.AC_EXOTIC))) - ch.send("Hit: %d Dam: %d Saves: %d Size: %s Position: %s Wimpy: %d\n" % ( - state_checks.GET_HITROLL(victim), state_checks.GET_DAMROLL(victim), victim.saving_throw, - tables.size_table[victim.size], tables.position_table[victim.position].name, - victim.wimpy )) + ch.send( + "Str: %d(%d) Int: %d(%d) Wis: %d(%d) Dex: %d(%d) Con: %d(%d)\n" + % ( + victim.perm_stat[merc.STAT_STR], + victim.stat(merc.STAT_STR), + victim.perm_stat[merc.STAT_INT], + victim.stat(merc.STAT_INT), + victim.perm_stat[merc.STAT_WIS], + victim.stat(merc.STAT_WIS), + victim.perm_stat[merc.STAT_DEX], + victim.stat(merc.STAT_DEX), + victim.perm_stat[merc.STAT_CON], + victim.stat(merc.STAT_CON), + ) + ) + ch.send( + "Hp: %d/%d Mana: %d/%d Move: %d/%d Practices: %d\n" + % ( + victim.hit, + victim.max_hit, + victim.mana, + victim.max_mana, + victim.move, + victim.max_move, + 0 if victim.is_npc() else victim.practice, + ) + ) + ch.send( + "Lv: %d Class: %s Align: %d Gold: %ld Silver: %ld Exp: %d\n" + % ( + victim.level, + "mobile" if victim.is_npc() else victim.guild.name, + victim.alignment, + victim.gold, + victim.silver, + victim.exp, + ) + ) + ch.send( + "Armor: pierce: %d bash: %d slash: %d magic: %d\n" + % ( + state_checks.GET_AC(victim, merc.AC_PIERCE), + state_checks.GET_AC(victim, merc.AC_BASH), + state_checks.GET_AC(victim, merc.AC_SLASH), + state_checks.GET_AC(victim, merc.AC_EXOTIC), + ) + ) + ch.send( + "Hit: %d Dam: %d Saves: %d Size: %s Position: %s Wimpy: %d\n" + % ( + state_checks.GET_HITROLL(victim), + state_checks.GET_DAMROLL(victim), + victim.saving_throw, + tables.size_table[victim.size], + tables.position_table[victim.position].name, + victim.wimpy, + ) + ) if victim.is_npc(): - ch.send("Damage: %dd%d Message: %s\n" % ( - victim.damage[merc.DICE_NUMBER], victim.damage[merc.DICE_TYPE], - const.attack_table[victim.dam_type].noun)) - ch.send("Fighting: %s\n" % (victim.fighting.name if victim.fighting else "(none)" )) + ch.send( + "Damage: %dd%d Message: %s\n" + % ( + victim.damage[merc.DICE_NUMBER], + victim.damage[merc.DICE_TYPE], + const.attack_table[victim.dam_type].noun, + ) + ) + ch.send("Fighting: %s\n" % (victim.fighting.name if victim.fighting else "(none)")) if not victim.is_npc(): - ch.send("Thirst: %d Hunger: %d Full: %d Drunk: %d\n" % ( - victim.condition[merc.COND_THIRST], - victim.condition[merc.COND_HUNGER], - victim.condition[merc.COND_FULL], - victim.condition[merc.COND_DRUNK] )) - ch.send("Carry number: %d Carry weight: %ld\n" % (victim.carry_number, state_checks.get_carry_weight(victim) // 10 )) + ch.send( + "Thirst: %d Hunger: %d Full: %d Drunk: %d\n" + % ( + victim.condition[merc.COND_THIRST], + victim.condition[merc.COND_HUNGER], + victim.condition[merc.COND_FULL], + victim.condition[merc.COND_DRUNK], + ) + ) + ch.send( + "Carry number: %d Carry weight: %ld\n" + % (victim.carry_number, state_checks.get_carry_weight(victim) // 10) + ) if not victim.is_npc(): - ch.send("Age: %d Played: %d Last Level: %d Timer: %d\n" % (victim.get_age(), + ch.send( + "Age: %d Played: %d Last Level: %d Timer: %d\n" + % ( + victim.get_age(), (int)(victim.played + time.time() - victim.logon) // 3600, - victim.last_level, victim.timer)) - ch.send("Act: %s\n" %repr(victim.act)) + victim.last_level, + victim.timer, + ) + ) + ch.send("Act: %s\n" % repr(victim.act)) if victim.comm: ch.send("Comm: %s\n" % repr(victim.comm)) if victim.is_npc() and victim.off_flags: @@ -82,23 +141,35 @@ def do_mstat(ch, argument): ch.send("Form: %s\nParts: %s\n" % (repr(victim.form), repr(victim.parts))) if victim.affected_by: ch.send("Affected by %s\n" % repr(victim.affected_by)) - ch.send("Master: %s Leader: %s Pet: %s\n" % ( - victim.master.name if victim.master else "(none)", - victim.leader.name if victim.leader else "(none)", - victim.pet.name if victim.pet else "(none)")) - ch.send("Short description: %s\nLong description: %s" % ( victim.short_descr, - victim.long_descr if victim.long_descr else "(none)\n" )) + ch.send( + "Master: %s Leader: %s Pet: %s\n" + % ( + victim.master.name if victim.master else "(none)", + victim.leader.name if victim.leader else "(none)", + victim.pet.name if victim.pet else "(none)", + ) + ) + ch.send( + "Short description: %s\nLong description: %s" + % (victim.short_descr, victim.long_descr if victim.long_descr else "(none)\n") + ) if victim.is_npc() and victim.spec_fun is not None: ch.send("Npc has special procedure %s.\n" % victim.spec_fun.__name__) for paf in victim.affected: - ch.send("Spell: '%s' modifies %s by %d for %d hours with bits %s, level %d.\n" % ( - paf.type, - merc.affect_loc_name(paf.location), - paf.modifier, - paf.duration, - merc.affect_bit_name(paf.bitvector), - paf.level)) + ch.send( + "Spell: '%s' modifies %s by %d for %d hours with bits %s, level %d.\n" + % ( + paf.type, + merc.affect_loc_name(paf.location), + paf.modifier, + paf.duration, + merc.affect_bit_name(paf.bitvector), + paf.level, + ) + ) -interp.register_command(interp.cmd_type('mstat', do_mstat, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("mstat", do_mstat, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_murder.py b/src/rom24/commands/do_murder.py index 3b82263..919854d 100644 --- a/src/rom24/commands/do_murder.py +++ b/src/rom24/commands/do_murder.py @@ -17,9 +17,7 @@ def do_murder(ch, argument): ch.send("Murder whom?\n") return - if ch.is_affected(merc.AFF_CHARM) \ - or (ch.is_npc() - and ch.act.is_set(merc.ACT_PET)): + if ch.is_affected(merc.AFF_CHARM) or (ch.is_npc() and ch.act.is_set(merc.ACT_PET)): return victim = ch.get_char_room(arg) if victim is None: @@ -55,5 +53,10 @@ def do_murde(ch, argument): ch.send("If you want to MURDER, spell it out.\n") return -interp.register_command(interp.cmd_type('murder', do_murder, merc.POS_FIGHTING, 5, merc.LOG_ALWAYS, 1)) -interp.register_command(interp.cmd_type('murde', do_murde, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 0)) + +interp.register_command( + interp.cmd_type("murder", do_murder, merc.POS_FIGHTING, 5, merc.LOG_ALWAYS, 1) +) +interp.register_command( + interp.cmd_type("murde", do_murde, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 0) +) diff --git a/src/rom24/commands/do_music.py b/src/rom24/commands/do_music.py index 4ca4b6a..00b48ea 100644 --- a/src/rom24/commands/do_music.py +++ b/src/rom24/commands/do_music.py @@ -30,10 +30,22 @@ def do_music(ch, argument): ch.send("You MUSIC: '%s'\n" % argument) for d in merc.descriptor_list: victim = handler_ch.CH(d) - if d.is_connected(nanny.con_playing) and d.character != ch \ - and not victim.comm.is_set(merc.COMM_NOMUSIC) and not state_checks.IS_SET(victim.comm, - merc.COMM_QUIET): - handler_game.act("$n MUSIC: '$t'", ch, argument, d.character, merc.TO_VICT, merc.POS_SLEEPING) + if ( + d.is_connected(nanny.con_playing) + and d.character != ch + and not victim.comm.is_set(merc.COMM_NOMUSIC) + and not state_checks.IS_SET(victim.comm, merc.COMM_QUIET) + ): + handler_game.act( + "$n MUSIC: '$t'", + ch, + argument, + d.character, + merc.TO_VICT, + merc.POS_SLEEPING, + ) -interp.register_command(interp.cmd_type('music', do_music, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("music", do_music, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_mwhere.py b/src/rom24/commands/do_mwhere.py index d1380cc..b5abd41 100644 --- a/src/rom24/commands/do_mwhere.py +++ b/src/rom24/commands/do_mwhere.py @@ -14,31 +14,51 @@ def do_mwhere(ch, argument): if not argument: # show characters logged for d in merc.descriptor_list: - if d.character and d.is_connected(nanny.con_playing) \ - and d.character.in_room and ch.can_see(d.character) \ - and ch.can_see_room(d.character.in_room.instance_id): + if ( + d.character + and d.is_connected(nanny.con_playing) + and d.character.in_room + and ch.can_see(d.character) + and ch.can_see_room(d.character.in_room.instance_id) + ): victim = d.character count += 1 if d.original: - ch.send("%3d) %s (in the body of %s) is in %s [[%d]]\n" % ( - count, d.original.name, victim.short_descr, - victim.in_room.name, victim.in_room.vnum)) + ch.send( + "%3d) %s (in the body of %s) is in %s [[%d]]\n" + % ( + count, + d.original.name, + victim.short_descr, + victim.in_room.name, + victim.in_room.vnum, + ) + ) else: - ch.send("%3d) %s is in %s [[%d]]\n" % ( - count, victim.name, victim.in_room.name, victim.in_room.vnum)) + ch.send( + "%3d) %s is in %s [[%d]]\n" + % (count, victim.name, victim.in_room.name, victim.in_room.vnum) + ) return found = False for victim in instance.characters.values(): if victim.in_room and argument in victim.name: found = True count += 1 - ch.send("%3d) [[%5d]] %-28s [[%5d]] %s\n" % ( - count, 0 if not victim.is_npc() else victim.vnum, - victim.short_descr if victim.is_npc() else victim.name, - victim.in_room.vnum, - victim.in_room.name )) + ch.send( + "%3d) [[%5d]] %-28s [[%5d]] %s\n" + % ( + count, + 0 if not victim.is_npc() else victim.vnum, + victim.short_descr if victim.is_npc() else victim.name, + victim.in_room.vnum, + victim.in_room.name, + ) + ) if not found: handler_game.act("You didn't find any $T.", ch, None, argument, merc.TO_CHAR) -interp.register_command(interp.cmd_type('mwhere', do_mwhere, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("mwhere", do_mwhere, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_newlock.py b/src/rom24/commands/do_newlock.py index 4ba9f60..7028003 100644 --- a/src/rom24/commands/do_newlock.py +++ b/src/rom24/commands/do_newlock.py @@ -20,4 +20,6 @@ def do_newlock(ch, argument): return -interp.register_command(interp.cmd_type('newlock', do_newlock, merc.POS_DEAD, merc.L4, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("newlock", do_newlock, merc.POS_DEAD, merc.L4, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_nochannels.py b/src/rom24/commands/do_nochannels.py index 300d229..471d2ed 100644 --- a/src/rom24/commands/do_nochannels.py +++ b/src/rom24/commands/do_nochannels.py @@ -26,13 +26,31 @@ def do_nochannels(ch, argument): victim.comm = state_checks.REMOVE_BIT(victim.comm, merc.COMM_NOCHANNELS) victim.send("The gods have restored your channel priviliges.\n") ch.send("NOCHANNELS removed.\n") - handler_game.wiznet("$N restores channels to %s" % victim.name, ch, None, merc.WIZ_PENALTIES, merc.WIZ_SECURE, 0) + handler_game.wiznet( + "$N restores channels to %s" % victim.name, + ch, + None, + merc.WIZ_PENALTIES, + merc.WIZ_SECURE, + 0, + ) else: victim.comm = state_checks.SET_BIT(victim.comm, merc.COMM_NOCHANNELS) victim.send("The gods have revoked your channel priviliges.\n") ch.send("NOCHANNELS set.\n") - handler_game.wiznet("$N revokes %s's channels." % victim.name, ch, None, merc.WIZ_PENALTIES, merc.WIZ_SECURE, 0) + handler_game.wiznet( + "$N revokes %s's channels." % victim.name, + ch, + None, + merc.WIZ_PENALTIES, + merc.WIZ_SECURE, + 0, + ) return -interp.register_command(interp.cmd_type('nochannels', do_nochannels, merc.POS_DEAD, merc.L5, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type( + "nochannels", do_nochannels, merc.POS_DEAD, merc.L5, merc.LOG_ALWAYS, 1 + ) +) diff --git a/src/rom24/commands/do_noemote.py b/src/rom24/commands/do_noemote.py index 3df3ba4..cc045d4 100644 --- a/src/rom24/commands/do_noemote.py +++ b/src/rom24/commands/do_noemote.py @@ -25,13 +25,29 @@ def do_noemote(ch, argument): victim.comm = state_checks.REMOVE_BIT(victim.comm, merc.COMM_NOEMOTE) victim.send("You can emote again.\n") ch.send("NOEMOTE removed.\n") - handler_game.wiznet("$N restores emotes to %s." % victim.name, ch, None, merc.WIZ_PENALTIES, merc.WIZ_SECURE, 0) + handler_game.wiznet( + "$N restores emotes to %s." % victim.name, + ch, + None, + merc.WIZ_PENALTIES, + merc.WIZ_SECURE, + 0, + ) else: victim.comm = state_checks.SET_BIT(victim.comm, merc.COMM_NOEMOTE) victim.send("You can't emote!\n") ch.send("NOEMOTE set.\n") - handler_game.wiznet("$N revokes %s's emotes." % victim.name, ch, None, merc.WIZ_PENALTIES, merc.WIZ_SECURE, 0) + handler_game.wiznet( + "$N revokes %s's emotes." % victim.name, + ch, + None, + merc.WIZ_PENALTIES, + merc.WIZ_SECURE, + 0, + ) return -interp.register_command(interp.cmd_type('noemote', do_noemote, merc.POS_DEAD, merc.L5, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("noemote", do_noemote, merc.POS_DEAD, merc.L5, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_nofollow.py b/src/rom24/commands/do_nofollow.py index e337530..33c76cc 100644 --- a/src/rom24/commands/do_nofollow.py +++ b/src/rom24/commands/do_nofollow.py @@ -19,4 +19,6 @@ def do_nofollow(ch, argument): handler_ch.die_follower(ch) -interp.register_command(interp.cmd_type('nofollow', do_nofollow, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("nofollow", do_nofollow, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_noloot.py b/src/rom24/commands/do_noloot.py index 0703116..5fec92d 100644 --- a/src/rom24/commands/do_noloot.py +++ b/src/rom24/commands/do_noloot.py @@ -17,4 +17,6 @@ def do_noloot(ch, argument): ch.act.set_bit(merc.PLR_CANLOOT) -interp.register_command(interp.cmd_type('noloot', do_noloot, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("noloot", do_noloot, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_north.py b/src/rom24/commands/do_north.py index 62a5efc..15b5c4c 100644 --- a/src/rom24/commands/do_north.py +++ b/src/rom24/commands/do_north.py @@ -12,4 +12,6 @@ def do_north(ch, argument): return -interp.register_command(interp.cmd_type('north', do_north, merc.POS_STANDING, 0, merc.LOG_NEVER, 0)) +interp.register_command( + interp.cmd_type("north", do_north, merc.POS_STANDING, 0, merc.LOG_NEVER, 0) +) diff --git a/src/rom24/commands/do_noshout.py b/src/rom24/commands/do_noshout.py index f32f6de..64bc191 100644 --- a/src/rom24/commands/do_noshout.py +++ b/src/rom24/commands/do_noshout.py @@ -8,6 +8,7 @@ from rom24 import handler_game from rom24 import state_checks + def do_noshout(ch, argument): argument, arg = game_utils.read_word(argument) if not arg: @@ -27,13 +28,29 @@ def do_noshout(ch, argument): victim.comm = state_checks.REMOVE_BIT(victim.comm, merc.COMM_NOSHOUT) victim.send("You can shout again.\n") ch.send("NOSHOUT removed.\n") - handler_game.wiznet("$N restores shouts to %s." % victim.name, ch, None, merc.WIZ_PENALTIES, merc.WIZ_SECURE, 0) + handler_game.wiznet( + "$N restores shouts to %s." % victim.name, + ch, + None, + merc.WIZ_PENALTIES, + merc.WIZ_SECURE, + 0, + ) else: victim.comm = state_checks.SET_BIT(victim.comm, merc.COMM_NOSHOUT) victim.send("You can't shout!\n") ch.send("NOSHOUT set.\n") - handler_game.wiznet("$N revokes %s's shouts." % victim.name, ch, None, merc.WIZ_PENALTIES, merc.WIZ_SECURE, 0) + handler_game.wiznet( + "$N revokes %s's shouts." % victim.name, + ch, + None, + merc.WIZ_PENALTIES, + merc.WIZ_SECURE, + 0, + ) return -interp.register_command(interp.cmd_type('noshout', do_noshout, merc.POS_DEAD, merc.L5, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("noshout", do_noshout, merc.POS_DEAD, merc.L5, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_nosummon.py b/src/rom24/commands/do_nosummon.py index 1c0d81b..5ca1829 100644 --- a/src/rom24/commands/do_nosummon.py +++ b/src/rom24/commands/do_nosummon.py @@ -6,6 +6,7 @@ from rom24 import interp from rom24 import state_checks + def do_nosummon(ch, argument): if ch.is_npc(): if state_checks.IS_SET(ch.imm_flags, merc.IMM_SUMMON): @@ -23,4 +24,6 @@ def do_nosummon(ch, argument): ch.act.set_bit(merc.PLR_NOSUMMON) -interp.register_command(interp.cmd_type('nosummon', do_nosummon, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("nosummon", do_nosummon, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_notell.py b/src/rom24/commands/do_notell.py index 5fa6b53..88e517c 100644 --- a/src/rom24/commands/do_notell.py +++ b/src/rom24/commands/do_notell.py @@ -25,13 +25,29 @@ def do_notell(ch, argument): victim.comm = state_checks.REMOVE_BIT(victim.comm, merc.COMM_NOTELL) victim.send("You can tell again.\n") ch.send("NOTELL removed.\n") - handler_game.wiznet("$N restores tells to %s." % victim.name, ch, None, merc.WIZ_PENALTIES, merc.WIZ_SECURE, 0) + handler_game.wiznet( + "$N restores tells to %s." % victim.name, + ch, + None, + merc.WIZ_PENALTIES, + merc.WIZ_SECURE, + 0, + ) else: victim.comm = state_checks.SET_BIT(victim.comm, merc.COMM_NOTELL) victim.send("You can't tell!\n") ch.send("NOTELL set.\n") - handler_game.wiznet("$N revokes %s's tells." % victim.name, ch, None, merc.WIZ_PENALTIES, merc.WIZ_SECURE, 0) + handler_game.wiznet( + "$N revokes %s's tells." % victim.name, + ch, + None, + merc.WIZ_PENALTIES, + merc.WIZ_SECURE, + 0, + ) return -interp.register_command(interp.cmd_type('notell', do_notell, merc.POS_DEAD, merc.L5, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("notell", do_notell, merc.POS_DEAD, merc.L5, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_ofind.py b/src/rom24/commands/do_ofind.py index 5a3d45a..938ef34 100644 --- a/src/rom24/commands/do_ofind.py +++ b/src/rom24/commands/do_ofind.py @@ -27,10 +27,15 @@ def do_ofind(ch, argument): for objTemplate in instance.item_templates.values(): if fAll or game_utils.is_name(arg, objTemplate.name): found = True - ch.send("[[%5d]] %s(%s)\n" % (objTemplate.vnum, objTemplate.short_descr, objTemplate.name)) + ch.send( + "[[%5d]] %s(%s)\n" + % (objTemplate.vnum, objTemplate.short_descr, objTemplate.name) + ) if not found: ch.send("No objects by that name.\n") return -interp.register_command(interp.cmd_type('ofind', do_ofind, merc.POS_DEAD, merc.L4, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("ofind", do_ofind, merc.POS_DEAD, merc.L4, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_oload.py b/src/rom24/commands/do_oload.py index 5ee9ec9..5f062f5 100644 --- a/src/rom24/commands/do_oload.py +++ b/src/rom24/commands/do_oload.py @@ -37,9 +37,13 @@ def do_oload(ch, argument): else: ch.in_room.put(item) handler_game.act("$n has created $p!", ch, item, None, merc.TO_ROOM) - handler_game.wiznet("$N loads $p.", ch, item, merc.WIZ_LOAD, merc.WIZ_SECURE, ch.trust) + handler_game.wiznet( + "$N loads $p.", ch, item, merc.WIZ_LOAD, merc.WIZ_SECURE, ch.trust + ) ch.send("Ok.\n") return -interp.register_command(interp.cmd_type('oload', do_oload, merc.POS_DEAD, merc.L4, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("oload", do_oload, merc.POS_DEAD, merc.L4, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_omni.py b/src/rom24/commands/do_omni.py index 74e28c8..7aa5c86 100644 --- a/src/rom24/commands/do_omni.py +++ b/src/rom24/commands/do_omni.py @@ -15,4 +15,6 @@ def do_omni(ch, argument): ch.act.set_bit(merc.PLR_OMNI) -interp.register_command(interp.cmd_type('omni', do_omni, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("omni", do_omni, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_open.py b/src/rom24/commands/do_open.py index bb83b01..a6e7eb2 100644 --- a/src/rom24/commands/do_open.py +++ b/src/rom24/commands/do_open.py @@ -73,7 +73,11 @@ def do_open(ch, argument): pexit_rev.exit_info.rem_bit(merc.EX_CLOSED) for rch_id in to_room.people[:]: rch = instance.characters[rch_id] - handler_game.act("The $d opens.", rch, None, pexit_rev.keyword, merc.TO_CHAR) + handler_game.act( + "The $d opens.", rch, None, pexit_rev.keyword, merc.TO_CHAR + ) -interp.register_command(interp.cmd_type('open', do_open, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("open", do_open, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_order.py b/src/rom24/commands/do_order.py index 56118fd..b46a29a 100644 --- a/src/rom24/commands/do_order.py +++ b/src/rom24/commands/do_order.py @@ -37,18 +37,25 @@ def do_order(ch, argument): if victim == ch: ch.send("Aye aye, right away!\n") return - if not victim.is_affected( merc.AFF_CHARM) or victim.master != ch \ - or (state_checks.IS_IMMORTAL(victim) and victim.trust >= ch.trust): + if ( + not victim.is_affected(merc.AFF_CHARM) + or victim.master != ch + or (state_checks.IS_IMMORTAL(victim) and victim.trust >= ch.trust) + ): ch.send("Do it yourself!\n") return found = False for och_id in ch.in_room.people[:]: och = instance.characters[och_id] - if state_checks.IS_AFFECTED(och, merc.AFF_CHARM) \ - and och.master == ch \ - and (fAll or och == victim): + if ( + state_checks.IS_AFFECTED(och, merc.AFF_CHARM) + and och.master == ch + and (fAll or och == victim) + ): found = True - handler_game.act("$n orders you to '%s'." % argument, ch, None, och, merc.TO_VICT) + handler_game.act( + "$n orders you to '%s'." % argument, ch, None, och, merc.TO_VICT + ) och.interpret(argument) if found: @@ -59,4 +66,6 @@ def do_order(ch, argument): return -interp.register_command(interp.cmd_type('order', do_order, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("order", do_order, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_oset.py b/src/rom24/commands/do_oset.py index 19ceeae..fc57960 100644 --- a/src/rom24/commands/do_oset.py +++ b/src/rom24/commands/do_oset.py @@ -6,6 +6,7 @@ from rom24 import interp from rom24 import game_utils + def do_oset(ch, argument): argument, arg1 = game_utils.read_word(argument) argument, arg2 = game_utils.read_word(argument) @@ -66,4 +67,6 @@ def do_oset(ch, argument): return -interp.register_command(interp.cmd_type('oset', do_oset, merc.POS_DEAD, merc.L2, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("oset", do_oset, merc.POS_DEAD, merc.L2, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_ostat.py b/src/rom24/commands/do_ostat.py index a281eb8..e72bc92 100644 --- a/src/rom24/commands/do_ostat.py +++ b/src/rom24/commands/do_ostat.py @@ -19,69 +19,114 @@ def do_ostat(ch, argument): return ch.send("Name(s): %s\n" % obj.name) - ch.send("Vnum: %d Format: %s Type: %s Resets: %d\n" % ( - obj.vnum, "new" if obj.new_format else "old", - obj.item_type, obj.reset_num )) - ch.send("Short description: %s\nLong description: %s\n" % (obj.short_descr, obj.description )) - ch.send("Wear bits: %s\nExtra bits: %s\n" % (obj.equips_to_names, - obj.item_attribute_names)) - ch.send("Number: 1/%d Weight: %d/%d/%d (10th pounds)\n" % ( obj.get_number(), - obj.weight, obj.get_weight(), obj.true_weight() )) - ch.send("Level: %d Cost: %d Condition: %d Timer: %d\n" % (obj.level, obj.cost, obj.condition, obj.timer )) + ch.send( + "Vnum: %d Format: %s Type: %s Resets: %d\n" + % (obj.vnum, "new" if obj.new_format else "old", obj.item_type, obj.reset_num) + ) + ch.send( + "Short description: %s\nLong description: %s\n" + % (obj.short_descr, obj.description) + ) + ch.send( + "Wear bits: %s\nExtra bits: %s\n" + % (obj.equips_to_names, obj.item_attribute_names) + ) + ch.send( + "Number: 1/%d Weight: %d/%d/%d (10th pounds)\n" + % (obj.get_number(), obj.weight, obj.get_weight(), obj.true_weight()) + ) + ch.send( + "Level: %d Cost: %d Condition: %d Timer: %d\n" + % (obj.level, obj.cost, obj.condition, obj.timer) + ) - ch.send("In room: %d In object: %s Carried by: %s\n" % ( - 0 if not obj.in_room else obj.in_room.vnum, - "(none)" if not obj.in_item else obj.in_item.short_descr, - "(noone)" if not obj.in_living else "someone" if not ch.can_see(obj.in_living) else obj.in_living.name )) + ch.send( + "In room: %d In object: %s Carried by: %s\n" + % ( + 0 if not obj.in_room else obj.in_room.vnum, + "(none)" if not obj.in_item else obj.in_item.short_descr, + "(noone)" + if not obj.in_living + else "someone" + if not ch.can_see(obj.in_living) + else obj.in_living.name, + ) + ) ch.send("Values: %s\n" % [v for v in obj.value]) # now give out vital statistics as per identify - if obj.item_type == merc.ITEM_SCROLL \ - or obj.item_type == merc.ITEM_POTION \ - or obj.item_type == merc.ITEM_PILL: + if ( + obj.item_type == merc.ITEM_SCROLL + or obj.item_type == merc.ITEM_POTION + or obj.item_type == merc.ITEM_PILL + ): ch.send("Level %d spells of:", obj.value[0]) for value in obj.value: if value and value in const.skill_table: ch.send(" '%s'" % const.skill_table[value].name) ch.send(".\n") - elif obj.item_type == merc.ITEM_WAND \ - or obj.item_type == merc.ITEM_STAFF: - ch.send("Has %d(%d) charges of level %d" % (obj.value[1], obj.value[2], obj.value[0] )) + elif obj.item_type == merc.ITEM_WAND or obj.item_type == merc.ITEM_STAFF: + ch.send( + "Has %d(%d) charges of level %d" + % (obj.value[1], obj.value[2], obj.value[0]) + ) if obj.value[3] and obj.value[3] in const.skill_table: ch.send(" '%s'" % const.skill_table[obj.value[3]].name) ch.send(".\n") elif obj.item_type == merc.ITEM_DRINK_CON: - ch.send("It holds %s-colored %s.\n" % (const.liq_table[obj.value[2]].color, - const.liq_table[obj.value[2]].name)) + ch.send( + "It holds %s-colored %s.\n" + % (const.liq_table[obj.value[2]].color, const.liq_table[obj.value[2]].name) + ) elif obj.item_type == merc.ITEM_WEAPON: ch.send("Weapon type is ") - weapon_type = {merc.WEAPON_EXOTIC: "exotic", merc.WEAPON_SWORD: "sword", - merc.WEAPON_DAGGER: "dagger", merc.WEAPON_SPEAR: "spear/staff", - merc.WEAPON_MACE: "mace/club", merc.WEAPON_AXE: "axe", - merc.WEAPON_FLAIL: "flail", merc.WEAPON_WHIP: "whip", - merc.WEAPON_POLEARM: "polearm"} + weapon_type = { + merc.WEAPON_EXOTIC: "exotic", + merc.WEAPON_SWORD: "sword", + merc.WEAPON_DAGGER: "dagger", + merc.WEAPON_SPEAR: "spear/staff", + merc.WEAPON_MACE: "mace/club", + merc.WEAPON_AXE: "axe", + merc.WEAPON_FLAIL: "flail", + merc.WEAPON_WHIP: "whip", + merc.WEAPON_POLEARM: "polearm", + } if obj.value[0] not in weapon_type: ch.send("unknown\n") else: ch.send(const.weapon_table[obj.value[0]] + "\n") if obj.new_format: ch.send( - "Damage is %dd%d (average %d)\n" % (obj.value[1], obj.value[2], (1 + obj.value[2]) * obj.value[1] // 2)) + "Damage is %dd%d (average %d)\n" + % (obj.value[1], obj.value[2], (1 + obj.value[2]) * obj.value[1] // 2) + ) else: - ch.send("Damage is %d to %d (average %d)\n" % ( - obj.value[1], obj.value[2], ( obj.value[1] + obj.value[2] ) // 2 )) - ch.send("Damage noun is %s.\n" % ( - const.attack_table[obj.value[3]].noun if obj.value[3] in const.attack_table else "undefined")) + ch.send( + "Damage is %d to %d (average %d)\n" + % (obj.value[1], obj.value[2], (obj.value[1] + obj.value[2]) // 2) + ) + ch.send( + "Damage noun is %s.\n" + % ( + const.attack_table[obj.value[3]].noun + if obj.value[3] in const.attack_table + else "undefined" + ) + ) if obj.value[4] > 0: # weapon flags ch.send("Weapons flags: %s\n" % merc.weapon_bit_name(obj.value[4])) elif obj.item_type == merc.ITEM_ARMOR: - ch.send("Armor class is %d pierce, %d bash, %d slash, and %d vs. magic\n" % ( - obj.value[0], obj.value[1], obj.value[2], obj.value[3] )) + ch.send( + "Armor class is %d pierce, %d bash, %d slash, and %d vs. magic\n" + % (obj.value[0], obj.value[1], obj.value[2], obj.value[3]) + ) elif obj.item_type == merc.ITEM_CONTAINER: - ch.send("Capacity: %d# Maximum weight: %d# flags: %s\n" % ( - obj.value[0], obj.value[3], merc.cont_bit_name(obj.value[1]))) + ch.send( + "Capacity: %d# Maximum weight: %d# flags: %s\n" + % (obj.value[0], obj.value[3], merc.cont_bit_name(obj.value[1])) + ) if obj.value[4] != 100: ch.send("Weight multiplier: %d%%\n" % obj.value[4]) @@ -95,12 +140,15 @@ def do_ostat(ch, argument): ch.send("'\n") affected = list(obj.affected) - #TODO: This may not be necessary at all. - #if not obj.enchanted: + # TODO: This may not be necessary at all. + # if not obj.enchanted: # objTemplate = merc.itemTemplate[obj.vnum] # affected.extend(objTemplate.affected) for paf in affected: - ch.send("Affects %s by %d, level %d" % (merc.affect_loc_name(paf.location), paf.modifier, paf.level)) + ch.send( + "Affects %s by %d, level %d" + % (merc.affect_loc_name(paf.location), paf.modifier, paf.level) + ) if paf.duration > -1: ch.send(", %d hours.\n" % paf.duration) else: @@ -117,9 +165,13 @@ def do_ostat(ch, argument): elif paf.where == merc.TO_RESIST: ch.send("Adds resistance to %s.\n" % merc.imm_bit_name(paf.bitvector)) elif paf.where == merc.TO_VULN: - ch.send("Adds vulnerability to %s.\n" % merc.imm_bit_name(paf.bitvector)) + ch.send( + "Adds vulnerability to %s.\n" % merc.imm_bit_name(paf.bitvector) + ) else: ch.send("Unknown bit %d: %d\n" % paf.where, paf.bitvector) -interp.register_command(interp.cmd_type('ostat', do_ostat, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("ostat", do_ostat, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_outfit.py b/src/rom24/commands/do_outfit.py index d23bdeb..7afcb9a 100644 --- a/src/rom24/commands/do_outfit.py +++ b/src/rom24/commands/do_outfit.py @@ -17,7 +17,9 @@ def do_outfit(ch, argument): item = ch.slots.light if not item: - item = object_creator.create_item(instance.item_templates[merc.OBJ_VNUM_SCHOOL_BANNER], 0) + item = object_creator.create_item( + instance.item_templates[merc.OBJ_VNUM_SCHOOL_BANNER], 0 + ) item.cost = 0 ch.put(item) ch.equip(item, True, False) @@ -25,7 +27,9 @@ def do_outfit(ch, argument): item = ch.slots.body if not item: - item = object_creator.create_item(instance.item_templates[merc.OBJ_VNUM_SCHOOL_VEST], 0) + item = object_creator.create_item( + instance.item_templates[merc.OBJ_VNUM_SCHOOL_VEST], 0 + ) item.cost = 0 ch.put(item) ch.equip(item, True, False) @@ -46,7 +50,9 @@ def do_outfit(ch, argument): item = ch.slots.main_hand shield = ch.slots.off_hand if (not item or not item.flags.two_handed) and not shield: - item = object_creator.create_item(instance.item_templates[merc.OBJ_VNUM_SCHOOL_SHIELD], 0) + item = object_creator.create_item( + instance.item_templates[merc.OBJ_VNUM_SCHOOL_SHIELD], 0 + ) item.cost = 0 ch.put(item) ch.equip(item, True, False) @@ -55,4 +61,6 @@ def do_outfit(ch, argument): ch.send("You have been equipped by Mota.\n") -interp.register_command(interp.cmd_type('outfit', do_outfit, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("outfit", do_outfit, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_owhere.py b/src/rom24/commands/do_owhere.py index 769c8bd..2953ab4 100644 --- a/src/rom24/commands/do_owhere.py +++ b/src/rom24/commands/do_owhere.py @@ -18,7 +18,11 @@ def do_owhere(ch, argument): ch.send("Find what?\n") return for item in instance.items.values(): - if not ch.can_see_item(item) or not game_utils.is_name(argument, item.name) or ch.level < item.level: + if ( + not ch.can_see_item(item) + or not game_utils.is_name(argument, item.name) + or ch.level < item.level + ): continue found = True logger.info("owhere command found an item for %s: %s", argument, item) @@ -36,14 +40,36 @@ def do_owhere(ch, argument): while content and content.in_item: content = content.in_item - if content.in_living and ch.can_see(content.in_living) and content.in_living.in_room: - ch.send("%3d) %s (%s) is carried by %s [[Room %d]]\n" % ( - number,item.short_descr, item.vnum, state_checks.PERS(content.in_living, ch), content.in_living.in_room.vnum )) + if ( + content.in_living + and ch.can_see(content.in_living) + and content.in_living.in_room + ): + ch.send( + "%3d) %s (%s) is carried by %s [[Room %d]]\n" + % ( + number, + item.short_descr, + item.vnum, + state_checks.PERS(content.in_living, ch), + content.in_living.in_room.vnum, + ) + ) elif content.in_room and ch.can_see_room(content.in_room.instance_id): - ch.send("%3d) %s (%s) is in %s [[Room %d]]\n" % ( - number, item.short_descr, item.vnum, content.in_room.name, content.in_room.vnum)) + ch.send( + "%3d) %s (%s) is in %s [[Room %d]]\n" + % ( + number, + item.short_descr, + item.vnum, + content.in_room.name, + content.in_room.vnum, + ) + ) else: - ch.send("%3d) %s (%s) is somewhere\n" % (number, item.short_descr, item.vnum)) + ch.send( + "%3d) %s (%s) is somewhere\n" % (number, item.short_descr, item.vnum) + ) if number >= max_found: break @@ -52,4 +78,6 @@ def do_owhere(ch, argument): ch.send("Nothing like that in heaven or earth.\n") -interp.register_command(interp.cmd_type('owhere', do_owhere, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("owhere", do_owhere, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_pardon.py b/src/rom24/commands/do_pardon.py index 9d11d9a..a176281 100644 --- a/src/rom24/commands/do_pardon.py +++ b/src/rom24/commands/do_pardon.py @@ -36,4 +36,6 @@ def do_pardon(ch, argument): return -interp.register_command(interp.cmd_type('pardon', do_pardon, merc.POS_DEAD, merc.L3, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("pardon", do_pardon, merc.POS_DEAD, merc.L3, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_password.py b/src/rom24/commands/do_password.py index b34f750..d77f67d 100644 --- a/src/rom24/commands/do_password.py +++ b/src/rom24/commands/do_password.py @@ -46,4 +46,6 @@ def do_password(ch, argument): return -interp.register_command(interp.cmd_type('password', do_password, merc.POS_DEAD, 0, merc.LOG_NEVER, 1)) +interp.register_command( + interp.cmd_type("password", do_password, merc.POS_DEAD, 0, merc.LOG_NEVER, 1) +) diff --git a/src/rom24/commands/do_peace.py b/src/rom24/commands/do_peace.py index 0550d10..8bbc2dc 100644 --- a/src/rom24/commands/do_peace.py +++ b/src/rom24/commands/do_peace.py @@ -20,4 +20,6 @@ def do_peace(ch, argument): return -interp.register_command(interp.cmd_type('peace', do_peace, merc.POS_DEAD, merc.L5, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("peace", do_peace, merc.POS_DEAD, merc.L5, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_pecho.py b/src/rom24/commands/do_pecho.py index cada739..9b3498e 100644 --- a/src/rom24/commands/do_pecho.py +++ b/src/rom24/commands/do_pecho.py @@ -27,4 +27,6 @@ def do_pecho(ch, argument): ch.send("\n") -interp.register_command(interp.cmd_type('pecho', do_pecho, merc.POS_DEAD, merc.L4, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("pecho", do_pecho, merc.POS_DEAD, merc.L4, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_pick.py b/src/rom24/commands/do_pick.py index 934d890..870f773 100644 --- a/src/rom24/commands/do_pick.py +++ b/src/rom24/commands/do_pick.py @@ -26,13 +26,19 @@ def do_pick(self, argument): # look for guards for gch_id in ch.in_room.people: gch = instance.characters[gch_id] - if state_checks.IS_NPC(gch) and state_checks.IS_AWAKE(gch) and ch.level + 5 < gch.level: - handler_game.act("$N is standing too close to the lock.", ch, None, gch, merc.TO_CHAR) + if ( + state_checks.IS_NPC(gch) + and state_checks.IS_AWAKE(gch) + and ch.level + 5 < gch.level + ): + handler_game.act( + "$N is standing too close to the lock.", ch, None, gch, merc.TO_CHAR + ) return if not ch.is_npc() and random.randint(1, 99) > ch.get_skill("pick lock"): ch.send("You failed.\n") if ch.is_pc: - ch.check_improve( "pick lock", False, 2) + ch.check_improve("pick lock", False, 2) return obj = ch.get_item_here(arg) if obj: @@ -51,13 +57,16 @@ def do_pick(self, argument): ch.send("You failed.\n") return state_checks.REMOVE_BIT(obj.value[1], merc.EX_LOCKED) - handler_game.act("You pick the lock on $p.", ch, obj, None, merc.TO_CHAR) - handler_game.act("$n picks the lock on $p.", ch, obj, None, merc.TO_ROOM) + handler_game.act( + "You pick the lock on $p.", ch, obj, None, merc.TO_CHAR + ) + handler_game.act( + "$n picks the lock on $p.", ch, obj, None, merc.TO_ROOM + ) if ch.is_pc: - ch.check_improve( "pick lock", True, 2) + ch.check_improve("pick lock", True, 2) return - # 'pick object' if obj.item_type != merc.ITEM_CONTAINER: ch.send("That's not a container.\n") @@ -79,7 +88,7 @@ def do_pick(self, argument): handler_game.act("You pick the lock on $p.", ch, obj, None, merc.TO_CHAR) handler_game.act("$n picks the lock on $p.", ch, obj, None, merc.TO_ROOM) if ch.is_pc: - ch.check_improve( "pick lock", True, 2) + ch.check_improve("pick lock", True, 2) return door = handler_room.find_door(ch, arg) if door >= 0: @@ -101,13 +110,18 @@ def do_pick(self, argument): ch.send("*Click*\n") handler_game.act("$n picks the $d.", ch, None, pexit.keyword, merc.TO_ROOM) if ch.is_pc: - ch.check_improve( "pick_lock", True, 2) + ch.check_improve("pick_lock", True, 2) # unlock the other side to_room = pexit.to_room - if to_room and to_room.exit[merc.rev_dir[door]] != 0 \ - and to_room.exit[merc.rev_dir[door]].to_room == ch.in_room: + if ( + to_room + and to_room.exit[merc.rev_dir[door]] != 0 + and to_room.exit[merc.rev_dir[door]].to_room == ch.in_room + ): to_room.exit[merc.rev_dir[door]].exit_info.rem_bit(merc.EX_LOCKED) -interp.register_command(interp.cmd_type('pick', do_pick, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("pick", do_pick, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_pmote.py b/src/rom24/commands/do_pmote.py index 0470162..ec9c44b 100644 --- a/src/rom24/commands/do_pmote.py +++ b/src/rom24/commands/do_pmote.py @@ -29,4 +29,6 @@ def do_pmote(ch, argument): return -interp.register_command(interp.cmd_type('pmote', do_pmote, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("pmote", do_pmote, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_pose.py b/src/rom24/commands/do_pose.py index b52e002..f72d840 100644 --- a/src/rom24/commands/do_pose.py +++ b/src/rom24/commands/do_pose.py @@ -10,8 +10,8 @@ # All the posing stuff. pose_table = { - 'to_ch': { - 'mage': ( + "to_ch": { + "mage": ( "You sizzle with energy.", "You turn into a butterfly, then return to your normal shape.", "Blue sparks fly from your fingers.", @@ -30,7 +30,7 @@ "A black hole swallows you.", "The world shimmers in time with your whistling.", ), - 'cleric': ( + "cleric": ( "You feel very holy.", "You nonchalantly turn wine into water.", "A halo appears over your head.", @@ -49,7 +49,7 @@ "Valentine Michael Smith offers you a glass of water.", "The great god Mota gives you a staff.", ), - 'thief': ( + "thief": ( "You perform a small card trick.", "You wiggle your ears alternately.", "You nimbly tie yourself into a knot.", @@ -68,7 +68,7 @@ "Where did you go?", "Click.", ), - 'warrior': ( + "warrior": ( "You show your bulging muscles.", "You crack nuts between your fingers.", "You grizzle your teeth and look mean.", @@ -88,8 +88,8 @@ "Atlas asks you to relieve him.", ), }, - 'to_others': { - 'mage': ( + "to_others": { + "mage": ( "$n sizzles with energy.", "$n turns into a butterfly, then returns to $s normal shape.", "Blue sparks fly from $n's fingers.", @@ -108,7 +108,7 @@ "A black hole swallows $n.", "The world shimmers in time with $n's whistling.", ), - 'cleric': ( + "cleric": ( "$n looks very holy.", "$n nonchalantly turns wine into water.", "A halo appears over $n's head.", @@ -127,7 +127,7 @@ "Valentine Michael Smith offers $n a glass of water.", "The great god Mota gives $n a staff.", ), - 'thief': ( + "thief": ( "$n performs a small card trick.", "$n wiggles $s ears alternately.", "$n nimbly ties $mself into a knot.", @@ -146,7 +146,7 @@ "Where did $n go?", "Click.", ), - 'warrior': ( + "warrior": ( "$n shows $s bulging muscles.", "$n cracks nuts between $s fingers.", "$n grizzles $s teeth and looks mean.", @@ -172,13 +172,19 @@ def do_pose(ch, argument): if ch.is_npc(): return - band = merc.LEVEL_HERO // len(pose_table['to_ch'][ch.guild.name]) + band = merc.LEVEL_HERO // len(pose_table["to_ch"][ch.guild.name]) level = min(ch.level, merc.LEVEL_HERO) // band choice = random.randint(0, level) - handler_game.act(pose_table['to_ch'][ch.guild.name][choice], ch, None, None, merc.TO_CHAR) - handler_game.act(pose_table['to_others'][ch.guild.name][choice], ch, None, None, merc.TO_ROOM) + handler_game.act( + pose_table["to_ch"][ch.guild.name][choice], ch, None, None, merc.TO_CHAR + ) + handler_game.act( + pose_table["to_others"][ch.guild.name][choice], ch, None, None, merc.TO_ROOM + ) return -interp.register_command(interp.cmd_type('pose', do_pose, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("pose", do_pose, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_pour.py b/src/rom24/commands/do_pour.py index 8680275..f524ce9 100644 --- a/src/rom24/commands/do_pour.py +++ b/src/rom24/commands/do_pour.py @@ -29,10 +29,22 @@ def do_pour(ch, argument): return out.value[1] = 0 out.value[3] = 0 - handler_game.act("You invert $p, spilling %s all over the ground." % const.liq_table[out.value[2]].name, ch, out, - None, merc.TO_CHAR) - handler_game.act("$n inverts $p, spilling %s all over the ground." % const.liq_table[out.value[2]].name, ch, out, - None, merc.TO_ROOM) + handler_game.act( + "You invert $p, spilling %s all over the ground." + % const.liq_table[out.value[2]].name, + ch, + out, + None, + merc.TO_CHAR, + ) + handler_game.act( + "$n inverts $p, spilling %s all over the ground." + % const.liq_table[out.value[2]].name, + ch, + out, + None, + merc.TO_ROOM, + ) return into = ch.get_item_here(arg2) vch = None @@ -42,7 +54,7 @@ def do_pour(ch, argument): if vch is None: ch.send("Pour into what?\n") return - into = vch.get_eq('held') + into = vch.get_eq("held") if not into: ch.send("They aren't holding anything.") @@ -59,7 +71,9 @@ def do_pour(ch, argument): handler_game.act("There's nothing in $p to pour.", ch, out, None, merc.TO_CHAR) return if into.value[1] >= into.value[0]: - handler_game.act("$p is already filled to the top.", ch, into, None, merc.TO_CHAR) + handler_game.act( + "$p is already filled to the top.", ch, into, None, merc.TO_CHAR + ) return amount = min(out.value[1], into.value[0] - into.value[1]) @@ -68,16 +82,44 @@ def do_pour(ch, argument): into.value[2] = out.value[2] if not vch: - handler_game.act("You pour %s from $p into $P." % const.liq_table[out.value[2]].name, ch, out, into, - merc.TO_CHAR) - handler_game.act("$n pours %s from $p into $P." % const.liq_table[out.value[2]].name, ch, out, into, - merc.TO_ROOM) + handler_game.act( + "You pour %s from $p into $P." % const.liq_table[out.value[2]].name, + ch, + out, + into, + merc.TO_CHAR, + ) + handler_game.act( + "$n pours %s from $p into $P." % const.liq_table[out.value[2]].name, + ch, + out, + into, + merc.TO_ROOM, + ) else: - handler_game.act("You pour some %s for $N." % const.liq_table[out.value[2]].name, ch, None, vch, - merc.TO_CHAR) - handler_game.act("$n pours you some %s." % const.liq_table[out.value[2]].name, ch, None, vch, merc.TO_VICT) - handler_game.act("$n pours some %s for $N." % const.liq_table[out.value[2]].name, ch, None, vch, - merc.TO_NOTVICT) + handler_game.act( + "You pour some %s for $N." % const.liq_table[out.value[2]].name, + ch, + None, + vch, + merc.TO_CHAR, + ) + handler_game.act( + "$n pours you some %s." % const.liq_table[out.value[2]].name, + ch, + None, + vch, + merc.TO_VICT, + ) + handler_game.act( + "$n pours some %s for $N." % const.liq_table[out.value[2]].name, + ch, + None, + vch, + merc.TO_NOTVICT, + ) -interp.register_command(interp.cmd_type('pour', do_pour, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("pour", do_pour, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_practice.py b/src/rom24/commands/do_practice.py index 78195dc..13477cb 100644 --- a/src/rom24/commands/do_practice.py +++ b/src/rom24/commands/do_practice.py @@ -18,8 +18,11 @@ def do_practice(ch, argument): if not argument: col = 0 for sn, skill in const.skill_table.items(): - if ch.level < skill.skill_level[ch.guild.name] \ - or sn not in ch.learned or ch.learned[sn] < 1: # skill is not known + if ( + ch.level < skill.skill_level[ch.guild.name] + or sn not in ch.learned + or ch.learned[sn] < 1 + ): # skill is not known continue ch.send("%-18s %3d%% " % (skill.name, ch.learned[sn])) @@ -49,9 +52,15 @@ def do_practice(ch, argument): ch.send("You have no practice sessions left.\n") return skill = state_checks.prefix_lookup(const.skill_table, argument) - if not skill or not ch.is_npc() \ - and (ch.level < skill.skill_level[ch.guild.name] or ch.learned[skill.name] < 1 \ - or skill.rating[ch.guild.name] == 0): + if ( + not skill + or not ch.is_npc() + and ( + ch.level < skill.skill_level[ch.guild.name] + or ch.learned[skill.name] < 1 + or skill.rating[ch.guild.name] == 0 + ) + ): ch.send("You can't practice that.\n") return @@ -61,16 +70,24 @@ def do_practice(ch, argument): ch.send("You are already learned at %s.\n" % skill.name) else: ch.practice -= 1 - ch.learned[skill.name] += const.int_app[ch.stat(merc.STAT_INT)].learn // skill.rating[ - ch.guild.name] + ch.learned[skill.name] += ( + const.int_app[ch.stat(merc.STAT_INT)].learn + // skill.rating[ch.guild.name] + ) if ch.learned[skill.name] < adept: handler_game.act("You practice $T.", ch, None, skill.name, merc.TO_CHAR) handler_game.act("$n practices $T.", ch, None, skill.name, merc.TO_ROOM) else: ch.learned[skill.name] = adept - handler_game.act("You are now learned at $T.", ch, None, skill.name, merc.TO_CHAR) - handler_game.act("$n is now learned at $T.", ch, None, skill.name, merc.TO_ROOM) + handler_game.act( + "You are now learned at $T.", ch, None, skill.name, merc.TO_CHAR + ) + handler_game.act( + "$n is now learned at $T.", ch, None, skill.name, merc.TO_ROOM + ) return -interp.register_command(interp.cmd_type('practice', do_practice, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("practice", do_practice, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_prefix.py b/src/rom24/commands/do_prefix.py index bd4b181..b203138 100644 --- a/src/rom24/commands/do_prefix.py +++ b/src/rom24/commands/do_prefix.py @@ -26,5 +26,10 @@ def do_prefi(ch, argument): ch.send("You cannot abbreviate the prefix command.\n") return -interp.register_command(interp.cmd_type('prefix', do_prefix, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1)) -interp.register_command(interp.cmd_type('prefi', do_prefi, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 0)) + +interp.register_command( + interp.cmd_type("prefix", do_prefix, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1) +) +interp.register_command( + interp.cmd_type("prefi", do_prefi, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 0) +) diff --git a/src/rom24/commands/do_prompt.py b/src/rom24/commands/do_prompt.py index 99767bc..4cd4878 100644 --- a/src/rom24/commands/do_prompt.py +++ b/src/rom24/commands/do_prompt.py @@ -29,4 +29,6 @@ def do_prompt(ch, argument): return -interp.register_command(interp.cmd_type('prompt', do_prompt, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("prompt", do_prompt, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_protect.py b/src/rom24/commands/do_protect.py index 95b0fd5..420bb18 100644 --- a/src/rom24/commands/do_protect.py +++ b/src/rom24/commands/do_protect.py @@ -7,6 +7,7 @@ from rom24 import state_checks from rom24 import handler_game + def do_protect(ch, argument): if not argument: ch.send("Protect whom from snooping?\n") @@ -16,13 +17,24 @@ def do_protect(ch, argument): ch.send("You can't find them.\n") return if victim.comm.is_set(merc.COMM_SNOOP_PROOF): - handler_game.act("$N is no longer snoop-proof.", ch, None, victim, merc.TO_CHAR, merc.POS_DEAD) + handler_game.act( + "$N is no longer snoop-proof.", + ch, + None, + victim, + merc.TO_CHAR, + merc.POS_DEAD, + ) victim.send("Your snoop-proofing was just removed.\n") victim.comm = state_checks.REMOVE_BIT(victim.comm, merc.COMM_SNOOP_PROOF) else: - handler_game.act("$N is now snoop-proof.", ch, None, victim, merc.TO_CHAR, merc.POS_DEAD) + handler_game.act( + "$N is now snoop-proof.", ch, None, victim, merc.TO_CHAR, merc.POS_DEAD + ) victim.send("You are now immune to snooping.\n") victim.comm = state_checks.SET_BIT(victim.comm, merc.COMM_SNOOP_PROOF) -interp.register_command(interp.cmd_type('protect', do_protect, merc.POS_DEAD, merc.L1, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("protect", do_protect, merc.POS_DEAD, merc.L1, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_purge.py b/src/rom24/commands/do_purge.py index 6dc2ea6..4342351 100644 --- a/src/rom24/commands/do_purge.py +++ b/src/rom24/commands/do_purge.py @@ -10,13 +10,17 @@ from rom24 import state_checks from rom24 import instance + def do_purge(ch, argument): argument, arg = game_utils.read_word(argument) if not arg: for victim_id in ch.in_room.people: victim = instance.characters[victim_id] - if victim.is_npc() and not state_checks.IS_SET(victim.act, merc.ACT_NOPURGE) \ - and victim != ch: # safety precaution + if ( + victim.is_npc() + and not state_checks.IS_SET(victim.act, merc.ACT_NOPURGE) + and victim != ch + ): # safety precaution victim.in_room.get(victim) victim.extract(True) for item_id in ch.in_room.items: @@ -54,4 +58,6 @@ def do_purge(ch, argument): return -interp.register_command(interp.cmd_type('purge', do_purge, merc.POS_DEAD, merc.L4, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("purge", do_purge, merc.POS_DEAD, merc.L4, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_put.py b/src/rom24/commands/do_put.py index b4615c9..35c0cdd 100644 --- a/src/rom24/commands/do_put.py +++ b/src/rom24/commands/do_put.py @@ -9,6 +9,7 @@ from rom24 import handler_game from rom24 import state_checks + def do_put(ch, argument): argument, arg1 = game_utils.read_word(argument) argument, arg2 = game_utils.read_word(argument) @@ -46,12 +47,12 @@ def do_put(ch, argument): if state_checks.WEIGHT_MULT(item) != 100: ch.send("You have a feeling that would be a bad idea.\n") return - if item.get_weight() + container.true_weight() > (container.value[0] * 10) \ - or item.get_weight() > (container.value[3] * 10): + if item.get_weight() + container.true_weight() > ( + container.value[0] * 10 + ) or item.get_weight() > (container.value[3] * 10): ch.send("It won't fit.\n") return - if container.vnum == merc.OBJ_VNUM_PIT \ - and not container.flags.take: + if container.vnum == merc.OBJ_VNUM_PIT and not container.flags.take: if item.timer: item.flags.had_timer = True else: @@ -68,12 +69,17 @@ def do_put(ch, argument): else: # 'put all container' or 'put all.obj container' for item in ch.inventory[:]: - if (len(arg1) == 3 or arg1[4:] in item.name ) \ - and ch.can_see_item(item) and state_checks.WEIGHT_MULT(item) == 100 \ - and not item.equipped_to and item != container \ - and ch.can_drop_item(item) \ - and item.get_weight() + container.true_weight() <= (container.value[0] * 10) \ - and item.get_weight() < (container.value[3] * 10): + if ( + (len(arg1) == 3 or arg1[4:] in item.name) + and ch.can_see_item(item) + and state_checks.WEIGHT_MULT(item) == 100 + and not item.equipped_to + and item != container + and ch.can_drop_item(item) + and item.get_weight() + container.true_weight() + <= (container.value[0] * 10) + and item.get_weight() < (container.value[3] * 10) + ): if container.vnum == merc.OBJ_VNUM_PIT and not item.flags.take: if item.timer: item.flags.had_timer = True @@ -82,11 +88,21 @@ def do_put(ch, argument): ch.get(item) container.put(item) if state_checks.IS_SET(container.value[1], merc.CONT_PUT_ON): - handler_game.act("$n puts $p on $P.", ch, item, container, merc.TO_ROOM) - handler_game.act("You put $p on $P.", ch, item, container, merc.TO_CHAR) + handler_game.act( + "$n puts $p on $P.", ch, item, container, merc.TO_ROOM + ) + handler_game.act( + "You put $p on $P.", ch, item, container, merc.TO_CHAR + ) else: - handler_game.act("$n puts $p in $P.", ch, item, container, merc.TO_ROOM) - handler_game.act("You put $p in $P.", ch, item, container, merc.TO_CHAR) + handler_game.act( + "$n puts $p in $P.", ch, item, container, merc.TO_ROOM + ) + handler_game.act( + "You put $p in $P.", ch, item, container, merc.TO_CHAR + ) -interp.register_command(interp.cmd_type('put', do_put, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("put", do_put, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_quaff.py b/src/rom24/commands/do_quaff.py index d4263cd..fcf79b5 100644 --- a/src/rom24/commands/do_quaff.py +++ b/src/rom24/commands/do_quaff.py @@ -9,6 +9,7 @@ from rom24 import handler_game from rom24 import handler_magic + def do_quaff(ch, argument): argument, arg = game_utils.read_word(argument) if not arg: @@ -35,4 +36,6 @@ def do_quaff(ch, argument): return -interp.register_command(interp.cmd_type('quaff', do_quaff, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("quaff", do_quaff, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_question.py b/src/rom24/commands/do_question.py index 6bdf716..b724756 100644 --- a/src/rom24/commands/do_question.py +++ b/src/rom24/commands/do_question.py @@ -31,10 +31,22 @@ def do_question(ch, argument): ch.send("You question '%s'\n" % argument) for d in merc.descriptor_list: victim = handler_ch.CH(d) - if d.is_connected(nanny.con_playing) and d.character != ch \ - and not victim.comm.is_set(merc.COMM_NOQUESTION) and not state_checks.IS_SET(victim.comm, - merc.COMM_QUIET): - handler_game.act("$n questions '$t'", ch, argument, d.character, merc.TO_VICT, merc.POS_SLEEPING) + if ( + d.is_connected(nanny.con_playing) + and d.character != ch + and not victim.comm.is_set(merc.COMM_NOQUESTION) + and not state_checks.IS_SET(victim.comm, merc.COMM_QUIET) + ): + handler_game.act( + "$n questions '$t'", + ch, + argument, + d.character, + merc.TO_VICT, + merc.POS_SLEEPING, + ) -interp.register_command(interp.cmd_type('question', do_question, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("question", do_question, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_quiet.py b/src/rom24/commands/do_quiet.py index 40cbb69..43f21fe 100644 --- a/src/rom24/commands/do_quiet.py +++ b/src/rom24/commands/do_quiet.py @@ -16,4 +16,6 @@ def do_quiet(ch, argument): ch.comm.set_bit(merc.COMM_QUIET) -interp.register_command(interp.cmd_type('quiet', do_quiet, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("quiet", do_quiet, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_quit.py b/src/rom24/commands/do_quit.py index 70402d4..e4dd4f6 100644 --- a/src/rom24/commands/do_quit.py +++ b/src/rom24/commands/do_quit.py @@ -21,10 +21,12 @@ def do_quit(ch, argument): ch.send("Alas, all good things must come to an end.\n") handler_game.act("$n has left the game.", ch, None, None, merc.TO_ROOM) logger.info("%s has quit.", ch.name) - handler_game.wiznet("$N rejoins the real world.", ch, None, merc.WIZ_LOGINS, 0, ch.trust) + handler_game.wiznet( + "$N rejoins the real world.", ch, None, merc.WIZ_LOGINS, 0, ch.trust + ) # After extract_char the ch is no longer valid! ch.save(logout=True, force=True) - #save.legacy_save_char_obj(ch) + # save.legacy_save_char_obj(ch) id = ch.id d = ch.desc ch.extract(True) @@ -45,5 +47,9 @@ def do_qui(ch, argument): return -interp.register_command(interp.cmd_type('quit', do_quit, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) -interp.register_command(interp.cmd_type('qui', do_qui, merc.POS_DEAD, 0, merc.LOG_NORMAL, 0)) +interp.register_command( + interp.cmd_type("quit", do_quit, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) +interp.register_command( + interp.cmd_type("qui", do_qui, merc.POS_DEAD, 0, merc.LOG_NORMAL, 0) +) diff --git a/src/rom24/commands/do_quote.py b/src/rom24/commands/do_quote.py index d0cac6c..dccd62f 100644 --- a/src/rom24/commands/do_quote.py +++ b/src/rom24/commands/do_quote.py @@ -25,15 +25,27 @@ def do_quote(ch, argument): if ch.comm.is_set(merc.COMM_NOCHANNELS): ch.send("The gods have revoked your channel priviliges.\n") return - ch.commm = ch.comm.rem_bit( merc.COMM_NOQUOTE) + ch.commm = ch.comm.rem_bit(merc.COMM_NOQUOTE) ch.send("You quote '%s'\n" % argument) for d in merc.descriptor_list: victim = handler_ch.CH(d) - if d.is_connected(nanny.con_playing) and d.character != ch \ - and not victim.comm.is_set(merc.COMM_NOQUOTE) and not state_checks.IS_SET(victim.comm, - merc.COMM_QUIET): - handler_game.act("$n quotes '$t'", ch, argument, d.character, merc.TO_VICT, merc.POS_SLEEPING) + if ( + d.is_connected(nanny.con_playing) + and d.character != ch + and not victim.comm.is_set(merc.COMM_NOQUOTE) + and not state_checks.IS_SET(victim.comm, merc.COMM_QUIET) + ): + handler_game.act( + "$n quotes '$t'", + ch, + argument, + d.character, + merc.TO_VICT, + merc.POS_SLEEPING, + ) -interp.register_command(interp.cmd_type('quote', do_quote, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("quote", do_quote, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_reboot.py b/src/rom24/commands/do_reboot.py index 9838219..91c909d 100644 --- a/src/rom24/commands/do_reboot.py +++ b/src/rom24/commands/do_reboot.py @@ -7,6 +7,7 @@ from rom24 import comm from rom24 import handler_ch + def do_reboot(ch, argument): if ch.invis_level < merc.LEVEL_HERO: ch.do_echo("Reboot by %s." % ch.name) @@ -23,5 +24,9 @@ def do_reboo(ch, argument): return -interp.register_command(interp.cmd_type('reboot', do_reboot, merc.POS_DEAD, merc.L1, merc.LOG_ALWAYS, 1)) -interp.register_command(interp.cmd_type('reboo', do_reboo, merc.POS_DEAD, merc.L1, merc.LOG_NORMAL, 0)) +interp.register_command( + interp.cmd_type("reboot", do_reboot, merc.POS_DEAD, merc.L1, merc.LOG_ALWAYS, 1) +) +interp.register_command( + interp.cmd_type("reboo", do_reboo, merc.POS_DEAD, merc.L1, merc.LOG_NORMAL, 0) +) diff --git a/src/rom24/commands/do_recall.py b/src/rom24/commands/do_recall.py index 33d1a64..0594e17 100644 --- a/src/rom24/commands/do_recall.py +++ b/src/rom24/commands/do_recall.py @@ -12,7 +12,6 @@ from rom24 import update - def do_recall(ch, argument): if ch.is_npc() and not ch.act.is_set(merc.ACT_PET): ch.send("Only players can recall.\n") @@ -24,7 +23,9 @@ def do_recall(ch, argument): return if ch.in_room == location: return - if state_checks.IS_SET(ch.in_room.room_flags, merc.ROOM_NO_RECALL) or ch.is_affected(merc.AFF_CURSE): + if state_checks.IS_SET( + ch.in_room.room_flags, merc.ROOM_NO_RECALL + ) or ch.is_affected(merc.AFF_CURSE): ch.send("Mota has forsaken you.\n") return victim = ch.fighting @@ -32,14 +33,14 @@ def do_recall(ch, argument): skill = ch.get_skill("recall") if random.randint(1, 99) < 80 * skill / 100: if ch.is_pc: - ch.check_improve( "recall", False, 6) + ch.check_improve("recall", False, 6) state_checks.WAIT_STATE(ch, 4) ch.send("You failed!.\n") return lose = 25 if ch.desc else 50 update.gain_exp(ch, 0 - lose) if ch.is_pc: - ch.check_improve( "recall", True, 4) + ch.check_improve("recall", True, 4) ch.send("You recall from combat! You lose %d exps.\n" % lose) fight.stop_fighting(ch, True) ch.move /= 2 @@ -54,5 +55,9 @@ def do_recall(ch, argument): return -interp.register_command(interp.cmd_type("recall", do_recall, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 1)) -interp.register_command(interp.cmd_type("/", do_recall, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 0)) +interp.register_command( + interp.cmd_type("recall", do_recall, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 1) +) +interp.register_command( + interp.cmd_type("/", do_recall, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 0) +) diff --git a/src/rom24/commands/do_recho.py b/src/rom24/commands/do_recho.py index b7192b4..258a4c3 100644 --- a/src/rom24/commands/do_recho.py +++ b/src/rom24/commands/do_recho.py @@ -20,4 +20,6 @@ def do_recho(ch, argument): return -interp.register_command(interp.cmd_type('echo', do_recho, merc.POS_DEAD, merc.L6, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("echo", do_recho, merc.POS_DEAD, merc.L6, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_recite.py b/src/rom24/commands/do_recite.py index 2a9e3aa..675ebf2 100644 --- a/src/rom24/commands/do_recite.py +++ b/src/rom24/commands/do_recite.py @@ -39,15 +39,17 @@ def do_recite(ch, argument): if random.randint(1, 99) >= 20 + ch.get_skill("scrolls") * 4 // 5: ch.send("You mispronounce a syllable.\n") if ch.is_pc: - ch.check_improve( "scrolls", False, 2) + ch.check_improve("scrolls", False, 2) else: handler_magic.obj_cast_spell(scroll.value[1], scroll.value[0], ch, victim, obj) handler_magic.obj_cast_spell(scroll.value[2], scroll.value[0], ch, victim, obj) handler_magic.obj_cast_spell(scroll.value[3], scroll.value[0], ch, victim, obj) if ch.is_pc: - ch.check_improve( "scrolls", True, 2) + ch.check_improve("scrolls", True, 2) scroll.extract() return -interp.register_command(interp.cmd_type('recite', do_recite, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("recite", do_recite, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_reload.py b/src/rom24/commands/do_reload.py index 437bace..dce2c2b 100644 --- a/src/rom24/commands/do_reload.py +++ b/src/rom24/commands/do_reload.py @@ -16,4 +16,6 @@ def do_reload(ch, argument): d.send(f"imp> {ch.name} reloaded files.") -interp.register_command(interp.cmd_type('reload', do_reload, merc.POS_DEAD, merc.ML, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("reload", do_reload, merc.POS_DEAD, merc.ML, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_remove.py b/src/rom24/commands/do_remove.py index ea3c491..e99e03a 100644 --- a/src/rom24/commands/do_remove.py +++ b/src/rom24/commands/do_remove.py @@ -26,4 +26,6 @@ def do_remove(ch, argument): return -interp.register_command(interp.cmd_type('remove', do_remove, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("remove", do_remove, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_rent.py b/src/rom24/commands/do_rent.py index 7d37b5f..e37b583 100644 --- a/src/rom24/commands/do_rent.py +++ b/src/rom24/commands/do_rent.py @@ -11,4 +11,6 @@ def do_rent(ch, argument): return -interp.register_command(interp.cmd_type('rent', do_rent, merc.POS_DEAD, 0, merc.LOG_NORMAL, 0)) +interp.register_command( + interp.cmd_type("rent", do_rent, merc.POS_DEAD, 0, merc.LOG_NORMAL, 0) +) diff --git a/src/rom24/commands/do_replay.py b/src/rom24/commands/do_replay.py index 9e408c7..343539a 100644 --- a/src/rom24/commands/do_replay.py +++ b/src/rom24/commands/do_replay.py @@ -17,4 +17,6 @@ def do_replay(ch, argument): ch.buffer = [] -interp.register_command(interp.cmd_type('replay', do_replay, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("replay", do_replay, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_reply.py b/src/rom24/commands/do_reply.py index 9d3d54a..4c5a71f 100644 --- a/src/rom24/commands/do_reply.py +++ b/src/rom24/commands/do_reply.py @@ -17,7 +17,13 @@ def do_reply(ch, argument): return victim = ch if not victim.desc and not victim.is_npc(): - handler_game.act("$N seems to have misplaced $S link...try again later.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N seems to have misplaced $S link...try again later.", + ch, + None, + victim, + merc.TO_CHAR, + ) buf = "%s tells you '%s'\n" % (state_checks.PERS(ch, victim), argument) victim.buffer.append(buf) return @@ -25,26 +31,50 @@ def do_reply(ch, argument): handler_game.act("$E can't hear you.", ch, 0, victim, merc.TO_CHAR) return - if (victim.comm.is_set(merc.COMM_QUIET) or victim.comm.is_set(merc.COMM_DEAF)) \ - and not ch.is_immortal() and not state_checks.IS_IMMORTAL(victim): - handler_game.act("$E is not receiving tells.", ch, None, victim, merc.TO_CHAR, merc.POS_DEAD) + if ( + (victim.comm.is_set(merc.COMM_QUIET) or victim.comm.is_set(merc.COMM_DEAF)) + and not ch.is_immortal() + and not state_checks.IS_IMMORTAL(victim) + ): + handler_game.act( + "$E is not receiving tells.", ch, None, victim, merc.TO_CHAR, merc.POS_DEAD + ) return if not state_checks.IS_IMMORTAL(victim) and not ch.is_awake(): ch.send("In your dreams, or what?\n") return if victim.comm.is_set(merc.COMM_AFK): if victim.is_npc(): - handler_game.act("$E is AFK, and not receiving tells.", ch, None, victim, merc.TO_CHAR, merc.POS_DEAD) + handler_game.act( + "$E is AFK, and not receiving tells.", + ch, + None, + victim, + merc.TO_CHAR, + merc.POS_DEAD, + ) return - handler_game.act("$E is AFK, but your tell will go through when $E returns.", ch, None, victim, merc.TO_CHAR, - merc.POS_DEAD) + handler_game.act( + "$E is AFK, but your tell will go through when $E returns.", + ch, + None, + victim, + merc.TO_CHAR, + merc.POS_DEAD, + ) buf = "%s tells you '%s'\n" % (state_checks.PERS(ch, victim), argument) victim.buffer.append(buf) return - handler_game.act("You tell $N '$t'", ch, argument, victim, merc.TO_CHAR, merc.POS_DEAD) - handler_game.act("$n tells you '$t'", ch, argument, victim, merc.TO_VICT, merc.POS_DEAD) + handler_game.act( + "You tell $N '$t'", ch, argument, victim, merc.TO_CHAR, merc.POS_DEAD + ) + handler_game.act( + "$n tells you '$t'", ch, argument, victim, merc.TO_VICT, merc.POS_DEAD + ) victim.reply = ch return -interp.register_command(interp.cmd_type('reply', do_reply, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("reply", do_reply, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_report.py b/src/rom24/commands/do_report.py index bb3b5ac..277e08d 100644 --- a/src/rom24/commands/do_report.py +++ b/src/rom24/commands/do_report.py @@ -8,18 +8,23 @@ def do_report(ch, argument): - ch.send("You say 'I have %d/%d hp %d/%d mana %d/%d mv %d xp.'\n" % ( - ch.hit, ch.max_hit, - ch.mana, ch.max_mana, - ch.move, ch.max_move, - ch.exp )) + ch.send( + "You say 'I have %d/%d hp %d/%d mana %d/%d mv %d xp.'\n" + % (ch.hit, ch.max_hit, ch.mana, ch.max_mana, ch.move, ch.max_move, ch.exp) + ) buf = "$n says 'I have %d/%d hp %d/%d mana %d/%d mv %d xp.'" % ( - ch.hit, ch.max_hit, - ch.mana, ch.max_mana, - ch.move, ch.max_move, - ch.exp ) + ch.hit, + ch.max_hit, + ch.mana, + ch.max_mana, + ch.move, + ch.max_move, + ch.exp, + ) handler_game.act(buf, ch, None, None, merc.TO_ROOM) return -interp.register_command(interp.cmd_type('report', do_report, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("report", do_report, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_rescue.py b/src/rom24/commands/do_rescue.py index 0c596a6..7b7cb8e 100644 --- a/src/rom24/commands/do_rescue.py +++ b/src/rom24/commands/do_rescue.py @@ -38,17 +38,17 @@ def do_rescue(ch, argument): if state_checks.IS_NPC(fch) and not ch.is_same_group(victim): ch.send("Kill stealing is not permitted.\n") return - state_checks.WAIT_STATE(ch, const.skill_table['rescue'].beats) - if random.randint(1, 99) > ch.get_skill('rescue'): + state_checks.WAIT_STATE(ch, const.skill_table["rescue"].beats) + if random.randint(1, 99) > ch.get_skill("rescue"): ch.send("You fail the rescue.\n") if ch.is_pc: - ch.check_improve( 'rescue', False, 1) + ch.check_improve("rescue", False, 1) return handler_game.act("You rescue $N!", ch, None, victim, merc.TO_CHAR) handler_game.act("$n rescues you!", ch, None, victim, merc.TO_VICT) handler_game.act("$n rescues $N!", ch, None, victim, merc.TO_NOTVICT) if ch.is_pc: - ch.check_improve( 'rescue', True, 1) + ch.check_improve("rescue", True, 1) fight.stop_fighting(fch, False) fight.stop_fighting(victim, False) @@ -59,4 +59,6 @@ def do_rescue(ch, argument): return -interp.register_command(interp.cmd_type('rescue', do_rescue, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 0)) +interp.register_command( + interp.cmd_type("rescue", do_rescue, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 0) +) diff --git a/src/rom24/commands/do_rest.py b/src/rom24/commands/do_rest.py index 83be0bb..b05ca15 100644 --- a/src/rom24/commands/do_rest.py +++ b/src/rom24/commands/do_rest.py @@ -24,14 +24,22 @@ def do_rest(self, argument): obj = ch.on if obj: - if obj.item_type != merc.ITEM_FURNITURE \ - or (not state_checks.IS_SET(obj.value[2], merc.REST_ON) - and not state_checks.IS_SET(obj.value[2], merc.REST_IN) - and not state_checks.IS_SET(obj.value[2], merc.REST_AT)): + if obj.item_type != merc.ITEM_FURNITURE or ( + not state_checks.IS_SET(obj.value[2], merc.REST_ON) + and not state_checks.IS_SET(obj.value[2], merc.REST_IN) + and not state_checks.IS_SET(obj.value[2], merc.REST_AT) + ): ch.send("You can't rest on that.\n") return if obj and ch.on != obj and obj.count_users() >= obj.value[0]: - handler_game.act("There's no more room on $p.", ch, obj, None, merc.TO_CHAR, merc.POS_DEAD) + handler_game.act( + "There's no more room on $p.", + ch, + obj, + None, + merc.TO_CHAR, + merc.POS_DEAD, + ) return ch.on = obj @@ -41,16 +49,45 @@ def do_rest(self, argument): return if not obj: ch.send("You wake up and start resting.\n") - handler_game.act("$n wakes up and starts resting.", ch, None, None, merc.TO_ROOM) + handler_game.act( + "$n wakes up and starts resting.", ch, None, None, merc.TO_ROOM + ) elif state_checks.IS_SET(obj.value[2], merc.REST_AT): - handler_game.act("You wake up and rest at $p.", ch, obj, None, merc.TO_CHAR, merc.POS_SLEEPING) - handler_game.act("$n wakes up and rests at $p.", ch, obj, None, merc.TO_ROOM) + handler_game.act( + "You wake up and rest at $p.", + ch, + obj, + None, + merc.TO_CHAR, + merc.POS_SLEEPING, + ) + handler_game.act( + "$n wakes up and rests at $p.", ch, obj, None, merc.TO_ROOM + ) elif state_checks.IS_SET(obj.value[2], merc.REST_ON): - handler_game.act("You wake up and rest on $p.", ch, obj, None, merc.TO_CHAR, merc.POS_SLEEPING) - handler_game.act("$n wakes up and rests on $p.", ch, obj, None, merc.TO_ROOM) + handler_game.act( + "You wake up and rest on $p.", + ch, + obj, + None, + merc.TO_CHAR, + merc.POS_SLEEPING, + ) + handler_game.act( + "$n wakes up and rests on $p.", ch, obj, None, merc.TO_ROOM + ) else: - handler_game.act("You wake up and rest in $p.", ch, obj, None, merc.TO_CHAR, merc.POS_SLEEPING) - handler_game.act("$n wakes up and rests in $p.", ch, obj, None, merc.TO_ROOM) + handler_game.act( + "You wake up and rest in $p.", + ch, + obj, + None, + merc.TO_CHAR, + merc.POS_SLEEPING, + ) + handler_game.act( + "$n wakes up and rests in $p.", ch, obj, None, merc.TO_ROOM + ) ch.position = merc.POS_RESTING return elif ch.position == merc.POS_RESTING: @@ -61,8 +98,12 @@ def do_rest(self, argument): ch.send("You rest.\n") handler_game.act("$n sits down and rests.", ch, None, None, merc.TO_ROOM) elif state_checks.IS_SET(obj.value[2], merc.REST_AT): - handler_game.act("You sit down at $p and rest.", ch, obj, None, merc.TO_CHAR) - handler_game.act("$n sits down at $p and rests.", ch, obj, None, merc.TO_ROOM) + handler_game.act( + "You sit down at $p and rest.", ch, obj, None, merc.TO_CHAR + ) + handler_game.act( + "$n sits down at $p and rests.", ch, obj, None, merc.TO_ROOM + ) elif state_checks.IS_SET(obj.value[2], merc.REST_ON): handler_game.act("You sit on $p and rest.", ch, obj, None, merc.TO_CHAR) handler_game.act("$n sits on $p and rests.", ch, obj, None, merc.TO_ROOM) @@ -88,4 +129,6 @@ def do_rest(self, argument): return -interp.register_command(interp.cmd_type('rest', do_rest, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("rest", do_rest, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_restore.py b/src/rom24/commands/do_restore.py index 546969b..0442203 100644 --- a/src/rom24/commands/do_restore.py +++ b/src/rom24/commands/do_restore.py @@ -26,7 +26,14 @@ def do_restore(ch, argument): vch.move = vch.max_move fight.update_pos(vch) handler_game.act("$n has restored you.", ch, None, vch, merc.TO_VICT) - handler_game.wiznet("$N restored room %d." % ch.in_room.vnum, ch, None, merc.WIZ_RESTORE, merc.WIZ_SECURE, ch.trust) + handler_game.wiznet( + "$N restored room %d." % ch.in_room.vnum, + ch, + None, + merc.WIZ_RESTORE, + merc.WIZ_SECURE, + ch.trust, + ) ch.send("Room restored.\n") return if ch.trust >= merc.MAX_LEVEL - 1 and arg == "all": @@ -68,4 +75,6 @@ def do_restore(ch, argument): return -interp.register_command(interp.cmd_type('restore', do_restore, merc.POS_DEAD, merc.L4, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("restore", do_restore, merc.POS_DEAD, merc.L4, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_return.py b/src/rom24/commands/do_return.py index 937ecaa..1ce58c0 100644 --- a/src/rom24/commands/do_return.py +++ b/src/rom24/commands/do_return.py @@ -6,7 +6,7 @@ from rom24 import interp from rom24 import handler_game -#TODO: Known broken. +# TODO: Known broken. def do_return(ch, argument): if not ch.desc: return @@ -15,9 +15,15 @@ def do_return(ch, argument): return ch.send("You return to your original body. Type replay to see any missed tells.\n") if ch.prompt: - ch.prompt = '' - handler_game.wiznet("$N returns from %s." % ch.short_descr, ch.desc.original, 0, merc.WIZ_SWITCHES, merc.WIZ_SECURE, - ch.trust) + ch.prompt = "" + handler_game.wiznet( + "$N returns from %s." % ch.short_descr, + ch.desc.original, + 0, + merc.WIZ_SWITCHES, + merc.WIZ_SECURE, + ch.trust, + ) ch.desc.character = ch.desc.original ch.desc.original = None ch.desc.character.desc = ch.desc @@ -25,4 +31,6 @@ def do_return(ch, argument): return -interp.register_command(interp.cmd_type('return', do_return, merc.POS_DEAD, merc.L6, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("return", do_return, merc.POS_DEAD, merc.L6, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_rstat.py b/src/rom24/commands/do_rstat.py index 71891ff..263e3f6 100644 --- a/src/rom24/commands/do_rstat.py +++ b/src/rom24/commands/do_rstat.py @@ -8,7 +8,7 @@ from rom24 import state_checks from rom24 import instance -#TODO: Known broken. Exit flags or locks are messed up. +# TODO: Known broken. Exit flags or locks are messed up. def do_rstat(ch, argument): argument, arg = game_utils.read_word(argument) location = ch.in_room if not arg else game_utils.find_location(ch, arg) @@ -16,18 +16,29 @@ def do_rstat(ch, argument): ch.send("No such location.\n") return - if not ch.is_room_owner(location) and ch.in_room != location \ - and location.is_private() and not state_checks.IS_TRUSTED(ch, merc.MAX_LEVEL): + if ( + not ch.is_room_owner(location) + and ch.in_room != location + and location.is_private() + and not state_checks.IS_TRUSTED(ch, merc.MAX_LEVEL) + ): ch.send("That room is private right now.\n") return ch.send("Name: '%s'\nArea: '%s'\n" % (location.name, location.area)) - ch.send("Vnum: %d Sector: %d Light: %d Healing: %d Mana: %d\n" % ( - location.vnum, - location.sector_type, - location.available_light, - location.heal_rate, - location.mana_rate)) - ch.send("Room flags: %d.\nDescription:\n%s" % (location.room_flags, location.description)) + ch.send( + "Vnum: %d Sector: %d Light: %d Healing: %d Mana: %d\n" + % ( + location.vnum, + location.sector_type, + location.available_light, + location.heal_rate, + location.mana_rate, + ) + ) + ch.send( + "Room flags: %d.\nDescription:\n%s" + % (location.room_flags, location.description) + ) if location.extra_descr: ch.send("Extra description keywords: '") [ch.send(ed.keyword + " ") for ed in location.extra_descr] @@ -45,14 +56,20 @@ def do_rstat(ch, argument): ch.send(".\n") for door, pexit in enumerate(location.exit): if pexit: - ch.send("Door: %d. To: %d. Key: %d. Exit flags: %d.\nKeyword: '%s'. Description: %s" % ( - door, # TODO: come back and fix this - -1 if pexit.to_room is None else instance.rooms[pexit.to_room].vnum, - -1 if pexit.key is None else pexit.key, - pexit.exit_info, - pexit.keyword, - pexit.description if pexit.description else "(none).\n" )) + ch.send( + "Door: %d. To: %d. Key: %d. Exit flags: %d.\nKeyword: '%s'. Description: %s" + % ( + door, # TODO: come back and fix this + -1 if pexit.to_room is None else instance.rooms[pexit.to_room].vnum, + -1 if pexit.key is None else pexit.key, + pexit.exit_info, + pexit.keyword, + pexit.description if pexit.description else "(none).\n", + ) + ) return -interp.register_command(interp.cmd_type('rstat', do_rstat, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("rstat", do_rstat, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_sacrifice.py b/src/rom24/commands/do_sacrifice.py index b2b716c..8d48bab 100644 --- a/src/rom24/commands/do_sacrifice.py +++ b/src/rom24/commands/do_sacrifice.py @@ -9,11 +9,18 @@ from rom24 import handler_game from rom24 import instance + def do_sacrifice(ch, argument): argument, arg = game_utils.read_word(argument) if not arg or arg == ch.name.lower(): - handler_game.act("$n offers $mself to Mota, who graciously declines.", ch, None, None, merc.TO_ROOM) + handler_game.act( + "$n offers $mself to Mota, who graciously declines.", + ch, + None, + None, + merc.TO_ROOM, + ) ch.send("Mota appreciates your offer and may accept it later.\n") return item = ch.get_item_list(arg, ch.in_room.items) @@ -25,13 +32,17 @@ def do_sacrifice(ch, argument): ch.send("Mota wouldn't like that.\n") return if not item.flags.take or item.flags.no_sac: - handler_game.act("$p is not an acceptable sacrifice.", ch, item, 0, merc.TO_CHAR) + handler_game.act( + "$p is not an acceptable sacrifice.", ch, item, 0, merc.TO_CHAR + ) return if item.in_room: for gch_id in item.in_room.people: gch = instance.characters[gch_id] if gch.on == item.instance_id: - handler_game.act("$N appears to be using $p.", ch, item, gch, merc.TO_CHAR) + handler_game.act( + "$N appears to be using $p.", ch, item, gch, merc.TO_CHAR + ) return silver = max(1, item.level * 3) @@ -49,12 +60,20 @@ def do_sacrifice(ch, argument): if members > 1 and silver > 1: ch.do_split("%d" % silver) handler_game.act("$n sacrifices $p to Mota.", ch, item, None, merc.TO_ROOM) - handler_game.wiznet("$N sends up $p as a burnt offering.", ch, item, merc.WIZ_SACCING, 0, 0) + handler_game.wiznet( + "$N sends up $p as a burnt offering.", ch, item, merc.WIZ_SACCING, 0, 0 + ) ch.in_room.get(item) item.extract() return -interp.register_command(interp.cmd_type('sacrifice', do_sacrifice, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) -interp.register_command(interp.cmd_type('junk', do_sacrifice, merc.POS_RESTING, 0, merc.LOG_NORMAL, 0)) -interp.register_command(interp.cmd_type('tap', do_sacrifice, merc.POS_RESTING, 0, merc.LOG_NORMAL, 0)) +interp.register_command( + interp.cmd_type("sacrifice", do_sacrifice, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) +interp.register_command( + interp.cmd_type("junk", do_sacrifice, merc.POS_RESTING, 0, merc.LOG_NORMAL, 0) +) +interp.register_command( + interp.cmd_type("tap", do_sacrifice, merc.POS_RESTING, 0, merc.LOG_NORMAL, 0) +) diff --git a/src/rom24/commands/do_save.py b/src/rom24/commands/do_save.py index 50a149d..567e61e 100644 --- a/src/rom24/commands/do_save.py +++ b/src/rom24/commands/do_save.py @@ -11,10 +11,12 @@ def do_save(ch, argument): if ch.is_npc(): return ch.save() - #save.legacy_save_char_obj(ch) + # save.legacy_save_char_obj(ch) ch.send("Saving. Remember that ROM has automatic saving now.\n") state_checks.WAIT_STATE(ch, 4 * merc.PULSE_VIOLENCE) return -interp.cmd_table['save'] = interp.cmd_type('save', do_save, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +interp.cmd_table["save"] = interp.cmd_type( + "save", do_save, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1 +) diff --git a/src/rom24/commands/do_say.py b/src/rom24/commands/do_say.py index a2162dd..11d17b4 100644 --- a/src/rom24/commands/do_say.py +++ b/src/rom24/commands/do_say.py @@ -7,6 +7,7 @@ from rom24 import pyprogs from rom24.handler_game import act + def do_say(ch, argument): if not argument: ch.send("Say what?\n") @@ -14,9 +15,13 @@ def do_say(ch, argument): act("$n says '$T'", ch, None, argument, merc.TO_ROOM) act("You say '$T'", ch, None, argument, merc.TO_CHAR) - pyprogs.emit_signal('say', actor=ch, argument=argument, audience=ch.in_room.people) + pyprogs.emit_signal("say", actor=ch, argument=argument, audience=ch.in_room.people) return -interp.register_command(interp.cmd_type('say', do_say, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) -interp.register_command(interp.cmd_type("'", do_say, merc.POS_RESTING, 0, merc.LOG_NORMAL, 0)) +interp.register_command( + interp.cmd_type("say", do_say, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) +interp.register_command( + interp.cmd_type("'", do_say, merc.POS_RESTING, 0, merc.LOG_NORMAL, 0) +) diff --git a/src/rom24/commands/do_scan.py b/src/rom24/commands/do_scan.py index b310673..fb6a10a 100644 --- a/src/rom24/commands/do_scan.py +++ b/src/rom24/commands/do_scan.py @@ -10,7 +10,12 @@ from rom24 import state_checks -distance = ["right here.", "nearby to the %s.", "not far %s.", "off in the distance %s."] +distance = [ + "right here.", + "nearby to the %s.", + "not far %s.", + "off in the distance %s.", +] # Thanks to Zrin for auto-exit part. def do_scan(ch, argument): @@ -43,12 +48,16 @@ def do_scan(ch, argument): ch.send("Which way do you want to scan?\n") return - handler_game.act("You peer intently $T.", ch, None, merc.dir_name[door], merc.TO_CHAR) - handler_game.act("$n peers intently $T.", ch, None, merc.dir_name[door], merc.TO_ROOM) + handler_game.act( + "You peer intently $T.", ch, None, merc.dir_name[door], merc.TO_CHAR + ) + handler_game.act( + "$n peers intently $T.", ch, None, merc.dir_name[door], merc.TO_ROOM + ) scan_room = ch.in_room - for depth in range(1,4): + for depth in range(1, 4): pexit = scan_room.exit[door] if pexit: scan_room = instance.rooms[pexit.to_room] @@ -56,17 +65,22 @@ def do_scan(ch, argument): return + def scan_list(scan_room, ch, depth, door): if not scan_room: return for person_id in scan_room.people: person = instance.characters[person_id] - if person == ch: continue - if person.is_pc and person.invis_level > ch.trust: continue - if ch.can_see(person): scan_ch(person, ch, depth, door) + if person == ch: + continue + if person.is_pc and person.invis_level > ch.trust: + continue + if ch.can_see(person): + scan_ch(person, ch, depth, door) return + def scan_ch(victim, ch, depth, door): buf = state_checks.PERS(victim, ch) buf = buf + ", " @@ -78,4 +92,7 @@ def scan_ch(victim, ch, depth, door): ch.send(buf) return -interp.register_command(interp.cmd_type('scan', do_scan, merc.POS_STANDING, 0, merc.LOG_NORMAL, 1)) \ No newline at end of file + +interp.register_command( + interp.cmd_type("scan", do_scan, merc.POS_STANDING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_score.py b/src/rom24/commands/do_score.py index a4e1af4..9db321f 100644 --- a/src/rom24/commands/do_score.py +++ b/src/rom24/commands/do_score.py @@ -9,32 +9,69 @@ def do_score(ch, argument): - ch.send("You are %s%s, level %d, %d years old (%d hours).\n" % (ch.name, "" if ch.is_npc() else ch.title, - ch.level, ch.get_age(), ( - ch.played + (int)(time.time() - ch.logon)) // 3600)) + ch.send( + "You are %s%s, level %d, %d years old (%d hours).\n" + % ( + ch.name, + "" if ch.is_npc() else ch.title, + ch.level, + ch.get_age(), + (ch.played + (int)(time.time() - ch.logon)) // 3600, + ) + ) if ch.trust != ch.level: ch.send("You are trusted at level %d.\n" % ch.trust) - ch.send("Race: %s Sex: %s Class: %s\n" % ( - ch.race.name, "sexless" if ch.sex == 0 else "male" if ch.sex == 1 else "female", - "mobile" if ch.is_npc() else ch.guild.name)) - ch.send("You have %d/%d hit, %d/%d mana, %d/%d movement.\n" % (ch.hit, ch.max_hit, - ch.mana, ch.max_mana, ch.move, ch.max_move)) - ch.send("You have %d practices and %d training sessions.\n" % (ch.practice, ch.train)) - ch.send("You are carrying %d/%d items with weight %ld/%d pounds.\n" % (ch.carry_number, ch.can_carry_n(), - state_checks.get_carry_weight(ch) // 10, - ch.can_carry_w() // 10)) - ch.send("Str: %d(%d) Int: %d(%d) Wis: %d(%d) Dex: %d(%d) Con: %d(%d)\n" % ( - ch.perm_stat[merc.STAT_STR], ch.stat(merc.STAT_STR), - ch.perm_stat[merc.STAT_INT], ch.stat(merc.STAT_INT), - ch.perm_stat[merc.STAT_WIS], ch.stat(merc.STAT_WIS), - ch.perm_stat[merc.STAT_DEX], ch.stat(merc.STAT_DEX), - ch.perm_stat[merc.STAT_CON], ch.stat(merc.STAT_CON))) + ch.send( + "Race: %s Sex: %s Class: %s\n" + % ( + ch.race.name, + "sexless" if ch.sex == 0 else "male" if ch.sex == 1 else "female", + "mobile" if ch.is_npc() else ch.guild.name, + ) + ) + ch.send( + "You have %d/%d hit, %d/%d mana, %d/%d movement.\n" + % (ch.hit, ch.max_hit, ch.mana, ch.max_mana, ch.move, ch.max_move) + ) + ch.send( + "You have %d practices and %d training sessions.\n" % (ch.practice, ch.train) + ) + ch.send( + "You are carrying %d/%d items with weight %ld/%d pounds.\n" + % ( + ch.carry_number, + ch.can_carry_n(), + state_checks.get_carry_weight(ch) // 10, + ch.can_carry_w() // 10, + ) + ) + ch.send( + "Str: %d(%d) Int: %d(%d) Wis: %d(%d) Dex: %d(%d) Con: %d(%d)\n" + % ( + ch.perm_stat[merc.STAT_STR], + ch.stat(merc.STAT_STR), + ch.perm_stat[merc.STAT_INT], + ch.stat(merc.STAT_INT), + ch.perm_stat[merc.STAT_WIS], + ch.stat(merc.STAT_WIS), + ch.perm_stat[merc.STAT_DEX], + ch.stat(merc.STAT_DEX), + ch.perm_stat[merc.STAT_CON], + ch.stat(merc.STAT_CON), + ) + ) - ch.send("You have scored %d exp, and have %ld gold and %ld silver coins.\n" % (ch.exp, ch.gold, ch.silver)) + ch.send( + "You have scored %d exp, and have %ld gold and %ld silver coins.\n" + % (ch.exp, ch.gold, ch.silver) + ) # RT shows exp to level if not ch.is_npc() and ch.level < merc.LEVEL_HERO: - ch.send("You need %d exp to level.\n" % ((ch.level + 1) * ch.exp_per_level(ch.points) - ch.exp)) + ch.send( + "You need %d exp to level.\n" + % ((ch.level + 1) * ch.exp_per_level(ch.points) - ch.exp) + ) ch.send("Wimpy set to %d hit points.\n" % ch.wimpy) if not ch.is_npc() and ch.condition[merc.COND_DRUNK] > 10: ch.send("You are drunk.\n") @@ -63,13 +100,17 @@ def do_score(ch, argument): ch.send("You are fighting.\n") # print AC values if ch.level >= 25: - ch.send("Armor: pierce: %d bash: %d slash: %d magic: %d\n" % ( - state_checks.GET_AC(ch, merc.AC_PIERCE), - state_checks.GET_AC(ch, merc.AC_BASH), - state_checks.GET_AC(ch, merc.AC_SLASH), - state_checks.GET_AC(ch, merc.AC_EXOTIC))) + ch.send( + "Armor: pierce: %d bash: %d slash: %d magic: %d\n" + % ( + state_checks.GET_AC(ch, merc.AC_PIERCE), + state_checks.GET_AC(ch, merc.AC_BASH), + state_checks.GET_AC(ch, merc.AC_SLASH), + state_checks.GET_AC(ch, merc.AC_EXOTIC), + ) + ) for i in range(4): - temp = '' + temp = "" if i == merc.AC_PIERCE: temp = "piercing" elif i == merc.AC_BASH: @@ -122,7 +163,10 @@ def do_score(ch, argument): ch.send("\n") if ch.level >= 15: - ch.send("Hitroll: %d Damroll: %d.\n" % (state_checks.GET_HITROLL(ch), state_checks.GET_DAMROLL(ch))) + ch.send( + "Hitroll: %d Damroll: %d.\n" + % (state_checks.GET_HITROLL(ch), state_checks.GET_DAMROLL(ch)) + ) if ch.level >= 10: ch.send("Alignment: %d. " % ch.alignment) ch.send("You are ") @@ -149,4 +193,6 @@ def do_score(ch, argument): ch.do_affects("") -interp.register_command(interp.cmd_type('score', do_score, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("score", do_score, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_scroll.py b/src/rom24/commands/do_scroll.py index dcc0c36..f574a75 100644 --- a/src/rom24/commands/do_scroll.py +++ b/src/rom24/commands/do_scroll.py @@ -7,15 +7,14 @@ from rom24 import interp from rom24 import game_utils -#TODO: Known broken. Not this command, but the paging itself. +# TODO: Known broken. Not this command, but the paging itself. def do_scroll(ch, argument): argument, arg = game_utils.read_word(argument) if not arg: if ch.lines == 0: ch.send("You do not page long messages.\n") else: - ch.send("You currently display %d lines per page.\n" % ( - ch.lines + 2)) + ch.send("You currently display %d lines per page.\n" % (ch.lines + 2)) return if not arg.isdigit(): ch.send("You must provide a number.\n") @@ -32,4 +31,6 @@ def do_scroll(ch, argument): ch.lines = lines - 2 -interp.register_command(interp.cmd_type('scroll', do_scroll, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("scroll", do_scroll, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_sell.py b/src/rom24/commands/do_sell.py index 51c67fe..20c43e8 100644 --- a/src/rom24/commands/do_sell.py +++ b/src/rom24/commands/do_sell.py @@ -20,22 +20,31 @@ def do_sell(ch, argument): return item = ch.get_item_carry(arg, ch) if not item: - handler_game.act("$n tells you 'You don't have that item'.", keeper, None, ch, merc.TO_VICT) + handler_game.act( + "$n tells you 'You don't have that item'.", keeper, None, ch, merc.TO_VICT + ) ch.reply = keeper return if not ch.can_drop_item(item): ch.send("You can't let go of it.\n") return if not keeper.can_see_item(item): - handler_game.act("$n doesn't see what you are offering.", keeper, None, ch, merc.TO_VICT) + handler_game.act( + "$n doesn't see what you are offering.", keeper, None, ch, merc.TO_VICT + ) return cost = shop_utils.get_cost(keeper, item, False) if cost <= 0: handler_game.act("$n looks uninterested in $p.", keeper, item, ch, merc.TO_VICT) return if cost > (keeper.silver + 100 * keeper.gold): - handler_game.act("$n tells you 'I'm afraid I don't have enough wealth to buy $p.", keeper, item, ch, - merc.TO_VICT) + handler_game.act( + "$n tells you 'I'm afraid I don't have enough wealth to buy $p.", + keeper, + item, + ch, + merc.TO_VICT, + ) return handler_game.act("$n sells $p.", ch, item, None, merc.TO_ROOM) # haggle @@ -46,9 +55,15 @@ def do_sell(ch, argument): cost = min(cost, 95 * shop_utils.get_cost(keeper, item, True) // 100) cost = min(cost, (keeper.silver + 100 * keeper.gold)) if ch.is_pc: - ch.check_improve( "haggle", True, 4) - handler_game.act("You sell $p for %d silver and %d gold piece%s." % ( - cost - (cost // 100) * 100, cost // 100, ("" if cost == 1 else "s")), ch, item, None, merc.TO_CHAR) + ch.check_improve("haggle", True, 4) + handler_game.act( + "You sell $p for %d silver and %d gold piece%s." + % (cost - (cost // 100) * 100, cost // 100, ("" if cost == 1 else "s")), + ch, + item, + None, + merc.TO_CHAR, + ) ch.gold += cost // 100 ch.silver += cost - (cost // 100) * 100 @@ -69,4 +84,6 @@ def do_sell(ch, argument): return -interp.register_command(interp.cmd_type('sell', do_sell, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("sell", do_sell, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_set.py b/src/rom24/commands/do_set.py index 3de0844..d1128b0 100644 --- a/src/rom24/commands/do_set.py +++ b/src/rom24/commands/do_set.py @@ -34,4 +34,6 @@ def do_set(ch, argument): ch.do_set("") -interp.register_command(interp.cmd_type('set', do_set, merc.POS_DEAD, merc.L2, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("set", do_set, merc.POS_DEAD, merc.L2, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_shout.py b/src/rom24/commands/do_shout.py index 7026fa4..adc960f 100644 --- a/src/rom24/commands/do_shout.py +++ b/src/rom24/commands/do_shout.py @@ -10,6 +10,7 @@ from rom24 import handler_game from rom24 import state_checks + def do_shout(ch, argument): if not argument: if ch.comm.is_set(merc.COMM_SHOUTSOFF): @@ -27,10 +28,15 @@ def do_shout(ch, argument): handler_game.act("You shout '$T'", ch, None, argument, merc.TO_CHAR) for d in merc.descriptor_list: victim = handler_ch.CH(d) - if d.is_connected(nanny.con_playing) and d.character != ch \ - and not victim.comm.is_set(merc.COMM_SHOUTSOFF) and not state_checks.IS_SET(victim.comm, - merc.COMM_QUIET): + if ( + d.is_connected(nanny.con_playing) + and d.character != ch + and not victim.comm.is_set(merc.COMM_SHOUTSOFF) + and not state_checks.IS_SET(victim.comm, merc.COMM_QUIET) + ): handler_game.act("$n shouts '$t'", ch, argument, d.character, merc.TO_VICT) -interp.register_command(interp.cmd_type('shout', do_shout, merc.POS_RESTING, 3, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("shout", do_shout, merc.POS_RESTING, 3, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_show.py b/src/rom24/commands/do_show.py index ed4ee0c..68395ae 100644 --- a/src/rom24/commands/do_show.py +++ b/src/rom24/commands/do_show.py @@ -15,4 +15,6 @@ def do_show(ch, argument): ch.comm.set_bit(merc.COMM_SHOW_AFFECTS) -interp.register_command(interp.cmd_type('show', do_show, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("show", do_show, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_shutdown.py b/src/rom24/commands/do_shutdown.py index a181713..486d0a6 100644 --- a/src/rom24/commands/do_shutdown.py +++ b/src/rom24/commands/do_shutdown.py @@ -24,5 +24,9 @@ def do_shutdow(ch, argument): return -interp.register_command(interp.cmd_type('shutdown', do_shutdown, merc.POS_DEAD, merc.L1, merc.LOG_ALWAYS, 1)) -interp.register_command(interp.cmd_type('shutdow', do_shutdow, merc.POS_DEAD, merc.L1, merc.LOG_NORMAL, 0)) +interp.register_command( + interp.cmd_type("shutdown", do_shutdown, merc.POS_DEAD, merc.L1, merc.LOG_ALWAYS, 1) +) +interp.register_command( + interp.cmd_type("shutdow", do_shutdow, merc.POS_DEAD, merc.L1, merc.LOG_NORMAL, 0) +) diff --git a/src/rom24/commands/do_sit.py b/src/rom24/commands/do_sit.py index fe27240..fbd6a64 100644 --- a/src/rom24/commands/do_sit.py +++ b/src/rom24/commands/do_sit.py @@ -7,6 +7,7 @@ from rom24 import merc from rom24 import state_checks + def do_sit(ch, argument): obj = None if ch.position == merc.POS_FIGHTING: @@ -23,13 +24,21 @@ def do_sit(ch, argument): if obj: if obj.item_type != merc.ITEM_FURNITURE or ( - not state_checks.IS_SET(obj.value[2], merc.SIT_ON) - and not state_checks.IS_SET(obj.value[2], merc.SIT_IN) - and not state_checks.IS_SET(obj.value[2], merc.SIT_AT)): + not state_checks.IS_SET(obj.value[2], merc.SIT_ON) + and not state_checks.IS_SET(obj.value[2], merc.SIT_IN) + and not state_checks.IS_SET(obj.value[2], merc.SIT_AT) + ): ch.send("You can't sit on that.\n") return if ch.on != obj and obj.count_users() >= obj.value[0]: - handler_game.act("There's no more room on $p.", ch, obj, None, merc.TO_CHAR, merc.POS_DEAD) + handler_game.act( + "There's no more room on $p.", + ch, + obj, + None, + merc.TO_CHAR, + merc.POS_DEAD, + ) return ch.on = obj @@ -42,13 +51,19 @@ def do_sit(ch, argument): ch.send("You wake and sit up.\n") handler_game.act("$n wakes and sits up.", ch, None, None, merc.TO_ROOM) elif state_checks.IS_SET(obj.value[2], merc.SIT_AT): - handler_game.act("You wake and sit at $p.", ch, obj, None, merc.TO_CHAR, merc.POS_DEAD) + handler_game.act( + "You wake and sit at $p.", ch, obj, None, merc.TO_CHAR, merc.POS_DEAD + ) handler_game.act("$n wakes and sits at $p.", ch, obj, None, merc.TO_ROOM) elif state_checks.IS_SET(obj.value[2], merc.SIT_ON): - handler_game.act("You wake and sit on $p.", ch, obj, None, merc.TO_CHAR, merc.POS_DEAD) + handler_game.act( + "You wake and sit on $p.", ch, obj, None, merc.TO_CHAR, merc.POS_DEAD + ) handler_game.act("$n wakes and sits at $p.", ch, obj, None, merc.TO_ROOM) else: - handler_game.act("You wake and sit in $p.", ch, obj, None, merc.TO_CHAR, merc.POS_DEAD) + handler_game.act( + "You wake and sit in $p.", ch, obj, None, merc.TO_CHAR, merc.POS_DEAD + ) handler_game.act("$n wakes and sits in $p.", ch, obj, None, merc.TO_ROOM) ch.position = merc.POS_SITTING return @@ -69,7 +84,9 @@ def do_sit(ch, argument): elif ch.position == merc.POS_STANDING: if obj is None: ch.send("You sit down.\n") - handler_game.act("$n sits down on the ground.", ch, None, None, merc.TO_ROOM) + handler_game.act( + "$n sits down on the ground.", ch, None, None, merc.TO_ROOM + ) elif state_checks.IS_SET(obj.value[2], merc.SIT_AT): handler_game.act("You sit down at $p.", ch, obj, None, merc.TO_CHAR) handler_game.act("$n sits down at $p.", ch, obj, None, merc.TO_ROOM) @@ -82,4 +99,6 @@ def do_sit(ch, argument): ch.position = merc.POS_SITTING -interp.register_command(interp.cmd_type('sit', do_sit, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("sit", do_sit, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_skills.py b/src/rom24/commands/do_skills.py index 539347c..0bed420 100644 --- a/src/rom24/commands/do_skills.py +++ b/src/rom24/commands/do_skills.py @@ -56,11 +56,14 @@ def do_skills(ch, argument): for sn, skill in const.skill_table.items(): level = skill.skill_level[ch.guild.name] - if level < merc.LEVEL_HERO + 1 \ - and (fAll or level <= ch.level) \ - and level >= min_lev and level <= max_lev \ - and skill.spell_fun is None \ - and sn in ch.learned: + if ( + level < merc.LEVEL_HERO + 1 + and (fAll or level <= ch.level) + and level >= min_lev + and level <= max_lev + and skill.spell_fun is None + and sn in ch.learned + ): found = True level = skill.skill_level[ch.guild.name] if ch.level < level: @@ -87,4 +90,6 @@ def do_skills(ch, argument): ch.send("\n") -interp.register_command(interp.cmd_type('skills', do_skills, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("skills", do_skills, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_slay.py b/src/rom24/commands/do_slay.py index 5ab6b03..936a9ba 100644 --- a/src/rom24/commands/do_slay.py +++ b/src/rom24/commands/do_slay.py @@ -36,5 +36,9 @@ def do_sla(ch, argument): return -interp.register_command(interp.cmd_type('slay', do_slay, merc.POS_DEAD, merc.L3, merc.LOG_ALWAYS, 1)) -interp.register_command(interp.cmd_type('sla', do_sla, merc.POS_DEAD, merc.L3, merc.LOG_NORMAL, 0)) +interp.register_command( + interp.cmd_type("slay", do_slay, merc.POS_DEAD, merc.L3, merc.LOG_ALWAYS, 1) +) +interp.register_command( + interp.cmd_type("sla", do_sla, merc.POS_DEAD, merc.L3, merc.LOG_NORMAL, 0) +) diff --git a/src/rom24/commands/do_sleep.py b/src/rom24/commands/do_sleep.py index 0fa1374..ccd9836 100644 --- a/src/rom24/commands/do_sleep.py +++ b/src/rom24/commands/do_sleep.py @@ -13,9 +13,11 @@ def do_sleep(ch, argument): if ch.position == merc.POS_SLEEPING: ch.send("You are already sleeping.\n") return - elif ch.position == merc.POS_RESTING \ - or ch.position == merc.POS_SITTING \ - or ch.position == merc.POS_STANDING: + elif ( + ch.position == merc.POS_RESTING + or ch.position == merc.POS_SITTING + or ch.position == merc.POS_STANDING + ): if not argument and not ch.on: ch.send("You go to sleep.\n") handler_game.act("$n goes to sleep.", ch, None, None, merc.TO_ROOM) @@ -30,13 +32,21 @@ def do_sleep(ch, argument): ch.send("You don't see that here.\n") return if obj.item_type != merc.ITEM_FURNITURE or ( - not state_checks.IS_SET(obj.value[2], merc.SLEEP_ON) - and not state_checks.IS_SET(obj.value[2], merc.SLEEP_IN) - and not state_checks.IS_SET(obj.value[2], merc.SLEEP_AT)): + not state_checks.IS_SET(obj.value[2], merc.SLEEP_ON) + and not state_checks.IS_SET(obj.value[2], merc.SLEEP_IN) + and not state_checks.IS_SET(obj.value[2], merc.SLEEP_AT) + ): ch.send("You can't sleep on that!\n") return if ch.on != obj and obj.count_users() >= obj.value[0]: - handler_game.act("There is no room on $p for you.", ch, obj, None, merc.TO_CHAR, merc.POS_DEAD) + handler_game.act( + "There is no room on $p for you.", + ch, + obj, + None, + merc.TO_CHAR, + merc.POS_DEAD, + ) return ch.on = obj if state_checks.IS_SET(obj.value[2], merc.SLEEP_AT): @@ -55,4 +65,6 @@ def do_sleep(ch, argument): return -interp.register_command(interp.cmd_type('sleep', do_sleep, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("sleep", do_sleep, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_slookup.py b/src/rom24/commands/do_slookup.py index adf0f37..3ee2b2d 100644 --- a/src/rom24/commands/do_slookup.py +++ b/src/rom24/commands/do_slookup.py @@ -16,14 +16,22 @@ def do_slookup(ch, argument): return if arg == "all": for sn, skill in const.skill_table.items(): - ch.send("Sn: %15s Slot: %3d Skill/spell: '%s'\n" % (sn, skill.slot, skill.name)) + ch.send( + "Sn: %15s Slot: %3d Skill/spell: '%s'\n" + % (sn, skill.slot, skill.name) + ) else: skill = state_checks.prefix_lookup(const.skill_table, arg) if not skill: ch.send("No such skill or spell.\n") return - ch.send("Sn: %15s Slot: %3d Skill/spell: '%s'\n" % (skill.name, skill.slot, skill.name)) + ch.send( + "Sn: %15s Slot: %3d Skill/spell: '%s'\n" + % (skill.name, skill.slot, skill.name) + ) -interp.register_command(interp.cmd_type('slookup', do_slookup, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("slookup", do_slookup, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_smote.py b/src/rom24/commands/do_smote.py index feb287b..b4d3084 100644 --- a/src/rom24/commands/do_smote.py +++ b/src/rom24/commands/do_smote.py @@ -26,9 +26,11 @@ def do_smote(ch, argument): if vch.name not in argument: vch.send(argument + "\n") continue - buf = game_utils.mass_replace({"%s's" % vch.name: 'your', vch.name: 'you'}) + buf = game_utils.mass_replace({"%s's" % vch.name: "your", vch.name: "you"}) vch.send(buf + "\n") return -interp.register_command(interp.cmd_type('smote', do_smote, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("smote", do_smote, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_sneak.py b/src/rom24/commands/do_sneak.py index e218d42..0bec826 100644 --- a/src/rom24/commands/do_sneak.py +++ b/src/rom24/commands/do_sneak.py @@ -18,7 +18,7 @@ def do_sneak(ch, argument): if random.randint(1, 99) < ch.get_skill("sneak"): if ch.is_pc: - ch.check_improve( "sneak", True, 3) + ch.check_improve("sneak", True, 3) af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS af.type = "sneak" @@ -30,8 +30,10 @@ def do_sneak(ch, argument): ch.affect_add(af) else: if ch.is_pc: - ch.check_improve( "sneak", False, 3) + ch.check_improve("sneak", False, 3) return -interp.register_command(interp.cmd_type('sneak', do_sneak, merc.POS_STANDING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("sneak", do_sneak, merc.POS_STANDING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_snoop.py b/src/rom24/commands/do_snoop.py index 852d1fd..5a66fc3 100644 --- a/src/rom24/commands/do_snoop.py +++ b/src/rom24/commands/do_snoop.py @@ -23,7 +23,14 @@ def do_snoop(ch, argument): return if victim == ch: ch.send("Cancelling all snoops.\n") - handler_game.wiznet("$N stops being such a snoop.", ch, None, merc.WIZ_SNOOPS, merc.WIZ_SECURE, ch.trust) + handler_game.wiznet( + "$N stops being such a snoop.", + ch, + None, + merc.WIZ_SNOOPS, + merc.WIZ_SECURE, + ch.trust, + ) for d in merc.descriptor_list: if d.snoop_by == ch.desc: d.snoop_by = None @@ -31,8 +38,12 @@ def do_snoop(ch, argument): if victim.desc.snoop_by: ch.send("Busy already.\n") return - if not ch.is_room_owner(victim.in_room) and ch.in_room != victim.in_room \ - and victim.in_room.is_private() and not state_checks.IS_TRUSTED(ch, merc.MAX_LEVEL): + if ( + not ch.is_room_owner(victim.in_room) + and ch.in_room != victim.in_room + and victim.in_room.is_private() + and not state_checks.IS_TRUSTED(ch, merc.MAX_LEVEL) + ): ch.send("That character is in a private room.\n") return if victim.trust >= ch.trust or victim.comm.is_set(merc.COMM_SNOOP_PROOF): @@ -46,10 +57,14 @@ def do_snoop(ch, argument): return d = d.snoop_by victim.desc.snoop_by = ch.desc - buf = "$N starts snooping on %s" % (victim.short_descr if ch.is_npc() else victim.name) + buf = "$N starts snooping on %s" % ( + victim.short_descr if ch.is_npc() else victim.name + ) handler_game.wiznet(buf, ch, None, merc.WIZ_SNOOPS, merc.WIZ_SECURE, ch.trust) ch.send("Ok.\n") return -interp.register_command(interp.cmd_type('snoop', do_snoop, merc.POS_DEAD, merc.L5, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("snoop", do_snoop, merc.POS_DEAD, merc.L5, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_socials.py b/src/rom24/commands/do_socials.py index 50a6515..d411b26 100644 --- a/src/rom24/commands/do_socials.py +++ b/src/rom24/commands/do_socials.py @@ -17,4 +17,6 @@ def do_socials(ch, argument): return -interp.register_command(interp.cmd_type('socials', do_socials, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("socials", do_socials, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_sockets.py b/src/rom24/commands/do_sockets.py index 5012aaf..07e7955 100644 --- a/src/rom24/commands/do_sockets.py +++ b/src/rom24/commands/do_sockets.py @@ -6,22 +6,36 @@ from rom24 import interp from rom24 import game_utils + def do_sockets(ch, argument): count = 0 argument, arg = game_utils.read_word(argument) for d in merc.descriptor_list: - if d.character and ch.can_see(d.character) \ - and (not arg or arg not in d.character.name) \ - or (d.original and game_utils.is_name(arg, d.original.name)): + if ( + d.character + and ch.can_see(d.character) + and (not arg or arg not in d.character.name) + or (d.original and game_utils.is_name(arg, d.original.name)) + ): count += 1 - ch.send("%s@%s\n" % ( - d.original.name if d.original else d.character.name if d.character else "(none)", - d.address)) + ch.send( + "%s@%s\n" + % ( + d.original.name + if d.original + else d.character.name + if d.character + else "(none)", + d.address, + ) + ) if count == 0: ch.send("No one by that name is connected.\n") return - ch.send("%d user%s\n" % (count, "" if count == 1 else "s" )) + ch.send("%d user%s\n" % (count, "" if count == 1 else "s")) return -interp.register_command(interp.cmd_type('sockets', do_sockets, merc.POS_DEAD, merc.L4, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("sockets", do_sockets, merc.POS_DEAD, merc.L4, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_south.py b/src/rom24/commands/do_south.py index fd954fb..a752795 100644 --- a/src/rom24/commands/do_south.py +++ b/src/rom24/commands/do_south.py @@ -12,4 +12,6 @@ def do_south(ch, argument): return -interp.register_command(interp.cmd_type('south', do_south, merc.POS_STANDING, 0, merc.LOG_NEVER, 0)) +interp.register_command( + interp.cmd_type("south", do_south, merc.POS_STANDING, 0, merc.LOG_NEVER, 0) +) diff --git a/src/rom24/commands/do_spells.py b/src/rom24/commands/do_spells.py index e625bcb..f85e0af 100644 --- a/src/rom24/commands/do_spells.py +++ b/src/rom24/commands/do_spells.py @@ -53,11 +53,14 @@ def do_spells(ch, argument): spell_column = {} for sn, skill in const.skill_table.items(): level = skill.skill_level[ch.guild.name] - if level < merc.LEVEL_HERO + 1 \ - and (fAll or level <= ch.level) \ - and level >= min_lev and level <= max_lev \ - and skill.spell_fun is not None \ - and sn in ch.learned: + if ( + level < merc.LEVEL_HERO + 1 + and (fAll or level <= ch.level) + and level >= min_lev + and level <= max_lev + and skill.spell_fun is not None + and sn in ch.learned + ): found = True level = skill.skill_level[ch.guild.name] if ch.level < level: @@ -85,4 +88,6 @@ def do_spells(ch, argument): ch.send("\n") -interp.register_command(interp.cmd_type('spells', do_spells, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("spells", do_spells, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_split.py b/src/rom24/commands/do_split.py index c946620..8196507 100644 --- a/src/rom24/commands/do_split.py +++ b/src/rom24/commands/do_split.py @@ -52,24 +52,44 @@ def do_split(ch, argument): ch.gold -= amount_gold ch.gold += share_gold + extra_gold if share_silver > 0: - ch.send("You split %d silver coins. Your share is %d silver.\n" % (amount_silver, share_silver + extra_silver)) + ch.send( + "You split %d silver coins. Your share is %d silver.\n" + % (amount_silver, share_silver + extra_silver) + ) if share_gold > 0: - ch.send("You split %d gold coins. Your share is %d gold.\n" % (amount_gold, share_gold + extra_gold)) + ch.send( + "You split %d gold coins. Your share is %d gold.\n" + % (amount_gold, share_gold + extra_gold) + ) if share_gold == 0: - buf = "$n splits %d silver coins. Your share is %d silver." % (amount_silver, share_silver) + buf = "$n splits %d silver coins. Your share is %d silver." % ( + amount_silver, + share_silver, + ) elif share_silver == 0: - buf = "$n splits %d gold coins. Your share is %d gold." % (amount_gold, share_gold) + buf = "$n splits %d gold coins. Your share is %d gold." % ( + amount_gold, + share_gold, + ) else: - buf = '$n splits %d silver and %d gold coins, giving you %d silver and %d gold.\n' % ( - amount_silver, amount_gold, share_silver, share_gold) + buf = ( + "$n splits %d silver and %d gold coins, giving you %d silver and %d gold.\n" + % (amount_silver, amount_gold, share_silver, share_gold) + ) for gch_id in ch.in_room.people: gch = instance.characters[gch_id] - if gch != ch and gch.is_same_group(ch) and not state_checks.IS_AFFECTED(gch, merc.AFF_CHARM): + if ( + gch != ch + and gch.is_same_group(ch) + and not state_checks.IS_AFFECTED(gch, merc.AFF_CHARM) + ): handler_game.act(buf, ch, None, gch, merc.TO_VICT) gch.gold += share_gold gch.silver += share_silver return -interp.register_command(interp.cmd_type('split', do_split, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("split", do_split, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_sset.py b/src/rom24/commands/do_sset.py index 676cd81..1fee3a6 100644 --- a/src/rom24/commands/do_sset.py +++ b/src/rom24/commands/do_sset.py @@ -13,7 +13,7 @@ def do_sset(ch, argument): """Set a skill to a specific level. Example: - + <26hp 128m 454mv> sset bub dagger 100 Skill set. @@ -72,4 +72,6 @@ def do_sset(ch, argument): ch.send("Skill set.\n") -interp.register_command(interp.cmd_type('sset', do_sset, merc.POS_DEAD, merc.L2, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("sset", do_sset, merc.POS_DEAD, merc.L2, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_stand.py b/src/rom24/commands/do_stand.py index e96b6e5..65c3130 100644 --- a/src/rom24/commands/do_stand.py +++ b/src/rom24/commands/do_stand.py @@ -18,14 +18,22 @@ def do_stand(ch, argument): if not obj: ch.send("You don't see that here.\n") return - if obj.item_type != merc.ITEM_FURNITURE \ - or (not state_checks.IS_SET(obj.value[2], merc.STAND_AT) - and not state_checks.IS_SET(obj.value[2], merc.STAND_ON) - and not state_checks.IS_SET(obj.value[2], merc.STAND_IN)): + if obj.item_type != merc.ITEM_FURNITURE or ( + not state_checks.IS_SET(obj.value[2], merc.STAND_AT) + and not state_checks.IS_SET(obj.value[2], merc.STAND_ON) + and not state_checks.IS_SET(obj.value[2], merc.STAND_IN) + ): ch.send("You can't seem to find a place to stand.\n") return if ch.on != obj and obj.count_users() >= obj.value[0]: - handler_game.act("There's no room to stand on $p.", ch, obj, None, merc.TO_CHAR, merc.POS_DEAD) + handler_game.act( + "There's no room to stand on $p.", + ch, + obj, + None, + merc.TO_CHAR, + merc.POS_DEAD, + ) return ch.on = obj @@ -38,13 +46,19 @@ def do_stand(ch, argument): handler_game.act("$n wakes and stands up.", ch, None, None, merc.TO_ROOM) ch.on = None elif state_checks.IS_SET(obj.value[2], merc.STAND_AT): - handler_game.act("You wake and stand at $p.", ch, obj, None, merc.TO_CHAR, merc.POS_DEAD) + handler_game.act( + "You wake and stand at $p.", ch, obj, None, merc.TO_CHAR, merc.POS_DEAD + ) handler_game.act("$n wakes and stands at $p.", ch, obj, None, merc.TO_ROOM) elif state_checks.IS_SET(obj.value[2], merc.STAND_ON): - handler_game.act("You wake and stand on $p.", ch, obj, None, merc.TO_CHAR, merc.POS_DEAD) + handler_game.act( + "You wake and stand on $p.", ch, obj, None, merc.TO_CHAR, merc.POS_DEAD + ) handler_game.act("$n wakes and stands on $p.", ch, obj, None, merc.TO_ROOM) else: - handler_game.act("You wake and stand in $p.", ch, obj, None, merc.TO_CHAR, merc.POS_DEAD) + handler_game.act( + "You wake and stand in $p.", ch, obj, None, merc.TO_CHAR, merc.POS_DEAD + ) handler_game.act("$n wakes and stands in $p.", ch, obj, None, merc.TO_ROOM) ch.position = merc.POS_STANDING ch.do_look("auto") @@ -73,4 +87,6 @@ def do_stand(ch, argument): return -interp.register_command(interp.cmd_type('stand', do_stand, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("stand", do_stand, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_stat.py b/src/rom24/commands/do_stat.py index 85547bb..3c8a262 100644 --- a/src/rom24/commands/do_stat.py +++ b/src/rom24/commands/do_stat.py @@ -41,4 +41,6 @@ def do_stat(ch, argument): ch.send("Nothing by that name found anywhere.\n") -interp.register_command(interp.cmd_type('stat', do_stat, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("stat", do_stat, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_steal.py b/src/rom24/commands/do_steal.py index 6a17a81..a968080 100644 --- a/src/rom24/commands/do_steal.py +++ b/src/rom24/commands/do_steal.py @@ -30,7 +30,9 @@ def do_steal(ch, argument): return if victim.is_npc() and victim.position == merc.POS_FIGHTING: - ch.send("Kill stealing is not permitted.\nYou'd better not -- you might get hit.\n") + ch.send( + "Kill stealing is not permitted.\nYou'd better not -- you might get hit.\n" + ) return state_checks.WAIT_STATE(ch, const.skill_table["steal"].beats) percent = random.randint(1, 99) @@ -42,22 +44,34 @@ def do_steal(ch, argument): else: percent += 50 - if ((ch.level + 7 < victim.level or ch.level - 7 > victim.level) - and not victim.is_npc() and not ch.is_npc() ) \ - or (not ch.is_npc() and percent > ch.get_skill("steal")) \ - or (not ch.is_npc() and not ch.is_clan()): + if ( + ( + (ch.level + 7 < victim.level or ch.level - 7 > victim.level) + and not victim.is_npc() + and not ch.is_npc() + ) + or (not ch.is_npc() and percent > ch.get_skill("steal")) + or (not ch.is_npc() and not ch.is_clan()) + ): # Failure. ch.send("Oops.\n") ch.affect_strip("sneak") ch.affected_by = ch.affected_by.rem_bit(merc.AFF_SNEAK) - handler_game.act("$n tried to steal from you.\n", ch, None, victim, merc.TO_VICT) - handler_game.act("$n tried to steal from $N.\n", ch, None, victim, merc.TO_NOTVICT) + handler_game.act( + "$n tried to steal from you.\n", ch, None, victim, merc.TO_VICT + ) + handler_game.act( + "$n tried to steal from $N.\n", ch, None, victim, merc.TO_NOTVICT + ) outcome = random.randint(0, 3) - buf = '' + buf = "" if outcome == 0: buf = "%s is a lousy thief!" % ch.name elif outcome == 1: - buf = "%s couldn't rob %s way out of a paper bag!" % (ch.name, ("her" if ch.sex == 2 else "his")) + buf = "%s couldn't rob %s way out of a paper bag!" % ( + ch.name, + ("her" if ch.sex == 2 else "his"), + ) elif outcome == 2: buf = "%s tried to rob me!" % ch.name elif outcome == 3: @@ -72,13 +86,20 @@ def do_steal(ch, argument): ch.check_improve("steal", False, 2) fight.multi_hit(victim, ch, merc.TYPE_UNDEFINED) else: - handler_game.wiznet("$N tried to steal from %s." % victim.name, ch, None, merc.WIZ_FLAGS, 0, 0) + handler_game.wiznet( + "$N tried to steal from %s." % victim.name, + ch, + None, + merc.WIZ_FLAGS, + 0, + 0, + ) if not ch.act.is_set(merc.PLR_THIEF): ch.act.set_bit(merc.PLR_THIEF) ch.send("*** You are now a THIEF!! ***\n") ch.save() return - currency = ['coins', 'coin', 'gold', 'silver'] + currency = ["coins", "coin", "gold", "silver"] if arg1 in currency: gold = victim.gold * random.randint(1, ch.level) // merc.MAX_LEVEL silver = victim.silver * random.randint(1, ch.level) // merc.MAX_LEVEL @@ -96,7 +117,7 @@ def do_steal(ch, argument): else: ch.send("Bingo! You got %d silver and %d gold coins.\n" % (silver, gold)) if ch.is_pc: - ch.check_improve( "steal", True, 2) + ch.check_improve("steal", True, 2) return item = victim.get_item_carry(arg1, ch) if not item: @@ -115,9 +136,11 @@ def do_steal(ch, argument): ch.put(item) handler_game.act("You pocket $p.", ch, item, None, merc.TO_CHAR) if ch.is_pc: - ch.check_improve( "steal", True, 2) + ch.check_improve("steal", True, 2) ch.send("Got it!\n") return -interp.register_command(interp.cmd_type('steal', do_steal, merc.POS_STANDING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("steal", do_steal, merc.POS_STANDING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_string.py b/src/rom24/commands/do_string.py index 858b9ff..83b46de 100644 --- a/src/rom24/commands/do_string.py +++ b/src/rom24/commands/do_string.py @@ -93,4 +93,6 @@ def do_string(ch, argument): ch.do_string("") -interp.register_command(interp.cmd_type('string', do_string, merc.POS_DEAD, merc.L5, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("string", do_string, merc.POS_DEAD, merc.L5, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_switch.py b/src/rom24/commands/do_switch.py index 857c7c7..62301a8 100644 --- a/src/rom24/commands/do_switch.py +++ b/src/rom24/commands/do_switch.py @@ -9,7 +9,7 @@ from rom24 import state_checks -#TODO: Known broken. +# TODO: Known broken. def do_switch(ch, argument): argument, arg = game_utils.read_word(argument) @@ -31,16 +31,26 @@ def do_switch(ch, argument): if not victim.is_npc(): ch.send("You can only switch into mobiles.\n") return - if not ch.is_room_owner(victim.in_room) and ch.in_room != victim.in_room \ - and victim.in_room.is_private() and not state_checks.IS_TRUSTED(ch, merc.MAX_LEVEL): + if ( + not ch.is_room_owner(victim.in_room) + and ch.in_room != victim.in_room + and victim.in_room.is_private() + and not state_checks.IS_TRUSTED(ch, merc.MAX_LEVEL) + ): ch.send("That character is in a private room.\n") return if victim.desc: ch.send("Character in use.\n") return - handler_game.wiznet("$N switches into %s" % victim.short_descr, ch, None, merc.WIZ_SWITCHES, merc.WIZ_SECURE, - ch.trust) + handler_game.wiznet( + "$N switches into %s" % victim.short_descr, + ch, + None, + merc.WIZ_SWITCHES, + merc.WIZ_SECURE, + ch.trust, + ) ch.desc.character = victim ch.desc.original = ch @@ -55,4 +65,6 @@ def do_switch(ch, argument): return -interp.register_command(interp.cmd_type('switch', do_switch, merc.POS_DEAD, merc.L6, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("switch", do_switch, merc.POS_DEAD, merc.L6, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_tabledump.py b/src/rom24/commands/do_tabledump.py index 246ea41..25d0130 100644 --- a/src/rom24/commands/do_tabledump.py +++ b/src/rom24/commands/do_tabledump.py @@ -12,4 +12,9 @@ def do_tabledump(ch, argument): ch.send("Dumping all tables.\n") database.write.write_tables(ch) -interp.register_command(interp.cmd_type('tabledump', do_tabledump, merc.POS_DEAD, merc.ML, merc.LOG_ALWAYS, 1)) \ No newline at end of file + +interp.register_command( + interp.cmd_type( + "tabledump", do_tabledump, merc.POS_DEAD, merc.ML, merc.LOG_ALWAYS, 1 + ) +) diff --git a/src/rom24/commands/do_tableload.py b/src/rom24/commands/do_tableload.py index 718bff2..76eedb3 100644 --- a/src/rom24/commands/do_tableload.py +++ b/src/rom24/commands/do_tableload.py @@ -13,4 +13,8 @@ def do_tableload(ch, argument): database.read.read_tables(ch) -interp.register_command(interp.cmd_type('tableload', do_tableload, merc.POS_DEAD, merc.ML, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type( + "tableload", do_tableload, merc.POS_DEAD, merc.ML, merc.LOG_ALWAYS, 1 + ) +) diff --git a/src/rom24/commands/do_tell.py b/src/rom24/commands/do_tell.py index 07b45f2..d61e351 100644 --- a/src/rom24/commands/do_tell.py +++ b/src/rom24/commands/do_tell.py @@ -28,35 +28,58 @@ def do_tell(ch, argument): # -- Furey victim = ch.get_char_world(arg) argument = argument.strip() - if not victim or ( victim.is_npc() and victim.in_room != ch.in_room ): + if not victim or (victim.is_npc() and victim.in_room != ch.in_room): ch.send("They aren't here.\n") return if victim.desc is None and not victim.is_npc(): - handler_game.act("$N seems to have misplaced $S link...try again later.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N seems to have misplaced $S link...try again later.", + ch, + None, + victim, + merc.TO_CHAR, + ) buf = "%s tells you '%s'\n" % (state_checks.PERS(ch, victim), argument) victim.buffer.append(buf) return - if not (ch.is_immortal() and ch.level > merc.LEVEL_IMMORTAL) and not state_checks.IS_AWAKE(victim): + if not ( + ch.is_immortal() and ch.level > merc.LEVEL_IMMORTAL + ) and not state_checks.IS_AWAKE(victim): handler_game.act("$E can't hear you.", ch, 0, victim, merc.TO_CHAR) return - if (victim.comm.is_set(merc.COMM_QUIET) or state_checks.IS_SET(victim.comm,merc.COMM_DEAF)) and not state_checks.IS_IMMORTAL(ch): + if ( + victim.comm.is_set(merc.COMM_QUIET) + or state_checks.IS_SET(victim.comm, merc.COMM_DEAF) + ) and not state_checks.IS_IMMORTAL(ch): handler_game.act("$E is not receiving tells.", ch, 0, victim, merc.TO_CHAR) return if victim.comm.is_set(merc.COMM_AFK): if victim.is_npc(): - handler_game.act("$E is AFK, and not receiving tells.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$E is AFK, and not receiving tells.", ch, None, victim, merc.TO_CHAR + ) return - handler_game.act("$E is AFK, but your tell will go through when $E returns.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$E is AFK, but your tell will go through when $E returns.", + ch, + None, + victim, + merc.TO_CHAR, + ) buf = "%s tells you '%s'\n" % (state_checks.PERS(ch, victim), argument) victim.buffer.append(buf) return handler_game.act("You tell $N '$t'", ch, argument, victim, merc.TO_CHAR) - handler_game.act("$n tells you '$t'", ch, argument, victim, merc.TO_VICT, merc.POS_DEAD) + handler_game.act( + "$n tells you '$t'", ch, argument, victim, merc.TO_VICT, merc.POS_DEAD + ) victim.reply = ch return -interp.register_command(interp.cmd_type('tell', do_tell, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("tell", do_tell, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_term.py b/src/rom24/commands/do_term.py index 35b27d6..98b133e 100644 --- a/src/rom24/commands/do_term.py +++ b/src/rom24/commands/do_term.py @@ -9,13 +9,18 @@ def usage(ch): - ch.send('Usage: term [[ttype]] [[cols N]] [[rows N]]\n') - ch.send(' valid ttypes are %s.\n\n' % ', '.join(miniboa.colors.TERMINAL_TYPES)) + ch.send("Usage: term [[ttype]] [[cols N]] [[rows N]]\n") + ch.send( + " valid ttypes are %s.\n\n" % ", ".join(miniboa.colors.TERMINAL_TYPES) + ) def do_term(ch, argument): if not argument: - ch.send('Terminal Type is %s (%d columns, %d rows)\n' % (ch.desc.terminal_type, ch.desc.columns, ch.desc.rows)) + ch.send( + "Terminal Type is %s (%d columns, %d rows)\n" + % (ch.desc.terminal_type, ch.desc.columns, ch.desc.rows) + ) return else: args = argument.split() @@ -24,13 +29,13 @@ def do_term(ch, argument): got_type = False changed = False for a in args: - if a.lower() == 'help': + if a.lower() == "help": usage(ch) return - if a.lower() == 'rows': + if a.lower() == "rows": expect_rows = True continue - elif a.lower() == 'columns' or a.lower() == 'cols': + elif a.lower() == "columns" or a.lower() == "cols": expect_cols = True continue elif a.isnumeric(): @@ -43,7 +48,7 @@ def do_term(ch, argument): expect_cols = False changed = True else: - ch.send('Invalid argument: %s\n\n' % a) + ch.send("Invalid argument: %s\n\n" % a) usage(ch) return elif not got_type and a.lower() in miniboa.colors.TERMINAL_TYPES: @@ -51,11 +56,16 @@ def do_term(ch, argument): got_type = True changed = True else: - ch.send('Invalid argument: %s\n\n' % a) + ch.send("Invalid argument: %s\n\n" % a) usage(ch) return if changed: - ch.send('Terminal Type set to %s (%d columns, %d rows)\n' % (ch.desc.terminal_type, ch.desc.columns, ch.desc.rows)) + ch.send( + "Terminal Type set to %s (%d columns, %d rows)\n" + % (ch.desc.terminal_type, ch.desc.columns, ch.desc.rows) + ) -interp.register_command(interp.cmd_type('term', do_term, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("term", do_term, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_time.py b/src/rom24/commands/do_time.py index 5de1705..9d06890 100644 --- a/src/rom24/commands/do_time.py +++ b/src/rom24/commands/do_time.py @@ -7,17 +7,39 @@ from rom24 import handler_game -day_name = ["the Moon", "the Bull", "Deception", "Thunder", "Freedom", - "the Great Gods", "the Sun"] -month_name = ["Winter", "the Winter Wolf", "the Frost Giant", "the Old Forces", - "the Grand Struggle", "the Spring", "Nature", "Futility", "the Dragon", - "the Sun", "the Heat", "the Battle", "the Dark Shades", "the Shadows", - "the Long Shadows", "the Ancient Darkness", "the Great Evil"] - -#TODO: Known broken. Doesn't show startup or longevity. +day_name = [ + "the Moon", + "the Bull", + "Deception", + "Thunder", + "Freedom", + "the Great Gods", + "the Sun", +] +month_name = [ + "Winter", + "the Winter Wolf", + "the Frost Giant", + "the Old Forces", + "the Grand Struggle", + "the Spring", + "Nature", + "Futility", + "the Dragon", + "the Sun", + "the Heat", + "the Battle", + "the Dark Shades", + "the Shadows", + "the Long Shadows", + "the Ancient Darkness", + "the Great Evil", +] + +# TODO: Known broken. Doesn't show startup or longevity. def do_time(ch, argument): day = handler_game.time_info.day + 1 - suf = '' + suf = "" if day > 4 and day < 20: suf = "th" elif day % 10 == 1: @@ -29,12 +51,23 @@ def do_time(ch, argument): else: suf = "th" - ch.send("It is %d o'clock %s, Day of %s, %d%s the Month of %s.\n" % ( - 12 if (handler_game.time_info.hour % 12 == 0) else handler_game.time_info.hour % 12, - "pm" if handler_game.time_info.hour >= 12 else "am", - day_name[day % 7], day, suf, month_name[handler_game.time_info.month])) + ch.send( + "It is %d o'clock %s, Day of %s, %d%s the Month of %s.\n" + % ( + 12 + if (handler_game.time_info.hour % 12 == 0) + else handler_game.time_info.hour % 12, + "pm" if handler_game.time_info.hour >= 12 else "am", + day_name[day % 7], + day, + suf, + month_name[handler_game.time_info.month], + ) + ) # ch.send("ROM started up at %s\nThe system time is %s.\n", str_boot_time, (char *) ctime(¤t_time) return -interp.register_command(interp.cmd_type('time', do_time, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("time", do_time, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_title.py b/src/rom24/commands/do_title.py index 6b3e21d..2d2751d 100644 --- a/src/rom24/commands/do_title.py +++ b/src/rom24/commands/do_title.py @@ -20,4 +20,6 @@ def do_title(ch, argument): ch.send("Ok.\n") -interp.register_command(interp.cmd_type('title', do_title, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("title", do_title, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_train.py b/src/rom24/commands/do_train.py index 31df613..e93d0d0 100644 --- a/src/rom24/commands/do_train.py +++ b/src/rom24/commands/do_train.py @@ -77,15 +77,22 @@ def do_train(ch, argument): return else: ch.send("You can train:") - if ch.perm_stat[merc.STAT_STR] < ch.get_max_train(merc.STAT_STR): ch.send(" str") - if ch.perm_stat[merc.STAT_INT] < ch.get_max_train(merc.STAT_INT): ch.send(" int") - if ch.perm_stat[merc.STAT_WIS] < ch.get_max_train(merc.STAT_WIS): ch.send(" wis") - if ch.perm_stat[merc.STAT_DEX] < ch.get_max_train(merc.STAT_DEX): ch.send(" dex") - if ch.perm_stat[merc.STAT_CON] < ch.get_max_train(merc.STAT_CON): ch.send(" con") + if ch.perm_stat[merc.STAT_STR] < ch.get_max_train(merc.STAT_STR): + ch.send(" str") + if ch.perm_stat[merc.STAT_INT] < ch.get_max_train(merc.STAT_INT): + ch.send(" int") + if ch.perm_stat[merc.STAT_WIS] < ch.get_max_train(merc.STAT_WIS): + ch.send(" wis") + if ch.perm_stat[merc.STAT_DEX] < ch.get_max_train(merc.STAT_DEX): + ch.send(" dex") + if ch.perm_stat[merc.STAT_CON] < ch.get_max_train(merc.STAT_CON): + ch.send(" con") ch.send(" hp mana") return if ch.perm_stat[stat] >= ch.get_max_train(stat): - handler_game.act("Your $T is already at maximum.", ch, None, pOutput, merc.TO_CHAR) + handler_game.act( + "Your $T is already at maximum.", ch, None, pOutput, merc.TO_CHAR + ) return if cost > ch.train: ch.send("You don't have enough training sessions.\n") @@ -97,4 +104,6 @@ def do_train(ch, argument): return -interp.register_command(interp.cmd_type('train', do_train, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("train", do_train, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_transfer.py b/src/rom24/commands/do_transfer.py index 14d3259..036fed8 100644 --- a/src/rom24/commands/do_transfer.py +++ b/src/rom24/commands/do_transfer.py @@ -18,10 +18,12 @@ def do_transfer(ch, argument): return if arg1 == "all": for d in merc.descriptor_list: - if d.is_connected(nanny.con_playing) \ - and d.character != ch \ - and d.character.in_room \ - and ch.can_see(d.character): + if ( + d.is_connected(nanny.con_playing) + and d.character != ch + and d.character.in_room + and ch.can_see(d.character) + ): ch.do_transfer("%s %s" % d.character.name, arg2) return # Thanks to Grodyn for the optional location parameter. @@ -32,8 +34,11 @@ def do_transfer(ch, argument): if not location: ch.send("No such location.\n") return - if not ch.is_room_owner(location) and location.is_private() \ - and ch.trust < merc.MAX_LEVEL: + if ( + not ch.is_room_owner(location) + and location.is_private() + and ch.trust < merc.MAX_LEVEL + ): ch.send("That room is private right now.\n") return victim = ch.get_char_world(arg1) @@ -46,15 +51,23 @@ def do_transfer(ch, argument): if victim.fighting: fight.stop_fighting(victim, True) - handler_game.act("$n disappears in a mushroom cloud.", victim, None, None, merc.TO_ROOM) + handler_game.act( + "$n disappears in a mushroom cloud.", victim, None, None, merc.TO_ROOM + ) victim.in_room.get(victim) location.put(victim) - handler_game.act("$n arrives from a puff of smoke.", victim, None, None, merc.TO_ROOM) + handler_game.act( + "$n arrives from a puff of smoke.", victim, None, None, merc.TO_ROOM + ) if ch != victim: handler_game.act("$n has transferred you.", ch, None, victim, merc.TO_VICT) victim.do_look("auto") ch.send("Ok.\n") -interp.register_command(interp.cmd_type('teleport', do_transfer, merc.POS_DEAD, merc.L5, merc.LOG_ALWAYS, 1)) -interp.register_command(interp.cmd_type('transfer', do_transfer, merc.POS_DEAD, merc.L5, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("teleport", do_transfer, merc.POS_DEAD, merc.L5, merc.LOG_ALWAYS, 1) +) +interp.register_command( + interp.cmd_type("transfer", do_transfer, merc.POS_DEAD, merc.L5, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_trip.py b/src/rom24/commands/do_trip.py index 3c03a68..2912287 100644 --- a/src/rom24/commands/do_trip.py +++ b/src/rom24/commands/do_trip.py @@ -14,9 +14,15 @@ def do_trip(ch, argument): arghold, arg = game_utils.read_word(argument) - chance = ch.get_skill('trip') - if chance == 0 or (ch.is_npc() and not ch.off_flags.is_set(merc.OFF_TRIP)) \ - or ( not ch.is_npc() and ch.level < const.skill_table['trip'].skill_level[ch.guild.name]): + chance = ch.get_skill("trip") + if ( + chance == 0 + or (ch.is_npc() and not ch.off_flags.is_set(merc.OFF_TRIP)) + or ( + not ch.is_npc() + and ch.level < const.skill_table["trip"].skill_level[ch.guild.name] + ) + ): ch.send("Tripping? What's that?\n\r") return if not arg: @@ -29,25 +35,27 @@ def do_trip(ch, argument): if victim is None: ch.send("They aren't here.\n\r") return - if fight.is_safe(ch,victim): + if fight.is_safe(ch, victim): return if victim.is_npc() and victim.fighting and not ch.is_same_group(victim.fighting): ch.send("Kill stealing is not permitted.\n\r") return - if victim.is_affected( merc.AFF_FLYING): - handler_game.act("$S feet aren't on the ground.",ch,None,victim, merc.TO_CHAR) + if victim.is_affected(merc.AFF_FLYING): + handler_game.act( + "$S feet aren't on the ground.", ch, None, victim, merc.TO_CHAR + ) return if victim.position < merc.POS_FIGHTING: - handler_game.act("$N is already down.",ch,None,victim, merc.TO_CHAR) + handler_game.act("$N is already down.", ch, None, victim, merc.TO_CHAR) return if victim == ch: ch.send("You fall flat on your face!\n\r") - state_checks.WAIT_STATE(ch,2 * const.skill_table['trip'].beats) - handler_game.act("$n trips over $s own feet!",ch,None,None, merc.TO_ROOM) + state_checks.WAIT_STATE(ch, 2 * const.skill_table["trip"].beats) + handler_game.act("$n trips over $s own feet!", ch, None, None, merc.TO_ROOM) return if ch.is_affected(merc.AFF_CHARM) and ch.master == victim: - handler_game.act("$N is your beloved master.",ch,None,victim, merc.TO_CHAR) + handler_game.act("$N is your beloved master.", ch, None, victim, merc.TO_CHAR) return # modifiers */ # size */ @@ -59,28 +67,48 @@ def do_trip(ch, argument): chance -= victim.stat(merc.STAT_DEX) * 3 // 2 # speed */ - if (ch.is_npc() and ch.off_flags.is_set(merc.OFF_FAST)) or ch.is_affected(merc.AFF_HASTE): + if (ch.is_npc() and ch.off_flags.is_set(merc.OFF_FAST)) or ch.is_affected( + merc.AFF_HASTE + ): chance += 10 - if (victim.is_npc() and victim.off_flags.is_set(merc.OFF_FAST)) or victim.is_affected( merc.AFF_HASTE): + if ( + victim.is_npc() and victim.off_flags.is_set(merc.OFF_FAST) + ) or victim.is_affected(merc.AFF_HASTE): chance -= 20 # level */ chance += (ch.level - victim.level) * 2 # now the attack */ - if random.randint(1,99) < chance: - handler_game.act("$n trips you and you go down!",ch,None,victim, merc.TO_VICT) - handler_game.act("You trip $N and $N goes down!",ch,None,victim, merc.TO_CHAR) - handler_game.act("$n trips $N, sending $M to the ground.",ch,None,victim, merc.TO_NOTVICT) + if random.randint(1, 99) < chance: + handler_game.act( + "$n trips you and you go down!", ch, None, victim, merc.TO_VICT + ) + handler_game.act( + "You trip $N and $N goes down!", ch, None, victim, merc.TO_CHAR + ) + handler_game.act( + "$n trips $N, sending $M to the ground.", ch, None, victim, merc.TO_NOTVICT + ) if ch.is_pc: - ch.check_improve('trip', True, 1) - state_checks.DAZE_STATE(victim,2 * merc.PULSE_VIOLENCE) - state_checks.WAIT_STATE(ch,const.skill_table['trip'].beats) + ch.check_improve("trip", True, 1) + state_checks.DAZE_STATE(victim, 2 * merc.PULSE_VIOLENCE) + state_checks.WAIT_STATE(ch, const.skill_table["trip"].beats) victim.position = merc.POS_RESTING - fight.damage(ch,victim,random.randint(2, 2 + 2 * victim.size),'trip', merc.DAM_BASH,True) + fight.damage( + ch, + victim, + random.randint(2, 2 + 2 * victim.size), + "trip", + merc.DAM_BASH, + True, + ) else: - fight.damage(ch,victim,0,'trip', merc.DAM_BASH,True) - state_checks.WAIT_STATE(ch,const.skill_table['trip'].beats*2 // 3) + fight.damage(ch, victim, 0, "trip", merc.DAM_BASH, True) + state_checks.WAIT_STATE(ch, const.skill_table["trip"].beats * 2 // 3) if ch.is_pc: - ch.check_improve('trip', False, 1) - fight.check_killer(ch,victim) + ch.check_improve("trip", False, 1) + fight.check_killer(ch, victim) -interp.register_command(interp.cmd_type('trip', do_trip, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 1)) + +interp.register_command( + interp.cmd_type("trip", do_trip, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_trust.py b/src/rom24/commands/do_trust.py index eb35708..3983fc2 100644 --- a/src/rom24/commands/do_trust.py +++ b/src/rom24/commands/do_trust.py @@ -29,4 +29,6 @@ def do_trust(ch, argument): return -interp.register_command(interp.cmd_type('trust', do_trust, merc.POS_DEAD, merc.ML, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("trust", do_trust, merc.POS_DEAD, merc.ML, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_typo.py b/src/rom24/commands/do_typo.py index f028953..9344034 100644 --- a/src/rom24/commands/do_typo.py +++ b/src/rom24/commands/do_typo.py @@ -14,4 +14,6 @@ def do_typo(ch, argument): return -interp.register_command(interp.cmd_type('typo', do_typo, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("typo", do_typo, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_unalias.py b/src/rom24/commands/do_unalias.py index 3305bf1..dbe5810 100644 --- a/src/rom24/commands/do_unalias.py +++ b/src/rom24/commands/do_unalias.py @@ -30,4 +30,6 @@ def do_unalias(ch, argument): return -interp.register_command(interp.cmd_type('unalias', do_unalias, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("unalias", do_unalias, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_unlock.py b/src/rom24/commands/do_unlock.py index e7d0c9a..d87c733 100644 --- a/src/rom24/commands/do_unlock.py +++ b/src/rom24/commands/do_unlock.py @@ -83,9 +83,14 @@ def do_unlock(ch, argument): # unlock the other side */ to_room = pexit.to_room - if to_room and to_room.exit[merc.rev_dir[door]] != 0 \ - and to_room.exit[merc.rev_dir[door]].to_room == ch.in_room: + if ( + to_room + and to_room.exit[merc.rev_dir[door]] != 0 + and to_room.exit[merc.rev_dir[door]].to_room == ch.in_room + ): to_room.exit[merc.rev_dir[door]].exit_info.rem_bit(merc.EX_LOCKED) -interp.register_command(interp.cmd_type('unlock', do_unlock, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("unlock", do_unlock, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_up.py b/src/rom24/commands/do_up.py index b1c51bb..fa43c52 100644 --- a/src/rom24/commands/do_up.py +++ b/src/rom24/commands/do_up.py @@ -12,4 +12,6 @@ def do_up(ch, argument): return -interp.register_command(interp.cmd_type('up', do_up, merc.POS_STANDING, 0, merc.LOG_NEVER, 0)) +interp.register_command( + interp.cmd_type("up", do_up, merc.POS_STANDING, 0, merc.LOG_NEVER, 0) +) diff --git a/src/rom24/commands/do_value.py b/src/rom24/commands/do_value.py index 2a1ca50..236622d 100644 --- a/src/rom24/commands/do_value.py +++ b/src/rom24/commands/do_value.py @@ -19,23 +19,35 @@ def do_value(ch, argument): return obj = ch.get_item_carry(arg, ch) if not obj: - handler_game.act("$n tells you 'You don't have that item'.", keeper, None, ch, merc.TO_VICT) + handler_game.act( + "$n tells you 'You don't have that item'.", keeper, None, ch, merc.TO_VICT + ) ch.reply = keeper return if not keeper.can_see_item(obj): - handler_game.act("$n doesn't see what you are offering.",keeper,None,ch, merc.TO_VICT) + handler_game.act( + "$n doesn't see what you are offering.", keeper, None, ch, merc.TO_VICT + ) return if not ch.can_drop_item(obj): ch.send("You can't let go of it.\n") return cost = shop_utils.get_cost(keeper, obj, False) if cost <= 0: - handler_game.act( "$n looks uninterested in $p.", keeper, obj, ch, merc.TO_VICT) + handler_game.act("$n looks uninterested in $p.", keeper, obj, ch, merc.TO_VICT) return - handler_game.act("$n tells you 'I'll give you %d silver and %d gold coins for $p'." % (cost - (cost//100) * 100, cost//100), - keeper, obj, ch, merc.TO_VICT) + handler_game.act( + "$n tells you 'I'll give you %d silver and %d gold coins for $p'." + % (cost - (cost // 100) * 100, cost // 100), + keeper, + obj, + ch, + merc.TO_VICT, + ) ch.reply = keeper return -interp.register_command(interp.cmd_type('value', do_value, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("value", do_value, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_violate.py b/src/rom24/commands/do_violate.py index 91d7a5c..00ebb66 100644 --- a/src/rom24/commands/do_violate.py +++ b/src/rom24/commands/do_violate.py @@ -32,7 +32,9 @@ def do_violate(ch, argument): if ch.pcdata and ch.bamfout: handler_game.act("$t", ch, ch.bamfout, rch, merc.TO_VICT) else: - handler_game.act("$n leaves in a swirling mist.", ch, None, rch, merc.TO_VICT) + handler_game.act( + "$n leaves in a swirling mist.", ch, None, rch, merc.TO_VICT + ) ch.get() ch.put(location) @@ -42,9 +44,13 @@ def do_violate(ch, argument): if ch.pcdata and ch.bamfin: handler_game.act("$t", ch, ch.bamfin, rch, merc.TO_VICT) else: - handler_game.act("$n appears in a swirling mist.", ch, None, rch, merc.TO_VICT) + handler_game.act( + "$n appears in a swirling mist.", ch, None, rch, merc.TO_VICT + ) ch.do_look("auto") return -interp.register_command(interp.cmd_type('violate', do_violate, merc.POS_DEAD, merc.ML, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("violate", do_violate, merc.POS_DEAD, merc.ML, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_visible.py b/src/rom24/commands/do_visible.py index 5853e8f..9ce93f6 100644 --- a/src/rom24/commands/do_visible.py +++ b/src/rom24/commands/do_visible.py @@ -17,4 +17,6 @@ def do_visible(ch, argument): ch.send("Ok.\n") -interp.register_command(interp.cmd_type('visible', do_visible, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("visible", do_visible, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_vnum.py b/src/rom24/commands/do_vnum.py index ee7ec4f..d3c4782 100644 --- a/src/rom24/commands/do_vnum.py +++ b/src/rom24/commands/do_vnum.py @@ -33,4 +33,6 @@ def do_vnum(ch, argument): ch.do_ofind(argument) -interp.register_command(interp.cmd_type('vnum', do_vnum, merc.POS_DEAD, merc.L4, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("vnum", do_vnum, merc.POS_DEAD, merc.L4, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_wake.py b/src/rom24/commands/do_wake.py index f3a0dde..3b0916c 100644 --- a/src/rom24/commands/do_wake.py +++ b/src/rom24/commands/do_wake.py @@ -25,7 +25,7 @@ def do_wake(ch, argument): if state_checks.IS_AWAKE(victim): handler_game.act("$N is already awake.", ch, None, victim, merc.TO_CHAR) return - if victim.is_affected( merc.AFF_SLEEP): + if victim.is_affected(merc.AFF_SLEEP): handler_game.act("You can't wake $M!", ch, None, victim, merc.TO_CHAR) return handler_game.act("$n wakes you.", ch, None, victim, merc.TO_VICT, merc.POS_SLEEPING) @@ -33,4 +33,6 @@ def do_wake(ch, argument): return -interp.register_command(interp.cmd_type('wake', do_wake, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("wake", do_wake, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_wear.py b/src/rom24/commands/do_wear.py index 706ba7e..f0c7f5e 100644 --- a/src/rom24/commands/do_wear.py +++ b/src/rom24/commands/do_wear.py @@ -28,6 +28,12 @@ def do_wear(ch, argument): return -interp.register_command(interp.cmd_type('wield', do_wear, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) -interp.register_command(interp.cmd_type('hold', do_wear, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) -interp.register_command(interp.cmd_type('wear', do_wear, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("wield", do_wear, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) +interp.register_command( + interp.cmd_type("hold", do_wear, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) +interp.register_command( + interp.cmd_type("wear", do_wear, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_weather.py b/src/rom24/commands/do_weather.py index d37dcb6..4390354 100644 --- a/src/rom24/commands/do_weather.py +++ b/src/rom24/commands/do_weather.py @@ -7,15 +7,25 @@ from rom24 import interp from rom24 import state_checks + def do_weather(ch, argument): sky_look = ["cloudless", "cloudy", "rainy", "lit by flashes of lightning"] if not state_checks.IS_OUTSIDE(ch): ch.send("You can't see the weather indoors.\n") return - ch.send("The sky is %s and %s.\n" % (sky_look[handler_game.weather_info.sky], - "a warm southerly breeze blows" if handler_game.weather_info.change >= 0 else "a cold northern gust blows")) + ch.send( + "The sky is %s and %s.\n" + % ( + sky_look[handler_game.weather_info.sky], + "a warm southerly breeze blows" + if handler_game.weather_info.change >= 0 + else "a cold northern gust blows", + ) + ) return -interp.register_command(interp.cmd_type('weather', do_weather, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("weather", do_weather, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_west.py b/src/rom24/commands/do_west.py index 2f29e96..155f88e 100644 --- a/src/rom24/commands/do_west.py +++ b/src/rom24/commands/do_west.py @@ -12,4 +12,6 @@ def do_west(ch, argument): return -interp.register_command(interp.cmd_type('west', do_west, merc.POS_STANDING, 0, merc.LOG_NEVER, 0)) +interp.register_command( + interp.cmd_type("west", do_west, merc.POS_STANDING, 0, merc.LOG_NEVER, 0) +) diff --git a/src/rom24/commands/do_where.py b/src/rom24/commands/do_where.py index 8f74c5d..a6a870d 100644 --- a/src/rom24/commands/do_where.py +++ b/src/rom24/commands/do_where.py @@ -19,14 +19,20 @@ def do_where(ch, argument): found = False for d in merc.descriptor_list: victim = handler_ch.CH(d) - if d.is_connected(nanny.con_playing) \ - and victim \ - and not victim.is_npc() \ - and victim.in_room \ - and not state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_NOWHERE) \ - and (ch.is_room_owner(victim.in_room) or not victim.in_room.is_private()) \ - and victim.in_room.area == ch.in_room.area \ - and ch.can_see(victim): + if ( + d.is_connected(nanny.con_playing) + and victim + and not victim.is_npc() + and victim.in_room + and not state_checks.IS_SET( + victim.in_room.room_flags, merc.ROOM_NOWHERE + ) + and ( + ch.is_room_owner(victim.in_room) or not victim.in_room.is_private() + ) + and victim.in_room.area == ch.in_room.area + and ch.can_see(victim) + ): found = True ch.send("%-28s %s\n" % (victim.name, victim.in_room.name)) if not found: @@ -35,18 +41,24 @@ def do_where(ch, argument): else: found = False for victim in instance.characters.values(): - if victim.in_room \ - and victim.in_room.area == ch.in_room.area \ - and not victim.is_affected( merc.AFF_HIDE) \ - and not victim.is_affected( merc.AFF_SNEAK) \ - and ch.can_see(victim) \ - and arg in victim.name.lower(): + if ( + victim.in_room + and victim.in_room.area == ch.in_room.area + and not victim.is_affected(merc.AFF_HIDE) + and not victim.is_affected(merc.AFF_SNEAK) + and ch.can_see(victim) + and arg in victim.name.lower() + ): found = True - ch.send("%-28s %s\n" % (state_checks.PERS(victim, ch), victim.in_room.name)) + ch.send( + "%-28s %s\n" % (state_checks.PERS(victim, ch), victim.in_room.name) + ) break if not found: handler_game.act("You didn't find any $T.", ch, None, arg, merc.TO_CHAR) return -interp.register_command(interp.cmd_type('where', do_where, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("where", do_where, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_who.py b/src/rom24/commands/do_who.py index 65b432f..f4c7631 100644 --- a/src/rom24/commands/do_who.py +++ b/src/rom24/commands/do_who.py @@ -75,11 +75,15 @@ def do_who(ch, argument): if not ch.can_see(wch): continue - if wch.level < iLevelLower or wch.level > iLevelUpper \ - or (fImmortalOnly and wch.level < merc.LEVEL_IMMORTAL) \ - or (fClassRestrict and not rgfClass[wch.guild.name]) \ - or (fRaceRestrict and not rgfRace[wch.race.name]) \ - or (fClan and not wch.is_clan()) or (fClanRestrict and not rgfClan[wch.clan.name]): + if ( + wch.level < iLevelLower + or wch.level > iLevelUpper + or (fImmortalOnly and wch.level < merc.LEVEL_IMMORTAL) + or (fClassRestrict and not rgfClass[wch.guild.name]) + or (fRaceRestrict and not rgfRace[wch.race.name]) + or (fClan and not wch.is_clan()) + or (fClanRestrict and not rgfClan[wch.clan.name]) + ): continue nMatch += 1 @@ -105,9 +109,13 @@ def do_who(ch, argument): elif wch.level == merc.MAX_LEVEL - 8: guild = "AVA" # a little formatting - ch.send("[[%2d %6s %s]] %s%s%s%s%s%s%s%s\n" % ( + ch.send( + "[[%2d %6s %s]] %s%s%s%s%s%s%s%s\n" + % ( wch.level, - const.pc_race_table[wch.race.name].who_name if wch.race.name in const.pc_race_table else " ", + const.pc_race_table[wch.race.name].who_name + if wch.race.name in const.pc_race_table + else " ", guild, "(Incog) " if wch.incog_level >= merc.LEVEL_HERO else "", "(Wizi) " if wch.invis_level >= merc.LEVEL_HERO else "", @@ -116,9 +124,13 @@ def do_who(ch, argument): "(KILLER) " if wch.act.is_set(merc.PLR_KILLER) else "", "(THIEF) " if wch.act.is_set(merc.PLR_THIEF) else "", wch.name, - "" if wch.is_npc() else wch.title)) + "" if wch.is_npc() else wch.title, + ) + ) ch.send("\nPlayers found: %d\n" % nMatch) return -interp.register_command(interp.cmd_type('who', do_who, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("who", do_who, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_whois.py b/src/rom24/commands/do_whois.py index 9be5c5f..93cc047 100644 --- a/src/rom24/commands/do_whois.py +++ b/src/rom24/commands/do_whois.py @@ -46,9 +46,15 @@ def do_whois(ch, argument): elif wch.level == merc.MAX_LEVEL - 8: guild = "AVA" # a little formatting */ - ch.send("[[%2d %6s %s]] %s%s%s%s%s%s%s%s\n" % ( + ch.send( + "[[%2d %6s %s]] %s%s%s%s%s%s%s%s\n" + % ( wch.level, - (const.pc_race_table[wch.race.name].who_name if wch.race.name in const.pc_race_table else " "), + ( + const.pc_race_table[wch.race.name].who_name + if wch.race.name in const.pc_race_table + else " " + ), guild, ("(Incog) " if wch.incog_level >= merc.LEVEL_HERO else ""), ("(Wizi) " if wch.invis_level >= merc.LEVEL_HERO else ""), @@ -57,11 +63,15 @@ def do_whois(ch, argument): ("(KILLER) " if wch.act.is_set(merc.PLR_KILLER) else ""), ("(THIEF) " if wch.act.is_set(merc.PLR_THIEF) else ""), wch.name, - ("" if wch.is_npc() else wch.title))) + ("" if wch.is_npc() else wch.title), + ) + ) if not found: ch.send("No one of that name is playing.\n") return -interp.register_command(interp.cmd_type('whois', do_whois, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("whois", do_whois, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_wimpy.py b/src/rom24/commands/do_wimpy.py index a426fd9..f7cd102 100644 --- a/src/rom24/commands/do_wimpy.py +++ b/src/rom24/commands/do_wimpy.py @@ -24,4 +24,6 @@ def do_wimpy(ch, argument): return -interp.register_command(interp.cmd_type('wimpy', do_wimpy, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("wimpy", do_wimpy, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_wizhelp.py b/src/rom24/commands/do_wizhelp.py index e48046d..af8cfdc 100644 --- a/src/rom24/commands/do_wizhelp.py +++ b/src/rom24/commands/do_wizhelp.py @@ -22,4 +22,6 @@ def do_wizhelp(ch, argument): return -interp.register_command(interp.cmd_type('wizhelp', do_wizhelp, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("wizhelp", do_wizhelp, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_wizlock.py b/src/rom24/commands/do_wizlock.py index dd72f16..66414bd 100644 --- a/src/rom24/commands/do_wizlock.py +++ b/src/rom24/commands/do_wizlock.py @@ -20,4 +20,6 @@ def do_wizlock(ch, argument): return -interp.register_command(interp.cmd_type('wizlock', do_wizlock, merc.POS_DEAD, merc.L2, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("wizlock", do_wizlock, merc.POS_DEAD, merc.L2, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/commands/do_wiznet.py b/src/rom24/commands/do_wiznet.py index e59d0f1..954aa59 100644 --- a/src/rom24/commands/do_wiznet.py +++ b/src/rom24/commands/do_wiznet.py @@ -26,11 +26,11 @@ def do_wiznet(ch, argument): ch.send("Signing off of Wiznet.\n") ch.wiznet = state_checks.REMOVE_BIT(ch.wiznet, merc.WIZ_ON) return - buf = '' + buf = "" # show wiznet status if "status".startswith(argument): if not state_checks.IS_SET(ch.wiznet, merc.WIZ_ON): - buf += "off " + buf += "off " for name, flag in const.wiznet_table.items(): if state_checks.IS_SET(ch.wiznet, flag.bit): buf += name + " " @@ -38,7 +38,7 @@ def do_wiznet(ch, argument): return if "show".startswith(argument): # list of all wiznet options - buf = '' + buf = "" for name, flag in const.wiznet_table.items(): if flag.level <= ch.trust: buf += name + " " @@ -58,4 +58,6 @@ def do_wiznet(ch, argument): return -interp.register_command(interp.cmd_type('wiznet', do_wiznet, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("wiznet", do_wiznet, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_worth.py b/src/rom24/commands/do_worth.py index 58f9ada..42c00ca 100644 --- a/src/rom24/commands/do_worth.py +++ b/src/rom24/commands/do_worth.py @@ -10,8 +10,17 @@ def do_worth(ch, argument): if ch.is_npc(): ch.send("You have %ld gold and %ld silver.\n" % (ch.gold, ch.silver)) return - ch.send("You have %ld gold, %ld silver, and %d experience (%d exp to level).\n" % ( - ch.gold, ch.silver, ch.exp, (ch.level + 1) * ch.exp_per_level(ch.points) - ch.exp)) + ch.send( + "You have %ld gold, %ld silver, and %d experience (%d exp to level).\n" + % ( + ch.gold, + ch.silver, + ch.exp, + (ch.level + 1) * ch.exp_per_level(ch.points) - ch.exp, + ) + ) -interp.register_command(interp.cmd_type('worth', do_worth, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("worth", do_worth, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_yell.py b/src/rom24/commands/do_yell.py index 84c32d7..e65d56d 100644 --- a/src/rom24/commands/do_yell.py +++ b/src/rom24/commands/do_yell.py @@ -18,12 +18,16 @@ def do_yell(ch, argument): return handler_game.act("You yell '$t'", ch, argument, None, merc.TO_CHAR) for d in merc.descriptor_list: - if d.is_connected(nanny.con_playing) \ - and d.character != ch \ - and d.character.in_room is not None \ - and d.character.in_room.area == ch.in_room.area \ - and not state_checks.IS_SET(d.character.comm, merc.COMM_QUIET): + if ( + d.is_connected(nanny.con_playing) + and d.character != ch + and d.character.in_room is not None + and d.character.in_room.area == ch.in_room.area + and not state_checks.IS_SET(d.character.comm, merc.COMM_QUIET) + ): handler_game.act("$n yells '$t'", ch, argument, d.character, merc.TO_VICT) -interp.register_command(interp.cmd_type('yell', do_yell, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("yell", do_yell, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_zap.py b/src/rom24/commands/do_zap.py index 452fbaf..546b141 100644 --- a/src/rom24/commands/do_zap.py +++ b/src/rom24/commands/do_zap.py @@ -17,7 +17,7 @@ def do_zap(ch, argument): if not arg and not ch.fighting: ch.send("Zap whom or what?\n") return - wand = ch.get_eq('held') + wand = ch.get_eq("held") if not wand: ch.send("You hold nothing in your hand.\n") return @@ -48,21 +48,41 @@ def do_zap(ch, argument): else: handler_game.act("$n zaps $P with $p.", ch, wand, obj, merc.TO_ROOM) handler_game.act("You zap $P with $p.", ch, wand, obj, merc.TO_CHAR) - if ch.level < wand.level \ - or random.randint(1, 99) >= 20 + ch.get_skill("wands") * 4 // 5: - handler_game.act("Your efforts with $p produce only smoke and sparks.", ch, wand, None, merc.TO_CHAR) - handler_game.act("$n's efforts with $p produce only smoke and sparks.", ch, wand, None, merc.TO_ROOM) + if ( + ch.level < wand.level + or random.randint(1, 99) >= 20 + ch.get_skill("wands") * 4 // 5 + ): + handler_game.act( + "Your efforts with $p produce only smoke and sparks.", + ch, + wand, + None, + merc.TO_CHAR, + ) + handler_game.act( + "$n's efforts with $p produce only smoke and sparks.", + ch, + wand, + None, + merc.TO_ROOM, + ) if ch.is_pc: - ch.check_improve( "wands", False, 2) + ch.check_improve("wands", False, 2) else: handler_magic.obj_cast_spell(wand.value[3], wand.value[0], ch, victim, obj) if ch.is_pc: - ch.check_improve( "wands", True, 2) + ch.check_improve("wands", True, 2) wand.value[2] -= 1 if wand.value[2] <= 0: - handler_game.act("$n's $p explodes into fragments.", ch, wand, None, merc.TO_ROOM) - handler_game.act("Your $p explodes into fragments.", ch, wand, None, merc.TO_CHAR) + handler_game.act( + "$n's $p explodes into fragments.", ch, wand, None, merc.TO_ROOM + ) + handler_game.act( + "Your $p explodes into fragments.", ch, wand, None, merc.TO_CHAR + ) wand.extract() -interp.register_command(interp.cmd_type('zap', do_zap, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) +interp.register_command( + interp.cmd_type("zap", do_zap, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1) +) diff --git a/src/rom24/commands/do_zecho.py b/src/rom24/commands/do_zecho.py index 50fb02b..562fb7b 100644 --- a/src/rom24/commands/do_zecho.py +++ b/src/rom24/commands/do_zecho.py @@ -12,11 +12,17 @@ def do_zecho(ch, argument): ch.send("Zone echo what?\n") return for d in merc.descriptor_list: - if d.is_connected(nanny.con_playing) and d.character.in_room and ch.in_room \ - and d.character.in_room.area == ch.in_room.area: + if ( + d.is_connected(nanny.con_playing) + and d.character.in_room + and ch.in_room + and d.character.in_room.area == ch.in_room.area + ): if d.character.trust >= ch.trust: d.send("zone> ") d.send(argument + "\n") -interp.register_command(interp.cmd_type('zecho', do_zecho, merc.POS_DEAD, merc.L4, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("zecho", do_zecho, merc.POS_DEAD, merc.L4, merc.LOG_ALWAYS, 1) +) diff --git a/src/rom24/const.py b/src/rom24/const.py index 79385f7..f88b3c8 100644 --- a/src/rom24/const.py +++ b/src/rom24/const.py @@ -1,4 +1,3 @@ - from collections import OrderedDict, namedtuple import logging @@ -6,19 +5,27 @@ spell_lookup_dict = {} -race_type = namedtuple('race_type', 'name, pc_race, act, aff, off, imm, res, vuln, form, parts') +race_type = namedtuple( + "race_type", "name, pc_race, act, aff, off, imm, res, vuln, form, parts" +) race_table = OrderedDict() -pc_race_type = namedtuple('pc_race_type', 'name, who_name, points, class_mult, skills, stats, max_stats, size') +pc_race_type = namedtuple( + "pc_race_type", "name, who_name, points, class_mult, skills, stats, max_stats, size" +) pc_race_table = OrderedDict() def SLOT(i): return i -skill_type = namedtuple('skilltype', 'name, skill_level, rating, spell_fun, ' - 'target, minimum_position, pgsn, slot, ' - 'min_mana, beats, noun_damage, msg_off, msg_obj') + +skill_type = namedtuple( + "skilltype", + "name, skill_level, rating, spell_fun, " + "target, minimum_position, pgsn, slot, " + "min_mana, beats, noun_damage, msg_off, msg_obj", +) skill_table = OrderedDict() @@ -26,45 +33,49 @@ def register_spell(entry: skill_type): skill_table[entry.name] = entry spell_lookup_dict[entry.name] = [entry.slot] logger.debug(" %s %d added to lookup", entry.name, entry.slot) - logger.debug(' %s registered in skill table.', entry.name) + logger.debug(" %s registered in skill table.", entry.name) + -group_type = namedtuple('group_type', 'name, rating, spells') +group_type = namedtuple("group_type", "name, rating, spells") group_table = OrderedDict() -guild_type = namedtuple('guild_type', 'name, who_name, attr_prime, weapon, guild_rooms, ' - 'skill_adept, thac0_00, thac0_32, hp_min, hp_max, ' - 'fMana, base_group, default_group') +guild_type = namedtuple( + "guild_type", + "name, who_name, attr_prime, weapon, guild_rooms, " + "skill_adept, thac0_00, thac0_32, hp_min, hp_max, " + "fMana, base_group, default_group", +) guild_table = OrderedDict() -weapon_type = namedtuple('weapon_type', 'name, vnum, type, gsn') +weapon_type = namedtuple("weapon_type", "name, vnum, type, gsn") weapon_table = OrderedDict() title_table = {} # * Attribute bonus structures. -str_app_type = namedtuple('str_app_type', 'tohit, todam, carry, wield') +str_app_type = namedtuple("str_app_type", "tohit, todam, carry, wield") str_app = OrderedDict() -int_app_type = namedtuple('int_app_type', 'learn') +int_app_type = namedtuple("int_app_type", "learn") int_app = OrderedDict() -wis_app_type = namedtuple('wis_app_type', 'practice') +wis_app_type = namedtuple("wis_app_type", "practice") wis_app = OrderedDict() -dex_app_type = namedtuple('dex_app_type', 'defensive') +dex_app_type = namedtuple("dex_app_type", "defensive") dex_app = OrderedDict() -con_app_type = namedtuple('con_app_type', 'hitp, shock') +con_app_type = namedtuple("con_app_type", "hitp, shock") con_app = OrderedDict() -#/* attack table -- not very organized :( */ -attack_type = namedtuple('attack_type', 'name, noun, damage') +# /* attack table -- not very organized :( */ +attack_type = namedtuple("attack_type", "name, noun, damage") attack_table = OrderedDict() -wiznet_type = namedtuple('wiznet_type', 'name bit level') +wiznet_type = namedtuple("wiznet_type", "name bit level") wiznet_table = OrderedDict() -liq_type = namedtuple('liq_type', 'name color proof full thirst food ssize') +liq_type = namedtuple("liq_type", "name color proof full thirst food ssize") liq_table = OrderedDict() diff --git a/src/rom24/data_loader.py b/src/rom24/data_loader.py index b38ee30..7016f3a 100644 --- a/src/rom24/data_loader.py +++ b/src/rom24/data_loader.py @@ -21,24 +21,24 @@ from rom24 import instance -__author__ = 'syn' +__author__ = "syn" def load_areas(): - logger.info('Loading Areas from %s', settings.AREA_LIST_FILE) + logger.info("Loading Areas from %s", settings.AREA_LIST_FILE) index = 0 - fp = open(settings.AREA_LIST_FILE, 'r') + fp = open(settings.AREA_LIST_FILE, "r") area = fp.readline().strip() while area != "$": logger.info("Loading area %s", area) - afp = open(os.path.join(settings.AREA_DIR, area), 'r') + afp = open(os.path.join(settings.AREA_DIR, area), "r") index += 1 load_area(afp.read(), index) area = fp.readline().strip() afp.close() fp.close() - logger.info('Done. (loading areas)') + logger.info("Done. (loading areas)") def load_area(area, index): @@ -75,10 +75,10 @@ def load_area(area, index): area = load_socials(area) elif w == "#SPECIALS": area = load_specials(area) - elif w == '#$': + elif w == "#$": break else: - logger.error('Bad section name: %s', w) + logger.error("Bad section name: %s", w) area, w = game_utils.read_word(area, False) @@ -90,14 +90,14 @@ def load_helps(area): area, nhelp.keyword = game_utils.read_string(area) instance.helps[nhelp.keyword] = nhelp - if nhelp.keyword == '$': + if nhelp.keyword == "$": del nhelp break area, nhelp.text = game_utils.read_string(area) - nhelp.text = miniboa_terminal.escape(nhelp.text, 'pyom') + nhelp.text = miniboa_terminal.escape(nhelp.text, "pyom") if nhelp.keyword == "GREETING": - nhelp.text += ' ' + nhelp.text += " " merc.greeting_list.append(nhelp) merc.help_list.append(nhelp) return area @@ -107,7 +107,7 @@ def load_npcs(area, pArea): area, w = game_utils.read_word(area, False) w = w[1:] # strip the pound - while w != '0': + while w != "0": npc = handler_npc.Npc() npc.vnum = int(w) instance.npc_templates[npc.vnum] = npc @@ -117,9 +117,9 @@ def load_npcs(area, pArea): area, npc.short_descr = game_utils.read_string(area) area, npc.long_descr = game_utils.read_string(area) - npc.long_descr = miniboa_terminal.escape(npc.long_descr, 'pyom') + npc.long_descr = miniboa_terminal.escape(npc.long_descr, "pyom") area, npc.description = game_utils.read_string(area) - npc.description = miniboa_terminal.escape(npc.description, 'pyom') + npc.description = miniboa_terminal.escape(npc.description, "pyom") area, npc.race = game_utils.read_string(area) area = npc.act.read_bits(area, default=merc.ACT_IS_NPC | npc.race.act) @@ -155,8 +155,12 @@ def load_npcs(area, pArea): area = npc.vuln_flags.read_bits(area, default=npc.race.vuln) area, npc.start_pos = game_utils.read_word(area, False) area, npc.default_pos = game_utils.read_word(area, False) - npc.start_pos = state_checks.name_lookup(tables.position_table, npc.start_pos, 'short_name') - npc.default_pos = state_checks.name_lookup(tables.position_table, npc.default_pos, 'short_name') + npc.start_pos = state_checks.name_lookup( + tables.position_table, npc.start_pos, "short_name" + ) + npc.default_pos = state_checks.name_lookup( + tables.position_table, npc.default_pos, "short_name" + ) area, sex = game_utils.read_word(area, False) npc.sex = state_checks.value_lookup(tables.sex_table, sex) area, npc.wealth = game_utils.read_int(area) @@ -166,7 +170,7 @@ def load_npcs(area, pArea): area, npc.material = game_utils.read_word(area, False) area, w = game_utils.read_word(area, False) npc.size = tables.size_table.index(npc.size) - while w == 'F': + while w == "F": area, word = game_utils.read_word(area, False) area, vector = game_utils.read_flags(area) area, w = game_utils.read_word(area, False) @@ -177,8 +181,10 @@ def load_npcs(area, pArea): def load_objects(area, pArea): area, w = game_utils.read_word(area, False) w = w[1:] # strip the pound - while w != '0': - flag_data = collections.namedtuple('item_flags', ('slots', 'restrictions', 'attributes', 'weapon')) + while w != "0": + flag_data = collections.namedtuple( + "item_flags", ("slots", "restrictions", "attributes", "weapon") + ) flag_data.slots = set({}) flag_data.restrictions = set({}) flag_data.weapon = set({}) @@ -191,16 +197,16 @@ def load_objects(area, pArea): area, item.short_descr = game_utils.read_string(area) area, item.description = game_utils.read_string(area) - item.description = miniboa_terminal.escape(item.description, 'pyom') + item.description = miniboa_terminal.escape(item.description, "pyom") area, item.material = game_utils.read_string(area) area, item.item_type = game_utils.read_word(area, False) area, extra_bits = game_utils.read_flags(area) - game_utils.item_flags_from_bits(extra_bits, flag_data, 'extra flags') + game_utils.item_flags_from_bits(extra_bits, flag_data, "extra flags") area, wear_bits = game_utils.read_flags(area) - game_utils.item_flags_from_bits(wear_bits, flag_data, 'wear flags') + game_utils.item_flags_from_bits(wear_bits, flag_data, "wear flags") if merc.ITEM_LIGHT == item.item_type: - flag_data.slots.update({'light'}) + flag_data.slots.update({"light"}) item.equips_to = flag_data.slots item.item_restrictions = flag_data.restrictions item.item_attributes = flag_data.attributes @@ -212,7 +218,7 @@ def load_objects(area, pArea): area, item.value[3] = game_utils.read_word(area, False) item.value[3] = state_checks.name_lookup(const.attack_table, item.value[3]) area, item.value[4] = game_utils.read_flags(area) - game_utils.item_flags_from_bits(item.value[4], flag_data, 'weapon flags') + game_utils.item_flags_from_bits(item.value[4], flag_data, "weapon flags") item.weapon_attributes = flag_data.weapon elif item.item_type == merc.ITEM_CONTAINER: area, item.value[0] = game_utils.read_int(area) @@ -220,7 +226,10 @@ def load_objects(area, pArea): area, item.value[2] = game_utils.read_int(area) area, item.value[3] = game_utils.read_int(area) area, item.value[4] = game_utils.read_int(area) - elif item.item_type == merc.ITEM_DRINK_CON or item.item_type == merc.ITEM_FOUNTAIN: + elif ( + item.item_type == merc.ITEM_DRINK_CON + or item.item_type == merc.ITEM_FOUNTAIN + ): area, item.value[0] = game_utils.read_int(area) area, item.value[1] = game_utils.read_int(area) area, item.value[2] = game_utils.read_word(area, False) @@ -232,8 +241,11 @@ def load_objects(area, pArea): area, item.value[2] = game_utils.read_int(area) area, item.value[3] = game_utils.read_word(area, False) area, item.value[4] = game_utils.read_int(area) - elif item.item_type == merc.ITEM_POTION or item.item_type == merc.ITEM_SCROLL \ - or item.item_type == merc.ITEM_PILL: + elif ( + item.item_type == merc.ITEM_POTION + or item.item_type == merc.ITEM_SCROLL + or item.item_type == merc.ITEM_PILL + ): area, item.value[0] = game_utils.read_int(area) area, item.value[1] = game_utils.read_word(area, False) area, item.value[2] = game_utils.read_word(area, False) @@ -250,32 +262,32 @@ def load_objects(area, pArea): area, item.weight = game_utils.read_int(area) area, item.cost = game_utils.read_int(area) area, item.condition = game_utils.read_word(area, False) - if item.condition == 'P': + if item.condition == "P": item.condition = 100 - elif item.condition == 'G': + elif item.condition == "G": item.condition = 90 - elif item.condition == 'A': + elif item.condition == "A": item.condition = 75 - elif item.condition == 'W': + elif item.condition == "W": item.condition = 50 - elif item.condition == 'D': + elif item.condition == "D": item.condition = 25 - elif item.condition == 'B': + elif item.condition == "B": item.condition = 10 - elif item.condition == 'R': + elif item.condition == "R": item.condition = 0 else: item.condition = 100 area, w = game_utils.read_word(area, False) - while w == 'F' or w == 'A' or w == 'E': - if w == 'F': + while w == "F" or w == "A" or w == "E": + if w == "F": area, word = game_utils.read_word(area, False) area, number = game_utils.read_int(area) area, number = game_utils.read_int(area) area, flags = game_utils.read_flags(area) - elif w == 'A': + elif w == "A": paf = handler_game.AFFECT_DATA() paf.where = merc.TO_OBJECT paf.type = -1 @@ -285,7 +297,7 @@ def load_objects(area, pArea): area, paf.modifier = game_utils.read_int(area) paf.bitvector = 0 item.affected += [paf] - elif w == 'E': + elif w == "E": ed = world_classes.ExtraDescrData() area, ed.keyword = game_utils.read_string(area) area, ed.description = game_utils.read_string(area) @@ -301,10 +313,10 @@ def load_resets(area, pArea): while True: count += 1 area, letter = game_utils.read_letter(area) - if letter == 'S': + if letter == "S": break - if letter == '*': + if letter == "*": area, t = game_utils.read_to_eol(area) continue @@ -315,8 +327,12 @@ def load_resets(area, pArea): area, number = game_utils.read_int(area) # if_flag area, reset.arg1 = game_utils.read_int(area) area, reset.arg2 = game_utils.read_int(area) - area, reset.arg3 = (area, 0) if letter == 'G' or letter == 'R' else game_utils.read_int(area) - area, reset.arg4 = game_utils.read_int(area) if letter == 'P' or letter == 'M' else (area, 0) + area, reset.arg3 = ( + (area, 0) if letter == "G" or letter == "R" else game_utils.read_int(area) + ) + area, reset.arg4 = ( + game_utils.read_int(area) if letter == "P" or letter == "M" else (area, 0) + ) area, t = game_utils.read_to_eol(area) pArea.reset_list.append(reset) return area @@ -325,18 +341,18 @@ def load_resets(area, pArea): def load_rooms(area, pArea): area, w = game_utils.read_word(area, False) w = w[1:] # strip the pound - while w != '0': + while w != "0": room = handler_room.Room(None) room.vnum = int(w) if room.vnum in instance.room_templates: - logger.critical('Dupicate room Vnum: %d', room.vnum) + logger.critical("Dupicate room Vnum: %d", room.vnum) sys.exit(1) instance.room_templates[room.vnum] = room room.area = pArea.name area, room.name = game_utils.read_string(area) area, room.description = game_utils.read_string(area) - room.description = miniboa_terminal.escape(room.description, 'pyom') + room.description = miniboa_terminal.escape(room.description, "pyom") area, number = game_utils.read_int(area) # area number area, room.room_flags = game_utils.read_flags(area) @@ -344,38 +360,42 @@ def load_rooms(area, pArea): while True: area, letter = game_utils.read_letter(area) - if letter == 'S': + if letter == "S": break - elif letter == 'H': # Healing Room + elif letter == "H": # Healing Room area, room.heal_rate = game_utils.read_int(area) - elif letter == 'M': # Mana Room + elif letter == "M": # Mana Room area, room.mana_rate = game_utils.read_int(area) - elif letter == 'C': # Clan + elif letter == "C": # Clan area, room.clan = game_utils.read_string(area) - elif letter == 'D': # exit + elif letter == "D": # exit nexit = world_classes.Exit(None) area, door = game_utils.read_int(area) area, nexit.description = game_utils.read_string(area) area, nexit.keyword = game_utils.read_string(area) - #Replaced Locks code + # Replaced Locks code area = nexit.exit_info.read_bits(area) area, nexit.key = game_utils.read_int(area) area, nexit.to_room_vnum = game_utils.read_int(area) - nexit.name = "Exit %s %d to %d" % \ - (nexit.keyword, - room.vnum, - nexit.to_room_vnum) + nexit.name = "Exit %s %d to %d" % ( + nexit.keyword, + room.vnum, + nexit.to_room_vnum, + ) room.exit[door] = nexit - elif letter == 'E': + elif letter == "E": ed = world_classes.ExtraDescrData() area, ed.keyword = game_utils.read_string(area) area, ed.description = game_utils.read_string(area) room.extra_descr.append(ed) - elif letter == 'O': + elif letter == "O": area, room.owner = game_utils.read_string(area) else: - logger.critical("RoomIndexData(%d) has flag other than SHMCDEO: %s", (room.vnum, letter)) + logger.critical( + "RoomIndexData(%d) has flag other than SHMCDEO: %s", + (room.vnum, letter), + ) sys.exit(1) area, w = game_utils.read_word(area, False) w = w[1:] # strip the pound @@ -409,16 +429,16 @@ def load_socials(area): while True: area, word = game_utils.read_word(area, False) - if word == '#0': + if word == "#0": return social = handler_game.SOCIAL_DATA() social.name = word instance.socials[social.name] = social area, throwaway = game_utils.read_to_eol(area) area, line = game_utils.read_to_eol(area) - if line == '$': + if line == "$": social.char_no_arg = None - elif line == '#': + elif line == "#": if social not in merc.social_list: merc.social_list.append(social) continue @@ -427,9 +447,9 @@ def load_socials(area): area, line = game_utils.read_to_eol(area) - if line == '$': + if line == "$": social.others_no_arg = None - elif line == '#': + elif line == "#": if social not in merc.social_list: merc.social_list.append(social) continue @@ -437,9 +457,9 @@ def load_socials(area): social.others_no_arg = line area, line = game_utils.read_to_eol(area) - if line == '$': + if line == "$": social.char_found = None - elif line == '#': + elif line == "#": if social not in merc.social_list: merc.social_list.append(social) continue @@ -447,9 +467,9 @@ def load_socials(area): social.char_found = line area, line = game_utils.read_to_eol(area) - if line == '$': + if line == "$": social.others_found = None - elif line == '#': + elif line == "#": if social not in merc.social_list: merc.social_list.append(social) continue @@ -457,9 +477,9 @@ def load_socials(area): social.others_found = line area, line = game_utils.read_to_eol(area) - if line == '$': + if line == "$": social.vict_found = None - elif line == '#': + elif line == "#": if social not in merc.social_list: merc.social_list.append(social) continue @@ -467,9 +487,9 @@ def load_socials(area): social.vict_found = line area, line = game_utils.read_to_eol(area) - if line == '$': + if line == "$": social.char_not_found = None - elif line == '#': + elif line == "#": if social not in merc.social_list: merc.social_list.append(social) continue @@ -477,9 +497,9 @@ def load_socials(area): social.char_not_found = line area, line = game_utils.read_to_eol(area) - if line == '$': + if line == "$": social.char_auto = None - elif line == '#': + elif line == "#": if social not in merc.social_list: merc.social_list.append(social) continue @@ -487,9 +507,9 @@ def load_socials(area): social.char_auto = line area, line = game_utils.read_to_eol(area) - if line == '$': + if line == "$": social.others_auto = None - elif line == '#': + elif line == "#": if social not in merc.social_list: merc.social_list.append(social) continue @@ -505,14 +525,16 @@ def load_specials(area): while True: area, letter = game_utils.read_letter(area) - if letter == '*': + if letter == "*": area, t = game_utils.read_to_eol(area) continue - elif letter == 'S': + elif letter == "S": return area - elif letter == 'M': + elif letter == "M": area, vnum = game_utils.read_int(area) - area, instance.npc_templates[vnum].spec_fun = game_utils.read_word(area, False) + area, instance.npc_templates[vnum].spec_fun = game_utils.read_word( + area, False + ) else: logger.error("Load_specials: letter noth *SM: %s", letter) diff --git a/src/rom24/database/read/read_tables.py b/src/rom24/database/read/read_tables.py index 463e7bd..db2efaf 100644 --- a/src/rom24/database/read/read_tables.py +++ b/src/rom24/database/read/read_tables.py @@ -11,7 +11,7 @@ def read_tables(listener=None, loc=DATA_DIR, extn=DATA_EXTN): if listener: - #This means the game is running. Wipe the current data. + # This means the game is running. Wipe the current data. logger.debug("Clearing all tables.") for tok in tables: logger.debug(" Clearing %s.", tok.name) @@ -19,10 +19,9 @@ def read_tables(listener=None, loc=DATA_DIR, extn=DATA_EXTN): tok.table.clear() else: affected = tok.filter(tok.table) - for k,v in tok.table.copy().items(): + for k, v in tok.table.copy().items(): if k in affected: - del(tok.table[k]) - + del tok.table[k] listener.send("Tables cleared. Rebuilding...\n") logger.info(" Loading Tables.") @@ -31,9 +30,9 @@ def read_tables(listener=None, loc=DATA_DIR, extn=DATA_EXTN): logger.debug(" Loading %s(%s)", tok.name, path) data = None if os.path.isfile(path): - data = json.load(open(path,'r')) + data = json.load(open(path, "r")) else: - logger.warning(' Failed to find file %s', path) + logger.warning(" Failed to find file %s", path) if listener: listener.send("Failed to load %s" % path) continue @@ -45,7 +44,6 @@ def read_tables(listener=None, loc=DATA_DIR, extn=DATA_EXTN): tok.table[k] = tok.tupletype._make(v) else: tok.table[k] = v - except (AttributeError): #Its a list + except (AttributeError): # Its a list for v in data: tok.table.append(v) - diff --git a/src/rom24/database/tracker.py b/src/rom24/database/tracker.py index 0545fbf..f6cf1ff 100644 --- a/src/rom24/database/tracker.py +++ b/src/rom24/database/tracker.py @@ -1,13 +1,57 @@ -from rom24.const import liq_table, wiznet_table, attack_table, con_app, dex_app, wis_app, int_app, str_app, title_table, \ - weapon_table, guild_table, group_table, pc_race_table, race_table, skill_table, pc_race_type, race_type, liq_type, \ - wiznet_type, attack_type, dex_app_type, wis_app_type, int_app_type, str_app_type, weapon_type, guild_type, \ - group_type, skill_type, con_app_type -from rom24.tables import comm_flags, part_flags, form_flags, imm_flags, off_flags, affect_flags, plr_flags, act_flags, \ - size_table, sex_table, position_table, clan_table, clan_type, position_type, flag_type, exit_flags +from rom24.const import ( + liq_table, + wiznet_table, + attack_table, + con_app, + dex_app, + wis_app, + int_app, + str_app, + title_table, + weapon_table, + guild_table, + group_table, + pc_race_table, + race_table, + skill_table, + pc_race_type, + race_type, + liq_type, + wiznet_type, + attack_type, + dex_app_type, + wis_app_type, + int_app_type, + str_app_type, + weapon_type, + guild_type, + group_type, + skill_type, + con_app_type, +) +from rom24.tables import ( + comm_flags, + part_flags, + form_flags, + imm_flags, + off_flags, + affect_flags, + plr_flags, + act_flags, + size_table, + sex_table, + position_table, + clan_table, + clan_type, + position_type, + flag_type, + exit_flags, +) def skill_filter(table): - return {k:v for k, v in table.items() if not v.spell_fun} + return {k: v for k, v in table.items() if not v.spell_fun} + class SaveToken: def __init__(self, name, table, tupletype, filter=None): @@ -16,32 +60,34 @@ def __init__(self, name, table, tupletype, filter=None): self.tupletype = tupletype self.filter = filter -tables = [SaveToken('clan_table', clan_table, clan_type), - SaveToken('position_table', position_table, position_type), - SaveToken('sex_table', sex_table, None), - SaveToken('size_table', size_table, None), - SaveToken('act_flags', act_flags, flag_type), - SaveToken('plr_flags', plr_flags, flag_type), - SaveToken('affect_flags', affect_flags, flag_type), - SaveToken('off_flags', off_flags, flag_type), - SaveToken('imm_flags', imm_flags, flag_type), - SaveToken('form_flags', form_flags, flag_type), - SaveToken('part_flags', part_flags, flag_type), - SaveToken('comm_flags', comm_flags, flag_type), - SaveToken('race_table', race_table, race_type), - SaveToken('pc_race_table', pc_race_table, pc_race_type), - SaveToken('skill_table', skill_table, skill_type, skill_filter), - SaveToken('group_table', group_table, group_type), - SaveToken('guild_table', guild_table, guild_type), - SaveToken('weapon_table', weapon_table, weapon_type), - SaveToken('title_table', title_table, None), - SaveToken('str_app', str_app, str_app_type), - SaveToken('int_app', int_app, int_app_type), - SaveToken('wis_app', wis_app, wis_app_type), - SaveToken('dex_app', dex_app, dex_app_type), - SaveToken('con_app', con_app, con_app_type), - SaveToken('attack_table', attack_table, attack_type), - SaveToken('wiznet_table', wiznet_table, wiznet_type), - SaveToken('liq_table', liq_table, liq_type), - SaveToken('exit_flags', exit_flags, flag_type)] +tables = [ + SaveToken("clan_table", clan_table, clan_type), + SaveToken("position_table", position_table, position_type), + SaveToken("sex_table", sex_table, None), + SaveToken("size_table", size_table, None), + SaveToken("act_flags", act_flags, flag_type), + SaveToken("plr_flags", plr_flags, flag_type), + SaveToken("affect_flags", affect_flags, flag_type), + SaveToken("off_flags", off_flags, flag_type), + SaveToken("imm_flags", imm_flags, flag_type), + SaveToken("form_flags", form_flags, flag_type), + SaveToken("part_flags", part_flags, flag_type), + SaveToken("comm_flags", comm_flags, flag_type), + SaveToken("race_table", race_table, race_type), + SaveToken("pc_race_table", pc_race_table, pc_race_type), + SaveToken("skill_table", skill_table, skill_type, skill_filter), + SaveToken("group_table", group_table, group_type), + SaveToken("guild_table", guild_table, guild_type), + SaveToken("weapon_table", weapon_table, weapon_type), + SaveToken("title_table", title_table, None), + SaveToken("str_app", str_app, str_app_type), + SaveToken("int_app", int_app, int_app_type), + SaveToken("wis_app", wis_app, wis_app_type), + SaveToken("dex_app", dex_app, dex_app_type), + SaveToken("con_app", con_app, con_app_type), + SaveToken("attack_table", attack_table, attack_type), + SaveToken("wiznet_table", wiznet_table, wiznet_type), + SaveToken("liq_table", liq_table, liq_type), + SaveToken("exit_flags", exit_flags, flag_type), +] diff --git a/src/rom24/database/write/__init__.py b/src/rom24/database/write/__init__.py index 724d35d..7b7e3ab 100644 --- a/src/rom24/database/write/__init__.py +++ b/src/rom24/database/write/__init__.py @@ -1 +1 @@ -__author__ = 'aaron' +__author__ = "aaron" diff --git a/src/rom24/database/write/write_tables.py b/src/rom24/database/write/write_tables.py index 4d1e5fd..188b43a 100644 --- a/src/rom24/database/write/write_tables.py +++ b/src/rom24/database/write/write_tables.py @@ -7,21 +7,23 @@ from database.tracker import tables from settings import DATA_EXTN, DATA_DIR + def write_tables(listener=None, loc=DATA_DIR, extn=DATA_EXTN): - logger.info(' Writing Tables') + logger.info(" Writing Tables") if listener: listener.send("Writing tables\n") os.makedirs(loc, 0o755, True) for tok in tables: path = "%s%s" % (os.path.join(loc, tok.name), extn) - logger.debug(' Writing %s(%s)', tok.name, path) + logger.debug(" Writing %s(%s)", tok.name, path) if listener: listener.send("\t%s\n" % tok.name) write_table(path, tok) + def write_table(path, tok): - with open(path, 'w') as fp: + with open(path, "w") as fp: if tok.filter: fp.write(json.dumps(tok.filter(tok.table), indent=4, sort_keys=True)) else: diff --git a/src/rom24/db.py b/src/rom24/db.py index 0d35941..96a5f5e 100644 --- a/src/rom24/db.py +++ b/src/rom24/db.py @@ -28,56 +28,66 @@ def boot_db(): init_instance() read.read_tables() data_loader.load_areas() - #fix_exits() + # fix_exits() area_update() object_creator.setup_exits() update.instance_number_save() results = ( - '-----------------------------------------', - ' Loaded %d Areas' % world_classes.Area.template_count, - ' Loaded %d Npc Templates' % handler_npc.Npc.template_count, - ' Loaded %d Item Templates' % handler_item.Items.template_count, - ' Loaded %d Room Templates' % handler_room.Room.template_count, - ' Loaded %d Shops' % len(instance.shop_templates), - ' Loaded %d Total Templates' % (world_classes.Area.template_count - + handler_npc.Npc.template_count - + handler_item.Items.template_count - + handler_room.Room.template_count), - '-----------------------------------------', - ' Loaded %d Resets' % world_classes.Reset.load_count, - '-----------------------------------------', - ' Loaded %d Area Instances' % world_classes.Area.instance_count, - ' Loaded %d Npc Instances' % handler_npc.Npc.instance_count, - ' Loaded %d Item Instances' % handler_item.Items.instance_count, - ' Loaded %d Room Instances' % handler_room.Room.instance_count, - ' Loaded %d Total Instances' % (world_classes.Area.instance_count - + handler_room.Room.instance_count - + handler_item.Items.instance_count - + handler_npc.Npc.instance_count), - '-----------------------------------------', - ' Loaded %d Help files' % len(merc.help_list), - ' Loaded %d Socials' % len(merc.social_list), - '-----------------------------------------', + "-----------------------------------------", + " Loaded %d Areas" % world_classes.Area.template_count, + " Loaded %d Npc Templates" % handler_npc.Npc.template_count, + " Loaded %d Item Templates" % handler_item.Items.template_count, + " Loaded %d Room Templates" % handler_room.Room.template_count, + " Loaded %d Shops" % len(instance.shop_templates), + " Loaded %d Total Templates" + % ( + world_classes.Area.template_count + + handler_npc.Npc.template_count + + handler_item.Items.template_count + + handler_room.Room.template_count + ), + "-----------------------------------------", + " Loaded %d Resets" % world_classes.Reset.load_count, + "-----------------------------------------", + " Loaded %d Area Instances" % world_classes.Area.instance_count, + " Loaded %d Npc Instances" % handler_npc.Npc.instance_count, + " Loaded %d Item Instances" % handler_item.Items.instance_count, + " Loaded %d Room Instances" % handler_room.Room.instance_count, + " Loaded %d Total Instances" + % ( + world_classes.Area.instance_count + + handler_room.Room.instance_count + + handler_item.Items.instance_count + + handler_npc.Npc.instance_count + ), + "-----------------------------------------", + " Loaded %d Help files" % len(merc.help_list), + " Loaded %d Socials" % len(merc.social_list), + "-----------------------------------------", ) - spaces = '\n' + ' ' * 51 + spaces = "\n" + " " * 51 logger.info(spaces.join(results)) def init_instance(): - #First lets add the bad terms we dont want to pass during instancing, while copying attributes - instance.not_to_instance.append('instance_id') - instance.not_to_instance.append('act') - fp = open(settings.INSTANCE_NUM_FILE, 'a') # in case the file doesnt exist open in append mode to not wipe + # First lets add the bad terms we dont want to pass during instancing, while copying attributes + instance.not_to_instance.append("instance_id") + instance.not_to_instance.append("act") + fp = open( + settings.INSTANCE_NUM_FILE, "a" + ) # in case the file doesnt exist open in append mode to not wipe fp.close() - fp = open(settings.INSTANCE_NUM_FILE, 'r') + fp = open(settings.INSTANCE_NUM_FILE, "r") junk, instance.max_instance_id = game_utils.read_int(fp.read()) fp.close() if instance.max_instance_id == 0 or not instance.max_instance_id: logger.info("First run, or problem with instance, setting 0") instance.max_instance_id = 0 else: - logger.info("Global Instance Tracker, instances thus far: %d", instance.max_instance_id) + logger.info( + "Global Instance Tracker, instances thus far: %d", instance.max_instance_id + ) def fix_exits(): @@ -85,7 +95,11 @@ def fix_exits(): for e in r.template_exit[:]: if e and type(e.template_to_room) == int: if e.template_to_room not in instance.room_templates: - logger.error("Fix_exits: Failed to find to_room for %d: %d", r.template_vnum, e.template_to_room) + logger.error( + "Fix_exits: Failed to find to_room for %d: %d", + r.template_vnum, + e.template_to_room, + ) e.template_to_room = None r.template_exit.remove(e) else: @@ -100,11 +114,15 @@ def area_update(): continue # # * Check age and reset. - #* Note: Mud School resets every 3 minutes (not 15). - #*/ - if (not area.empty and (area.character == 0 or area.age >= 15)) or area.age >= 31: + # * Note: Mud School resets every 3 minutes (not 15). + # */ + if ( + not area.empty and (area.character == 0 or area.age >= 15) + ) or area.age >= 31: reset_area(area) - handler_game.wiznet("%s has just been reset." % area.name, None, None, merc.WIZ_RESETS, 0, 0) + handler_game.wiznet( + "%s has just been reset." % area.name, None, None, merc.WIZ_RESETS, 0, 0 + ) area.age = random.randint(0, 3) school_instance_id = instance.instances_by_room[merc.ROOM_VNUM_SCHOOL][0] @@ -117,8 +135,8 @@ def area_update(): def m_reset(pReset, last, level, npc): if pReset.arg1 not in instance.npc_templates.keys(): - logger.error("Reset_area: 'M': bad vnum %d.", pReset.arg1) - return last, level, npc + logger.error("Reset_area: 'M': bad vnum %d.", pReset.arg1) + return last, level, npc else: npcTemplate = instance.npc_templates[pReset.arg1] @@ -181,11 +199,16 @@ def o_reset(pArea, pReset, last, level, npc): roomInstance_id = instance.instances_by_room[pReset.arg3][0] roomInstance = instance.global_instances[roomInstance_id] - if pArea.player_count > 0 or handler_item.count_obj_list(itemTemplate, roomInstance.items) > 0: + if ( + pArea.player_count > 0 + or handler_item.count_obj_list(itemTemplate, roomInstance.items) > 0 + ): last = False return last, level, npc - item = object_creator.create_item(itemTemplate, min(game_utils.number_fuzzy(level), merc.LEVEL_HERO - 1)) + item = object_creator.create_item( + itemTemplate, min(game_utils.number_fuzzy(level), merc.LEVEL_HERO - 1) + ) item.cost = 0 roomInstance.put(item) item = None @@ -217,20 +240,24 @@ def p_reset(pArea, pReset, last, level, npc): if item_to_list: item_to = instance.global_instances[item_to_list[0]] - if pArea.player_count > 0 \ - or not item_to \ - or (not item_to.in_room and not last) \ - or (itemTemplate.count >= limit and random.randint(0, 4) != 0) \ - or handler_item.count_obj_list(itemTemplate, item_to.inventory) > pReset.arg4: + if ( + pArea.player_count > 0 + or not item_to + or (not item_to.in_room and not last) + or (itemTemplate.count >= limit and random.randint(0, 4) != 0) + or handler_item.count_obj_list(itemTemplate, item_to.inventory) > pReset.arg4 + ): last = False return last, level, npc count = handler_item.count_obj_list(itemTemplate, item_to.inventory) - #Converted while to For Loop, testing indicated - #While loop was ~.002-.004 - #For loop ~.0009-.001 + # Converted while to For Loop, testing indicated + # While loop was ~.002-.004 + # For loop ~.0009-.001 if item_to: for i in range(pReset.arg4): - item = object_creator.create_item(itemTemplate, game_utils.number_fuzzy(item_to.level)) + item = object_creator.create_item( + itemTemplate, game_utils.number_fuzzy(item_to.level) + ) item_to.put(item) item = None count += 1 @@ -239,7 +266,7 @@ def p_reset(pArea, pReset, last, level, npc): if itemTemplate.count >= limit: break - # fix object lock state! */ + # fix object lock state! */ item_to.value[1] = item_toTemplate.value[1] last = True return last, level, npc @@ -252,7 +279,7 @@ def g_e_reset(pReset, last, level, npc): return last, level, npc else: itemTemplate = instance.item_templates[pReset.arg1] - #if not last: + # if not last: # continue if not npc: @@ -263,9 +290,11 @@ def g_e_reset(pReset, last, level, npc): olevel = 0 if instance.npc_templates[npc.vnum].pShop: if not itemTemplate.new_format: - if itemTemplate.item_type == merc.ITEM_PILL \ - or itemTemplate.item_type == merc.ITEM_POTION \ - or itemTemplate.item_type == merc.ITEM_SCROLL: + if ( + itemTemplate.item_type == merc.ITEM_PILL + or itemTemplate.item_type == merc.ITEM_POTION + or itemTemplate.item_type == merc.ITEM_SCROLL + ): olevel = 53 for i in itemTemplate.value: if i > 0: @@ -296,11 +325,13 @@ def g_e_reset(pReset, last, level, npc): limit = pReset.arg2 if itemTemplate.count < limit or random.randint(0, 4) == 0: - item = object_creator.create_item(itemTemplate, min(game_utils.number_fuzzy(level), merc.LEVEL_HERO - 1)) + item = object_creator.create_item( + itemTemplate, min(game_utils.number_fuzzy(level), merc.LEVEL_HERO - 1) + ) else: return last, level, npc npc.put(item) - if pReset.command == 'E': + if pReset.command == "E": npc.equip(item, True) item = None last = True @@ -349,22 +380,23 @@ def r_reset(pReset, last, level, npc): break return last, level, npc + def reset_area(pArea): npc = None last = True level = 0 for pReset in pArea.reset_list[:]: - if pReset.command.startswith('M'): + if pReset.command.startswith("M"): last, level, npc = m_reset(pReset, last, level, npc) - elif pReset.command.startswith('O'): + elif pReset.command.startswith("O"): last, level, npc = o_reset(pArea, pReset, last, level, npc) - elif pReset.command.startswith('P'): + elif pReset.command.startswith("P"): last, level, npc = p_reset(pArea, pReset, last, level, npc) - elif pReset.command.startswith('G') or pReset.command.startswith('E'): + elif pReset.command.startswith("G") or pReset.command.startswith("E"): last, level, npc = g_e_reset(pReset, last, level, npc) - elif pReset.command.startswith('D'): + elif pReset.command.startswith("D"): last, level, npc = d_reset(pReset, last, level, npc) - elif pReset.command.startswith('R'): + elif pReset.command.startswith("R"): last, level, npc = r_reset(pReset, last, level, npc) else: logger.error("Reset_area: bad command %c.", pReset.command) @@ -374,7 +406,6 @@ def reset_area(pArea): # * Create an instance of a mobile. - # # * Clear a new character. # */ diff --git a/src/rom24/effects.py b/src/rom24/effects.py index 80fb736..1bf6280 100644 --- a/src/rom24/effects.py +++ b/src/rom24/effects.py @@ -71,7 +71,11 @@ def acid_effect(vo, level, dam, target): chance -= item.level * 2 - if item.item_type == merc.ITEM_CONTAINER or item.item_type == merc.ITEM_CORPSE_PC or item.item_type == merc.ITEM_CORPSE_NPC: + if ( + item.item_type == merc.ITEM_CONTAINER + or item.item_type == merc.ITEM_CORPSE_PC + or item.item_type == merc.ITEM_CORPSE_NPC + ): msg = "$p fumes and dissolves." elif item.item_type == merc.ITEM_ARMOR: msg = "$p is pitted and etched." @@ -148,10 +152,14 @@ def cold_effect(vo, level, dam, target): # chill touch effect */ if not handler_magic.saves_spell(level / 4 + dam / 20, victim, merc.DAM_COLD): af = handler_game.AFFECT_DATA() - handler_game.act("$n turns blue and shivers.", victim, None, None, merc.TO_ROOM) - handler_game.act("A chill sinks deep into your bones.", victim, None, None, merc.TO_CHAR) + handler_game.act( + "$n turns blue and shivers.", victim, None, None, merc.TO_ROOM + ) + handler_game.act( + "A chill sinks deep into your bones.", victim, None, None, merc.TO_CHAR + ) af.where = merc.TO_AFFECTS - af.type = 'chill touch' + af.type = "chill touch" af.level = level af.duration = 6 af.location = merc.APPLY_STR @@ -170,9 +178,7 @@ def cold_effect(vo, level, dam, target): return if target == merc.TARGET_ITEM: # toast an object */ item = vo - if item.flags.burn_proof \ - or item.flags.no_purge \ - or random.randint(0, 4) == 0: + if item.flags.burn_proof or item.flags.no_purge or random.randint(0, 4) == 0: return chance = level // 4 + dam // 10 if chance > 25: @@ -216,13 +222,22 @@ def fire_effect(vo, level, dam, target): if target == merc.TARGET_CHAR: # do the effect on a victim */ victim = vo # chance of blindness */ - if not victim.is_affected(merc.AFF_BLIND) and not handler_magic.saves_spell(level / 4 + dam / 20, victim, - merc.DAM_FIRE): - handler_game.act("$n is blinded by smoke!", victim, None, None, merc.TO_ROOM) - handler_game.act("Your eyes tear up from smoke...you can't see a thing!", victim, None, None, merc.TO_CHAR) + if not victim.is_affected(merc.AFF_BLIND) and not handler_magic.saves_spell( + level / 4 + dam / 20, victim, merc.DAM_FIRE + ): + handler_game.act( + "$n is blinded by smoke!", victim, None, None, merc.TO_ROOM + ) + handler_game.act( + "Your eyes tear up from smoke...you can't see a thing!", + victim, + None, + None, + merc.TO_CHAR, + ) af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS - af.type = 'fire breath' + af.type = "fire breath" af.level = level af.duration = random.randint(0, level / 10) af.location = merc.APPLY_HITROLL @@ -312,14 +327,16 @@ def poison_effect(vo, level, dam, target): if target == merc.TARGET_CHAR: # do the effect on a victim */ victim = vo # chance of poisoning */ - if not handler_magic.saves_spell(level // 4 + dam // 20, victim, merc.DAM_POISON): + if not handler_magic.saves_spell( + level // 4 + dam // 20, victim, merc.DAM_POISON + ): af = handler_game.AFFECT_DATA() victim.send("You feel poison coursing through your veins.\n\r") handler_game.act("$n looks very ill.", victim, None, None, merc.TO_ROOM) af.where = merc.TO_AFFECTS - af.type = 'poison' + af.type = "poison" af.level = level af.duration = level // 2 af.location = merc.APPLY_STR @@ -371,7 +388,9 @@ def shock_effect(vo, level, dam, target): if target == merc.TARGET_CHAR: victim = vo # daze and confused? */ - if not handler_magic.saves_spell(level // 4 + dam // 20, victim, merc.DAM_LIGHTNING): + if not handler_magic.saves_spell( + level // 4 + dam // 20, victim, merc.DAM_LIGHTNING + ): victim.send("Your muscles stop responding.\n\r") state_checks.DAZE_STATE(victim, max(12, level // 4 + dam / 20)) # toast some gear */ @@ -396,8 +415,7 @@ def shock_effect(vo, level, dam, target): chance -= item.level * 2 - if item.item_type == merc.ITEM_WAND \ - or item.item_type == merc.ITEM_STAFF: + if item.item_type == merc.ITEM_WAND or item.item_type == merc.ITEM_STAFF: chance += 10 msg = "$p overloads and explodes!" elif item.item_type == merc.ITEM_JEWELRY: diff --git a/src/rom24/environment.py b/src/rom24/environment.py index be29f3b..b732943 100644 --- a/src/rom24/environment.py +++ b/src/rom24/environment.py @@ -13,10 +13,7 @@ class Environment: def __init__(self): - """ - - - """ + """ """ super().__init__() self._environment = None self.was_in_room = None @@ -39,7 +36,10 @@ def environment(self, input_value): elif type(input_value) is int: self._environment = input_value else: - raise TypeError('Environment trying to be set with non integer value %r' % type(input_value)) + raise TypeError( + "Environment trying to be set with non integer value %r" + % type(input_value) + ) @property def in_area(self): @@ -78,13 +78,13 @@ def in_item(self): return None def spread_plague(self, plague_carrier): - af = [af for af in plague_carrier.affected if af.type == 'plague'] + af = [af for af in plague_carrier.affected if af.type == "plague"] if not af: plague_carrier.affected_by.rem_bit(merc.AFF_PLAGUE) return af = af[0] if af.level == 1: - return + return plague = handler_game.AFFECT_DATA() plague.where = merc.TO_AFFECTS plague.type = "plague" @@ -94,13 +94,18 @@ def spread_plague(self, plague_carrier): plague.modifier = -5 plague.bitvector = merc.AFF_PLAGUE for vch_id in self.people[:]: - vch = instance.characters[vch_id] - if not handler_magic.saves_spell(plague.level - 2, vch, merc.DAM_DISEASE) \ - and not vch.is_immortal() and not vch.is_affected(merc.AFF_PLAGUE) \ - and random.randint(0, 5) == 0: - vch.send("You feel hot and feverish.\n\r") - handler_game.act("$n shivers and looks very ill.", vch, None, None, merc.TO_ROOM) - vch.affect_join(plague) + vch = instance.characters[vch_id] + if ( + not handler_magic.saves_spell(plague.level - 2, vch, merc.DAM_DISEASE) + and not vch.is_immortal() + and not vch.is_affected(merc.AFF_PLAGUE) + and random.randint(0, 5) == 0 + ): + vch.send("You feel hot and feverish.\n\r") + handler_game.act( + "$n shivers and looks very ill.", vch, None, None, merc.TO_ROOM + ) + vch.affect_join(plague) def is_room_owner(self, room): if not room.owner: @@ -116,7 +121,11 @@ def put(self, instance_object): pass def has_key(self, key): - instance_id = [item_id for item_id in self.items if instance.items[item_id].vnum == key.vnum] + instance_id = [ + item_id + for item_id in self.items + if instance.items[item_id].vnum == key.vnum + ] if instance_id: return True return False @@ -125,7 +134,12 @@ def has_key(self, key): # * Thanks to Tony Chamberlain for the correct recursive code here. def get_number(self): try: # if self is an item. - noweight = [merc.ITEM_CONTAINER, merc.ITEM_MONEY, merc.ITEM_GEM, merc.ITEM_JEWELRY] + noweight = [ + merc.ITEM_CONTAINER, + merc.ITEM_MONEY, + merc.ITEM_GEM, + merc.ITEM_JEWELRY, + ] if self.item_type in noweight: number = 0 else: @@ -139,8 +153,15 @@ def get_number(self): content = instance.items[content_id] number += 1 if content.instance_id in counted: - logger.debug("BUG: Objects contain eachother. %s(%d) - %s(%d)" % - (self.short_descr, self.instance_id, content.short_descr, content.instance_id)) + logger.debug( + "BUG: Objects contain eachother. %s(%d) - %s(%d)" + % ( + self.short_descr, + self.instance_id, + content.short_descr, + content.instance_id, + ) + ) break counted.append(content) contents.extend(content.inventory) @@ -156,8 +177,15 @@ def get_weight(item): for content_id in contents: content = instance.items[content_id] if content.instance_id in counted: - print("BUG: Objects contain eachother. %s(%d) - %s(%d)" % - (item.short_descr, item.instance_id, content.short_descr, content.instance_id)) + print( + "BUG: Objects contain eachother. %s(%d) - %s(%d)" + % ( + item.short_descr, + item.instance_id, + content.short_descr, + content.instance_id, + ) + ) break counted.append(content) contents.extend(content.inventory) @@ -174,4 +202,3 @@ def true_weight(item): content = instance.items[content_id] weight += content.get_weight() return weight - diff --git a/src/rom24/equipment.py b/src/rom24/equipment.py index 3a56653..335d12a 100644 --- a/src/rom24/equipment.py +++ b/src/rom24/equipment.py @@ -1,4 +1,4 @@ -__author__ = 'syn' +__author__ = "syn" import sys import json @@ -17,34 +17,45 @@ def __init__(self): self._equips_to = None self._equipped_to = None - def equip(self, item, replace: bool=False, verbose: bool=True, verbose_all: bool=True, to_loc: str=None): + def equip( + self, + item, + replace: bool = False, + verbose: bool = True, + verbose_all: bool = True, + to_loc: str = None, + ): pass - def unequip(self, unequip_from, replace: bool=True): + def unequip(self, unequip_from, replace: bool = True): pass class Equipped: - def __init__(self, equip_dict: dict=None): - self._equipped = collections.OrderedDict([('light', None), - ('left_finger', None), - ('right_finger', None), - ('neck', None), - ('collar', None), - ('body', None), - ('head', None), - ('legs', None), - ('feet', None), - ('hands', None), - ('arms', None), - ('about_body', None), - ('waist', None), - ('left_wrist', None), - ('right_wrist', None), - ('main_hand', None), - ('off_hand', None), - ('held', None), - ('float', None)]) + def __init__(self, equip_dict: dict = None): + self._equipped = collections.OrderedDict( + [ + ("light", None), + ("left_finger", None), + ("right_finger", None), + ("neck", None), + ("collar", None), + ("body", None), + ("head", None), + ("legs", None), + ("feet", None), + ("hands", None), + ("arms", None), + ("about_body", None), + ("waist", None), + ("left_wrist", None), + ("right_wrist", None), + ("main_hand", None), + ("off_hand", None), + ("held", None), + ("float", None), + ] + ) if equip_dict: for k, v in equip_dict.items(): self._equipped[k] = v @@ -63,7 +74,6 @@ def head(self): func_name = sys._getframe().f_code.co_name return instance.global_instances.get(self._equipped[func_name], None) - @property def neck(self): func_name = sys._getframe().f_code.co_name @@ -154,15 +164,15 @@ def to_json(self, outer_encoder=None): if outer_encoder is None: outer_encoder = json.JSONEncoder.default - cls_name = '__class__/' + __name__ + '.' + self.__class__.__name__ - return{cls_name: {'equipped': outer_encoder(self._equipped)}} + cls_name = "__class__/" + __name__ + "." + self.__class__.__name__ + return {cls_name: {"equipped": outer_encoder(self._equipped)}} @classmethod def from_json(cls, data, outer_decoder=None): if outer_decoder is None: outer_decoder = json.JSONDecoder.decode - cls_name = '__class__/' + __name__ + '.' + cls.__name__ + cls_name = "__class__/" + __name__ + "." + cls.__name__ if cls_name in data: - return cls(equip_dict=outer_decoder(data[cls_name]['equipped'])) + return cls(equip_dict=outer_decoder(data[cls_name]["equipped"])) return data diff --git a/src/rom24/fight.py b/src/rom24/fight.py index 39bef56..05bd89c 100644 --- a/src/rom24/fight.py +++ b/src/rom24/fight.py @@ -1,5 +1,3 @@ - - import logging import random @@ -40,7 +38,7 @@ def violence_update(): victim = ch.fighting # # * Fun for the whole family! - #*/ + # */ check_assist(ch, victim) ch_list = None return @@ -52,31 +50,53 @@ def check_assist(ch, victim): rch = instance.characters[rch_id] if state_checks.IS_AWAKE(rch) and rch.fighting is None: # quick check for ASSIST_PLAYER */ - if not ch.is_npc() and rch.is_npc() \ - and rch.off_flags.is_set(ASSIST_PLAYERS) \ - and rch.level + 6 > victim.level: + if ( + not ch.is_npc() + and rch.is_npc() + and rch.off_flags.is_set(ASSIST_PLAYERS) + and rch.level + 6 > victim.level + ): rch.do_emote("screams and attacks!") multi_hit(rch, victim, TYPE_UNDEFINED) continue # PCs next */ if not ch.is_npc() or ch.is_affected(AFF_CHARM): - if ((not rch.is_npc() and rch.act.is_set(PLR_AUTOASSIST)) - or rch.is_affected(AFF_CHARM)) \ - and ch.is_same_group(rch) \ - and not is_safe(rch, victim): + if ( + ( + (not rch.is_npc() and rch.act.is_set(PLR_AUTOASSIST)) + or rch.is_affected(AFF_CHARM) + ) + and ch.is_same_group(rch) + and not is_safe(rch, victim) + ): multi_hit(rch, victim, TYPE_UNDEFINED) continue # now check the NPC cases */ if ch.is_npc() and not ch.is_affected(AFF_CHARM): - if (rch.is_npc() and rch.off_flags.is_set(ASSIST_ALL)) \ - or (rch.is_npc() and rch.group and rch.group == ch.group) \ - or (rch.is_npc() and rch.race == ch.race and rch.off_flags.is_set(ASSIST_RACE)) \ - or (rch.is_npc() and rch.off_flags.is_set(ASSIST_ALIGN) - and ((rch.is_good() and ch.is_good()) or (rch.is_evil() - and ch.is_evil()) - or (rch.is_neutral() and ch.is_neutral()))) \ - or (rch.is_npc() and rch.vnum == ch.vnum and rch.off_flags.is_set(ASSIST_VNUM)): + if ( + (rch.is_npc() and rch.off_flags.is_set(ASSIST_ALL)) + or (rch.is_npc() and rch.group and rch.group == ch.group) + or ( + rch.is_npc() + and rch.race == ch.race + and rch.off_flags.is_set(ASSIST_RACE) + ) + or ( + rch.is_npc() + and rch.off_flags.is_set(ASSIST_ALIGN) + and ( + (rch.is_good() and ch.is_good()) + or (rch.is_evil() and ch.is_evil()) + or (rch.is_neutral() and ch.is_neutral()) + ) + ) + or ( + rch.is_npc() + and rch.vnum == ch.vnum + and rch.off_flags.is_set(ASSIST_VNUM) + ) + ): if random.randint(0, 1) == 0: continue @@ -84,7 +104,11 @@ def check_assist(ch, victim): number = 0 for vch_id in ch.in_room.people[:]: vch = instance.characters[vch_id] - if rch.can_see(vch) and vch.is_same_group(victim) and random.randint(0, number) == 0: + if ( + rch.can_see(vch) + and vch.is_same_group(victim) + and random.randint(0, number) == 0 + ): target = vch number += 1 if target: @@ -94,7 +118,7 @@ def check_assist(ch, victim): # * Do one group of attacks. def multi_hit(ch, victim, dt): - # no attacks for stunnies -- just a check */ + # no attacks for stunnies -- just a check */ if ch.position < POS_RESTING: return @@ -110,10 +134,10 @@ def multi_hit(ch, victim, dt): if ch.is_affected(AFF_HASTE): one_hit(ch, victim, dt) - if ch.fighting != victim or dt == 'backstab': + if ch.fighting != victim or dt == "backstab": return - chance = ch.get_skill('second attack') // 2 + chance = ch.get_skill("second attack") // 2 if ch.is_affected(AFF_SLOW): chance //= 2 @@ -121,11 +145,11 @@ def multi_hit(ch, victim, dt): if random.randint(1, 99) < chance: one_hit(ch, victim, dt) if ch.is_pc: - ch.check_improve('second attack', True, 5) + ch.check_improve("second attack", True, 5) if ch.fighting != victim: return - chance = ch.get_skill('third attack') // 4 + chance = ch.get_skill("third attack") // 4 if ch.is_affected(AFF_SLOW): chance = 0 @@ -133,8 +157,8 @@ def multi_hit(ch, victim, dt): if random.randint(1, 99) < chance: one_hit(ch, victim, dt) if ch.is_pc: - ch.check_improve('third attack', True, 6) - if ch.fighting != victim : + ch.check_improve("third attack", True, 6) + if ch.fighting != victim: return return @@ -151,12 +175,12 @@ def mob_hit(ch, victim, dt): if vch != victim and vch.fighting == ch: one_hit(ch, vch, dt) - if ch.is_affected(AFF_HASTE) \ - or (ch.off_flags.is_set(OFF_FAST) - and not ch.is_affected(AFF_SLOW)): + if ch.is_affected(AFF_HASTE) or ( + ch.off_flags.is_set(OFF_FAST) and not ch.is_affected(AFF_SLOW) + ): one_hit(ch, victim, dt) - if ch.fighting != victim or dt == 'backstab': + if ch.fighting != victim or dt == "backstab": return chance = ch.get_skill("second attack") // 2 @@ -168,7 +192,7 @@ def mob_hit(ch, victim, dt): one_hit(ch, victim, dt) if ch.fighting != victim: return - chance = ch.get_skill('third attack') // 4 + chance = ch.get_skill("third attack") // 4 if ch.is_affected(AFF_SLOW) and not ch.off_flags.is_set(OFF_FAST): chance = 0 @@ -190,7 +214,7 @@ def mob_hit(ch, victim, dt): if number == 2 and ch.act.is_set(ACT_CLERIC): pass - # { mob_cast_cleric(ch,victim) return } */ + # { mob_cast_cleric(ch,victim) return } */ # now for the skills */ @@ -203,10 +227,10 @@ def mob_hit(ch, victim, dt): if ch.off_flags.is_set(OFF_BERSERK) and not ch.is_affected(AFF_BERSERK): ch.do_berserk("") elif number == 2: - if ch.off_flags.is_set(OFF_DISARM) \ - or (ch.get_weapon_sn() != 'hand_to_hand' - and (ch.act.is_set(ACT_WARRIOR) - or ch.act.is_set(ACT_THIEF))): + if ch.off_flags.is_set(OFF_DISARM) or ( + ch.get_weapon_sn() != "hand_to_hand" + and (ch.act.is_set(ACT_WARRIOR) or ch.act.is_set(ACT_THIEF)) + ): ch.do_disarm("") elif number == 3: if ch.off_flags.is_set(OFF_KICK): @@ -216,7 +240,7 @@ def mob_hit(ch, victim, dt): ch.do_dirt("") elif number == 5: if ch.off_flags.is_set(OFF_TAIL): - pass # do_function(ch, &do_tail, "") */ + pass # do_function(ch, &do_tail, "") */ elif number == 6: if ch.off_flags.is_set(OFF_TRIP): ch.do_trip("") @@ -236,12 +260,12 @@ def one_hit(ch, victim, dt): if victim.instance_id == ch.instance_id or ch is None or victim is None: return # * Can't beat a dead char! - #* Guard against weird room-leavings. + # * Guard against weird room-leavings. if victim.position == POS_DEAD or ch.in_room != victim.in_room: return - #* Figure out the type of damage message. - wield = ch.get_eq('main_hand') + # * Figure out the type of damage message. + wield = ch.get_eq("main_hand") if dt == TYPE_UNDEFINED: dt = TYPE_HIT if wield and wield.item_type == ITEM_WEAPON: @@ -270,7 +294,7 @@ def one_hit(ch, victim, dt): sn = ch.get_weapon_sn() skill = 20 + ch.get_weapon_skill(sn) - #* Calculate to-hit-armor-guild-0 versus armor. + # * Calculate to-hit-armor-guild-0 versus armor. if ch.is_npc(): thac0_00 = 20 thac0_32 = -4 # as good as a thief */ @@ -297,8 +321,8 @@ def one_hit(ch, victim, dt): thac0 -= state_checks.GET_HITROLL(ch) * skill // 100 thac0 += 5 * (100 - skill) // 100 - if dt == 'backstab': - thac0 -= 10 * (100 - ch.get_skill('backstab')) + if dt == "backstab": + thac0 -= 10 * (100 - ch.get_skill("backstab")) if dam_type == DAM_PIERCE: victim_ac = state_checks.GET_AC(victim, AC_PIERCE) // 10 @@ -321,7 +345,7 @@ def one_hit(ch, victim, dt): if victim.position < POS_RESTING: victim_ac += 6 - #* The moment of excitement! + # * The moment of excitement! diceroll = random.randint(0, 19) if diceroll == 0 or (diceroll != 19 and diceroll < thac0 - victim_ac): # Miss. */ @@ -339,14 +363,16 @@ def one_hit(ch, victim, dt): else: if sn != -1: if ch.is_pc: - ch.check_improve( sn, True, 5) + ch.check_improve(sn, True, 5) if wield: if wield.new_format: dam = game_utils.dice(wield.value[1], wield.value[2]) * skill // 100 else: - dam = random.randint(wield.value[1] * skill // 100, wield.value[2] * skill // 100) + dam = random.randint( + wield.value[1] * skill // 100, wield.value[2] * skill // 100 + ) - if not ch.get_eq('off_hand'): # no shield = more */ + if not ch.get_eq("off_hand"): # no shield = more */ dam = dam * 11 // 10 # sharpness! */ if wield.flags.sharp: @@ -362,18 +388,18 @@ def one_hit(ch, victim, dt): dam = low # # * Bonuses. - if ch.get_skill('enhanced damage') > 0: + if ch.get_skill("enhanced damage") > 0: diceroll = random.randint(1, 99) - if diceroll <= ch.get_skill('enhanced damage'): + if diceroll <= ch.get_skill("enhanced damage"): if ch.is_pc: - ch.check_improve('enhanced damage', True, 6) + ch.check_improve("enhanced damage", True, 6) dam += 2 * (dam * diceroll // 300) if not state_checks.IS_AWAKE(victim): dam *= 2 elif victim.position < POS_FIGHTING: dam = dam * 3 // 2 - if dt == 'backstab' and wield: + if dt == "backstab" and wield: if wield.value[0] != 2: dam *= 2 + (ch.level // 10) else: @@ -389,17 +415,19 @@ def one_hit(ch, victim, dt): if result and wield is not None: if ch.fighting == victim and wield.flags.poison: - poison = state_checks.affect_find(wield.affected, 'poison') + poison = state_checks.affect_find(wield.affected, "poison") if poison: level = wield.level else: level = poison.level if not handler_magic.saves_spell(level // 2, victim, DAM_POISON): victim.send("You feel poison coursing through your veins.") - handler_game.act("$n is poisoned by the venom on $p.", victim, wield, None, TO_ROOM) + handler_game.act( + "$n is poisoned by the venom on $p.", victim, wield, None, TO_ROOM + ) af = handler_game.AFFECT_DATA() af.where = TO_AFFECTS - af.type = 'poison' + af.type = "poison" af.level = level * 3 // 4 af.duration = level // 2 af.location = APPLY_STR @@ -412,12 +440,16 @@ def one_hit(ch, victim, dt): poison.level = max(0, poison.level - 2) poison.duration = max(0, poison.duration - 1) if poison.level == 0 or poison.duration == 0: - handler_game.act("The poison on $p has worn off.", ch, wield, None, TO_CHAR) + handler_game.act( + "The poison on $p has worn off.", ch, wield, None, TO_CHAR + ) if ch.fighting == victim and wield.flags.vampiric: dam = random.randint(1, wield.level // 5 + 1) handler_game.act("$p draws life from $n.", victim, wield, None, TO_ROOM) - handler_game.act("You feel $p drawing your life away.", victim, wield, None, TO_CHAR) + handler_game.act( + "You feel $p drawing your life away.", victim, wield, None, TO_CHAR + ) damage(ch, victim, dam, 0, DAM_NEGATIVE, False) ch.alignment = max(-1000, ch.alignment - 1) ch.hit += dam // 2 @@ -430,13 +462,20 @@ def one_hit(ch, victim, dt): if ch.fighting == victim and wield.flags.frost: dam = random.randint(1, wield.level // 6 + 2) handler_game.act("$p freezes $n.", victim, wield, None, TO_ROOM) - handler_game.act("The cold touch of $p surrounds you with ice.", - victim, wield, None, TO_CHAR) + handler_game.act( + "The cold touch of $p surrounds you with ice.", + victim, + wield, + None, + TO_CHAR, + ) effects.cold_effect(victim, wield.level // 2, dam, TARGET_CHAR) damage(ch, victim, dam, 0, DAM_COLD, False) if ch.fighting == victim and wield.flags.shocking: dam = random.randint(1, wield.level // 5 + 2) - handler_game.act("$n is struck by lightning from $p.", victim, wield, None, TO_ROOM) + handler_game.act( + "$n is struck by lightning from $p.", victim, wield, None, TO_ROOM + ) handler_game.act("You are shocked by $p.", victim, wield, None, TO_CHAR) effects.shock_effect(victim, wield.level // 2, dam, TARGET_CHAR) damage(ch, victim, dam, 0, DAM_LIGHTNING, False) @@ -496,8 +535,10 @@ def damage(ch, victim, dam, dt, dam_type, show): if dam > 1 and victim.is_affected(AFF_SANCTUARY): dam //= 2 - if dam > 1 and ((victim.is_affected(AFF_PROTECT_EVIL) and ch.is_evil()) \ - or (victim.is_affected(AFF_PROTECT_GOOD) and ch.is_good() )): + if dam > 1 and ( + (victim.is_affected(AFF_PROTECT_EVIL) and ch.is_evil()) + or (victim.is_affected(AFF_PROTECT_GOOD) and ch.is_good()) + ): dam -= dam // 4 immune = False @@ -532,13 +573,27 @@ def damage(ch, victim, dam, dt, dam_type, show): update_pos(victim) if victim.position == POS_MORTAL: - handler_game.act("$n is mortally wounded, and will die soon, if not aided.", victim, None, None, TO_ROOM) + handler_game.act( + "$n is mortally wounded, and will die soon, if not aided.", + victim, + None, + None, + TO_ROOM, + ) victim.send("You are mortally wounded, and will die soon, if not aided.\n\r") elif victim.position == POS_INCAP: - handler_game.act("$n is incapacitated and will slowly die, if not aided.", victim, None, None, TO_ROOM) + handler_game.act( + "$n is incapacitated and will slowly die, if not aided.", + victim, + None, + None, + TO_ROOM, + ) victim.send("You are incapacitated and will slowly die, if not aided.\n\r") elif victim.position == POS_STUNNED: - handler_game.act("$n is stunned, but will probably recover.", victim, None, None, TO_ROOM) + handler_game.act( + "$n is stunned, but will probably recover.", victim, None, None, TO_ROOM + ) victim.send("You are stunned, but will probably recover.\n\r") elif victim.position == POS_DEAD: handler_game.act("$n is DEAD!!", victim, 0, 0, TO_ROOM) @@ -557,17 +612,34 @@ def damage(ch, victim, dam, dt, dam_type, show): group_gain(ch, victim) if not victim.is_npc(): - logger.warn("%s killed by %s at %d", victim.name, ch.short_descr if ch.is_npc() else ch.name, - ch.in_room.vnum) + logger.warn( + "%s killed by %s at %d", + victim.name, + ch.short_descr if ch.is_npc() else ch.name, + ch.in_room.vnum, + ) # Dying penalty: # 2/3 way back to previous level. if victim.exp > victim.exp_per_level(victim.points) * victim.level: - update.gain_exp(victim, (2 * (victim.exp_per_level(victim.points) - * victim.level - victim.exp) // 3) + 50) - - log_buf = "%s got toasted by %s at %s [[room %d]]" % (victim.short_descr if victim.is_npc() else victim.name, - ch.short_descr if ch.is_npc() else ch.name, - ch.in_room.name, ch.in_room.vnum) + update.gain_exp( + victim, + ( + 2 + * ( + victim.exp_per_level(victim.points) * victim.level + - victim.exp + ) + // 3 + ) + + 50, + ) + + log_buf = "%s got toasted by %s at %s [[room %d]]" % ( + victim.short_descr if victim.is_npc() else victim.name, + ch.short_descr if ch.is_npc() else ch.name, + ch.in_room.name, + ch.in_room.vnum, + ) if victim.is_npc(): handler_game.wiznet(log_buf, None, None, WIZ_MOBDEATHS, 0, 0) @@ -584,11 +656,23 @@ def damage(ch, victim, dam, dt, dam_type, show): # RT new auto commands */ corpse = ch.get_item_list("corpse", ch.in_room.items) - if not ch.is_npc() and corpse and corpse.item_type == ITEM_CORPSE_NPC and ch.can_see_item(corpse.instance_id): - if ch.act.is_set(PLR_AUTOLOOT) and corpse and corpse.inventory: # exists and not empty */ + if ( + not ch.is_npc() + and corpse + and corpse.item_type == ITEM_CORPSE_NPC + and ch.can_see_item(corpse.instance_id) + ): + if ( + ch.act.is_set(PLR_AUTOLOOT) and corpse and corpse.inventory + ): # exists and not empty */ ch.do_get("all corpse") - if ch.act.is_set(PLR_AUTOGOLD) and corpse and corpse.inventory and not ch.act.is_set(PLR_AUTOLOOT): + if ( + ch.act.is_set(PLR_AUTOGOLD) + and corpse + and corpse.inventory + and not ch.act.is_set(PLR_AUTOLOOT) + ): coins = ch.get_item_list("gcash", corpse.inventory) if coins: ch.do_get("all.gcash corpse") @@ -603,7 +687,7 @@ def damage(ch, victim, dam, dt, dam_type, show): if victim == ch: return True - #* Take care of link dead people. + # * Take care of link dead people. if not victim.is_npc() and victim.desc is None: if random.randint(0, victim.wait) == 0: victim.do_recall("") @@ -611,13 +695,22 @@ def damage(ch, victim, dam, dt, dam_type, show): # * Wimp out? if victim.is_npc() and dam > 0 and victim.wait < PULSE_VIOLENCE // 2: - if (victim.act.is_set(ACT_WIMPY) and random.randint(0, 4) == 0 - and victim.hit < victim.max_hit // 5) \ - or (victim.is_affected(AFF_CHARM) and victim.master - and instance.characters[victim.master].in_room != victim.in_room): + if ( + victim.act.is_set(ACT_WIMPY) + and random.randint(0, 4) == 0 + and victim.hit < victim.max_hit // 5 + ) or ( + victim.is_affected(AFF_CHARM) + and victim.master + and instance.characters[victim.master].in_room != victim.in_room + ): victim.do_flee("") - if not victim.is_npc() and 0 < victim.hit <= victim.wimpy and victim.wait < PULSE_VIOLENCE // 2: + if ( + not victim.is_npc() + and 0 < victim.hit <= victim.wimpy + and victim.wait < PULSE_VIOLENCE // 2 + ): victim.do_flee("") return True @@ -639,16 +732,20 @@ def is_safe(ch, victim): ch.send("The shopkeeper wouldn't like that.\n") return True # no killing healers, trainers, etc */ - if victim.act.is_set(ACT_TRAIN) \ - or victim.act.is_set(ACT_PRACTICE) \ - or victim.act.is_set(ACT_IS_HEALER) \ - or victim.act.is_set(ACT_IS_CHANGER): + if ( + victim.act.is_set(ACT_TRAIN) + or victim.act.is_set(ACT_PRACTICE) + or victim.act.is_set(ACT_IS_HEALER) + or victim.act.is_set(ACT_IS_CHANGER) + ): ch.send("I don't think Mota would approve.\n") return True if not ch.is_npc(): # no pets */ if victim.act.is_set(ACT_PET): - handler_game.act("But $N looks so cute and cuddly...", ch, None, victim, TO_CHAR) + handler_game.act( + "But $N looks so cute and cuddly...", ch, None, victim, TO_CHAR + ) return True # no charmed creatures unless owner */ @@ -665,8 +762,7 @@ def is_safe(ch, victim): return True # charmed mobs and pets cannot attack players while owned */ - if ch.is_affected(AFF_CHARM) and ch.master \ - and ch.master.fighting != victim: + if ch.is_affected(AFF_CHARM) and ch.master and ch.master.fighting != victim: ch.send("Players are your friends!\n") return True # player doing the killing */ @@ -705,17 +801,21 @@ def is_safe_spell(ch, victim, area): if victim.pShop: return True # no killing healers, trainers, etc */ - if victim.act.is_set(ACT_TRAIN) \ - or victim.act.is_set(ACT_PRACTICE) \ - or victim.act.is_set(ACT_IS_HEALER) \ - or victim.act.is_set(ACT_IS_CHANGER): + if ( + victim.act.is_set(ACT_TRAIN) + or victim.act.is_set(ACT_PRACTICE) + or victim.act.is_set(ACT_IS_HEALER) + or victim.act.is_set(ACT_IS_CHANGER) + ): return True if not ch.is_npc(): # no pets */ if victim.act.is_set(ACT_PET): return True # no charmed creatures unless owner */ - if victim.is_affected(AFF_CHARM) and (area or ch.instance_id != victim.master): + if victim.is_affected(AFF_CHARM) and ( + area or ch.instance_id != victim.master + ): return True # legal kill? -- cannot hit mob fighting non-group member */ if victim.fighting is not None and not ch.is_same_group(victim.fighting): @@ -732,8 +832,11 @@ def is_safe_spell(ch, victim, area): # NPC doing the killing */ if ch.is_npc(): # charmed mobs and pets cannot attack players while owned */ - if state_checks.IS_AFFECTED(ch, AFF_CHARM) and ch.master \ - and instance.characters[ch.master].fighting != victim: + if ( + state_checks.IS_AFFECTED(ch, AFF_CHARM) + and ch.master + and instance.characters[ch.master].fighting != victim + ): return True # safe room? */ if state_checks.IS_SET(victim.in_room.room_flags, ROOM_SAFE): @@ -772,8 +875,11 @@ def check_killer(ch, victim): # Charm-o-rama. if ch.affected_by.is_set(AFF_CHARM): if ch.master is None: - logger.warn("BUG: Check_killer: %s bad AFF_CHARM", ch.short_descr if ch.is_npc() else ch.name) - ch.affect_strip('charm person') + logger.warn( + "BUG: Check_killer: %s bad AFF_CHARM", + ch.short_descr if ch.is_npc() else ch.name, + ) + ch.affect_strip("charm person") ch.affected_by.rem_bit(AFF_CHARM) return # send_to_char( "*** You are now a KILLER!! ***\n", ch.master ) @@ -785,13 +891,21 @@ def check_killer(ch, victim): # Hitting yourself is cool too (bleeding). # So is being immortal (Alander's idea). # And current killers stay as they are. - if ch.is_npc() or ch == victim or ch.level >= LEVEL_IMMORTAL \ - or not ch.is_clan() or ch.act.is_set(PLR_KILLER) or ch.fighting == victim: + if ( + ch.is_npc() + or ch == victim + or ch.level >= LEVEL_IMMORTAL + or not ch.is_clan() + or ch.act.is_set(PLR_KILLER) + or ch.fighting == victim + ): return ch.send("*** You are now a KILLER!! ***\n") state_checks.SET_BIT(ch.act, PLR_KILLER) - handler_game.wiznet("$N is attempting to murder %s" % victim.name, ch, None, WIZ_FLAGS, 0, 0) + handler_game.wiznet( + "$N is attempting to murder %s" % victim.name, ch, None, WIZ_FLAGS, 0, 0 + ) ch.save(force=True) return @@ -800,9 +914,9 @@ def check_killer(ch, victim): def check_parry(ch, victim): if state_checks.IS_AWAKE(victim): return False - chance = victim.get_skill('parry') // 2 + chance = victim.get_skill("parry") // 2 - if not ch.get_eq('main_hand'): + if not ch.get_eq("main_hand"): if victim.is_npc(): chance //= 2 else: @@ -815,7 +929,7 @@ def check_parry(ch, victim): handler_game.act("You parry $n's attack.", ch, None, victim, TO_VICT) handler_game.act("$N parries your attack.", ch, None, victim, TO_CHAR) - skills.check_improve(victim, 'parry', True, 6) + skills.check_improve(victim, "parry", True, 6) return True @@ -823,14 +937,16 @@ def check_parry(ch, victim): def check_shield_block(ch, victim): if not state_checks.IS_AWAKE(victim): return False - chance = victim.get_skill('shield block') // 5 + 3 - if not ch.get_eq('off_hand'): + chance = victim.get_skill("shield block") // 5 + 3 + if not ch.get_eq("off_hand"): return False if random.randint(1, 99) >= chance + victim.level - ch.level: return False - handler_game.act("You block $n's attack with your shield.", ch, None, victim, TO_VICT) + handler_game.act( + "You block $n's attack with your shield.", ch, None, victim, TO_VICT + ) handler_game.act("$N blocks your attack with a shield.", ch, None, victim, TO_CHAR) - skills.check_improve(victim, 'shield block', True, 6) + skills.check_improve(victim, "shield block", True, 6) return True @@ -838,14 +954,14 @@ def check_shield_block(ch, victim): def check_dodge(ch, victim): if not state_checks.IS_AWAKE(victim): return False - chance = victim.get_skill('dodge') // 2 + chance = victim.get_skill("dodge") // 2 if not victim.can_see(ch): chance //= 2 if random.randint(1, 99) >= chance + victim.level - ch.level: return False handler_game.act("You dodge $n's attack.", ch, None, victim, TO_VICT) handler_game.act("$N dodges your attack.", ch, None, victim, TO_CHAR) - skills.check_improve(victim, 'dodge', True, 6) + skills.check_improve(victim, "dodge", True, 6) return True @@ -877,7 +993,7 @@ def set_fighting(ch, victim): return if ch.is_affected(AFF_SLEEP): - ch.affect_strip('sleep') + ch.affect_strip("sleep") ch.fighting = victim ch.position = POS_FIGHTING @@ -898,7 +1014,9 @@ def stop_fighting(ch, fBoth): def make_corpse(ch): if ch.is_npc(): name = ch.short_descr - corpse = object_creator.create_item(instance.item_templates[OBJ_VNUM_CORPSE_NPC], 0) + corpse = object_creator.create_item( + instance.item_templates[OBJ_VNUM_CORPSE_NPC], 0 + ) corpse.timer = random.randint(3, 6) if ch.gold > 0: corpse.put(object_creator.create_money(ch.gold, ch.silver)) @@ -907,7 +1025,9 @@ def make_corpse(ch): corpse.cost = 0 else: name = ch.name - corpse = object_creator.create_item(instance.item_templates[OBJ_VNUM_CORPSE_PC], 0) + corpse = object_creator.create_item( + instance.item_templates[OBJ_VNUM_CORPSE_PC], 0 + ) corpse.timer = random.randint(25, 40) ch.act.rem_bit(PLR_CANLOOT) if not ch.is_clan(): @@ -949,7 +1069,13 @@ def make_corpse(ch): elif floating: if item.flags.rot_death: # get rid of it! */ if item.inventory: - handler_game.act("$p evaporates,scattering its contents.", ch, item, None, TO_ROOM) + handler_game.act( + "$p evaporates,scattering its contents.", + ch, + item, + None, + TO_ROOM, + ) for contents_id in item.inventory[:]: contents = instance.items[contents_id] item.get(contents) @@ -1045,7 +1171,7 @@ def raw_kill(victim): victim.extract(True) return if victim.in_room: - victim.in_room.get(victim) + victim.in_room.get(victim) victim.extract(False) for af in victim.affected[:]: victim.affect_remove(af) @@ -1092,18 +1218,21 @@ def group_gain(ch, victim): if gch.level - lch.level <= -5: gch.send("You are too low for this group.\n") continue - #*/ + # */ xp = xp_compute(gch, victim, group_levels) gch.send("You receive %d experience points.\n" % xp) update.gain_exp(gch, xp) - #equipment + # equipment for item_id in ch.equipped.values(): if not item_id: continue item = instance.items[item_id] - if (item.flags.anti_evil and ch.is_evil()) or (item.flags.anti_good and ch.is_good()) \ - or (item.flags.anti_neutral and ch.is_neutral()): + if ( + (item.flags.anti_evil and ch.is_evil()) + or (item.flags.anti_good and ch.is_good()) + or (item.flags.anti_neutral and ch.is_neutral()) + ): handler_game.act("You are zapped by $p.", ch, item, None, TO_CHAR) handler_game.act("$n is zapped by $p.", ch, item, None, TO_ROOM) ch.unequip(item.equipped_to, False) @@ -1160,7 +1289,7 @@ def xp_compute(gch, victim, total_levels): change = max(1, change) gch.alignment = max(-1000, gch.alignment - change) elif align < -500: # monster is more evil than slayer */ - change = ( -1 * align - 500) * base_exp // 500 * gch.level // total_levels + change = (-1 * align - 500) * base_exp // 500 * gch.level // total_levels change = max(1, change) gch.alignment = min(1000, gch.alignment + change) else: # improve this someday */ @@ -1229,7 +1358,9 @@ def xp_compute(gch, victim, total_levels): xp = 15 * xp // (gch.level - 25) # reduce for playing time */ # compute quarter-hours per level */ - time_per_level = 4 * (gch.played + int(current_time - gch.logon)) // 3600 // gch.level + time_per_level = ( + 4 * (gch.played + int(current_time - gch.logon)) // 3600 // gch.level + ) time_per_level = max(2, min(time_per_level, 12)) if gch.level < 15: # make it a curve */ time_per_level = max(time_per_level, (15 - gch.level)) @@ -1251,50 +1382,50 @@ def dam_message(ch, victim, dam, dt, immune): damnum = "" if dam == 0: - msg = {'vs': "miss", 'vp': "misses"} + msg = {"vs": "miss", "vp": "misses"} elif dam <= 4: - msg = {'vs': "scratch", 'vp': "scratches"} + msg = {"vs": "scratch", "vp": "scratches"} elif dam <= 8: - msg = {'vs': "graze", 'vp': "grazes"} + msg = {"vs": "graze", "vp": "grazes"} elif dam <= 12: - msg = {'vs': "hit", 'vp': "hits"} + msg = {"vs": "hit", "vp": "hits"} elif dam <= 16: - msg = {'vs': "injure", 'vp': "injures"} + msg = {"vs": "injure", "vp": "injures"} elif dam <= 20: - msg = {'vs': "wound", 'vp': "wounds"} + msg = {"vs": "wound", "vp": "wounds"} elif dam <= 24: - msg = {'vs': "maul", 'vp': "mauls"} + msg = {"vs": "maul", "vp": "mauls"} elif dam <= 28: - msg = {'vs': "decimate", 'vp': "decimates"} + msg = {"vs": "decimate", "vp": "decimates"} elif dam <= 32: - msg = {'vs': "devastate", 'vp': "devastates"} + msg = {"vs": "devastate", "vp": "devastates"} elif dam <= 36: - msg = {'vs': "maim", 'vp': "maims"} + msg = {"vs": "maim", "vp": "maims"} elif dam <= 40: - msg = {'vs': "MUTILATE", 'vp': "MUTILATES"} + msg = {"vs": "MUTILATE", "vp": "MUTILATES"} elif dam <= 44: - msg = {'vs': "DISEMBOWEL", 'vp': "DISEMBOWELS"} + msg = {"vs": "DISEMBOWEL", "vp": "DISEMBOWELS"} elif dam <= 48: - msg = {'vs': "DISMEMBER", 'vp': "DISMEMBERS"} + msg = {"vs": "DISMEMBER", "vp": "DISMEMBERS"} elif dam <= 52: - msg = {'vs': "MASSACRE", 'vp': "MASSACRES"} + msg = {"vs": "MASSACRE", "vp": "MASSACRES"} elif dam <= 56: - msg = {'vs': "MANGLE", 'vp': "MANGLES"} + msg = {"vs": "MANGLE", "vp": "MANGLES"} elif dam <= 60: - msg = {'vs': "*** DEMOLISH ***", 'vp': "*** DEMOLISHES ***"} + msg = {"vs": "*** DEMOLISH ***", "vp": "*** DEMOLISHES ***"} elif dam <= 75: - msg = {'vs': "*** DEVASTATE ***", 'vp': "*** DEVASTATES ***"} + msg = {"vs": "*** DEVASTATE ***", "vp": "*** DEVASTATES ***"} elif dam <= 100: - msg = {'vs': "=== OBLITERATE ===", 'vp': "=== OBLITERATES ==="} + msg = {"vs": "=== OBLITERATE ===", "vp": "=== OBLITERATES ==="} elif dam <= 125: - msg = {'vs': ">>> ANNIHILATE <<<", 'vp': ">>> ANNIHILATES <<<"} + msg = {"vs": ">>> ANNIHILATE <<<", "vp": ">>> ANNIHILATES <<<"} elif dam <= 150: - msg = {'vs': "<<< ERADICATE >>>", 'vp': "<<< ERADICATES >>>"} + msg = {"vs": "<<< ERADICATE >>>", "vp": "<<< ERADICATES >>>"} else: - msg = {'vs': "do UNSPEAKABLE things to", 'vp': "does UNSPEAKABLE things to"} - vs = msg['vs'] - vp = msg['vp'] - punct = '.' if dam <= 24 else '!' + msg = {"vs": "do UNSPEAKABLE things to", "vp": "does UNSPEAKABLE things to"} + vs = msg["vs"] + vp = msg["vp"] + punct = "." if dam <= 24 else "!" if dt == TYPE_HIT: if ch == victim: buf1 = "$n %s $melf%c%s" % (vp, punct, damnum) @@ -1351,16 +1482,25 @@ def disarm(ch, victim): if item.flags.no_remove: handler_game.act("$S weapon won't budge!", ch, None, victim, TO_CHAR) - handler_game.act("$n tries to disarm you, but your weapon won't budge!", ch, None, victim, TO_VICT) - handler_game.act("$n tries to disarm $N, but fails.", ch, None, victim, TO_NOTVICT) + handler_game.act( + "$n tries to disarm you, but your weapon won't budge!", + ch, + None, + victim, + TO_VICT, + ) + handler_game.act( + "$n tries to disarm $N, but fails.", ch, None, victim, TO_NOTVICT + ) return - handler_game.act("$n DISARMS you and sends your weapon flying!", ch, None, victim, TO_VICT) + handler_game.act( + "$n DISARMS you and sends your weapon flying!", ch, None, victim, TO_VICT + ) handler_game.act("You disarm $N!", ch, None, victim, TO_CHAR) handler_game.act("$n disarms $N!", ch, None, victim, TO_NOTVICT) - victim.unequip('main_hand') + victim.unequip("main_hand") if not item.flags.no_drop or item.flags.shop_inventory: victim.in_room.put(item) if victim.is_npc() and victim.wait == 0 and victim.can_see_item(item): handler_item.get_item(victim, item, None) return - diff --git a/src/rom24/game_utils.py b/src/rom24/game_utils.py index 183689b..1ca1c4a 100644 --- a/src/rom24/game_utils.py +++ b/src/rom24/game_utils.py @@ -1,4 +1,4 @@ -__author__ = 'syn' +__author__ = "syn" import os import re @@ -14,11 +14,17 @@ from rom24 import instance -def find_instance_file(instance_id: int=None, from_char_dir: str=None, from_world: bool=False): +def find_instance_file( + instance_id: int = None, from_char_dir: str = None, from_world: bool = False +): if not instance_id: return None if from_char_dir: - pathname = os.path.join(settings.PLAYER_DIR, from_char_dir[0].capitalize(), from_char_dir.capitalize()) + pathname = os.path.join( + settings.PLAYER_DIR, + from_char_dir[0].capitalize(), + from_char_dir.capitalize(), + ) for start, directories, file in os.walk(pathname): if str(instance_id) in file: return os.path.join(start, directories, file) @@ -45,12 +51,12 @@ def old_read_word(pstr, lower=True): if locate == 0: return "", "" if pstr[0] == "'": - locate = pstr.find("'", 1)+1 + locate = pstr.find("'", 1) + 1 if locate == 0: locate = len(pstr) unmatch = True elif pstr[0] == '"': - locate = pstr.find('"', 1)+1 + locate = pstr.find('"', 1) + 1 if locate == 0: locate = len(pstr) unmatch = True @@ -76,7 +82,7 @@ def old_read_word(pstr, lower=True): def read_word(pstr, to_lower=True): if not pstr: - return '', '' + return "", "" start = None end = None @@ -92,7 +98,7 @@ def read_word(pstr, to_lower=True): end = quote else: end = len(pstr) - return pstr[end + 1:], pstr[start:end] + return pstr[end + 1 :], pstr[start:end] elif c == '"' and start is None: start = i + 1 quote = pstr.find('"', i + 1) @@ -100,7 +106,7 @@ def read_word(pstr, to_lower=True): end = quote else: end = len(pstr) - return pstr[end + 1:], pstr[start:end] + return pstr[end + 1 :], pstr[start:end] elif c.isspace(): if start is not None: end = i @@ -121,7 +127,7 @@ def read_int(pstr): number = "" negative = False for c in pstr: - if c == '-': + if c == "-": negative = True elif c.isdigit(): number += c @@ -130,10 +136,10 @@ def read_int(pstr): pstr = pstr.lstrip() if not negative: - pstr = pstr[len(number):] + pstr = pstr[len(number) :] return pstr, int(number) else: - pstr = pstr[len(number) + 1:] + pstr = pstr[len(number) + 1 :] number = int(number) * -1 return pstr, number @@ -141,9 +147,9 @@ def read_int(pstr): def read_string(pstr): if not pstr: return None, None - end = pstr.find('~') + end = pstr.find("~") word = pstr[0:end] - pstr = pstr[end + 1:] + pstr = pstr[end + 1 :] return pstr, word.strip() @@ -151,7 +157,7 @@ def read_flags(pstr): if not pstr: return None, None pstr, w = read_word(pstr, False) - if w == '0' or w == 0: + if w == "0" or w == 0: return pstr, 0 if w.isdigit(): return pstr, int(w) @@ -159,15 +165,15 @@ def read_flags(pstr): for c in w: flag = 0 - if 'A' <= c <= 'Z': + if "A" <= c <= "Z": flag = merc.A - while c != 'A': + while c != "A": flag *= 2 c = chr(ord(c) - 1) - elif 'a' <= c <= 'z': + elif "a" <= c <= "z": flag = merc.aa - while c != 'a': + while c != "a": flag *= 2 c = chr(ord(c) - 1) @@ -176,11 +182,11 @@ def read_flags(pstr): def read_equipment_flags(item, pstr): - ret_set = {''} + ret_set = {""} if not pstr: return None, None pstr, w = read_word(pstr, False) - if w == '0' or w == 0: + if w == "0" or w == 0: return pstr, ret_set if w.isdigit(): return pstr, ret_set @@ -197,226 +203,228 @@ def read_equipment_flags(item, pstr): return pstr, ret_set -def item_bitvector_flag_str(bits: int, in_type='extra flags'): +def item_bitvector_flag_str(bits: int, in_type="extra flags"): if not bits or not in_type: return None if bits == 0: return None - if 'wear flags' in in_type: + if "wear flags" in in_type: if bits & merc.ITEM_TAKE: - return 'take' + return "take" elif bits & merc.ITEM_WEAR_FINGER: - return 'left_finger, right_finger' + return "left_finger, right_finger" elif bits & merc.ITEM_WEAR_NECK: - return 'neck, collar' + return "neck, collar" elif bits & merc.ITEM_WEAR_BODY: - return 'body' + return "body" elif bits & merc.ITEM_WEAR_HEAD: - return 'head' + return "head" elif bits & merc.ITEM_WEAR_LEGS: - return 'legs' + return "legs" elif bits & merc.ITEM_WEAR_FEET: - return 'feet' + return "feet" elif bits & merc.ITEM_WEAR_HANDS: - return 'hands' + return "hands" elif bits & merc.ITEM_WEAR_ARMS: - return 'arms' + return "arms" elif bits & merc.ITEM_WEAR_SHIELD: - return 'off_hand' + return "off_hand" elif bits & merc.ITEM_WEAR_ABOUT: - return 'about_body' + return "about_body" elif bits & merc.ITEM_WEAR_WAIST: - return 'waist' + return "waist" elif bits & merc.ITEM_WEAR_WRIST: - return 'left_wrist, right_wrist' + return "left_wrist, right_wrist" elif bits & merc.ITEM_WIELD: - return 'main_hand' + return "main_hand" elif bits & merc.ITEM_HOLD: - return 'held' + return "held" elif bits & merc.ITEM_NO_SAC: - return 'no_sac' + return "no_sac" elif bits & merc.ITEM_WEAR_FLOAT: - return 'float' + return "float" else: return None - if 'extra flags' in in_type: + if "extra flags" in in_type: if bits & merc.ITEM_GLOW: - return 'glow' + return "glow" elif bits & merc.ITEM_HUM: - return 'hum' + return "hum" elif bits & merc.ITEM_DARK: - return 'dark' + return "dark" elif bits & merc.ITEM_LOCK: - return 'lock' + return "lock" elif bits & merc.ITEM_EVIL: - return 'evil' + return "evil" elif bits & merc.ITEM_INVIS: - return 'invis' + return "invis" elif bits & merc.ITEM_MAGIC: - return 'magic' + return "magic" elif bits & merc.ITEM_NODROP: - return 'no_drop' + return "no_drop" elif bits & merc.ITEM_BLESS: - return 'bless' + return "bless" elif bits & merc.ITEM_ANTI_GOOD: - return 'anti_good' + return "anti_good" elif bits & merc.ITEM_ANTI_EVIL: - return 'anti_evil' + return "anti_evil" elif bits & merc.ITEM_ANTI_NEUTRAL: - return 'anti_neutral' + return "anti_neutral" elif bits & merc.ITEM_NOREMOVE: - return 'no_remove' + return "no_remove" elif bits & merc.ITEM_INVENTORY: - return 'inventory' + return "inventory" elif bits & merc.ITEM_NOPURGE: - return 'no_purge' + return "no_purge" elif bits & merc.ITEM_ROT_DEATH: - return 'rot_death' + return "rot_death" elif bits & merc.ITEM_VIS_DEATH: - return 'vis_death' + return "vis_death" elif bits & merc.ITEM_NONMETAL: - return 'non_metal' + return "non_metal" elif bits & merc.ITEM_NOLOCATE: - return 'no_locate' + return "no_locate" elif bits & merc.ITEM_MELT_DROP: - return 'melt_drop' + return "melt_drop" elif bits & merc.ITEM_HAD_TIMER: - return 'had_timer' + return "had_timer" elif bits & merc.ITEM_SELL_EXTRACT: - return 'sell_extract' + return "sell_extract" elif bits & merc.ITEM_BURN_PROOF: - return 'burn_proof' + return "burn_proof" elif bits & merc.ITEM_NOUNCURSE: - return 'no_uncurse' + return "no_uncurse" else: return None - if 'weapon flags' in in_type: + if "weapon flags" in in_type: if bits & merc.WEAPON_FLAMING: - return 'flaming' + return "flaming" elif bits & merc.WEAPON_FROST: - return 'frost' + return "frost" elif bits & merc.WEAPON_VAMPIRIC: - return 'vampiric' + return "vampiric" elif bits & merc.WEAPON_SHARP: - return 'sharp' + return "sharp" elif bits & merc.WEAPON_VORPAL: - return 'vorpal' + return "vorpal" elif bits & merc.WEAPON_TWO_HANDS: - return 'two_handed' + return "two_handed" elif bits & merc.WEAPON_SHOCKING: - return 'shocking' + return "shocking" elif bits & merc.WEAPON_POISON: - return 'poison' + return "poison" else: return None -def item_flags_from_bits(bits: int, out_data: collections.namedtuple, in_type='wear flags'): +def item_flags_from_bits( + bits: int, out_data: collections.namedtuple, in_type="wear flags" +): if not out_data or not bits or not in_type: return None if bits == 0: return None - if 'wear flags' in in_type: + if "wear flags" in in_type: if bits & merc.ITEM_TAKE: - out_data.attributes.update({'take'}) + out_data.attributes.update({"take"}) if bits & merc.ITEM_WEAR_FINGER: - out_data.slots.update({'left_finger', 'right_finger'}) + out_data.slots.update({"left_finger", "right_finger"}) if bits & merc.ITEM_WEAR_NECK: - out_data.slots.update({'neck', 'collar'}) + out_data.slots.update({"neck", "collar"}) if bits & merc.ITEM_WEAR_BODY: - out_data.slots.update({'body'}) + out_data.slots.update({"body"}) if bits & merc.ITEM_WEAR_HEAD: - out_data.slots.update({'head'}) + out_data.slots.update({"head"}) if bits & merc.ITEM_WEAR_LEGS: - out_data.slots.update({'legs'}) + out_data.slots.update({"legs"}) if bits & merc.ITEM_WEAR_FEET: - out_data.slots.update({'feet'}) + out_data.slots.update({"feet"}) if bits & merc.ITEM_WEAR_HANDS: - out_data.slots.update({'hands'}) + out_data.slots.update({"hands"}) if bits & merc.ITEM_WEAR_ARMS: - out_data.slots.update({'arms'}) + out_data.slots.update({"arms"}) if bits & merc.ITEM_WEAR_SHIELD: - out_data.slots.update({'off_hand'}) + out_data.slots.update({"off_hand"}) if bits & merc.ITEM_WEAR_ABOUT: - out_data.slots.update({'about_body'}) + out_data.slots.update({"about_body"}) if bits & merc.ITEM_WEAR_WAIST: - out_data.slots.update({'waist'}) + out_data.slots.update({"waist"}) if bits & merc.ITEM_WEAR_WRIST: - out_data.slots.update({'left_wrist', 'right_wrist'}) + out_data.slots.update({"left_wrist", "right_wrist"}) if bits & merc.ITEM_WIELD: - out_data.slots.update({'main_hand'}) + out_data.slots.update({"main_hand"}) if bits & merc.ITEM_HOLD: - out_data.slots.update({'held'}) + out_data.slots.update({"held"}) if bits & merc.ITEM_NO_SAC: - out_data.restrictions.update({'no_sac'}) + out_data.restrictions.update({"no_sac"}) if bits & merc.ITEM_WEAR_FLOAT: - out_data.slots.update({'float'}) - if 'extra flags' in in_type: + out_data.slots.update({"float"}) + if "extra flags" in in_type: if bits & merc.ITEM_GLOW: - out_data.attributes.update({'glow'}) + out_data.attributes.update({"glow"}) if bits & merc.ITEM_HUM: - out_data.attributes.update({'hum'}) + out_data.attributes.update({"hum"}) if bits & merc.ITEM_DARK: - out_data.attributes.update({'dark'}) + out_data.attributes.update({"dark"}) if bits & merc.ITEM_LOCK: - out_data.attributes.update({'lock'}) + out_data.attributes.update({"lock"}) if bits & merc.ITEM_EVIL: - out_data.attributes.update({'evil'}) + out_data.attributes.update({"evil"}) if bits & merc.ITEM_INVIS: - out_data.attributes.update({'invis'}) + out_data.attributes.update({"invis"}) if bits & merc.ITEM_MAGIC: - out_data.attributes.update({'magic'}) + out_data.attributes.update({"magic"}) if bits & merc.ITEM_NODROP: - out_data.restrictions.update({'no_drop'}) + out_data.restrictions.update({"no_drop"}) if bits & merc.ITEM_BLESS: - out_data.attributes.update({'bless'}) + out_data.attributes.update({"bless"}) if bits & merc.ITEM_ANTI_GOOD: - out_data.restrictions.update({'anti_good'}) + out_data.restrictions.update({"anti_good"}) if bits & merc.ITEM_ANTI_EVIL: - out_data.restrictions.update({'anti_evil'}) + out_data.restrictions.update({"anti_evil"}) if bits & merc.ITEM_ANTI_NEUTRAL: - out_data.restrictions.update({'anti_neutral'}) + out_data.restrictions.update({"anti_neutral"}) if bits & merc.ITEM_NOREMOVE: - out_data.restrictions.update({'no_remove'}) + out_data.restrictions.update({"no_remove"}) if bits & merc.ITEM_INVENTORY: - out_data.attributes.update({'inventory'}) + out_data.attributes.update({"inventory"}) if bits & merc.ITEM_NOPURGE: - out_data.restrictions.update({'no_purge'}) + out_data.restrictions.update({"no_purge"}) if bits & merc.ITEM_ROT_DEATH: - out_data.attributes.update({'rot_death'}) + out_data.attributes.update({"rot_death"}) if bits & merc.ITEM_VIS_DEATH: - out_data.attributes.update({'vis_death'}) + out_data.attributes.update({"vis_death"}) if bits & merc.ITEM_NONMETAL: - out_data.attributes.update({'non_metal'}) + out_data.attributes.update({"non_metal"}) if bits & merc.ITEM_NOLOCATE: - out_data.restrictions.update({'no_locate'}) + out_data.restrictions.update({"no_locate"}) if bits & merc.ITEM_MELT_DROP: - out_data.attributes.update({'melt_drop'}) + out_data.attributes.update({"melt_drop"}) if bits & merc.ITEM_HAD_TIMER: - out_data.attributes.update({'had_timer'}) + out_data.attributes.update({"had_timer"}) if bits & merc.ITEM_SELL_EXTRACT: - out_data.attributes.update({'sell_extract'}) + out_data.attributes.update({"sell_extract"}) if bits & merc.ITEM_BURN_PROOF: - out_data.attributes.update({'burn_proof'}) + out_data.attributes.update({"burn_proof"}) if bits & merc.ITEM_NOUNCURSE: - out_data.restrictions.update({'no_uncurse'}) - if 'weapon flags' in in_type: + out_data.restrictions.update({"no_uncurse"}) + if "weapon flags" in in_type: if bits & merc.WEAPON_FLAMING: - out_data.weapon.update({'flaming'}) + out_data.weapon.update({"flaming"}) if bits & merc.WEAPON_FROST: - out_data.weapon.update({'frost'}) + out_data.weapon.update({"frost"}) if bits & merc.WEAPON_VAMPIRIC: - out_data.weapon.update({'vampiric'}) + out_data.weapon.update({"vampiric"}) if bits & merc.WEAPON_SHARP: - out_data.weapon.update({'sharp'}) + out_data.weapon.update({"sharp"}) if bits & merc.WEAPON_VORPAL: - out_data.weapon.update({'vorpal'}) + out_data.weapon.update({"vorpal"}) if bits & merc.WEAPON_TWO_HANDS: - out_data.weapon.update({'two_handed'}) + out_data.weapon.update({"two_handed"}) if bits & merc.WEAPON_SHOCKING: - out_data.weapon.update({'shocking'}) + out_data.weapon.update({"shocking"}) if bits & merc.WEAPON_POISON: - out_data.weapon.update({'poison'}) + out_data.weapon.update({"poison"}) def find_location(ch, arg): @@ -443,10 +451,11 @@ def append_file(ch, fp, pstr): def read_to_eol(pstr): - locate = pstr.find('\n') + locate = pstr.find("\n") if locate == -1: locate = len(pstr) - return pstr[locate+1:], pstr[:locate] + return pstr[locate + 1 :], pstr[:locate] + def old_is_name(arg, name): name, tmp = read_word(name) @@ -458,7 +467,8 @@ def old_is_name(arg, name): name, tmp = read_word(name) return False -_breakup = re.compile('(\".*?\"|\'.*?\'|[^\s]+)') + +_breakup = re.compile("(\".*?\"|'.*?'|[^\s]+)") def is_name(arg, name): @@ -486,14 +496,14 @@ def number_fuzzy(number): def number_argument(argument): if not argument: return 1, "" - if '.' not in argument: + if "." not in argument: return 1, argument - dot = argument.find('.') + dot = argument.find(".") number = argument[:dot] if number.isdigit(): - return int(number), argument[dot + 1:] + return int(number), argument[dot + 1 :] else: - return 1, argument[dot + 1:] + return 1, argument[dot + 1 :] # * Simple linear interpolation. @@ -511,11 +521,11 @@ def mass_replace(pstr, pdict): def set_title(ch, title): if ch.is_npc(): return - nospace = ['.', ',', '!', '?'] + nospace = [".", ",", "!", "?"] if title[0] in nospace: ch.title = title else: - ch.title = ' ' + title + ch.title = " " + title def get_mob_id(): @@ -540,35 +550,35 @@ def argument_parser(arg_string): num_or_count = None arg_num = 1 - if '' is arg_string: + if "" is arg_string: return None, None, None, None arg_string = arg_string.lstrip() - if '#' in arg_string: - if arg_string[0] == '#': - atype = 'instance_id' - target = arg_string.replace('#', '') + if "#" in arg_string: + if arg_string[0] == "#": + atype = "instance_id" + target = arg_string.replace("#", "") return atype, num_or_count, arg_num, int(target) else: return None # Funky id request - elif '.' in arg_string or '*' in arg_string: - if '*' in arg_string: - sep = arg_string.find('*') - num_or_count = 'count' + elif "." in arg_string or "*" in arg_string: + if "*" in arg_string: + sep = arg_string.find("*") + num_or_count = "count" else: - sep = arg_string.find('.') - num_or_count = 'number' + sep = arg_string.find(".") + num_or_count = "number" arg_num = arg_string[:sep] - target = arg_string[sep + 1:] + target = arg_string[sep + 1 :] if '"' in target or "'" in target: - if num_or_count == 'number': - atype = 'number_compound' + if num_or_count == "number": + atype = "number_compound" else: - atype = 'count_compound' + atype = "count_compound" compound_set = set({}) if '"' in target: - target = target.replace('"', '') + target = target.replace('"', "") else: target = target.replace("'", "") compound, word = read_word(target, True) @@ -577,11 +587,11 @@ def argument_parser(arg_string): compound, word = read_word(compound) compound_set |= {word} return atype, num_or_count, arg_num, compound_set - elif ' ' in target and re.match("^[a-zA-Z ]*$", target): - if num_or_count == 'number': - atype = 'number_compound' + elif " " in target and re.match("^[a-zA-Z ]*$", target): + if num_or_count == "number": + atype = "number_compound" else: - atype = 'count_compound' + atype = "count_compound" compound_set = set({}) compound, word = read_word(target, True) compound_set |= {word} @@ -592,26 +602,26 @@ def argument_parser(arg_string): if not arg_num.isdigit(): arg_num = 1 if target.isdigit(): - if num_or_count == 'number': - atype = 'number_vnum' + if num_or_count == "number": + atype = "number_vnum" else: - atype = 'count_vnum' + atype = "count_vnum" return atype, num_or_count, arg_num, int(target) elif target.isalpha(): - if num_or_count == 'number': - atype = 'number_word' + if num_or_count == "number": + atype = "number_word" else: - atype = 'count_word' + atype = "count_word" return atype, num_or_count, arg_num, target else: return None, None, None, None elif arg_string.isdigit(): - atype = 'vnum' + atype = "vnum" return atype, None, arg_num, int(arg_string) elif arg_string.isalpha(): - atype = 'word' + atype = "word" return atype, None, arg_num, arg_string elif re.match("^[a-zA-Z ]*$", arg_string): @@ -621,7 +631,7 @@ def argument_parser(arg_string): while len(compound) > 0: compound, word = read_word(compound) compound_set |= {word} - atype = 'compound' + atype = "compound" return atype, num_or_count, arg_num, compound_set elif not arg_string.isalnum(): @@ -631,7 +641,9 @@ def argument_parser(arg_string): return None, None, None, None -def object_search(ch, template: bool=False, obj_type: str=None, target_package: tuple=None): +def object_search( + ch, template: bool = False, obj_type: str = None, target_package: tuple = None +): if not obj_type: try: return find_character(ch, template, target_package) @@ -644,56 +656,67 @@ def object_search(ch, template: bool=False, obj_type: str=None, target_package: except: return None - if 'character' in obj_type: + if "character" in obj_type: return find_character(ch, template, target_package) - elif 'room' in obj_type: + elif "room" in obj_type: return find_room(ch, template, target_package) - elif 'item' in obj_type: + elif "item" in obj_type: return find_item(ch, template, target_package) def find_character(ch, template, target_package): atype, num_or_count, arg_num, target = target_package if ch.in_room: - room_inventory_list = [npc_id for npc_id in ch.in_room.people[:] - if instance.characters[npc_id].vnum == target] - if room_inventory_list: - try: - return instance.characters[room_inventory_list[arg_num - 1]] - except: - room_inventory_list = None - else: - npc_id = instance.instances_by_npc[target][arg_num - 1] - if npc_id: - return instance.characters[npc_id] + room_inventory_list = [ + npc_id + for npc_id in ch.in_room.people[:] + if instance.characters[npc_id].vnum == target + ] + if room_inventory_list: + try: + return instance.characters[room_inventory_list[arg_num - 1]] + except: + room_inventory_list = None + else: + npc_id = instance.instances_by_npc[target][arg_num - 1] + if npc_id: + return instance.characters[npc_id] + def find_room(ch, template, target_package): atype, num_or_count, arg_num, target = target_package if isinstance(target, int): - trash = '' - try: - room_id = instance.instances_by_room[target][arg_num - 1] - return instance.rooms[room_id] - except: - trash = 'onion bagels!' - if trash: - try: - return instance.rooms[target] - except: - return None + trash = "" + try: + room_id = instance.instances_by_room[target][arg_num - 1] + return instance.rooms[room_id] + except: + trash = "onion bagels!" + if trash: + try: + return instance.rooms[target] + except: + return None + def find_item(ch, template, target_package): - #TODO change instance dicts to ordered dicts to support searches with predictable results. + # TODO change instance dicts to ordered dicts to support searches with predictable results. atype, num_or_count, arg_num, target = target_package - bagels = '' - sorted(sorted(instance.rooms.keys(), key=lambda x: instance.rooms[x].vnum), key=lambda x: instance.rooms[x].instance_id) + bagels = "" + sorted( + sorted(instance.rooms.keys(), key=lambda x: instance.rooms[x].vnum), + key=lambda x: instance.rooms[x].instance_id, + ) combined_inventory = ch.inventory + ch.in_room.items - if 'vnum' in atype: + if "vnum" in atype: if combined_inventory: - final_item = [instance.items[item_id] for item_id in combined_inventory - if instance.items[item_id].vnum == target][arg_num - 1] + final_item = [ + instance.items[item_id] + for item_id in combined_inventory + if instance.items[item_id].vnum == target + ][arg_num - 1] if final_item: return final_item elif ch.is_immortal(): @@ -701,21 +724,20 @@ def find_item(ch, template, target_package): return instance.items.get(item_id, None) else: return None - elif 'instance' in atype: + elif "instance" in atype: return instance.items.get(target, None) - elif 'number' in atype: + elif "number" in atype: pass else: - if 'vnum' in atype: + if "vnum" in atype: if ch.is_immortal(): try: - #temp + # temp return instance.items[None] except: return None - def to_integer(s: str): try: return int(s) diff --git a/src/rom24/handler_ch.py b/src/rom24/handler_ch.py index 21755fc..e17ffb6 100644 --- a/src/rom24/handler_ch.py +++ b/src/rom24/handler_ch.py @@ -1,4 +1,3 @@ - import collections import random import logging @@ -31,14 +30,21 @@ def move_char(ch, door, follow): ch.send("Alas, you cannot go that way.\n") return to_room = instance.rooms[pexit.to_room] - if pexit.exit_info.is_set(merc.EX_CLOSED) \ - and (not ch.is_affected(merc.AFF_PASS_DOOR) - or pexit.exit_info.is_set(merc.EX_NOPASS)) \ - and not state_checks.IS_TRUSTED(ch, merc.L7): + if ( + pexit.exit_info.is_set(merc.EX_CLOSED) + and ( + not ch.is_affected(merc.AFF_PASS_DOOR) + or pexit.exit_info.is_set(merc.EX_NOPASS) + ) + and not state_checks.IS_TRUSTED(ch, merc.L7) + ): handler_game.act("The $d is closed.", ch, None, pexit.keyword, merc.TO_CHAR) return - if ch.is_affected(merc.AFF_CHARM) \ - and ch.master and in_room == instance.characters[ch.master].in_room: + if ( + ch.is_affected(merc.AFF_CHARM) + and ch.master + and in_room == instance.characters[ch.master].in_room + ): ch.send("What? And leave your beloved master?\n") return if not ch.is_room_owner(to_room) and to_room.is_private(): @@ -53,22 +59,27 @@ def move_char(ch, door, follow): if guild != ch.guild and to_room.instance_id == room.instance_id: ch.send("You aren't allowed in there.\n") return - if in_room.sector_type == merc.SECT_AIR \ - or to_room.sector_type == merc.SECT_AIR: - if not ch.is_affected(merc.AFF_FLYING) \ - and not ch.is_immortal(): + if in_room.sector_type == merc.SECT_AIR or to_room.sector_type == merc.SECT_AIR: + if not ch.is_affected(merc.AFF_FLYING) and not ch.is_immortal(): ch.send("You can't fly.\n") return - if (in_room.sector_type == merc.SECT_WATER_NOSWIM - or to_room.sector_type == merc.SECT_WATER_NOSWIM) \ - and not ch.is_affected(merc.AFF_FLYING): + if ( + in_room.sector_type == merc.SECT_WATER_NOSWIM + or to_room.sector_type == merc.SECT_WATER_NOSWIM + ) and not ch.is_affected(merc.AFF_FLYING): # Look for a boat. - boats = [item_id for item_id in ch.inventory if instance.items[item_id].item_type == merc.ITEM_BOAT] + boats = [ + item_id + for item_id in ch.inventory + if instance.items[item_id].item_type == merc.ITEM_BOAT + ] if not boats and not ch.is_immortal(): ch.send("You need a boat to go there.\n") return - move = merc.movement_loss[min(merc.SECT_MAX - 1, in_room.sector_type)] + merc.movement_loss[ - min(merc.SECT_MAX - 1, to_room.sector_type)] + move = ( + merc.movement_loss[min(merc.SECT_MAX - 1, in_room.sector_type)] + + merc.movement_loss[min(merc.SECT_MAX - 1, to_room.sector_type)] + ) move /= 2 # i.e. the average */ # conditional effects */ if ch.is_affected(merc.AFF_FLYING) or ch.is_affected(merc.AFF_HASTE): @@ -80,11 +91,15 @@ def move_char(ch, door, follow): return state_checks.WAIT_STATE(ch, 1) ch.move -= move - if not ch.is_affected(merc.AFF_SNEAK) and (not ch.is_npc() and ch.invis_level < merc.LEVEL_HERO): + if not ch.is_affected(merc.AFF_SNEAK) and ( + not ch.is_npc() and ch.invis_level < merc.LEVEL_HERO + ): handler_game.act("$n leaves $T.", ch, None, merc.dir_name[door], merc.TO_ROOM) ch.in_room.get(ch) to_room.put(ch) - if not ch.is_affected(merc.AFF_SNEAK) and (not ch.is_npc() and ch.invis_level < merc.LEVEL_HERO): + if not ch.is_affected(merc.AFF_SNEAK) and ( + not ch.is_npc() and ch.invis_level < merc.LEVEL_HERO + ): handler_game.act("$n has arrived.", ch, None, None, merc.TO_ROOM) ch.do_look("auto") if in_room.instance_id == to_room.instance_id: # no circular follows */ @@ -92,16 +107,27 @@ def move_char(ch, door, follow): for fch_id in in_room.people[:]: fch = instance.characters[fch_id] - if fch.master == ch.instance_id and fch.is_affected(merc.AFF_CHARM) and fch.position < merc.POS_STANDING: + if ( + fch.master == ch.instance_id + and fch.is_affected(merc.AFF_CHARM) + and fch.position < merc.POS_STANDING + ): fch.do_stand("") - if fch.master == ch.instance_id and fch.position == merc.POS_STANDING \ - and fch.can_see_room(to_room.instance_id): - if state_checks.IS_SET(ch.in_room.room_flags, merc.ROOM_LAW) \ - and (fch.is_npc() - and fch.act.is_set(merc.ACT_AGGRESSIVE)): - handler_game.act("You can't bring $N into the city.", ch, None, fch, merc.TO_CHAR) - handler_game.act("You aren't allowed in the city.", fch, None, None, merc.TO_CHAR) + if ( + fch.master == ch.instance_id + and fch.position == merc.POS_STANDING + and fch.can_see_room(to_room.instance_id) + ): + if state_checks.IS_SET(ch.in_room.room_flags, merc.ROOM_LAW) and ( + fch.is_npc() and fch.act.is_set(merc.ACT_AGGRESSIVE) + ): + handler_game.act( + "You can't bring $N into the city.", ch, None, fch, merc.TO_CHAR + ) + handler_game.act( + "You aren't allowed in the city.", fch, None, None, merc.TO_CHAR + ) continue handler_game.act("You follow $N.", fch, None, ch, merc.TO_CHAR) move_char(fch, door, True) @@ -124,7 +150,13 @@ def nuke_pets(ch): if ch.pet: stop_follower(ch.pet) if instance.characters[ch.pet].in_room: - handler_game.act("$N slowly fades away.", ch, None, instance.characters[ch.pet], merc.TO_NOTVICT) + handler_game.act( + "$N slowly fades away.", + ch, + None, + instance.characters[ch.pet], + merc.TO_NOTVICT, + ) instance.characters[ch.pet].extract(True) ch.pet = None return @@ -152,11 +184,23 @@ def stop_follower(ch): if ch.is_affected(merc.AFF_CHARM): ch.affected_by.rem_bit(merc.AFF_CHARM) - ch.affect_strip('charm person') + ch.affect_strip("charm person") if instance.characters[ch.master].can_see(ch) and ch.in_room: - handler_game.act("$n stops following you.", ch, None, instance.characters[ch.master], merc.TO_VICT) - handler_game.act("You stop following $N.", ch, None, instance.characters[ch.master], merc.TO_CHAR) + handler_game.act( + "$n stops following you.", + ch, + None, + instance.characters[ch.master], + merc.TO_VICT, + ) + handler_game.act( + "You stop following $N.", + ch, + None, + instance.characters[ch.master], + merc.TO_CHAR, + ) if instance.characters[ch.master].pet == ch.instance_id: instance.characters[ch.master].pet = None ch.master = None @@ -174,19 +218,19 @@ def show_list_to_char(clist, ch, fShort, fShowNothing): for item_id in clist: item = instance.items[item_id] if ch.can_see_item(item): - #logger.trace("Showing an item") - frmt = handler_item.format_item_to_char(item, ch, fShort) - if frmt not in item_dict: - item_dict[frmt] = 1 - else: - item_dict[frmt] += 1 + # logger.trace("Showing an item") + frmt = handler_item.format_item_to_char(item, ch, fShort) + if frmt not in item_dict: + item_dict[frmt] = 1 + else: + item_dict[frmt] += 1 if not item_dict and fShowNothing: if ch.is_npc() or ch.comm.is_set(merc.COMM_COMBINE): ch.send(" ") ch.send("Nothing.\n") - #* Output the formatted list. + # * Output the formatted list. for desc, count in item_dict.items(): if ch.is_npc() or ch.comm.is_set(merc.COMM_COMBINE) and count > 1: ch.send("(%2d) %s\n" % (count, desc)) @@ -196,7 +240,7 @@ def show_list_to_char(clist, ch, fShort, fShowNothing): def show_char_to_char_0(victim, ch): - buf = '' + buf = "" if victim.comm.is_set(merc.COMM_AFK): buf += "[[AFK]] " if victim.is_affected(merc.AFF_INVISIBLE): @@ -230,8 +274,12 @@ def show_char_to_char_0(victim, ch): return buf += state_checks.PERS(victim, ch) - if not victim.is_npc() and not ch.comm.is_set(merc.COMM_BRIEF) \ - and victim.position == merc.POS_STANDING and not ch.on: + if ( + not victim.is_npc() + and not ch.comm.is_set(merc.COMM_BRIEF) + and victim.position == merc.POS_STANDING + and not ch.on + ): buf += victim.title if victim.position == merc.POS_DEAD: @@ -313,7 +361,9 @@ def show_char_to_char_1(victim, ch): if victim.description: ch.send(victim.description + "\n") else: - handler_game.act("You see nothing special about $M.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "You see nothing special about $M.", ch, None, victim, merc.TO_CHAR + ) if victim.max_hit > 0: percent = (100 * victim.hit) // victim.max_hit else: @@ -344,17 +394,24 @@ def show_char_to_char_1(victim, ch): item = instance.items[instance_id] if item: if ch.can_see_item(item): - if item.flags.two_handed and victim.equipped['off_hand'] == item.instance_id and 'off_hand' in location: + if ( + item.flags.two_handed + and victim.equipped["off_hand"] == item.instance_id + and "off_hand" in location + ): continue else: if ch.can_see_item(item): ch.send(merc.eq_slot_strings[location]) ch.send(handler_item.format_item_to_char(item, ch, True) + "\n") - if victim != ch and not ch.is_npc() \ - and random.randint(1, 99) < ch.get_skill("peek"): + if ( + victim != ch + and not ch.is_npc() + and random.randint(1, 99) < ch.get_skill("peek") + ): ch.send("\nYou peek at the inventory:\n") if ch.is_pc: - ch.check_improve('peek', True, 4) + ch.check_improve("peek", True, 4) show_list_to_char(victim.inventory, ch, True, True) return diff --git a/src/rom24/handler_game.py b/src/rom24/handler_game.py index 4d190ee..eff07f5 100644 --- a/src/rom24/handler_game.py +++ b/src/rom24/handler_game.py @@ -1,5 +1,4 @@ - -__author__ = 'syn' +__author__ = "syn" import copy import json @@ -57,7 +56,7 @@ def to_json(self, outer_encoder=None): else: tmp_dict[k] = v - cls_name = '__class__/' + __name__ + '.' + self.__class__.__name__ + cls_name = "__class__/" + __name__ + "." + self.__class__.__name__ return {cls_name: outer_encoder(tmp_dict)} @classmethod @@ -65,7 +64,7 @@ def from_json(cls, data, outer_decoder=None): if outer_decoder is None: outer_decoder = json.JSONDecoder.decode - cls_name = '__class__/' + __name__ + '.' + cls.__name__ + cls_name = "__class__/" + __name__ + "." + cls.__name__ if cls_name in data: tmp_data = outer_decoder(data[cls_name]) return cls(**tmp_data) @@ -97,10 +96,14 @@ def __init__(self): self.sky = 0 self.sunlight = 0 + time_info = time_info_data() weather_info = weather_data() -def act(format, ch, arg1=None, arg2=None, send_to=merc.TO_ROOM, min_pos=merc.POS_RESTING): + +def act( + format, ch, arg1=None, arg2=None, send_to=merc.TO_ROOM, min_pos=merc.POS_RESTING +): if not format: return if not ch or not ch.in_room: @@ -110,11 +113,13 @@ def act(format, ch, arg1=None, arg2=None, send_to=merc.TO_ROOM, min_pos=merc.POS obj1 = arg1 obj2 = arg2 - he_she = ["it", "he", "she"] - him_her = ["it", "him", "her"] + he_she = ["it", "he", "she"] + him_her = ["it", "him", "her"] his_her = ["its", "his", "her"] - to_players = [instance.characters[instance_id] for instance_id in ch.in_room.people[:]] + to_players = [ + instance.characters[instance_id] for instance_id in ch.in_room.people[:] + ] if send_to is merc.TO_VICT: if not vch: @@ -122,7 +127,9 @@ def act(format, ch, arg1=None, arg2=None, send_to=merc.TO_ROOM, min_pos=merc.POS return if not vch.in_room: return - to_players = [instance.characters[instance_id] for instance_id in ch.in_room.people[:]] + to_players = [ + instance.characters[instance_id] for instance_id in ch.in_room.people[:] + ] for to in to_players: if not to.desc or to.position < min_pos: @@ -138,42 +145,47 @@ def act(format, ch, arg1=None, arg2=None, send_to=merc.TO_ROOM, min_pos=merc.POS act_trans = {} if arg1: - act_trans['$t'] = str(arg1) + act_trans["$t"] = str(arg1) if arg2 and type(arg2) == str: - act_trans['$T'] = str(arg2) + act_trans["$T"] = str(arg2) if ch: - act_trans['$n'] = state_checks.PERS(ch, to) - act_trans['$e'] = he_she[ch.sex] - act_trans['$m'] = him_her[ch.sex] - act_trans['$s'] = his_her[ch.sex] + act_trans["$n"] = state_checks.PERS(ch, to) + act_trans["$e"] = he_she[ch.sex] + act_trans["$m"] = him_her[ch.sex] + act_trans["$s"] = his_her[ch.sex] if vch and isinstance(vch, living.Living): - act_trans['$N'] = state_checks.PERS(vch, to) - act_trans['$E'] = he_she[vch.sex] - act_trans['$M'] = him_her[vch.sex] - act_trans['$S'] = his_her[vch.sex] + act_trans["$N"] = state_checks.PERS(vch, to) + act_trans["$E"] = he_she[vch.sex] + act_trans["$M"] = him_her[vch.sex] + act_trans["$S"] = his_her[vch.sex] if obj1 and obj1.__class__ == handler_item.Items: - act_trans['$p'] = state_checks.OPERS(to, obj1) + act_trans["$p"] = state_checks.OPERS(to, obj1) if obj2 and obj2.__class__ == handler_item.Items: - act_trans['$P'] = state_checks.OPERS(to, obj2) - act_trans['$d'] = arg2 if not arg2 else "door" + act_trans["$P"] = state_checks.OPERS(to, obj2) + act_trans["$d"] = arg2 if not arg2 else "door" format = game_utils.mass_replace(format, act_trans) - to.send(format+"\n") + to.send(format + "\n") return -def wiznet( string, ch, obj, flag, flag_skip, min_level): + +def wiznet(string, ch, obj, flag, flag_skip, min_level): from rom24.nanny import con_playing + for d in merc.descriptor_list: - if d.is_connected(con_playing) \ - and d.character.is_immortal() \ - and d.character.wiznet.is_set(merc.WIZ_ON) \ - and (not flag or d.character.wiznet.is_set(flag)) \ - and (not flag_skip or not d.character.wiznet.set(flag_skip)) \ - and d.character.trust >= min_level \ - and d.character != ch: + if ( + d.is_connected(con_playing) + and d.character.is_immortal() + and d.character.wiznet.is_set(merc.WIZ_ON) + and (not flag or d.character.wiznet.is_set(flag)) + and (not flag_skip or not d.character.wiznet.set(flag_skip)) + and d.character.trust >= min_level + and d.character != ch + ): if d.character.wiznet.set_bit(merc.WIZ_PREFIX): - d.send("-. ",d.character) - act(string,d.character,obj,ch, merc.TO_CHAR, merc.POS_DEAD) + d.send("-. ", d.character) + act(string, d.character, obj, ch, merc.TO_CHAR, merc.POS_DEAD) + # does aliasing and other fun stuff */ def substitute_alias(d, argument): @@ -184,11 +196,15 @@ def substitute_alias(d, argument): if len(ch.prefix) + len(argument) > MAX_INPUT_LENGTH: ch.send("Line to long, prefix not processed.\r\n") else: - prefix = "%s %s" % (ch.prefix,argument) - - if ch.is_npc() or not ch.alias \ - or "alias".startswith(argument) or "unalias".startswith(argument) \ - or "prefix".startswith(argument): + prefix = "%s %s" % (ch.prefix, argument) + + if ( + ch.is_npc() + or not ch.alias + or "alias".startswith(argument) + or "unalias".startswith(argument) + or "prefix".startswith(argument) + ): ch.interpret(argument) return remains, sub = game_utils.read_word(argument) @@ -197,4 +213,3 @@ def substitute_alias(d, argument): return buf = "%s %s" % (ch.alias[sub], remains) ch.interpret(buf) - diff --git a/src/rom24/handler_item.py b/src/rom24/handler_item.py index 3aba954..f07b059 100644 --- a/src/rom24/handler_item.py +++ b/src/rom24/handler_item.py @@ -1,4 +1,3 @@ - import json import os import copy @@ -24,69 +23,83 @@ # * One object. -'''Equip "Flags": +"""Equip "Flags": Keyword: internal identifier -Value: String Representation''' -equips_to_strings = {'left_finger': 'Left Finger', - 'right_finger': 'Right Finger', - 'neck': 'Neck', - 'collar': 'Collar', - 'body': 'Body', - 'head': 'Head', - 'legs': 'Legs', - 'feet': 'Feet', - 'hands': 'Hands', - 'arms': 'Arms', - 'about_body': 'About Body', - 'left_wrist': 'Left Wrist', - 'right_wrist': 'Right Wrist', - 'waist': 'Waist', - 'main_hand': 'Main Hand', - 'off_hand': 'Off Hand', - 'held': 'Held', - 'float': 'Float', - 'light': 'Light'} - -item_restriction_strings = {'no_drop': 'No Drop', - 'no_sac': 'No Sacrifice', - 'no_remove': 'No Remove', - 'no_uncurse': 'No Uncurse', - 'no_purge': 'No Purge', - 'anti_good': 'Anti-Good', - 'anti_evil': 'Anti-Evil', - 'anti_neutral': 'Anti-Neutral', - 'no_locate': 'No Locate'} - -item_attribute_strings = {'magic': 'Magic', - 'glow': 'Glowing', - 'hum': 'Humming', - 'dark': 'Dark', - 'lock': 'Lock', - 'evil': 'Evil', - 'invis': 'Invisible', - 'bless': 'Bless', - 'non_metal': 'Non Metal', - 'had_timer': 'Had Timer', - 'burn_proof': 'Burn Proof', - 'melt_drop': 'Melt Drop', - 'rot_death': 'Rot Death', - 'vis_death': 'Vis Death', - 'inventory': 'Inventory', - 'sell_extract': 'Sell Extract', - 'take': 'Take'} - -weapon_attribute_strings = {'flaming': 'Flaming', - 'frost': 'Frost', - 'vampiric': 'Vampiric', - 'sharp': 'Sharp', - 'vorpal': 'Vorpal', - 'two_handed': 'Two-Handed', - 'shocking': 'Shocking', - 'poison': 'Poison'} - - -class Items(instance.Instancer, environment.Environment, physical.Physical, inventory.Inventory, - equipment.Equipment, type_bypass.ObjectType): +Value: String Representation""" +equips_to_strings = { + "left_finger": "Left Finger", + "right_finger": "Right Finger", + "neck": "Neck", + "collar": "Collar", + "body": "Body", + "head": "Head", + "legs": "Legs", + "feet": "Feet", + "hands": "Hands", + "arms": "Arms", + "about_body": "About Body", + "left_wrist": "Left Wrist", + "right_wrist": "Right Wrist", + "waist": "Waist", + "main_hand": "Main Hand", + "off_hand": "Off Hand", + "held": "Held", + "float": "Float", + "light": "Light", +} + +item_restriction_strings = { + "no_drop": "No Drop", + "no_sac": "No Sacrifice", + "no_remove": "No Remove", + "no_uncurse": "No Uncurse", + "no_purge": "No Purge", + "anti_good": "Anti-Good", + "anti_evil": "Anti-Evil", + "anti_neutral": "Anti-Neutral", + "no_locate": "No Locate", +} + +item_attribute_strings = { + "magic": "Magic", + "glow": "Glowing", + "hum": "Humming", + "dark": "Dark", + "lock": "Lock", + "evil": "Evil", + "invis": "Invisible", + "bless": "Bless", + "non_metal": "Non Metal", + "had_timer": "Had Timer", + "burn_proof": "Burn Proof", + "melt_drop": "Melt Drop", + "rot_death": "Rot Death", + "vis_death": "Vis Death", + "inventory": "Inventory", + "sell_extract": "Sell Extract", + "take": "Take", +} + +weapon_attribute_strings = { + "flaming": "Flaming", + "frost": "Frost", + "vampiric": "Vampiric", + "sharp": "Sharp", + "vorpal": "Vorpal", + "two_handed": "Two-Handed", + "shocking": "Shocking", + "poison": "Poison", +} + + +class Items( + instance.Instancer, + environment.Environment, + physical.Physical, + inventory.Inventory, + equipment.Equipment, + type_bypass.ObjectType, +): template_count = 0 instance_count = 0 @@ -139,9 +152,13 @@ def __repr__(self): if not self.instance_id: return "" % (self.short_descr, self.vnum) else: - return "" % (self.short_descr, self.instance_id, self.vnum) + return "" % ( + self.short_descr, + self.instance_id, + self.vnum, + ) - #Equipped/Equips To + # Equipped/Equips To @property def equipped_to(self): """ @@ -170,7 +187,7 @@ def equips_to_names(self, check_occupied=False): if used == name: continue things.add(equips_to_strings[name]) - return ', '.join(name for name in things) + return ", ".join(name for name in things) @property def equips_to(self): @@ -198,7 +215,7 @@ def equips_to(self, slots): self.flags._equips_to.clear() self.flags._equips_to |= set(slots) - #Item Attributes + # Item Attributes @property def item_attribute_names(self): """ @@ -209,11 +226,11 @@ def item_attribute_names(self): attributes = set({}) for astring in self.item_attributes: attributes.add(item_attribute_strings[astring]) - return ', '.join(name for name in attributes) + return ", ".join(name for name in attributes) @property def item_attributes(self): - #Item Attribute getter + # Item Attribute getter """ return the item_attributes set @@ -233,7 +250,7 @@ def item_attributes(self, attr_set): self.flags._item_attributes.clear() self.flags._item_attributes |= set(attr_set) - #Restrictions + # Restrictions @property def item_restriction_names(self): """ @@ -244,11 +261,11 @@ def item_restriction_names(self): restrictions = set({}) for rstring in self.item_restrictions: restrictions.add(item_restriction_strings[rstring]) - return ', '.join(name for name in restrictions) + return ", ".join(name for name in restrictions) @property def item_restrictions(self): - #Item Restrictions getter + # Item Restrictions getter """ return item_restriction flags as set @@ -267,7 +284,7 @@ def item_restrictions(self, restrictions): self.flags._item_restrictions.clear() self.flags._item_restrictions |= set(restrictions) - #Weapons + # Weapons @property def weapon_attribute_names(self): """ @@ -278,7 +295,7 @@ def weapon_attribute_names(self): attributes = set({}) for wstring in self.item_restrictions: attributes.add(weapon_attribute_strings[wstring]) - return ', '.join(name for name in attributes) + return ", ".join(name for name in attributes) @property def weapon_attributes(self): @@ -304,22 +321,34 @@ def get(self, instance_object): if instance_object.is_item and instance_object.instance_id in self.inventory: self.inventory.remove(instance_object.instance_id) self.carry_number -= instance_object.get_number() - self.carry_weight -= instance_object.get_weight() * state_checks.WEIGHT_MULT(self) // 100 + self.carry_weight -= ( + instance_object.get_weight() * state_checks.WEIGHT_MULT(self) // 100 + ) instance_object.environment = None return instance_object else: - raise KeyError('Item to be removed from Item, not in inventory %d' % instance_object.instance_id) + raise KeyError( + "Item to be removed from Item, not in inventory %d" + % instance_object.instance_id + ) def put(self, instance_object): - if instance_object.is_item and instance_object.instance_id not in self.inventory: + if ( + instance_object.is_item + and instance_object.instance_id not in self.inventory + ): self.inventory += [instance_object.instance_id] - self.carry_weight += instance_object.get_weight() * state_checks.WEIGHT_MULT(self) // 100 + self.carry_weight += ( + instance_object.get_weight() * state_checks.WEIGHT_MULT(self) // 100 + ) self.carry_number += instance_object.get_number() instance_object.environment = self.instance_id return instance_object else: - raise KeyError('Item to be added to Item, already in inventory or wrong type ' - '%d, %r' % (instance_object.instance_id, type(instance_object))) + raise KeyError( + "Item to be added to Item, already in inventory or wrong type " + "%d, %r" % (instance_object.instance_id, type(instance_object)) + ) def instance_setup(self): instance.items[self.instance_id] = self @@ -338,7 +367,7 @@ def instance_destructor(self): def apply_ac(self, ac_position): if self.item_type != merc.ITEM_ARMOR: return 0 - multi = {'body': 3, 'head': 2, 'legs': 2, 'about': 2} + multi = {"body": 3, "head": 2, "legs": 2, "about": 2} for worn_on in self.equipped_to: if worn_on in multi.keys(): return multi[worn_on] * self.value[ac_position] @@ -370,20 +399,28 @@ def affect_add(self, paf): # apply any affect vectors to the object's extra_flags if paf.bitvector: if paf.where == merc.TO_OBJECT: - ret_str = game_utils.item_bitvector_flag_str(paf.bitvector, 'extra flags') + ret_str = game_utils.item_bitvector_flag_str( + paf.bitvector, "extra flags" + ) if self.item_attribute_names.intersection(ret_str): self.item_attributes |= {ret_str} elif self.item_restriction_names.intersection(ret_str): self.item_restrictions |= {ret_str} else: - raise ValueError('paf set attempt failed, unable to find flag %s' % ret_str) + raise ValueError( + "paf set attempt failed, unable to find flag %s" % ret_str + ) elif paf.where == merc.TO_WEAPON: if self.item_type == merc.ITEM_WEAPON: - ret_str = game_utils.item_bitvector_flag_str(paf.bitvector, 'weapon flags') + ret_str = game_utils.item_bitvector_flag_str( + paf.bitvector, "weapon flags" + ) if self.weapon_attribute_names.intersection(ret_str): self.weapon_attributes |= {ret_str} else: - raise ValueError('paf set attempt failed, unable to find flag %s' % ret_str) + raise ValueError( + "paf set attempt failed, unable to find flag %s" % ret_str + ) def affect_remove(self, paf): if not self.affected: @@ -399,20 +436,29 @@ def affect_remove(self, paf): # remove flags from the object if needed */ if paf.bitvector: if paf.where == merc.TO_OBJECT: - ret_str = game_utils.item_bitvector_flag_str(paf.bitvector, 'extra flags') + ret_str = game_utils.item_bitvector_flag_str( + paf.bitvector, "extra flags" + ) if self.item_attribute_names.intersection(ret_str): self.item_attributes -= {ret_str} elif self.item_restriction_names.intersection(ret_str): self.item_restrictions -= {ret_str} else: - raise ValueError('paf removal attempt failed, unable to find flag %s' % ret_str) + raise ValueError( + "paf removal attempt failed, unable to find flag %s" % ret_str + ) elif paf.where == merc.TO_WEAPON: if self.item_type == merc.ITEM_WEAPON: - ret_str = game_utils.item_bitvector_flag_str(paf.bitvector, 'weapon flags') + ret_str = game_utils.item_bitvector_flag_str( + paf.bitvector, "weapon flags" + ) if self.weapon_attribute_names.intersection(ret_str): self.weapon_attributes -= {ret_str} else: - raise ValueError('paf removal attempt failed, unable to find flag %s' % ret_str) + raise ValueError( + "paf removal attempt failed, unable to find flag %s" + % ret_str + ) if paf not in self.affected: print("BUG: Affect_remove_object: cannot find paf.") @@ -431,7 +477,10 @@ def extract(self): self.environment.get(self) for item_id in self.inventory[:]: if self.instance_id not in instance.items: - logger.error("Extract_obj: obj %d not found in obj_instance dict." % self.instance_id) + logger.error( + "Extract_obj: obj %d not found in obj_instance dict." + % self.instance_id + ) return tmp = instance.items[item_id] self.get(tmp) @@ -449,6 +498,7 @@ def count_users(self): return total # Serialization + def to_json(self, outer_encoder=None): if outer_encoder is None: outer_encoder = json.JSONEncoder.default @@ -457,12 +507,12 @@ def to_json(self, outer_encoder=None): for k, v in self.__dict__.items(): if str(type(v)) in ("", ""): continue - elif str(k) in ('_last_saved', '_md5'): + elif str(k) in ("_last_saved", "_md5"): continue else: tmp_dict[k] = v - cls_name = '__class__/' + __name__ + '.' + self.__class__.__name__ + cls_name = "__class__/" + __name__ + "." + self.__class__.__name__ return {cls_name: outer_encoder(tmp_dict)} @classmethod @@ -470,13 +520,19 @@ def from_json(cls, data, outer_decoder=None, player_name=None): if outer_decoder is None: outer_decoder = json.JSONDecoder.decode - cls_name = '__class__/' + __name__ + '.' + cls.__name__ + cls_name = "__class__/" + __name__ + "." + cls.__name__ if cls_name in data: tmp_data = outer_decoder(data[cls_name]) return cls(**tmp_data) return data - def save(self, is_equipped: bool=False, in_inventory: bool=False, player_name: str=None, force: bool=False): + def save( + self, + is_equipped: bool = False, + in_inventory: bool = False, + player_name: str = None, + force: bool = False, + ): if self._last_saved is None: self._last_saved = time.time() - settings.SAVE_LIMITER - 2 if not force and time.time() < self._last_saved + settings.SAVE_LIMITER: @@ -493,27 +549,35 @@ def save(self, is_equipped: bool=False, in_inventory: bool=False, player_name: s area_number = self.in_area.instance_id else: area_number = self.in_area.index - pathname = os.path.join(top_dir, '%d-%s' % (area_number, self.in_area.name), 'items') + pathname = os.path.join( + top_dir, "%d-%s" % (area_number, self.in_area.name), "items" + ) else: - top_dir = os.path.join(settings.PLAYER_DIR, player_name[0].lower(), player_name.capitalize()) + top_dir = os.path.join( + settings.PLAYER_DIR, player_name[0].lower(), player_name.capitalize() + ) number = self.instance_id if is_equipped and in_inventory: - raise ValueError('A player item cannot be BOTH equipped AND in their inventory!') + raise ValueError( + "A player item cannot be BOTH equipped AND in their inventory!" + ) if is_equipped: - pathname = os.path.join(top_dir, 'equipment') + pathname = os.path.join(top_dir, "equipment") elif in_inventory: - pathname = os.path.join(top_dir, 'inventory') + pathname = os.path.join(top_dir, "inventory") else: - raise ValueError('Player items must specify if they are equipped or in their inventory!') + raise ValueError( + "Player items must specify if they are equipped or in their inventory!" + ) os.makedirs(pathname, 0o755, True) - filename = os.path.join(pathname, '%d-item.json' % number) + filename = os.path.join(pathname, "%d-item.json" % number) # logger.info('Saving %s', filename) js = json.dumps(self, default=instance.to_json, indent=4, sort_keys=True) - md5 = hashlib.md5(js.encode('utf-8')).hexdigest() + md5 = hashlib.md5(js.encode("utf-8")).hexdigest() if self._md5 != md5: self._md5 = md5 - with open(filename, 'w') as fp: + with open(filename, "w") as fp: fp.write(js) if self.inventory: @@ -522,16 +586,23 @@ def save(self, is_equipped: bool=False, in_inventory: bool=False, player_name: s # logger.error('Item %d is in Item %d\'s inventory, but does not exist?', item_id, self.instance_id) continue item = instance.global_instances[item_id] - item.save(is_equipped=is_equipped, in_inventory=in_inventory, player_name=player_name, force=force) + item.save( + is_equipped=is_equipped, + in_inventory=in_inventory, + player_name=player_name, + force=force, + ) @classmethod - def load(cls, instance_id: int=None, vnum: int=None, player_name: str=None): + def load(cls, instance_id: int = None, vnum: int = None, player_name: str = None): if not vnum and not instance_id: - raise ValueError('You must provide either a vnum or an instance_id!') + raise ValueError("You must provide either a vnum or an instance_id!") if vnum and instance_id: - raise ValueError('You must provide either a vnum or an instance_id, not BOTH!') + raise ValueError( + "You must provide either a vnum or an instance_id, not BOTH!" + ) if instance_id and instance_id in instance.items: - logger.warn('Instance %d of item already loaded!', instance_id) + logger.warn("Instance %d of item already loaded!", instance_id) return if not player_name: @@ -542,36 +613,41 @@ def load(cls, instance_id: int=None, vnum: int=None, player_name: str=None): pathname = settings.AREA_DIR number = vnum else: - pathname = os.path.join(settings.PLAYER_DIR, player_name[0].lower(), player_name.capitalize()) + pathname = os.path.join( + settings.PLAYER_DIR, player_name[0].lower(), player_name.capitalize() + ) number = instance_id - target_file = '%d-item.json' % number + target_file = "%d-item.json" % number filename = None for a_path, a_directory, i_files in os.walk(pathname): if target_file in i_files: filename = os.path.join(a_path, target_file) break if not filename: - raise ValueError('Cannot find %s' % target_file) + raise ValueError("Cannot find %s" % target_file) with open(filename) as fp: obj = json.load(fp, object_hook=instance.from_json) if not isinstance(obj, Items): - raise TypeError('Could not load instance %r!' % number) + raise TypeError("Could not load instance %r!" % number) if obj.inventory: obj.load_inventory(player_name) if obj.environment: - if obj.environment.is_room and obj.instance_id not in obj.environment.inventory: + if ( + obj.environment.is_room + and obj.instance_id not in obj.environment.inventory + ): obj.environment.put(obj) return obj - def load_inventory(self, player_name: str=None): + def load_inventory(self, player_name: str = None): for number in self.inventory[:]: if self.instance_id: obj = Items.load(instance_id=number, player_name=player_name) else: obj = Items.load(vnum=number, player_name=player_name) if not isinstance(obj, Items): - raise TypeError('Could not load instance %r!' % number) + raise TypeError("Could not load instance %r!" % number) def get_item(ch, item, this_container): @@ -580,15 +656,26 @@ def get_item(ch, item, this_container): ch.send("You can't take that.\n") return if ch.carry_number + item.get_number() > ch.can_carry_n(): - handler_game.act("$d: you can't carry that many items.", ch, None, item.name, merc.TO_CHAR) + handler_game.act( + "$d: you can't carry that many items.", ch, None, item.name, merc.TO_CHAR + ) return if not ch.can_loot(item): - handler_game.act("Corpse looting is not permitted.", ch, None, None, merc.TO_CHAR) + handler_game.act( + "Corpse looting is not permitted.", ch, None, None, merc.TO_CHAR + ) return if item.in_living: - if (not item.in_item or (item.in_living.instance_id != ch.instance_id)) \ - and (state_checks.get_carry_weight(ch) + item.get_weight() > ch.can_carry_w()): - handler_game.act("$d: you can't carry that much weight.", ch, None, item.name, merc.TO_CHAR) + if (not item.in_item or (item.in_living.instance_id != ch.instance_id)) and ( + state_checks.get_carry_weight(ch) + item.get_weight() > ch.can_carry_w() + ): + handler_game.act( + "$d: you can't carry that much weight.", + ch, + None, + item.name, + merc.TO_CHAR, + ) return # Make sure nobody is using the item before we allow someone to get it. @@ -598,14 +685,20 @@ def get_item(ch, item, this_container): if gch.on: on_item = instance.items[gch.on] if on_item.instance_id in item.in_room.items: - handler_game.act("$N appears to be using $p.", ch, item, gch, merc.TO_CHAR) + handler_game.act( + "$N appears to be using $p.", ch, item, gch, merc.TO_CHAR + ) return # Get things from a container. if this_container: if this_container.vnum == merc.OBJ_VNUM_PIT and ch.trust < item.level: ch.send("You are not powerful enough to use it.\n") return - elif this_container.vnum == merc.OBJ_VNUM_PIT and item.flags.take and item.flags.had_timer: + elif ( + this_container.vnum == merc.OBJ_VNUM_PIT + and item.flags.take + and item.flags.had_timer + ): item.timer = 0 handler_game.act("You get $p from $P.", ch, item, this_container, merc.TO_CHAR) handler_game.act("$n gets $p from $P.", ch, item, this_container, merc.TO_ROOM) @@ -616,15 +709,20 @@ def get_item(ch, item, this_container): handler_game.act("You get $p.", ch, item, this_container, merc.TO_CHAR) handler_game.act("$n gets $p.", ch, item, this_container, merc.TO_ROOM) ch.in_room.get(item) - + if item.item_type == merc.ITEM_MONEY: ch.silver += item.value[0] ch.gold += item.value[1] if ch.act.is_set(merc.PLR_AUTOSPLIT): # AUTOSPLIT code - members = len([gch for gch in ch.in_room.people[:] - if not instance.characters[gch].is_affected(merc.AFF_CHARM) - and instance.characters[gch].is_same_group(ch)]) + members = len( + [ + gch + for gch in ch.in_room.people[:] + if not instance.characters[gch].is_affected(merc.AFF_CHARM) + and instance.characters[gch].is_same_group(ch) + ] + ) if members > 1 and (item.value[0] > 1 or item.value[1]): ch.do_split("%d %d" % (item.value[0], item.value[1])) ch.get(item) @@ -636,12 +734,14 @@ def get_item(ch, item, this_container): # trust levels for load and clone def item_check(ch, obj): - #TODO add real values, just guessed for now - if state_checks.IS_TRUSTED(ch, 60) \ - or (state_checks.IS_TRUSTED(ch, 55) and obj.level <= 20 and obj.cost <= 1000) \ - or (state_checks.IS_TRUSTED(ch, 53) and obj.level <= 10 and obj.cost <= 500) \ - or (state_checks.IS_TRUSTED(ch, 52) and obj.level <= 5 and obj.cost <= 250) \ - or (state_checks.IS_TRUSTED(ch, 51) and obj.level == 0 and obj.cost <= 100): + # TODO add real values, just guessed for now + if ( + state_checks.IS_TRUSTED(ch, 60) + or (state_checks.IS_TRUSTED(ch, 55) and obj.level <= 20 and obj.cost <= 1000) + or (state_checks.IS_TRUSTED(ch, 53) and obj.level <= 10 and obj.cost <= 500) + or (state_checks.IS_TRUSTED(ch, 52) and obj.level <= 5 and obj.cost <= 250) + or (state_checks.IS_TRUSTED(ch, 51) and obj.level == 0 and obj.cost <= 100) + ): return True else: return False @@ -650,7 +750,7 @@ def item_check(ch, obj): def format_item_to_char(item, ch, fShort): if type(item) == int: item = instance.items[item] - buf = '' + buf = "" if (fShort and not item.short_descr) or not item.description: return buf diff --git a/src/rom24/handler_log.py b/src/rom24/handler_log.py index a30124f..310a162 100644 --- a/src/rom24/handler_log.py +++ b/src/rom24/handler_log.py @@ -1,5 +1,4 @@ - -__author__ = 'syn' +__author__ = "syn" import sys import functools import inspect @@ -23,6 +22,7 @@ def some_func(stuff) class GlobalDebugFlag: """Enable or disable our global flags""" + def gdfset(state): merc.GDF = state return @@ -31,38 +31,49 @@ def gdcfset(state): merc.GDCF = state return + def value_to_str(v): from rom24 import interp + if isinstance(v, handler_pc.Pc): return v.name elif isinstance(v, interp.cmd_type): return v.do_fun elif isinstance(v, str): - return ''.join(["'", v.replace('\n', '\\n'), "'"]) + return "".join(["'", v.replace("\n", "\\n"), "'"]) else: # noinspection PyBroadException try: - return str(v).replace('\n', '\\n') + return str(v).replace("\n", "\\n") except: - return '' + return "" -def char_parse_exception(error_object, *args, ch): # Parser for exceptions with a CH entity for extra msging +def char_parse_exception( + error_object, *args, ch +): # Parser for exceptions with a CH entity for extra msging merc.GDF = False wrap_call = inspect.getinnerframes(sys.exc_info()[2]) if ch.level == merc.ML: - ch.send("An Exception Occurred: \n%s %s\n\n" % (type(error_object), str(error_object))) + ch.send( + "An Exception Occurred: \n%s %s\n\n" + % (type(error_object), str(error_object)) + ) logger.debug("Exception: %s %s" % (type(error_object), str(error_object))) for call_info in reversed(wrap_call): local_calls = call_info[0].f_locals - if '_logged__tracer_var_' in local_calls: + if "_logged__tracer_var_" in local_calls: continue if ch.level == merc.ML: - ch.send("--Frame Trace-- \nFile: %s \nFunction: %s \nLine: %d \nCode: %s " - % (call_info[1], call_info[3], call_info[2], call_info[4][0].lstrip())) + ch.send( + "--Frame Trace-- \nFile: %s \nFunction: %s \nLine: %d \nCode: %s " + % (call_info[1], call_info[3], call_info[2], call_info[4][0].lstrip()) + ) ch.send("\n") - logger.debug("--Frame Trace-- \nFile: %s \nFunction: %s \nLine: %d \nCode: %s " - % (call_info[1], call_info[3], call_info[2], call_info[4][0].lstrip())) + logger.debug( + "--Frame Trace-- \nFile: %s \nFunction: %s \nLine: %d \nCode: %s " + % (call_info[1], call_info[3], call_info[2], call_info[4][0].lstrip()) + ) logger.debug("Local Env Variables: ") for k, v in local_calls.items(): levtrace = value_to_str(v) @@ -75,10 +86,18 @@ def noch_parse_exception(error_object, *args): logger.debug("Exception: %s %s" % (type(error_object), str(error_object))) for call_info in reversed(wrap_call): local_calls = call_info[0].f_locals - if '_logged__tracer_var_' in local_calls: + if "_logged__tracer_var_" in local_calls: continue - tracestring = "Frame Trace: \nFile: %s \nLine: %d \n ", call_info[1], call_info[2] - tracestring += "Function: %s \nCode: %s ", call_info[3], call_info[4][0].lstrip() + tracestring = ( + "Frame Trace: \nFile: %s \nLine: %d \n ", + call_info[1], + call_info[2], + ) + tracestring += ( + "Function: %s \nCode: %s ", + call_info[3], + call_info[4][0].lstrip(), + ) logger.debug(tracestring) logger.debug("Local Env Variables: ") for k, v in local_calls.items(): @@ -96,8 +115,11 @@ def __call__(self, func): """the class needs to be callable for this to work""" functools.update_wrapper(self, func) - #Add debug log for any function you wish for TS, provides trace of incident - if self.log_type == "Debug": # Used to wrap any function and does not know about or care about flags + # Add debug log for any function you wish for TS, provides trace of incident + if ( + self.log_type == "Debug" + ): # Used to wrap any function and does not know about or care about flags + def debug(*args, **kwargs): if args and isinstance(args[0], handler_pc.Pc): mch = args[0] @@ -120,17 +142,29 @@ def debug(*args, **kwargs): else: noch_parse_exception(err, args) return + return debug - if self.log_type == "Interp": # Used with interp and either debug command, or global debug flag + if ( + self.log_type == "Interp" + ): # Used with interp and either debug command, or global debug flag + def interp_debug(*args, **kwargs): - if merc.GDF is False and merc.GDCF is False: # Check for global/debug command flags - return func(*args, **kwargs) # if none of the debugs are on, just send the command as normal + if ( + merc.GDF is False and merc.GDCF is False + ): # Check for global/debug command flags + return func( + *args, **kwargs + ) # if none of the debugs are on, just send the command as normal if args and isinstance(args[0], handler_pc.Pc): """check if there are args, and the args entail a character structure""" - mch = args[0] # If so, lets make a char object so we can send messages as needed + mch = args[ + 0 + ] # If so, lets make a char object so we can send messages as needed else: - mch = self.ch # If so, lets make a char object so we can send messages as needed + mch = ( + self.ch + ) # If so, lets make a char object so we can send messages as needed """__tracer_var_ becomes _logger__tracer_var_ in the trace. This is used to determine if we are within the wrapping frame or the wrapped frame. @@ -147,10 +181,8 @@ def interp_debug(*args, **kwargs): else: noch_parse_exception(err, args) return + return interp_debug else: return func - - - diff --git a/src/rom24/handler_magic.py b/src/rom24/handler_magic.py index ffa441a..1461f13 100644 --- a/src/rom24/handler_magic.py +++ b/src/rom24/handler_magic.py @@ -1,5 +1,4 @@ - -__author__ = 'syn' +__author__ = "syn" import random import logging @@ -12,13 +11,58 @@ from rom24 import game_utils from rom24 import instance -#Magic functions +# Magic functions def say_spell(ch, spell): - syl_dict = {"ar":"abra", "au":"kada", "bless":"fido", "blind":"nose", "bur":"mosa", "cu":"judi", "de":"oculo", "en":"unso", "light":"dies", - "lo":"hi", "mor":"zak", "move":"sido", "ness":"lacri", "ning":"illa", "per":"duda", "ra":"gru", "fresh":"ima", "re":"candus", - "son":"sabru", "tect":"infra", "tri":"cula", "ven":"nofo", "a":"a", "b":"b", "c":"q", "d":"e", "e":"z", "f":"y", "g":"o", - "h":"p", "i":"u", "j":"y", "k":"t", "l":"r", "m":"w", "n":"i", "o":"a", "p":"s", "q":"d", "r":"f", "s":"g", "t":"h", "u":"j", - "v":"z", "w":"x", "x":"n", "y":"l", "z": "k" } + syl_dict = { + "ar": "abra", + "au": "kada", + "bless": "fido", + "blind": "nose", + "bur": "mosa", + "cu": "judi", + "de": "oculo", + "en": "unso", + "light": "dies", + "lo": "hi", + "mor": "zak", + "move": "sido", + "ness": "lacri", + "ning": "illa", + "per": "duda", + "ra": "gru", + "fresh": "ima", + "re": "candus", + "son": "sabru", + "tect": "infra", + "tri": "cula", + "ven": "nofo", + "a": "a", + "b": "b", + "c": "q", + "d": "e", + "e": "z", + "f": "y", + "g": "o", + "h": "p", + "i": "u", + "j": "y", + "k": "t", + "l": "r", + "m": "w", + "n": "i", + "o": "a", + "p": "s", + "q": "d", + "r": "f", + "s": "g", + "t": "h", + "u": "j", + "v": "z", + "w": "x", + "x": "n", + "y": "l", + "z": "k", + } incantation = game_utils.mass_replace(spell.name, syl_dict) buf = "$n utters the words, '%s'." % incantation @@ -45,25 +89,28 @@ def saves_spell(level, victim, dam_type): if not victim.is_npc() and victim.guild.fMana: save = 9 * save // 10 - save = max( 5, min(save, 95 ) ) + save = max(5, min(save, 95)) + + return random.randint(1, 99) < save - return random.randint(1,99) < save def saves_dispel(dis_level, spell_level, duration): if duration == -1: - spell_level += 5 - # very hard to dispel permanent effects */ + spell_level += 5 + # very hard to dispel permanent effects */ save = 50 + (spell_level - dis_level) * 5 - save = max( 5, min(save, 95 ) ) - return random.randint(1,99) < save + save = max(5, min(save, 95)) + return random.randint(1, 99) < save + def check_dispel(dis_level, victim, skill): from rom24.const import skill_table + if state_checks.is_affected(victim, skill): for af in victim.affected[:]: if af.type == skill: - if not saves_dispel(dis_level,af.level,af.duration): + if not saves_dispel(dis_level, af.level, af.duration): victim.affect_strip(skill) if skill.msg_off: victim.send(skill_table[skill.name].msg_off + "\n") @@ -72,21 +119,24 @@ def check_dispel(dis_level, victim, skill): af.level -= 1 return False -target_name = '' + +target_name = "" fLogAll = False # for finding mana costs -- temporary version */ -def mana_cost (ch, min_mana, level): +def mana_cost(ch, min_mana, level): if ch.level + 2 == level: return 1000 return max(min_mana, (100 // (2 + ch.level - level))) + def find_spell(ch, name): - #* finds a spell the character can cast if possible */ + # * finds a spell the character can cast if possible */ from rom24.const import skill_table + found = None if ch.is_npc(): - return state_checks.prefix_lookup(skill_table,name) + return state_checks.prefix_lookup(skill_table, name) for key, sn in skill_table.items(): if key.startswith(name.lower()): if found == None: @@ -95,10 +145,12 @@ def find_spell(ch, name): return sn return found -#Cast spells at targets using a magical object. + +# Cast spells at targets using a magical object. def obj_cast_spell(sn, level, ch, victim, obj): from rom24 import const from rom24 import fight + target = merc.TARGET_NONE vo = None if not sn: @@ -120,8 +172,7 @@ def obj_cast_spell(sn, level, ch, victim, obj): return vo = victim target = merc.TARGET_CHAR - elif sn.target == merc.TAR_CHAR_DEFENSIVE \ - or sn.target == merc.TAR_CHAR_SELF: + elif sn.target == merc.TAR_CHAR_DEFENSIVE or sn.target == merc.TAR_CHAR_SELF: if not victim: victim = ch vo = victim @@ -163,12 +214,15 @@ def obj_cast_spell(sn, level, ch, victim, obj): return target_name = "" sn.spell_fun(sn, level, ch, vo, target) - if (sn.target == merc.TAR_CHAR_OFFENSIVE \ - or (sn.target == merc.TAR_OBJ_CHAR_OFF and target == merc.TARGET_CHAR)) \ - and victim != ch \ - and victim.master != ch: + if ( + ( + sn.target == merc.TAR_CHAR_OFFENSIVE + or (sn.target == merc.TAR_OBJ_CHAR_OFF and target == merc.TARGET_CHAR) + ) + and victim != ch + and victim.master != ch + ): for vch in ch.in_room.people[:]: if victim == vch and not victim.fighting: fight.check_killer(victim, ch) fight.multi_hit(victim, ch, merc.TYPE_UNDEFINED) - diff --git a/src/rom24/handler_npc.py b/src/rom24/handler_npc.py index abed767..622e0f5 100644 --- a/src/rom24/handler_npc.py +++ b/src/rom24/handler_npc.py @@ -1,4 +1,3 @@ - import copy import os import hashlib @@ -23,7 +22,7 @@ class Npc(living.Living): def __init__(self, template=None, **kwargs): super().__init__() - #self.is_npc = True + # self.is_npc = True self.vnum = 0 # Needs to come before the template to setup the instance self.memory = None self.spec_fun = None @@ -77,7 +76,11 @@ def __del__(self): def __repr__(self): if self.instance_id: - return "" % (self.short_descr, self.instance_id, self.vnum) + return "" % ( + self.short_descr, + self.instance_id, + self.vnum, + ) else: return "" % (self.short_descr, self.vnum) @@ -108,14 +111,14 @@ def to_json(self, outer_encoder=None): for k, v in self.__dict__.items(): if str(type(v)) in ("", ""): continue - elif str(k) in ('desc', 'send'): + elif str(k) in ("desc", "send"): continue - elif str(k) in ('_last_saved', '_md5'): + elif str(k) in ("_last_saved", "_md5"): continue else: tmp_dict[k] = v - cls_name = '__class__/' + __name__ + '.' + self.__class__.__name__ + cls_name = "__class__/" + __name__ + "." + self.__class__.__name__ return {cls_name: outer_encoder(tmp_dict)} @classmethod @@ -123,13 +126,13 @@ def from_json(cls, data, outer_decoder=None): if outer_decoder is None: outer_decoder = json.JSONDecoder.decode - cls_name = '__class__/' + __name__ + '.' + cls.__name__ + cls_name = "__class__/" + __name__ + "." + cls.__name__ if cls_name in data: tmp_data = outer_decoder(data[cls_name]) return cls(**tmp_data) return data - def save(self, force: bool=False): + def save(self, force: bool = False): if self._last_saved is None: self._last_saved = time.time() - settings.SAVE_LIMITER - 2 if not force and time.time() < self._last_saved + settings.SAVE_LIMITER: @@ -145,16 +148,18 @@ def save(self, force: bool=False): area_number = self.in_area.instance_id else: area_number = self.in_area.index - pathname = os.path.join(top_dir, '%d-%s' % (area_number, self.in_area.name), 'npcs') + pathname = os.path.join( + top_dir, "%d-%s" % (area_number, self.in_area.name), "npcs" + ) os.makedirs(pathname, 0o755, True) - filename = os.path.join(pathname, '%d-npc.json' % number) + filename = os.path.join(pathname, "%d-npc.json" % number) # logger.info('Saving %s', filename) js = json.dumps(self, default=instance.to_json, indent=4, sort_keys=True) - md5 = hashlib.md5(js.encode('utf-8')).hexdigest() + md5 = hashlib.md5(js.encode("utf-8")).hexdigest() if self._md5 != md5: self._md5 = md5 - with open(filename, 'w') as fp: + with open(filename, "w") as fp: fp.write(js) if self.inventory: @@ -173,10 +178,10 @@ def save(self, force: bool=False): item.save(is_equipped=True, force=force) @classmethod - def load(cls, vnum: int=None, instance_id: int=None): + def load(cls, vnum: int = None, instance_id: int = None): if instance_id: if instance_id in instance.characters: - logger.warn('Instance %d of npc already loaded!', instance_id) + logger.warn("Instance %d of npc already loaded!", instance_id) return pathname = settings.INSTANCE_DIR number = instance_id @@ -184,18 +189,20 @@ def load(cls, vnum: int=None, instance_id: int=None): pathname = settings.AREA_DIR number = vnum else: - raise ValueError('To load an NPC, you must provide either a VNUM or an Instance_ID!') + raise ValueError( + "To load an NPC, you must provide either a VNUM or an Instance_ID!" + ) - target_file = '%d-npc.json' % number + target_file = "%d-npc.json" % number filename = None for a_path, a_directory, i_files in os.walk(pathname): if target_file in i_files: filename = os.path.join(a_path, target_file) break if not filename: - raise ValueError('Cannot find %s' % target_file) + raise ValueError("Cannot find %s" % target_file) - with open(filename, 'r') as fp: + with open(filename, "r") as fp: obj = json.load(fp, object_hook=instance.from_json) if isinstance(obj, Npc): # This just ensures that all items the player has are actually loaded. @@ -204,5 +211,5 @@ def load(cls, vnum: int=None, instance_id: int=None): handler_item.Items.load(instance_id=item_id) return obj else: - logger.error('Could not load npc data for %d', number) + logger.error("Could not load npc data for %d", number) return None diff --git a/src/rom24/handler_pc.py b/src/rom24/handler_pc.py index f1de410..e8b3c29 100644 --- a/src/rom24/handler_pc.py +++ b/src/rom24/handler_pc.py @@ -27,6 +27,7 @@ class Pc(living.Living): def __init__(self, template=None, **kwargs): from rom24 import handler_item + super().__init__() self.is_pc = True self.buffer = [] @@ -80,10 +81,14 @@ def __init__(self, template=None, **kwargs): self.environment = None if self.inventory: for instance_id in self.inventory[:]: - handler_item.Items.load(instance_id=instance_id, player_name=self.name) + handler_item.Items.load( + instance_id=instance_id, player_name=self.name + ) for item_id in self.equipped.values(): if item_id: - handler_item.Items.load(instance_id=item_id, player_name=self.name) + handler_item.Items.load( + instance_id=item_id, player_name=self.name + ) self.instance_setup() if self.instance_id: Pc.instance_count += 1 @@ -133,14 +138,14 @@ def title(self): def title(self, title): if self.is_npc(): return - nospace = ['.', ',', '!', '?'] + nospace = [".", ",", "!", "?"] if title[0] in nospace: self._title = title else: - self._title = ' ' + title + self._title = " " + title def get_age(self): - return 17 + (self.played + int(time.time() - self.logon)) // 72000 + return 17 + (self.played + int(time.time() - self.logon)) // 72000 # command for returning max training score def get_max_train(self, stat): @@ -150,7 +155,7 @@ def get_max_train(self, stat): max += 3 else: max += 2 - return min(max,25) + return min(max, 25) # recursively adds a group given its number -- uses group_add */ def gn_add(self, gn): @@ -215,13 +220,21 @@ def list_group_costs(self): if self.is_npc(): return col = 0 - self.send("%-18s %-5s %-18s %-5s %-18s %-5s\n" % ("group", "cp", "group", "cp", "group", "cp")) + self.send( + "%-18s %-5s %-18s %-5s %-18s %-5s\n" + % ("group", "cp", "group", "cp", "group", "cp") + ) for gn, group in const.group_table.items(): - if gn not in self.gen_data.group_chosen \ - and gn not in self.group_known \ - and group.rating[self.guild.name] > 0: - self.send("%-18s %-5d " % (const.group_table[gn].name, group.rating[self.guild.name])) + if ( + gn not in self.gen_data.group_chosen + and gn not in self.group_known + and group.rating[self.guild.name] > 0 + ): + self.send( + "%-18s %-5d " + % (const.group_table[gn].name, group.rating[self.guild.name]) + ) col += 1 if col % 3 == 0: self.send("\n") @@ -230,13 +243,18 @@ def list_group_costs(self): self.send("\n") col = 0 - self.send("%-18s %-5s %-18s %-5s %-18s %-5s\n" % ("skill", "cp", "skill", "cp", "skill", "cp")) + self.send( + "%-18s %-5s %-18s %-5s %-18s %-5s\n" + % ("skill", "cp", "skill", "cp", "skill", "cp") + ) for sn, skill in const.skill_table.items(): - if sn not in self.gen_data.skill_chosen \ - and sn not in self.learned \ - and skill.spell_fun is None \ - and skill.rating[self.guild.name] > 0: + if ( + sn not in self.gen_data.skill_chosen + and sn not in self.learned + and skill.spell_fun is None + and skill.rating[self.guild.name] > 0 + ): self.send("%-18s %-5d " % (skill.name, skill.rating[self.guild.name])) col += 1 if col % 3 == 0: @@ -246,14 +264,20 @@ def list_group_costs(self): self.send("\n") self.send("Creation points: %d\n" % self.points) - self.send("Experience per level: %d\n" % self.exp_per_level(self.gen_data.points_chosen)) + self.send( + "Experience per level: %d\n" + % self.exp_per_level(self.gen_data.points_chosen) + ) return def list_group_chosen(self): if self.is_npc(): return col = 0 - self.send("%-18s %-5s %-18s %-5s %-18s %-5s" % ("group", "cp", "group", "cp", "group", "cp\n")) + self.send( + "%-18s %-5s %-18s %-5s %-18s %-5s" + % ("group", "cp", "group", "cp", "group", "cp\n") + ) for gn, group in const.group_table.items(): if gn in self.gen_data.group_chosen and group.rating[self.guild.name] > 0: @@ -267,7 +291,10 @@ def list_group_chosen(self): col = 0 - self.send("%-18s %-5s %-18s %-5s %-18s %-5s" % ("skill", "cp", "skill", "cp", "skill", "cp\n")) + self.send( + "%-18s %-5s %-18s %-5s %-18s %-5s" + % ("skill", "cp", "skill", "cp", "skill", "cp\n") + ) for sn, skill in const.skill_table.items(): if sn in self.gen_data.skill_chosen and skill.rating[self.guild.name] > 0: @@ -280,12 +307,16 @@ def list_group_chosen(self): self.send("\n") self.send("Creation points: %d\n" % self.gen_data.points_chosen) - self.send("Experience per level: %d\n" % self.exp_per_level(self.gen_data.points_chosen)) + self.send( + "Experience per level: %d\n" + % self.exp_per_level(self.gen_data.points_chosen) + ) return # this procedure handles the input parsing for the skill generator */ def parse_gen_groups(self, argument): from game_utils import read_word + if not argument.strip(): return False @@ -404,15 +435,17 @@ def check_improve(self, sn, success, multiplier): if type(sn) == str: sn = const.skill_table[sn] - if self.level < sn.skill_level[self.guild.name] \ - or sn.rating[self.guild.name] == 0 \ - or sn.name not in self.learned \ - or self.learned[sn.name] == 100: + if ( + self.level < sn.skill_level[self.guild.name] + or sn.rating[self.guild.name] == 0 + or sn.name not in self.learned + or self.learned[sn.name] == 100 + ): return # skill is not known */ # check to see if the character has a chance to learn */ chance = 10 * const.int_app[self.stat(merc.STAT_INT)].learn - chance //= (multiplier * sn.rating[self.guild.name] * 4) + chance //= multiplier * sn.rating[self.guild.name] * 4 chance += self.level if random.randint(1, 1000) > chance: @@ -429,7 +462,10 @@ def check_improve(self, sn, success, multiplier): else: chance = max(5, min(self.learned[sn.name] / 2, 30)) if random.randint(1, 99) < chance: - self.send("You learn from your mistakes, and your %s skill improves.\n" % sn.name) + self.send( + "You learn from your mistakes, and your %s skill improves.\n" + % sn.name + ) self.learned[sn.name] += random.randint(1, 3) self.learned[sn.name] = min(self.learned[sn.name], 100) update.gain_exp(self, 2 * sn.rating[self.guild.name]) @@ -475,12 +511,18 @@ def check_social(ch, command, argument): handler_game.act(cmd.char_found, ch, None, victim, merc.TO_CHAR) handler_game.act(cmd.vict_found, ch, None, victim, merc.TO_VICT) - if not ch.is_npc() and victim.is_npc() \ - and not victim.is_affected(merc.AFF_CHARM) \ - and state_checks.IS_AWAKE(victim) and victim.desc is None: + if ( + not ch.is_npc() + and victim.is_npc() + and not victim.is_affected(merc.AFF_CHARM) + and state_checks.IS_AWAKE(victim) + and victim.desc is None + ): num = random.randint(0, 12) if num in [0, 1, 2, 3, 4, 5, 6, 7, 8]: - handler_game.act(cmd.others_found, victim, None, ch, merc.TO_NOTVICT) + handler_game.act( + cmd.others_found, victim, None, ch, merc.TO_NOTVICT + ) handler_game.act(cmd.char_found, victim, None, ch, merc.TO_CHAR) handler_game.act(cmd.vict_found, victim, None, ch, merc.TO_VICT) @@ -519,10 +561,12 @@ def interpret(self, argument): if cmd.level > trust: cmd = None - #* Log and snoop. - if (not self.is_npc() and self.act.is_set(merc.PLR_LOG)) \ - or settings.LOGALL \ - or (cmd and cmd.log == merc.LOG_ALWAYS): + # * Log and snoop. + if ( + (not self.is_npc() and self.act.is_set(merc.PLR_LOG)) + or settings.LOGALL + or (cmd and cmd.log == merc.LOG_ALWAYS) + ): if cmd and cmd.log != merc.LOG_NEVER: log_buf = "Log %s: %s" % (self.name, logline) handler_game.wiznet(log_buf, self, None, merc.WIZ_SECURE, 0, self.trust) @@ -532,20 +576,19 @@ def interpret(self, argument): self.desc.snoop_by.send(logline) self.desc.snoop_by.send("\n") if not cmd: - #* Look for command in socials table. + # * Look for command in socials table. if not Pc.check_social(self, command, argument): if settings.DETAILED_INVALID_COMMANDS: - #TODO: Levenshtein distance over cmd_table, also add a wait_state to prevent horrors + # TODO: Levenshtein distance over cmd_table, also add a wait_state to prevent horrors self.send("Huh? '%s' is not a valid command." % command) else: self.send("Huh?\n") return - #* Pc not in position for command? + # * Pc not in position for command? if self.position < cmd.position: if self.position == merc.POS_DEAD: self.send("Lie still; you are DEAD.\n") - elif self.position == merc.POS_MORTAL \ - or self.position == merc.POS_INCAP: + elif self.position == merc.POS_MORTAL or self.position == merc.POS_INCAP: self.send("You are hurt far too bad for that.\n") elif self.position == merc.POS_STUNNED: self.send("You are too stunned to do that.\n") @@ -574,14 +617,14 @@ def to_json(self, outer_encoder=None): for k, v in self.__dict__.items(): if str(type(v)) in ("", ""): continue - elif str(k) in ('desc', 'send'): + elif str(k) in ("desc", "send"): continue - elif str(k) in ('_last_saved', '_md5'): + elif str(k) in ("_last_saved", "_md5"): continue else: tmp_dict[k] = v - cls_name = '__class__/' + __name__ + '.' + self.__class__.__name__ + cls_name = "__class__/" + __name__ + "." + self.__class__.__name__ return {cls_name: outer_encoder(tmp_dict)} @classmethod @@ -589,55 +632,58 @@ def from_json(cls, data, outer_decoder=None): if outer_decoder is None: outer_decoder = json.JSONDecoder.decode - cls_name = '__class__/' + __name__ + '.' + cls.__name__ + cls_name = "__class__/" + __name__ + "." + cls.__name__ if cls_name in data: tmp_data = outer_decoder(data[cls_name]) return cls(**tmp_data) return data - def save_stub(self, logout: bool=False): + def save_stub(self, logout: bool = False): if logout: self._last_logout = time.time() - pathname = os.path.join(settings.PLAYER_DIR, self.name[0].lower(), self.name.capitalize()) + pathname = os.path.join( + settings.PLAYER_DIR, self.name[0].lower(), self.name.capitalize() + ) os.makedirs(pathname, 0o755, True) - filename = os.path.join(pathname, 'login.json') + filename = os.path.join(pathname, "login.json") stub = dict({}) - stub['name'] = self.name - stub['pwd'] = self.pwd - stub['auth'] = self.auth - stub['is_immortal'] = self.is_immortal() - stub['is_banned'] = self.act.is_set(merc.PLR_DENY) - stub['instance_id'] = self.instance_id - stub['last_login'] = self._last_login - stub['last_logout'] = self._last_logout - stub['room'] = self._saved_room_vnum + stub["name"] = self.name + stub["pwd"] = self.pwd + stub["auth"] = self.auth + stub["is_immortal"] = self.is_immortal() + stub["is_banned"] = self.act.is_set(merc.PLR_DENY) + stub["instance_id"] = self.instance_id + stub["last_login"] = self._last_login + stub["last_logout"] = self._last_logout + stub["room"] = self._saved_room_vnum js = json.dumps(stub, default=instance.to_json, indent=4, sort_keys=True) - with open(filename, 'w') as fp: + with open(filename, "w") as fp: fp.write(js) - @classmethod - def load_stub(cls, player_name: str=None): + def load_stub(cls, player_name: str = None): if not player_name: - raise KeyError('Player name is required to load a player!') + raise KeyError("Player name is required to load a player!") - pathname = os.path.join(settings.PLAYER_DIR, player_name[0].lower(), player_name.capitalize()) - filename = os.path.join(pathname, 'login.json') + pathname = os.path.join( + settings.PLAYER_DIR, player_name[0].lower(), player_name.capitalize() + ) + filename = os.path.join(pathname, "login.json") if os.path.isfile(filename): - logger.info('Loading %s player stub data', player_name) - with open(filename, 'r') as fp: + logger.info("Loading %s player stub data", player_name) + with open(filename, "r") as fp: data = json.load(fp, object_hook=instance.from_json) if isinstance(data, dict): return data else: - logger.error('Could not load player stub file for %s', player_name) + logger.error("Could not load player stub file for %s", player_name) return None else: - logger.error('Could not open player stub file for %s', player_name) + logger.error("Could not open player stub file for %s", player_name) return None - def save(self, logout: bool=False, force: bool=False): + def save(self, logout: bool = False, force: bool = False): if self._last_saved is None: self._last_saved = time.time() - settings.SAVE_LIMITER - 2 if not force and time.time() < self._last_saved + settings.SAVE_LIMITER: @@ -645,15 +691,17 @@ def save(self, logout: bool=False, force: bool=False): self._last_saved = time.time() self.save_stub(logout) - pathname = os.path.join(settings.PLAYER_DIR, self.name[0].lower(), self.name.capitalize()) + pathname = os.path.join( + settings.PLAYER_DIR, self.name[0].lower(), self.name.capitalize() + ) os.makedirs(pathname, 0o755, True) - filename = os.path.join(pathname, 'player.json') + filename = os.path.join(pathname, "player.json") # logger.info('Saving %s', filename) js = json.dumps(self, default=instance.to_json, indent=4, sort_keys=True) - md5 = hashlib.md5(js.encode('utf-8')).hexdigest() + md5 = hashlib.md5(js.encode("utf-8")).hexdigest() if self._md5 != md5: self._md5 = md5 - with open(filename, 'w') as fp: + with open(filename, "w") as fp: fp.write(js) if self.inventory: @@ -672,16 +720,18 @@ def save(self, logout: bool=False, force: bool=False): item.save(is_equipped=True, player_name=self.name, force=force) @classmethod - def load(cls, player_name: str=None): + def load(cls, player_name: str = None): if not player_name: - raise KeyError('Player name is required to load a player!') + raise KeyError("Player name is required to load a player!") - pathname = os.path.join(settings.PLAYER_DIR, player_name[0].lower(), player_name.capitalize()) - filename = os.path.join(pathname, 'player.json') + pathname = os.path.join( + settings.PLAYER_DIR, player_name[0].lower(), player_name.capitalize() + ) + filename = os.path.join(pathname, "player.json") if os.path.isfile(filename): - logger.info('Loading %s player data', player_name) - with open(filename, 'r') as fp: + logger.info("Loading %s player data", player_name) + with open(filename, "r") as fp: obj = json.load(fp, object_hook=instance.from_json) if isinstance(obj, Pc): obj._last_login = time.time() @@ -689,14 +739,18 @@ def load(cls, player_name: str=None): # This just ensures that all items the player has are actually loaded. if obj.inventory: for item_id in obj.inventory[:]: - handler_item.Items.load(instance_id=item_id, player_name=player_name) + handler_item.Items.load( + instance_id=item_id, player_name=player_name + ) for item_id in obj.equipped.values(): if item_id: - handler_item.Items.load(instance_id=item_id, player_name=player_name) + handler_item.Items.load( + instance_id=item_id, player_name=player_name + ) return obj else: - logger.error('Could not load player file for %s', player_name) + logger.error("Could not load player file for %s", player_name) return None else: - logger.error('Could not open player file for %s', player_name) + logger.error("Could not open player file for %s", player_name) return None diff --git a/src/rom24/handler_room.py b/src/rom24/handler_room.py index 956d78d..4560166 100644 --- a/src/rom24/handler_room.py +++ b/src/rom24/handler_room.py @@ -1,4 +1,3 @@ - import random import copy import os @@ -19,7 +18,12 @@ from rom24 import settings -class Room(instance.Instancer, environment.Environment, inventory.Inventory, type_bypass.ObjectType): +class Room( + instance.Instancer, + environment.Environment, + inventory.Inventory, + type_bypass.ObjectType, +): template_count = 0 instance_count = 0 @@ -53,13 +57,14 @@ def __init__(self, template=None, **kwargs): for t in self.special_inventory[:]: self.inventory += t[0] import importlib - words = t[1].split('.') + + words = t[1].split(".") class_name = words[-1] - module_name = '.'.join(words[0:-1]) - if module_name != '' and class_name != '': + module_name = ".".join(words[0:-1]) + if module_name != "" and class_name != "": module_ref = importlib.import_module(module_name) class_ref = getattr(module_ref, class_name) - if hasattr(class_ref, 'load'): + if hasattr(class_ref, "load"): return class_ref.load(t[0]) del self.special_inventory if self.instance_id: @@ -86,18 +91,27 @@ def __repr__(self): if not self.instance_id: return "" % self.vnum else: - return "" % (self.instance_id, self.vnum) + return "" % ( + self.instance_id, + self.vnum, + ) def put(self, instance_object): if not instance_object.instance_id in self.inventory: self.inventory += [instance_object.instance_id] instance_object._room_vnum = self.vnum else: - raise ValueError('Instance already present in room inventory %d' % instance_object.instance_id) + raise ValueError( + "Instance already present in room inventory %d" + % instance_object.instance_id + ) if instance_object.is_living: if not instance_object.is_npc(): - self.in_area.add_pc(instance_object) - if instance_object.slots.light and instance_object.slots.light.value[2] != 0: + self.in_area.add_pc(instance_object) + if ( + instance_object.slots.light + and instance_object.slots.light.value[2] != 0 + ): self.available_light += 1 if instance_object.is_affected(merc.AFF_PLAGUE): self.spread_plague(instance_object) @@ -117,17 +131,31 @@ def get(self, instance_object): self.inventory.remove(instance_object.instance_id) instance_object._room_vnum = None else: - raise KeyError('Instance is not in room inventory, trying to be removed %d' % instance_object.instance_id) + raise KeyError( + "Instance is not in room inventory, trying to be removed %d" + % instance_object.instance_id + ) if instance_object.is_living: if not instance_object.is_npc(): self.in_area.remove_pc(instance_object) - if instance_object.slots.light and instance_object.slots.light.value[2] != 0 and self.available_light > 0: + if ( + instance_object.slots.light + and instance_object.slots.light.value[2] != 0 + and self.available_light > 0 + ): self.available_light -= 1 elif instance_object.is_item: - if instance_object.flags.light and instance_object.value[2] != 0 and self.available_light > 0: + if ( + instance_object.flags.light + and instance_object.value[2] != 0 + and self.available_light > 0 + ): self.available_light -= 1 else: - raise TypeError('Unknown instance type trying to be removed from Room %r' % type(instance_object)) + raise TypeError( + "Unknown instance type trying to be removed from Room %r" + % type(instance_object) + ) if instance_object.on: instance_object.on = None instance_object.environment = None @@ -156,9 +184,15 @@ def is_dark(room_instance): return False if state_checks.IS_SET(room_instance.room_flags, merc.ROOM_DARK): return True - if room_instance.sector_type == merc.SECT_INSIDE or room_instance.sector_type == merc.SECT_CITY: + if ( + room_instance.sector_type == merc.SECT_INSIDE + or room_instance.sector_type == merc.SECT_CITY + ): return False - if handler_game.weather_info.sunlight == merc.SUN_SET or handler_game.weather_info.sunlight == merc.SUN_DARK: + if ( + handler_game.weather_info.sunlight == merc.SUN_SET + or handler_game.weather_info.sunlight == merc.SUN_DARK + ): return True return False @@ -167,9 +201,15 @@ def is_private(room_instance): if room_instance.owner: return True count = len(room_instance.people) - if state_checks.IS_SET(room_instance.room_flags, merc.ROOM_PRIVATE) and count >= 2: + if ( + state_checks.IS_SET(room_instance.room_flags, merc.ROOM_PRIVATE) + and count >= 2 + ): return True - if state_checks.IS_SET(room_instance.room_flags, merc.ROOM_SOLITARY) and count >= 1: + if ( + state_checks.IS_SET(room_instance.room_flags, merc.ROOM_SOLITARY) + and count >= 1 + ): return True if state_checks.IS_SET(room_instance.room_flags, merc.ROOM_IMP_ONLY): return True @@ -184,11 +224,11 @@ def to_json(self, outer_encoder=None): for k, v in self.__dict__.items(): if str(type(v)) in ("", ""): continue - elif str(k) in ('_last_saved', '_md5'): + elif str(k) in ("_last_saved", "_md5"): continue - elif str(k) == 'inventory' and v is not None: + elif str(k) == "inventory" and v is not None: # We need to save the inventory special to keep the type data with it. - t = 'special_inventory' + t = "special_inventory" tmp_dict[t] = [] for i in v: if i in instance.players: @@ -198,12 +238,20 @@ def to_json(self, outer_encoder=None): elif i in instance.areas: pass else: - tmp_dict[t].append(tuple((i, instance.global_instances[i].__module__ + '.' - + instance.global_instances[i].__class__.__name__))) + tmp_dict[t].append( + tuple( + ( + i, + instance.global_instances[i].__module__ + + "." + + instance.global_instances[i].__class__.__name__, + ) + ) + ) else: tmp_dict[k] = v - cls_name = '__class__/' + __name__ + '.' + self.__class__.__name__ + cls_name = "__class__/" + __name__ + "." + self.__class__.__name__ return {cls_name: outer_encoder(tmp_dict)} @classmethod @@ -211,13 +259,13 @@ def from_json(cls, data, outer_decoder=None): if outer_decoder is None: outer_decoder = json.JSONDecoder.decode - cls_name = '__class__/' + __name__ + '.' + cls.__name__ + cls_name = "__class__/" + __name__ + "." + cls.__name__ if cls_name in data: tmp_data = outer_decoder(data[cls_name]) return cls(**tmp_data) return data - def save(self, force: bool=False): + def save(self, force: bool = False): if self._last_saved is None: self._last_saved = time.time() - settings.SAVE_LIMITER - 2 if not force and time.time() < self._last_saved + settings.SAVE_LIMITER: @@ -233,16 +281,18 @@ def save(self, force: bool=False): area_number = self.in_area.instance_id else: area_number = self.in_area.index - pathname = os.path.join(top_dir, '%d-%s' % (area_number, self.in_area.name), 'rooms') + pathname = os.path.join( + top_dir, "%d-%s" % (area_number, self.in_area.name), "rooms" + ) os.makedirs(pathname, 0o755, True) - filename = os.path.join(pathname, '%d-room.json' % number) + filename = os.path.join(pathname, "%d-room.json" % number) # logger.info('Saving %s', filename) js = json.dumps(self, default=instance.to_json, indent=4, sort_keys=True) - md5 = hashlib.md5(js.encode('utf-8')).hexdigest() + md5 = hashlib.md5(js.encode("utf-8")).hexdigest() if self._md5 != md5: self._md5 = md5 - with open(filename, 'w') as fp: + with open(filename, "w") as fp: fp.write(js) if self.inventory: @@ -254,10 +304,10 @@ def save(self, force: bool=False): item.save(in_inventory=True, force=force) @classmethod - def load(cls, vnum: int=None, instance_id: int=None): + def load(cls, vnum: int = None, instance_id: int = None): if instance_id: if instance_id in instance.rooms: - logger.warn('Instance %d of room already loaded!', instance_id) + logger.warn("Instance %d of room already loaded!", instance_id) return pathname = settings.INSTANCE_DIR number = instance_id @@ -265,24 +315,26 @@ def load(cls, vnum: int=None, instance_id: int=None): pathname = settings.AREA_DIR number = vnum else: - raise ValueError('To load a Room, you must provide either a VNUM or an Instance_ID!') + raise ValueError( + "To load a Room, you must provide either a VNUM or an Instance_ID!" + ) - target_file = '%d-room.json' % number + target_file = "%d-room.json" % number filename = None for a_path, a_directory, i_files in os.walk(pathname): if target_file in i_files: filename = os.path.join(a_path, target_file) break if not filename: - raise ValueError('Cannot find %s' % target_file) + raise ValueError("Cannot find %s" % target_file) - with open(filename, 'r') as fp: + with open(filename, "r") as fp: obj = json.load(fp, object_hook=instance.from_json) if isinstance(obj, Room): # Inventory is already loaded by Room's __init__ function. return obj else: - logger.error('Could not load room data for %d', number) + logger.error("Could not load room data for %d", number) return None @@ -290,22 +342,31 @@ def get_room_by_vnum(vnum): room_id = instance.instances_by_room[vnum][0] return instance.rooms[room_id] + def get_random_room(ch): room = None while True: room = random.choice(instance.rooms.values()) - if ch.can_see_room(room) and not room.is_private() \ - and not state_checks.IS_SET(room.room_flags, merc.ROOM_PRIVATE) \ - and not state_checks.IS_SET(room.room_flags, merc.ROOM_SOLITARY) \ - and not state_checks.IS_SET(room.room_flags, merc.ROOM_SAFE) \ - and (ch.is_npc() or ch.act.is_set(merc.ACT_AGGRESSIVE) - or not state_checks.IS_SET(room.room_flags, merc.ROOM_LAW)): + if ( + ch.can_see_room(room) + and not room.is_private() + and not state_checks.IS_SET(room.room_flags, merc.ROOM_PRIVATE) + and not state_checks.IS_SET(room.room_flags, merc.ROOM_SOLITARY) + and not state_checks.IS_SET(room.room_flags, merc.ROOM_SAFE) + and ( + ch.is_npc() + or ch.act.is_set(merc.ACT_AGGRESSIVE) + or not state_checks.IS_SET(room.room_flags, merc.ROOM_LAW) + ) + ): break return room + def number_door(self=None): return random.randint(0, 5) + def find_door(ch, arg): if arg == "n" or arg == "north": door = 0 @@ -322,8 +383,12 @@ def find_door(ch, arg): else: for door in range(0, 5): pexit = ch.in_room.exit[door] - if pexit and pexit.exit_info.is_set(merc.EX_ISDOOR) and pexit.keyword \ - and arg in pexit.keyword: + if ( + pexit + and pexit.exit_info.is_set(merc.EX_ISDOOR) + and pexit.keyword + and arg in pexit.keyword + ): return door handler_game.act("I see no $T here.", ch, None, arg, merc.TO_CHAR) return -1 diff --git a/src/rom24/hotfix.py b/src/rom24/hotfix.py index 906b99a..33eb66f 100644 --- a/src/rom24/hotfix.py +++ b/src/rom24/hotfix.py @@ -1,4 +1,3 @@ - import os import importlib import traceback @@ -11,80 +10,80 @@ modified_files = {} -# Looks like we need to fix the directory for this init so that it will find the commands. +# Looks like we need to fix the directory for this init so that it will find the commands. + def init_file(path, modules): - #called by init_monitoring to begin tracking a file. + # called by init_monitoring to begin tracking a file. logger.info("Initializing monitoring for %s: %s", path, modules) loaded_modules = {m: importlib.import_module(m) for m in modules} logger.info("Adding %s to tracked paths.", path) tracked_files[path] = [os.path.getmtime(path), loaded_modules] logger.info("Successfully initialized %s", path) + def init_module(module): logger.info("Initializing module for %s", module) loaded_module = importlib.import_module(f"rom24.{module}") tracked_files[loaded_module.__file__] = os.path.getmtime(loaded_module.__file__) + def init_directory_module(directory_module): loaded_module = importlib.import_module(f"rom24.{directory_module}") dirpath = os.path.dirname(loaded_module.__file__) dir_items = os.listdir(dirpath) - dfiles = [f for f in dir_items if not f.startswith('__')] + dfiles = [f for f in dir_items if not f.startswith("__")] - logger.info('Tracking %d files in %s', len(dfiles), dirpath) + logger.info("Tracking %d files in %s", len(dfiles), dirpath) for dfile in dfiles: dfmodule = f"{directory_module}.{dfile.split('.')[0]}" init_module(dfmodule) def init_monitoring(): - #Called in main function to begin tracking files. - logger.info('Monitoring system initializing...') + # Called in main function to begin tracking files. + logger.info("Monitoring system initializing...") modules_to_init = [ - 'handler_ch', - 'handler_item', - 'handler_room', - 'shop_utils', - 'game_utils', - 'pyprogs', - 'affects', - 'effects' - ] - directories_to_init = [ - 'commands', - 'spells' + "handler_ch", + "handler_item", + "handler_room", + "shop_utils", + "game_utils", + "pyprogs", + "affects", + "effects", ] + directories_to_init = ["commands", "spells"] for module in modules_to_init: init_module(module) for directory in directories_to_init: init_directory_module(directory) - logger.info('done. (Monitoring system)') + logger.info("done. (Monitoring system)") def poll_files(): - #Called in game_loop of program to check if files have been modified. + # Called in game_loop of program to check if files have been modified. for fp, mod in tracked_files.items(): if mod != os.path.getmtime(fp): # File has been modified. - logger.warn('%s has been modified', fp) + logger.warn("%s has been modified", fp) tracked_files[fp] = os.path.getmtime(fp) modified_files[fp] = os.path.getmtime(fp) def reload_files(ch): # This will be broken - we need to import the module again - # but we're just doing file path and load times - we can + # but we're just doing file path and load times - we can # infer the module from the file path though. for fp, mod in modified_files.copy().items(): - import_path = fp.split('src')[-1] - module_name = import_path.replace('/', '.').lstrip('.').split('.py')[0] + import_path = fp.split("src")[-1] + module_name = import_path.replace("/", ".").lstrip(".").split(".py")[0] module = importlib.import_module(module_name) - logger.warn('Reloading %s from %s', module, fp) + logger.warn("Reloading %s from %s", module, fp) try: importlib.reload(module) except: ch.send(traceback.format_exc()) - logger.exception('Failed to reload %s', fp) + logger.exception("Failed to reload %s", fp) del modified_files[fp] diff --git a/src/rom24/immortal.py b/src/rom24/immortal.py index 1dc9244..89afa91 100644 --- a/src/rom24/immortal.py +++ b/src/rom24/immortal.py @@ -10,7 +10,7 @@ class Immortal: def __init__(self): super().__init__() - #Immortal + # Immortal self._trust = 0 self.invis_level = 0 self.incog_level = 0 diff --git a/src/rom24/instance.py b/src/rom24/instance.py index 150f20e..386bf87 100644 --- a/src/rom24/instance.py +++ b/src/rom24/instance.py @@ -1,5 +1,4 @@ - -__author__ = 'quixadhal' +__author__ = "quixadhal" import os import json @@ -11,7 +10,7 @@ from rom24 import settings -'''For the instance dicts, we are not going to make another pointer, or copy, of +"""For the instance dicts, we are not going to make another pointer, or copy, of the original entity. We are going to alias, or bind, the specific entity _instances[dict key] [entity] back to the original global_instances[dict key] [entity] pointer. This will give us a shared alias, not a copy. Lets us do a clean @@ -34,7 +33,7 @@ 'bob' >>>merc.mob_instances[mob.instance_id].name 'bob' -''' +""" max_instance_id = 0 previous_max_instance_id = 0 @@ -45,7 +44,9 @@ npc_templates = {} shop_templates = {} -global_instances = {} # This is the global instance list, the heart of the game data set +global_instances = ( + {} +) # This is the global instance list, the heart of the game data set areas = {} items = {} @@ -59,11 +60,11 @@ socials = {} resets = {} -''' +""" Contains lists of instances, Key: string VNUM Value: list Instance_ID of object associated with Key:VNUM -''' +""" instances_by_area = {} instances_by_item = {} instances_by_room = {} @@ -74,6 +75,7 @@ # Things to omit from instances that are in templates. not_to_instance = [] + def isnamedtuple(obj): """ Named Tuples look, to python, like a normal tuple, so we have to poke around @@ -84,10 +86,12 @@ def isnamedtuple(obj): :return: True if obj is a namedtuple :rtype: bool """ - return isinstance(obj, tuple) and \ - hasattr(obj, '_fields') and \ - hasattr(obj, '_asdict') and \ - callable(obj._asdict) + return ( + isinstance(obj, tuple) + and hasattr(obj, "_fields") + and hasattr(obj, "_asdict") + and callable(obj._asdict) + ) def to_json(data): @@ -118,19 +122,15 @@ def to_json(data): "__type__/namedtuple": { "type": type(data).__name__, "fields": list(data._fields), - "values": [to_json(getattr(data, f)) for f in data._fields] + "values": [to_json(getattr(data, f)) for f in data._fields], } } if isinstance(data, set): - return { - "__type__/set": [to_json(val) for val in data] - } + return {"__type__/set": [to_json(val) for val in data]} if isinstance(data, tuple): - return { - "__type__/tuple": [to_json(val) for val in data] - } + return {"__type__/tuple": [to_json(val) for val in data]} if isinstance(data, list): return [to_json(val) for val in data] @@ -140,17 +140,15 @@ def to_json(data): if isinstance(data, dict): if all(isinstance(k, str) for k in data): return {k: to_json(v) for k, v in data.items()} - return { - "__type__/dict": [[to_json(k), to_json(v)] for k, v in data.items()] - } + return {"__type__/dict": [[to_json(k), to_json(v)] for k, v in data.items()]} # Finally, the magic part.... if it wasn't a "normal" thing, check to see # if it has a to_json method. If so, use it! - if hasattr(data, 'to_json'): + if hasattr(data, "to_json"): return data.to_json(to_json) # And if we still get nothing useful, PUNT! - raise TypeError('Type %r not data-serializable' % type(data)) + raise TypeError("Type %r not data-serializable" % type(data)) def from_json(data): @@ -190,17 +188,18 @@ def from_json(data): # If we're a dict, we can check to see if we're a custom class. # If we are, we need to find out class definition and make sure # there's a from_json() method to call. If so, let it handle things. - if hasattr(data, 'keys'): + if hasattr(data, "keys"): for k in data.keys(): - found = re.findall('__class__\/((?:\w+)\.)*(\w+)', k) + found = re.findall("__class__\/((?:\w+)\.)*(\w+)", k) if found: import importlib - module_name = found[0][0].rstrip('.') + + module_name = found[0][0].rstrip(".") class_name = found[0][1] - if module_name != '' and class_name != '': - module_ref = importlib.import_module('rom24.' + module_name) + if module_name != "" and class_name != "": + module_ref = importlib.import_module("rom24." + module_name) class_ref = getattr(module_ref, class_name) - if hasattr(class_ref, 'from_json'): + if hasattr(class_ref, "from_json"): return class_ref.from_json(data, from_json) # If we have no idea, return whatever we are and hope someone else @@ -210,15 +209,24 @@ def from_json(data): def save(): os.makedirs(settings.INSTANCE_DIR, 0o755, True) - filename = os.path.join(settings.INSTANCE_DIR, 'list.json') + filename = os.path.join(settings.INSTANCE_DIR, "list.json") tmp_dict = {} for i in global_instances: if i in players: pass else: - tmp_dict[i] = [global_instances[i].__module__, global_instances[i].__class__.__name__] - with open(filename, 'w') as fp: - json.dump({'max_instance_id': max_instance_id, 'data': tmp_dict}, fp, default=to_json, indent=4, sort_keys=True) + tmp_dict[i] = [ + global_instances[i].__module__, + global_instances[i].__class__.__name__, + ] + with open(filename, "w") as fp: + json.dump( + {"max_instance_id": max_instance_id, "data": tmp_dict}, + fp, + default=to_json, + indent=4, + sort_keys=True, + ) for i in areas: areas[i].save(force=True) @@ -240,21 +248,22 @@ def save(): def load(): - filename = os.path.join(settings.INSTANCE_DIR, 'list.json') + filename = os.path.join(settings.INSTANCE_DIR, "list.json") if os.path.isfile(filename): - with open(filename, 'r') as fp: + with open(filename, "r") as fp: tmp_dict = json.load(fp, object_hook=from_json) global max_instance_id global global_instances - max_instance_id = tmp_dict['max_instance_id'] + max_instance_id = tmp_dict["max_instance_id"] import importlib - for k,v in tmp_dict['data']: + + for k, v in tmp_dict["data"]: module_ref = importlib.import_module(v[0]) class_ref = getattr(module_ref, v[1]) - if hasattr(class_ref, 'load'): + if hasattr(class_ref, "load"): obj = class_ref.load(instance_id=k) if isinstance(obj, class_ref): - logger.info('Restored instance %d (%r)', k, repr(obj)) + logger.info("Restored instance %d (%r)", k, repr(obj)) class Instancer: @@ -283,5 +292,7 @@ def instancer(self): global max_instance_id, global_instances max_instance_id += 1 if global_instances.get(max_instance_id, None): - raise ValueError('houston we have a problem - instance number already in global instances') + raise ValueError( + "houston we have a problem - instance number already in global instances" + ) self.instance_id = max_instance_id diff --git a/src/rom24/interp.py b/src/rom24/interp.py index 84affe3..2bb3a9c 100644 --- a/src/rom24/interp.py +++ b/src/rom24/interp.py @@ -1,4 +1,3 @@ - from collections import OrderedDict import logging @@ -18,29 +17,30 @@ def __init__(self, name, do_fun, position, level, log, show, default_arg=None): self.default_arg = default_arg setattr(living.Living, self.do_fun.__name__, self.do_fun) + # These commands don't need to be here but are, for order. These will always match first with prefixes. cmd_table = OrderedDict() -cmd_table['north'] = None -cmd_table['east'] = None -cmd_table['south'] = None -cmd_table['west'] = None -cmd_table['up'] = None -cmd_table['down'] = None -cmd_table['doat'] = None -cmd_table['buy'] = None -cmd_table['cast'] = None -cmd_table['follow'] = None -cmd_table['goto'] = None -cmd_table['group'] = None -cmd_table['hit'] = None -cmd_table['inventory'] = None -cmd_table['kill'] = None -cmd_table['look'] = None -cmd_table['who'] = None -cmd_table['autolist'] = None +cmd_table["north"] = None +cmd_table["east"] = None +cmd_table["south"] = None +cmd_table["west"] = None +cmd_table["up"] = None +cmd_table["down"] = None +cmd_table["doat"] = None +cmd_table["buy"] = None +cmd_table["cast"] = None +cmd_table["follow"] = None +cmd_table["goto"] = None +cmd_table["group"] = None +cmd_table["hit"] = None +cmd_table["inventory"] = None +cmd_table["kill"] = None +cmd_table["look"] = None +cmd_table["who"] = None +cmd_table["autolist"] = None def register_command(entry: cmd_type): cmd_table[entry.name] = entry - logger.debug(' %s registered in command table.', entry.name) + logger.debug(" %s registered in command table.", entry.name) diff --git a/src/rom24/inventory.py b/src/rom24/inventory.py index de3ff4f..733cbdd 100644 --- a/src/rom24/inventory.py +++ b/src/rom24/inventory.py @@ -16,11 +16,13 @@ def __init__(self): @property def people(self): - return tuple(char_id for char_id in self.inventory if char_id in instance.characters) + return tuple( + char_id for char_id in self.inventory if char_id in instance.characters + ) @property def items(self): - return tuple(item_id for item_id in self.inventory if item_id in instance.items) + return tuple(item_id for item_id in self.inventory if item_id in instance.items) def can_carry_n(self): if not self.is_npc() and self.level >= merc.LEVEL_IMMORTAL: diff --git a/src/rom24/item_flags.py b/src/rom24/item_flags.py index f43c317..0636024 100644 --- a/src/rom24/item_flags.py +++ b/src/rom24/item_flags.py @@ -1,4 +1,4 @@ -__author__ = 'syn' +__author__ = "syn" import sys import json import logging @@ -7,7 +7,13 @@ class ItemFlags: - def __init__(self, et_data: set=None, iaf_data: set=None, ir_data: set=None, wa_data: set=None): + def __init__( + self, + et_data: set = None, + iaf_data: set = None, + ir_data: set = None, + wa_data: set = None, + ): self._equips_to = set({}) if et_data: self._equips_to |= set(et_data) @@ -27,16 +33,16 @@ def __init__(self, et_data: set=None, iaf_data: set=None, ir_data: set=None, wa_ @property def head(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._equips_to else False @head.setter def head(self, is_equippable): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if is_equippable: self._equips_to |= {func_name} @@ -46,16 +52,16 @@ def head(self, is_equippable): @property def legs(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._equips_to else False @legs.setter def legs(self, is_equippable): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if is_equippable: self._equips_to |= {func_name} @@ -65,16 +71,16 @@ def legs(self, is_equippable): @property def feet(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._equips_to else False @feet.setter def feet(self, is_equippable): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if is_equippable: self._equips_to |= {func_name} @@ -84,16 +90,16 @@ def feet(self, is_equippable): @property def hands(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._equips_to else False @hands.setter def hands(self, is_equippable): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if is_equippable: self._equips_to |= {func_name} @@ -103,16 +109,16 @@ def hands(self, is_equippable): @property def float(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._equips_to else False @float.setter def float(self, is_equippable): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if is_equippable: self._equips_to |= {func_name} @@ -122,16 +128,16 @@ def float(self, is_equippable): @property def left_finger(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._equips_to else False @left_finger.setter def left_finger(self, is_equippable): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if is_equippable: self._equips_to |= {func_name} @@ -141,16 +147,16 @@ def left_finger(self, is_equippable): @property def right_finger(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._equips_to else False @right_finger.setter def right_finger(self, is_equippable): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if is_equippable: self._equips_to |= {func_name} @@ -160,16 +166,16 @@ def right_finger(self, is_equippable): @property def right_wrist(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._equips_to else False @right_wrist.setter def right_wrist(self, is_equippable): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if is_equippable: self._equips_to |= {func_name} @@ -179,16 +185,16 @@ def right_wrist(self, is_equippable): @property def left_wrist(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._equips_to else False @left_wrist.setter def left_wrist(self, is_equippable): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if is_equippable: self._equips_to |= {func_name} @@ -198,16 +204,16 @@ def left_wrist(self, is_equippable): @property def waist(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._equips_to else False @waist.setter def waist(self, is_equippable): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if is_equippable: self._equips_to |= {func_name} @@ -217,16 +223,16 @@ def waist(self, is_equippable): @property def about_body(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._equips_to else False @about_body.setter def about_body(self, is_equippable): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if is_equippable: self._equips_to |= {func_name} @@ -236,16 +242,16 @@ def about_body(self, is_equippable): @property def light(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._equips_to else False @light.setter def light(self, is_equippable): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if is_equippable: self._equips_to |= {func_name} @@ -255,16 +261,16 @@ def light(self, is_equippable): @property def body(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._equips_to else False @body.setter def body(self, is_equippable): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if is_equippable: self._equips_to |= {func_name} @@ -274,16 +280,16 @@ def body(self, is_equippable): @property def neck(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._equips_to else False @neck.setter def neck(self, is_equippable): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if is_equippable: self._equips_to |= {func_name} @@ -293,16 +299,16 @@ def neck(self, is_equippable): @property def collar(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._equips_to else False @collar.setter def collar(self, is_equippable): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if is_equippable: self._equips_to |= {func_name} @@ -312,16 +318,16 @@ def collar(self, is_equippable): @property def arms(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._equips_to else False @arms.setter def arms(self, is_equippable): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if is_equippable: self._equips_to |= {func_name} @@ -331,16 +337,16 @@ def arms(self, is_equippable): @property def off_hand(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._equips_to else False @off_hand.setter def off_hand(self, is_equippable): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if is_equippable: self._equips_to |= {func_name} @@ -350,16 +356,16 @@ def off_hand(self, is_equippable): @property def main_hand(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._equips_to else False @main_hand.setter def main_hand(self, is_equippable): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if is_equippable: self._equips_to |= {func_name} @@ -369,16 +375,16 @@ def main_hand(self, is_equippable): @property def held(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._equips_to else False @held.setter def held(self, is_equippable): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if is_equippable: self._equips_to |= {func_name} @@ -389,16 +395,16 @@ def held(self, is_equippable): @property def melt_drop(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._item_attributes else False @melt_drop.setter def melt_drop(self, has_attr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if has_attr: self._item_attributes |= {func_name} @@ -408,16 +414,16 @@ def melt_drop(self, has_attr): @property def rot_death(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._item_attributes else False @rot_death.setter def rot_death(self, has_attr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if has_attr: self._item_attributes |= {func_name} @@ -427,16 +433,16 @@ def rot_death(self, has_attr): @property def vis_death(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._item_attributes else False @vis_death.setter def vis_death(self, has_attr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if has_attr: self._item_attributes |= {func_name} @@ -446,16 +452,16 @@ def vis_death(self, has_attr): @property def sell_extract(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._item_attributes else False @sell_extract.setter def sell_extract(self, has_attr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if has_attr: self._item_attributes |= {func_name} @@ -465,16 +471,16 @@ def sell_extract(self, has_attr): @property def magic(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._item_attributes else False @magic.setter def magic(self, has_attr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if has_attr: self._item_attributes |= {func_name} @@ -484,16 +490,16 @@ def magic(self, has_attr): @property def glow(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._item_attributes else False @glow.setter def glow(self, has_attr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if has_attr: self._item_attributes |= {func_name} @@ -503,16 +509,16 @@ def glow(self, has_attr): @property def hum(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._item_attributes else False @hum.setter def hum(self, has_attr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if has_attr: self._item_attributes |= {func_name} @@ -522,16 +528,16 @@ def hum(self, has_attr): @property def dark(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._item_attributes else False @dark.setter def dark(self, has_attr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if has_attr: self._item_attributes |= {func_name} @@ -541,16 +547,16 @@ def dark(self, has_attr): @property def lock(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._item_attributes else False @lock.setter def lock(self, has_attr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if has_attr: self._item_attributes |= {func_name} @@ -560,16 +566,16 @@ def lock(self, has_attr): @property def evil(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._item_attributes else False @evil.setter def evil(self, has_attr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if has_attr: self._item_attributes |= {func_name} @@ -579,16 +585,16 @@ def evil(self, has_attr): @property def invis(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._item_attributes else False @invis.setter def invis(self, has_attr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if has_attr: self._item_attributes |= {func_name} @@ -598,16 +604,16 @@ def invis(self, has_attr): @property def bless(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._item_attributes else False @bless.setter def bless(self, has_attr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if has_attr: self._item_attributes |= {func_name} @@ -617,16 +623,16 @@ def bless(self, has_attr): @property def non_metal(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._item_attributes else False @non_metal.setter def non_metal(self, has_attr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if has_attr: self._item_attributes |= {func_name} @@ -636,16 +642,16 @@ def non_metal(self, has_attr): @property def had_timer(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._item_attributes else False @had_timer.setter def had_timer(self, has_attr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if has_attr: self._item_attributes |= {func_name} @@ -655,16 +661,16 @@ def had_timer(self, has_attr): @property def burn_proof(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._item_attributes else False @burn_proof.setter def burn_proof(self, has_attr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if has_attr: self._item_attributes |= {func_name} @@ -674,16 +680,16 @@ def burn_proof(self, has_attr): @property def take(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._item_attributes else False @take.setter def take(self, has_attr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if has_attr: self._item_attributes |= {func_name} @@ -693,16 +699,16 @@ def take(self, has_attr): @property def shop_inventory(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._item_attributes else False @shop_inventory.setter def shop_inventory(self, has_restr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if has_restr: self._item_attributes |= {func_name} @@ -739,16 +745,16 @@ def no_sac(self, has_restr): @property def no_remove(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._item_restrictions else False @no_remove.setter def no_remove(self, has_restr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if has_restr: self._item_restrictions |= {func_name} @@ -758,16 +764,16 @@ def no_remove(self, has_restr): @property def no_uncurse(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._item_restrictions else False @no_uncurse.setter def no_uncurse(self, has_restr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if has_restr: self._item_restrictions |= {func_name} @@ -777,16 +783,16 @@ def no_uncurse(self, has_restr): @property def no_purge(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._item_restrictions else False @no_purge.setter def no_purge(self, has_restr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if has_restr: self._item_restrictions |= {func_name} @@ -796,16 +802,16 @@ def no_purge(self, has_restr): @property def anti_good(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._item_restrictions else False @anti_good.setter def anti_good(self, has_restr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if has_restr: self._item_restrictions |= {func_name} @@ -815,16 +821,16 @@ def anti_good(self, has_restr): @property def anti_evil(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._item_restrictions else False @anti_evil.setter def anti_evil(self, has_restr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if has_restr: self._item_restrictions |= {func_name} @@ -834,16 +840,16 @@ def anti_evil(self, has_restr): @property def anti_neutral(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._item_restrictions else False @anti_neutral.setter def anti_neutral(self, has_restr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if has_restr: self._item_restrictions |= {func_name} @@ -853,16 +859,16 @@ def anti_neutral(self, has_restr): @property def no_locate(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._item_restrictions else False @no_locate.setter def no_locate(self, has_restr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if has_restr: self._item_restrictions |= {func_name} @@ -873,16 +879,16 @@ def no_locate(self, has_restr): @property def no_remove(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._item_restrictions else False @no_remove.setter def no_remove(self, has_restr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if has_restr: self._item_restrictions |= {func_name} @@ -892,16 +898,16 @@ def no_remove(self, has_restr): @property def no_uncurse(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._item_restrictions else False @no_uncurse.setter def no_uncurse(self, has_restr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if has_restr: self._item_restrictions |= {func_name} @@ -911,168 +917,168 @@ def no_uncurse(self, has_restr): @property def no_purge(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._item_restrictions else False @no_purge.setter def no_purge(self, has_restr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if has_restr: self._item_restrictions |= {func_name} else: self._item_restrictions -= {func_name} - + @property def two_handed(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._weapon_attributes else False - + @two_handed.setter def two_handed(self, weap_attr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if weap_attr: self._weapon_attributes |= {func_name} else: self._weapon_attributes -= {func_name} - + @property def flaming(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._weapon_attributes else False - + @flaming.setter def flaming(self, weap_attr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if weap_attr: self._weapon_attributes |= {func_name} else: self._weapon_attributes -= {func_name} - + @property def sharp(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._weapon_attributes else False - + @sharp.setter def sharp(self, weap_attr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if weap_attr: self._weapon_attributes |= {func_name} else: self._weapon_attributes -= {func_name} - + @property def frost(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._weapon_attributes else False - + @frost.setter def frost(self, weap_attr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if weap_attr: self._weapon_attributes |= {func_name} else: self._weapon_attributes -= {func_name} - + @property def vampiric(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._weapon_attributes else False - + @vampiric.setter def vampiric(self, weap_attr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if weap_attr: self._weapon_attributes |= {func_name} else: self._weapon_attributes -= {func_name} - + @property def vorpal(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._weapon_attributes else False - + @vorpal.setter def vorpal(self, weap_attr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if weap_attr: self._weapon_attributes |= {func_name} else: self._weapon_attributes -= {func_name} - + @property def shocking(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._weapon_attributes else False - + @shocking.setter def shocking(self, weap_attr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if weap_attr: self._weapon_attributes |= {func_name} else: self._weapon_attributes -= {func_name} - + @property def poison(self): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name return func_name if func_name in self._weapon_attributes else False - + @poison.setter def poison(self, weap_attr): """ - TODO: write documentation - """ + TODO: write documentation + """ func_name = sys._getframe().f_code.co_name if weap_attr: self._weapon_attributes |= {func_name} @@ -1084,13 +1090,13 @@ def to_json(self, outer_encoder=None): if outer_encoder is None: outer_encoder = json.JSONEncoder.default - cls_name = '__class__/' + __name__ + '.' + self.__class__.__name__ + cls_name = "__class__/" + __name__ + "." + self.__class__.__name__ return { cls_name: { - 'equips_to': outer_encoder(self._equips_to), - 'item_attributes': outer_encoder(self._item_attributes), - 'item_restrictions': outer_encoder(self._item_restrictions), - 'weapon_attributes': outer_encoder(self._weapon_attributes), + "equips_to": outer_encoder(self._equips_to), + "item_attributes": outer_encoder(self._item_attributes), + "item_restrictions": outer_encoder(self._item_restrictions), + "weapon_attributes": outer_encoder(self._weapon_attributes), } } @@ -1099,10 +1105,12 @@ def from_json(cls, data, outer_decoder=None): if outer_decoder is None: outer_decoder = json.JSONDecoder.decode - cls_name = '__class__/' + __name__ + '.' + cls.__name__ + cls_name = "__class__/" + __name__ + "." + cls.__name__ if cls_name in data: - return cls(et_data=outer_decoder(data[cls_name]['equips_to']), - iaf_data=outer_decoder(data[cls_name]['item_attributes']), - ir_data=outer_decoder(data[cls_name]['item_restrictions']), - wa_data=outer_decoder(data[cls_name]['weapon_attributes'])) + return cls( + et_data=outer_decoder(data[cls_name]["equips_to"]), + iaf_data=outer_decoder(data[cls_name]["item_attributes"]), + ir_data=outer_decoder(data[cls_name]["item_restrictions"]), + wa_data=outer_decoder(data[cls_name]["weapon_attributes"]), + ) return data diff --git a/src/rom24/living.py b/src/rom24/living.py index 9ac7115..571badf 100644 --- a/src/rom24/living.py +++ b/src/rom24/living.py @@ -1,4 +1,3 @@ - import random import logging @@ -30,6 +29,7 @@ def __init__(self): self.pet = None self.group = None self._clan = "" + # * It is very important that this be an equivalence relation: # * (1) A ~ A # * (2) if A ~ B then B ~ A @@ -64,11 +64,15 @@ def stop_follower(self): if self.is_affected(merc.AFF_CHARM): self.affected_by.rem_bit(merc.AFF_CHARM) - self.affect_strip('charm person') + self.affect_strip("charm person") if instance.characters[self.master].can_see(self) and self.in_room: - handler_game.act("$n stops following you.", self, None, self.master, merc.TO_VICT) - handler_game.act("You stop following $N.", self, None, self.master, merc.TO_CHAR) + handler_game.act( + "$n stops following you.", self, None, self.master, merc.TO_VICT + ) + handler_game.act( + "You stop following $N.", self, None, self.master, merc.TO_CHAR + ) if instance.characters[self.master].pet == self.instance_id: instance.characters[self.master].pet = None self.master = None @@ -132,7 +136,9 @@ def fighting(self, value): if type(value) is int: value = instance.characters.get(value, None) # Ensure fighting exists. if value and not isinstance(value, Fight): - logger.error("Instance fighting non combat. %s fighting %s", self.name, value.name) + logger.error( + "Instance fighting non combat. %s fighting %s", self.name, value.name + ) return if value: value = value.instance_id @@ -162,23 +168,25 @@ def check_immune(self, dam_type): elif self.vuln_flags.is_set(merc.VULN_MAGIC): defence = merc.IS_VULNERABLE - bit = {merc.DAM_BASH: merc.IMM_BASH, - merc.DAM_PIERCE: merc.IMM_PIERCE, - merc.DAM_SLASH: merc.IMM_SLASH, - merc.DAM_FIRE: merc.IMM_FIRE, - merc.DAM_COLD: merc.IMM_COLD, - merc.DAM_LIGHTNING: merc.IMM_LIGHTNING, - merc.DAM_ACID: merc.IMM_ACID, - merc.DAM_POISON: merc.IMM_POISON, - merc.DAM_NEGATIVE: merc.IMM_NEGATIVE, - merc.DAM_HOLY: merc.IMM_HOLY, - merc.DAM_ENERGY: merc.IMM_ENERGY, - merc.DAM_MENTAL: merc.IMM_MENTAL, - merc.DAM_DISEASE: merc.IMM_DISEASE, - merc.DAM_DROWNING: merc.IMM_DROWNING, - merc.DAM_LIGHT: merc.IMM_LIGHT, - merc.DAM_CHARM: merc.IMM_CHARM, - merc.DAM_SOUND: merc.IMM_SOUND} + bit = { + merc.DAM_BASH: merc.IMM_BASH, + merc.DAM_PIERCE: merc.IMM_PIERCE, + merc.DAM_SLASH: merc.IMM_SLASH, + merc.DAM_FIRE: merc.IMM_FIRE, + merc.DAM_COLD: merc.IMM_COLD, + merc.DAM_LIGHTNING: merc.IMM_LIGHTNING, + merc.DAM_ACID: merc.IMM_ACID, + merc.DAM_POISON: merc.IMM_POISON, + merc.DAM_NEGATIVE: merc.IMM_NEGATIVE, + merc.DAM_HOLY: merc.IMM_HOLY, + merc.DAM_ENERGY: merc.IMM_ENERGY, + merc.DAM_MENTAL: merc.IMM_MENTAL, + merc.DAM_DISEASE: merc.IMM_DISEASE, + merc.DAM_DROWNING: merc.IMM_DROWNING, + merc.DAM_LIGHT: merc.IMM_LIGHT, + merc.DAM_CHARM: merc.IMM_CHARM, + merc.DAM_SOUND: merc.IMM_SOUND, + } if dam_type not in bit: return defence @@ -210,9 +218,19 @@ def __init__(self): self.comm = bit.Bit(merc.COMM_COMBINE | merc.COMM_PROMPT, tables.comm_flags) -class Living(immortal.Immortal, Fight, Grouping, physical.Physical, - environment.Environment, affects.Affects, Communication, - inventory.Inventory, instance.Instancer, type_bypass.ObjectType, equipment.Equipment): +class Living( + immortal.Immortal, + Fight, + Grouping, + physical.Physical, + environment.Environment, + affects.Affects, + Communication, + inventory.Inventory, + instance.Instancer, + type_bypass.ObjectType, + equipment.Equipment, +): def __init__(self): super().__init__() self.is_living = True @@ -220,7 +238,7 @@ def __init__(self): self.version = 5 self.level = 0 self.act = bit.Bit(merc.PLR_NOSUMMON, [tables.act_flags, tables.plr_flags]) - self._race = 'human' + self._race = "human" self._guild = None self.sex = 0 self.level = 0 @@ -251,7 +269,7 @@ def race(self): try: return const.race_table[self._race] except KeyError: - return const.race_table['human'] + return const.race_table["human"] @race.setter def race(self, value): @@ -278,15 +296,23 @@ def get(self, instance_object): self.carry_weight -= instance_object.get_weight() instance_object.environment = None return instance_object - elif instance_object.is_item and instance_object.instance_id in self.equipped.values(): - raise KeyError('Item is in equipped dict, not inventory! %d' % instance_object.instance_id) + elif ( + instance_object.is_item + and instance_object.instance_id in self.equipped.values() + ): + raise KeyError( + "Item is in equipped dict, not inventory! %d" + % instance_object.instance_id + ) else: if not instance_object.is_item: - raise TypeError('Non-item object attempted ' - 'to be removed from character object - %s' % type(instance_object)) + raise TypeError( + "Non-item object attempted " + "to be removed from character object - %s" % type(instance_object) + ) def put(self, instance_object): - #if instance_object.is_item: + # if instance_object.is_item: self.inventory += [instance_object.instance_id] instance_object.environment = self.instance_id if not instance_object.instance_id in self.equipped.values(): @@ -294,8 +320,10 @@ def put(self, instance_object): self.carry_weight += instance_object.get_weight() return instance_object else: - raise KeyError('Item is in equipped dict, run, screaming! %d' % instance_object.instance_id) - + raise KeyError( + "Item is in equipped dict, run, screaming! %d" + % instance_object.instance_id + ) def send(self, pstr): pass @@ -314,7 +342,9 @@ def is_pc(self, val): elif val is False: self.act.set_bit(merc.ACT_IS_NPC) else: - raise ValueError(f"Invalid bit set for is_pc: {val}. Values can only be true or false.") + raise ValueError( + f"Invalid bit set for is_pc: {val}. Values can only be true or false." + ) def is_good(self): return self.alignment >= 350 @@ -337,7 +367,7 @@ def check_blind(self): return False return True - #/* command for retrieving stats */ + # /* command for retrieving stats */ def stat(self, stat): stat_max = 0 if self.is_npc() or self.level > merc.LEVEL_IMMORTAL: @@ -349,7 +379,7 @@ def stat(self, stat): stat_max += 2 if self.race == const.race_table["human"]: stat_max += 1 - stat_max = min(stat_max, 25); + stat_max = min(stat_max, 25) return max(3, min(self.perm_stat[stat] + self.mod_stat[stat], stat_max)) def exp_per_level(self, points): @@ -359,8 +389,13 @@ def exp_per_level(self, points): inc = 500 if points < 40: - return 1000 * const.pc_race_table[self.race.name].class_mult[self.guild.name] // 100 if \ - const.pc_race_table[self.race.name].class_mult[self.guild.name] else 1 + return ( + 1000 + * const.pc_race_table[self.race.name].class_mult[self.guild.name] + // 100 + if const.pc_race_table[self.race.name].class_mult[self.guild.name] + else 1 + ) # processing */ points -= 40 @@ -372,16 +407,22 @@ def exp_per_level(self, points): inc *= 2 points -= 10 expl += points * inc // 10 - return expl * const.pc_race_table[self.race.name].class_mult[self.guild.name] // 100 + return ( + expl + * const.pc_race_table[self.race.name].class_mult[self.guild.name] + // 100 + ) def reset(self): if self.is_npc(): return - if self.perm_hit == 0 \ - or self.perm_mana == 0 \ - or self.perm_move == 0 \ - or self.last_level == 0: + if ( + self.perm_hit == 0 + or self.perm_mana == 0 + or self.perm_move == 0 + or self.last_level == 0 + ): # do a FULL reset */ for loc in self.equipped.keys(): item = self.get_eq(loc) @@ -534,23 +575,25 @@ def can_see(self, victim): return False if self.trust < victim.incog_level and self.in_room != victim.in_room: return False - if (not self.is_npc() - and self.act.is_set(merc.PLR_HOLYLIGHT)) \ - or (self.is_npc() - and self.is_immortal()): + if (not self.is_npc() and self.act.is_set(merc.PLR_HOLYLIGHT)) or ( + self.is_npc() and self.is_immortal() + ): return True if self.is_affected(merc.AFF_BLIND): return False if self.in_room.is_dark() and not self.is_affected(merc.AFF_INFRARED): return False - if victim.is_affected(merc.AFF_INVISIBLE) \ - and not self.is_affected(merc.AFF_DETECT_INVIS): + if victim.is_affected(merc.AFF_INVISIBLE) and not self.is_affected( + merc.AFF_DETECT_INVIS + ): return False # sneaking */ - if victim.is_affected(merc.AFF_SNEAK) \ - and not self.is_affected(merc.AFF_DETECT_HIDDEN) \ - and victim.fighting is None: + if ( + victim.is_affected(merc.AFF_SNEAK) + and not self.is_affected(merc.AFF_DETECT_HIDDEN) + and victim.fighting is None + ): chance = victim.get_skill("sneak") chance += victim.stat(merc.STAT_DEX) * 3 // 2 chance -= self.stat(merc.STAT_INT) * 2 @@ -559,24 +602,24 @@ def can_see(self, victim): if random.randint(1, 99) < chance: return False - if victim.is_affected(merc.AFF_HIDE) \ - and not self.is_affected(merc.AFF_DETECT_HIDDEN) \ - and victim.fighting is None: + if ( + victim.is_affected(merc.AFF_HIDE) + and not self.is_affected(merc.AFF_DETECT_HIDDEN) + and victim.fighting is None + ): return False return True # * True if char can see obj. def can_see_item(self, item): - if not self.is_npc() \ - and self.act.is_set(merc.PLR_HOLYLIGHT): + if not self.is_npc() and self.act.is_set(merc.PLR_HOLYLIGHT): return True if type(item) == int: item = instance.items.get(item, None) if item.flags.vis_death: return False - if self.is_affected(merc.AFF_BLIND) \ - and item.item_type != merc.ITEM_POTION: + if self.is_affected(merc.AFF_BLIND) and item.item_type != merc.ITEM_POTION: return False if item.flags.light and item.value[2] != 0: return True @@ -584,8 +627,7 @@ def can_see_item(self, item): return False if item.flags.glow: return True - if self.in_room.is_dark() \ - and not self.is_affected(merc.AFF_DARK_VISION): + if self.in_room.is_dark() and not self.is_affected(merc.AFF_DARK_VISION): return False return True @@ -598,13 +640,26 @@ def can_see_room(self, room_id): if not room: logger.error("No room found for room_id: %s", room_id) return False - if state_checks.IS_SET(room.room_flags, merc.ROOM_IMP_ONLY) and self.trust < merc.MAX_LEVEL: + if ( + state_checks.IS_SET(room.room_flags, merc.ROOM_IMP_ONLY) + and self.trust < merc.MAX_LEVEL + ): return False - if state_checks.IS_SET(room.room_flags, merc.ROOM_GODS_ONLY) and not self.is_immortal(): + if ( + state_checks.IS_SET(room.room_flags, merc.ROOM_GODS_ONLY) + and not self.is_immortal() + ): return False - if state_checks.IS_SET(room.room_flags, merc.ROOM_HEROES_ONLY) and not self.is_immortal(): + if ( + state_checks.IS_SET(room.room_flags, merc.ROOM_HEROES_ONLY) + and not self.is_immortal() + ): return False - if state_checks.IS_SET(room.room_flags, merc.ROOM_NEWBIES_ONLY) and self.level > 5 and not self.is_immortal(): + if ( + state_checks.IS_SET(room.room_flags, merc.ROOM_NEWBIES_ONLY) + and self.level > 5 + and not self.is_immortal() + ): return False if not self.is_immortal() and room.clan and self.clan != room.clan: return False @@ -613,12 +668,12 @@ def can_see_room(self, room_id): # Extract a char from the world. def extract(self, fPull): if not self.in_room: - logger.warn('Character being extracted is not in a room.') + logger.warn("Character being extracted is not in a room.") # nuke_pets(ch) self.pet = None # just in case - #if fPull: + # if fPull: # die_follower( ch ) fight.stop_fighting(self, True) @@ -669,8 +724,11 @@ def get_char_room(ch, argument): if word == "self": return ch number, arg = game_utils.number_argument(argument) - ch_list = [instance.characters[rch_id] for rch_id in ch.in_room.people[:] - if game_utils.is_name(word, instance.characters[rch_id].name)] + ch_list = [ + instance.characters[rch_id] + for rch_id in ch.in_room.people[:] + if game_utils.is_name(word, instance.characters[rch_id].name) + ] if ch_list: try: if ch.can_see(ch_list[number - 1]): @@ -686,8 +744,11 @@ def get_char_world(ch, argument): return wch number, arg = game_utils.number_argument(argument) arg = arg.lower() - ch_list = [instance.characters[wch_id] for wch_id in sorted(instance.characters.keys()) - if game_utils.is_name(arg, instance.characters[wch_id].name)] + ch_list = [ + instance.characters[wch_id] + for wch_id in sorted(instance.characters.keys()) + if game_utils.is_name(arg, instance.characters[wch_id].name) + ] if ch_list: try: if ch.can_see(ch_list[number - 1]): @@ -700,7 +761,11 @@ def get_char_world(ch, argument): def get_item_list(ch, argument, contents): number, arg = game_utils.number_argument(argument) arg = arg.lower() - item_list = [instance.items[item_id] for item_id in contents if game_utils.is_name(arg, instance.items[item_id].name)] + item_list = [ + instance.items[item_id] + for item_id in contents + if game_utils.is_name(arg, instance.items[item_id].name) + ] if item_list: try: if ch.can_see_item(item_list[number - 1]): @@ -729,12 +794,12 @@ def get_item_wear(ch, argument): if item_id: item = instance.items[item_id] if ch.can_see_item(item) and game_utils.is_name(arg, item.name.lower()): - #print('inside') + # print('inside') count += 1 if count == number: - #print(item.name, '\n') - #print(item.instance_id, '\n') - #print(ch.equipped['main_hand']) + # print(item.name, '\n') + # print(item.instance_id, '\n') + # print(ch.equipped['main_hand']) return item else: continue @@ -760,8 +825,11 @@ def get_item_world(ch, argument): return item number, arg = game_utils.number_argument(argument) arg = arg.lower() - item_list = [instance.items[item_id] for item_id in sorted(instance.items.keys()) - if game_utils.is_name(arg, instance.items[item_id].name)] + item_list = [ + instance.items[item_id] + for item_id in sorted(instance.items.keys()) + if game_utils.is_name(arg, instance.items[item_id].name) + ] if item_list: try: if ch.can_see_item(item_list[number - 1]): @@ -774,8 +842,7 @@ def get_item_world(ch, argument): def can_drop_item(self, item): if not item.flags.no_drop: return True - if not self.is_npc() \ - and self.level >= merc.LEVEL_IMMORTAL: + if not self.is_npc() and self.level >= merc.LEVEL_IMMORTAL: return True return False @@ -786,35 +853,41 @@ def get_skill(self, sn): logger.error("BUG: Bad sn %s in get_skill." % sn) skill = 0 elif self.is_pc: - if self.level < const.skill_table[sn].skill_level[self.guild.name] or sn not in self.learned: + if ( + self.level < const.skill_table[sn].skill_level[self.guild.name] + or sn not in self.learned + ): skill = 0 else: skill = self.learned[sn] else: # mobiles */ if const.skill_table[sn].spell_fun is not None: skill = 40 + 2 * self.level - elif sn == 'sneak' or sn == 'hide': + elif sn == "sneak" or sn == "hide": skill = self.level * 2 + 20 - elif (sn == 'dodge' and self.off_flags.is_set(merc.OFF_DODGE)) \ - or (sn == 'parry' and self.off_flags.is_set(merc.OFF_PARRY)): + elif (sn == "dodge" and self.off_flags.is_set(merc.OFF_DODGE)) or ( + sn == "parry" and self.off_flags.is_set(merc.OFF_PARRY) + ): skill = self.level * 2 - elif sn == 'shield block': + elif sn == "shield block": skill = 10 + 2 * self.level - elif sn == 'second attack' \ - and (self.act.is_set(merc.ACT_WARRIOR) - or self.act.is_set(merc.ACT_THIEF)): + elif sn == "second attack" and ( + self.act.is_set(merc.ACT_WARRIOR) or self.act.is_set(merc.ACT_THIEF) + ): skill = 10 + 3 * self.level - elif sn == 'third attack' and self.act.is_set(merc.ACT_WARRIOR): + elif sn == "third attack" and self.act.is_set(merc.ACT_WARRIOR): skill = 4 * self.level - 40 - elif sn == 'hand to hand': + elif sn == "hand to hand": skill = 40 + 2 * self.level elif sn == "trip" and self.off_flags.is_set(merc.OFF_TRIP): skill = 10 + 3 * self.level elif sn == "bash" and self.off_flags.is_set(merc.OFF_BASH): skill = 10 + 3 * self.level - elif sn == "disarm" and (self.off_flags.is_set(merc.OFF_DISARM) - or self.act.is_set(merc.ACT_WARRIOR) - or self.act.is_set(merc.ACT_THIEF)): + elif sn == "disarm" and ( + self.off_flags.is_set(merc.OFF_DISARM) + or self.act.is_set(merc.ACT_WARRIOR) + or self.act.is_set(merc.ACT_THIEF) + ): skill = 20 + 3 * self.level elif sn == "berserk" and self.off_flags.is_set(merc.OFF_BERSERK): skill = 3 * self.level @@ -826,7 +899,16 @@ def get_skill(self, sn): skill = 40 + self.level elif sn == "recall": skill = 40 + self.level - elif sn in ["sword", "dagger", "spear", "mace", "axe", "flail", "whip", "polearm"]: + elif sn in [ + "sword", + "dagger", + "spear", + "mace", + "axe", + "flail", + "whip", + "polearm", + ]: skill = 40 + 5 * self.level // 2 else: skill = 0 @@ -842,7 +924,7 @@ def get_skill(self, sn): # for returning weapon information */ def get_weapon_sn(self): - wield = self.get_eq('main_hand') + wield = self.get_eq("main_hand") if not wield or wield.item_type != merc.ITEM_WEAPON: sn = "hand to hand" return sn @@ -877,7 +959,7 @@ def deduct_cost(self, cost): silver = min(self.silver, cost) gold = 0 if silver < cost: - gold = ((cost - silver + 99) // 100) + gold = (cost - silver + 99) // 100 silver = cost - 100 * gold self.gold -= gold self.silver -= silver @@ -918,10 +1000,10 @@ def apply_affect(self, aff_object): :rtype: nothing """ # redundant anc causes bugs! - #if not aff_object.enchanted: - # for paf in merc.itemTemplate[aff_object.vnum].affected: - # if paf.location != merc.APPLY_SPELL_AFFECT: - # self.affect_modify(paf, True) + # if not aff_object.enchanted: + # for paf in merc.itemTemplate[aff_object.vnum].affected: + # if paf.location != merc.APPLY_SPELL_AFFECT: + # self.affect_modify(paf, True) for paf in aff_object.affected: if paf.location == merc.APPLY_SPELL_AFFECT: @@ -932,10 +1014,10 @@ def apply_affect(self, aff_object): def raw_equip(self, item, to_location): self.equipped[to_location] = item.instance_id item.environment = self.instance_id - if item.flags.two_handed and 'main_hand' in item.equipped_to: - self.equipped['off_hand'] = item.instance_id + if item.flags.two_handed and "main_hand" in item.equipped_to: + self.equipped["off_hand"] = item.instance_id for i in range(4): - self.armor[i] -= item.apply_ac(i) + self.armor[i] -= item.apply_ac(i) self.apply_affect(item) if item.flags.light and item.value[2] != 0 and self.in_room: self.in_room.available_light += 1 @@ -952,10 +1034,17 @@ def can_equip(self, item, loc, should_replace=False, wverbose=False): # logger.exception("Encountered an exception trying to get the item from the environment.") # return - if (item.flags.anti_evil and self.is_evil()) or (item.flags.anti_good and self.is_good()) \ - or (item.flags.anti_neutral and self.is_neutral()): - handler_game.act("You are zapped by $p and drop it.", self, item, None, merc.TO_CHAR) - handler_game.act("$n is zapped by $p and drops it.", self, item, None, merc.TO_ROOM) + if ( + (item.flags.anti_evil and self.is_evil()) + or (item.flags.anti_good and self.is_good()) + or (item.flags.anti_neutral and self.is_neutral()) + ): + handler_game.act( + "You are zapped by $p and drop it.", self, item, None, merc.TO_CHAR + ) + handler_game.act( + "$n is zapped by $p and drops it.", self, item, None, merc.TO_ROOM + ) self.get(item) self.in_room.put(item) return False @@ -963,32 +1052,38 @@ def can_equip(self, item, loc, should_replace=False, wverbose=False): if not self.unequip(loc): return False if not self.is_npc(): - if loc == 'main_hand': + if loc == "main_hand": - if item.get_weight() > (const.str_app[self.stat(merc.STAT_STR)].wield * 10): + if item.get_weight() > ( + const.str_app[self.stat(merc.STAT_STR)].wield * 10 + ): if wverbose: - self.send('That weapon is too heavy for you to wield.\n') + self.send("That weapon is too heavy for you to wield.\n") return False elif item.flags.two_handed: if self.slots.off_hand and self.size < merc.SIZE_LARGE: if wverbose: - self.send('You need two hands free for that weapon.\n') + self.send("You need two hands free for that weapon.\n") return False elif self.size < merc.SIZE_LARGE: if wverbose: - self.send('That weapon is too large for you to wield.\n') + self.send("That weapon is too large for you to wield.\n") return False else: return True else: return True - elif loc == 'off_hand': - if self.slots.main_hand and item.flags.two_handed and self.size < merc.SIZE_LARGE: + elif loc == "off_hand": + if ( + self.slots.main_hand + and item.flags.two_handed + and self.size < merc.SIZE_LARGE + ): if wverbose: - self.send('Your hands are tied up with your weapon!\n') + self.send("Your hands are tied up with your weapon!\n") return False else: return True @@ -998,7 +1093,14 @@ def can_equip(self, item, loc, should_replace=False, wverbose=False): return True # * Equip a char with an obj. - def equip(self, item, replace: bool=False, verbose: bool=False, verbose_all: bool=False, to_loc: str=None): + def equip( + self, + item, + replace: bool = False, + verbose: bool = False, + verbose_all: bool = False, + to_loc: str = None, + ): """ :type item: int or Items @@ -1025,9 +1127,13 @@ def equip(self, item, replace: bool=False, verbose: bool=False, verbose_all: boo possible_slots = item.equips_to & self.slots.available if len(possible_slots) > 0: if not verbose: - success = self.can_equip(item, [k for k in possible_slots][0], False, False) + success = self.can_equip( + item, [k for k in possible_slots][0], False, False + ) else: - success = self.can_equip(item, [k for k in possible_slots][0], False, True) + success = self.can_equip( + item, [k for k in possible_slots][0], False, True + ) if not success: return else: @@ -1042,9 +1148,13 @@ def equip(self, item, replace: bool=False, verbose: bool=False, verbose_all: boo overlap = item.equips_to & all_slots if len(overlap) > 0: if not verbose: - success = self.can_equip(item, [k for k in overlap][0], True, False) + success = self.can_equip( + item, [k for k in overlap][0], True, False + ) else: - success = self.can_equip(item, [k for k in overlap][0], True, False) + success = self.can_equip( + item, [k for k in overlap][0], True, False + ) if not success: return else: @@ -1071,23 +1181,27 @@ def remove_affect(self, aff_object): :rtype: none Taken from unequip to shorten it, searches for Affects, and removes as needed """ - #if aff_object.is_item and not aff_object.enchanted: - #No idea why ROM was going back to the template for this one.. but to make it accurate, for now. - #for paf in merc.itemTemplate[aff_object.vnum].affected: - # if paf.location == merc.APPLY_SPELL_AFFECT: - # for lpaf in self.affected[:]: - # if lpaf.type == paf.type and lpaf.level == paf.level \ - # and lpaf.location == merc.APPLY_SPELL_AFFECT: - # self.affect_remove(lpaf) - # break - # else: - # self.affect_modify(paf, False) - # self.affect_check(paf.where, paf.bitvector) + # if aff_object.is_item and not aff_object.enchanted: + # No idea why ROM was going back to the template for this one.. but to make it accurate, for now. + # for paf in merc.itemTemplate[aff_object.vnum].affected: + # if paf.location == merc.APPLY_SPELL_AFFECT: + # for lpaf in self.affected[:]: + # if lpaf.type == paf.type and lpaf.level == paf.level \ + # and lpaf.location == merc.APPLY_SPELL_AFFECT: + # self.affect_remove(lpaf) + # break + # else: + # self.affect_modify(paf, False) + # self.affect_check(paf.where, paf.bitvector) for paf in aff_object.affected: if paf.location == merc.APPLY_SPELL_AFFECT: logger.error("Bug: Norm-Apply") for lpaf in self.affected: - if lpaf.type == paf.type and lpaf.level == paf.level and lpaf.location == merc.APPLY_SPELL_AFFECT: + if ( + lpaf.type == paf.type + and lpaf.level == paf.level + and lpaf.location == merc.APPLY_SPELL_AFFECT + ): logger.error("bug: location = %d" % lpaf.location) logger.error("bug: type = %d" % lpaf.type) self.affect_remove(lpaf) @@ -1097,7 +1211,7 @@ def remove_affect(self, aff_object): self.affect_check(paf.where, paf.bitvector) # Unequip a char with an obj. - def unequip(self, unequip_from, forced: bool=True, silent: bool=False): + def unequip(self, unequip_from, forced: bool = True, silent: bool = False): """ :param unequip_from: :type unequip_from: @@ -1116,21 +1230,21 @@ def unequip(self, unequip_from, forced: bool=True, silent: bool=False): item = instance.items[self.equipped[unequip_from]] except: return False - elif hasattr(unequip_from, 'is_item') and unequip_from.is_item: + elif hasattr(unequip_from, "is_item") and unequip_from.is_item: item = unequip_from else: return False if not item.is_item: - raise TypeError('Expected item on unequip, got %r' % type(item)) + raise TypeError("Expected item on unequip, got %r" % type(item)) if not forced: return False if item.flags.no_remove: handler_game.act("You can't remove $p.", self, item, None, merc.TO_CHAR) return False - #AC Removal preceeds the actual clearing of the item from the character equipped dict, and list - #This is because, apply_ac relies on the item being equipped to figure out its position on the character - #To determine what to actually apply, or remove. + # AC Removal preceeds the actual clearing of the item from the character equipped dict, and list + # This is because, apply_ac relies on the item being equipped to figure out its position on the character + # To determine what to actually apply, or remove. self.raw_unequip(item) if not silent: handler_game.act("$n stops using $p.", self, item, None, merc.TO_ROOM) @@ -1143,11 +1257,16 @@ def raw_unequip(self, item): for i in range(4): self.armor[i] += item.apply_ac(i) if item.flags.two_handed and self.slots.off_hand: - self.equipped['off_hand'] = None + self.equipped["off_hand"] = None self.equipped[item.equipped_to] = None self.inventory += [item.instance_id] self.remove_affect(item) - if item.flags.light and item.value[2] != 0 and self.in_room and self.in_room.available_light > 0: + if ( + item.flags.light + and item.value[2] != 0 + and self.in_room + and self.in_room.available_light > 0 + ): self.in_room.available_light -= 1 return @@ -1160,71 +1279,119 @@ def verbose_wear_strings(self, item, slot): :return: :rtype: """ - if slot == 'light': - handler_game.act("$n lights $p and holds it.", self, item, None, merc.TO_ROOM) - handler_game.act("You light $p and hold it.", self, item, None, merc.TO_CHAR) + if slot == "light": + handler_game.act( + "$n lights $p and holds it.", self, item, None, merc.TO_ROOM + ) + handler_game.act( + "You light $p and hold it.", self, item, None, merc.TO_CHAR + ) return - elif slot == 'left_finger': - handler_game.act("$n wears $p on $s left finger.", self, item, None, merc.TO_ROOM) - handler_game.act("You wear $p on your left finger.", self, item, None, merc.TO_CHAR) + elif slot == "left_finger": + handler_game.act( + "$n wears $p on $s left finger.", self, item, None, merc.TO_ROOM + ) + handler_game.act( + "You wear $p on your left finger.", self, item, None, merc.TO_CHAR + ) return - elif slot == 'right_finger': - handler_game.act("$n wears $p on $s right finger.", self, item, None, merc.TO_ROOM) - handler_game.act("You wear $p on your right finger.", self, item, None, merc.TO_CHAR) + elif slot == "right_finger": + handler_game.act( + "$n wears $p on $s right finger.", self, item, None, merc.TO_ROOM + ) + handler_game.act( + "You wear $p on your right finger.", self, item, None, merc.TO_CHAR + ) return - elif slot == 'neck': - handler_game.act("$n wears $p around $s neck.", self, item, None, merc.TO_ROOM) - handler_game.act("You wear $p around your neck.", self, item, None, merc.TO_CHAR) + elif slot == "neck": + handler_game.act( + "$n wears $p around $s neck.", self, item, None, merc.TO_ROOM + ) + handler_game.act( + "You wear $p around your neck.", self, item, None, merc.TO_CHAR + ) return - elif slot == 'collar': - handler_game.act("$n wears $p around $s collar.", self, item, None, merc.TO_ROOM) - handler_game.act("You wear $p around your collar.", self, item, None, merc.TO_CHAR) + elif slot == "collar": + handler_game.act( + "$n wears $p around $s collar.", self, item, None, merc.TO_ROOM + ) + handler_game.act( + "You wear $p around your collar.", self, item, None, merc.TO_CHAR + ) return - elif slot == 'body': + elif slot == "body": handler_game.act("$n wears $p on $s torso.", self, item, None, merc.TO_ROOM) - handler_game.act("You wear $p on your torso.", self, item, None, merc.TO_CHAR) + handler_game.act( + "You wear $p on your torso.", self, item, None, merc.TO_CHAR + ) return - elif slot == 'head': + elif slot == "head": handler_game.act("$n wears $p on $s head.", self, item, None, merc.TO_ROOM) - handler_game.act("You wear $p on your head.", self, item, None, merc.TO_CHAR) + handler_game.act( + "You wear $p on your head.", self, item, None, merc.TO_CHAR + ) return - elif slot == 'legs': + elif slot == "legs": handler_game.act("$n wears $p on $s legs.", self, item, None, merc.TO_ROOM) - handler_game.act("You wear $p on your legs.", self, item, None, merc.TO_CHAR) + handler_game.act( + "You wear $p on your legs.", self, item, None, merc.TO_CHAR + ) return - elif slot == 'feet': + elif slot == "feet": handler_game.act("$n wears $p on $s feet.", self, item, None, merc.TO_ROOM) - handler_game.act("You wear $p on your feet.", self, item, None, merc.TO_CHAR) + handler_game.act( + "You wear $p on your feet.", self, item, None, merc.TO_CHAR + ) return - elif slot == 'hands': + elif slot == "hands": handler_game.act("$n wears $p on $s hands.", self, item, None, merc.TO_ROOM) - handler_game.act("You wear $p on your hands.", self, item, None, merc.TO_CHAR) + handler_game.act( + "You wear $p on your hands.", self, item, None, merc.TO_CHAR + ) return - elif slot == 'arms': + elif slot == "arms": handler_game.act("$n wears $p on $s arms.", self, item, None, merc.TO_ROOM) - handler_game.act("You wear $p on your arms.", self, item, None, merc.TO_CHAR) + handler_game.act( + "You wear $p on your arms.", self, item, None, merc.TO_CHAR + ) return - elif slot == 'about_body': - handler_game.act("$n wears $p about $s torso.", self, item, None, merc.TO_ROOM) - handler_game.act("You wear $p about your torso.", self, item, None, merc.TO_CHAR) + elif slot == "about_body": + handler_game.act( + "$n wears $p about $s torso.", self, item, None, merc.TO_ROOM + ) + handler_game.act( + "You wear $p about your torso.", self, item, None, merc.TO_CHAR + ) return - elif slot == 'waist': - handler_game.act("$n wears $p about $s waist.", self, item, None, merc.TO_ROOM) - handler_game.act("You wear $p about your waist.", self, item, None, merc.TO_CHAR) + elif slot == "waist": + handler_game.act( + "$n wears $p about $s waist.", self, item, None, merc.TO_ROOM + ) + handler_game.act( + "You wear $p about your waist.", self, item, None, merc.TO_CHAR + ) return - elif slot == 'left_wrist': - handler_game.act("$n wears $p around $s left wrist.", self, item, None, merc.TO_ROOM) - handler_game.act("You wear $p around your left wrist.", self, item, None, merc.TO_CHAR) + elif slot == "left_wrist": + handler_game.act( + "$n wears $p around $s left wrist.", self, item, None, merc.TO_ROOM + ) + handler_game.act( + "You wear $p around your left wrist.", self, item, None, merc.TO_CHAR + ) return - elif slot == 'right_wrist': - handler_game.act("$n wears $p around $s right wrist.", self, item, None, merc.TO_ROOM) - handler_game.act("You wear $p around your right wrist.", self, item, None, merc.TO_CHAR) + elif slot == "right_wrist": + handler_game.act( + "$n wears $p around $s right wrist.", self, item, None, merc.TO_ROOM + ) + handler_game.act( + "You wear $p around your right wrist.", self, item, None, merc.TO_CHAR + ) return - elif slot == 'off_hand': + elif slot == "off_hand": handler_game.act("$n wears $p as a shield.", self, item, None, merc.TO_ROOM) handler_game.act("You wear $p as a shield.", self, item, None, merc.TO_CHAR) return - elif slot == 'main_hand': + elif slot == "main_hand": handler_game.act("$n wields $p.", self, item, None, merc.TO_ROOM) handler_game.act("You wield $p.", self, item, None, merc.TO_CHAR) sn = self.get_weapon_sn() @@ -1232,29 +1399,59 @@ def verbose_wear_strings(self, item, slot): return skill = self.get_weapon_skill(sn) if skill >= 100: - handler_game.act("$p feels like a part of you!", self, item, None, merc.TO_CHAR) + handler_game.act( + "$p feels like a part of you!", self, item, None, merc.TO_CHAR + ) elif skill > 85: - handler_game.act("You feel quite confident with $p.", self, item, None, merc.TO_CHAR) + handler_game.act( + "You feel quite confident with $p.", self, item, None, merc.TO_CHAR + ) elif skill > 70: - handler_game.act("You are skilled with $p.", self, item, None, merc.TO_CHAR) + handler_game.act( + "You are skilled with $p.", self, item, None, merc.TO_CHAR + ) elif skill > 50: - handler_game.act("Your skill with $p is adequate.", self, item, None, merc.TO_CHAR) + handler_game.act( + "Your skill with $p is adequate.", self, item, None, merc.TO_CHAR + ) elif skill > 25: - handler_game.act("$p feels a little clumsy in your hands.", self, item, None, merc.TO_CHAR) + handler_game.act( + "$p feels a little clumsy in your hands.", + self, + item, + None, + merc.TO_CHAR, + ) elif skill > 1: - handler_game.act("You fumble and almost drop $p.", self, item, None, merc.TO_CHAR) + handler_game.act( + "You fumble and almost drop $p.", self, item, None, merc.TO_CHAR + ) else: - handler_game.act("You don't even know which end is up on $p.", self, item, None, merc.TO_CHAR) + handler_game.act( + "You don't even know which end is up on $p.", + self, + item, + None, + merc.TO_CHAR, + ) return - elif slot == 'held': + elif slot == "held": handler_game.act("$n holds $p in $s hand.", self, item, None, merc.TO_ROOM) - handler_game.act("You hold $p in your hand.", self, item, None, merc.TO_CHAR) + handler_game.act( + "You hold $p in your hand.", self, item, None, merc.TO_CHAR + ) return - elif slot == 'float': - handler_game.act("$n releases $p to float next to $m.", self, item, None, merc.TO_ROOM) - handler_game.act("You release $p and it floats next to you.", self, item, None, merc.TO_CHAR) + elif slot == "float": + handler_game.act( + "$n releases $p to float next to $m.", self, item, None, merc.TO_ROOM + ) + handler_game.act( + "You release $p and it floats next to you.", + self, + item, + None, + merc.TO_CHAR, + ) return else: - raise LookupError('Unable to find verbose wear string for %s' % slot) - - + raise LookupError("Unable to find verbose wear string for %s" % slot) diff --git a/src/rom24/magic.py b/src/rom24/magic.py index af8d7a9..4cb527e 100644 --- a/src/rom24/magic.py +++ b/src/rom24/magic.py @@ -1,6 +1,3 @@ - - - def spell_null(sn, level, ch, victim, target): ch.send("That's not a spell! \n") return diff --git a/src/rom24/merc.py b/src/rom24/merc.py index e972846..036303f 100644 --- a/src/rom24/merc.py +++ b/src/rom24/merc.py @@ -1,5 +1,3 @@ - - import time import collections import logging @@ -8,8 +6,8 @@ from rom24 import state_checks -#Merc Setup -#Letter->Bit conversion +# Merc Setup +# Letter->Bit conversion A = 1 B = 1 << 1 C = 1 << 2 @@ -63,22 +61,22 @@ yy = 1 << 50 zz = 1 << 51 -#Boot Time, Current Time +# Boot Time, Current Time boot_time = time.time() current_time = 0 -#Old Style Lists +# Old Style Lists descriptor_list = [] shop_list = [] help_list = [] greeting_list = [] social_list = [] -''' +""" Game Defines -''' +""" -#Wiznet Flags +# Wiznet Flags WIZ_ON = A WIZ_TICKS = B WIZ_LOGINS = C @@ -107,52 +105,52 @@ MAX_GROUP = 30 MAX_LEVEL = 60 MAX_ALIAS = 10 -LEVEL_HERO = (MAX_LEVEL - 9) -LEVEL_IMMORTAL = (MAX_LEVEL - 8) - -ML = MAX_LEVEL # implementor */ -L1 = MAX_LEVEL - 1 # creator */ -L2 = MAX_LEVEL - 2 # supreme being */ -L3 = MAX_LEVEL - 3 # deity */ -L4 = MAX_LEVEL - 4 # god */ -L5 = MAX_LEVEL - 5 # immortal */ -L6 = MAX_LEVEL - 6 # demigod */ -L7 = MAX_LEVEL - 7 # angel */ -L8 = MAX_LEVEL - 8 # avatar */ +LEVEL_HERO = MAX_LEVEL - 9 +LEVEL_IMMORTAL = MAX_LEVEL - 8 + +ML = MAX_LEVEL # implementor */ +L1 = MAX_LEVEL - 1 # creator */ +L2 = MAX_LEVEL - 2 # supreme being */ +L3 = MAX_LEVEL - 3 # deity */ +L4 = MAX_LEVEL - 4 # god */ +L5 = MAX_LEVEL - 5 # immortal */ +L6 = MAX_LEVEL - 6 # demigod */ +L7 = MAX_LEVEL - 7 # angel */ +L8 = MAX_LEVEL - 8 # avatar */ IM = LEVEL_IMMORTAL # avatar */ HE = LEVEL_HERO # hero */ -#TODO: RemoveDebug - switch to false +# TODO: RemoveDebug - switch to false GDCF = True GDF = True -#Global Constants +# Global Constants PULSE_PER_SECOND = 4 MILLISECONDS_PER_PULSE = float(1000.0 / PULSE_PER_SECOND) -PULSE_VIOLENCE = (3 * PULSE_PER_SECOND) -PULSE_MOBILE = (4 * PULSE_PER_SECOND) -PULSE_MUSIC = (6 * PULSE_PER_SECOND) -PULSE_TICK = (60 * PULSE_PER_SECOND) -PULSE_AREA = (120 * PULSE_PER_SECOND) +PULSE_VIOLENCE = 3 * PULSE_PER_SECOND +PULSE_MOBILE = 4 * PULSE_PER_SECOND +PULSE_MUSIC = 6 * PULSE_PER_SECOND +PULSE_TICK = 60 * PULSE_PER_SECOND +PULSE_AREA = 120 * PULSE_PER_SECOND -#Time - Quarter of Day +# Time - Quarter of Day SUN_DARK = 0 SUN_RISE = 1 SUN_LIGHT = 2 SUN_SET = 3 -#Weather Defines +# Weather Defines SKY_CLOUDLESS = 0 SKY_CLOUDY = 1 SKY_RAINING = 2 SKY_LIGHTNING = 3 -#Dice Numbers +# Dice Numbers DICE_NUMBER = 0 DICE_TYPE = 1 DICE_BONUS = 2 -#Target types +# Target types TAR_IGNORE = 0 TAR_CHAR_OFFENSIVE = 1 TAR_CHAR_DEFENSIVE = 2 @@ -166,19 +164,19 @@ TARGET_ROOM = 2 TARGET_NONE = 3 -#To types for act function +# To types for act function TO_ROOM = 0 TO_NOTVICT = 1 TO_VICT = 2 TO_CHAR = 3 TO_ALL = 4 -#Log types +# Log types LOG_NORMAL = 0 LOG_ALWAYS = 1 LOG_NEVER = 2 -#Damage classes +# Damage classes DAM_NONE = 0 DAM_BASH = 1 DAM_PIERCE = 2 @@ -202,10 +200,10 @@ PAGELEN = 22 -#Pc Tracking +# Pc Tracking max_on = 0 -#Where definitions +# Where definitions TO_AFFECTS = 0 TO_OBJECT = 1 TO_IMMUNE = 2 @@ -213,17 +211,17 @@ TO_VULN = 4 TO_WEAPON = 5 -#Vulnerability States +# Vulnerability States IS_NORMAL = 0 IS_IMMUNE = 1 IS_RESISTANT = 2 IS_VULNERABLE = 3 -#Hit or Undefined +# Hit or Undefined TYPE_UNDEFINED = -1 TYPE_HIT = 1000 -#Affected by Bits +# Affected by Bits AFF_BLIND = A AFF_INVISIBLE = B AFF_DETECT_EVIL = C @@ -256,34 +254,38 @@ AFF_SLOW = dd -''' +""" Character Defines -''' - - -''' Equipment Slot Strings - for use with displaying EQ to characters ''' - -eq_slot_strings = collections.OrderedDict([('light', ' '), - ('left_finger', ' '), - ('right_finger', ' '), - ('neck', ' '), - ('collar', ' '), - ('body', ' '), - ('head', ' '), - ('legs', ' '), - ('feet', ' '), - ('hands', ' '), - ('arms', ' '), - ('off_hand', ' '), - ('about_body', ' '), - ('waist', ' '), - ('left_wrist', ' '), - ('right_wrist', ' '), - ('main_hand', ' '), - ('held', ' '), - ('float', ' ')]) - -#Immunity Bits +""" + + +""" Equipment Slot Strings - for use with displaying EQ to characters """ + +eq_slot_strings = collections.OrderedDict( + [ + ("light", " "), + ("left_finger", " "), + ("right_finger", " "), + ("neck", " "), + ("collar", " "), + ("body", " "), + ("head", " "), + ("legs", " "), + ("feet", " "), + ("hands", " "), + ("arms", " "), + ("off_hand", " "), + ("about_body", " "), + ("waist", " "), + ("left_wrist", " "), + ("right_wrist", " "), + ("main_hand", " "), + ("held", " "), + ("float", " "), + ] +) + +# Immunity Bits IMM_SUMMON = A IMM_CHARM = B IMM_MAGIC = C @@ -308,7 +310,7 @@ IMM_SILVER = Y IMM_IRON = Z -#Resist Bits +# Resist Bits RES_SUMMON = A RES_CHARM = B RES_MAGIC = C @@ -333,7 +335,7 @@ RES_SILVER = Y RES_IRON = Z -#Vulnerable Bits +# Vulnerable Bits VULN_SUMMON = A VULN_CHARM = B VULN_MAGIC = C @@ -358,19 +360,19 @@ VULN_SILVER = Y VULN_IRON = Z -#Sexes +# Sexes SEX_NEUTRAL = 0 SEX_MALE = 1 SEX_FEMALE = 2 -#Stats +# Stats STAT_STR = 0 STAT_INT = 1 STAT_WIS = 2 STAT_DEX = 3 STAT_CON = 4 -#Sizes +# Sizes SIZE_TINY = 0 SIZE_SMALL = 1 SIZE_MEDIUM = 2 @@ -384,7 +386,7 @@ AC_SLASH = 2 AC_EXOTIC = 3 -#Positions +# Positions POS_DEAD = 0 POS_MORTAL = 1 POS_INCAP = 2 @@ -396,7 +398,7 @@ POS_STANDING = 8 # ACT bits for players. -PLR_IS_NPC = A # Don't EVER set. */ +PLR_IS_NPC = A # Don't EVER set. */ # RT auto flags */ PLR_AUTOASSIST = C @@ -421,13 +423,13 @@ PLR_KILLER = aa PLR_OMNI = bb -#Player Conditions +# Player Conditions COND_DRUNK = 0 COND_FULL = 1 COND_THIRST = 2 COND_HUNGER = 3 -#RT Comm Flags +# RT Comm Flags COMM_QUIET = A COMM_DEAF = B COMM_NOWIZ = C @@ -439,7 +441,7 @@ COMM_NOQUOTE = I COMM_SHOUTSOFF = J -#Display Flags +# Display Flags COMM_COMPACT = L COMM_BRIEF = M COMM_PROMPT = N @@ -448,7 +450,7 @@ COMM_SHOW_AFFECTS = Q COMM_NOGRATS = R -#Comm Penalties +# Comm Penalties COMM_NOEMOTE = T COMM_NOSHOUT = U COMM_NOTELL = V @@ -456,7 +458,7 @@ COMM_SNOOP_PROOF = Y COMM_AFK = Z -#Assist Bits +# Assist Bits ASSIST_ALL = P ASSIST_ALIGN = Q ASSIST_RACE = R @@ -464,16 +466,16 @@ ASSIST_GUARD = T ASSIST_VNUM = U -#ACT Bits for NPCs +# ACT Bits for NPCs ACT_IS_NPC = A # Auto set for mobs */ ACT_SENTINEL = B # Stays in one room */ ACT_SCAVENGER = C # Picks up objects */ -ACT_AGGRESSIVE = F # Attacks PC's */ -ACT_STAY_AREA = G # Won't leave area */ +ACT_AGGRESSIVE = F # Attacks PC's */ +ACT_STAY_AREA = G # Won't leave area */ ACT_WIMPY = H -ACT_PET = I # Auto set for pets */ -ACT_TRAIN = J # Can train PC's */ -ACT_PRACTICE = K # Can practice PC's */ +ACT_PET = I # Auto set for pets */ +ACT_TRAIN = J # Can train PC's */ +ACT_PRACTICE = K # Can practice PC's */ ACT_UNDEAD = O ACT_CLERIC = Q ACT_MAGE = R @@ -488,7 +490,7 @@ ACT_UPDATE_ALWAYS = cc ACT_IS_CHANGER = dd -#Offensive Bits +# Offensive Bits OFF_AREA_ATTACK = A OFF_BACKSTAB = B OFF_BASH = C @@ -505,14 +507,14 @@ OFF_TRIP = N OFF_CRUSH = O -#Body Form Bits, descriptive +# Body Form Bits, descriptive FORM_EDIBLE = A FORM_POISON = B FORM_MAGICAL = C FORM_INSTANT_DECAY = D FORM_OTHER = E # defined by material bit */ -#Character Form Bits +# Character Form Bits FORM_ANIMAL = G FORM_SENTIENT = H FORM_UNDEAD = I @@ -535,7 +537,7 @@ FORM_FISH = bb FORM_COLD_BLOOD = cc -#Body Parts Bits +# Body Parts Bits PART_HEAD = A PART_ARMS = B PART_LEGS = C @@ -554,26 +556,26 @@ PART_WINGS = P PART_TAIL = Q -#Parts Combat Bits +# Parts Combat Bits PART_CLAWS = U PART_FANGS = V PART_HORNS = W PART_SCALES = X PART_TUSKS = Y -#NPC Memory Flags +# NPC Memory Flags MEM_CUSTOMER = A MEM_SELLER = B MEM_HOSTILE = C MEM_AFRAID = D -''' +""" Room Defines -''' +""" -#Room Sector Types +# Room Sector Types SECT_INSIDE = 0 SECT_CITY = 1 SECT_FIELD = 2 @@ -587,7 +589,7 @@ SECT_DESERT = 10 SECT_MAX = 11 -#Directions +# Directions DIR_NORTH = 0 DIR_EAST = 1 DIR_SOUTH = 2 @@ -595,12 +597,12 @@ DIR_UP = 4 DIR_DOWN = 5 -#Movement +# Movement dir_name = ["north", "east", "south", "west", "up", "down"] rev_dir = [2, 3, 0, 1, 5, 4] movement_loss = [1, 2, 2, 3, 4, 6, 4, 1, 6, 10, 6] -#Static Room VNUMs +# Static Room VNUMs ROOM_VNUM_LIMBO = 2 ROOM_VNUM_CHAT = 1200 ROOM_VNUM_TEMPLE = 3001 @@ -611,7 +613,7 @@ ROOM_VNUM_DEMISE = 4201 ROOM_VNUM_HONOR = 4300 -#Room Flags +# Room Flags ROOM_DARK = A ROOM_NO_MOB = C ROOM_INDOORS = D @@ -627,7 +629,7 @@ ROOM_LAW = S ROOM_NOWHERE = T -#Exit Flags +# Exit Flags EX_ISDOOR = A EX_CLOSED = B EX_LOCKED = C @@ -640,12 +642,12 @@ EX_NOLOCK = L -''' +""" Item Defines -''' +""" -#Apply Types +# Apply Types APPLY_NONE = 0 APPLY_STR = 1 APPLY_DEX = 2 @@ -674,38 +676,38 @@ APPLY_SAVING_SPELL = 24 APPLY_SPELL_AFFECT = 25 -#Item types -ITEM_LIGHT = 'light' -ITEM_SCROLL = 'scroll' -ITEM_WAND = 'wand' -ITEM_STAFF = 'staff' -ITEM_WEAPON = 'weapon' -ITEM_TREASURE = 'treasure' -ITEM_ARMOR = 'armor' -ITEM_POTION = 'potion' -ITEM_CLOTHING = 'clothing' -ITEM_FURNITURE = 'furniture' -ITEM_TRASH = 'trash' -ITEM_CONTAINER = 'container' -ITEM_DRINK_CON = 'drink' -ITEM_KEY = 'key' -ITEM_FOOD = 'food' -ITEM_MONEY = 'money' -ITEM_BOAT = 'boat' -ITEM_CORPSE_NPC = 'npc_corpse' -ITEM_CORPSE_PC = 'pc_corpse' -ITEM_FOUNTAIN = 'fountain' -ITEM_PILL = 'pill' -ITEM_PROTECT = 'protect' -ITEM_MAP = 'map' -ITEM_PORTAL = 'portal' -ITEM_WARP_STONE = 'warp_stone' -ITEM_ROOM_KEY = 'room_key' -ITEM_GEM = 'gem' -ITEM_JEWELRY = 'jewelry' -ITEM_JUKEBOX = 'jukebox' - -#Weapon Types +# Item types +ITEM_LIGHT = "light" +ITEM_SCROLL = "scroll" +ITEM_WAND = "wand" +ITEM_STAFF = "staff" +ITEM_WEAPON = "weapon" +ITEM_TREASURE = "treasure" +ITEM_ARMOR = "armor" +ITEM_POTION = "potion" +ITEM_CLOTHING = "clothing" +ITEM_FURNITURE = "furniture" +ITEM_TRASH = "trash" +ITEM_CONTAINER = "container" +ITEM_DRINK_CON = "drink" +ITEM_KEY = "key" +ITEM_FOOD = "food" +ITEM_MONEY = "money" +ITEM_BOAT = "boat" +ITEM_CORPSE_NPC = "npc_corpse" +ITEM_CORPSE_PC = "pc_corpse" +ITEM_FOUNTAIN = "fountain" +ITEM_PILL = "pill" +ITEM_PROTECT = "protect" +ITEM_MAP = "map" +ITEM_PORTAL = "portal" +ITEM_WARP_STONE = "warp_stone" +ITEM_ROOM_KEY = "room_key" +ITEM_GEM = "gem" +ITEM_JEWELRY = "jewelry" +ITEM_JUKEBOX = "jukebox" + +# Weapon Types WEAPON_EXOTIC = 0 WEAPON_SWORD = 1 WEAPON_DAGGER = 2 @@ -716,7 +718,7 @@ WEAPON_WHIP = 7 WEAPON_POLEARM = 8 -#Item constants +# Item constants OBJ_VNUM_SILVER_ONE = 1 OBJ_VNUM_GOLD_ONE = 2 OBJ_VNUM_GOLD_SOME = 3 @@ -752,14 +754,14 @@ OBJ_VNUM_MAP = 3162 OBJ_VNUM_WHISTLE = 2116 -#Gate Flags +# Gate Flags GATE_NORMAL_EXIT = A GATE_NOCURSE = B GATE_GOWITH = C GATE_BUGGY = D GATE_RANDOM = E -#Furniture Flags +# Furniture Flags STAND_AT = A STAND_ON = B STAND_IN = C @@ -777,7 +779,7 @@ PUT_IN = O PUT_INSIDE = P -#Container Values (EG, Bags, etc) +# Container Values (EG, Bags, etc) CONT_CLOSEABLE = 1 CONT_PICKPROOF = 2 CONT_CLOSED = 4 @@ -785,82 +787,90 @@ CONT_PUT_ON = 16 -''' +""" Conversion Maps -''' - - -#Item Bits -rom_wear_flag_map = {'A': 'Take', - 'B': 'Finger', - 'C': 'Neck', - 'D': 'Body', - 'E': 'Head', - 'F': 'Legs', - 'G': 'Feet', - 'H': 'Hands', - 'I': 'Arms', - 'J': 'Shield', - 'K': 'About', - 'L': 'Waist', - 'M': 'Wrist', - 'N': 'Main Hand', - 'O': 'Off Hand', - 'P': 'No Sac', - 'Q': 'Float'} - -rom_wear_loc_map = {-1: None, - 0: 'Light', - 1: 'Left Finger', - 2: 'Right Finger', - 3: 'Neck', - 4: 'Collar', - 5: 'Body', - 6: 'Head', - 7: 'Legs', - 8: 'Feet', - 9: 'Hands', - 10: 'Arms', - 11: 'Off Hand', - 12: 'About', - 13: 'Waist', - 14: 'Left Wrist', - 15: 'Right Wrist', - 16: 'Main Hand', - 17: 'Held', - 18: 'Float'} +""" + + +# Item Bits +rom_wear_flag_map = { + "A": "Take", + "B": "Finger", + "C": "Neck", + "D": "Body", + "E": "Head", + "F": "Legs", + "G": "Feet", + "H": "Hands", + "I": "Arms", + "J": "Shield", + "K": "About", + "L": "Waist", + "M": "Wrist", + "N": "Main Hand", + "O": "Off Hand", + "P": "No Sac", + "Q": "Float", +} + +rom_wear_loc_map = { + -1: None, + 0: "Light", + 1: "Left Finger", + 2: "Right Finger", + 3: "Neck", + 4: "Collar", + 5: "Body", + 6: "Head", + 7: "Legs", + 8: "Feet", + 9: "Hands", + 10: "Arms", + 11: "Off Hand", + 12: "About", + 13: "Waist", + 14: "Left Wrist", + 15: "Right Wrist", + 16: "Main Hand", + 17: "Held", + 18: "Float", +} # * Equpiment wear locations. # * Used in #RESETS. -wear_num_to_str = collections.OrderedDict([(-1, 'none'), - (0, 'light'), - (1, 'left_finger'), - (2, 'right_finger'), - (3, 'neck'), - (4, 'collar'), - (5, 'body'), - (6, 'head'), - (7, 'legs'), - (8, 'feet'), - (9, 'hands'), - (10, 'arms'), - (11, 'unused'), - (12, 'about'), - (13, 'waist'), - (14, 'left_wrist'), - (15, 'right_wrist'), - (16, 'main_hand'), - (17, 'off_hand'), - (18, 'float')]) - - -''' +wear_num_to_str = collections.OrderedDict( + [ + (-1, "none"), + (0, "light"), + (1, "left_finger"), + (2, "right_finger"), + (3, "neck"), + (4, "collar"), + (5, "body"), + (6, "head"), + (7, "legs"), + (8, "feet"), + (9, "hands"), + (10, "arms"), + (11, "unused"), + (12, "about"), + (13, "waist"), + (14, "left_wrist"), + (15, "right_wrist"), + (16, "main_hand"), + (17, "off_hand"), + (18, "float"), + ] +) + + +""" Legacy Bits n Bobs -''' +""" -#legacy WEAR locations +# legacy WEAR locations WEAR_NONE = -1 WEAR_LIGHT = 0 WEAR_FINGER_L = 1 @@ -928,7 +938,7 @@ ITEM_NO_SAC = P ITEM_WEAR_FLOAT = Q -#Weapon Types - Legacy +# Weapon Types - Legacy WEAPON_FLAMING = A WEAPON_FROST = B WEAPON_VAMPIRIC = C @@ -940,30 +950,32 @@ # Return ascii name of an affect location. def affect_loc_name(location): - affect_loc = {APPLY_NONE: "none", - APPLY_STR: "strength", - APPLY_DEX: "dexterity", - APPLY_INT: "intelligence", - APPLY_WIS: "wisdom", - APPLY_CON: "constitution", - APPLY_SEX: "sex", - APPLY_CLASS: "class", - APPLY_LEVEL: "level", - APPLY_AGE: "age", - APPLY_MANA: "mana", - APPLY_HIT: "hp", - APPLY_MOVE: "moves", - APPLY_GOLD: "gold", - APPLY_EXP: "experience", - APPLY_AC: "armor class", - APPLY_HITROLL: "hit roll", - APPLY_DAMROLL: "damage roll", - APPLY_SAVES: "saves", - APPLY_SAVING_ROD: "save vs rod", - APPLY_SAVING_PETRI: "save vs petrification", - APPLY_SAVING_BREATH: "save vs breath", - APPLY_SAVING_SPELL: "save vs spell", - APPLY_SPELL_AFFECT: "none"} + affect_loc = { + APPLY_NONE: "none", + APPLY_STR: "strength", + APPLY_DEX: "dexterity", + APPLY_INT: "intelligence", + APPLY_WIS: "wisdom", + APPLY_CON: "constitution", + APPLY_SEX: "sex", + APPLY_CLASS: "class", + APPLY_LEVEL: "level", + APPLY_AGE: "age", + APPLY_MANA: "mana", + APPLY_HIT: "hp", + APPLY_MOVE: "moves", + APPLY_GOLD: "gold", + APPLY_EXP: "experience", + APPLY_AC: "armor class", + APPLY_HITROLL: "hit roll", + APPLY_DAMROLL: "damage roll", + APPLY_SAVES: "saves", + APPLY_SAVING_ROD: "save vs rod", + APPLY_SAVING_PETRI: "save vs petrification", + APPLY_SAVING_BREATH: "save vs breath", + APPLY_SAVING_SPELL: "save vs spell", + APPLY_SPELL_AFFECT: "none", + } location = affect_loc.get(location, None) if not location: logger.error("Affect_location_name: unknown location %d.", location) @@ -1339,7 +1351,7 @@ def form_bit_name(form_flags): def part_bit_name(part_flags): - buf = '' + buf = "" if part_flags & PART_HEAD: buf += " head" if part_flags & PART_ARMS: @@ -1386,7 +1398,7 @@ def part_bit_name(part_flags): def weapon_bit_name(weapon_flags): - buf = '' + buf = "" if weapon_flags & WEAPON_FLAMING: buf += " flaming" if weapon_flags & WEAPON_FROST: @@ -1407,7 +1419,7 @@ def weapon_bit_name(weapon_flags): def cont_bit_name(cont_flags): - buf = '' + buf = "" if cont_flags & CONT_CLOSEABLE: buf += " closable" if cont_flags & CONT_PICKPROOF: @@ -1420,7 +1432,7 @@ def cont_bit_name(cont_flags): def off_bit_name(off_flags): - buf = '' + buf = "" if off_flags & OFF_AREA_ATTACK: buf += " area attack" if off_flags & OFF_BACKSTAB: diff --git a/src/rom24/miniboa/asyncio.py b/src/rom24/miniboa/asyncio.py index 3ffb2f0..3546db0 100644 --- a/src/rom24/miniboa/asyncio.py +++ b/src/rom24/miniboa/asyncio.py @@ -10,18 +10,18 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # Changes made by pR0Ps.CM[at]gmail[dot]com on 18/07/2012 # -Updated for use with Python 3.x # -Repackaged into a single file to simplify distribution # -Other misc fixes and changes # # Report any bugs in this implementation to me (email above) -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # Additional changes by Quixadhal on 2014.06.16 # -Re-split code into multiple files, for ease of maintenance # -Rewrote terminal system -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ """ Handle Asynchronous Telnet Connections. @@ -39,13 +39,13 @@ ## Cap sockets to 512 on Windows because winsock can only process 512 at time -if sys.platform == 'win32': +if sys.platform == "win32": MAX_CONNECTIONS = 500 ## Cap sockets to 1000 on Linux because you can only have 1024 file descriptors else: MAX_CONNECTIONS = 1000 -#--[ Telnet Server ]----------------------------------------------------------- +# --[ Telnet Server ]----------------------------------------------------------- ## Default connection handler @@ -53,7 +53,9 @@ def _on_connect(client): """ Placeholder new connection handler. """ - logger.info("++ Opened connection to {}, sending greeting...".format(client.addrport())) + logger.info( + "++ Opened connection to {}, sending greeting...".format(client.addrport()) + ) client.send("Greetings from Miniboa-py3!\n") @@ -70,9 +72,15 @@ class TelnetServer(object): Poll sockets for new connections and sending/receiving data from clients. """ - def __init__(self, port=23, address='', on_connect=_on_connect, - on_disconnect=_on_disconnect, max_connections=MAX_CONNECTIONS, - timeout=0.05): + def __init__( + self, + port=23, + address="", + on_connect=_on_connect, + on_disconnect=_on_disconnect, + max_connections=MAX_CONNECTIONS, + timeout=0.05, + ): """ Create a new Telnet Server. @@ -173,8 +181,7 @@ def poll(self): ## Get active socket file descriptors from select.select() try: - rlist, slist, elist = select.select(recv_list, send_list, [], - self.timeout) + rlist, slist, elist = select.select(recv_list, send_list, [], self.timeout) except select.error as err: ## If we can't even use select(), game over man, game over logger.critical("SELECT socket error '{}'".format(str(err))) @@ -193,7 +200,7 @@ def poll(self): logger.error("ACCEPT socket error '{}:{}'.".format(err[0], err[1])) continue - #Check for maximum connections + # Check for maximum connections if self.client_count() >= self.max_connections: logger.warning("Refusing new connection, maximum already in use.") sock.close() diff --git a/src/rom24/miniboa/colors.py b/src/rom24/miniboa/colors.py index 08317f4..36b13ba 100644 --- a/src/rom24/miniboa/colors.py +++ b/src/rom24/miniboa/colors.py @@ -10,14 +10,14 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # Changes made by pR0Ps.CM[at]gmail[dot]com on 18/07/2012 # -Updated for use with Python 3.x # -Repackaged into a single file to simplify distribution # -Other misc fixes and changes # # Report any bugs in this implementation to me (email above) -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # Additional changes by Quixadhal on 2014.06.16 # -Re-split code into multiple files, for ease of maintenance # -Rewrote terminal system @@ -39,7 +39,7 @@ # The replacement is dependant on the terminal type passed in, which # defaults to ANSI, but can be "unknown" to strip colors, or # "i3" or "imc2" for the intermud networks, or "mxp" for that. -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ """ Split off the color codes themselves into a separate module to make it easier to edit the actual terminal code @@ -51,336 +51,2474 @@ from collections import namedtuple -TERMINAL_TYPES = ('unknown', 'pyom', 'rom', 'smaug', 'imc2', 'ansi', 'greyscale', 'i3', 'mxp') +TERMINAL_TYPES = ( + "unknown", + "pyom", + "rom", + "smaug", + "imc2", + "ansi", + "greyscale", + "i3", + "mxp", +) -ColorToken = namedtuple('ColorToken', TERMINAL_TYPES) +ColorToken = namedtuple("ColorToken", TERMINAL_TYPES) COLOR_MAP = {} -COLOR_MAP['unknown'] = { -} - -COLOR_MAP['pyom'] = { - '[d': ColorToken('', '[d', '{d', '&x', '~x', '\033[30m', '\033[38;5;232m', '%^BLACK%^', '' ), - '[r': ColorToken('', '[r', '{r', '&r', '~r', '\033[31m', '\033[38;5;237m', '%^RED%^', '' ), - '[g': ColorToken('', '[g', '{g', '&g', '~g', '\033[32m', '\033[38;5;237m', '%^GREEN%^', '' ), - '[y': ColorToken('', '[y', '{y', '&O', '~y', '\033[33m', '\033[38;5;244m', '%^ORANGE%^', '' ), - '[b': ColorToken('', '[b', '{b', '&b', '~b', '\033[34m', '\033[38;5;237m', '%^BLUE%^', '' ), - '[m': ColorToken('', '[m', '{m', '&p', '~p', '\033[35m', '\033[38;5;244m', '%^MAGENTA%^', '' ), - '[c': ColorToken('', '[c', '{c', '&c', '~c', '\033[36m', '\033[38;5;244m', '%^CYAN%^', '' ), - '[w': ColorToken('', '[w', '{w', '&w', '~w', '\033[37m', '\033[38;5;250m', '%^WHITE%^', '' ), - - '[D': ColorToken('', '[D', '{D', '&z', '~z', '\033[1;30m', '\033[38;5;240m', '%^BOLD%^BLACK%^', ''), - '[R': ColorToken('', '[R', '{R', '&R', '~R', '\033[1;31m', '\033[38;5;245m', '%^BOLD%^RED%^', ''), - '[G': ColorToken('', '[G', '{G', '&G', '~G', '\033[1;32m', '\033[38;5;245m', '%^BOLD%^GREEN%^', ''), - '[Y': ColorToken('', '[Y', '{Y', '&Y', '~Y', '\033[1;33m', '\033[38;5;251m', '%^BOLD%^ORANGE%^', ''), - '[B': ColorToken('', '[B', '{B', '&B', '~B', '\033[1;34m', '\033[38;5;245m', '%^BOLD%^BLUE%^', ''), - '[M': ColorToken('', '[M', '{M', '&P', '~P', '\033[1;35m', '\033[38;5;251m', '%^BOLD%^MAGENTA%^', ''), - '[C': ColorToken('', '[C', '{C', '&C', '~C', '\033[1;36m', '\033[38;5;251m', '%^BOLD%^CYAN%^', ''), - '[W': ColorToken('', '[W', '{W', '&W', '~W', '\033[1;37m', '\033[38;5;255m', '%^BOLD%^WHITE%^', ''), - - '[*': ColorToken('', '[*', '{*', '', '', '\007', '\007', '', ''), - '[/': ColorToken('', '[/', '{/', '', '', '\012', '\012', '', ''), - - '[[': ColorToken('[', '[[', '[', '[', '[', '[', '[', '[', '['), - ']]': ColorToken(']', ']]', ']', ']', ']', ']', ']', ']', ']'), - - '[x': ColorToken('', '[x', '{x', '&d', '~!', '\033[0m', '\033[0m', '%^RESET%^', ''), - '[L': ColorToken('', '[L', '{L', '&L', '~L', '\033[1m', '\033[1m', '%^BOLD%^', ''), - '[i': ColorToken('', '[i', '{i', '&i', '~i', '\033[3m', '\033[3m', '%^ITALIC%^', ''), - '[u': ColorToken('', '[u', '{u', '&u', '~u', '\033[4m', '\033[4m', '%^UNDERLINE%^', ''), - '[f': ColorToken('', '[f', '{f', '&f', '~$', '\033[5m', '\033[5m', '%^FLASH%^', ''), - '[V': ColorToken('', '[v', '{v', '&v', '~v', '\033[7m', '\033[7m', '%^REVERSE%^', ''), - '[s': ColorToken('', '[s', '{s', '&s', '~s', '\033[9m', '\033[9m', '%^STRIKETHRU%^', ''), - - '[H': ColorToken('', '[H', '{H', '', '', '\033[H', '\033[H', '%^HOME%^', ''), # Home - '[_': ColorToken('', '[_', '{_', '', '', '\033[K', '\033[K', '%^CLEARLINE%^', ''), # Clear to end of line - '[@': ColorToken('', '[@', '{@', '', '', '\033[J', '\033[J', '', ''), # Clear to end of screen - '[^': ColorToken('', '[^', '{^', '', '', '\033[A', '\033[A', '%^CURS_UP%^', ''), # Cursor up - '[v': ColorToken('', '[v', '{v', '', '', '\033[B', '\033[B', '%^CURS_DOWN%^', ''), # Cursor down - '[>': ColorToken('', '[>', '{>', '', '', '\033[C', '\033[C', '%^CURS_RIGHT%^', ''), # Cursor right - '[<': ColorToken('', '[<', '{<', '', '', '\033[D', '\033[D', '%^CURS_LEFT%^', ''), # Cursor left +COLOR_MAP["unknown"] = {} +COLOR_MAP["pyom"] = { + "[d": ColorToken( + "", + "[d", + "{d", + "&x", + "~x", + "\033[30m", + "\033[38;5;232m", + "%^BLACK%^", + '', + ), + "[r": ColorToken( + "", + "[r", + "{r", + "&r", + "~r", + "\033[31m", + "\033[38;5;237m", + "%^RED%^", + '', + ), + "[g": ColorToken( + "", + "[g", + "{g", + "&g", + "~g", + "\033[32m", + "\033[38;5;237m", + "%^GREEN%^", + '', + ), + "[y": ColorToken( + "", + "[y", + "{y", + "&O", + "~y", + "\033[33m", + "\033[38;5;244m", + "%^ORANGE%^", + '', + ), + "[b": ColorToken( + "", + "[b", + "{b", + "&b", + "~b", + "\033[34m", + "\033[38;5;237m", + "%^BLUE%^", + '', + ), + "[m": ColorToken( + "", + "[m", + "{m", + "&p", + "~p", + "\033[35m", + "\033[38;5;244m", + "%^MAGENTA%^", + '', + ), + "[c": ColorToken( + "", + "[c", + "{c", + "&c", + "~c", + "\033[36m", + "\033[38;5;244m", + "%^CYAN%^", + '', + ), + "[w": ColorToken( + "", + "[w", + "{w", + "&w", + "~w", + "\033[37m", + "\033[38;5;250m", + "%^WHITE%^", + '', + ), + "[D": ColorToken( + "", + "[D", + "{D", + "&z", + "~z", + "\033[1;30m", + "\033[38;5;240m", + "%^BOLD%^BLACK%^", + '', + ), + "[R": ColorToken( + "", + "[R", + "{R", + "&R", + "~R", + "\033[1;31m", + "\033[38;5;245m", + "%^BOLD%^RED%^", + '', + ), + "[G": ColorToken( + "", + "[G", + "{G", + "&G", + "~G", + "\033[1;32m", + "\033[38;5;245m", + "%^BOLD%^GREEN%^", + '', + ), + "[Y": ColorToken( + "", + "[Y", + "{Y", + "&Y", + "~Y", + "\033[1;33m", + "\033[38;5;251m", + "%^BOLD%^ORANGE%^", + '', + ), + "[B": ColorToken( + "", + "[B", + "{B", + "&B", + "~B", + "\033[1;34m", + "\033[38;5;245m", + "%^BOLD%^BLUE%^", + '', + ), + "[M": ColorToken( + "", + "[M", + "{M", + "&P", + "~P", + "\033[1;35m", + "\033[38;5;251m", + "%^BOLD%^MAGENTA%^", + '', + ), + "[C": ColorToken( + "", + "[C", + "{C", + "&C", + "~C", + "\033[1;36m", + "\033[38;5;251m", + "%^BOLD%^CYAN%^", + '', + ), + "[W": ColorToken( + "", + "[W", + "{W", + "&W", + "~W", + "\033[1;37m", + "\033[38;5;255m", + "%^BOLD%^WHITE%^", + '', + ), + "[*": ColorToken("", "[*", "{*", "", "", "\007", "\007", "", ""), + "[/": ColorToken("", "[/", "{/", "", "", "\012", "\012", "", ""), + "[[": ColorToken("[", "[[", "[", "[", "[", "[", "[", "[", "["), + "]]": ColorToken("]", "]]", "]", "]", "]", "]", "]", "]", "]"), + "[x": ColorToken( + "", "[x", "{x", "&d", "~!", "\033[0m", "\033[0m", "%^RESET%^", "" + ), + "[L": ColorToken( + "", "[L", "{L", "&L", "~L", "\033[1m", "\033[1m", "%^BOLD%^", "" + ), + "[i": ColorToken( + "", "[i", "{i", "&i", "~i", "\033[3m", "\033[3m", "%^ITALIC%^", "" + ), + "[u": ColorToken( + "", "[u", "{u", "&u", "~u", "\033[4m", "\033[4m", "%^UNDERLINE%^", "" + ), + "[f": ColorToken( + "", + "[f", + "{f", + "&f", + "~$", + "\033[5m", + "\033[5m", + "%^FLASH%^", + "", + ), + "[V": ColorToken( + "", + "[v", + "{v", + "&v", + "~v", + "\033[7m", + "\033[7m", + "%^REVERSE%^", + "", + ), + "[s": ColorToken( + "", + "[s", + "{s", + "&s", + "~s", + "\033[9m", + "\033[9m", + "%^STRIKETHRU%^", + "", + ), + "[H": ColorToken( + "", "[H", "{H", "", "", "\033[H", "\033[H", "%^HOME%^", "" + ), # Home + "[_": ColorToken( + "", "[_", "{_", "", "", "\033[K", "\033[K", "%^CLEARLINE%^", "" + ), # Clear to end of line + "[@": ColorToken( + "", "[@", "{@", "", "", "\033[J", "\033[J", "", "" + ), # Clear to end of screen + "[^": ColorToken( + "", "[^", "{^", "", "", "\033[A", "\033[A", "%^CURS_UP%^", "" + ), # Cursor up + "[v": ColorToken( + "", "[v", "{v", "", "", "\033[B", "\033[B", "%^CURS_DOWN%^", "" + ), # Cursor down + "[>": ColorToken( + "", "[>", "{>", "", "", "\033[C", "\033[C", "%^CURS_RIGHT%^", "" + ), # Cursor right + "[<": ColorToken( + "", "[<", "{<", "", "", "\033[D", "\033[D", "%^CURS_LEFT%^", "" + ), # Cursor left # Background colors - ']d': ColorToken('', ']d', '}d', '^x', '^x', '\033[40m', '\033[48;5;232m', '%^B_BLACK%^', ''), - ']r': ColorToken('', ']r', '}r', '^r', '^r', '\033[41m', '\033[48;5;237m', '%^B_RED%^', ''), - ']g': ColorToken('', ']g', '}g', '^g', '^g', '\033[42m', '\033[48;5;237m', '%^B_GREEN%^', ''), - ']y': ColorToken('', ']y', '}y', '^O', '^y', '\033[43m', '\033[48;5;244m', '%^B_ORANGE%^', ''), - ']b': ColorToken('', ']b', '}b', '^b', '^b', '\033[44m', '\033[48;5;237m', '%^B_BLUE%^', ''), - ']m': ColorToken('', ']m', '}m', '^p', '^p', '\033[45m', '\033[48;5;244m', '%^B_MAGENTA%^', ''), - ']c': ColorToken('', ']c', '}c', '^c', '^c', '\033[46m', '\033[48;5;244m', '%^B_CYAN%^', ''), - ']w': ColorToken('', ']w', '}w', '^w', '^w', '\033[47m', '\033[48;5;250m', '%^B_WHITE%^', ''), - + "]d": ColorToken( + "", + "]d", + "}d", + "^x", + "^x", + "\033[40m", + "\033[48;5;232m", + "%^B_BLACK%^", + '', + ), + "]r": ColorToken( + "", + "]r", + "}r", + "^r", + "^r", + "\033[41m", + "\033[48;5;237m", + "%^B_RED%^", + '', + ), + "]g": ColorToken( + "", + "]g", + "}g", + "^g", + "^g", + "\033[42m", + "\033[48;5;237m", + "%^B_GREEN%^", + '', + ), + "]y": ColorToken( + "", + "]y", + "}y", + "^O", + "^y", + "\033[43m", + "\033[48;5;244m", + "%^B_ORANGE%^", + '', + ), + "]b": ColorToken( + "", + "]b", + "}b", + "^b", + "^b", + "\033[44m", + "\033[48;5;237m", + "%^B_BLUE%^", + '', + ), + "]m": ColorToken( + "", + "]m", + "}m", + "^p", + "^p", + "\033[45m", + "\033[48;5;244m", + "%^B_MAGENTA%^", + '', + ), + "]c": ColorToken( + "", + "]c", + "}c", + "^c", + "^c", + "\033[46m", + "\033[48;5;244m", + "%^B_CYAN%^", + '', + ), + "]w": ColorToken( + "", + "]w", + "}w", + "^w", + "^w", + "\033[47m", + "\033[48;5;250m", + "%^B_WHITE%^", + '', + ), # Background colors cannot BE bold in ANSI - ']D': ColorToken('', ']D', '}D', '^z', '^z', '\033[40m', '\033[48;5;240m', '%^B_BLACK%^', ''), - ']R': ColorToken('', ']R', '}R', '^R', '^R', '\033[41m', '\033[48;5;245m', '%^B_RED%^', ''), - ']G': ColorToken('', ']G', '}G', '^G', '^G', '\033[42m', '\033[48;5;245m', '%^B_GREEN%^', ''), - ']Y': ColorToken('', ']Y', '}Y', '^Y', '^Y', '\033[43m', '\033[48;5;251m', '%^B_ORANGE%^', ''), - ']B': ColorToken('', ']B', '}B', '^B', '^B', '\033[44m', '\033[48;5;245m', '%^B_BLUE%^', ''), - ']M': ColorToken('', ']M', '}M', '^P', '^P', '\033[45m', '\033[48;5;251m', '%^B_MAGENTA%^', ''), - ']C': ColorToken('', ']C', '}C', '^C', '^C', '\033[46m', '\033[48;5;251m', '%^B_CYAN%^', ''), - ']W': ColorToken('', ']W', '}W', '^W', '^W', '\033[47m', '\033[48;5;255m', '%^B_WHITE%^', ''), + "]D": ColorToken( + "", + "]D", + "}D", + "^z", + "^z", + "\033[40m", + "\033[48;5;240m", + "%^B_BLACK%^", + '', + ), + "]R": ColorToken( + "", + "]R", + "}R", + "^R", + "^R", + "\033[41m", + "\033[48;5;245m", + "%^B_RED%^", + '', + ), + "]G": ColorToken( + "", + "]G", + "}G", + "^G", + "^G", + "\033[42m", + "\033[48;5;245m", + "%^B_GREEN%^", + '', + ), + "]Y": ColorToken( + "", + "]Y", + "}Y", + "^Y", + "^Y", + "\033[43m", + "\033[48;5;251m", + "%^B_ORANGE%^", + '', + ), + "]B": ColorToken( + "", + "]B", + "}B", + "^B", + "^B", + "\033[44m", + "\033[48;5;245m", + "%^B_BLUE%^", + '', + ), + "]M": ColorToken( + "", + "]M", + "}M", + "^P", + "^P", + "\033[45m", + "\033[48;5;251m", + "%^B_MAGENTA%^", + '', + ), + "]C": ColorToken( + "", + "]C", + "}C", + "^C", + "^C", + "\033[46m", + "\033[48;5;251m", + "%^B_CYAN%^", + '', + ), + "]W": ColorToken( + "", + "]W", + "}W", + "^W", + "^W", + "\033[47m", + "\033[48;5;255m", + "%^B_WHITE%^", + '', + ), } -COLOR_MAP['rom'] = { - '{d': ColorToken('', '[d', '{d', '&x', '~x', '\033[30m', '\033[38;5;232m', '%^BLACK%^', '' ), - '{r': ColorToken('', '[r', '{r', '&r', '~r', '\033[31m', '\033[38;5;237m', '%^RED%^', '' ), - '{g': ColorToken('', '[g', '{g', '&g', '~g', '\033[32m', '\033[38;5;237m', '%^GREEN%^', '' ), - '{y': ColorToken('', '[y', '{y', '&O', '~y', '\033[33m', '\033[38;5;244m', '%^ORANGE%^', '' ), - '{b': ColorToken('', '[b', '{b', '&b', '~b', '\033[34m', '\033[38;5;237m', '%^BLUE%^', '' ), - '{m': ColorToken('', '[m', '{m', '&p', '~p', '\033[35m', '\033[38;5;244m', '%^MAGENTA%^', '' ), - '{c': ColorToken('', '[c', '{c', '&c', '~c', '\033[36m', '\033[38;5;244m', '%^CYAN%^', '' ), - '{w': ColorToken('', '[w', '{w', '&w', '~w', '\033[37m', '\033[38;5;250m', '%^WHITE%^', '' ), - - '{D': ColorToken('', '[D', '{D', '&z', '~z', '\033[1;30m', '\033[38;5;240m', '%^BOLD%^BLACK%^', ''), - '{R': ColorToken('', '[R', '{R', '&R', '~R', '\033[1;31m', '\033[38;5;245m', '%^BOLD%^RED%^', ''), - '{G': ColorToken('', '[G', '{G', '&G', '~G', '\033[1;32m', '\033[38;5;245m', '%^BOLD%^GREEN%^', ''), - '{Y': ColorToken('', '[Y', '{Y', '&Y', '~Y', '\033[1;33m', '\033[38;5;251m', '%^BOLD%^ORANGE%^', ''), - '{B': ColorToken('', '[B', '{B', '&B', '~B', '\033[1;34m', '\033[38;5;245m', '%^BOLD%^BLUE%^', ''), - '{M': ColorToken('', '[M', '{M', '&P', '~P', '\033[1;35m', '\033[38;5;251m', '%^BOLD%^MAGENTA%^', ''), - '{C': ColorToken('', '[C', '{C', '&C', '~C', '\033[1;36m', '\033[38;5;251m', '%^BOLD%^CYAN%^', ''), - '{W': ColorToken('', '[W', '{W', '&W', '~W', '\033[1;37m', '\033[38;5;255m', '%^BOLD%^WHITE%^', ''), - - '{*': ColorToken('', '[*', '{*', '', '', '\007', '\007', '', ''), - '{/': ColorToken('', '[/', '{/', '', '', '\012', '\012', '', ''), - - '{{': ColorToken('{', '{', '{{', '{', '{', '{', '{', '{', '{'), - '}}': ColorToken('}', '}', '}}', '}}', '}', '}', '}', '}', '}'), - - '{x': ColorToken('', '[x', '{x', '&d', '~!', '\033[0m', '\033[0m', '%^RESET%^', ''), - '{L': ColorToken('', '[L', '{L', '&L', '~L', '\033[1m', '\033[1m', '%^BOLD%^', ''), - '{i': ColorToken('', '[i', '{i', '&i', '~i', '\033[3m', '\033[3m', '%^ITALIC%^', ''), - '{u': ColorToken('', '[u', '{u', '&u', '~u', '\033[4m', '\033[4m', '%^UNDERLINE%^', ''), - '{f': ColorToken('', '[f', '{f', '&f', '~$', '\033[5m', '\033[5m', '%^FLASH%^', ''), - '{V': ColorToken('', '[v', '{v', '&v', '~v', '\033[7m', '\033[7m', '%^REVERSE%^', ''), - '{s': ColorToken('', '[s', '{s', '&s', '~s', '\033[9m', '\033[9m', '%^STRIKETHRU%^', ''), - - '{H': ColorToken('', '[H', '{H', '', '', '\033[H', '\033[H', '%^HOME%^', ''), # Home - '{_': ColorToken('', '[_', '{_', '', '', '\033[K', '\033[K', '%^CLEARLINE%^', ''), # Clear to end of line - '{@': ColorToken('', '[@', '{@', '', '', '\033[J', '\033[J', '', ''), # Clear to end of screen - '{^': ColorToken('', '[^', '{^', '', '', '\033[A', '\033[A', '%^CURS_UP%^', ''), # Cursor up - '{v': ColorToken('', '[v', '{v', '', '', '\033[B', '\033[B', '%^CURS_DOWN%^', ''), # Cursor down - '{>': ColorToken('', '[>', '{>', '', '', '\033[C', '\033[C', '%^CURS_RIGHT%^', ''), # Cursor right - '{<': ColorToken('', '[<', '{<', '', '', '\033[D', '\033[D', '%^CURS_LEFT%^', ''), # Cursor left - +COLOR_MAP["rom"] = { + "{d": ColorToken( + "", + "[d", + "{d", + "&x", + "~x", + "\033[30m", + "\033[38;5;232m", + "%^BLACK%^", + '', + ), + "{r": ColorToken( + "", + "[r", + "{r", + "&r", + "~r", + "\033[31m", + "\033[38;5;237m", + "%^RED%^", + '', + ), + "{g": ColorToken( + "", + "[g", + "{g", + "&g", + "~g", + "\033[32m", + "\033[38;5;237m", + "%^GREEN%^", + '', + ), + "{y": ColorToken( + "", + "[y", + "{y", + "&O", + "~y", + "\033[33m", + "\033[38;5;244m", + "%^ORANGE%^", + '', + ), + "{b": ColorToken( + "", + "[b", + "{b", + "&b", + "~b", + "\033[34m", + "\033[38;5;237m", + "%^BLUE%^", + '', + ), + "{m": ColorToken( + "", + "[m", + "{m", + "&p", + "~p", + "\033[35m", + "\033[38;5;244m", + "%^MAGENTA%^", + '', + ), + "{c": ColorToken( + "", + "[c", + "{c", + "&c", + "~c", + "\033[36m", + "\033[38;5;244m", + "%^CYAN%^", + '', + ), + "{w": ColorToken( + "", + "[w", + "{w", + "&w", + "~w", + "\033[37m", + "\033[38;5;250m", + "%^WHITE%^", + '', + ), + "{D": ColorToken( + "", + "[D", + "{D", + "&z", + "~z", + "\033[1;30m", + "\033[38;5;240m", + "%^BOLD%^BLACK%^", + '', + ), + "{R": ColorToken( + "", + "[R", + "{R", + "&R", + "~R", + "\033[1;31m", + "\033[38;5;245m", + "%^BOLD%^RED%^", + '', + ), + "{G": ColorToken( + "", + "[G", + "{G", + "&G", + "~G", + "\033[1;32m", + "\033[38;5;245m", + "%^BOLD%^GREEN%^", + '', + ), + "{Y": ColorToken( + "", + "[Y", + "{Y", + "&Y", + "~Y", + "\033[1;33m", + "\033[38;5;251m", + "%^BOLD%^ORANGE%^", + '', + ), + "{B": ColorToken( + "", + "[B", + "{B", + "&B", + "~B", + "\033[1;34m", + "\033[38;5;245m", + "%^BOLD%^BLUE%^", + '', + ), + "{M": ColorToken( + "", + "[M", + "{M", + "&P", + "~P", + "\033[1;35m", + "\033[38;5;251m", + "%^BOLD%^MAGENTA%^", + '', + ), + "{C": ColorToken( + "", + "[C", + "{C", + "&C", + "~C", + "\033[1;36m", + "\033[38;5;251m", + "%^BOLD%^CYAN%^", + '', + ), + "{W": ColorToken( + "", + "[W", + "{W", + "&W", + "~W", + "\033[1;37m", + "\033[38;5;255m", + "%^BOLD%^WHITE%^", + '', + ), + "{*": ColorToken("", "[*", "{*", "", "", "\007", "\007", "", ""), + "{/": ColorToken("", "[/", "{/", "", "", "\012", "\012", "", ""), + "{{": ColorToken("{", "{", "{{", "{", "{", "{", "{", "{", "{"), + "}}": ColorToken("}", "}", "}}", "}}", "}", "}", "}", "}", "}"), + "{x": ColorToken( + "", "[x", "{x", "&d", "~!", "\033[0m", "\033[0m", "%^RESET%^", "" + ), + "{L": ColorToken( + "", "[L", "{L", "&L", "~L", "\033[1m", "\033[1m", "%^BOLD%^", "" + ), + "{i": ColorToken( + "", "[i", "{i", "&i", "~i", "\033[3m", "\033[3m", "%^ITALIC%^", "" + ), + "{u": ColorToken( + "", "[u", "{u", "&u", "~u", "\033[4m", "\033[4m", "%^UNDERLINE%^", "" + ), + "{f": ColorToken( + "", + "[f", + "{f", + "&f", + "~$", + "\033[5m", + "\033[5m", + "%^FLASH%^", + "", + ), + "{V": ColorToken( + "", + "[v", + "{v", + "&v", + "~v", + "\033[7m", + "\033[7m", + "%^REVERSE%^", + "", + ), + "{s": ColorToken( + "", + "[s", + "{s", + "&s", + "~s", + "\033[9m", + "\033[9m", + "%^STRIKETHRU%^", + "", + ), + "{H": ColorToken( + "", "[H", "{H", "", "", "\033[H", "\033[H", "%^HOME%^", "" + ), # Home + "{_": ColorToken( + "", "[_", "{_", "", "", "\033[K", "\033[K", "%^CLEARLINE%^", "" + ), # Clear to end of line + "{@": ColorToken( + "", "[@", "{@", "", "", "\033[J", "\033[J", "", "" + ), # Clear to end of screen + "{^": ColorToken( + "", "[^", "{^", "", "", "\033[A", "\033[A", "%^CURS_UP%^", "" + ), # Cursor up + "{v": ColorToken( + "", "[v", "{v", "", "", "\033[B", "\033[B", "%^CURS_DOWN%^", "" + ), # Cursor down + "{>": ColorToken( + "", "[>", "{>", "", "", "\033[C", "\033[C", "%^CURS_RIGHT%^", "" + ), # Cursor right + "{<": ColorToken( + "", "[<", "{<", "", "", "\033[D", "\033[D", "%^CURS_LEFT%^", "" + ), # Cursor left # Background colors - '}d': ColorToken('', ']d', '}d', '^x', '^x', '\033[40m', '\033[48;5;232m', '%^B_BLACK%^', ''), - '}r': ColorToken('', ']r', '}r', '^r', '^r', '\033[41m', '\033[48;5;237m', '%^B_RED%^', ''), - '}g': ColorToken('', ']g', '}g', '^g', '^g', '\033[42m', '\033[48;5;237m', '%^B_GREEN%^', ''), - '}y': ColorToken('', ']y', '}y', '^O', '^y', '\033[43m', '\033[48;5;244m', '%^B_ORANGE%^', ''), - '}b': ColorToken('', ']b', '}b', '^b', '^b', '\033[44m', '\033[48;5;237m', '%^B_BLUE%^', ''), - '}m': ColorToken('', ']m', '}m', '^p', '^p', '\033[45m', '\033[48;5;244m', '%^B_MAGENTA%^', ''), - '}c': ColorToken('', ']c', '}c', '^c', '^c', '\033[46m', '\033[48;5;244m', '%^B_CYAN%^', ''), - '}w': ColorToken('', ']w', '}w', '^w', '^w', '\033[47m', '\033[48;5;250m', '%^B_WHITE%^', ''), - + "}d": ColorToken( + "", + "]d", + "}d", + "^x", + "^x", + "\033[40m", + "\033[48;5;232m", + "%^B_BLACK%^", + '', + ), + "}r": ColorToken( + "", + "]r", + "}r", + "^r", + "^r", + "\033[41m", + "\033[48;5;237m", + "%^B_RED%^", + '', + ), + "}g": ColorToken( + "", + "]g", + "}g", + "^g", + "^g", + "\033[42m", + "\033[48;5;237m", + "%^B_GREEN%^", + '', + ), + "}y": ColorToken( + "", + "]y", + "}y", + "^O", + "^y", + "\033[43m", + "\033[48;5;244m", + "%^B_ORANGE%^", + '', + ), + "}b": ColorToken( + "", + "]b", + "}b", + "^b", + "^b", + "\033[44m", + "\033[48;5;237m", + "%^B_BLUE%^", + '', + ), + "}m": ColorToken( + "", + "]m", + "}m", + "^p", + "^p", + "\033[45m", + "\033[48;5;244m", + "%^B_MAGENTA%^", + '', + ), + "}c": ColorToken( + "", + "]c", + "}c", + "^c", + "^c", + "\033[46m", + "\033[48;5;244m", + "%^B_CYAN%^", + '', + ), + "}w": ColorToken( + "", + "]w", + "}w", + "^w", + "^w", + "\033[47m", + "\033[48;5;250m", + "%^B_WHITE%^", + '', + ), # Background colors cannot BE bold in ANSI - '}D': ColorToken('', ']D', '}D', '^z', '^z', '\033[40m', '\033[48;5;240m', '%^B_BLACK%^', ''), - '}R': ColorToken('', ']R', '}R', '^R', '^R', '\033[41m', '\033[48;5;245m', '%^B_RED%^', ''), - '}G': ColorToken('', ']G', '}G', '^G', '^G', '\033[42m', '\033[48;5;245m', '%^B_GREEN%^', ''), - '}Y': ColorToken('', ']Y', '}Y', '^Y', '^Y', '\033[43m', '\033[48;5;251m', '%^B_ORANGE%^', ''), - '}B': ColorToken('', ']B', '}B', '^B', '^B', '\033[44m', '\033[48;5;245m', '%^B_BLUE%^', ''), - '}M': ColorToken('', ']M', '}M', '^P', '^P', '\033[45m', '\033[48;5;251m', '%^B_MAGENTA%^', ''), - '}C': ColorToken('', ']C', '}C', '^C', '^C', '\033[46m', '\033[48;5;251m', '%^B_CYAN%^', ''), - '}W': ColorToken('', ']W', '}W', '^W', '^W', '\033[47m', '\033[48;5;255m', '%^B_WHITE%^', ''), + "}D": ColorToken( + "", + "]D", + "}D", + "^z", + "^z", + "\033[40m", + "\033[48;5;240m", + "%^B_BLACK%^", + '', + ), + "}R": ColorToken( + "", + "]R", + "}R", + "^R", + "^R", + "\033[41m", + "\033[48;5;245m", + "%^B_RED%^", + '', + ), + "}G": ColorToken( + "", + "]G", + "}G", + "^G", + "^G", + "\033[42m", + "\033[48;5;245m", + "%^B_GREEN%^", + '', + ), + "}Y": ColorToken( + "", + "]Y", + "}Y", + "^Y", + "^Y", + "\033[43m", + "\033[48;5;251m", + "%^B_ORANGE%^", + '', + ), + "}B": ColorToken( + "", + "]B", + "}B", + "^B", + "^B", + "\033[44m", + "\033[48;5;245m", + "%^B_BLUE%^", + '', + ), + "}M": ColorToken( + "", + "]M", + "}M", + "^P", + "^P", + "\033[45m", + "\033[48;5;251m", + "%^B_MAGENTA%^", + '', + ), + "}C": ColorToken( + "", + "]C", + "}C", + "^C", + "^C", + "\033[46m", + "\033[48;5;251m", + "%^B_CYAN%^", + '', + ), + "}W": ColorToken( + "", + "]W", + "}W", + "^W", + "^W", + "\033[47m", + "\033[48;5;255m", + "%^B_WHITE%^", + '', + ), } -COLOR_MAP['smaug'] = { - '&x': ColorToken('', '[d', '{d', '&x', '~x', '\033[30m', '\033[38;5;232m', '%^BLACK%^', '' ), - '&r': ColorToken('', '[r', '{r', '&r', '~r', '\033[31m', '\033[38;5;237m', '%^RED%^', '' ), - '&g': ColorToken('', '[g', '{g', '&g', '~g', '\033[32m', '\033[38;5;237m', '%^GREEN%^', '' ), - '&O': ColorToken('', '[y', '{y', '&O', '~y', '\033[33m', '\033[38;5;244m', '%^ORANGE%^', '' ), - '&b': ColorToken('', '[b', '{b', '&b', '~b', '\033[34m', '\033[38;5;237m', '%^BLUE%^', '' ), - '&p': ColorToken('', '[m', '{m', '&p', '~p', '\033[35m', '\033[38;5;244m', '%^MAGENTA%^', '' ), - '&c': ColorToken('', '[c', '{c', '&c', '~c', '\033[36m', '\033[38;5;244m', '%^CYAN%^', '' ), - '&w': ColorToken('', '[w', '{w', '&w', '~w', '\033[37m', '\033[38;5;250m', '%^WHITE%^', '' ), - - '&z': ColorToken('', '[D', '{D', '&z', '~z', '\033[1;30m', '\033[38;5;240m', '%^BOLD%^BLACK%^', ''), - '&R': ColorToken('', '[R', '{R', '&R', '~R', '\033[1;31m', '\033[38;5;245m', '%^BOLD%^RED%^', ''), - '&G': ColorToken('', '[G', '{G', '&G', '~G', '\033[1;32m', '\033[38;5;245m', '%^BOLD%^GREEN%^', ''), - '&Y': ColorToken('', '[Y', '{Y', '&Y', '~Y', '\033[1;33m', '\033[38;5;251m', '%^BOLD%^ORANGE%^', ''), - '&B': ColorToken('', '[B', '{B', '&B', '~B', '\033[1;34m', '\033[38;5;245m', '%^BOLD%^BLUE%^', ''), - '&P': ColorToken('', '[M', '{M', '&P', '~P', '\033[1;35m', '\033[38;5;251m', '%^BOLD%^MAGENTA%^', ''), - '&C': ColorToken('', '[C', '{C', '&C', '~C', '\033[1;36m', '\033[38;5;251m', '%^BOLD%^CYAN%^', ''), - '&W': ColorToken('', '[W', '{W', '&W', '~W', '\033[1;37m', '\033[38;5;255m', '%^BOLD%^WHITE%^', ''), - - '&&': ColorToken('&', '&', '&', '&&', '&', '&', '&', '&', '&'), - '^^': ColorToken('^', '^', '^', '^^', '^^', '^', '^', '^', '^'), - '}}': ColorToken('}', '}', '}}', '}}', '}', '}', '}', '}', '}'), - - '&d': ColorToken('', '[x', '{x', '&d', '~!', '\033[0m', '\033[0m', '%^RESET%^', ''), - '&L': ColorToken('', '[L', '{L', '&L', '~L', '\033[1m', '\033[1m', '%^BOLD%^', ''), - '&i': ColorToken('', '[i', '{i', '&i', '~i', '\033[3m', '\033[3m', '%^ITALIC%^', ''), - '&u': ColorToken('', '[u', '{u', '&u', '~u', '\033[4m', '\033[4m', '%^UNDERLINE%^', ''), - '&f': ColorToken('', '[f', '{f', '&f', '~$', '\033[5m', '\033[5m', '%^FLASH%^', ''), - '&v': ColorToken('', '[v', '{v', '&v', '~v', '\033[7m', '\033[7m', '%^REVERSE%^', ''), - '&s': ColorToken('', '[s', '{s', '&s', '~s', '\033[9m', '\033[9m', '%^STRIKETHRU%^', ''), - - '&I': ColorToken('', '[i', '{i', '&i', '~i', '\033[3m', '\033[3m', '%^ITALIC%^', ''), - '&U': ColorToken('', '[u', '{u', '&u', '~u', '\033[4m', '\033[4m', '%^UNDERLINE%^', ''), - '&F': ColorToken('', '[f', '{f', '&f', '~$', '\033[5m', '\033[5m', '%^FLASH%^', ''), - '&V': ColorToken('', '[v', '{v', '&v', '~v', '\033[7m', '\033[7m', '%^REVERSE%^', ''), - '&S': ColorToken('', '[s', '{s', '&s', '~s', '\033[9m', '\033[9m', '%^STRIKETHRU%^', ''), - +COLOR_MAP["smaug"] = { + "&x": ColorToken( + "", + "[d", + "{d", + "&x", + "~x", + "\033[30m", + "\033[38;5;232m", + "%^BLACK%^", + '', + ), + "&r": ColorToken( + "", + "[r", + "{r", + "&r", + "~r", + "\033[31m", + "\033[38;5;237m", + "%^RED%^", + '', + ), + "&g": ColorToken( + "", + "[g", + "{g", + "&g", + "~g", + "\033[32m", + "\033[38;5;237m", + "%^GREEN%^", + '', + ), + "&O": ColorToken( + "", + "[y", + "{y", + "&O", + "~y", + "\033[33m", + "\033[38;5;244m", + "%^ORANGE%^", + '', + ), + "&b": ColorToken( + "", + "[b", + "{b", + "&b", + "~b", + "\033[34m", + "\033[38;5;237m", + "%^BLUE%^", + '', + ), + "&p": ColorToken( + "", + "[m", + "{m", + "&p", + "~p", + "\033[35m", + "\033[38;5;244m", + "%^MAGENTA%^", + '', + ), + "&c": ColorToken( + "", + "[c", + "{c", + "&c", + "~c", + "\033[36m", + "\033[38;5;244m", + "%^CYAN%^", + '', + ), + "&w": ColorToken( + "", + "[w", + "{w", + "&w", + "~w", + "\033[37m", + "\033[38;5;250m", + "%^WHITE%^", + '', + ), + "&z": ColorToken( + "", + "[D", + "{D", + "&z", + "~z", + "\033[1;30m", + "\033[38;5;240m", + "%^BOLD%^BLACK%^", + '', + ), + "&R": ColorToken( + "", + "[R", + "{R", + "&R", + "~R", + "\033[1;31m", + "\033[38;5;245m", + "%^BOLD%^RED%^", + '', + ), + "&G": ColorToken( + "", + "[G", + "{G", + "&G", + "~G", + "\033[1;32m", + "\033[38;5;245m", + "%^BOLD%^GREEN%^", + '', + ), + "&Y": ColorToken( + "", + "[Y", + "{Y", + "&Y", + "~Y", + "\033[1;33m", + "\033[38;5;251m", + "%^BOLD%^ORANGE%^", + '', + ), + "&B": ColorToken( + "", + "[B", + "{B", + "&B", + "~B", + "\033[1;34m", + "\033[38;5;245m", + "%^BOLD%^BLUE%^", + '', + ), + "&P": ColorToken( + "", + "[M", + "{M", + "&P", + "~P", + "\033[1;35m", + "\033[38;5;251m", + "%^BOLD%^MAGENTA%^", + '', + ), + "&C": ColorToken( + "", + "[C", + "{C", + "&C", + "~C", + "\033[1;36m", + "\033[38;5;251m", + "%^BOLD%^CYAN%^", + '', + ), + "&W": ColorToken( + "", + "[W", + "{W", + "&W", + "~W", + "\033[1;37m", + "\033[38;5;255m", + "%^BOLD%^WHITE%^", + '', + ), + "&&": ColorToken("&", "&", "&", "&&", "&", "&", "&", "&", "&"), + "^^": ColorToken("^", "^", "^", "^^", "^^", "^", "^", "^", "^"), + "}}": ColorToken("}", "}", "}}", "}}", "}", "}", "}", "}", "}"), + "&d": ColorToken( + "", "[x", "{x", "&d", "~!", "\033[0m", "\033[0m", "%^RESET%^", "" + ), + "&L": ColorToken( + "", "[L", "{L", "&L", "~L", "\033[1m", "\033[1m", "%^BOLD%^", "" + ), + "&i": ColorToken( + "", "[i", "{i", "&i", "~i", "\033[3m", "\033[3m", "%^ITALIC%^", "" + ), + "&u": ColorToken( + "", "[u", "{u", "&u", "~u", "\033[4m", "\033[4m", "%^UNDERLINE%^", "" + ), + "&f": ColorToken( + "", + "[f", + "{f", + "&f", + "~$", + "\033[5m", + "\033[5m", + "%^FLASH%^", + "", + ), + "&v": ColorToken( + "", + "[v", + "{v", + "&v", + "~v", + "\033[7m", + "\033[7m", + "%^REVERSE%^", + "", + ), + "&s": ColorToken( + "", + "[s", + "{s", + "&s", + "~s", + "\033[9m", + "\033[9m", + "%^STRIKETHRU%^", + "", + ), + "&I": ColorToken( + "", "[i", "{i", "&i", "~i", "\033[3m", "\033[3m", "%^ITALIC%^", "" + ), + "&U": ColorToken( + "", "[u", "{u", "&u", "~u", "\033[4m", "\033[4m", "%^UNDERLINE%^", "" + ), + "&F": ColorToken( + "", + "[f", + "{f", + "&f", + "~$", + "\033[5m", + "\033[5m", + "%^FLASH%^", + "", + ), + "&V": ColorToken( + "", + "[v", + "{v", + "&v", + "~v", + "\033[7m", + "\033[7m", + "%^REVERSE%^", + "", + ), + "&S": ColorToken( + "", + "[s", + "{s", + "&s", + "~s", + "\033[9m", + "\033[9m", + "%^STRIKETHRU%^", + "", + ), # Background colors - '^x': ColorToken('', ']d', '}d', '^x', '^x', '\033[40m', '\033[48;5;232m', '%^B_BLACK%^', ''), - '^r': ColorToken('', ']r', '}r', '^r', '^r', '\033[41m', '\033[48;5;237m', '%^B_RED%^', ''), - '^g': ColorToken('', ']g', '}g', '^g', '^g', '\033[42m', '\033[48;5;237m', '%^B_GREEN%^', ''), - '^O': ColorToken('', ']y', '}y', '^O', '^y', '\033[43m', '\033[48;5;244m', '%^B_ORANGE%^', ''), - '^b': ColorToken('', ']b', '}b', '^b', '^b', '\033[44m', '\033[48;5;237m', '%^B_BLUE%^', ''), - '^p': ColorToken('', ']m', '}m', '^p', '^p', '\033[45m', '\033[48;5;244m', '%^B_MAGENTA%^', ''), - '^c': ColorToken('', ']c', '}c', '^c', '^c', '\033[46m', '\033[48;5;244m', '%^B_CYAN%^', ''), - '^w': ColorToken('', ']w', '}w', '^w', '^w', '\033[47m', '\033[48;5;250m', '%^B_WHITE%^', ''), - + "^x": ColorToken( + "", + "]d", + "}d", + "^x", + "^x", + "\033[40m", + "\033[48;5;232m", + "%^B_BLACK%^", + '', + ), + "^r": ColorToken( + "", + "]r", + "}r", + "^r", + "^r", + "\033[41m", + "\033[48;5;237m", + "%^B_RED%^", + '', + ), + "^g": ColorToken( + "", + "]g", + "}g", + "^g", + "^g", + "\033[42m", + "\033[48;5;237m", + "%^B_GREEN%^", + '', + ), + "^O": ColorToken( + "", + "]y", + "}y", + "^O", + "^y", + "\033[43m", + "\033[48;5;244m", + "%^B_ORANGE%^", + '', + ), + "^b": ColorToken( + "", + "]b", + "}b", + "^b", + "^b", + "\033[44m", + "\033[48;5;237m", + "%^B_BLUE%^", + '', + ), + "^p": ColorToken( + "", + "]m", + "}m", + "^p", + "^p", + "\033[45m", + "\033[48;5;244m", + "%^B_MAGENTA%^", + '', + ), + "^c": ColorToken( + "", + "]c", + "}c", + "^c", + "^c", + "\033[46m", + "\033[48;5;244m", + "%^B_CYAN%^", + '', + ), + "^w": ColorToken( + "", + "]w", + "}w", + "^w", + "^w", + "\033[47m", + "\033[48;5;250m", + "%^B_WHITE%^", + '', + ), # Background colors cannot BE bold in ANSI - '^z': ColorToken('', ']D', '}D', '^z', '^z', '\033[40m', '\033[48;5;240m', '%^B_BLACK%^', ''), - '^R': ColorToken('', ']R', '}R', '^R', '^R', '\033[41m', '\033[48;5;245m', '%^B_RED%^', ''), - '^G': ColorToken('', ']G', '}G', '^G', '^G', '\033[42m', '\033[48;5;245m', '%^B_GREEN%^', ''), - '^Y': ColorToken('', ']Y', '}Y', '^Y', '^Y', '\033[43m', '\033[48;5;251m', '%^B_ORANGE%^', ''), - '^B': ColorToken('', ']B', '}B', '^B', '^B', '\033[44m', '\033[48;5;245m', '%^B_BLUE%^', ''), - '^P': ColorToken('', ']M', '}M', '^P', '^P', '\033[45m', '\033[48;5;251m', '%^B_MAGENTA%^', ''), - '^C': ColorToken('', ']C', '}C', '^C', '^C', '\033[46m', '\033[48;5;251m', '%^B_CYAN%^', ''), - '^W': ColorToken('', ']W', '}W', '^W', '^W', '\033[47m', '\033[48;5;255m', '%^B_WHITE%^', ''), - + "^z": ColorToken( + "", + "]D", + "}D", + "^z", + "^z", + "\033[40m", + "\033[48;5;240m", + "%^B_BLACK%^", + '', + ), + "^R": ColorToken( + "", + "]R", + "}R", + "^R", + "^R", + "\033[41m", + "\033[48;5;245m", + "%^B_RED%^", + '', + ), + "^G": ColorToken( + "", + "]G", + "}G", + "^G", + "^G", + "\033[42m", + "\033[48;5;245m", + "%^B_GREEN%^", + '', + ), + "^Y": ColorToken( + "", + "]Y", + "}Y", + "^Y", + "^Y", + "\033[43m", + "\033[48;5;251m", + "%^B_ORANGE%^", + '', + ), + "^B": ColorToken( + "", + "]B", + "}B", + "^B", + "^B", + "\033[44m", + "\033[48;5;245m", + "%^B_BLUE%^", + '', + ), + "^P": ColorToken( + "", + "]M", + "}M", + "^P", + "^P", + "\033[45m", + "\033[48;5;251m", + "%^B_MAGENTA%^", + '', + ), + "^C": ColorToken( + "", + "]C", + "}C", + "^C", + "^C", + "\033[46m", + "\033[48;5;251m", + "%^B_CYAN%^", + '', + ), + "^W": ColorToken( + "", + "]W", + "}W", + "^W", + "^W", + "\033[47m", + "\033[48;5;255m", + "%^B_WHITE%^", + '', + ), # Blinking colors - '}x': ColorToken('', '[f[d', '{f{d', '}x', '`x', '\033[5;30m', '\033[5;38;5;232m', '%^FLASH%^BLACK%^', ''), - '}r': ColorToken('', '[f[r', '{f{r', '}r', '`r', '\033[5;31m', '\033[5;38;5;237m', '%^FLASH%^RED%^', ''), - '}g': ColorToken('', '[f[g', '{f{g', '}g', '`g', '\033[5;32m', '\033[5;38;5;237m', '%^FLASH%^GREEN%^', ''), - '}O': ColorToken('', '[f[y', '{f{y', '}O', '`y', '\033[5;33m', '\033[5;38;5;244m', '%^FLASH%^ORANGE%^', ''), - '}b': ColorToken('', '[f[b', '{f{b', '}b', '`b', '\033[5;34m', '\033[5;38;5;237m', '%^FLASH%^BLUE%^', ''), - '}p': ColorToken('', '[f[m', '{f{m', '}p', '`p', '\033[5;35m', '\033[5;38;5;244m', '%^FLASH%^MAGENTA%^', ''), - '}c': ColorToken('', '[f[c', '{f{c', '}c', '`c', '\033[5;36m', '\033[5;38;5;244m', '%^FLASH%^CYAN%^', ''), - '}w': ColorToken('', '[f[w', '{f{w', '}w', '`w', '\033[5;37m', '\033[5;38;5;250m', '%^FLASH%^WHITE%^', ''), - - '}z': ColorToken('', ']f]D', '{f{D', '}z', '`z', '\033[5;1;30m', '\033[5;38;5;240m', '%^FLASH%^BOLD%^BLACK%^', ''), - '}R': ColorToken('', ']f]R', '{f{R', '}R', '`R', '\033[5;1;31m', '\033[5;38;5;245m', '%^FLASH%^BOLD%^RED%^', ''), - '}G': ColorToken('', ']f]G', '{f{G', '}G', '`G', '\033[5;1;32m', '\033[5;38;5;245m', '%^FLASH%^BOLD%^GREEN%^', ''), - '}Y': ColorToken('', ']f]Y', '{f{Y', '}Y', '`Y', '\033[5;1;33m', '\033[5;38;5;251m', '%^FLASH%^BOLD%^ORANGE%^', ''), - '}B': ColorToken('', ']f]B', '{f{B', '}B', '`B', '\033[5;1;34m', '\033[5;38;5;245m', '%^FLASH%^BOLD%^BLUE%^', ''), - '}P': ColorToken('', ']f]M', '{f{M', '}P', '`P', '\033[5;1;35m', '\033[5;38;5;251m', '%^FLASH%^BOLD%^MAGENTA%^', ''), - '}C': ColorToken('', ']f]C', '{f{C', '}C', '`C', '\033[5;1;36m', '\033[5;38;5;251m', '%^FLASH%^BOLD%^CYAN%^', ''), - '}W': ColorToken('', ']f]W', '{f{W', '}W', '`W', '\033[5;1;37m', '\033[5;38;5;255m', '%^FLASH%^BOLD%^WHITE%^', ''), + "}x": ColorToken( + "", + "[f[d", + "{f{d", + "}x", + "`x", + "\033[5;30m", + "\033[5;38;5;232m", + "%^FLASH%^BLACK%^", + '', + ), + "}r": ColorToken( + "", + "[f[r", + "{f{r", + "}r", + "`r", + "\033[5;31m", + "\033[5;38;5;237m", + "%^FLASH%^RED%^", + '', + ), + "}g": ColorToken( + "", + "[f[g", + "{f{g", + "}g", + "`g", + "\033[5;32m", + "\033[5;38;5;237m", + "%^FLASH%^GREEN%^", + '', + ), + "}O": ColorToken( + "", + "[f[y", + "{f{y", + "}O", + "`y", + "\033[5;33m", + "\033[5;38;5;244m", + "%^FLASH%^ORANGE%^", + '', + ), + "}b": ColorToken( + "", + "[f[b", + "{f{b", + "}b", + "`b", + "\033[5;34m", + "\033[5;38;5;237m", + "%^FLASH%^BLUE%^", + '', + ), + "}p": ColorToken( + "", + "[f[m", + "{f{m", + "}p", + "`p", + "\033[5;35m", + "\033[5;38;5;244m", + "%^FLASH%^MAGENTA%^", + '', + ), + "}c": ColorToken( + "", + "[f[c", + "{f{c", + "}c", + "`c", + "\033[5;36m", + "\033[5;38;5;244m", + "%^FLASH%^CYAN%^", + '', + ), + "}w": ColorToken( + "", + "[f[w", + "{f{w", + "}w", + "`w", + "\033[5;37m", + "\033[5;38;5;250m", + "%^FLASH%^WHITE%^", + '', + ), + "}z": ColorToken( + "", + "]f]D", + "{f{D", + "}z", + "`z", + "\033[5;1;30m", + "\033[5;38;5;240m", + "%^FLASH%^BOLD%^BLACK%^", + '', + ), + "}R": ColorToken( + "", + "]f]R", + "{f{R", + "}R", + "`R", + "\033[5;1;31m", + "\033[5;38;5;245m", + "%^FLASH%^BOLD%^RED%^", + '', + ), + "}G": ColorToken( + "", + "]f]G", + "{f{G", + "}G", + "`G", + "\033[5;1;32m", + "\033[5;38;5;245m", + "%^FLASH%^BOLD%^GREEN%^", + '', + ), + "}Y": ColorToken( + "", + "]f]Y", + "{f{Y", + "}Y", + "`Y", + "\033[5;1;33m", + "\033[5;38;5;251m", + "%^FLASH%^BOLD%^ORANGE%^", + '', + ), + "}B": ColorToken( + "", + "]f]B", + "{f{B", + "}B", + "`B", + "\033[5;1;34m", + "\033[5;38;5;245m", + "%^FLASH%^BOLD%^BLUE%^", + '', + ), + "}P": ColorToken( + "", + "]f]M", + "{f{M", + "}P", + "`P", + "\033[5;1;35m", + "\033[5;38;5;251m", + "%^FLASH%^BOLD%^MAGENTA%^", + '', + ), + "}C": ColorToken( + "", + "]f]C", + "{f{C", + "}C", + "`C", + "\033[5;1;36m", + "\033[5;38;5;251m", + "%^FLASH%^BOLD%^CYAN%^", + '', + ), + "}W": ColorToken( + "", + "]f]W", + "{f{W", + "}W", + "`W", + "\033[5;1;37m", + "\033[5;38;5;255m", + "%^FLASH%^BOLD%^WHITE%^", + '', + ), } -COLOR_MAP['i3'] = { - 'BLACK': ColorToken('', '[d', '{d', '&x', '~x', '\033[30m', '\033[38;5;232m', '%^BLACK%^', ''), - 'RED': ColorToken('', '[r', '{r', '&r', '~r', '\033[31m', '\033[38;5;237m', '%^RED%^', ''), - 'GREEN': ColorToken('', '[g', '{g', '&g', '~g', '\033[32m', '\033[38;5;237m', '%^GREEN%^', ''), - 'ORANGE': ColorToken('', '[y', '{y', '&O', '~y', '\033[33m', '\033[38;5;244m', '%^ORANGE%^', ''), - 'BLUE': ColorToken('', '[b', '{b', '&b', '~b', '\033[34m', '\033[38;5;237m', '%^BLUE%^', ''), - 'MAGENTA': ColorToken('', '[m', '{m', '&p', '~p', '\033[35m', '\033[38;5;244m', '%^MAGENTA%^', ''), - 'CYAN': ColorToken('', '[c', '{c', '&c', '~c', '\033[36m', '\033[38;5;244m', '%^CYAN%^', ''), - 'WHITE': ColorToken('', '[w', '{w', '&w', '~w', '\033[37m', '\033[38;5;250m', '%^WHITE%^', ''), - 'YELLOW': ColorToken('', '[Y', '{Y', '&Y', '~Y', '\033[1;33m', '\033[38;5;251m', '%^BOLD%^ORANGE%^', ''), - - 'RESET': ColorToken('', '[x', '{x', '&d', '~!', '\033[0m', '\033[0m', '%^RESET%^', ''), - 'BOLD': ColorToken('', '[L', '{L', '&L', '~L', '\033[1m', '\033[1m', '%^BOLD%^', ''), - 'ITALIC': ColorToken('', '[i', '{i', '&i', '~i', '\033[3m', '\033[3m', '%^ITALIC%^', ''), - 'UNDERLINE': ColorToken('', '[u', '{u', '&u', '~u', '\033[4m', '\033[4m', '%^UNDERLINE%^', ''), - 'FLASH': ColorToken('', '[f', '{f', '&f', '~$', '\033[5m', '\033[5m', '%^FLASH%^', ''), - 'REVERSE': ColorToken('', '[v', '{v', '&v', '~v', '\033[7m', '\033[7m', '%^REVERSE%^', ''), - 'STRIKETHRU': ColorToken('', '[s', '{s', '&s', '~s', '\033[9m', '\033[9m', '%^STRIKETHRU%^', ''), - - 'HOME': ColorToken('', '[H', '{H', '', '', '\033[H', '\033[H', '%^HOME%^', ''), # Home - 'CLEARLINE': ColorToken('', '[_', '{_', '', '', '\033[K', '\033[K', '%^CLEARLINE%^', ''), # Clear to end of line - 'CURS_UP': ColorToken('', '[^', '{^', '', '', '\033[A', '\033[A', '%^CURS_UP%^', ''), # Cursor up - 'CURS_DOWN': ColorToken('', '[v', '{v', '', '', '\033[B', '\033[B', '%^CURS_DOWN%^', ''), # Cursor down - 'CURS_RIGHT': ColorToken('', '[>', '{>', '', '', '\033[C', '\033[C', '%^CURS_RIGHT%^', ''), # Cursor right - 'CURS_LEFT': ColorToken('', '[<', '{<', '', '', '\033[D', '\033[D', '%^CURS_LEFT%^', ''), # Cursor left - - 'B_BLACK': ColorToken('', ']d', '}d', '^x', '^x', '\033[40m', '\033[48;5;232m', '%^B_BLACK%^', ''), - 'B_RED': ColorToken('', ']r', '}r', '^r', '^r', '\033[41m', '\033[48;5;237m', '%^B_RED%^', ''), - 'B_GREEN': ColorToken('', ']g', '}g', '^g', '^g', '\033[42m', '\033[48;5;237m', '%^B_GREEN%^', ''), - 'B_ORANGE': ColorToken('', ']y', '}y', '^O', '^y', '\033[43m', '\033[48;5;244m', '%^B_ORANGE%^', ''), - 'B_BLUE': ColorToken('', ']b', '}b', '^b', '^b', '\033[44m', '\033[48;5;237m', '%^B_BLUE%^', ''), - 'B_MAGENTA': ColorToken('', ']m', '}m', '^p', '^p', '\033[45m', '\033[48;5;244m', '%^B_MAGENTA%^', ''), - 'B_CYAN': ColorToken('', ']c', '}c', '^c', '^c', '\033[46m', '\033[48;5;244m', '%^B_CYAN%^', ''), - 'B_WHITE': ColorToken('', ']w', '}w', '^w', '^w', '\033[47m', '\033[48;5;250m', '%^B_WHITE%^', ''), - 'B_YELLOW': ColorToken('', ']Y', '}Y', '^Y', '^Y', '\033[43m', '\033[48;5;251m', '%^B_ORANGE%^', ''), +COLOR_MAP["i3"] = { + "BLACK": ColorToken( + "", + "[d", + "{d", + "&x", + "~x", + "\033[30m", + "\033[38;5;232m", + "%^BLACK%^", + '', + ), + "RED": ColorToken( + "", + "[r", + "{r", + "&r", + "~r", + "\033[31m", + "\033[38;5;237m", + "%^RED%^", + '', + ), + "GREEN": ColorToken( + "", + "[g", + "{g", + "&g", + "~g", + "\033[32m", + "\033[38;5;237m", + "%^GREEN%^", + '', + ), + "ORANGE": ColorToken( + "", + "[y", + "{y", + "&O", + "~y", + "\033[33m", + "\033[38;5;244m", + "%^ORANGE%^", + '', + ), + "BLUE": ColorToken( + "", + "[b", + "{b", + "&b", + "~b", + "\033[34m", + "\033[38;5;237m", + "%^BLUE%^", + '', + ), + "MAGENTA": ColorToken( + "", + "[m", + "{m", + "&p", + "~p", + "\033[35m", + "\033[38;5;244m", + "%^MAGENTA%^", + '', + ), + "CYAN": ColorToken( + "", + "[c", + "{c", + "&c", + "~c", + "\033[36m", + "\033[38;5;244m", + "%^CYAN%^", + '', + ), + "WHITE": ColorToken( + "", + "[w", + "{w", + "&w", + "~w", + "\033[37m", + "\033[38;5;250m", + "%^WHITE%^", + '', + ), + "YELLOW": ColorToken( + "", + "[Y", + "{Y", + "&Y", + "~Y", + "\033[1;33m", + "\033[38;5;251m", + "%^BOLD%^ORANGE%^", + '', + ), + "RESET": ColorToken( + "", "[x", "{x", "&d", "~!", "\033[0m", "\033[0m", "%^RESET%^", "" + ), + "BOLD": ColorToken( + "", "[L", "{L", "&L", "~L", "\033[1m", "\033[1m", "%^BOLD%^", "" + ), + "ITALIC": ColorToken( + "", "[i", "{i", "&i", "~i", "\033[3m", "\033[3m", "%^ITALIC%^", "" + ), + "UNDERLINE": ColorToken( + "", "[u", "{u", "&u", "~u", "\033[4m", "\033[4m", "%^UNDERLINE%^", "" + ), + "FLASH": ColorToken( + "", + "[f", + "{f", + "&f", + "~$", + "\033[5m", + "\033[5m", + "%^FLASH%^", + "", + ), + "REVERSE": ColorToken( + "", + "[v", + "{v", + "&v", + "~v", + "\033[7m", + "\033[7m", + "%^REVERSE%^", + "", + ), + "STRIKETHRU": ColorToken( + "", + "[s", + "{s", + "&s", + "~s", + "\033[9m", + "\033[9m", + "%^STRIKETHRU%^", + "", + ), + "HOME": ColorToken( + "", "[H", "{H", "", "", "\033[H", "\033[H", "%^HOME%^", "" + ), # Home + "CLEARLINE": ColorToken( + "", "[_", "{_", "", "", "\033[K", "\033[K", "%^CLEARLINE%^", "" + ), # Clear to end of line + "CURS_UP": ColorToken( + "", "[^", "{^", "", "", "\033[A", "\033[A", "%^CURS_UP%^", "" + ), # Cursor up + "CURS_DOWN": ColorToken( + "", "[v", "{v", "", "", "\033[B", "\033[B", "%^CURS_DOWN%^", "" + ), # Cursor down + "CURS_RIGHT": ColorToken( + "", "[>", "{>", "", "", "\033[C", "\033[C", "%^CURS_RIGHT%^", "" + ), # Cursor right + "CURS_LEFT": ColorToken( + "", "[<", "{<", "", "", "\033[D", "\033[D", "%^CURS_LEFT%^", "" + ), # Cursor left + "B_BLACK": ColorToken( + "", + "]d", + "}d", + "^x", + "^x", + "\033[40m", + "\033[48;5;232m", + "%^B_BLACK%^", + '', + ), + "B_RED": ColorToken( + "", + "]r", + "}r", + "^r", + "^r", + "\033[41m", + "\033[48;5;237m", + "%^B_RED%^", + '', + ), + "B_GREEN": ColorToken( + "", + "]g", + "}g", + "^g", + "^g", + "\033[42m", + "\033[48;5;237m", + "%^B_GREEN%^", + '', + ), + "B_ORANGE": ColorToken( + "", + "]y", + "}y", + "^O", + "^y", + "\033[43m", + "\033[48;5;244m", + "%^B_ORANGE%^", + '', + ), + "B_BLUE": ColorToken( + "", + "]b", + "}b", + "^b", + "^b", + "\033[44m", + "\033[48;5;237m", + "%^B_BLUE%^", + '', + ), + "B_MAGENTA": ColorToken( + "", + "]m", + "}m", + "^p", + "^p", + "\033[45m", + "\033[48;5;244m", + "%^B_MAGENTA%^", + '', + ), + "B_CYAN": ColorToken( + "", + "]c", + "}c", + "^c", + "^c", + "\033[46m", + "\033[48;5;244m", + "%^B_CYAN%^", + '', + ), + "B_WHITE": ColorToken( + "", + "]w", + "}w", + "^w", + "^w", + "\033[47m", + "\033[48;5;250m", + "%^B_WHITE%^", + '', + ), + "B_YELLOW": ColorToken( + "", + "]Y", + "}Y", + "^Y", + "^Y", + "\033[43m", + "\033[48;5;251m", + "%^B_ORANGE%^", + '', + ), } -COLOR_MAP['imc2'] = { - '~x': ColorToken('', '[d', '{d', '&x', '~x', '\033[30m', '\033[38;5;232m', '%^BLACK%^', '' ), - '~r': ColorToken('', '[r', '{r', '&r', '~r', '\033[31m', '\033[38;5;237m', '%^RED%^', '' ), - '~g': ColorToken('', '[g', '{g', '&g', '~g', '\033[32m', '\033[38;5;237m', '%^GREEN%^', '' ), - '~y': ColorToken('', '[y', '{y', '&O', '~y', '\033[33m', '\033[38;5;244m', '%^ORANGE%^', '' ), - '~b': ColorToken('', '[b', '{b', '&b', '~b', '\033[34m', '\033[38;5;237m', '%^BLUE%^', '' ), - '~p': ColorToken('', '[m', '{m', '&p', '~p', '\033[35m', '\033[38;5;244m', '%^MAGENTA%^', '' ), - '~c': ColorToken('', '[c', '{c', '&c', '~c', '\033[36m', '\033[38;5;244m', '%^CYAN%^', '' ), - '~w': ColorToken('', '[w', '{w', '&w', '~w', '\033[37m', '\033[38;5;250m', '%^WHITE%^', '' ), - - '~z': ColorToken('', '[D', '{D', '&z', '~z', '\033[1;30m', '\033[38;5;240m', '%^BOLD%^BLACK%^', ''), - '~R': ColorToken('', '[R', '{R', '&R', '~R', '\033[1;31m', '\033[38;5;245m', '%^BOLD%^RED%^', ''), - '~G': ColorToken('', '[G', '{G', '&G', '~G', '\033[1;32m', '\033[38;5;245m', '%^BOLD%^GREEN%^', ''), - '~Y': ColorToken('', '[Y', '{Y', '&Y', '~Y', '\033[1;33m', '\033[38;5;251m', '%^BOLD%^ORANGE%^', ''), - '~B': ColorToken('', '[B', '{B', '&B', '~B', '\033[1;34m', '\033[38;5;245m', '%^BOLD%^BLUE%^', ''), - '~P': ColorToken('', '[M', '{M', '&P', '~P', '\033[1;35m', '\033[38;5;251m', '%^BOLD%^MAGENTA%^', ''), - '~C': ColorToken('', '[C', '{C', '&C', '~C', '\033[1;36m', '\033[38;5;251m', '%^BOLD%^CYAN%^', ''), - '~W': ColorToken('', '[W', '{W', '&W', '~W', '\033[1;37m', '\033[38;5;255m', '%^BOLD%^WHITE%^', ''), - - '~~': ColorToken('~', '~', '~', '~', '~~', '~', '~', '~', '~'), - '^^': ColorToken('^', '^', '^', '^^', '^^', '^', '^', '^', '^'), - '``': ColorToken('`', '`', '`', '`', '``', '`', '`', '`', '`'), - - '~!': ColorToken('', '[x', '{x', '&d', '~!', '\033[0m', '\033[0m', '%^RESET%^', ''), - '~L': ColorToken('', '[L', '{L', '&L', '~L', '\033[1m', '\033[1m', '%^BOLD%^', ''), - '~i': ColorToken('', '[i', '{i', '&i', '~i', '\033[3m', '\033[3m', '%^ITALIC%^', ''), - '~u': ColorToken('', '[u', '{u', '&u', '~u', '\033[4m', '\033[4m', '%^UNDERLINE%^', ''), - '~$': ColorToken('', '[f', '{f', '&f', '~$', '\033[5m', '\033[5m', '%^FLASH%^', ''), - '~v': ColorToken('', '[v', '{v', '&v', '~v', '\033[7m', '\033[7m', '%^REVERSE%^', ''), - '~s': ColorToken('', '[s', '{s', '&s', '~s', '\033[9m', '\033[9m', '%^STRIKETHRU%^', ''), - - '~Z': ColorToken('', '', '', '&Z', '~Z', '', '', '', ''), # Random foreground - '~D': ColorToken('', '[D', '{D', '&z', '~z', '\033[1;30m', '\033[38;5;240m', '%^BOLD%^BLACK%^', ''), - '~m': ColorToken('', '[m', '{m', '&p', '~p', '\033[35m', '\033[38;5;244m', '%^MAGENTA%^', ''), - '~d': ColorToken('', '[w', '{w', '&w', '~w', '\033[37m', '\033[38;5;250m', '%^WHITE%^', ''), - '~M': ColorToken('', '[M', '{M', '&P', '~P', '\033[1;35m', '\033[38;5;251m', '%^BOLD%^MAGENTA%^', ''), - +COLOR_MAP["imc2"] = { + "~x": ColorToken( + "", + "[d", + "{d", + "&x", + "~x", + "\033[30m", + "\033[38;5;232m", + "%^BLACK%^", + '', + ), + "~r": ColorToken( + "", + "[r", + "{r", + "&r", + "~r", + "\033[31m", + "\033[38;5;237m", + "%^RED%^", + '', + ), + "~g": ColorToken( + "", + "[g", + "{g", + "&g", + "~g", + "\033[32m", + "\033[38;5;237m", + "%^GREEN%^", + '', + ), + "~y": ColorToken( + "", + "[y", + "{y", + "&O", + "~y", + "\033[33m", + "\033[38;5;244m", + "%^ORANGE%^", + '', + ), + "~b": ColorToken( + "", + "[b", + "{b", + "&b", + "~b", + "\033[34m", + "\033[38;5;237m", + "%^BLUE%^", + '', + ), + "~p": ColorToken( + "", + "[m", + "{m", + "&p", + "~p", + "\033[35m", + "\033[38;5;244m", + "%^MAGENTA%^", + '', + ), + "~c": ColorToken( + "", + "[c", + "{c", + "&c", + "~c", + "\033[36m", + "\033[38;5;244m", + "%^CYAN%^", + '', + ), + "~w": ColorToken( + "", + "[w", + "{w", + "&w", + "~w", + "\033[37m", + "\033[38;5;250m", + "%^WHITE%^", + '', + ), + "~z": ColorToken( + "", + "[D", + "{D", + "&z", + "~z", + "\033[1;30m", + "\033[38;5;240m", + "%^BOLD%^BLACK%^", + '', + ), + "~R": ColorToken( + "", + "[R", + "{R", + "&R", + "~R", + "\033[1;31m", + "\033[38;5;245m", + "%^BOLD%^RED%^", + '', + ), + "~G": ColorToken( + "", + "[G", + "{G", + "&G", + "~G", + "\033[1;32m", + "\033[38;5;245m", + "%^BOLD%^GREEN%^", + '', + ), + "~Y": ColorToken( + "", + "[Y", + "{Y", + "&Y", + "~Y", + "\033[1;33m", + "\033[38;5;251m", + "%^BOLD%^ORANGE%^", + '', + ), + "~B": ColorToken( + "", + "[B", + "{B", + "&B", + "~B", + "\033[1;34m", + "\033[38;5;245m", + "%^BOLD%^BLUE%^", + '', + ), + "~P": ColorToken( + "", + "[M", + "{M", + "&P", + "~P", + "\033[1;35m", + "\033[38;5;251m", + "%^BOLD%^MAGENTA%^", + '', + ), + "~C": ColorToken( + "", + "[C", + "{C", + "&C", + "~C", + "\033[1;36m", + "\033[38;5;251m", + "%^BOLD%^CYAN%^", + '', + ), + "~W": ColorToken( + "", + "[W", + "{W", + "&W", + "~W", + "\033[1;37m", + "\033[38;5;255m", + "%^BOLD%^WHITE%^", + '', + ), + "~~": ColorToken("~", "~", "~", "~", "~~", "~", "~", "~", "~"), + "^^": ColorToken("^", "^", "^", "^^", "^^", "^", "^", "^", "^"), + "``": ColorToken("`", "`", "`", "`", "``", "`", "`", "`", "`"), + "~!": ColorToken( + "", "[x", "{x", "&d", "~!", "\033[0m", "\033[0m", "%^RESET%^", "" + ), + "~L": ColorToken( + "", "[L", "{L", "&L", "~L", "\033[1m", "\033[1m", "%^BOLD%^", "" + ), + "~i": ColorToken( + "", "[i", "{i", "&i", "~i", "\033[3m", "\033[3m", "%^ITALIC%^", "" + ), + "~u": ColorToken( + "", "[u", "{u", "&u", "~u", "\033[4m", "\033[4m", "%^UNDERLINE%^", "" + ), + "~$": ColorToken( + "", + "[f", + "{f", + "&f", + "~$", + "\033[5m", + "\033[5m", + "%^FLASH%^", + "", + ), + "~v": ColorToken( + "", + "[v", + "{v", + "&v", + "~v", + "\033[7m", + "\033[7m", + "%^REVERSE%^", + "", + ), + "~s": ColorToken( + "", + "[s", + "{s", + "&s", + "~s", + "\033[9m", + "\033[9m", + "%^STRIKETHRU%^", + "", + ), + "~Z": ColorToken("", "", "", "&Z", "~Z", "", "", "", ""), # Random foreground + "~D": ColorToken( + "", + "[D", + "{D", + "&z", + "~z", + "\033[1;30m", + "\033[38;5;240m", + "%^BOLD%^BLACK%^", + '', + ), + "~m": ColorToken( + "", + "[m", + "{m", + "&p", + "~p", + "\033[35m", + "\033[38;5;244m", + "%^MAGENTA%^", + '', + ), + "~d": ColorToken( + "", + "[w", + "{w", + "&w", + "~w", + "\033[37m", + "\033[38;5;250m", + "%^WHITE%^", + '', + ), + "~M": ColorToken( + "", + "[M", + "{M", + "&P", + "~P", + "\033[1;35m", + "\033[38;5;251m", + "%^BOLD%^MAGENTA%^", + '', + ), # Background colors - '^x': ColorToken('', ']d', '}d', '^x', '^x', '\033[40m', '\033[48;5;232m', '%^B_BLACK%^', ''), - '^r': ColorToken('', ']r', '}r', '^r', '^r', '\033[41m', '\033[48;5;237m', '%^B_RED%^', ''), - '^g': ColorToken('', ']g', '}g', '^g', '^g', '\033[42m', '\033[48;5;237m', '%^B_GREEN%^', ''), - '^y': ColorToken('', ']y', '}y', '^O', '^y', '\033[43m', '\033[48;5;244m', '%^B_ORANGE%^', ''), - '^b': ColorToken('', ']b', '}b', '^b', '^b', '\033[44m', '\033[48;5;237m', '%^B_BLUE%^', ''), - '^p': ColorToken('', ']m', '}m', '^p', '^p', '\033[45m', '\033[48;5;244m', '%^B_MAGENTA%^', ''), - '^c': ColorToken('', ']c', '}c', '^c', '^c', '\033[46m', '\033[48;5;244m', '%^B_CYAN%^', ''), - '^w': ColorToken('', ']w', '}w', '^w', '^w', '\033[47m', '\033[48;5;250m', '%^B_WHITE%^', ''), - + "^x": ColorToken( + "", + "]d", + "}d", + "^x", + "^x", + "\033[40m", + "\033[48;5;232m", + "%^B_BLACK%^", + '', + ), + "^r": ColorToken( + "", + "]r", + "}r", + "^r", + "^r", + "\033[41m", + "\033[48;5;237m", + "%^B_RED%^", + '', + ), + "^g": ColorToken( + "", + "]g", + "}g", + "^g", + "^g", + "\033[42m", + "\033[48;5;237m", + "%^B_GREEN%^", + '', + ), + "^y": ColorToken( + "", + "]y", + "}y", + "^O", + "^y", + "\033[43m", + "\033[48;5;244m", + "%^B_ORANGE%^", + '', + ), + "^b": ColorToken( + "", + "]b", + "}b", + "^b", + "^b", + "\033[44m", + "\033[48;5;237m", + "%^B_BLUE%^", + '', + ), + "^p": ColorToken( + "", + "]m", + "}m", + "^p", + "^p", + "\033[45m", + "\033[48;5;244m", + "%^B_MAGENTA%^", + '', + ), + "^c": ColorToken( + "", + "]c", + "}c", + "^c", + "^c", + "\033[46m", + "\033[48;5;244m", + "%^B_CYAN%^", + '', + ), + "^w": ColorToken( + "", + "]w", + "}w", + "^w", + "^w", + "\033[47m", + "\033[48;5;250m", + "%^B_WHITE%^", + '', + ), # Background colors cannot BE bold in ANSI - '^z': ColorToken('', ']D', '}D', '^z', '^z', '\033[40m', '\033[48;5;240m', '%^B_BLACK%^', ''), - '^R': ColorToken('', ']R', '}R', '^R', '^R', '\033[41m', '\033[48;5;245m', '%^B_RED%^', ''), - '^G': ColorToken('', ']G', '}G', '^G', '^G', '\033[42m', '\033[48;5;245m', '%^B_GREEN%^', ''), - '^Y': ColorToken('', ']Y', '}Y', '^Y', '^Y', '\033[43m', '\033[48;5;251m', '%^B_ORANGE%^', ''), - '^B': ColorToken('', ']B', '}B', '^B', '^B', '\033[44m', '\033[48;5;245m', '%^B_BLUE%^', ''), - '^P': ColorToken('', ']M', '}M', '^P', '^P', '\033[45m', '\033[48;5;251m', '%^B_MAGENTA%^', ''), - '^C': ColorToken('', ']C', '}C', '^C', '^C', '\033[46m', '\033[48;5;251m', '%^B_CYAN%^', ''), - '^W': ColorToken('', ']W', '}W', '^W', '^W', '\033[47m', '\033[48;5;255m', '%^B_WHITE%^', ''), - - '^D': ColorToken('', ']D', '}D', '^z', '^z', '\033[40m', '\033[48;5;232m', '%^B_BLACK%^', ''), - '^m': ColorToken('', ']m', '}m', '^p', '^p', '\033[45m', '\033[48;5;244m', '%^B_MAGENTA%^', ''), - '^d': ColorToken('', ']w', '}w', '^w', '^w', '\033[47m', '\033[48;5;250m', '%^B_WHITE%^', ''), - '^M': ColorToken('', ']M', '}M', '^P', '^P', '\033[45m', '\033[48;5;244m', '%^B_MAGENTA%^', ''), - + "^z": ColorToken( + "", + "]D", + "}D", + "^z", + "^z", + "\033[40m", + "\033[48;5;240m", + "%^B_BLACK%^", + '', + ), + "^R": ColorToken( + "", + "]R", + "}R", + "^R", + "^R", + "\033[41m", + "\033[48;5;245m", + "%^B_RED%^", + '', + ), + "^G": ColorToken( + "", + "]G", + "}G", + "^G", + "^G", + "\033[42m", + "\033[48;5;245m", + "%^B_GREEN%^", + '', + ), + "^Y": ColorToken( + "", + "]Y", + "}Y", + "^Y", + "^Y", + "\033[43m", + "\033[48;5;251m", + "%^B_ORANGE%^", + '', + ), + "^B": ColorToken( + "", + "]B", + "}B", + "^B", + "^B", + "\033[44m", + "\033[48;5;245m", + "%^B_BLUE%^", + '', + ), + "^P": ColorToken( + "", + "]M", + "}M", + "^P", + "^P", + "\033[45m", + "\033[48;5;251m", + "%^B_MAGENTA%^", + '', + ), + "^C": ColorToken( + "", + "]C", + "}C", + "^C", + "^C", + "\033[46m", + "\033[48;5;251m", + "%^B_CYAN%^", + '', + ), + "^W": ColorToken( + "", + "]W", + "}W", + "^W", + "^W", + "\033[47m", + "\033[48;5;255m", + "%^B_WHITE%^", + '', + ), + "^D": ColorToken( + "", + "]D", + "}D", + "^z", + "^z", + "\033[40m", + "\033[48;5;232m", + "%^B_BLACK%^", + '', + ), + "^m": ColorToken( + "", + "]m", + "}m", + "^p", + "^p", + "\033[45m", + "\033[48;5;244m", + "%^B_MAGENTA%^", + '', + ), + "^d": ColorToken( + "", + "]w", + "}w", + "^w", + "^w", + "\033[47m", + "\033[48;5;250m", + "%^B_WHITE%^", + '', + ), + "^M": ColorToken( + "", + "]M", + "}M", + "^P", + "^P", + "\033[45m", + "\033[48;5;244m", + "%^B_MAGENTA%^", + '', + ), # Blinking colors - '`x': ColorToken('', '[f[d', '{f{d', '}x', '`x', '\033[5;30m', '\033[5;38;5;232m', '%^FLASH%^BLACK%^', ''), - '`r': ColorToken('', '[f[r', '{f{r', '}r', '`r', '\033[5;31m', '\033[5;38;5;237m', '%^FLASH%^RED%^', ''), - '`g': ColorToken('', '[f[g', '{f{g', '}g', '`g', '\033[5;32m', '\033[5;38;5;237m', '%^FLASH%^GREEN%^', ''), - '`y': ColorToken('', '[f[y', '{f{y', '}O', '`y', '\033[5;33m', '\033[5;38;5;244m', '%^FLASH%^ORANGE%^', ''), - '`b': ColorToken('', '[f[b', '{f{b', '}b', '`b', '\033[5;34m', '\033[5;38;5;237m', '%^FLASH%^BLUE%^', ''), - '`p': ColorToken('', '[f[m', '{f{m', '}p', '`p', '\033[5;35m', '\033[5;38;5;244m', '%^FLASH%^MAGENTA%^', ''), - '`c': ColorToken('', '[f[c', '{f{c', '}c', '`c', '\033[5;36m', '\033[5;38;5;244m', '%^FLASH%^CYAN%^', ''), - '`w': ColorToken('', '[f[w', '{f{w', '}w', '`w', '\033[5;37m', '\033[5;38;5;250m', '%^FLASH%^WHITE%^', ''), - - '`z': ColorToken('', ']f]D', '{f{D', '}z', '`z', '\033[5;1;30m', '\033[5;38;5;240m', '%^FLASH%^BOLD%^BLACK%^', ''), - '`R': ColorToken('', ']f]R', '{f{R', '}R', '`R', '\033[5;1;31m', '\033[5;38;5;245m', '%^FLASH%^BOLD%^RED%^', ''), - '`G': ColorToken('', ']f]G', '{f{G', '}G', '`G', '\033[5;1;32m', '\033[5;38;5;245m', '%^FLASH%^BOLD%^GREEN%^', ''), - '`Y': ColorToken('', ']f]Y', '{f{Y', '}Y', '`Y', '\033[5;1;33m', '\033[5;38;5;251m', '%^FLASH%^BOLD%^ORANGE%^', ''), - '`B': ColorToken('', ']f]B', '{f{B', '}B', '`B', '\033[5;1;34m', '\033[5;38;5;245m', '%^FLASH%^BOLD%^BLUE%^', ''), - '`P': ColorToken('', ']f]M', '{f{M', '}P', '`P', '\033[5;1;35m', '\033[5;38;5;251m', '%^FLASH%^BOLD%^MAGENTA%^', ''), - '`C': ColorToken('', ']f]C', '{f{C', '}C', '`C', '\033[5;1;36m', '\033[5;38;5;251m', '%^FLASH%^BOLD%^CYAN%^', ''), - '`W': ColorToken('', ']f]W', '{f{W', '}W', '`W', '\033[5;1;37m', '\033[5;38;5;255m', '%^FLASH%^BOLD%^WHITE%^', ''), - - '`D': ColorToken('', '[f[D', '{f{D', '}z', '`z', '\033[5;1;30m', '\033[5;48;5;232m', '%^FLASH%^BOLD%^B_BLACK%^', ''), - '`m': ColorToken('', '[f[m', '{f{m', '}p', '`p', '\033[5;35m', '\033[5;48;5;244m', '%^FLASH%^MAGENTA%^', ''), - '`d': ColorToken('', '[f[w', '{f{w', '}w', '`w', '\033[5;37m', '\033[5;48;5;250m', '%^FLASH%^WHITE%^', ''), - '`M': ColorToken('', '[f[M', '{f{M', '}P', '`P', '\033[5;1;35m', '\033[5;48;5;244m', '%^FLASH%^BOLD%^MAGENTA%^', ''), + "`x": ColorToken( + "", + "[f[d", + "{f{d", + "}x", + "`x", + "\033[5;30m", + "\033[5;38;5;232m", + "%^FLASH%^BLACK%^", + '', + ), + "`r": ColorToken( + "", + "[f[r", + "{f{r", + "}r", + "`r", + "\033[5;31m", + "\033[5;38;5;237m", + "%^FLASH%^RED%^", + '', + ), + "`g": ColorToken( + "", + "[f[g", + "{f{g", + "}g", + "`g", + "\033[5;32m", + "\033[5;38;5;237m", + "%^FLASH%^GREEN%^", + '', + ), + "`y": ColorToken( + "", + "[f[y", + "{f{y", + "}O", + "`y", + "\033[5;33m", + "\033[5;38;5;244m", + "%^FLASH%^ORANGE%^", + '', + ), + "`b": ColorToken( + "", + "[f[b", + "{f{b", + "}b", + "`b", + "\033[5;34m", + "\033[5;38;5;237m", + "%^FLASH%^BLUE%^", + '', + ), + "`p": ColorToken( + "", + "[f[m", + "{f{m", + "}p", + "`p", + "\033[5;35m", + "\033[5;38;5;244m", + "%^FLASH%^MAGENTA%^", + '', + ), + "`c": ColorToken( + "", + "[f[c", + "{f{c", + "}c", + "`c", + "\033[5;36m", + "\033[5;38;5;244m", + "%^FLASH%^CYAN%^", + '', + ), + "`w": ColorToken( + "", + "[f[w", + "{f{w", + "}w", + "`w", + "\033[5;37m", + "\033[5;38;5;250m", + "%^FLASH%^WHITE%^", + '', + ), + "`z": ColorToken( + "", + "]f]D", + "{f{D", + "}z", + "`z", + "\033[5;1;30m", + "\033[5;38;5;240m", + "%^FLASH%^BOLD%^BLACK%^", + '', + ), + "`R": ColorToken( + "", + "]f]R", + "{f{R", + "}R", + "`R", + "\033[5;1;31m", + "\033[5;38;5;245m", + "%^FLASH%^BOLD%^RED%^", + '', + ), + "`G": ColorToken( + "", + "]f]G", + "{f{G", + "}G", + "`G", + "\033[5;1;32m", + "\033[5;38;5;245m", + "%^FLASH%^BOLD%^GREEN%^", + '', + ), + "`Y": ColorToken( + "", + "]f]Y", + "{f{Y", + "}Y", + "`Y", + "\033[5;1;33m", + "\033[5;38;5;251m", + "%^FLASH%^BOLD%^ORANGE%^", + '', + ), + "`B": ColorToken( + "", + "]f]B", + "{f{B", + "}B", + "`B", + "\033[5;1;34m", + "\033[5;38;5;245m", + "%^FLASH%^BOLD%^BLUE%^", + '', + ), + "`P": ColorToken( + "", + "]f]M", + "{f{M", + "}P", + "`P", + "\033[5;1;35m", + "\033[5;38;5;251m", + "%^FLASH%^BOLD%^MAGENTA%^", + '', + ), + "`C": ColorToken( + "", + "]f]C", + "{f{C", + "}C", + "`C", + "\033[5;1;36m", + "\033[5;38;5;251m", + "%^FLASH%^BOLD%^CYAN%^", + '', + ), + "`W": ColorToken( + "", + "]f]W", + "{f{W", + "}W", + "`W", + "\033[5;1;37m", + "\033[5;38;5;255m", + "%^FLASH%^BOLD%^WHITE%^", + '', + ), + "`D": ColorToken( + "", + "[f[D", + "{f{D", + "}z", + "`z", + "\033[5;1;30m", + "\033[5;48;5;232m", + "%^FLASH%^BOLD%^B_BLACK%^", + '', + ), + "`m": ColorToken( + "", + "[f[m", + "{f{m", + "}p", + "`p", + "\033[5;35m", + "\033[5;48;5;244m", + "%^FLASH%^MAGENTA%^", + '', + ), + "`d": ColorToken( + "", + "[f[w", + "{f{w", + "}w", + "`w", + "\033[5;37m", + "\033[5;48;5;250m", + "%^FLASH%^WHITE%^", + '', + ), + "`M": ColorToken( + "", + "[f[M", + "{f{M", + "}P", + "`P", + "\033[5;1;35m", + "\033[5;48;5;244m", + "%^FLASH%^BOLD%^MAGENTA%^", + '', + ), } diff --git a/src/rom24/miniboa/telnet.py b/src/rom24/miniboa/telnet.py index 09318a6..cab4e94 100644 --- a/src/rom24/miniboa/telnet.py +++ b/src/rom24/miniboa/telnet.py @@ -10,18 +10,18 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # Changes made by pR0Ps.CM[at]gmail[dot]com on 18/07/2012 # -Updated for use with Python 3.x # -Repackaged into a single file to simplify distribution # -Other misc fixes and changes # # Report any bugs in this implementation to me (email above) -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # Additional changes by Quixadhal on 2014.06.16 # -Re-split code into multiple files, for ease of maintenance # -Rewrote terminal system -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ """ Manage one Telnet client connected via a TCP/IP socket. @@ -38,7 +38,7 @@ from rom24.miniboa.terminal import word_wrap -#---[ Telnet Notes ]----------------------------------------------------------- +# ---[ Telnet Notes ]----------------------------------------------------------- # (See RFC 854 for more information) # # Negotiating a Local Option @@ -75,13 +75,13 @@ # request should not be acknowledged. -#--[ Global Constants ]-------------------------------------------------------- +# --[ Global Constants ]-------------------------------------------------------- UNKNOWN = -1 ## Cap sockets to 500 on Windows because winsock can only process 512 at time ## Cap sockets to 1000 on Linux because you can only have 1024 file descriptors -MAX_CONNECTIONS = 500 if sys.platform == 'win32' else 1000 +MAX_CONNECTIONS = 500 if sys.platform == "win32" else 1000 -#--[ Telnet Commands ]--------------------------------------------------------- +# --[ Telnet Commands ]--------------------------------------------------------- SE = chr(240) # End of subnegotiation parameters NOP = chr(241) # No operation DATMK = chr(242) # Data stream portion of a sync. @@ -101,7 +101,7 @@ SEND = chr(1) # Sub-process negotiation SEND command IS = chr(0) # Sub-process negotiation IS command -#--[ Telnet Options ]---------------------------------------------------------- +# --[ Telnet Options ]---------------------------------------------------------- BINARY = chr(0) # Transmit Binary ECHO = chr(1) # Echo characters back to sender RECON = chr(2) # Reconnection @@ -111,14 +111,14 @@ LINEMO = chr(34) # Line Mode -#--[ Connection Lost ]--------------------------------------------------------- +# --[ Connection Lost ]--------------------------------------------------------- class ConnectionLost(Exception): """ Custom exception to signal a lost connection to the Telnet Server. """ -#--[ Telnet Option ]----------------------------------------------------------- +# --[ Telnet Option ]----------------------------------------------------------- class TelnetOption(object): """ Simple class used to track the status of an extended Telnet option. @@ -130,7 +130,7 @@ def __init__(self): self.reply_pending = False # Are we expecting a reply? -#--[ Telnet Client ]----------------------------------------------------------- +# --[ Telnet Client ]----------------------------------------------------------- class TelnetClient(object): """ Represents a client connection via Telnet. @@ -140,19 +140,19 @@ class TelnetClient(object): """ def __init__(self, sock, addr_tup): - self.protocol = 'telnet' + self.protocol = "telnet" self.active = True # Turns False when the connection is lost self.sock = sock # The connection's socket self.fileno = sock.fileno() # The socket's file descriptor self.address = addr_tup[0] # The client's remote TCP/IP address self.port = addr_tup[1] # The client's remote port - self.terminal_type = 'ANSI' # set via request_terminal_type() + self.terminal_type = "ANSI" # set via request_terminal_type() self.use_ansi = True self.columns = 80 self.rows = 24 self.send_pending = False - self.send_buffer = '' - self.recv_buffer = '' + self.send_buffer = "" + self.recv_buffer = "" self.bytes_sent = 0 self.bytes_received = 0 self.cmd_ready = False @@ -167,7 +167,7 @@ def __init__(self, sock, addr_tup): self.telnet_opt_dict = {} # Mapping for up to 256 TelnetOptions self.telnet_echo = False # Echo input back to the client? self.telnet_echo_password = False # Echo back '*' for passwords? - self.telnet_sb_buffer = '' # Buffer for sub-negotiations + self.telnet_sb_buffer = "" # Buffer for sub-negotiations def get_command(self): """ @@ -184,28 +184,36 @@ def get_command(self): self.cmd_ready = False return cmd - def send(self, text: str, wrap: int=None, terminal: str='ansi'): + def send(self, text: str, wrap: int = None, terminal: str = "ansi"): """ Send raw text to the distant end. """ if text and isinstance(text, str): - text = text.replace('\n\r', '\n') # DikuMUD got their line endings backwards - text = text.replace('\r\n', '\n') # This is correct for TELNET, but we need to ensure + text = text.replace( + "\n\r", "\n" + ) # DikuMUD got their line endings backwards + text = text.replace( + "\r\n", "\n" + ) # This is correct for TELNET, but we need to ensure # that "\r\n" doesn't become "\r\n\n" later. if wrap: - text = '\n'.join(word_wrap(text, wrap)) # Note self.columns is negotiated + text = "\n".join( + word_wrap(text, wrap) + ) # Note self.columns is negotiated if terminal: - text = color_convert(text, 'pyom', terminal) # Note self.terminal_type is negotiated - self.send_buffer += text.replace('\n', '\r\n') + text = color_convert( + text, "pyom", terminal + ) # Note self.terminal_type is negotiated + self.send_buffer += text.replace("\n", "\r\n") self.send_pending = True - #def send_cc(self, text): + # def send_cc(self, text): # """ # Send text with caret codes converted to ansi. # """ # self.send(colorize(text, self.use_ansi)) - #def send_wrapped(self, text): + # def send_wrapped(self, text): # """ # Send text padded and wrapped to the user's screen width. # """ @@ -297,7 +305,7 @@ def socket_send(self): """ if len(self.send_buffer): try: - #convert to ansi before sending + # convert to ansi before sending sent = self.sock.send(bytes(self.send_buffer, "cp1252")) except socket.error as err: logger.error("SEND error '{}' from {}".format(err, self.addrport())) @@ -313,10 +321,12 @@ def socket_recv(self): Called by TelnetServer when recv data is ready. """ try: - #Encode recieved bytes in ansi + # Encode recieved bytes in ansi data = str(self.sock.recv(2048), "cp1252") except socket.error as err: - logger.error("RECIEVE socket error '{}' from {}".format(err, self.addrport())) + logger.error( + "RECIEVE socket error '{}' from {}".format(err, self.addrport()) + ) raise ConnectionLost() ## Did they close the connection? @@ -335,13 +345,13 @@ def socket_recv(self): ## Look for newline characters to get whole lines from the buffer while True: - mark = self.recv_buffer.find('\n') + mark = self.recv_buffer.find("\n") if mark == -1: break cmd = self.recv_buffer[:mark].strip() self.command_list.append(cmd) self.cmd_ready = True - self.recv_buffer = self.recv_buffer[mark + 1:] + self.recv_buffer = self.recv_buffer[mark + 1 :] def _recv_byte(self, byte): """ @@ -349,7 +359,7 @@ def _recv_byte(self, byte): well with extended character sets. """ ## Filter out non-printing characters - #if (byte >= ' ' and byte <= '~') or byte == '\n': + # if (byte >= ' ' and byte <= '~') or byte == '\n': if self.telnet_echo: self._echo_byte(byte) self.recv_buffer += byte @@ -358,10 +368,10 @@ def _echo_byte(self, byte): """ Echo a character back to the client and convert LF into CR\LF. """ - if byte == '\n': - self.send_buffer += '\r' + if byte == "\n": + self.send_buffer += "\r" if self.telnet_echo_password: - self.send_buffer += '*' + self.send_buffer += "*" else: self.send_buffer += byte @@ -438,12 +448,12 @@ def _two_byte_cmd(self, cmd): """ Handle incoming Telnet commands that are two bytes long. """ - #logger.debug("Got two byte cmd '{}'".format(ord(cmd))) + # logger.debug("Got two byte cmd '{}'".format(ord(cmd))) if cmd == SB: ## Begin capturing a sub-negotiation string self.telnet_got_sb = True - self.telnet_sb_buffer = '' + self.telnet_sb_buffer = "" elif cmd == SE: ## Stop capturing a sub-negotiation string @@ -485,7 +495,7 @@ def _three_byte_cmd(self, option): Handle incoming Telnet commmands that are three bytes long. """ cmd = self.telnet_got_cmd - #logger.debug("Got three byte cmd {}:{}".format(ord(cmd), ord(option))) + # logger.debug("Got three byte cmd {}:{}".format(ord(cmd), ord(option))) ## Incoming DO's and DONT's refer to the status of this end if cmd == DO: @@ -495,7 +505,10 @@ def _three_byte_cmd(self, option): self._note_reply_pending(option, False) self._note_local_option(option, True) - elif self._check_local_option(option) is False or self._check_local_option(option) is UNKNOWN: + elif ( + self._check_local_option(option) is False + or self._check_local_option(option) is UNKNOWN + ): self._note_local_option(option, True) self._iac_will(option) ## Just nod unless setting echo @@ -515,7 +528,10 @@ def _three_byte_cmd(self, option): self._note_reply_pending(option, False) self._note_local_option(option, False) - elif self._check_local_option(option) is True or self._check_local_option(option) is UNKNOWN: + elif ( + self._check_local_option(option) is True + or self._check_local_option(option) is UNKNOWN + ): self._note_local_option(option, False) self._iac_wont(option) ## Just nod unless setting echo @@ -540,7 +556,10 @@ def _three_byte_cmd(self, option): self._note_reply_pending(option, False) self._note_remote_option(option, True) - elif self._check_remote_option(option) is False or self._check_remote_option(option) is UNKNOWN: + elif ( + self._check_remote_option(option) is False + or self._check_remote_option(option) is UNKNOWN + ): self._note_remote_option(option, True) self._iac_do(option) ## Client should respond with SB (for NAWS) @@ -552,7 +571,10 @@ def _three_byte_cmd(self, option): ## Tell them to send their terminal type self.send("{}{}{}{}{}{}".format(IAC, SB, TTYPE, SEND, IAC, SE)) - elif self._check_remote_option(TTYPE) is False or self._check_remote_option(TTYPE) is UNKNOWN: + elif ( + self._check_remote_option(TTYPE) is False + or self._check_remote_option(TTYPE) is UNKNOWN + ): self._note_remote_option(TTYPE, True) self._iac_do(TTYPE) @@ -571,7 +593,10 @@ def _three_byte_cmd(self, option): self._note_reply_pending(option, False) self._note_remote_option(option, False) - elif self._check_remote_option(option) is True or self._check_remote_option(option) is UNKNOWN: + elif ( + self._check_remote_option(option) is True + or self._check_remote_option(option) is UNKNOWN + ): self._note_remote_option(option, False) self._iac_dont(option) @@ -606,9 +631,9 @@ def _sb_decoder(self): logger.info("Screen is {} x {}".format(self.columns, self.rows)) - self.telnet_sb_buffer = '' + self.telnet_sb_buffer = "" - #---[ State Juggling for Telnet Options ]---------------------------------- + # ---[ State Juggling for Telnet Options ]---------------------------------- ## Sometimes verbiage is tricky. I use 'note' rather than 'set' here ## because (to me) set infers something happened. @@ -649,7 +674,7 @@ def _note_reply_pending(self, option, state): self.telnet_opt_dict[option] = TelnetOption() self.telnet_opt_dict[option].reply_pending = state - #---[ Telnet Command Shortcuts ]------------------------------------------- + # ---[ Telnet Command Shortcuts ]------------------------------------------- def _iac_do(self, option): """Send a Telnet IAC "DO" sequence.""" @@ -668,4 +693,4 @@ def _iac_wont(self, option): self.send("{}{}{}".format(IAC, WONT, option)) def send_ga(self): - self.send('{}{}'.format(IAC, GA)) + self.send("{}{}".format(IAC, GA)) diff --git a/src/rom24/miniboa/terminal.py b/src/rom24/miniboa/terminal.py index 8d434c8..1782993 100644 --- a/src/rom24/miniboa/terminal.py +++ b/src/rom24/miniboa/terminal.py @@ -10,14 +10,14 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # Changes made by pR0Ps.CM[at]gmail[dot]com on 18/07/2012 # -Updated for use with Python 3.x # -Repackaged into a single file to simplify distribution # -Other misc fixes and changes # # Report any bugs in this implementation to me (email above) -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # Additional changes by Quixadhal on 2014.06.16 # -Re-split code into multiple files, for ease of maintenance # -Rewrote terminal system @@ -42,7 +42,7 @@ # # By popular demand, I've also added support for ROM style color codes, # and also IMC2, and Smaug, since they are parsed in the same way. -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ """ Support for color and formatting for various terminals or @@ -58,7 +58,7 @@ from rom24.miniboa.colors import TERMINAL_TYPES, COLOR_MAP _TTYPE_MAP = { - 'tinyfugue': 'ansi', + "tinyfugue": "ansi", } _PARA_BREAK = re.compile(r"(\n\s*\n)", re.MULTILINE) @@ -75,19 +75,19 @@ def word_wrap(text: str, columns=80, indent=4, padding=2): for para in paragraphs: if para.isspace(): continue - line = ' ' * indent + line = " " * indent linelen = len(line) words = para.split() for word in words: - bareword = color_convert(word, 'pyom', None) + bareword = color_convert(word, "pyom", None) if (linelen + 1 + len(bareword)) > columns: lines.append(line) - line = ' ' * padding + line = " " * padding linelen = len(line) line += word linelen += len(bareword) else: - line += ' ' + word + line += " " + word linelen += len(bareword) + 1 if not line.isspace(): lines.append(line) @@ -95,55 +95,56 @@ def word_wrap(text: str, columns=80, indent=4, padding=2): class Xlator(dict): - """ All-in-one multiple-string-substitution class """ + """All-in-one multiple-string-substitution class""" + def _make_regex(self): - """ Build re object based on the keys of the current dictionary """ - #x = lambda s: '(? 3: - self.send('Please come back when you think of a name.') + self.send("Please come back when you think of a name.") retries = 0 self.deactivate() return @@ -90,12 +101,14 @@ def con_get_name(self): ch_dummy.stub = handler_pc.Pc.load_stub(name) if ch_dummy.stub: found = True - if ch_dummy.stub['is_banned']: - logger.info("Denying access to %s@%s" % (ch_dummy.stub['name'], self.addrport())) + if ch_dummy.stub["is_banned"]: + logger.info( + "Denying access to %s@%s" % (ch_dummy.stub["name"], self.addrport()) + ) self.send("You have been denied access.") self.deactivate() return - if settings.WIZLOCK and not ch_dummy.stub['is_immortal']: + if settings.WIZLOCK and not ch_dummy.stub["is_immortal"]: self.send("Game is Wizlocked. Try again later.") self.deactivate() return @@ -125,11 +138,11 @@ def con_get_name(self): def con_confirm_new_name(self): argument = self.get_command()[:1].lower() ch_dummy = self.character - if argument == 'y': + if argument == "y": ch_dummy.send("New character.\nGive me a password for %s: " % ch_dummy.name) ch_dummy.desc.password_mode_on() self.set_connected(con_get_new_password) - elif argument == 'n': + elif argument == "n": ch_dummy.send("Ok, what IS it, then? ") self.set_connected(con_get_name) else: @@ -143,7 +156,7 @@ def con_get_new_password(self): ch_dummy.send("Password must be at least five characters long.\nPassword: ") return if settings.ENCRYPT_PASSWORD: - argument = argument.encode('utf8') + argument = argument.encode("utf8") pwdnew = hashlib.sha512(argument).hexdigest() else: pwdnew = argument @@ -160,7 +173,7 @@ def con_confirm_new_password(self): ch_dummy = self.character if settings.ENCRYPT_PASSWORD: - argument = argument.encode('utf8') + argument = argument.encode("utf8") argument = hashlib.sha512(argument).hexdigest() if argument != ch_dummy.pwd: @@ -190,7 +203,7 @@ def con_get_new_race(self): if argument.startswith("help"): argument, arg = game_utils.read_word(argument) if not argument: - ch.do_help('race help') + ch.do_help("race help") else: ch.do_help(argument) ch.send("\nWhat is your race (help for more information)? ") @@ -207,8 +220,8 @@ def con_get_new_race(self): return ch.race = const.race_table[race.name] - ch_selections['race'] = race.name - #initialize stats */ + ch_selections["race"] = race.name + # initialize stats */ for i in range(merc.MAX_STATS): ch.perm_stat[i] = race.stats[i] ch.affected_by.set_bit(const.race_table[race.name].aff) @@ -236,10 +249,10 @@ def con_get_new_sex(self): argument = self.get_command()[:1].lower() ch = self.character - if argument == 'm': + if argument == "m": ch.sex = merc.SEX_MALE ch.true_sex = merc.SEX_MALE - elif argument == 'f': + elif argument == "f": ch.sex = merc.SEX_FEMALE ch.true_sex = merc.SEX_FEMALE else: @@ -265,7 +278,7 @@ def con_get_new_class(self): return ch.guild = guild - ch_selections['guild'] = guild + ch_selections["guild"] = guild log_buf = "%s@%s new player." % (ch.name, self.addrport()) logger.info(log_buf) @@ -282,11 +295,11 @@ def con_get_alignment(self): argument = self.get_command()[:1].lower() ch = self.character - if argument == 'g': + if argument == "g": ch.alignment = 750 - elif argument == 'n': + elif argument == "n": ch.alignment = 0 - elif argument == 'e': + elif argument == "e": ch.alignment = -750 else: ch.send("That's not a valid alignment.\n") @@ -296,9 +309,11 @@ def con_get_alignment(self): ch.send("\n") ch.group_add("rom basics", False) ch.group_add(ch.guild.base_group, False) - ch.learned['recall'] = 50 + ch.learned["recall"] = 50 ch.send("Do you wish to customize this character?\n") - ch.send("Customization takes time, but allows a wider range of skills and abilities.\n") + ch.send( + "Customization takes time, but allows a wider range of skills and abilities.\n" + ) ch.send("Customize (Y/N)? ") self.set_connected(con_default_choice) @@ -308,7 +323,7 @@ def con_default_choice(self): ch = self.character ch.send("\n") - if argument == 'y': + if argument == "y": ch.gen_data = world_classes.Gen() ch.gen_data.points_chosen = ch.points ch.do_help("group header") @@ -317,7 +332,7 @@ def con_default_choice(self): ch.do_skills("") ch.do_help("menu choice") self.set_connected(con_gen_groups) - elif argument == 'n': + elif argument == "n": ch.group_add(ch.guild.default_group, True) ch.send("Please pick a weapon from the following choices:\n") @@ -346,7 +361,7 @@ def con_pick_weapon(self): return ch.learned[weapon.gsn] = 40 - ch_selections['weapon'] = weapon.gsn + ch_selections["weapon"] = weapon.gsn ch.do_help("motd") self.set_connected(con_read_motd) @@ -360,12 +375,16 @@ def con_gen_groups(self): ch.send("You didn't pick anything.\n") return if ch.points < 40 + const.pc_race_table[ch.race.name].points: - ch.send("You must take at least %d points of skills and groups" % - (40 + const.pc_race_table[ch.race.name].points)) + ch.send( + "You must take at least %d points of skills and groups" + % (40 + const.pc_race_table[ch.race.name].points) + ) return ch.send("Creation points: %d\n" % ch.points) - ch.send("Experience per level: %d\n" % ch.exp_per_level(ch.gen_data.points_chosen)) + ch.send( + "Experience per level: %d\n" % ch.exp_per_level(ch.gen_data.points_chosen) + ) if ch.points < 40: ch.train = (40 - ch.points + 1) / 2 del ch.gen_data @@ -391,11 +410,11 @@ def con_get_old_password(self): ch_dummy = self.character ch_dummy.desc.password_mode_off() if settings.ENCRYPT_PASSWORD: - argument = argument.encode('utf8') + argument = argument.encode("utf8") pwdcmp = hashlib.sha512(argument).hexdigest() else: pwdcmp = argument - if pwdcmp != ch_dummy.stub['pwd']: + if pwdcmp != ch_dummy.stub["pwd"]: ch_dummy.send("\nWrong password.\n") ch_dummy.failed_attempts += 1 if ch_dummy.failed_attempts > 3: @@ -405,11 +424,11 @@ def con_get_old_password(self): ch_dummy.desc.password_mode_on() self.set_connected(con_get_old_password) return - #write_to_buffer( d, echo_on_str, 0 ); + # write_to_buffer( d, echo_on_str, 0 ); - if ch_dummy.stub['auth']: + if ch_dummy.stub["auth"]: ch_dummy.failed_attempts = 0 - ch_dummy.send('\nAuthenticator code: ') + ch_dummy.send("\nAuthenticator code: ") self.set_connected(con_get_timecode) return @@ -440,13 +459,13 @@ def con_get_timecode(self): argument = self.get_command() ch_dummy = self.character - if not ch_dummy.stub['auth'].verify(argument): - ch_dummy.send('\nWrong timecode.\n') + if not ch_dummy.stub["auth"].verify(argument): + ch_dummy.send("\nWrong timecode.\n") ch_dummy.failed_attempts += 1 if ch_dummy.failed_attempts > 3: comm.close_socket(self) else: - ch_dummy.send('Authenticator code: ') + ch_dummy.send("Authenticator code: ") self.set_connected(con_get_timecode) return @@ -478,7 +497,7 @@ def con_break_connect(self): argument = self.get_command()[:1].lower() ch = self.character - if argument == 'y': + if argument == "y": for d_old in merc.descriptor_list[:]: if d_old == self or not d_old.character: continue @@ -494,7 +513,7 @@ def con_break_connect(self): self.character = None self.set_connected(con_get_name) return - if argument == 'n': + if argument == "n": self.send("Name: ") if self.character: del self.character @@ -535,15 +554,17 @@ def con_read_motd(self): ch.practice = 5 buf = "the %s" % const.title_table[ch.guild.name][ch.level][ch.sex - 1] ch.title = buf - #ch.prompt = "<%hhp %mm %vmv> " - ch.do_outfit(ch_selections['weapon']) - ch.put(object_creator.create_item(instance.item_templates[merc.OBJ_VNUM_MAP], 0)) + # ch.prompt = "<%hhp %mm %vmv> " + ch.do_outfit(ch_selections["weapon"]) + ch.put( + object_creator.create_item(instance.item_templates[merc.OBJ_VNUM_MAP], 0) + ) school_id = instance.instances_by_room[merc.ROOM_VNUM_SCHOOL][0] school = instance.rooms[school_id] school.put(ch) ch.do_help("newbie info") - #TODO: create a player manifest that we can use/check, instead of needing to walk the dir. + # TODO: create a player manifest that we can use/check, instead of needing to walk the dir. player_files = os.listdir(settings.PLAYER_DIR) if len(player_files) < 1: for iLevel in range(ch.level, merc.MAX_LEVEL): @@ -552,9 +573,11 @@ def con_read_motd(self): ch.exp = ch.exp_per_level(ch.points) * max(1, ch.level) ch.trust = 0 ch.save() - ch.send('\n\nCongratulations! As the first player to log into this MUD, you are now\n' + - 'the IMPLEMENTOR, the sucker in charge, the place where the buck stops.\n' + - 'Enjoy!\n\n') + ch.send( + "\n\nCongratulations! As the first player to log into this MUD, you are now\n" + + "the IMPLEMENTOR, the sucker in charge, the place where the buck stops.\n" + + "Enjoy!\n\n" + ) if ch._environment in instance.global_instances.keys() and not ch.level == 0: room = instance.global_instances.get(ch._environment, None) @@ -574,7 +597,14 @@ def con_read_motd(self): ch.send("\n\n") ch.do_term("") - handler_game.wiznet("$N has left real life behind.", ch, None, merc.WIZ_LOGINS, merc.WIZ_SITES, ch.trust) + handler_game.wiznet( + "$N has left real life behind.", + ch, + None, + merc.WIZ_LOGINS, + merc.WIZ_SITES, + ch.trust, + ) if ch.pet: ch.in_room.put(ch.pet) handler_game.act("$n has entered the game.", ch.pet, None, None, merc.TO_ROOM) diff --git a/src/rom24/object_creator.py b/src/rom24/object_creator.py index 4b92106..ad260d5 100644 --- a/src/rom24/object_creator.py +++ b/src/rom24/object_creator.py @@ -1,4 +1,4 @@ -__author__ = 'syn' +__author__ = "syn" import random import sys @@ -30,7 +30,7 @@ def create_room(room_template): def clone_room(parent, clone): if not parent or not clone: return - '''Clone a room, minus contents and exits''' + """Clone a room, minus contents and exits""" clone = handler_room.Room(parent) clone.inventory = None clone.people = None @@ -92,23 +92,33 @@ def create_mobile(npc_template): if npc_template.new_format: # load in new style */ # read from prototype */ - #npc.group = npc_template.group - #npc.act.bits = npc_template.act.bits + # npc.group = npc_template.group + # npc.act.bits = npc_template.act.bits npc.comm.set_bit(merc.COMM_NOCHANNELS | merc.COMM_NOSHOUT | merc.COMM_NOTELL) - #npc.affected_by.bits = npc_template.affected_by.bits - #npc.alignment = npc_template.alignment - #npc.level = npc_template.level - #npc.hitroll = npc_template.hitroll - #npc.damroll = npc_template.dam_dice[merc.DICE_BONUS] - npc.max_hit = game_utils.dice(npc_template.hit_dice[merc.DICE_NUMBER], - npc_template.hit_dice[merc.DICE_TYPE]) + npc_template.hit_dice[merc.DICE_BONUS] + # npc.affected_by.bits = npc_template.affected_by.bits + # npc.alignment = npc_template.alignment + # npc.level = npc_template.level + # npc.hitroll = npc_template.hitroll + # npc.damroll = npc_template.dam_dice[merc.DICE_BONUS] + npc.max_hit = ( + game_utils.dice( + npc_template.hit_dice[merc.DICE_NUMBER], + npc_template.hit_dice[merc.DICE_TYPE], + ) + + npc_template.hit_dice[merc.DICE_BONUS] + ) npc.hit = npc.max_hit - npc.max_mana = game_utils.dice(npc_template.mana_dice[merc.DICE_NUMBER], - npc_template.mana_dice[merc.DICE_TYPE]) + npc_template.mana_dice[merc.DICE_BONUS] + npc.max_mana = ( + game_utils.dice( + npc_template.mana_dice[merc.DICE_NUMBER], + npc_template.mana_dice[merc.DICE_TYPE], + ) + + npc_template.mana_dice[merc.DICE_BONUS] + ) npc.mana = npc.max_mana npc.damage[merc.DICE_NUMBER] = npc_template.dam_dice[merc.DICE_NUMBER] npc.damage[merc.DICE_TYPE] = npc_template.dam_dice[merc.DICE_TYPE] - #npc.dam_type = npc_template.dam_type + # npc.dam_type = npc_template.dam_type if npc.dam_type == 0: num = random.randint(1, 3) if num == 1: @@ -119,20 +129,20 @@ def create_mobile(npc_template): npc.dam_type = 11 # pierce */ for i in range(4): npc.armor[i] = npc_template.armor[i] - #npc.off_flags.bits = npc_template.off_flags.bits - #npc.imm_flags.bits = npc_template.imm_flags.bits - #npc.res_flags.bits = npc_template.res_flags.bits - #npc.vuln_flags.bits = npc_template.vuln_flags.bits - #npc.start_pos = npc_template.start_pos - #npc.default_pos = npc_template.default_pos - #npc.sex = npc_template.sex + # npc.off_flags.bits = npc_template.off_flags.bits + # npc.imm_flags.bits = npc_template.imm_flags.bits + # npc.res_flags.bits = npc_template.res_flags.bits + # npc.vuln_flags.bits = npc_template.vuln_flags.bits + # npc.start_pos = npc_template.start_pos + # npc.default_pos = npc_template.default_pos + # npc.sex = npc_template.sex if type(npc_template.sex) != int or npc.sex == 3: # random sex */ npc.sex = random.randint(1, 2) - #npc.race = npc_template.race - #npc.form.bits = npc_template.form.bits - #npc.parts.bits = npc_template.parts.bits - #npc.size = int(npc_template.size) - #npc.material = npc_template.material + # npc.race = npc_template.race + # npc.form.bits = npc_template.form.bits + # npc.parts.bits = npc_template.parts.bits + # npc.size = int(npc_template.size) + # npc.material = npc_template.material # computed on the spot */ for i in range(merc.MAX_STATS): @@ -205,14 +215,16 @@ def create_mobile(npc_template): af.bitvector = merc.AFF_PROTECT_GOOD npc.affect_add(af) else: # read in old format and convert */ - #npc.act.bits = npc_template.act.bits - #npc.affected_by.bits = npc_template.affected_by.bits - #npc.alignment = npc_template.alignment - #npc.level = npc_template.level - #npc.hitroll = npc_template.hitroll + # npc.act.bits = npc_template.act.bits + # npc.affected_by.bits = npc_template.affected_by.bits + # npc.alignment = npc_template.alignment + # npc.level = npc_template.level + # npc.hitroll = npc_template.hitroll npc.damroll = 0 - npc.max_hit = npc.level * 8 + random.randint(npc.level * npc.level // 4, npc.level * npc.level) - npc.max_hit *= .9 + npc.max_hit = npc.level * 8 + random.randint( + npc.level * npc.level // 4, npc.level * npc.level + ) + npc.max_hit *= 0.9 npc.hit = npc.max_hit npc.max_mana = 100 + game_utils.dice(npc.level, 10) npc.mana = npc.max_mana @@ -226,16 +238,16 @@ def create_mobile(npc_template): for i in range(3): npc.armor[i] = game_utils.interpolate(npc.level, 100, -100) npc.armor[3] = game_utils.interpolate(npc.level, 100, 0) - #npc.race = npc_template.race - #npc.off_flags.bits = npc_template.off_flags.bits - #npc.imm_flags.bits = npc_template.imm_flags.bits - #npc.res_flags.bits = npc_template.res_flags.bits - #npc.vuln_flags.bits = npc_template.vuln_flags.bits - #npc.start_pos = npc_template.start_pos - #npc.default_pos = npc_template.default_pos - #npc.sex = npc_template.sex - #npc.form.bits = npc_template.form.bits - #npc.parts.bits = npc_template.parts.bits + # npc.race = npc_template.race + # npc.off_flags.bits = npc_template.off_flags.bits + # npc.imm_flags.bits = npc_template.imm_flags.bits + # npc.res_flags.bits = npc_template.res_flags.bits + # npc.vuln_flags.bits = npc_template.vuln_flags.bits + # npc.start_pos = npc_template.start_pos + # npc.default_pos = npc_template.default_pos + # npc.sex = npc_template.sex + # npc.form.bits = npc_template.form.bits + # npc.parts.bits = npc_template.parts.bits npc.size = merc.SIZE_MEDIUM npc.material = "" @@ -316,7 +328,7 @@ def clone_mobile(parent, clone): # * Create an instance of an object. -def create_item(item_template, level, prev_instance_id: int=None): +def create_item(item_template, level, prev_instance_id: int = None): if not item_template: logger.critical("Create_object: No objTemplate.") sys.exit(1) @@ -326,47 +338,54 @@ def create_item(item_template, level, prev_instance_id: int=None): pass # item.instancer() else: item.instance_id = prev_instance_id - #item.instance_setup() - #item.enchanted = False + # item.instance_setup() + # item.enchanted = False if item_template.new_format is False: item.level = max(0, level) if level == -1 or not item_template.new_format: - item.cost = game_utils.number_fuzzy(10) * game_utils.number_fuzzy(level) * game_utils.number_fuzzy(level) + item.cost = ( + game_utils.number_fuzzy(10) + * game_utils.number_fuzzy(level) + * game_utils.number_fuzzy(level) + ) # Mess with object properties. if item.item_type == merc.ITEM_LIGHT: if item.value[2] == 999: item.value[2] = -1 - elif item.item_type == merc.ITEM_FURNITURE \ - or item.item_type == merc.ITEM_TRASH \ - or item.item_type == merc.ITEM_CONTAINER \ - or item.item_type == merc.ITEM_DRINK_CON \ - or item.item_type == merc.ITEM_KEY \ - or item.item_type == merc.ITEM_FOOD \ - or item.item_type == merc.ITEM_BOAT \ - or item.item_type == merc.ITEM_CORPSE_NPC \ - or item.item_type == merc.ITEM_CORPSE_PC \ - or item.item_type == merc.ITEM_FOUNTAIN \ - or item.item_type == merc.ITEM_MAP \ - or item.item_type == merc.ITEM_CLOTHING \ - or item.item_type == merc.ITEM_PORTAL: + elif ( + item.item_type == merc.ITEM_FURNITURE + or item.item_type == merc.ITEM_TRASH + or item.item_type == merc.ITEM_CONTAINER + or item.item_type == merc.ITEM_DRINK_CON + or item.item_type == merc.ITEM_KEY + or item.item_type == merc.ITEM_FOOD + or item.item_type == merc.ITEM_BOAT + or item.item_type == merc.ITEM_CORPSE_NPC + or item.item_type == merc.ITEM_CORPSE_PC + or item.item_type == merc.ITEM_FOUNTAIN + or item.item_type == merc.ITEM_MAP + or item.item_type == merc.ITEM_CLOTHING + or item.item_type == merc.ITEM_PORTAL + ): if not item_template.new_format: item.cost //= 5 - elif item.item_type == merc.ITEM_TREASURE \ - or item.item_type == merc.ITEM_WARP_STONE \ - or item.item_type == merc.ITEM_ROOM_KEY \ - or item.item_type == merc.ITEM_GEM \ - or item.item_type == merc.ITEM_JEWELRY: + elif ( + item.item_type == merc.ITEM_TREASURE + or item.item_type == merc.ITEM_WARP_STONE + or item.item_type == merc.ITEM_ROOM_KEY + or item.item_type == merc.ITEM_GEM + or item.item_type == merc.ITEM_JEWELRY + ): pass elif item.item_type == merc.ITEM_JUKEBOX: item.value = [-1 for i in range(5)] elif item.item_type == merc.ITEM_SCROLL: if level != -1 and not item_template.new_format: item.value[0] = game_utils.number_fuzzy(item.value[0]) - elif item.item_type == merc.ITEM_WAND \ - or item.item_type == merc.ITEM_STAFF: + elif item.item_type == merc.ITEM_WAND or item.item_type == merc.ITEM_STAFF: if level != -1 and not item_template.new_format: item.value[0] = game_utils.number_fuzzy(item.value[0]) item.value[1] = game_utils.number_fuzzy(item.value[1]) @@ -375,26 +394,34 @@ def create_item(item_template, level, prev_instance_id: int=None): item.cost *= 2 elif item.item_type == merc.ITEM_WEAPON: if level != -1 and not item_template.new_format: - item.value[1] = game_utils.number_fuzzy(game_utils.number_fuzzy(1 * level // 4 + 2)) - item.value[2] = game_utils.number_fuzzy(game_utils.number_fuzzy(3 * level // 4 + 6)) + item.value[1] = game_utils.number_fuzzy( + game_utils.number_fuzzy(1 * level // 4 + 2) + ) + item.value[2] = game_utils.number_fuzzy( + game_utils.number_fuzzy(3 * level // 4 + 6) + ) elif item.item_type == merc.ITEM_ARMOR: if level != -1 and not item_template.new_format: item.value[0] = game_utils.number_fuzzy(level // 5 + 3) item.value[1] = game_utils.number_fuzzy(level // 5 + 3) item.value[2] = game_utils.number_fuzzy(level // 5 + 3) - elif item.item_type == merc.ITEM_POTION \ - or item.item_type == merc.ITEM_PILL: + elif item.item_type == merc.ITEM_POTION or item.item_type == merc.ITEM_PILL: if level != -1 and not item_template.new_format: - item.value[0] = game_utils.number_fuzzy(game_utils.number_fuzzy(item.value[0])) + item.value[0] = game_utils.number_fuzzy( + game_utils.number_fuzzy(item.value[0]) + ) elif item.item_type == merc.ITEM_MONEY: if not item_template.new_format: item.value[0] = item.cost else: - logger.error("Bad item_type objTemplate vnum: %s(%s)" % (item_template.vnum, item.item_type)) - - #for paf in item_template.affected: - # if paf.location == merc.APPLY_SPELL_AFFECT: - # item.affect_add(paf) + logger.error( + "Bad item_type objTemplate vnum: %s(%s)" + % (item_template.vnum, item.item_type) + ) + + # for paf in item_template.affected: + # if paf.location == merc.APPLY_SPELL_AFFECT: + # item.affect_add(paf) return item @@ -439,4 +466,3 @@ def create_money(gold, silver): item.cost = 100 * gold + silver item.weight = gold // 5 + silver // 20 return item - diff --git a/src/rom24/pyom.py b/src/rom24/pyom.py index e95c569..2dfa2d1 100644 --- a/src/rom24/pyom.py +++ b/src/rom24/pyom.py @@ -1,4 +1,3 @@ - import os import sys import logging @@ -16,16 +15,17 @@ def pyom(): sys.path.append(os.getcwd()) - logger.info('Logging system initialized.') + logger.info("Logging system initialized.") server = TelnetServer(port=PORT) server.on_connect = init_descriptor server.on_disconnect = close_socket # TODO: Fix file monitoring init_monitoring() - logger.info('Entering Game Loop') + logger.info("Entering Game Loop") game_loop(server) - logger.critical('System halted.') + logger.critical("System halted.") + if __name__ == "__main__": pyom() diff --git a/src/rom24/pyprogs.py b/src/rom24/pyprogs.py index bd5d749..8a5ea74 100644 --- a/src/rom24/pyprogs.py +++ b/src/rom24/pyprogs.py @@ -13,7 +13,7 @@ from rom24 import settings from rom24 import instance -signals = {'say': []} +signals = {"say": []} def emit_signal(signal, actor=None, victim=None, argument=None, audience=None): @@ -27,24 +27,34 @@ def emit_signal(signal, actor=None, victim=None, argument=None, audience=None): victim.absorb(signal, actor, victim, argument) if audience: - [instance.global_instances[a].absorb(signal, actor, victim, argument, audience) for a in audience if a != actor and a != victim] + [ + instance.global_instances[a].absorb( + signal, actor, victim, argument, audience + ) + for a in audience + if a != actor and a != victim + ] for prog in signals[signal]: prog.execute(actor, victim, argument, audience) actor.dampen = False + def register_prog(signal, prog): signals[signal].append(prog) + def register_signal(self, signal, prog): if signal not in self.listeners: self.listeners[signal] = [] self.listeners[signal].append(prog) + def absorb(self, signal, ch, victim, argument, audience): progs = self.listeners.get(signal, []) for prog in progs: prog.execute(ch, victim, argument, audience) + class Progs: def __init__(self, code=None): self.code = code @@ -55,17 +65,19 @@ def __init__(self, code=None): self.actor = None self.victim = None self.argument = "" - self.compare_ops = ['<', '<=', '>', '>=', '=='] - self.equation_ops = ['**', '+', '-', '/', '*', '(', ')'] - self.process_tokens = {'break': None, - 'continue': None, - 'elif': self.process_elif, - 'else': self.process_else, - 'for': self.process_for, - 'if': self.process_if} + self.compare_ops = ["<", "<=", ">", ">=", "=="] + self.equation_ops = ["**", "+", "-", "/", "*", "(", ")"] + self.process_tokens = { + "break": None, + "continue": None, + "elif": self.process_elif, + "else": self.process_else, + "for": self.process_for, + "if": self.process_if, + } def tokenize(self): - self.tokens = tokenize.tokenize(io.BytesIO(self.code.encode('utf-8')).readline) + self.tokens = tokenize.tokenize(io.BytesIO(self.code.encode("utf-8")).readline) def increase_scope(self, local_scope): self.current_scope += 1 @@ -97,7 +109,6 @@ def jump_scope(self, scope, keep=False): if keep: return tokens - def token_after_op(self): next_token = None try: @@ -117,8 +128,8 @@ def next_char(self, line, pos, impose=False): try: next_char = line[pos] except IndexError: - return '' - while line[pos] == ' ' and pos + 1 < line_length: + return "" + while line[pos] == " " and pos + 1 < line_length: pos += 1 next_char = line[pos] if impose: @@ -129,15 +140,15 @@ def compare_conditions(self, values, op): outcome = False if not values[1]: return True if values[0] else False - if op == '<': + if op == "<": outcome = values[0] < values[1] - elif op == '<=': + elif op == "<=": outcome = values[0] <= values[1] - elif op == '>': + elif op == ">": outcome = values[0] > values[1] - elif op == '>=': + elif op == ">=": outcome = values[0] >= values[1] - elif op == '==': + elif op == "==": outcome = values[0] == values[1] del values[:] return outcome @@ -152,15 +163,16 @@ def seek(self, value): if token.type == value: return token return None + def process_for(self, token, local_scope, scope): iterator_tok = copy.deepcopy(next(self.tokens)) - next(self.tokens) # The in - iterable_tok = copy.deepcopy(next(self.tokens)) + next(self.tokens) # The in + iterable_tok = copy.deepcopy(next(self.tokens)) iterable = self.process_variable(iterable_tok, local_scope, scope) self.seek(tokenize.NEWLINE) loop = self.jump_scope(local_scope, True) self.increase_scope(local_scope) - local_scope[scope+1] = {iterator_tok.string: None} + local_scope[scope + 1] = {iterator_tok.string: None} if not iterable and not isinstance(iterable, collections.Iterable): logger.debug("For sent a non-iterable %s", iterable_tok.string) logger.debug(iterable_tok) @@ -174,10 +186,15 @@ def process_for(self, token, local_scope, scope): logger.debug(iterable_tok) logger.debug(iterator_tok) break - local_scope[scope+1][iterator_tok.string] = value + local_scope[scope + 1][iterator_tok.string] = value self.tokens = iter(loop) for token in self.tokens: - self.process_token(token, local_scope, scope + 1, [tokenize.NAME, tokenize.OP, tokenize.NEWLINE]) + self.process_token( + token, + local_scope, + scope + 1, + [tokenize.NAME, tokenize.OP, tokenize.NEWLINE], + ) self.tokens = tokens def process_condition(self, token, local_scope, scope, open_paren=0): @@ -191,19 +208,19 @@ def process_condition(self, token, local_scope, scope, open_paren=0): value = self.process_equation(token, local_scope, scope) values[set_value] = ast.literal_eval(value) elif token.type == tokenize.NAME: - if token.string == 'and': + if token.string == "and": condition = self.compare_conditions(values, op) if not condition: - seek_char = ')' if open_paren > 0 else ':' + seek_char = ")" if open_paren > 0 else ":" self.seek(seek_char) return condition values = [None, None] set_value = 0 op = None - elif token.string == 'or': + elif token.string == "or": condition = self.compare_conditions(values, op) if condition: - seek_char = ')' if open_paren > 0 else ':' + seek_char = ")" if open_paren > 0 else ":" self.seek(seek_char) return condition values = [None, None] @@ -214,14 +231,16 @@ def process_condition(self, token, local_scope, scope, open_paren=0): elif token.type == tokenize.NUMBER: values[set_value] = int(token.string) elif token.type == tokenize.STRING: - values[set_value] = token.string[1: -1] + values[set_value] = token.string[1:-1] elif token.type == tokenize.OP: - if token.string == '(': - condition = self.process_condition(token, local_scope, scope, open_paren + 1) + if token.string == "(": + condition = self.process_condition( + token, local_scope, scope, open_paren + 1 + ) elif token.string in self.compare_ops: op = token.string set_value = 1 - elif token.string in [')', ':']: + elif token.string in [")", ":"]: return self.compare_conditions(values, op) def process_if(self, token, local_scope, scope): @@ -241,15 +260,15 @@ def process_elif(self, token, local_scope, scope): self.jump_scope(scope) def process_else(self, token, local_scope, scope): - self.seek(':') + self.seek(":") if not self.exec_else[scope]: self.jump_scope(scope) else: self.increase_scope(local_scope) - def process_equation(self, token, local_scope, scope, open_paren=0, equation=''): + def process_equation(self, token, local_scope, scope, open_paren=0, equation=""): expected = [tokenize.OP, tokenize.NUMBER, tokenize.NAME] - value = '' + value = "" if token.type in expected: if token.type == tokenize.NAME: value = self.process_variable(token, local_scope, scope) @@ -257,33 +276,43 @@ def process_equation(self, token, local_scope, scope, open_paren=0, equation='') value = int(token.string) elif token.type == tokenize.OP: value = token.string - if value == '(': + if value == "(": open_paren += 1 - if value == ')': + if value == ")": open_paren -= 1 next_tok = next(self.tokens) - return self.process_equation(next_tok, local_scope, scope, open_paren, '%s%s' % (equation, value)) - equation = '%s%s' % (equation, value) + return self.process_equation( + next_tok, local_scope, scope, open_paren, "%s%s" % (equation, value) + ) + equation = "%s%s" % (equation, value) look_forward = self.next_char(token.line, token.end[1]) if look_forward in self.equation_ops: - if(look_forward == ')' and open_paren-1 > 0): + if look_forward == ")" and open_paren - 1 > 0: pass else: next_tok = next(self.tokens) - equation = self.process_equation(next_tok, local_scope, scope, open_paren, equation) + equation = self.process_equation( + next_tok, local_scope, scope, open_paren, equation + ) return equation def process_variable(self, token, local_scope, scope): l, pos = token.end next_pos, next_char = self.next_char(token.line, pos, True) - if next_char == '.': + if next_char == ".": # Access variable scope - token = copy.deepcopy(token) #Copy the token because when you generate new ones it changes the ref. + token = copy.deepcopy( + token + ) # Copy the token because when you generate new ones it changes the ref. target = self.get_in_scope(token.string, local_scope, scope) new_token = self.token_after_op() - local_scope[scope + 1] = {attr: value for attr, value in inspect.getmembers(target) if not attr.startswith('_')} + local_scope[scope + 1] = { + attr: value + for attr, value in inspect.getmembers(target) + if not attr.startswith("_") + } var = self.get_in_scope(new_token.string, local_scope, scope + 1) if not var: @@ -300,7 +329,7 @@ def process_variable(self, token, local_scope, scope): del local_scope[scope + 1] return value - elif next_char == '(': + elif next_char == "(": # Access callable variable args = [] value = None @@ -314,21 +343,24 @@ def process_variable(self, token, local_scope, scope): elif itoken.type == tokenize.STRING: value = itoken.string[1:-1] elif itoken.type == tokenize.OP: - if itoken.string == ',': + if itoken.string == ",": args.append(copy.deepcopy(value)) value = None - if itoken.string == ')': + if itoken.string == ")": args.append(copy.deepcopy(value)) return target(*args) - elif next_char == '=' and self.next_char(token.line, next_pos) != '=': + elif next_char == "=" and self.next_char(token.line, next_pos) != "=": # Assignment token = copy.deepcopy(token) - next(self.tokens) #skip the op + next(self.tokens) # skip the op value = None for itoken in self.tokens: look_forward = self.next_char(itoken.line, itoken.end[1]) - if look_forward in self.equation_ops or itoken.string in self.equation_ops: + if ( + look_forward in self.equation_ops + or itoken.string in self.equation_ops + ): value = self.process_equation(itoken, local_scope, scope) value = ast.literal_eval(value) elif itoken.type == tokenize.NAME: @@ -384,7 +416,7 @@ def execute(self, actor, victim, argument, audience): logger.debug("Executing script.") exec_start = time.time() self.tokenize() - local_scope = {0: {'actor': actor, 'victim': victim, 'argument': argument}} + local_scope = {0: {"actor": actor, "victim": victim, "argument": argument}} self.current_scope = 0 exec_types = [tokenize.NAME, tokenize.OP, tokenize.NEWLINE] try: @@ -392,16 +424,16 @@ def execute(self, actor, victim, argument, audience): now = time.time() # logger.debug('Time difference is: %0.3fms', (now - exec_start) * 1000.0) if (now - exec_start) * 1000.0 > 200.0: - logger.error('Maximum PyProg execution time exceeded') + logger.error("Maximum PyProg execution time exceeded") raise TimeoutError self.process_token(token, local_scope, 0, exec_types) except: actor.send("Something went wrong.") exec_stop = time.time() - logger.debug("Script took % 0.3fms", (exec_stop-exec_start) * 1000.0) + logger.debug("Script took % 0.3fms", (exec_stop - exec_start) * 1000.0) -# TODO: Find out more about how this works - when I say anything, it also progged the scripts below, but +# TODO: Find out more about how this works - when I say anything, it also progged the scripts below, but # it doesn't look like it's as simple as triggering it on anything, it looks like it has to trigger # on valid commands. Commenting it out for now. @@ -413,7 +445,7 @@ def execute(self, actor, victim, argument, audience): # actor.do_say("I'm a beast!") # else: # actor.do_say("I'm a wimp!") - + # if actor.guild.name == 'mage': # actor.do_say("I'm a mage tho, so don't mess with me.") # elif actor.guild.name == 'thief': diff --git a/src/rom24/save.py b/src/rom24/save.py index ffe5356..23e78a4 100644 --- a/src/rom24/save.py +++ b/src/rom24/save.py @@ -18,14 +18,15 @@ def area_pickler(): pass + def legacy_load_char_obj(d, name): - #ch = handler_ch.CHAR_DATA() - #ch.pcdata = handler_ch.PC_DATA() + # ch = handler_ch.CHAR_DATA() + # ch.pcdata = handler_ch.PC_DATA() ch = handler_pc.Pc(name) found = False - pfile = os.path.join(settings.LEGACY_PLAYER_DIR, name + '.json') + pfile = os.path.join(settings.LEGACY_PLAYER_DIR, name + ".json") if os.path.isfile(pfile): - chdict = json.load(open(pfile, 'r')) + chdict = json.load(open(pfile, "r")) ch = fread_char(chdict, ch) found = True @@ -42,54 +43,61 @@ def legacy_save_char_obj(ch): if ch.desc and ch.desc.original: ch = ch.desc.original - pfile = os.path.join(settings.LEGACY_PLAYER_DIR, ch.name + '.json') + pfile = os.path.join(settings.LEGACY_PLAYER_DIR, ch.name + ".json") os.makedirs(settings.PLAYER_DIR, 0o755, True) fwrite = fwrite_char(ch) if ch.inventory: - fwrite['inventory'] = [fwrite_obj(ch, o) for o in ch.inventory] + fwrite["inventory"] = [fwrite_obj(ch, o) for o in ch.inventory] to_write = json.dumps(fwrite, indent=4, sort_keys=True) - with open(pfile, 'w') as pf: + with open(pfile, "w") as pf: pf.write(to_write) def fwrite_obj(ch, obj, contained_by=None): odict = OrderedDict() obj = instance.items[obj] - odict['Vnum'] = obj.vnum - odict['Enchanted'] = obj.enchanted - odict['Name'] = obj.name - odict['ShD'] = obj.short_descr - odict['Desc'] = obj.description - odict['ExtF'] = obj.extra_flags - odict['WeaF'] = obj.wear_flags - odict['Ityp'] = obj.item_type - odict['Wt'] = obj.weight - odict['Cond'] = obj.condition - - odict['Wear'] = obj.wear_loc - odict['Lev'] = obj.level - odict['timer'] = obj.timer - odict['cost'] = obj.cost - odict['Val'] = obj.value - - odict['affected'] = [a for a in obj.affected if a.type >= 0] - odict['ExDe'] = {ed.keyword: ed.description for ed in obj.extra_descr} + odict["Vnum"] = obj.vnum + odict["Enchanted"] = obj.enchanted + odict["Name"] = obj.name + odict["ShD"] = obj.short_descr + odict["Desc"] = obj.description + odict["ExtF"] = obj.extra_flags + odict["WeaF"] = obj.wear_flags + odict["Ityp"] = obj.item_type + odict["Wt"] = obj.weight + odict["Cond"] = obj.condition + + odict["Wear"] = obj.wear_loc + odict["Lev"] = obj.level + odict["timer"] = obj.timer + odict["cost"] = obj.cost + odict["Val"] = obj.value + + odict["affected"] = [a for a in obj.affected if a.type >= 0] + odict["ExDe"] = {ed.keyword: ed.description for ed in obj.extra_descr} if contained_by: - odict['In'] = contained_by.instance_id + odict["In"] = contained_by.instance_id if obj.contents: - odict['inventory'] = [fwrite_obj(ch, o, obj) for o in obj.inventory] + odict["inventory"] = [fwrite_obj(ch, o, obj) for o in obj.inventory] return odict # unused -def recursive_item_jsonify(item_to_json, inv_dir: str=None, equip_dir: str=None, - is_equipment: bool=False, is_in_inventory: bool=False): +def recursive_item_jsonify( + item_to_json, + inv_dir: str = None, + equip_dir: str = None, + is_equipment: bool = False, + is_in_inventory: bool = False, +): if is_equipment: - to_equipped = json.dumps(item_to_json, default=instance.to_json, indent=4, sort_keys=True) - equip_write = os.path.join(equip_dir, str(item_to_json.instance_id) + '.json') - with open(equip_write, 'w') as eq: + to_equipped = json.dumps( + item_to_json, default=instance.to_json, indent=4, sort_keys=True + ) + equip_write = os.path.join(equip_dir, str(item_to_json.instance_id) + ".json") + with open(equip_write, "w") as eq: eq.write(to_equipped) if item_to_json.inventory: for item_id in item_to_json.inventory[:]: @@ -98,9 +106,11 @@ def recursive_item_jsonify(item_to_json, inv_dir: str=None, equip_dir: str=None, else: return if is_in_inventory: - to_inventory = json.dumps(item_to_json, default=instance.to_json, indent=4, sort_keys=True) - inventory_write = os.path.join(inv_dir, str(item_to_json.instance_id) + '.json') - with open(inventory_write, 'w') as inv: + to_inventory = json.dumps( + item_to_json, default=instance.to_json, indent=4, sort_keys=True + ) + inventory_write = os.path.join(inv_dir, str(item_to_json.instance_id) + ".json") + with open(inventory_write, "w") as inv: inv.write(to_inventory) if item_to_json.inventory: for item_id in item_to_json.inventory[:]: @@ -109,14 +119,15 @@ def recursive_item_jsonify(item_to_json, inv_dir: str=None, equip_dir: str=None, else: return -#unused + +# unused def fwrite_char(ch): chdict = OrderedDict() - chdict['instance_id'] = ch.instance_id - chdict['name'] = ch.name - chdict['id'] = ch.id - chdict['logo'] = time.time() - chdict['vers'] = 5 + chdict["instance_id"] = ch.instance_id + chdict["name"] = ch.name + chdict["id"] = ch.id + chdict["logo"] = time.time() + chdict["vers"] = 5 chdict["ShD"] = ch.short_descr chdict["LnD"] = ch.long_descr chdict["Desc"] = ch.description @@ -171,56 +182,59 @@ def fwrite_char(ch): chdict["LLev"] = ch.last_level chdict["HMVP"] = [ch.perm_hit, ch.perm_mana, ch.perm_move] chdict["Cnd"] = ch.condition - chdict['alias'] = ch.alias - chdict['skills'] = ch.learned - chdict['groups'] = ch.group_known - chdict['affected'] = [a for a in ch.affected if a.type >= 0] - chdict['equipped'] = ch.equipped - chdict['inventory'] = ch.inventory + chdict["alias"] = ch.alias + chdict["skills"] = ch.learned + chdict["groups"] = ch.group_known + chdict["affected"] = [a for a in ch.affected if a.type >= 0] + chdict["equipped"] = ch.equipped + chdict["inventory"] = ch.inventory return chdict -#unused + +# unused def get_if_diff(s1, s2): return s1 if s1 != s2 else s2 -#unused + +# unused def fwrite_item(ch, item, contained_by=None, equip_loc=None): - #TODO make this eq-ified + # TODO make this eq-ified odict = OrderedDict() - odict['instance_id'] = item.instance_id - odict['Vnum'] = item.vnum - odict['Enchanted'] = item.enchanted - odict['Name'] = item.name - odict['ShD'] = item.short_descr - odict['Desc'] = item.description - odict['EqpT'] = item.equips_to - odict['IatR'] = item.item_attributes - odict['IrsT'] = item.item_restrictions - odict['WeaT'] = item.weapon_attributes - odict['WeaF'] = item.equips_to - odict['Ityp'] = item.item_type - odict['Wt'] = item.weight - odict['Cond'] = item.condition - odict['Lev'] = item.level - odict['timer'] = item.timer - odict['cost'] = item.cost - odict['Val'] = item.value - - odict['affected'] = [a for a in item.affected if a.type >= 0] - odict['ExDe'] = {ed.keyword: ed.description for ed in item.extra_descr} + odict["instance_id"] = item.instance_id + odict["Vnum"] = item.vnum + odict["Enchanted"] = item.enchanted + odict["Name"] = item.name + odict["ShD"] = item.short_descr + odict["Desc"] = item.description + odict["EqpT"] = item.equips_to + odict["IatR"] = item.item_attributes + odict["IrsT"] = item.item_restrictions + odict["WeaT"] = item.weapon_attributes + odict["WeaF"] = item.equips_to + odict["Ityp"] = item.item_type + odict["Wt"] = item.weight + odict["Cond"] = item.condition + odict["Lev"] = item.level + odict["timer"] = item.timer + odict["cost"] = item.cost + odict["Val"] = item.value + + odict["affected"] = [a for a in item.affected if a.type >= 0] + odict["ExDe"] = {ed.keyword: ed.description for ed in item.extra_descr} if equip_loc: - odict['to_loc'] = equip_loc + odict["to_loc"] = equip_loc if contained_by: - odict['In'] = contained_by.instance_id + odict["In"] = contained_by.instance_id if item.inventory: - odict['inventory'] = [fwrite_item(ch, o, item) for o in item.inventory] + odict["inventory"] = [fwrite_item(ch, o, item) for o in item.inventory] return odict -#unused + +# unused def fread_char(chdict, ch): - #instance_id is already set so is omitted - ch.name = chdict['name'] - ch.id = chdict['id'] + # instance_id is already set so is omitted + ch.name = chdict["name"] + ch.id = chdict["id"] ch.short_descr = chdict["ShD"] ch.long_descr = chdict["LnD"] ch.description = chdict["Desc"] @@ -272,17 +286,18 @@ def fread_char(chdict, ch): ch.last_level = chdict["LLev"] ch.perm_hit, ch.perm_mana, ch.perm_move = chdict["HMVP"] ch.condition = chdict["Cnd"] - ch.alias = chdict['alias'] - ch.learned = chdict['skills'] - ch.group_known = chdict['groups'] - ch.affected = chdict['affected'] - if 'equipped' in chdict: - fread_items(ch, chdict['equipped']) - if 'inventory' in chdict: - fread_items(ch, chdict['inventory']) + ch.alias = chdict["alias"] + ch.learned = chdict["skills"] + ch.group_known = chdict["groups"] + ch.affected = chdict["affected"] + if "equipped" in chdict: + fread_items(ch, chdict["equipped"]) + if "inventory" in chdict: + fread_items(ch, chdict["inventory"]) return ch -#unused + +# unused def fread_items(contents, objects, contained_by=None): for odict in objects: item = fread_item(contents, odict) @@ -290,34 +305,37 @@ def fread_items(contents, objects, contained_by=None): contents.put(item) else: contained_by.put(item) - if 'equipped_to' in odict: + if "equipped_to" in odict: if contents.is_living: - contents.equip(item, False, False, False, odict['to_loc']) - if 'inventory' in odict: - fread_items(contents, odict['inventory'], item) + contents.equip(item, False, False, False, odict["to_loc"]) + if "inventory" in odict: + fread_items(contents, odict["inventory"], item) + -#unused +# unused def fread_item(contents, odict): - item = object_creator.create_item(item_templates[odict['Vnum']], odict['Lev'], odict['instance_id']) - item.enchanted = odict['Enchanted'] - item.name = odict['Name'] - item.short_descr = odict['ShD'] - item.description = odict['Desc'] - item.equips_to = odict['EqpT'] - item.item_attributes = odict['IatR'] - item.item_restrictions = odict['IrsT'] - item.weapon_attributes = odict['WeaT'] - item.item_type = odict['Ityp'] - item.weight = odict['Wt'] - item.condition = odict['Cond'] - item.level = odict['Lev'] - item.timer = odict['timer'] - item.cost = odict['cost'] - item.value = odict['Val'] - - item.affected = odict['affected'] + item = object_creator.create_item( + item_templates[odict["Vnum"]], odict["Lev"], odict["instance_id"] + ) + item.enchanted = odict["Enchanted"] + item.name = odict["Name"] + item.short_descr = odict["ShD"] + item.description = odict["Desc"] + item.equips_to = odict["EqpT"] + item.item_attributes = odict["IatR"] + item.item_restrictions = odict["IrsT"] + item.weapon_attributes = odict["WeaT"] + item.item_type = odict["Ityp"] + item.weight = odict["Wt"] + item.condition = odict["Cond"] + item.level = odict["Lev"] + item.timer = odict["timer"] + item.cost = odict["cost"] + item.value = odict["Val"] + + item.affected = odict["affected"] extra_descr = [] - for k, v in odict['ExDe'].items(): + for k, v in odict["ExDe"].items(): newed = world_classes.ExtraDescrData() newed.keyword = k newed.description = v diff --git a/src/rom24/settings.py b/src/rom24/settings.py index 8d924a1..59d82e7 100644 --- a/src/rom24/settings.py +++ b/src/rom24/settings.py @@ -5,7 +5,7 @@ logger = logging.getLogger(__name__) -#Game settings +# Game settings PORT = 1337 WIZLOCK = False NEWLOCK = False @@ -13,41 +13,41 @@ LOGALL = False MAX_ITERATIONS = 300 -#Files -AREA_LIST = 'area.lst' -BUG_FILE = 'bug.txt' -TYPO_FILE = 'typo.txt' -SOCIAL_LIST = 'social.lst' -HELP_FILE = 'help_files' +# Files +AREA_LIST = "area.lst" +BUG_FILE = "bug.txt" +TYPO_FILE = "typo.txt" +SOCIAL_LIST = "social.lst" +HELP_FILE = "help_files" -#extn -DATA_EXTN = '.json' -PKL_EXTN = '.pickle' +# extn +DATA_EXTN = ".json" +PKL_EXTN = ".pickle" -#Folders +# Folders INSTALLED_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) -SOURCE_DIR = os.path.join(INSTALLED_DIR, 'src') +SOURCE_DIR = os.path.join(INSTALLED_DIR, "src") logger.info("SOURCE_DIR: %s", SOURCE_DIR) -LEGACY_AREA_DIR = os.path.join(SOURCE_DIR, 'area') +LEGACY_AREA_DIR = os.path.join(SOURCE_DIR, "area") logger.info("LEGACY_AREA_DIR: %s", LEGACY_AREA_DIR) -LEGACY_PLAYER_DIR = os.path.join('../..', 'player') +LEGACY_PLAYER_DIR = os.path.join("../..", "player") logger.info("LEGACY_PLAYER_DIR: %s", LEGACY_PLAYER_DIR) -SOCIAL_DIR = os.path.join(LEGACY_AREA_DIR, 'socials') +SOCIAL_DIR = os.path.join(LEGACY_AREA_DIR, "socials") logger.info("SOCIAL_DIR: %s", SOCIAL_DIR) -HELP_DIR = os.path.join(LEGACY_AREA_DIR, 'help_files') +HELP_DIR = os.path.join(LEGACY_AREA_DIR, "help_files") logger.info("HELP_DIR: %s", HELP_DIR) -#New structure +# New structure USER_DIR = os.path.expanduser("~") -BASE_DIR = os.path.join(USER_DIR, 'rom24') -DATA_DIR = os.path.join(SOURCE_DIR, 'data') -WORLD_DIR = os.path.join(DATA_DIR, 'world') -PLAYER_DIR = os.path.join(DATA_DIR, 'players') -SYSTEM_DIR = os.path.join(DATA_DIR, 'system') -DOC_DIR = os.path.join(DATA_DIR, 'docs') +BASE_DIR = os.path.join(USER_DIR, "rom24") +DATA_DIR = os.path.join(SOURCE_DIR, "data") +WORLD_DIR = os.path.join(DATA_DIR, "world") +PLAYER_DIR = os.path.join(DATA_DIR, "players") +SYSTEM_DIR = os.path.join(DATA_DIR, "system") +DOC_DIR = os.path.join(DATA_DIR, "docs") AREA_DIR = LEGACY_AREA_DIR AREA_LIST_FILE = os.path.join(AREA_DIR, AREA_LIST) -INSTANCE_DIR = os.path.join(WORLD_DIR, 'instances') +INSTANCE_DIR = os.path.join(WORLD_DIR, "instances") INSTANCE_NUM_FILE = os.path.join(INSTANCE_DIR, "instance_tracker.txt") for mydir in ( BASE_DIR, @@ -62,15 +62,12 @@ if not os.path.exists(mydir): os.makedirs(mydir) -for rom24_file in ( - INSTANCE_NUM_FILE, - AREA_LIST_FILE -): +for rom24_file in (INSTANCE_NUM_FILE, AREA_LIST_FILE): if not os.path.exists(rom24_file): rom24_file_path = Path(rom24_file) rom24_file_path.touch(exist_ok=True) -#Features +# Features SHOW_DAMAGE_NUMBERS = True DETAILED_INVALID_COMMANDS = True -SAVE_LIMITER = 300 # Only save files every N seconds, unless forced. \ No newline at end of file +SAVE_LIMITER = 300 # Only save files every N seconds, unless forced. diff --git a/src/rom24/shell.py b/src/rom24/shell.py index f8cb199..9f8965b 100644 --- a/src/rom24/shell.py +++ b/src/rom24/shell.py @@ -1,4 +1,4 @@ -#Thanks to this post http://stackoverflow.com/questions/5597836/how-can-i-embedcreate-an-interactive-python-shell-in-my-python-program +# Thanks to this post http://stackoverflow.com/questions/5597836/how-can-i-embedcreate-an-interactive-python-shell-in-my-python-program # I'm setting up a small environment for testing. import code @@ -14,6 +14,7 @@ def send(txt): print(txt) + vars = globals().copy() vars.update(locals()) shell = code.InteractiveConsole(vars) diff --git a/src/rom24/shop_utils.py b/src/rom24/shop_utils.py index 60d5b40..46619ea 100644 --- a/src/rom24/shop_utils.py +++ b/src/rom24/shop_utils.py @@ -1,4 +1,4 @@ -__author__ = 'syn' +__author__ = "syn" import logging logger = logging.getLogger(__name__) @@ -15,7 +15,12 @@ def get_obj_keeper(ch, keeper, argument): count = 0 for obj_id in keeper.inventory[:]: obj = instance.items[obj_id] - if not obj.equipped_to and keeper.can_see_item(obj) and ch.can_see_item(obj) and game_utils.is_name(arg, obj.name): + if ( + not obj.equipped_to + and keeper.can_see_item(obj) + and ch.can_see_item(obj) + and game_utils.is_name(arg, obj.name) + ): count += 1 if count == number: return obj @@ -30,8 +35,7 @@ def obj_to_keeper(item, ch): spot = -1 for i, t_item_id in enumerate(ch.inventory): t_item = instance.items[t_item_id] - if item.vnum == t_item.vnum \ - and item.short_descr == t_item.short_descr: + if item.vnum == t_item.vnum and item.short_descr == t_item.short_descr: # if this is an unlimited item, destroy the new one */ if t_item.inventory: item.extract() @@ -51,6 +55,7 @@ def obj_to_keeper(item, ch): ch.carry_number += item.get_number() ch.carry_weight += item.get_weight() + def get_cost(keeper, item, fBuy): if not item or not instance.npc_templates[keeper.vnum].pShop: return 0 @@ -67,7 +72,10 @@ def get_cost(keeper, item, fBuy): if not item.sell_extract: for item2_id in keeper.inventory[:]: item2 = instance.items[item2_id] - if item.vnum == item2_id.vnum and item.short_descr == item2_id.short_descr: + if ( + item.vnum == item2_id.vnum + and item.short_descr == item2_id.short_descr + ): if item.inventory: cost /= 2 else: @@ -79,7 +87,8 @@ def get_cost(keeper, item, fBuy): cost = cost * item.value[2] / item.value[1] return cost -#* Shopping commands. + +# * Shopping commands. def find_keeper(ch): pShop = None for keeper_id in ch.in_room.people[:]: @@ -91,26 +100,24 @@ def find_keeper(ch): if not pShop: ch.send("You can't do that here.\n") return None - #* Undesirables. - #if not IS_NPC(ch) and IS_SET(ch.act, PLR_KILLER): + # * Undesirables. + # if not IS_NPC(ch) and IS_SET(ch.act, PLR_KILLER): # keeper.do_say("Killers are not welcome!") # keeper.do_yell("%s the KILLER is over here!\n" % ch.name) # return None - #if not IS_NPC(ch) and IS_SET(ch.act, PLR_THIEF): + # if not IS_NPC(ch) and IS_SET(ch.act, PLR_THIEF): # keeper.do_say("Thieves are not welcome!") # keeper.do_yell("%s the THIEF is over here!\n" % ch.name) # return None - #* Shop hours. + # * Shop hours. if handler_game.time_info.hour < pShop.open_hour: keeper.do_say("Sorry, I am closed. Come back later.") return None if handler_game.time_info.hour > pShop.close_hour: keeper.do_say("Sorry, I am closed. Come back tomorrow.") return None - #* Invisible or hidden people. + # * Invisible or hidden people. if not keeper.can_see(ch): keeper.do_say("I don't trade with folks I can't see.") return None return keeper - - diff --git a/src/rom24/skills.py b/src/rom24/skills.py index 56122c0..e7b5e69 100644 --- a/src/rom24/skills.py +++ b/src/rom24/skills.py @@ -1,4 +1,3 @@ - import random import logging @@ -11,31 +10,33 @@ # recursively adds a group given its number -- uses group_add */ -def gn_add( ch, gn): +def gn_add(ch, gn): ch.group_known[gn.name] = True for i in gn.spells: if not i: break - group_add(ch,i,False) + group_add(ch, i, False) + # recusively removes a group given its number -- uses group_remove */ -def gn_remove( ch, gn): +def gn_remove(ch, gn): if gn.name in ch.group_known: del ch.group_known[gn.name] for i in gn.spells: if not i: return - group_remove(ch,i) + group_remove(ch, i) + # use for processing a skill or group for addition */ -def group_add( ch, name, deduct): - if ch.is_npc(): # NPCs do not have skills */ +def group_add(ch, name, deduct): + if ch.is_npc(): # NPCs do not have skills */ return - + if name in const.skill_table: sn = const.skill_table[name] - if sn.name not in ch.learned: # i.e. not known */ + if sn.name not in ch.learned: # i.e. not known */ ch.learned[sn.name] = 1 if deduct: ch.points += sn.rating[ch.guild.name] @@ -49,14 +50,15 @@ def group_add( ch, name, deduct): ch.group_known[gn.name] = True if deduct: ch.points += gn.rating[ch.guild.name] - - gn_add(ch,gn) # make sure all skills in the group are known */ + + gn_add(ch, gn) # make sure all skills in the group are known */ # used for processing a skill or group for deletion -- no points back! */ + def group_remove(ch, name): - + if name in const.skill_table: sn = const.skill_table[name] if sn.name in ch.learned: @@ -66,12 +68,10 @@ def group_remove(ch, name): # now check groups */ if name in const.group_table: gn = const.group_table[name] - + if gn.name in ch.group_known: del ch.group_known[gn.name] - gn_remove(ch,gn) # be sure to call gn_add on all remaining groups */ - - + gn_remove(ch, gn) # be sure to call gn_add on all remaining groups */ # shows skills, groups and costs (only if not bought) */ @@ -79,11 +79,21 @@ def list_group_costs(ch): if ch.is_npc(): return col = 0 - ch.send("%-18s %-5s %-18s %-5s %-18s %-5s\n" % ("group","cp","group","cp","group","cp")) + ch.send( + "%-18s %-5s %-18s %-5s %-18s %-5s\n" + % ("group", "cp", "group", "cp", "group", "cp") + ) for gn, group in const.group_table.items(): - if gn not in ch.gen_data.group_chosen and gn not in ch.group_known and group.rating[ch.guild.name] > 0: - ch.send("%-18s %-5d " % (const.group_table[gn].name, group.rating[ch.guild.name])) + if ( + gn not in ch.gen_data.group_chosen + and gn not in ch.group_known + and group.rating[ch.guild.name] > 0 + ): + ch.send( + "%-18s %-5d " + % (const.group_table[gn].name, group.rating[ch.guild.name]) + ) col += 1 if col % 3 == 0: ch.send("\n") @@ -91,60 +101,73 @@ def list_group_costs(ch): ch.send("\n") ch.send("\n") col = 0 - - ch.send("%-18s %-5s %-18s %-5s %-18s %-5s\n" % ("skill","cp","skill","cp","skill","cp")) - + + ch.send( + "%-18s %-5s %-18s %-5s %-18s %-5s\n" + % ("skill", "cp", "skill", "cp", "skill", "cp") + ) + for sn, skill in const.skill_table.items(): - if sn not in ch.gen_data.skill_chosen \ - and sn not in ch.learned \ - and skill.spell_fun == magic.spell_null \ - and skill.rating[ch.guild.name] > 0: + if ( + sn not in ch.gen_data.skill_chosen + and sn not in ch.learned + and skill.spell_fun == magic.spell_null + and skill.rating[ch.guild.name] > 0 + ): ch.send("%-18s %-5d " % (skill.name, skill.rating[ch.guild.name])) col += 1 if col % 3 == 0: ch.send("\n") - if col % 3 != 0: - ch.send( "\n" ) + if col % 3 != 0: + ch.send("\n") ch.send("\n") ch.send("Creation points: %d\n" % ch.points) ch.send("Experience per level: %d\n" % ch.exp_per_level(ch.gen_data.points_chosen)) return + def list_group_chosen(ch): if ch.is_npc(): return col = 0 - ch.send("%-18s %-5s %-18s %-5s %-18s %-5s" % ("group","cp","group","cp","group","cp\n")) - + ch.send( + "%-18s %-5s %-18s %-5s %-18s %-5s" + % ("group", "cp", "group", "cp", "group", "cp\n") + ) + for gn, group in const.group_table.items(): if gn in ch.gen_data.group_chosen and group.rating[ch.guild.name] > 0: - ch.send("%-18s %-5d " % (group.name, group.rating[ch.guild.name]) ) + ch.send("%-18s %-5d " % (group.name, group.rating[ch.guild.name])) col += 1 if col % 3 == 0: ch.send("\n") if col % 3 != 0: - ch.send( "\n" ) + ch.send("\n") ch.send("\n") - + col = 0 - - ch.send("%-18s %-5s %-18s %-5s %-18s %-5s" % ("skill","cp","skill","cp","skill","cp\n")) + + ch.send( + "%-18s %-5s %-18s %-5s %-18s %-5s" + % ("skill", "cp", "skill", "cp", "skill", "cp\n") + ) for sn, skill in const.skill_table.items(): if sn in ch.gen_data.skill_chosen and skill.rating[ch.guild.name] > 0: - ch.send("%-18s %-5d " % ( skill.name, skill.rating[ch.guild.name]) ) + ch.send("%-18s %-5d " % (skill.name, skill.rating[ch.guild.name])) col += 1 if col % 3 == 0: ch.send("\n") if col % 3 != 0: - ch.send( "\n" ) + ch.send("\n") ch.send("\n") - + ch.send("Creation points: %d\n" % ch.gen_data.points_chosen) ch.send("Experience per level: %d\n" % ch.exp_per_level(ch.gen_data.points_chosen)) return + # this procedure handles the input parsing for the skill generator */ def parse_gen_groups(ch, argument): if not argument.strip(): @@ -169,7 +192,7 @@ def parse_gen_groups(ch, argument): if gn.name in ch.gen_data.group_chosen or gn.name in ch.group_known: ch.send("You already know that group!\n") return True - + if gn.rating[ch.guild.name] < 1: ch.send("That group is not available.\n") return True @@ -178,11 +201,11 @@ def parse_gen_groups(ch, argument): if ch.gen_data.points_chosen + gn.rating[ch.guild.name] > 300: ch.send("You cannot take more than 300 creation points.\n") return True - + ch.send("%s group added\n" % gn.name) ch.gen_data.group_chosen[gn.name] = True ch.gen_data.points_chosen += gn.rating[ch.guild.name] - gn_add(ch,gn) + gn_add(ch, gn) ch.points += gn.rating[ch.guild.name] return True @@ -199,7 +222,7 @@ def parse_gen_groups(ch, argument): if ch.gen_data.points_chosen + sn.rating[ch.guild.name] > 300: ch.send("You cannot take more than 300 creation points.\n") return True - + ch.send("%s skill added\n" % sn.name) ch.gen_data.skill_chosen[sn.name] = True ch.gen_data.points_chosen += sn.rating[ch.guild.name] @@ -214,19 +237,19 @@ def parse_gen_groups(ch, argument): if not argument: ch.send("You must provide a skill to drop.\n") return True - + argument = argument.lower() if argument in const.group_table and argument in ch.gen_data.group_chosen: gn = const.group_table[argument] ch.send("Group dropped.\n") del ch.gen_data.group_chosen[gn.name] ch.gen_data.points_chosen -= gn.rating[ch.guild.name] - gn_remove(ch,gn) - for k,v in ch.gen_data.group_chosen: - gn_add(ch,const.group_table[k]) + gn_remove(ch, gn) + for k, v in ch.gen_data.group_chosen: + gn_add(ch, const.group_table[k]) ch.points -= gn.rating[ch.guild.name] return True - + if argument in const.skill_table and argument in ch.gen_data.skill_chosen: sn = const.skill_table[argument] ch.send("Skill dropped.\n") @@ -257,42 +280,48 @@ def parse_gen_groups(ch, argument): return False + # shows all groups, or the sub-members of a group */ # checks for skill improvement */ -def check_improve( ch, sn, success, multiplier ): +def check_improve(ch, sn, success, multiplier): from rom24 import const from rom24 import update + if ch.is_npc(): return if type(sn) == str: sn = const.skill_table[sn] - if ch.level < sn.skill_level[ch.guild.name] \ - or sn.rating[ch.guild.name] == 0 \ - or sn.name not in ch.learned \ - or ch.learned[sn.name] == 100: - return # skill is not known */ + if ( + ch.level < sn.skill_level[ch.guild.name] + or sn.rating[ch.guild.name] == 0 + or sn.name not in ch.learned + or ch.learned[sn.name] == 100 + ): + return # skill is not known */ # check to see if the character has a chance to learn */ chance = 10 * const.int_app[ch.stat(STAT_INT)].learn - chance /= (multiplier * sn.rating[ch.guild.name] * 4) + chance /= multiplier * sn.rating[ch.guild.name] * 4 chance += ch.level - if random.randint(1,1000) > chance: + if random.randint(1, 1000) > chance: return - # now that the character has a CHANCE to learn, see if they really have */ + # now that the character has a CHANCE to learn, see if they really have */ if success: chance = max(5, min(100 - ch.learned[sn.name], 95)) - if random.randint(1,99) < chance: + if random.randint(1, 99) < chance: ch.send("You have become better at %s!\n" % sn.name) ch.learned[sn.name] += 1 - update.gain_exp(ch,2 * sn.rating[ch.guild.name]) + update.gain_exp(ch, 2 * sn.rating[ch.guild.name]) else: - chance = max(5, min(ch.learned[sn.name]/2,30)) - if random.randint(1,99) < chance: - ch.send("You learn from your mistakes, and your %s skill improves.\n" % sn.name) - ch.learned[sn.name] += random.randint(1,3) - ch.learned[sn.name] = min(ch.learned[sn.name],100) - update.gain_exp(ch,2 * sn.rating[ch.guild.name]) + chance = max(5, min(ch.learned[sn.name] / 2, 30)) + if random.randint(1, 99) < chance: + ch.send( + "You learn from your mistakes, and your %s skill improves.\n" % sn.name + ) + ch.learned[sn.name] += random.randint(1, 3) + ch.learned[sn.name] = min(ch.learned[sn.name], 100) + update.gain_exp(ch, 2 * sn.rating[ch.guild.name]) diff --git a/src/rom24/special.py b/src/rom24/special.py index f41ae40..63d9d24 100644 --- a/src/rom24/special.py +++ b/src/rom24/special.py @@ -1,4 +1,3 @@ - import random import logging @@ -13,8 +12,13 @@ def spec_troll_member(ch): - if not ch.is_awake() or state_checks.IS_AFFECTED(ch, merc.AFF_CALM) or ch.in_room is None \ - or state_checks.IS_AFFECTED(ch, merc.AFF_CHARM) or ch.fighting is not None: + if ( + not ch.is_awake() + or state_checks.IS_AFFECTED(ch, merc.AFF_CALM) + or ch.in_room is None + or state_checks.IS_AFFECTED(ch, merc.AFF_CHARM) + or ch.fighting is not None + ): return False count = 0 # find an ogre to beat up */ @@ -26,7 +30,11 @@ def spec_troll_member(ch): if vch.vnum == MOB_VNUM_PATROLMAN: return False - if vch.group == GROUP_VNUM_OGRES and ch.level > vch.level - 2 and not fight.is_safe(ch, vch): + if ( + vch.group == GROUP_VNUM_OGRES + and ch.level > vch.level - 2 + and not fight.is_safe(ch, vch) + ): if random.randint(0, count) == 0: victim = vch count += 1 @@ -35,13 +43,15 @@ def spec_troll_member(ch): return False # say something, then raise hell */ - messages = ["$n yells 'I've been looking for you, punk!'", - "With a scream of rage, $n attacks $N.", - "$n says 'What's slimy Ogre trash like you doing around here?'", - "$n cracks his knuckles and says 'Do ya feel lucky?'", - "$n says 'There's no cops to save you this time!'", - "$n says 'Time to join your brother, spud.'", - "$n says 'Let's rock.'"] + messages = [ + "$n yells 'I've been looking for you, punk!'", + "With a scream of rage, $n attacks $N.", + "$n says 'What's slimy Ogre trash like you doing around here?'", + "$n cracks his knuckles and says 'Do ya feel lucky?'", + "$n says 'There's no cops to save you this time!'", + "$n says 'Time to join your brother, spud.'", + "$n says 'Let's rock.'", + ] message = random.choice(messages) handler_game.act(message, ch, None, victim, merc.TO_ALL) fight.multi_hit(ch, victim, merc.TYPE_UNDEFINED) @@ -49,8 +59,13 @@ def spec_troll_member(ch): def spec_ogre_member(ch): - if not ch.is_awake() or state_checks.IS_AFFECTED(ch, merc.AFF_CALM) \ - or not ch.in_room or state_checks.IS_AFFECTED(ch, merc.AFF_CHARM) or ch.fighting: + if ( + not ch.is_awake() + or state_checks.IS_AFFECTED(ch, merc.AFF_CALM) + or not ch.in_room + or state_checks.IS_AFFECTED(ch, merc.AFF_CHARM) + or ch.fighting + ): return False count = 0 victim = None @@ -63,7 +78,11 @@ def spec_ogre_member(ch): if vch.vnum == MOB_VNUM_PATROLMAN: return False - if vch.group == GROUP_VNUM_TROLLS and ch.level > vch.level - 2 and not fight.is_safe(ch, vch): + if ( + vch.group == GROUP_VNUM_TROLLS + and ch.level > vch.level - 2 + and not fight.is_safe(ch, vch) + ): if random.randint(0, count) == 0: victim = vch count += 1 @@ -71,13 +90,15 @@ def spec_ogre_member(ch): if victim is None: return False - messages = ["$n yells 'I've been looking for you, punk!'", - "With a scream of rage, $n attacks $N.'", - "$n says 'What's Troll filth like you doing around here?'", - "$n cracks his knuckles and says 'Do ya feel lucky?'", - "$n says 'There's no cops to save you this time!'", - "$n says 'Time to join your brother, spud.'", - "$n says 'Let's rock.'"] + messages = [ + "$n yells 'I've been looking for you, punk!'", + "With a scream of rage, $n attacks $N.'", + "$n says 'What's Troll filth like you doing around here?'", + "$n cracks his knuckles and says 'Do ya feel lucky?'", + "$n says 'There's no cops to save you this time!'", + "$n says 'Time to join your brother, spud.'", + "$n says 'Let's rock.'", + ] message = random.choice(messages) handler_game.act(message, ch, None, victim, merc.TO_ALL) fight.multi_hit(ch, victim, merc.TYPE_UNDEFINED) @@ -85,8 +106,13 @@ def spec_ogre_member(ch): def spec_patrolman(ch): - if not ch.is_awake() or state_checks.IS_AFFECTED(ch, merc.AFF_CALM) \ - or not ch.in_room or state_checks.IS_AFFECTED(ch, merc.AFF_CHARM) or ch.fighting: + if ( + not ch.is_awake() + or state_checks.IS_AFFECTED(ch, merc.AFF_CALM) + or not ch.in_room + or state_checks.IS_AFFECTED(ch, merc.AFF_CHARM) + or ch.fighting + ): return False victim = None # look for a fight in the room */ @@ -102,27 +128,45 @@ def spec_patrolman(ch): if victim is None or (victim.is_npc() and victim.spec_fun == ch.spec_fun): return False - neck = ch.get_eq('neck') - collar = ch.get_eq('collar') - if (neck and neck.vnum == merc.OBJ_VNUM_WHISTLE) \ - or (collar and collar.vnum == merc.OBJ_VNUM_WHISTLE): - handler_game.act("You blow down hard on $p.", ch, instance.items[neck.instance_id], None, merc.TO_CHAR) - handler_game.act("$n blows on $p, ***WHEEEEEEEEEEEET***", ch, instance.items[neck.instance_id], None, merc.TO_ROOM) + neck = ch.get_eq("neck") + collar = ch.get_eq("collar") + if (neck and neck.vnum == merc.OBJ_VNUM_WHISTLE) or ( + collar and collar.vnum == merc.OBJ_VNUM_WHISTLE + ): + handler_game.act( + "You blow down hard on $p.", + ch, + instance.items[neck.instance_id], + None, + merc.TO_CHAR, + ) + handler_game.act( + "$n blows on $p, ***WHEEEEEEEEEEEET***", + ch, + instance.items[neck.instance_id], + None, + merc.TO_ROOM, + ) for vch in instance.characters.values(): if vch.in_room is None: continue - if vch.in_room != ch.in_room and instance.area_templates[instance.rooms[vch.in_room].area] \ - == instance.area_templates[instance.room_templates[ch.in_room].area]: + if ( + vch.in_room != ch.in_room + and instance.area_templates[instance.rooms[vch.in_room].area] + == instance.area_templates[instance.room_templates[ch.in_room].area] + ): vch.send("You hear a shrill whistling sound.\n") - messages = ["$n yells 'All roit! All roit! break it up!'", - "$n says 'Society's to blame, but what's a bloke to do?'", - "$n mumbles 'bloody kids will be the death of us all.'", - "$n shouts 'Stop that! Stop that!' and attacks.", - "$n pulls out his billy and goes to work.", - "$n sighs in resignation and proceeds to break up the fight.", - "$n says 'Settle down, you hooligans!'"] + messages = [ + "$n yells 'All roit! All roit! break it up!'", + "$n says 'Society's to blame, but what's a bloke to do?'", + "$n mumbles 'bloody kids will be the death of us all.'", + "$n shouts 'Stop that! Stop that!' and attacks.", + "$n pulls out his billy and goes to work.", + "$n sighs in resignation and proceeds to break up the fight.", + "$n says 'Settle down, you hooligans!'", + ] message = random.choice(messages) handler_game.act(message, ch, None, None, merc.TO_ALL) fight.multi_hit(ch, victim, merc.TYPE_UNDEFINED) @@ -136,7 +180,11 @@ def spec_nasty(ch): if ch.position != merc.POS_FIGHTING: for victim_id in ch.in_room.people[:]: victim = instance.characters[victim_id] - if not victim.is_npc() and (victim.level > ch.level) and (victim.level < ch.level + 10): + if ( + not victim.is_npc() + and (victim.level > ch.level) + and (victim.level < ch.level + 10) + ): ch.do_backstab(victim.name) if ch.position != merc.POS_FIGHTING: ch.do_murder(victim.name) @@ -150,9 +198,23 @@ def spec_nasty(ch): victim = instance.characters[ch.fighting] num = random.randint(0, 2) if num == 0: - handler_game.act("$n rips apart your coin purse, spilling your gold!", ch, None, victim, merc.TO_VICT) - handler_game.act("You slash apart $N's coin purse and gather his gold.", ch, None, victim, merc.TO_CHAR) - handler_game.act("$N's coin purse is ripped apart!", ch, None, victim, merc.TO_NOTVICT) + handler_game.act( + "$n rips apart your coin purse, spilling your gold!", + ch, + None, + victim, + merc.TO_VICT, + ) + handler_game.act( + "You slash apart $N's coin purse and gather his gold.", + ch, + None, + victim, + merc.TO_CHAR, + ) + handler_game.act( + "$N's coin purse is ripped apart!", ch, None, victim, merc.TO_NOTVICT + ) gold = victim.gold / 10 # steal 10% of his gold */ victim.gold -= gold ch.gold += gold @@ -173,7 +235,7 @@ def dragon(ch, spell_name): victim = None for vch_id in ch.in_room.people[:]: vch = instance.characters[vch_id] - if vch.fighting == ch and random.randint(0,3) == 0: + if vch.fighting == ch and random.randint(0, 3) == 0: victim = vch break @@ -187,11 +249,18 @@ def dragon(ch, spell_name): # Special procedures for mobiles. + def spec_breath_any(ch): if ch.position != merc.POS_FIGHTING: return False - breaths = [spec_breath_fire, spec_breath_lightning, spec_breath_gas, spec_breath_acid, spec_breath_frost] + breaths = [ + spec_breath_fire, + spec_breath_lightning, + spec_breath_gas, + spec_breath_acid, + spec_breath_frost, + ] breath = random.randint(0, len(breaths) + 3) if breath < len(breaths): return breaths[breath](ch) @@ -230,7 +299,13 @@ def spec_cast_adept(ch): victim = None for vch_id in instance.rooms[ch.in_room].people[:]: vch = instance.characters[vch_id] - if vch != ch and ch.can_see(vch) and random.randint(0, 1) == 0 and not vch.is_npc() and vch.level < 11: + if ( + vch != ch + and ch.can_see(vch) + and random.randint(0, 1) == 0 + and not vch.is_npc() + and vch.level < 11 + ): victim = vch break @@ -240,31 +315,55 @@ def spec_cast_adept(ch): num = random.randint(1, 15) if num == 0: handler_game.act("$n utters the word 'abrazak'.", ch, None, None, merc.TO_ROOM) - const.skill_table["armor"].spell_fun('armor', ch.level, ch, victim, merc.TARGET_CHAR) + const.skill_table["armor"].spell_fun( + "armor", ch.level, ch, victim, merc.TARGET_CHAR + ) return True elif num == 1: handler_game.act("$n utters the word 'fido'.", ch, None, None, merc.TO_ROOM) - const.skill_table["bless"].spell_fun('bless', ch.level, ch, victim, merc.TARGET_CHAR) + const.skill_table["bless"].spell_fun( + "bless", ch.level, ch, victim, merc.TARGET_CHAR + ) return True elif num == 2: - handler_game.act("$n utters the words 'judicandus noselacri'.", ch, None, None, merc.TO_ROOM) - const.skill_table["cure blindness"].spell_fun('cure blindness', ch.level, ch, victim, merc.TARGET_CHAR) + handler_game.act( + "$n utters the words 'judicandus noselacri'.", ch, None, None, merc.TO_ROOM + ) + const.skill_table["cure blindness"].spell_fun( + "cure blindness", ch.level, ch, victim, merc.TARGET_CHAR + ) return True elif num == 3: - handler_game.act("$n utters the words 'judicandus dies'.", ch, None, None, merc.TO_ROOM) - const.skill_table["cure light"].spell_fun('cure light', ch.level, ch, victim, merc.TARGET_CHAR) + handler_game.act( + "$n utters the words 'judicandus dies'.", ch, None, None, merc.TO_ROOM + ) + const.skill_table["cure light"].spell_fun( + "cure light", ch.level, ch, victim, merc.TARGET_CHAR + ) return True elif num == 4: - handler_game.act("$n utters the words 'judicandus sausabru'.", ch, None, None, merc.TO_ROOM) - const.skill_table["cure poison"].spell_fun('cure poison', ch.level, ch, victim, merc.TARGET_CHAR) + handler_game.act( + "$n utters the words 'judicandus sausabru'.", ch, None, None, merc.TO_ROOM + ) + const.skill_table["cure poison"].spell_fun( + "cure poison", ch.level, ch, victim, merc.TARGET_CHAR + ) return True elif num == 5: - handler_game.act("$n utters the word 'candusima'.", ch, None, None, merc.TO_ROOM) - const.skill_table["refresh"].spell_fun('refresh', ch.level, ch, victim, merc.TARGET_CHAR) + handler_game.act( + "$n utters the word 'candusima'.", ch, None, None, merc.TO_ROOM + ) + const.skill_table["refresh"].spell_fun( + "refresh", ch.level, ch, victim, merc.TARGET_CHAR + ) return True elif num == 6: - handler_game.act("$n utters the words 'judicandus eugzagz'.", ch, None, None, merc.TO_ROOM) - const.skill_table["cure disease"].spell_fun('cure disease', ch.level, ch, victim, merc.TARGET_CHAR) + handler_game.act( + "$n utters the words 'judicandus eugzagz'.", ch, None, None, merc.TO_ROOM + ) + const.skill_table["cure disease"].spell_fun( + "cure disease", ch.level, ch, victim, merc.TARGET_CHAR + ) return False @@ -274,7 +373,7 @@ def spec_cast_cleric(ch): victim = None for vch_id in ch.in_room.people[:]: vch = instance.characters[vch_id] - if vch.fighting == ch and random.randint(0,3) == 0: + if vch.fighting == ch and random.randint(0, 3) == 0: victim = vch break @@ -333,7 +432,7 @@ def spec_cast_judge(ch): victim = None for vch_id in ch.in_room.people[:]: vch = instance.characters[vch_id] - if vch.fighting == ch and random.randint(0, 3 ) == 0: + if vch.fighting == ch and random.randint(0, 3) == 0: victim = vch break @@ -409,7 +508,7 @@ def spec_cast_undead(ch): for vch_id in ch.in_room.people[:]: vch = instance.characters[vch_id] - if vch.fighting == ch and random.randint(0,3) == 0: + if vch.fighting == ch and random.randint(0, 3) == 0: victim = vch break if victim is None: @@ -476,7 +575,9 @@ def spec_executioner(ch): return False ch.comm.rem_bit(merc.COMM_NOSHOUT) - ch.do_yell("%s is a %s! PROTECT THE INNOCENT! MORE BLOOOOD!!!" % (victim.name, crime)) + ch.do_yell( + "%s is a %s! PROTECT THE INNOCENT! MORE BLOOOOD!!!" % (victim.name, crime) + ) fight.multi_hit(ch, victim, merc.TYPE_UNDEFINED) return True @@ -532,7 +633,9 @@ def spec_guard(ch): return True if ech: - handler_game.act("$n screams 'PROTECT THE INNOCENT!! BANZAI!!", ch, None, None, merc.TO_ROOM) + handler_game.act( + "$n screams 'PROTECT THE INNOCENT!! BANZAI!!", ch, None, None, merc.TO_ROOM + ) fight.multi_hit(ch, ech, merc.TYPE_UNDEFINED) return True return False @@ -546,7 +649,11 @@ def spec_janitor(ch): trash = instance.items[trash_id] if not trash.flags.take or not ch.can_loot(trash): continue - if trash.item_type == merc.ITEM_DRINK_CON or trash.item_type == merc.ITEM_TRASH or trash.cost < 10: + if ( + trash.item_type == merc.ITEM_DRINK_CON + or trash.item_type == merc.ITEM_TRASH + or trash.cost < 10 + ): handler_game.act("$n picks up some trash.", ch, None, None, merc.TO_ROOM) ch.in_room.get(trash) ch.put(trash) @@ -582,46 +689,76 @@ def spec_mayor(ch): if not move or ch.position < merc.POS_SLEEPING: return False - if path[pos] == '0' or path[pos] == '1' or path[pos] == '2' or path[pos] == '3': + if path[pos] == "0" or path[pos] == "1" or path[pos] == "2" or path[pos] == "3": handler_ch.move_char(ch, int(path[pos]), False) - elif path[pos] == 'W': + elif path[pos] == "W": ch.position = merc.POS_STANDING handler_game.act("$n awakens and groans loudly.", ch, None, None, merc.TO_ROOM) - elif path[pos] == 'S': + elif path[pos] == "S": ch.position = merc.POS_SLEEPING handler_game.act("$n lies down and falls asleep.", ch, None, None, merc.TO_ROOM) - elif path[pos] == 'a': + elif path[pos] == "a": handler_game.act("$n says 'Hello Honey!'", ch, None, None, merc.TO_ROOM) - elif path[pos] == 'b': - handler_game.act("$n says 'What a view! I must do something about that dump!'", ch, None, None, merc.TO_ROOM) - elif path[pos] == 'c': - handler_game.act("$n says 'Vandals! Youngsters have no respect for anything!'", ch, None, None, merc.TO_ROOM) - elif path[pos] == 'd': + elif path[pos] == "b": + handler_game.act( + "$n says 'What a view! I must do something about that dump!'", + ch, + None, + None, + merc.TO_ROOM, + ) + elif path[pos] == "c": + handler_game.act( + "$n says 'Vandals! Youngsters have no respect for anything!'", + ch, + None, + None, + merc.TO_ROOM, + ) + elif path[pos] == "d": handler_game.act("$n says 'Good day, citizens!'", ch, None, None, merc.TO_ROOM) - elif path[pos] == 'e': - handler_game.act("$n says 'I hereby declare the city of Midgaard open!'", ch, None, None, merc.TO_ROOM) - elif path[pos] == 'E': - handler_game.act("$n says 'I hereby declare the city of Midgaard closed!'", ch, None, None, merc.TO_ROOM) - elif path[pos] == 'O': + elif path[pos] == "e": + handler_game.act( + "$n says 'I hereby declare the city of Midgaard open!'", + ch, + None, + None, + merc.TO_ROOM, + ) + elif path[pos] == "E": + handler_game.act( + "$n says 'I hereby declare the city of Midgaard closed!'", + ch, + None, + None, + merc.TO_ROOM, + ) + elif path[pos] == "O": # do_function(ch, &do_unlock, "gate" ) */ ch.do_open("gate") - elif 'C': + elif "C": ch.do_close("gate") # do_function(ch, &do_lock, "gate" ) */ - elif path[pos] == '.': + elif path[pos] == ".": move = False pos += 1 return False def spec_poison(ch): - if ch.position != merc.POS_FIGHTING or not ch.fighting or random.randint(1, 99) > 2 * ch.level: + if ( + ch.position != merc.POS_FIGHTING + or not ch.fighting + or random.randint(1, 99) > 2 * ch.level + ): return False victim = ch.fighting handler_game.act("You bite $N!", ch, None, victim, merc.TO_CHAR) handler_game.act("$n bites $N!", ch, None, victim, merc.TO_NOTVICT) handler_game.act("$n bites you!", ch, None, victim, merc.TO_VICT) - const.skill_table['poison'].spell_fun('poison', ch.level, ch, victim, merc.TARGET_CHAR) + const.skill_table["poison"].spell_fun( + "poison", ch.level, ch, victim, merc.TARGET_CHAR + ) return True @@ -632,12 +769,29 @@ def spec_thief(ch): for victim_id in ch.in_room.people[:]: victim = instance.characters[victim_id] - if victim.is_npc() or victim.level >= merc.LEVEL_IMMORTAL or random.randint(0,31) != 0 or not ch.can_see(victim): + if ( + victim.is_npc() + or victim.level >= merc.LEVEL_IMMORTAL + or random.randint(0, 31) != 0 + or not ch.can_see(victim) + ): continue if state_checks.IS_AWAKE(victim) and random.randint(0, ch.level) == 0: - handler_game.act("You discover $n's hands in your wallet!", ch, None, victim, merc.TO_VICT) - handler_game.act("$N discovers $n's hands in $S wallet!", ch, None, victim, merc.TO_NOTVICT) + handler_game.act( + "You discover $n's hands in your wallet!", + ch, + None, + victim, + merc.TO_VICT, + ) + handler_game.act( + "$N discovers $n's hands in $S wallet!", + ch, + None, + victim, + merc.TO_NOTVICT, + ) return True else: gold = victim.gold * min(random.randint(1, 20), ch.level / 2) / 100 @@ -652,13 +806,27 @@ def spec_thief(ch): return False -spec_table = {"spec_breath_any": spec_breath_any, "spec_breath_acid": spec_breath_acid, - "spec_breath_fire": spec_breath_fire, "spec_breath_frost": spec_breath_frost, - "spec_breath_gas": spec_breath_gas, "spec_breath_lightning": spec_breath_lightning, - "spec_cast_adept": spec_cast_adept, "spec_cast_cleric": spec_cast_cleric, - "spec_cast_judge": spec_cast_judge, "spec_cast_mage": spec_cast_mage, - "spec_cast_undead": spec_cast_undead, "spec_executioner": spec_executioner, "spec_fido": spec_fido, - "spec_guard": spec_guard, "spec_janitor": spec_janitor, "spec_mayor": spec_mayor, - "spec_poison": spec_poison, "spec_thief": spec_thief, "spec_nasty": spec_nasty, - "spec_troll_member": spec_troll_member, "spec_ogre_member": spec_ogre_member, - "spec_patrolman": spec_patrolman} +spec_table = { + "spec_breath_any": spec_breath_any, + "spec_breath_acid": spec_breath_acid, + "spec_breath_fire": spec_breath_fire, + "spec_breath_frost": spec_breath_frost, + "spec_breath_gas": spec_breath_gas, + "spec_breath_lightning": spec_breath_lightning, + "spec_cast_adept": spec_cast_adept, + "spec_cast_cleric": spec_cast_cleric, + "spec_cast_judge": spec_cast_judge, + "spec_cast_mage": spec_cast_mage, + "spec_cast_undead": spec_cast_undead, + "spec_executioner": spec_executioner, + "spec_fido": spec_fido, + "spec_guard": spec_guard, + "spec_janitor": spec_janitor, + "spec_mayor": spec_mayor, + "spec_poison": spec_poison, + "spec_thief": spec_thief, + "spec_nasty": spec_nasty, + "spec_troll_member": spec_troll_member, + "spec_ogre_member": spec_ogre_member, + "spec_patrolman": spec_patrolman, +} diff --git a/src/rom24/spells/spell_acid_blast.py b/src/rom24/spells/spell_acid_blast.py index 6868379..04f3e6d 100644 --- a/src/rom24/spells/spell_acid_blast.py +++ b/src/rom24/spells/spell_acid_blast.py @@ -12,8 +12,20 @@ def spell_acid_blast(sn, level, ch, victim, target): fight.damage(ch, victim, dam, sn, merc.DAM_ACID, True) -const.register_spell(const.skill_type("acid blast", - {'mage': 28, 'cleric': 53, 'thief': 35, 'warrior': 32}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_acid_blast, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(70), 20, 12, "acid blast", "!Acid Blast!", "")) +const.register_spell( + const.skill_type( + "acid blast", + {"mage": 28, "cleric": 53, "thief": 35, "warrior": 32}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_acid_blast, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(70), + 20, + 12, + "acid blast", + "!Acid Blast!", + "", + ) +) diff --git a/src/rom24/spells/spell_acid_breath.py b/src/rom24/spells/spell_acid_breath.py index 7d996ee..f24f4da 100644 --- a/src/rom24/spells/spell_acid_breath.py +++ b/src/rom24/spells/spell_acid_breath.py @@ -12,7 +12,9 @@ def spell_acid_breath(sn, level, ch, victim, target): # NPC spells. handler_game.act("$n spits acid at $N.", ch, None, victim, merc.TO_NOTVICT) - handler_game.act("$n spits a stream of corrosive acid at you.", ch, None, victim, merc.TO_VICT) + handler_game.act( + "$n spits a stream of corrosive acid at you.", ch, None, victim, merc.TO_VICT + ) handler_game.act("You spit acid at $N.", ch, None, victim, merc.TO_CHAR) hpch = max(12, ch.hit) @@ -29,8 +31,20 @@ def spell_acid_breath(sn, level, ch, victim, target): fight.damage(ch, victim, dam, sn, merc.DAM_ACID, True) -const.register_spell(const.skill_type("acid breath", - {'mage': 31, 'cleric': 32, 'thief': 33, 'warrior': 34}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_acid_breath, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, None, - const.SLOT(200), 100, 24, "blast of acid", "!Acid Breath!", "")) +const.register_spell( + const.skill_type( + "acid breath", + {"mage": 31, "cleric": 32, "thief": 33, "warrior": 34}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_acid_breath, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(200), + 100, + 24, + "blast of acid", + "!Acid Breath!", + "", + ) +) diff --git a/src/rom24/spells/spell_armor.py b/src/rom24/spells/spell_armor.py index 71155b3..1be8215 100644 --- a/src/rom24/spells/spell_armor.py +++ b/src/rom24/spells/spell_armor.py @@ -22,11 +22,25 @@ def spell_armor(sn, level, ch, victim, target): victim.affect_add(af) victim.send("You feel someone protecting you.\n") if ch is not victim: - handler_game.act("$N is protected by your magic.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N is protected by your magic.", ch, None, victim, merc.TO_CHAR + ) -const.register_spell(const.skill_type("armor", - {'mage': 7, 'cleric': 2, 'thief': 10, 'warrior': 5}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_armor, merc.TAR_CHAR_DEFENSIVE, merc.POS_STANDING, - None, const.SLOT(1), 5, 12, "", "You feel less armored.", "")) +const.register_spell( + const.skill_type( + "armor", + {"mage": 7, "cleric": 2, "thief": 10, "warrior": 5}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_armor, + merc.TAR_CHAR_DEFENSIVE, + merc.POS_STANDING, + None, + const.SLOT(1), + 5, + 12, + "", + "You feel less armored.", + "", + ) +) diff --git a/src/rom24/spells/spell_bless.py b/src/rom24/spells/spell_bless.py index 929eb60..a557542 100644 --- a/src/rom24/spells/spell_bless.py +++ b/src/rom24/spells/spell_bless.py @@ -20,11 +20,20 @@ def spell_bless(sn, level, ch, victim, target): if not handler_magic.saves_dispel(level, level, 0): if paf: obj.affect_remove(paf) - handler_game.act("$p glows a pale blue.", ch, obj, None, merc.TO_ALL) - obj.extra_bits = state_checks.REMOVE_BIT(obj.extra_flags, merc.ITEM_EVIL) + handler_game.act( + "$p glows a pale blue.", ch, obj, None, merc.TO_ALL + ) + obj.extra_bits = state_checks.REMOVE_BIT( + obj.extra_flags, merc.ITEM_EVIL + ) return else: - handler_game.act("The evil of $p is too powerful for you to overcome.", ch, obj, send_to=merc.TO_CHAR) + handler_game.act( + "The evil of $p is too powerful for you to overcome.", + ch, + obj, + send_to=merc.TO_CHAR, + ) return af = handler_game.AFFECT_DATA() af.where = merc.TO_OBJECT @@ -40,13 +49,14 @@ def spell_bless(sn, level, ch, victim, target): ch.saving_throw = ch.saving_throw - 1 return - # character target */ if victim.position == merc.POS_FIGHTING or state_checks.is_affected(victim, sn): if victim == ch: ch.send("You are already blessed.\n") else: - handler_game.act("$N already has divine favor.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N already has divine favor.", ch, None, victim, merc.TO_CHAR + ) return af = handler_game.AFFECT_DATA() @@ -64,11 +74,25 @@ def spell_bless(sn, level, ch, victim, target): victim.affect_add(af) victim.send("You feel righteous.\n") if ch is not victim: - handler_game.act("You grant $N the favor of your god.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "You grant $N the favor of your god.", ch, None, victim, merc.TO_CHAR + ) -const.register_spell(const.skill_type("bless", - {'mage': 53, 'cleric': 7, 'thief': 53, 'warrior': 8}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_bless, merc.TAR_OBJ_CHAR_DEF, merc.POS_STANDING, None, - const.SLOT(3), 5, 12, "", "You feel less righteous.", "$p's holy aura fades.")) +const.register_spell( + const.skill_type( + "bless", + {"mage": 53, "cleric": 7, "thief": 53, "warrior": 8}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_bless, + merc.TAR_OBJ_CHAR_DEF, + merc.POS_STANDING, + None, + const.SLOT(3), + 5, + 12, + "", + "You feel less righteous.", + "$p's holy aura fades.", + ) +) diff --git a/src/rom24/spells/spell_blindness.py b/src/rom24/spells/spell_blindness.py index e12c2e2..dc444cc 100644 --- a/src/rom24/spells/spell_blindness.py +++ b/src/rom24/spells/spell_blindness.py @@ -5,7 +5,9 @@ def spell_blindness(sn, level, ch, victim, target): - if victim.is_affected(merc.AFF_BLIND) or handler_magic.saves_spell(level, victim, merc.DAM_OTHER): + if victim.is_affected(merc.AFF_BLIND) or handler_magic.saves_spell( + level, victim, merc.DAM_OTHER + ): return af = handler_game.AFFECT_DATA() @@ -21,8 +23,20 @@ def spell_blindness(sn, level, ch, victim, target): handler_game.act("$n appears to be blinded.", victim, send_to=merc.TO_ROOM) -const.register_spell(const.skill_type("blindness", - {'mage': 12, 'cleric': 8, 'thief': 17, 'warrior': 15}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_blindness, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(4), 5, 12, "", "You can see again.", "")) +const.register_spell( + const.skill_type( + "blindness", + {"mage": 12, "cleric": 8, "thief": 17, "warrior": 15}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_blindness, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(4), + 5, + 12, + "", + "You can see again.", + "", + ) +) diff --git a/src/rom24/spells/spell_burning_hands.py b/src/rom24/spells/spell_burning_hands.py index 63e2c2b..a4c5847 100644 --- a/src/rom24/spells/spell_burning_hands.py +++ b/src/rom24/spells/spell_burning_hands.py @@ -6,12 +6,59 @@ def spell_burning_hands(sn, level, ch, victim, target): - dam_each = [0, - 0, 0, 0, 0, 14, 17, 20, 23, 26, 29, - 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, - 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, - 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, - 44, 44, 45, 45, 46, 46, 47, 47, 48, 48] + dam_each = [ + 0, + 0, + 0, + 0, + 0, + 14, + 17, + 20, + 23, + 26, + 29, + 29, + 29, + 30, + 30, + 31, + 31, + 32, + 32, + 33, + 33, + 34, + 34, + 35, + 35, + 36, + 36, + 37, + 37, + 38, + 38, + 39, + 39, + 40, + 40, + 41, + 41, + 42, + 42, + 43, + 43, + 44, + 44, + 45, + 45, + 46, + 46, + 47, + 47, + 48, + 48, + ] level = min(level, len(dam_each) - 1) level = max(0, level) @@ -21,8 +68,20 @@ def spell_burning_hands(sn, level, ch, victim, target): fight.damage(ch, victim, dam, sn, merc.DAM_FIRE, True) -const.register_spell(const.skill_type("burning hands", - {'mage': 7, 'cleric': 53, 'thief': 10, 'warrior': 9}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_burning_hands, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(5), 15, 12, "burning hands", "!Burning Hands!", "")) +const.register_spell( + const.skill_type( + "burning hands", + {"mage": 7, "cleric": 53, "thief": 10, "warrior": 9}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_burning_hands, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(5), + 15, + 12, + "burning hands", + "!Burning Hands!", + "", + ) +) diff --git a/src/rom24/spells/spell_call_lightning.py b/src/rom24/spells/spell_call_lightning.py index 1321cb4..4de8b6d 100644 --- a/src/rom24/spells/spell_call_lightning.py +++ b/src/rom24/spells/spell_call_lightning.py @@ -19,23 +19,49 @@ def spell_call_lightning(sn, level, ch, victim, target): dam = game_utils.dice(level // 2, 8) ch.send("Mota's lightning strikes your foes! \n") - handler_game.act("$n calls Mota's lightning to strike $s foes! ", ch, None, None, merc.TO_ROOM) + handler_game.act( + "$n calls Mota's lightning to strike $s foes! ", ch, None, None, merc.TO_ROOM + ) for vch in instance.characters.values(): if vch.in_room == None: continue if vch.in_room == ch.in_room: - if vch is not ch and ( not vch.is_npc() if ch.is_npc() else vch.is_npc() ): - fight.damage(ch, vch, dam // 2 if handler_magic.saves_spell(level, vch, merc.DAM_LIGHTNING) else dam, sn, - merc.DAM_LIGHTNING, True) + if vch is not ch and (not vch.is_npc() if ch.is_npc() else vch.is_npc()): + fight.damage( + ch, + vch, + dam // 2 + if handler_magic.saves_spell(level, vch, merc.DAM_LIGHTNING) + else dam, + sn, + merc.DAM_LIGHTNING, + True, + ) continue - if vch.in_room.area == ch.in_room.area and state_checks.IS_OUTSIDE(vch) and vch.is_awake(): + if ( + vch.in_room.area == ch.in_room.area + and state_checks.IS_OUTSIDE(vch) + and vch.is_awake() + ): vch.send("Lightning flashes in the sky.\n") -const.register_spell(const.skill_type("call lightning", - {'mage': 26, 'cleric': 18, 'thief': 31, 'warrior': 22}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_call_lightning, merc.TAR_IGNORE, merc.POS_FIGHTING, None, - const.SLOT(6), 15, 12, "lightning bolt", "!Call Lightning!", "")) +const.register_spell( + const.skill_type( + "call lightning", + {"mage": 26, "cleric": 18, "thief": 31, "warrior": 22}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_call_lightning, + merc.TAR_IGNORE, + merc.POS_FIGHTING, + None, + const.SLOT(6), + 15, + 12, + "lightning bolt", + "!Call Lightning!", + "", + ) +) diff --git a/src/rom24/spells/spell_calm.py b/src/rom24/spells/spell_calm.py index 6e36cf6..bdaf491 100644 --- a/src/rom24/spells/spell_calm.py +++ b/src/rom24/spells/spell_calm.py @@ -1,7 +1,3 @@ - - - - # RT calm spell stops all fighting in the room */ import random from rom24 import const @@ -35,12 +31,16 @@ def spell_calm(sn, level, ch, victim, target): if random.randint(0, chance) >= mlevel: # hard to stop large fights */ for vch_id in ch.in_room.people: vch = instance.characters[vch_id] - if vch.is_npc() and (vch.imm_flags.is_set(merc.IMM_MAGIC) \ - or vch.act.is_set(merc.ACT_UNDEAD)): + if vch.is_npc() and ( + vch.imm_flags.is_set(merc.IMM_MAGIC) or vch.act.is_set(merc.ACT_UNDEAD) + ): return - if vch.is_affected(merc.AFF_CALM) or vch.is_affected(merc.AFF_BERSERK) \ - or vch.is_affected('frenzy'): + if ( + vch.is_affected(merc.AFF_CALM) + or vch.is_affected(merc.AFF_BERSERK) + or vch.is_affected("frenzy") + ): return vch.send("A wave of calm passes over you.\n") @@ -64,8 +64,20 @@ def spell_calm(sn, level, ch, victim, target): vch.affect_add(af) -const.register_spell(const.skill_type("calm", - {'mage': 48, 'cleric': 16, 'thief': 50, 'warrior': 20}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_calm, merc.TAR_IGNORE, merc.POS_FIGHTING, None, const.SLOT(509), - 30, 12, "", "You have lost your peace of mind.", "")) +const.register_spell( + const.skill_type( + "calm", + {"mage": 48, "cleric": 16, "thief": 50, "warrior": 20}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_calm, + merc.TAR_IGNORE, + merc.POS_FIGHTING, + None, + const.SLOT(509), + 30, + 12, + "", + "You have lost your peace of mind.", + "", + ) +) diff --git a/src/rom24/spells/spell_cancellation.py b/src/rom24/spells/spell_cancellation.py index 9d9e60a..b3576f9 100644 --- a/src/rom24/spells/spell_cancellation.py +++ b/src/rom24/spells/spell_cancellation.py @@ -7,43 +7,47 @@ def spell_cancellation(sn, level, ch, victim, target): found = False level += 2 - if (not ch.is_npc() and victim.is_npc() and not ( - ch.is_affected(merc.AFF_CHARM) and ch.master == victim)) \ - or (ch.is_npc() and not victim.is_npc()): + if ( + not ch.is_npc() + and victim.is_npc() + and not (ch.is_affected(merc.AFF_CHARM) and ch.master == victim) + ) or (ch.is_npc() and not victim.is_npc()): ch.send("You failed, try dispel magic.\n") return # unlike dispel magic, the victim gets NO save */ # begin running through the spells */ - spells = {'armor': None, - 'bless': None, - 'blindness': '$n is no longer blinded', - 'calm': '$n no longer looks so peaceful...', - 'change sex': '$n looks more like $mself again.', - 'charm person': '$n regains $s free will.', - 'chill touch': '$n looks warmer', - 'curse': None, - 'detect evil': None, - 'detect good': None, - 'detect hidden': None, - 'detect invis': None, - 'detect magic': None, - 'faerie fire': "$n's outline fades", - 'fly': '$n falls to the ground! ', - 'frenzy': "$n no longer looks so wild.", - 'giant strength': "$n no longer looks so mighty.", - 'haste': '$n is no longer moving so quickly', - 'infravision': None, - 'invisibility': '$n fades into existence.', - 'mass invis': '$n fades into existence', - 'pass door': None, - 'protection evil': None, - 'protection good': None, - 'sanctuary': "The white aura around $n's body vanishes.", - 'shield': 'The shield protecting $n vanishes', - 'sleep': None, - 'slow': '$n is no longer moving so slowly.', - 'stone skin': "$n's skin regains its normal texture.", - 'weaken': "$n looks stronger."} + spells = { + "armor": None, + "bless": None, + "blindness": "$n is no longer blinded", + "calm": "$n no longer looks so peaceful...", + "change sex": "$n looks more like $mself again.", + "charm person": "$n regains $s free will.", + "chill touch": "$n looks warmer", + "curse": None, + "detect evil": None, + "detect good": None, + "detect hidden": None, + "detect invis": None, + "detect magic": None, + "faerie fire": "$n's outline fades", + "fly": "$n falls to the ground! ", + "frenzy": "$n no longer looks so wild.", + "giant strength": "$n no longer looks so mighty.", + "haste": "$n is no longer moving so quickly", + "infravision": None, + "invisibility": "$n fades into existence.", + "mass invis": "$n fades into existence", + "pass door": None, + "protection evil": None, + "protection good": None, + "sanctuary": "The white aura around $n's body vanishes.", + "shield": "The shield protecting $n vanishes", + "sleep": None, + "slow": "$n is no longer moving so slowly.", + "stone skin": "$n's skin regains its normal texture.", + "weaken": "$n looks stronger.", + } for k, v in spells.items(): if handler_magic.check_dispel(level, victim, const.skill_table[k]): @@ -57,9 +61,20 @@ def spell_cancellation(sn, level, ch, victim, target): ch.send("Spell failed.\n") -const.register_spell(const.skill_type("cancellation", - {'mage': 18, 'cleric': 26, 'thief': 34, 'warrior': 34}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_cancellation, merc.TAR_CHAR_DEFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(507), 20, 12, "", "!cancellation!", "") +const.register_spell( + const.skill_type( + "cancellation", + {"mage": 18, "cleric": 26, "thief": 34, "warrior": 34}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_cancellation, + merc.TAR_CHAR_DEFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(507), + 20, + 12, + "", + "!cancellation!", + "", + ) ) diff --git a/src/rom24/spells/spell_cause_critical.py b/src/rom24/spells/spell_cause_critical.py index 28e31db..ffd0378 100644 --- a/src/rom24/spells/spell_cause_critical.py +++ b/src/rom24/spells/spell_cause_critical.py @@ -9,8 +9,20 @@ def spell_cause_critical(sn, level, ch, victim, target): return -const.register_spell(const.skill_type("cause critical", - {'mage': 53, 'cleric': 13, 'thief': 53, 'warrior': 19}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_cause_critical, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(63), 20, 12, "spell", "!Cause Critical!", "")) +const.register_spell( + const.skill_type( + "cause critical", + {"mage": 53, "cleric": 13, "thief": 53, "warrior": 19}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_cause_critical, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(63), + 20, + 12, + "spell", + "!Cause Critical!", + "", + ) +) diff --git a/src/rom24/spells/spell_cause_light.py b/src/rom24/spells/spell_cause_light.py index f7d8cec..d4135c4 100644 --- a/src/rom24/spells/spell_cause_light.py +++ b/src/rom24/spells/spell_cause_light.py @@ -5,13 +5,27 @@ def spell_cause_light(sn, level, ch, victim, target): - fight.damage(ch, victim, game_utils.dice(1, 8) + level // 3, sn, merc.DAM_HARM, True) + fight.damage( + ch, victim, game_utils.dice(1, 8) + level // 3, sn, merc.DAM_HARM, True + ) fight.check_killer return -const.register_spell(const.skill_type("cause light", - {'mage': 53, 'cleric': 1, 'thief': 53, 'warrior': 3}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_cause_light, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(62), 15, 12, "spell", "!Cause Light!", "")) +const.register_spell( + const.skill_type( + "cause light", + {"mage": 53, "cleric": 1, "thief": 53, "warrior": 3}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_cause_light, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(62), + 15, + 12, + "spell", + "!Cause Light!", + "", + ) +) diff --git a/src/rom24/spells/spell_cause_serious.py b/src/rom24/spells/spell_cause_serious.py index e048d5a..3590734 100644 --- a/src/rom24/spells/spell_cause_serious.py +++ b/src/rom24/spells/spell_cause_serious.py @@ -5,14 +5,26 @@ def spell_cause_serious(sn, level, ch, victim, target): - fight.damage(ch, victim, game_utils.dice(2, 8) + level // 2, sn, merc.DAM_HARM, True) + fight.damage( + ch, victim, game_utils.dice(2, 8) + level // 2, sn, merc.DAM_HARM, True + ) return -const.register_spell(const.skill_type("cause serious", - {'mage': 53, 'cleric': 7, 'thief': 53, 'warrior': 10}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_cause_serious, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, None, - const.SLOT(64), 17, 12, "spell", "!Cause Serious!", "") - +const.register_spell( + const.skill_type( + "cause serious", + {"mage": 53, "cleric": 7, "thief": 53, "warrior": 10}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_cause_serious, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(64), + 17, + 12, + "spell", + "!Cause Serious!", + "", + ) ) diff --git a/src/rom24/spells/spell_chain_lightning.py b/src/rom24/spells/spell_chain_lightning.py index 99835bd..a66e98c 100644 --- a/src/rom24/spells/spell_chain_lightning.py +++ b/src/rom24/spells/spell_chain_lightning.py @@ -8,9 +8,27 @@ def spell_chain_lightning(sn, level, ch, victim, target): # H first strike */ - handler_game.act("A lightning bolt leaps from $n's hand and arcs to $N.", ch, None, victim, merc.TO_ROOM) - handler_game.act("A lightning bolt leaps from your hand and arcs to $N.", ch, None, victim, merc.TO_CHAR) - handler_game.act("A lightning bolt leaps from $n's hand and hits you! ", ch, None, victim, merc.TO_VICT) + handler_game.act( + "A lightning bolt leaps from $n's hand and arcs to $N.", + ch, + None, + victim, + merc.TO_ROOM, + ) + handler_game.act( + "A lightning bolt leaps from your hand and arcs to $N.", + ch, + None, + victim, + merc.TO_CHAR, + ) + handler_game.act( + "A lightning bolt leaps from $n's hand and hits you! ", + ch, + None, + victim, + merc.TO_VICT, + ) dam = game_utils.dice(level, 6) if handler_magic.saves_spell(level, victim, merc.DAM_LIGHTNING): @@ -24,11 +42,18 @@ def spell_chain_lightning(sn, level, ch, victim, target): found = False for tmp_vict_id in ch.in_room.people: tmp_vict = instance.characters[tmp_vict_id] - if not fight.is_safe_spell(ch, tmp_vict, True) and tmp_vict is not last_vict: + if ( + not fight.is_safe_spell(ch, tmp_vict, True) + and tmp_vict is not last_vict + ): found = True last_vict = tmp_vict - handler_game.act("The bolt arcs to $n! ", tmp_vict, None, None, merc.TO_ROOM) - handler_game.act("The bolt hits you! ", tmp_vict, None, None, merc.TO_CHAR) + handler_game.act( + "The bolt arcs to $n! ", tmp_vict, None, None, merc.TO_ROOM + ) + handler_game.act( + "The bolt hits you! ", tmp_vict, None, None, merc.TO_CHAR + ) dam = game_utils.dice(level, 6) if handler_magic.saves_spell(level, tmp_vict, merc.DAM_LIGHTNING): dam = dam // 3 @@ -40,12 +65,22 @@ def spell_chain_lightning(sn, level, ch, victim, target): return if last_vict == ch: # no double hits */ - handler_game.act("The bolt seems to have fizzled out.", ch, None, None, merc.TO_ROOM) - handler_game.act("The bolt grounds out through your body.", ch, None, None, merc.TO_CHAR) + handler_game.act( + "The bolt seems to have fizzled out.", ch, None, None, merc.TO_ROOM + ) + handler_game.act( + "The bolt grounds out through your body.", + ch, + None, + None, + merc.TO_CHAR, + ) return last_vict = ch - handler_game.act("The bolt arcs to $n...whoops! ", ch, None, None, merc.TO_ROOM) + handler_game.act( + "The bolt arcs to $n...whoops! ", ch, None, None, merc.TO_ROOM + ) ch.send("You are struck by your own lightning! \n") dam = game_utils.dice(level, 6) if handler_magic.saves_spell(level, ch, merc.DAM_LIGHTNING): @@ -56,8 +91,20 @@ def spell_chain_lightning(sn, level, ch, victim, target): return -const.register_spell(const.skill_type("chain lightning", - {'mage': 33, 'cleric': 53, 'thief': 39, 'warrior': 36}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_chain_lightning, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(500), 25, 12, "lightning", "!Chain Lightning!", "")) +const.register_spell( + const.skill_type( + "chain lightning", + {"mage": 33, "cleric": 53, "thief": 39, "warrior": 36}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_chain_lightning, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(500), + 25, + 12, + "lightning", + "!Chain Lightning!", + "", + ) +) diff --git a/src/rom24/spells/spell_change_sex.py b/src/rom24/spells/spell_change_sex.py index 4819813..a43b8e7 100644 --- a/src/rom24/spells/spell_change_sex.py +++ b/src/rom24/spells/spell_change_sex.py @@ -12,7 +12,9 @@ def spell_change_sex(sn, level, ch, victim, target): if victim == ch: ch.send("You've already been changed.\n") else: - handler_game.act("$N has already had $s(?) sex changed.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N has already had $s(?) sex changed.", ch, None, victim, merc.TO_CHAR + ) return if handler_magic.saves_spell(level, victim, merc.DAM_OTHER): @@ -30,11 +32,25 @@ def spell_change_sex(sn, level, ch, victim, target): af.bitvector = 0 victim.affect_add(af) victim.send("You feel different.\n") - handler_game.act("$n doesn't look like $mself anymore...", victim, None, None, merc.TO_ROOM) - - -const.register_spell(const.skill_type("change sex", - {'mage': 53, 'cleric': 53, 'thief': 53, 'warrior': 53}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_change_sex, merc.TAR_CHAR_DEFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(82), 15, 12, "", "Your body feels familiar again.", "")) + handler_game.act( + "$n doesn't look like $mself anymore...", victim, None, None, merc.TO_ROOM + ) + + +const.register_spell( + const.skill_type( + "change sex", + {"mage": 53, "cleric": 53, "thief": 53, "warrior": 53}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_change_sex, + merc.TAR_CHAR_DEFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(82), + 15, + 12, + "", + "Your body feels familiar again.", + "", + ) +) diff --git a/src/rom24/spells/spell_charm_person.py b/src/rom24/spells/spell_charm_person.py index 515c044..6d394fe 100644 --- a/src/rom24/spells/spell_charm_person.py +++ b/src/rom24/spells/spell_charm_person.py @@ -16,11 +16,13 @@ def spell_charm_person(sn, level, ch, victim, target): ch.send("You like yourself even better! \n") return - if ( victim.is_affected( merc.AFF_CHARM) \ - or ch.is_affected(merc.AFF_CHARM) \ - or level < victim.level \ - or state_checks.IS_SET(victim.imm_flags, merc.IMM_CHARM) \ - or handler_magic.saves_spell(level, victim, merc.DAM_CHARM) ): + if ( + victim.is_affected(merc.AFF_CHARM) + or ch.is_affected(merc.AFF_CHARM) + or level < victim.level + or state_checks.IS_SET(victim.imm_flags, merc.IMM_CHARM) + or handler_magic.saves_spell(level, victim, merc.DAM_CHARM) + ): return if state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_LAW): @@ -40,16 +42,29 @@ def spell_charm_person(sn, level, ch, victim, target): af.modifier = 0 af.bitvector = merc.AFF_CHARM victim.affect_add(af) - #TODO: Known broken. Mob will immediately try to fight you after casting this, because this is an offensive spell. - #ROM had some stipulation to prevent this combat, possibly in fight.py:is_safe() + # TODO: Known broken. Mob will immediately try to fight you after casting this, because this is an offensive spell. + # ROM had some stipulation to prevent this combat, possibly in fight.py:is_safe() handler_game.act("Isn't $n just so nice?", ch, None, victim, merc.TO_VICT) if ch is not victim: - handler_game.act("$N looks at you with adoring eyes.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N looks at you with adoring eyes.", ch, None, victim, merc.TO_CHAR + ) -const.register_spell(const.skill_type("charm person", - {'mage': 20, 'cleric': 53, 'thief': 25, 'warrior': 53}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_charm_person, merc.TAR_CHAR_OFFENSIVE, merc.POS_STANDING, - None, const.SLOT(7), 5, 12, "", "You feel more self-confident.", "") +const.register_spell( + const.skill_type( + "charm person", + {"mage": 20, "cleric": 53, "thief": 25, "warrior": 53}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_charm_person, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_STANDING, + None, + const.SLOT(7), + 5, + 12, + "", + "You feel more self-confident.", + "", + ) ) diff --git a/src/rom24/spells/spell_chill_touch.py b/src/rom24/spells/spell_chill_touch.py index b5c33de..75ad49a 100644 --- a/src/rom24/spells/spell_chill_touch.py +++ b/src/rom24/spells/spell_chill_touch.py @@ -8,12 +8,59 @@ def spell_chill_touch(sn, level, ch, victim, target): - dam_each = [0, - 0, 0, 6, 7, 8, 9, 12, 13, 13, 13, - 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, - 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, - 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, - 24, 24, 24, 25, 25, 25, 26, 26, 26, 27] + dam_each = [ + 0, + 0, + 0, + 6, + 7, + 8, + 9, + 12, + 13, + 13, + 13, + 14, + 14, + 14, + 15, + 15, + 15, + 16, + 16, + 16, + 17, + 17, + 17, + 18, + 18, + 18, + 19, + 19, + 19, + 20, + 20, + 20, + 21, + 21, + 21, + 22, + 22, + 22, + 23, + 23, + 23, + 24, + 24, + 24, + 25, + 25, + 25, + 26, + 26, + 26, + 27, + ] level = min(level, len(dam_each) - 1) level = max(0, level) @@ -34,8 +81,20 @@ def spell_chill_touch(sn, level, ch, victim, target): fight.damage(ch, victim, dam, sn, merc.DAM_COLD, True) -const.register_spell(const.skill_type("chill touch", - {'mage': 4, 'cleric': 53, 'thief': 6, 'warrior': 6}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_chill_touch, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(8), 15, 12, "chilling touch", "You feel less cold.", "")) +const.register_spell( + const.skill_type( + "chill touch", + {"mage": 4, "cleric": 53, "thief": 6, "warrior": 6}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_chill_touch, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(8), + 15, + 12, + "chilling touch", + "You feel less cold.", + "", + ) +) diff --git a/src/rom24/spells/spell_colour_spray.py b/src/rom24/spells/spell_colour_spray.py index 6a2500a..3a05612 100644 --- a/src/rom24/spells/spell_colour_spray.py +++ b/src/rom24/spells/spell_colour_spray.py @@ -6,12 +6,59 @@ def spell_colour_spray(sn, level, ch, victim, target): - dam_each = [0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 30, 35, 40, 45, 50, 55, 55, 55, 56, 57, - 58, 58, 59, 60, 61, 61, 62, 63, 64, 64, - 65, 66, 67, 67, 68, 69, 70, 70, 71, 72, - 73, 73, 74, 75, 76, 76, 77, 78, 79, 79] + dam_each = [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 30, + 35, + 40, + 45, + 50, + 55, + 55, + 55, + 56, + 57, + 58, + 58, + 59, + 60, + 61, + 61, + 62, + 63, + 64, + 64, + 65, + 66, + 67, + 67, + 68, + 69, + 70, + 70, + 71, + 72, + 73, + 73, + 74, + 75, + 76, + 76, + 77, + 78, + 79, + 79, + ] level = min(level, len(dam_each) - 1) level = max(0, level) @@ -19,13 +66,27 @@ def spell_colour_spray(sn, level, ch, victim, target): if handler_magic.saves_spell(level, victim, merc.DAM_LIGHT): dam //= 2 else: - const.skill_table["blindness"].spell_fun('blindness', level // 2, ch, victim, merc.TARGET_CHAR) + const.skill_table["blindness"].spell_fun( + "blindness", level // 2, ch, victim, merc.TARGET_CHAR + ) fight.damage(ch, victim, dam, sn, merc.DAM_LIGHT, True) -const.register_spell(const.skill_type('colour spray', - {'mage': 16, 'cleric': 53, 'thief': 22, 'warrior': 20}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_colour_spray, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(10), 15, 12, "colour spray", "!Colour Spray!", "")) +const.register_spell( + const.skill_type( + "colour spray", + {"mage": 16, "cleric": 53, "thief": 22, "warrior": 20}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_colour_spray, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(10), + 15, + 12, + "colour spray", + "!Colour Spray!", + "", + ) +) diff --git a/src/rom24/spells/spell_continual_light.py b/src/rom24/spells/spell_continual_light.py index 1f6eeba..10b7654 100644 --- a/src/rom24/spells/spell_continual_light.py +++ b/src/rom24/spells/spell_continual_light.py @@ -21,14 +21,32 @@ def spell_continual_light(sn, level, ch, victim, target): handler_game.act("$p glows with a white light.", ch, light, None, merc.TO_ALL) return - light = object_creator.create_object(instance.item_templates[merc.OBJ_VNUM_LIGHT_BALL], 0) + light = object_creator.create_object( + instance.item_templates[merc.OBJ_VNUM_LIGHT_BALL], 0 + ) ch.in_room.put(light) - handler_game.act("$n twiddles $s thumbs and $p appears.", ch, light, None, merc.TO_ROOM) - handler_game.act("You twiddle your thumbs and $p appears.", ch, light, None, merc.TO_CHAR) - - -const.register_spell(const.skill_type("continual light", - {'mage': 6, 'cleric': 4, 'thief': 6, 'warrior': 9}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_continual_light, merc.TAR_IGNORE, merc.POS_STANDING, None, - const.SLOT(57), 7, 12, "", "!Continual Light!", "")) + handler_game.act( + "$n twiddles $s thumbs and $p appears.", ch, light, None, merc.TO_ROOM + ) + handler_game.act( + "You twiddle your thumbs and $p appears.", ch, light, None, merc.TO_CHAR + ) + + +const.register_spell( + const.skill_type( + "continual light", + {"mage": 6, "cleric": 4, "thief": 6, "warrior": 9}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_continual_light, + merc.TAR_IGNORE, + merc.POS_STANDING, + None, + const.SLOT(57), + 7, + 12, + "", + "!Continual Light!", + "", + ) +) diff --git a/src/rom24/spells/spell_control_weather.py b/src/rom24/spells/spell_control_weather.py index e3a5c88..5d829d7 100644 --- a/src/rom24/spells/spell_control_weather.py +++ b/src/rom24/spells/spell_control_weather.py @@ -16,8 +16,20 @@ def spell_control_weather(sn, level, ch, victim, target): return -const.register_spell(const.skill_type("control weather", - {'mage': 15, 'cleric': 19, 'thief': 28, 'warrior': 22}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_control_weather, merc.TAR_IGNORE, merc.POS_STANDING, - None, const.SLOT(11), 25, 12, "", "!Control Weather!", "")) +const.register_spell( + const.skill_type( + "control weather", + {"mage": 15, "cleric": 19, "thief": 28, "warrior": 22}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_control_weather, + merc.TAR_IGNORE, + merc.POS_STANDING, + None, + const.SLOT(11), + 25, + 12, + "", + "!Control Weather!", + "", + ) +) diff --git a/src/rom24/spells/spell_create_food.py b/src/rom24/spells/spell_create_food.py index 3cf6649..d043a70 100644 --- a/src/rom24/spells/spell_create_food.py +++ b/src/rom24/spells/spell_create_food.py @@ -3,8 +3,11 @@ from rom24 import merc from rom24 import object_creator + def spell_create_food(sn, level, ch, victim, target): - mushroom = object_creator.create_item(instance.item_templates[merc.OBJ_VNUM_MUSHROOM], 0) + mushroom = object_creator.create_item( + instance.item_templates[merc.OBJ_VNUM_MUSHROOM], 0 + ) mushroom.value[0] = level // 2 mushroom.value[1] = level ch.in_room.put(mushroom) @@ -13,8 +16,20 @@ def spell_create_food(sn, level, ch, victim, target): return -const.register_spell(const.skill_type("create food", - {'mage': 10, 'cleric': 5, 'thief': 11, 'warrior': 12}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_create_food, merc.TAR_IGNORE, merc.POS_STANDING, None, - const.SLOT(12), 5, 12, "", "!Create Food!", "")) +const.register_spell( + const.skill_type( + "create food", + {"mage": 10, "cleric": 5, "thief": 11, "warrior": 12}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_create_food, + merc.TAR_IGNORE, + merc.POS_STANDING, + None, + const.SLOT(12), + 5, + 12, + "", + "!Create Food!", + "", + ) +) diff --git a/src/rom24/spells/spell_create_rose.py b/src/rom24/spells/spell_create_rose.py index e5f2238..a868c23 100644 --- a/src/rom24/spells/spell_create_rose.py +++ b/src/rom24/spells/spell_create_rose.py @@ -6,13 +6,27 @@ def spell_create_rose(sn, level, ch, victim, target): rose = object_creator.create_item(instance.item_templates[merc.OBJ_VNUM_ROSE], 0) - handler_game.act("$n has created a beautiful red rose.", ch, rose, None, merc.TO_ROOM) + handler_game.act( + "$n has created a beautiful red rose.", ch, rose, None, merc.TO_ROOM + ) ch.send("You create a beautiful red rose.\n") ch.put(rose) -const.register_spell(const.skill_type("create rose", - {'mage': 16, 'cleric': 11, 'thief': 10, 'warrior': 24}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_create_rose, merc.TAR_IGNORE, merc.POS_STANDING, None, - const.SLOT(511), 30, 12, "", "!Create Rose!", "")) +const.register_spell( + const.skill_type( + "create rose", + {"mage": 16, "cleric": 11, "thief": 10, "warrior": 24}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_create_rose, + merc.TAR_IGNORE, + merc.POS_STANDING, + None, + const.SLOT(511), + 30, + 12, + "", + "!Create Rose!", + "", + ) +) diff --git a/src/rom24/spells/spell_create_spring.py b/src/rom24/spells/spell_create_spring.py index 455c44c..be78f95 100644 --- a/src/rom24/spells/spell_create_spring.py +++ b/src/rom24/spells/spell_create_spring.py @@ -5,15 +5,29 @@ def spell_create_spring(sn, level, ch, victim, target): - spring = object_creator.create_item(instance.item_templates[merc.OBJ_VNUM_SPRING], 0) + spring = object_creator.create_item( + instance.item_templates[merc.OBJ_VNUM_SPRING], 0 + ) spring.timer = level ch.in_room.put(spring) handler_game.act("$p flows from the ground.", ch, spring, None, merc.TO_ROOM) handler_game.act("$p flows from the ground.", ch, spring, None, merc.TO_CHAR) -const.register_spell(const.skill_type("create spring", - {'mage': 14, 'cleric': 17, 'thief': 23, 'warrior': 20}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_create_spring, merc.TAR_IGNORE, merc.POS_STANDING, None, - const.SLOT(80), 20, 12, "", "!Create Spring!", "")) +const.register_spell( + const.skill_type( + "create spring", + {"mage": 14, "cleric": 17, "thief": 23, "warrior": 20}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_create_spring, + merc.TAR_IGNORE, + merc.POS_STANDING, + None, + const.SLOT(80), + 20, + 12, + "", + "!Create Spring!", + "", + ) +) diff --git a/src/rom24/spells/spell_create_water.py b/src/rom24/spells/spell_create_water.py index 7a9b485..d0c7429 100644 --- a/src/rom24/spells/spell_create_water.py +++ b/src/rom24/spells/spell_create_water.py @@ -13,7 +13,10 @@ def spell_create_water(sn, level, ch, victim, target): ch.send("It contains some other liquid.\n") return - water = min(level * (4 if handler_game.weather_info.sky >= merc.SKY_RAINING else 2), obj.value[0] - obj.value[1]) + water = min( + level * (4 if handler_game.weather_info.sky >= merc.SKY_RAINING else 2), + obj.value[0] - obj.value[1], + ) if water > 0: obj.value[2] = LIQ_WATER @@ -24,8 +27,20 @@ def spell_create_water(sn, level, ch, victim, target): handler_game.act("$p is filled.", ch, obj, None, merc.TO_CHAR) -const.register_spell(const.skill_type("create water", - {'mage': 8, 'cleric': 3, 'thief': 12, 'warrior': 11}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_create_water, merc.TAR_OBJ_INV, merc.POS_STANDING, None, - const.SLOT(13), 5, 12, "", "!Create Water!", "")) +const.register_spell( + const.skill_type( + "create water", + {"mage": 8, "cleric": 3, "thief": 12, "warrior": 11}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_create_water, + merc.TAR_OBJ_INV, + merc.POS_STANDING, + None, + const.SLOT(13), + 5, + 12, + "", + "!Create Water!", + "", + ) +) diff --git a/src/rom24/spells/spell_cure_blindness.py b/src/rom24/spells/spell_cure_blindness.py index 6790beb..18540d8 100644 --- a/src/rom24/spells/spell_cure_blindness.py +++ b/src/rom24/spells/spell_cure_blindness.py @@ -6,22 +6,36 @@ def spell_cure_blindness(sn, level, ch, victim, target): - if not state_checks.is_affected(victim, const.skill_table['blindness']): + if not state_checks.is_affected(victim, const.skill_table["blindness"]): if victim == ch: ch.send("You aren't blind.\n") else: - handler_game.act("$N doesn't appear to be blinded.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N doesn't appear to be blinded.", ch, None, victim, merc.TO_CHAR + ) return - if handler_magic.check_dispel(level, victim, const.skill_table['blindness']): + if handler_magic.check_dispel(level, victim, const.skill_table["blindness"]): victim.send("Your vision returns!\n") handler_game.act("$n is no longer blinded.", victim, None, None, merc.TO_ROOM) else: ch.send("Spell failed.\n") -const.register_spell(const.skill_type("cure blindness", - {'mage': 53, 'cleric': 6, 'thief': 53, 'warrior': 8}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_cure_blindness, merc.TAR_CHAR_DEFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(14), 5, 12, "", "!Cure Blindness!", "")) +const.register_spell( + const.skill_type( + "cure blindness", + {"mage": 53, "cleric": 6, "thief": 53, "warrior": 8}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_cure_blindness, + merc.TAR_CHAR_DEFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(14), + 5, + 12, + "", + "!Cure Blindness!", + "", + ) +) diff --git a/src/rom24/spells/spell_cure_critical.py b/src/rom24/spells/spell_cure_critical.py index 05ff0dd..62fc894 100644 --- a/src/rom24/spells/spell_cure_critical.py +++ b/src/rom24/spells/spell_cure_critical.py @@ -13,8 +13,20 @@ def spell_cure_critical(sn, level, ch, victim, target): ch.send("Ok.\n") -const.register_spell(const.skill_type("cure critical", - {'mage': 53, 'cleric': 13, 'thief': 53, 'warrior': 19}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_cure_critical, merc.TAR_CHAR_DEFENSIVE, merc.POS_FIGHTING, None, - const.SLOT(15), 20, 12, "", "!Cure Critical!", "")) +const.register_spell( + const.skill_type( + "cure critical", + {"mage": 53, "cleric": 13, "thief": 53, "warrior": 19}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_cure_critical, + merc.TAR_CHAR_DEFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(15), + 20, + 12, + "", + "!Cure Critical!", + "", + ) +) diff --git a/src/rom24/spells/spell_cure_disease.py b/src/rom24/spells/spell_cure_disease.py index 2a76307..6ca2f4e 100644 --- a/src/rom24/spells/spell_cure_disease.py +++ b/src/rom24/spells/spell_cure_disease.py @@ -6,23 +6,39 @@ def spell_cure_disease(sn, level, ch, victim, target): - if not state_checks.is_affected(victim, const.skill_table['plague']): + if not state_checks.is_affected(victim, const.skill_table["plague"]): if victim == ch: ch.send("You aren't ill.\n") else: - handler_game.act("$N doesn't appear to be diseased.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N doesn't appear to be diseased.", ch, None, victim, merc.TO_CHAR + ) return - if handler_magic.check_dispel(level, victim, const.skill_table['plague']): + if handler_magic.check_dispel(level, victim, const.skill_table["plague"]): victim.send("Your sores vanish.\n") - handler_game.act("$n looks relieved as $s sores vanish.", victim, None, None, merc.TO_ROOM) + handler_game.act( + "$n looks relieved as $s sores vanish.", victim, None, None, merc.TO_ROOM + ) return ch.send("Spell failed.\n") -const.register_spell(const.skill_type("cure disease", - {'mage': 53, 'cleric': 13, 'thief': 53, 'warrior': 14}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_cure_disease, merc.TAR_CHAR_DEFENSIVE, merc.POS_STANDING, - None, const.SLOT(501), 20, 12, "", "!Cure Disease!", "")) +const.register_spell( + const.skill_type( + "cure disease", + {"mage": 53, "cleric": 13, "thief": 53, "warrior": 14}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_cure_disease, + merc.TAR_CHAR_DEFENSIVE, + merc.POS_STANDING, + None, + const.SLOT(501), + 20, + 12, + "", + "!Cure Disease!", + "", + ) +) diff --git a/src/rom24/spells/spell_cure_light.py b/src/rom24/spells/spell_cure_light.py index a6e2f87..1c27001 100644 --- a/src/rom24/spells/spell_cure_light.py +++ b/src/rom24/spells/spell_cure_light.py @@ -14,8 +14,20 @@ def spell_cure_light(sn, level, ch, victim, target): return -const.register_spell(const.skill_type("cure light", - {'mage': 53, 'cleric': 1, 'thief': 53, 'warrior': 3}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_cure_light, merc.TAR_CHAR_DEFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(16), 10, 12, "", "!Cure Light!", "")) +const.register_spell( + const.skill_type( + "cure light", + {"mage": 53, "cleric": 1, "thief": 53, "warrior": 3}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_cure_light, + merc.TAR_CHAR_DEFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(16), + 10, + 12, + "", + "!Cure Light!", + "", + ) +) diff --git a/src/rom24/spells/spell_cure_poison.py b/src/rom24/spells/spell_cure_poison.py index 003c736..0a1f927 100644 --- a/src/rom24/spells/spell_cure_poison.py +++ b/src/rom24/spells/spell_cure_poison.py @@ -6,14 +6,16 @@ def spell_cure_poison(sn, level, ch, victim, target): - if not state_checks.is_affected(victim, const.skill_table['poison']): + if not state_checks.is_affected(victim, const.skill_table["poison"]): if victim == ch: ch.send("You aren't poisoned.\n") else: - handler_game.act("$N doesn't appear to be poisoned.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N doesn't appear to be poisoned.", ch, None, victim, merc.TO_CHAR + ) return - if handler_magic.check_dispel(level, victim, const.skill_table['poison']): + if handler_magic.check_dispel(level, victim, const.skill_table["poison"]): victim.send("A warm feeling runs through your body.\n") handler_game.act("$n looks much better.", victim, None, None, merc.TO_ROOM) return @@ -21,8 +23,20 @@ def spell_cure_poison(sn, level, ch, victim, target): ch.send("Spell failed.\n") -const.register_spell(const.skill_type("cure poison", - {'mage': 53, 'cleric': 14, 'thief': 53, 'warrior': 16}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_cure_poison, merc.TAR_CHAR_DEFENSIVE, merc.POS_STANDING, - None, const.SLOT(43), 5, 12, "", "!Cure Poison!", "")) +const.register_spell( + const.skill_type( + "cure poison", + {"mage": 53, "cleric": 14, "thief": 53, "warrior": 16}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_cure_poison, + merc.TAR_CHAR_DEFENSIVE, + merc.POS_STANDING, + None, + const.SLOT(43), + 5, + 12, + "", + "!Cure Poison!", + "", + ) +) diff --git a/src/rom24/spells/spell_cure_serious.py b/src/rom24/spells/spell_cure_serious.py index 3ecbc36..78b4b6f 100644 --- a/src/rom24/spells/spell_cure_serious.py +++ b/src/rom24/spells/spell_cure_serious.py @@ -13,8 +13,20 @@ def spell_cure_serious(sn, level, ch, victim, target): ch.send("Ok.\n") -const.register_spell(const.skill_type("cure serious", - {'mage': 53, 'cleric': 7, 'thief': 53, 'warrior': 10}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_cure_serious, merc.TAR_CHAR_DEFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(61), 15, 12, "", "!Cure Serious!", "")) +const.register_spell( + const.skill_type( + "cure serious", + {"mage": 53, "cleric": 7, "thief": 53, "warrior": 10}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_cure_serious, + merc.TAR_CHAR_DEFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(61), + 15, + 12, + "", + "!Cure Serious!", + "", + ) +) diff --git a/src/rom24/spells/spell_curse.py b/src/rom24/spells/spell_curse.py index 62f7b29..67bd928 100644 --- a/src/rom24/spells/spell_curse.py +++ b/src/rom24/spells/spell_curse.py @@ -10,20 +10,31 @@ def spell_curse(sn, level, ch, victim, target): if target == merc.TARGET_ITEM: obj = victim if obj.flags.evil: - handler_game.act("$p is already filled with evil.", ch, obj, None, merc.TO_CHAR) + handler_game.act( + "$p is already filled with evil.", ch, obj, None, merc.TO_CHAR + ) return if obj.flags.bless: paf = state_checks.affect_find(obj.affected, const.skill_table["bless"]) - if not handler_magic.saves_dispel(level, paf.level if paf is not None else obj.level, 0): + if not handler_magic.saves_dispel( + level, paf.level if paf is not None else obj.level, 0 + ): if paf: obj.affect_remove(paf) - handler_game.act("$p glows with a red aura.", ch, obj, None, merc.TO_ALL) + handler_game.act( + "$p glows with a red aura.", ch, obj, None, merc.TO_ALL + ) state_checks.REMOVE_BIT(obj.extra_flags, merc.ITEM_BLESS) return else: - handler_game.act("The holy aura of $p is too powerful for you to overcome.", ch, obj, None, - merc.TO_CHAR) + handler_game.act( + "The holy aura of $p is too powerful for you to overcome.", + ch, + obj, + None, + merc.TO_CHAR, + ) return af = handler_game.AFFECT_DATA() af.where = merc.TO_OBJECT @@ -42,7 +53,9 @@ def spell_curse(sn, level, ch, victim, target): return # character curses */ - if victim.is_affected( merc.AFF_CURSE) or handler_magic.saves_spell(level, victim, merc.DAM_NEGATIVE): + if victim.is_affected(merc.AFF_CURSE) or handler_magic.saves_spell( + level, victim, merc.DAM_NEGATIVE + ): return af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS @@ -63,8 +76,20 @@ def spell_curse(sn, level, ch, victim, target): handler_game.act("$N looks very uncomfortable.", ch, None, victim, merc.TO_CHAR) -const.register_spell(const.skill_type("curse", - {'mage': 18, 'cleric': 18, 'thief': 26, 'warrior': 22}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_curse, merc.TAR_OBJ_CHAR_OFF, merc.POS_FIGHTING, None, - const.SLOT(17), 20, 12, "curse", "The curse wears off.", "$p is no longer impure.")) +const.register_spell( + const.skill_type( + "curse", + {"mage": 18, "cleric": 18, "thief": 26, "warrior": 22}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_curse, + merc.TAR_OBJ_CHAR_OFF, + merc.POS_FIGHTING, + None, + const.SLOT(17), + 20, + 12, + "curse", + "The curse wears off.", + "$p is no longer impure.", + ) +) diff --git a/src/rom24/spells/spell_demonfire.py b/src/rom24/spells/spell_demonfire.py index 5aeb43e..8c5f112 100644 --- a/src/rom24/spells/spell_demonfire.py +++ b/src/rom24/spells/spell_demonfire.py @@ -15,18 +15,44 @@ def spell_demonfire(sn, level, ch, victim, target): ch.alignment = max(-1000, ch.alignment - 50) if victim != ch: - handler_game.act("$n calls forth the demons of Hell upon $N! ", ch, None, victim, merc.TO_ROOM) - handler_game.act("$n has assailed you with the demons of Hell! ", ch, None, victim, merc.TO_VICT) + handler_game.act( + "$n calls forth the demons of Hell upon $N! ", + ch, + None, + victim, + merc.TO_ROOM, + ) + handler_game.act( + "$n has assailed you with the demons of Hell! ", + ch, + None, + victim, + merc.TO_VICT, + ) ch.send("You conjure forth the demons of hell! \n") dam = game_utils.dice(level, 10) if handler_magic.saves_spell(level, victim, merc.DAM_NEGATIVE): dam = dam // 2 fight.damage(ch, victim, dam, sn, merc.DAM_NEGATIVE, True) - const.skill_table['curse'].spell_fun('curse', 3 * level // 4, ch, victim, merc.TARGET_CHAR) + const.skill_table["curse"].spell_fun( + "curse", 3 * level // 4, ch, victim, merc.TARGET_CHAR + ) -const.register_spell(const.skill_type("demonfire", - {'mage': 53, 'cleric': 34, 'thief': 53, 'warrior': 45}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_demonfire, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(505), 20, 12, "torments", "!Demonfire!", "")) +const.register_spell( + const.skill_type( + "demonfire", + {"mage": 53, "cleric": 34, "thief": 53, "warrior": 45}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_demonfire, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(505), + 20, + 12, + "torments", + "!Demonfire!", + "", + ) +) diff --git a/src/rom24/spells/spell_detect_evil.py b/src/rom24/spells/spell_detect_evil.py index 3b97f81..bf59ad8 100644 --- a/src/rom24/spells/spell_detect_evil.py +++ b/src/rom24/spells/spell_detect_evil.py @@ -4,11 +4,13 @@ def spell_detect_evil(sn, level, ch, victim, target): - if victim.is_affected( merc.AFF_DETECT_EVIL): + if victim.is_affected(merc.AFF_DETECT_EVIL): if victim == ch: ch.send("You can already sense evil.\n") else: - handler_game.act("$N can already detect evil.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N can already detect evil.", ch, None, victim, merc.TO_CHAR + ) return af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS @@ -24,8 +26,20 @@ def spell_detect_evil(sn, level, ch, victim, target): ch.send("Ok.\n") -const.register_spell(const.skill_type("detect evil", - {'mage': 11, 'cleric': 4, 'thief': 12, 'warrior': 53}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_detect_evil, merc.TAR_CHAR_SELF, merc.POS_STANDING, None, - const.SLOT(18), 5, 12, "", "The red in your vision disappears.", "")) +const.register_spell( + const.skill_type( + "detect evil", + {"mage": 11, "cleric": 4, "thief": 12, "warrior": 53}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_detect_evil, + merc.TAR_CHAR_SELF, + merc.POS_STANDING, + None, + const.SLOT(18), + 5, + 12, + "", + "The red in your vision disappears.", + "", + ) +) diff --git a/src/rom24/spells/spell_detect_good.py b/src/rom24/spells/spell_detect_good.py index 284a194..bb84d0b 100644 --- a/src/rom24/spells/spell_detect_good.py +++ b/src/rom24/spells/spell_detect_good.py @@ -4,11 +4,13 @@ def spell_detect_good(sn, level, ch, victim, target): - if victim.is_affected( merc.AFF_DETECT_GOOD): + if victim.is_affected(merc.AFF_DETECT_GOOD): if victim == ch: ch.send("You can already sense good.\n") else: - handler_game.act("$N can already detect good.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N can already detect good.", ch, None, victim, merc.TO_CHAR + ) return af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS @@ -24,8 +26,20 @@ def spell_detect_good(sn, level, ch, victim, target): ch.send("Ok.\n") -const.register_spell(const.skill_type("detect good", - {'mage': 11, 'cleric': 4, 'thief': 12, 'warrior': 53}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_detect_good, merc.TAR_CHAR_SELF, merc.POS_STANDING, None, - const.SLOT(513), 5, 12, "", "The gold in your vision disappears.", "")) +const.register_spell( + const.skill_type( + "detect good", + {"mage": 11, "cleric": 4, "thief": 12, "warrior": 53}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_detect_good, + merc.TAR_CHAR_SELF, + merc.POS_STANDING, + None, + const.SLOT(513), + 5, + 12, + "", + "The gold in your vision disappears.", + "", + ) +) diff --git a/src/rom24/spells/spell_detect_hidden.py b/src/rom24/spells/spell_detect_hidden.py index d65d0a8..91e8054 100644 --- a/src/rom24/spells/spell_detect_hidden.py +++ b/src/rom24/spells/spell_detect_hidden.py @@ -4,11 +4,13 @@ def spell_detect_hidden(sn, level, ch, victim, target): - if victim.is_affected( merc.AFF_DETECT_HIDDEN): + if victim.is_affected(merc.AFF_DETECT_HIDDEN): if victim == ch: ch.send("You are already as alert as you can be. \n") else: - handler_game.act("$N can already sense hidden lifeforms.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N can already sense hidden lifeforms.", ch, None, victim, merc.TO_CHAR + ) return af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS @@ -24,8 +26,20 @@ def spell_detect_hidden(sn, level, ch, victim, target): ch.send("Ok.\n") -const.register_spell(const.skill_type("detect hidden", - {'mage': 15, 'cleric': 11, 'thief': 12, 'warrior': 53}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_detect_hidden, merc.TAR_CHAR_SELF, merc.POS_STANDING, None, - const.SLOT(44), 5, 12, "", "You feel less aware of your surroundings.", "")) +const.register_spell( + const.skill_type( + "detect hidden", + {"mage": 15, "cleric": 11, "thief": 12, "warrior": 53}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_detect_hidden, + merc.TAR_CHAR_SELF, + merc.POS_STANDING, + None, + const.SLOT(44), + 5, + 12, + "", + "You feel less aware of your surroundings.", + "", + ) +) diff --git a/src/rom24/spells/spell_detect_invis.py b/src/rom24/spells/spell_detect_invis.py index d1cb210..8bcf4a1 100644 --- a/src/rom24/spells/spell_detect_invis.py +++ b/src/rom24/spells/spell_detect_invis.py @@ -4,11 +4,13 @@ def spell_detect_invis(sn, level, ch, victim, target): - if victim.is_affected( merc.AFF_DETECT_INVIS): + if victim.is_affected(merc.AFF_DETECT_INVIS): if victim == ch: ch.send("You can already see invisible.\n") else: - handler_game.act("$N can already see invisible things.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N can already see invisible things.", ch, None, victim, merc.TO_CHAR + ) return af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS @@ -24,8 +26,20 @@ def spell_detect_invis(sn, level, ch, victim, target): ch.send("Ok.\n") -const.register_spell(const.skill_type("detect invis", - {'mage': 3, 'cleric': 8, 'thief': 6, 'warrior': 53}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_detect_invis, merc.TAR_CHAR_SELF, merc.POS_STANDING, - None, const.SLOT(19), 5, 12, "", "You no longer see invisible objects.", "")) +const.register_spell( + const.skill_type( + "detect invis", + {"mage": 3, "cleric": 8, "thief": 6, "warrior": 53}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_detect_invis, + merc.TAR_CHAR_SELF, + merc.POS_STANDING, + None, + const.SLOT(19), + 5, + 12, + "", + "You no longer see invisible objects.", + "", + ) +) diff --git a/src/rom24/spells/spell_detect_magic.py b/src/rom24/spells/spell_detect_magic.py index 39ff07b..781008b 100644 --- a/src/rom24/spells/spell_detect_magic.py +++ b/src/rom24/spells/spell_detect_magic.py @@ -4,11 +4,13 @@ def spell_detect_magic(sn, level, ch, victim, target): - if victim.is_affected( merc.AFF_DETECT_MAGIC): + if victim.is_affected(merc.AFF_DETECT_MAGIC): if victim == ch: ch.send("You can already sense magical auras.\n") else: - handler_game.act("$N can already detect magic.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N can already detect magic.", ch, None, victim, merc.TO_CHAR + ) return af = handler_game.AFFECT_DATA() @@ -25,8 +27,20 @@ def spell_detect_magic(sn, level, ch, victim, target): ch.send("Ok.\n") -const.register_spell(const.skill_type("detect magic", - {'mage': 2, 'cleric': 6, 'thief': 5, 'warrior': 53}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_detect_magic, merc.TAR_CHAR_SELF, merc.POS_STANDING, None, - const.SLOT(20), 5, 12, "", "The detect magic wears off.", "")) +const.register_spell( + const.skill_type( + "detect magic", + {"mage": 2, "cleric": 6, "thief": 5, "warrior": 53}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_detect_magic, + merc.TAR_CHAR_SELF, + merc.POS_STANDING, + None, + const.SLOT(20), + 5, + 12, + "", + "The detect magic wears off.", + "", + ) +) diff --git a/src/rom24/spells/spell_detect_poison.py b/src/rom24/spells/spell_detect_poison.py index 110b1ef..4453ac1 100644 --- a/src/rom24/spells/spell_detect_poison.py +++ b/src/rom24/spells/spell_detect_poison.py @@ -1,4 +1,3 @@ - from rom24 import const from rom24 import merc @@ -14,8 +13,20 @@ def spell_detect_poison(sn, level, ch, victim, target): return -const.register_spell(const.skill_type("detect poison", - {'mage': 15, 'cleric': 7, 'thief': 9, 'warrior': 53}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_detect_poison, merc.TAR_OBJ_INV, merc.POS_STANDING, None, - const.SLOT(21), 5, 12, "", "!Detect Poison!", "")) +const.register_spell( + const.skill_type( + "detect poison", + {"mage": 15, "cleric": 7, "thief": 9, "warrior": 53}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_detect_poison, + merc.TAR_OBJ_INV, + merc.POS_STANDING, + None, + const.SLOT(21), + 5, + 12, + "", + "!Detect Poison!", + "", + ) +) diff --git a/src/rom24/spells/spell_dispel_evil.py b/src/rom24/spells/spell_dispel_evil.py index 4f18ab0..848b2f6 100644 --- a/src/rom24/spells/spell_dispel_evil.py +++ b/src/rom24/spells/spell_dispel_evil.py @@ -16,7 +16,9 @@ def spell_dispel_evil(sn, level, ch, victim, target): return if state_checks.IS_NEUTRAL(victim): - handler_game.act("$N does not seem to be affected.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N does not seem to be affected.", ch, None, victim, merc.TO_CHAR + ) return if victim.hit > (ch.level * 4): @@ -28,8 +30,20 @@ def spell_dispel_evil(sn, level, ch, victim, target): fight.damage(ch, victim, dam, sn, merc.DAM_HOLY, True) -const.register_spell(const.skill_type("dispel evil", - {'mage': 53, 'cleric': 15, 'thief': 53, 'warrior': 21}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_dispel_evil, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(22), 15, 12, "dispel evil", "!Dispel Evil!", "")) +const.register_spell( + const.skill_type( + "dispel evil", + {"mage": 53, "cleric": 15, "thief": 53, "warrior": 21}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_dispel_evil, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(22), + 15, + 12, + "dispel evil", + "!Dispel Evil!", + "", + ) +) diff --git a/src/rom24/spells/spell_dispel_good.py b/src/rom24/spells/spell_dispel_good.py index 326e9c4..b312188 100644 --- a/src/rom24/spells/spell_dispel_good.py +++ b/src/rom24/spells/spell_dispel_good.py @@ -16,7 +16,9 @@ def spell_dispel_good(sn, level, ch, victim, target): return if state_checks.IS_NEUTRAL(victim): - handler_game.act("$N does not seem to be affected.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N does not seem to be affected.", ch, None, victim, merc.TO_CHAR + ) return if victim.hit > (ch.level * 4): @@ -28,8 +30,20 @@ def spell_dispel_good(sn, level, ch, victim, target): fight.damage(ch, victim, dam, sn, merc.DAM_NEGATIVE, True) -const.register_spell(const.skill_type("dispel good", - {'mage': 53, 'cleric': 15, 'thief': 53, 'warrior': 21}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_dispel_good, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(512), 15, 12, "dispel good", "!Dispel Good!", "")) +const.register_spell( + const.skill_type( + "dispel good", + {"mage": 53, "cleric": 15, "thief": 53, "warrior": 21}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_dispel_good, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(512), + 15, + 12, + "dispel good", + "!Dispel Good!", + "", + ) +) diff --git a/src/rom24/spells/spell_dispel_magic.py b/src/rom24/spells/spell_dispel_magic.py index bbb0f88..2757901 100644 --- a/src/rom24/spells/spell_dispel_magic.py +++ b/src/rom24/spells/spell_dispel_magic.py @@ -12,36 +12,38 @@ def spell_dispel_magic(sn, level, ch, victim, target): ch.send("You failed.\n") return - spells = {'armor': None, - 'bless': None, - 'blindness': '$n is no longer blinded', - 'calm': '$n no longer looks so peaceful...', - 'change sex': '$n looks more like $mself again.', - 'charm person': '$n regains $s free will.', - 'chill touch': '$n looks warmer', - 'curse': None, - 'detect evil': None, - 'detect good': None, - 'detect hidden': None, - 'detect invis': None, - 'detect magic': None, - 'faerie fire': "$n's outline fades", - 'fly': '$n falls to the ground! ', - 'frenzy': "$n no longer looks so wild.", - 'giant strength': "$n no longer looks so mighty.", - 'haste': '$n is no longer moving so quickly', - 'infravision': None, - 'invis': '$n fades into existence.', - 'mass invis': '$n fades into existence', - 'pass door': None, - 'protection evil': None, - 'protection good': None, - 'sanctuary': "The white aura around $n's body vanishes.", - 'shield': 'The shield protecting $n vanishes', - 'sleep': None, - 'slow': '$n is no longer moving so slowly.', - 'stone skin': "$n's skin regains its normal texture.", - 'weaken': "$n looks stronger."} + spells = { + "armor": None, + "bless": None, + "blindness": "$n is no longer blinded", + "calm": "$n no longer looks so peaceful...", + "change sex": "$n looks more like $mself again.", + "charm person": "$n regains $s free will.", + "chill touch": "$n looks warmer", + "curse": None, + "detect evil": None, + "detect good": None, + "detect hidden": None, + "detect invis": None, + "detect magic": None, + "faerie fire": "$n's outline fades", + "fly": "$n falls to the ground! ", + "frenzy": "$n no longer looks so wild.", + "giant strength": "$n no longer looks so mighty.", + "haste": "$n is no longer moving so quickly", + "infravision": None, + "invis": "$n fades into existence.", + "mass invis": "$n fades into existence", + "pass door": None, + "protection evil": None, + "protection good": None, + "sanctuary": "The white aura around $n's body vanishes.", + "shield": "The shield protecting $n vanishes", + "sleep": None, + "slow": "$n is no longer moving so slowly.", + "stone skin": "$n's skin regains its normal texture.", + "weaken": "$n looks stronger.", + } for k, v in spells.items(): if handler_magic.check_dispel(level, victim, const.skill_table[k]): @@ -49,12 +51,19 @@ def spell_dispel_magic(sn, level, ch, victim, target): handler_game.act(v, victim, None, None, merc.TO_ROOM) found = True - if victim.is_affected( - merc.AFF_SANCTUARY) and not handler_magic.saves_dispel(level, victim.level, -1) and not state_checks.is_affected(victim, - const.skill_table[ - "sanctuary"]): + if ( + victim.is_affected(merc.AFF_SANCTUARY) + and not handler_magic.saves_dispel(level, victim.level, -1) + and not state_checks.is_affected(victim, const.skill_table["sanctuary"]) + ): state_checks.REMOVE_BIT(victim.affected_by, merc.AFF_SANCTUARY) - handler_game.act("The white aura around $n's body vanishes.", victim, None, None, merc.TO_ROOM) + handler_game.act( + "The white aura around $n's body vanishes.", + victim, + None, + None, + merc.TO_ROOM, + ) found = True if found: @@ -63,8 +72,20 @@ def spell_dispel_magic(sn, level, ch, victim, target): ch.send("Spell failed.\n") -const.register_spell(const.skill_type("dispel magic", - {'mage': 16, 'cleric': 24, 'thief': 30, 'warrior': 30}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_dispel_magic, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(59), 15, 12, "", "!Dispel Magic!", "")) +const.register_spell( + const.skill_type( + "dispel magic", + {"mage": 16, "cleric": 24, "thief": 30, "warrior": 30}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_dispel_magic, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(59), + 15, + 12, + "", + "!Dispel Magic!", + "", + ) +) diff --git a/src/rom24/spells/spell_earthquake.py b/src/rom24/spells/spell_earthquake.py index 1090d79..8461a18 100644 --- a/src/rom24/spells/spell_earthquake.py +++ b/src/rom24/spells/spell_earthquake.py @@ -8,7 +8,9 @@ def spell_earthquake(sn, level, ch, victim, target): ch.send("The earth trembles beneath your feet! \n") - handler_game.act("$n makes the earth tremble and shiver.", ch, None, None, merc.TO_ROOM) + handler_game.act( + "$n makes the earth tremble and shiver.", ch, None, None, merc.TO_ROOM + ) for vch in instance.characters.values(): if not vch.in_room: @@ -18,15 +20,29 @@ def spell_earthquake(sn, level, ch, victim, target): if state_checks.IS_AFFECTED(vch, merc.AFF_FLYING): fight.damage(ch, vch, 0, sn, merc.DAM_BASH, True) else: - fight.damage(ch, vch, level + game_utils.dice(2, 8), sn, merc.DAM_BASH, True) + fight.damage( + ch, vch, level + game_utils.dice(2, 8), sn, merc.DAM_BASH, True + ) continue if vch.in_room.area == ch.in_room.area: vch.send("The earth trembles and shivers.\n") -const.register_spell(const.skill_type("earthquake", - {'mage': 53, 'cleric': 10, 'thief': 53, 'warrior': 14}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_earthquake, merc.TAR_IGNORE, merc.POS_FIGHTING, - None, const.SLOT(23), 15, 12, "earthquake", "!Earthquake!", "")) +const.register_spell( + const.skill_type( + "earthquake", + {"mage": 53, "cleric": 10, "thief": 53, "warrior": 14}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_earthquake, + merc.TAR_IGNORE, + merc.POS_FIGHTING, + None, + const.SLOT(23), + 15, + 12, + "earthquake", + "!Earthquake!", + "", + ) +) diff --git a/src/rom24/spells/spell_enchant_armor.py b/src/rom24/spells/spell_enchant_armor.py index d1a0026..9b08a10 100644 --- a/src/rom24/spells/spell_enchant_armor.py +++ b/src/rom24/spells/spell_enchant_armor.py @@ -48,12 +48,18 @@ def spell_enchant_armor(sn, level, ch, victim, target): # the moment of truth */ if result < (fail // 5): # item destroyed */ - handler_game.act("$p flares blindingly... and evaporates! ", ch, obj, None, merc.TO_CHAR) - handler_game.act("$p flares blindingly... and evaporates! ", ch, obj, None, merc.TO_ROOM) + handler_game.act( + "$p flares blindingly... and evaporates! ", ch, obj, None, merc.TO_CHAR + ) + handler_game.act( + "$p flares blindingly... and evaporates! ", ch, obj, None, merc.TO_ROOM + ) obj.extract() if result < (fail // 3): # item disenchanted */ - handler_game.act("$p glows brightly, then fades...oops.", ch, obj, None, merc.TO_CHAR) + handler_game.act( + "$p glows brightly, then fades...oops.", ch, obj, None, merc.TO_CHAR + ) handler_game.act("$p glows brightly, then fades.", ch, obj, None, merc.TO_ROOM) obj.enchanted = True @@ -68,7 +74,6 @@ def spell_enchant_armor(sn, level, ch, victim, target): ch.send("Nothing seemed to happen.\n") return - # okay, move all the old flags into new vectors if we have to */ if not obj.enchanted: obj.enchanted = True @@ -118,8 +123,20 @@ def spell_enchant_armor(sn, level, ch, victim, target): obj.affected.append(paf) -const.register_spell(const.skill_type("enchant armor", - {'mage': 16, 'cleric': 53, 'thief': 53, 'warrior': 53}, - {'mage': 2, 'cleric': 2, 'thief': 4, 'warrior': 4}, - spell_enchant_armor, merc.TAR_OBJ_INV, merc.POS_STANDING, None, - const.SLOT(510), 100, 24, "", "!Enchant Armor!", "")) +const.register_spell( + const.skill_type( + "enchant armor", + {"mage": 16, "cleric": 53, "thief": 53, "warrior": 53}, + {"mage": 2, "cleric": 2, "thief": 4, "warrior": 4}, + spell_enchant_armor, + merc.TAR_OBJ_INV, + merc.POS_STANDING, + None, + const.SLOT(510), + 100, + 24, + "", + "!Enchant Armor!", + "", + ) +) diff --git a/src/rom24/spells/spell_enchant_weapon.py b/src/rom24/spells/spell_enchant_weapon.py index 5e5e768..98541ab 100644 --- a/src/rom24/spells/spell_enchant_weapon.py +++ b/src/rom24/spells/spell_enchant_weapon.py @@ -54,13 +54,19 @@ def spell_enchant_weapon(sn, level, ch, victim, target): # the moment of truth */ if result < (fail // 5): # item destroyed */ - handler_game.act("$p shivers violently and explodes! ", ch, obj, None, merc.TO_CHAR) - handler_game.act("$p shivers violently and explodeds! ", ch, obj, None, merc.TO_ROOM) + handler_game.act( + "$p shivers violently and explodes! ", ch, obj, None, merc.TO_CHAR + ) + handler_game.act( + "$p shivers violently and explodeds! ", ch, obj, None, merc.TO_ROOM + ) obj.extract() return if result < (fail // 2): # item disenchanted */ - handler_game.act("$p glows brightly, then fades...oops.", ch, obj, None, merc.TO_CHAR) + handler_game.act( + "$p glows brightly, then fades...oops.", ch, obj, None, merc.TO_CHAR + ) handler_game.act("$p glows brightly, then fades.", ch, obj, None, merc.TO_ROOM) obj.enchanted = True # remove all affects */ @@ -143,8 +149,20 @@ def spell_enchant_weapon(sn, level, ch, victim, target): obj.affected.append(paf) -const.register_spell(const.skill_type("enchant weapon", - {'mage': 17, 'cleric': 53, 'thief': 53, 'warrior': 53}, - {'mage': 2, 'cleric': 2, 'thief': 4, 'warrior': 4}, - spell_enchant_weapon, merc.TAR_OBJ_INV, merc.POS_STANDING, - None, const.SLOT(24), 100, 24, "", "!Enchant Weapon!", "")) +const.register_spell( + const.skill_type( + "enchant weapon", + {"mage": 17, "cleric": 53, "thief": 53, "warrior": 53}, + {"mage": 2, "cleric": 2, "thief": 4, "warrior": 4}, + spell_enchant_weapon, + merc.TAR_OBJ_INV, + merc.POS_STANDING, + None, + const.SLOT(24), + 100, + 24, + "", + "!Enchant Weapon!", + "", + ) +) diff --git a/src/rom24/spells/spell_energy_drain.py b/src/rom24/spells/spell_energy_drain.py index 16ebaf7..3fc2b4a 100644 --- a/src/rom24/spells/spell_energy_drain.py +++ b/src/rom24/spells/spell_energy_drain.py @@ -30,8 +30,20 @@ def spell_energy_drain(sn, level, ch, victim, target): fight.damage(ch, victim, dam, sn, merc.DAM_NEGATIVE, True) -const.register_spell(const.skill_type("energy drain", - {'mage': 19, 'cleric': 22, 'thief': 26, 'warrior': 23}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_energy_drain, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(25), 35, 12, "energy drain", "!Energy Drain!", "")) +const.register_spell( + const.skill_type( + "energy drain", + {"mage": 19, "cleric": 22, "thief": 26, "warrior": 23}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_energy_drain, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(25), + 35, + 12, + "energy drain", + "!Energy Drain!", + "", + ) +) diff --git a/src/rom24/spells/spell_faerie_fire.py b/src/rom24/spells/spell_faerie_fire.py index e809c2a..5efe5ad 100644 --- a/src/rom24/spells/spell_faerie_fire.py +++ b/src/rom24/spells/spell_faerie_fire.py @@ -4,7 +4,7 @@ def spell_faerie_fire(sn, level, ch, victim, target): - if victim.is_affected( merc.AFF_FAERIE_FIRE): + if victim.is_affected(merc.AFF_FAERIE_FIRE): return af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS @@ -16,11 +16,25 @@ def spell_faerie_fire(sn, level, ch, victim, target): af.bitvector = merc.AFF_FAERIE_FIRE victim.affect_add(af) victim.send("You are surrounded by a pink outline.\n") - handler_game.act("$n is surrounded by a pink outline.", victim, None, None, merc.TO_ROOM) + handler_game.act( + "$n is surrounded by a pink outline.", victim, None, None, merc.TO_ROOM + ) -const.register_spell(const.skill_type("faerie fire", - {'mage': 6, 'cleric': 3, 'thief': 5, 'warrior': 8}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_faerie_fire, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(72), 5, 12, "faerie fire", "The pink aura around you fades away.", "")) +const.register_spell( + const.skill_type( + "faerie fire", + {"mage": 6, "cleric": 3, "thief": 5, "warrior": 8}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_faerie_fire, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(72), + 5, + 12, + "faerie fire", + "The pink aura around you fades away.", + "", + ) +) diff --git a/src/rom24/spells/spell_faerie_fog.py b/src/rom24/spells/spell_faerie_fog.py index 10cb761..02211cd 100644 --- a/src/rom24/spells/spell_faerie_fog.py +++ b/src/rom24/spells/spell_faerie_fog.py @@ -6,7 +6,9 @@ def spell_faerie_fog(sn, level, ch, victim, target): - handler_game.act("$n conjures a cloud of purple smoke.", ch, None, None, merc.TO_ROOM) + handler_game.act( + "$n conjures a cloud of purple smoke.", ch, None, None, merc.TO_ROOM + ) ch.send("You conjure a cloud of purple smoke.\n") for ich_id in ch.in_room.people: @@ -18,9 +20,9 @@ def spell_faerie_fog(sn, level, ch, victim, target): if ich == ch or handler_magic.saves_spell(level, ich, merc.DAM_OTHER): continue - ich.affect_strip('invis') - ich.affect_strip('mass_invis') - ich.affect_strip('sneak') + ich.affect_strip("invis") + ich.affect_strip("mass_invis") + ich.affect_strip("sneak") ich.affected_by.rem_bit(merc.AFF_HIDE) ich.affected_by.rem_bit(merc.AFF_INVISIBLE) ich.affected_by.rem_bit(merc.AFF_SNEAK) @@ -28,8 +30,20 @@ def spell_faerie_fog(sn, level, ch, victim, target): ich.send("You are revealed! \n") -const.register_spell(const.skill_type("faerie fog", - {'mage': 14, 'cleric': 21, 'thief': 16, 'warrior': 24}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_faerie_fog, merc.TAR_IGNORE, merc.POS_STANDING, None, - const.SLOT(73), 12, 12, "faerie fog", "!Faerie Fog!", "")) +const.register_spell( + const.skill_type( + "faerie fog", + {"mage": 14, "cleric": 21, "thief": 16, "warrior": 24}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_faerie_fog, + merc.TAR_IGNORE, + merc.POS_STANDING, + None, + const.SLOT(73), + 12, + 12, + "faerie fog", + "!Faerie Fog!", + "", + ) +) diff --git a/src/rom24/spells/spell_farsight.py b/src/rom24/spells/spell_farsight.py index 59ed367..7014e24 100644 --- a/src/rom24/spells/spell_farsight.py +++ b/src/rom24/spells/spell_farsight.py @@ -11,8 +11,20 @@ def spell_farsight(sn, level, ch, victim, target): ch.do_scan(handler_magic.target_name) -const.register_spell(const.skill_type("farsight", - {'mage': 14, 'cleric': 16, 'thief': 16, 'warrior': 53}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_farsight, merc.TAR_IGNORE, merc.POS_STANDING, None, - const.SLOT(521), 36, 20, "farsight", "!Farsight!", "")) +const.register_spell( + const.skill_type( + "farsight", + {"mage": 14, "cleric": 16, "thief": 16, "warrior": 53}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_farsight, + merc.TAR_IGNORE, + merc.POS_STANDING, + None, + const.SLOT(521), + 36, + 20, + "farsight", + "!Farsight!", + "", + ) +) diff --git a/src/rom24/spells/spell_fire_breath.py b/src/rom24/spells/spell_fire_breath.py index c3960cd..a4cc76c 100644 --- a/src/rom24/spells/spell_fire_breath.py +++ b/src/rom24/spells/spell_fire_breath.py @@ -10,8 +10,12 @@ def spell_fire_breath(sn, level, ch, victim, target): - handler_game.act("$n breathes forth a cone of fire.", ch, None, victim, merc.TO_NOTVICT) - handler_game.act("$n breathes a cone of hot fire over you! ", ch, None, victim, merc.TO_VICT) + handler_game.act( + "$n breathes forth a cone of fire.", ch, None, victim, merc.TO_NOTVICT + ) + handler_game.act( + "$n breathes a cone of hot fire over you! ", ch, None, victim, merc.TO_VICT + ) handler_game.act("You breath forth a cone of fire.", ch, None, None, merc.TO_CHAR) hpch = max(10, ch.hit) @@ -22,7 +26,9 @@ def spell_fire_breath(sn, level, ch, victim, target): effects.fire_effect(victim.in_room, level, dam // 2, merc.TARGET_ROOM) for vch in victim.in_room.people[:]: - if fight.is_safe_spell(ch, vch, True) or (vch.is_npc() and ch.is_npc() and (ch.fighting != vch or vch.fighting != ch)): + if fight.is_safe_spell(ch, vch, True) or ( + vch.is_npc() and ch.is_npc() and (ch.fighting != vch or vch.fighting != ch) + ): continue if vch == victim: # full damage */ @@ -41,8 +47,20 @@ def spell_fire_breath(sn, level, ch, victim, target): fight.damage(ch, vch, dam // 2, sn, merc.DAM_FIRE, True) -const.register_spell(const.skill_type("fire breath", - {'mage': 40, 'cleric': 45, 'thief': 50, 'warrior': 51}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_fire_breath, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(201), 200, 24, "blast of flame", "The smoke leaves your eyes.", "")) +const.register_spell( + const.skill_type( + "fire breath", + {"mage": 40, "cleric": 45, "thief": 50, "warrior": 51}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_fire_breath, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(201), + 200, + 24, + "blast of flame", + "The smoke leaves your eyes.", + "", + ) +) diff --git a/src/rom24/spells/spell_fireball.py b/src/rom24/spells/spell_fireball.py index 13ae90c..6b55649 100644 --- a/src/rom24/spells/spell_fireball.py +++ b/src/rom24/spells/spell_fireball.py @@ -6,12 +6,59 @@ def spell_fireball(sn, level, ch, victim, target): - dam_each = [0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 30, 35, 40, 45, 50, 55, - 60, 65, 70, 75, 80, 82, 84, 86, 88, 90, - 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, - 112, 114, 116, 118, 120, 122, 124, 126, 128, 130] + dam_each = [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 30, + 35, + 40, + 45, + 50, + 55, + 60, + 65, + 70, + 75, + 80, + 82, + 84, + 86, + 88, + 90, + 92, + 94, + 96, + 98, + 100, + 102, + 104, + 106, + 108, + 110, + 112, + 114, + 116, + 118, + 120, + 122, + 124, + 126, + 128, + 130, + ] level = min(level, len(dam_each) - 1) level = max(0, level) @@ -21,8 +68,20 @@ def spell_fireball(sn, level, ch, victim, target): fight.damage(ch, victim, dam, sn, merc.DAM_FIRE, True) -const.register_spell(const.skill_type("fireball", - {'mage': 22, 'cleric': 53, 'thief': 30, 'warrior': 26}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_fireball, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, None, - const.SLOT(26), 15, 12, "fireball", "!Fireball!", "")) +const.register_spell( + const.skill_type( + "fireball", + {"mage": 22, "cleric": 53, "thief": 30, "warrior": 26}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_fireball, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(26), + 15, + 12, + "fireball", + "!Fireball!", + "", + ) +) diff --git a/src/rom24/spells/spell_fireproof.py b/src/rom24/spells/spell_fireproof.py index a79710b..d758123 100644 --- a/src/rom24/spells/spell_fireproof.py +++ b/src/rom24/spells/spell_fireproof.py @@ -1,5 +1,3 @@ - - from rom24 import const from rom24 import game_utils from rom24 import handler_game @@ -10,7 +8,9 @@ def spell_fireproof(sn, level, ch, victim, target): obj = victim if obj.flags.burn_proof: - handler_game.act("$p is already protected from burning.", ch, obj, None, merc.TO_CHAR) + handler_game.act( + "$p is already protected from burning.", ch, obj, None, merc.TO_CHAR + ) return af = handler_game.AFFECT_DATA() af.where = merc.TO_OBJECT @@ -24,11 +24,25 @@ def spell_fireproof(sn, level, ch, victim, target): obj.affect_add(af) handler_game.act("You protect $p from fire.", ch, obj, None, merc.TO_CHAR) - handler_game.act("$p is surrounded by a protective aura.", ch, obj, None, merc.TO_ROOM) - - -const.register_spell(const.skill_type("fireproof", - {'mage': 13, 'cleric': 12, 'thief': 19, 'warrior': 18}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_fireproof, merc.TAR_OBJ_INV, merc.POS_STANDING, None, - const.SLOT(523), 10, 12, "", "", "$p's protective aura fades.")) + handler_game.act( + "$p is surrounded by a protective aura.", ch, obj, None, merc.TO_ROOM + ) + + +const.register_spell( + const.skill_type( + "fireproof", + {"mage": 13, "cleric": 12, "thief": 19, "warrior": 18}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_fireproof, + merc.TAR_OBJ_INV, + merc.POS_STANDING, + None, + const.SLOT(523), + 10, + 12, + "", + "", + "$p's protective aura fades.", + ) +) diff --git a/src/rom24/spells/spell_flamestrike.py b/src/rom24/spells/spell_flamestrike.py index 7d8b58b..93db532 100644 --- a/src/rom24/spells/spell_flamestrike.py +++ b/src/rom24/spells/spell_flamestrike.py @@ -12,8 +12,20 @@ def spell_flamestrike(sn, level, ch, victim, target): fight.damage(ch, victim, dam, sn, merc.DAM_FIRE, True) -const.register_spell(const.skill_type("flamestrike", - {'mage': 53, 'cleric': 20, 'thief': 53, 'warrior': 27}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_flamestrike, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(65), 20, 12, "flamestrike", "!Flamestrike!", "")) +const.register_spell( + const.skill_type( + "flamestrike", + {"mage": 53, "cleric": 20, "thief": 53, "warrior": 27}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_flamestrike, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(65), + 20, + 12, + "flamestrike", + "!Flamestrike!", + "", + ) +) diff --git a/src/rom24/spells/spell_floating_disc.py b/src/rom24/spells/spell_floating_disc.py index 77b9dd0..2f70da3 100644 --- a/src/rom24/spells/spell_floating_disc.py +++ b/src/rom24/spells/spell_floating_disc.py @@ -18,14 +18,28 @@ def spell_floating_disc(sn, level, ch, victim, target): disc.value[3] = ch.level * 5 # 5 pounds per level max per item */ disc.timer = ch.level * 2 - random.randint(0, level // 2) - handler_game.act("$n has created a floating black disc.", ch, None, None, merc.TO_ROOM) + handler_game.act( + "$n has created a floating black disc.", ch, None, None, merc.TO_ROOM + ) ch.send("You create a floating disc.\n") ch.put(disc) ch.equip(disc, True, True) -const.register_spell(const.skill_type("floating disc", - {'mage': 4, 'cleric': 10, 'thief': 7, 'warrior': 16}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_floating_disc, merc.TAR_IGNORE, merc.POS_STANDING, None, - const.SLOT(522), 40, 24, "", "!Floating disc!", "")) +const.register_spell( + const.skill_type( + "floating disc", + {"mage": 4, "cleric": 10, "thief": 7, "warrior": 16}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_floating_disc, + merc.TAR_IGNORE, + merc.POS_STANDING, + None, + const.SLOT(522), + 40, + 24, + "", + "!Floating disc!", + "", + ) +) diff --git a/src/rom24/spells/spell_fly.py b/src/rom24/spells/spell_fly.py index 2fb1f0a..5c1b4bb 100644 --- a/src/rom24/spells/spell_fly.py +++ b/src/rom24/spells/spell_fly.py @@ -4,11 +4,13 @@ def spell_fly(sn, level, ch, victim, target): - if victim.is_affected( merc.AFF_FLYING): + if victim.is_affected(merc.AFF_FLYING): if victim == ch: ch.send("You are already airborne.\n") else: - handler_game.act("$N doesn't need your help to fly.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N doesn't need your help to fly.", ch, None, victim, merc.TO_CHAR + ) return af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS @@ -24,8 +26,20 @@ def spell_fly(sn, level, ch, victim, target): return -const.register_spell(const.skill_type("fly", - {'mage': 10, 'cleric': 18, 'thief': 20, 'warrior': 22}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_fly, merc.TAR_CHAR_DEFENSIVE, merc.POS_STANDING, None, - const.SLOT(56), 10, 18, "", "You slowly float to the ground.", "")) +const.register_spell( + const.skill_type( + "fly", + {"mage": 10, "cleric": 18, "thief": 20, "warrior": 22}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_fly, + merc.TAR_CHAR_DEFENSIVE, + merc.POS_STANDING, + None, + const.SLOT(56), + 10, + 18, + "", + "You slowly float to the ground.", + "", + ) +) diff --git a/src/rom24/spells/spell_frenzy.py b/src/rom24/spells/spell_frenzy.py index 51d35c6..5d1ba97 100644 --- a/src/rom24/spells/spell_frenzy.py +++ b/src/rom24/spells/spell_frenzy.py @@ -6,23 +6,35 @@ def spell_frenzy(sn, level, ch, victim, target): # RT clerical berserking spell */ - if state_checks.is_affected(victim, sn) or victim.is_affected( merc.AFF_BERSERK): + if state_checks.is_affected(victim, sn) or victim.is_affected(merc.AFF_BERSERK): if victim == ch: ch.send("You are already in a frenzy.\n") else: - handler_game.act("$N is already in a frenzy.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N is already in a frenzy.", ch, None, victim, merc.TO_CHAR + ) return - if state_checks.is_affected(victim, const.skill_table['calm']): + if state_checks.is_affected(victim, const.skill_table["calm"]): if victim == ch: ch.send("Why don't you just relax for a while?\n") else: - handler_game.act("$N doesn't look like $e wants to fight anymore.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N doesn't look like $e wants to fight anymore.", + ch, + None, + victim, + merc.TO_CHAR, + ) return - if (ch.is_good() and not state_checks.IS_GOOD(victim)) or \ - (state_checks.IS_NEUTRAL(ch) and not state_checks.IS_NEUTRAL(victim)) or \ - (ch.is_evil() and not state_checks.IS_EVIL(victim)): - handler_game.act("Your god doesn't seem to like $N", ch, None, victim, merc.TO_CHAR) + if ( + (ch.is_good() and not state_checks.IS_GOOD(victim)) + or (state_checks.IS_NEUTRAL(ch) and not state_checks.IS_NEUTRAL(victim)) + or (ch.is_evil() and not state_checks.IS_EVIL(victim)) + ): + handler_game.act( + "Your god doesn't seem to like $N", ch, None, victim, merc.TO_CHAR + ) return af = handler_game.AFFECT_DATA() @@ -44,11 +56,25 @@ def spell_frenzy(sn, level, ch, victim, target): victim.affect_add(af) victim.send("You are filled with holy wrath! \n") - handler_game.act("$n gets a wild look in $s eyes! ", victim, None, None, merc.TO_ROOM) + handler_game.act( + "$n gets a wild look in $s eyes! ", victim, None, None, merc.TO_ROOM + ) -const.register_spell(const.skill_type("frenzy", - {'mage': 53, 'cleric': 24, 'thief': 53, 'warrior': 26}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_frenzy, merc.TAR_CHAR_DEFENSIVE, merc.POS_STANDING, None, - const.SLOT(504), 30, 24, "", "Your rage ebbs.", "")) +const.register_spell( + const.skill_type( + "frenzy", + {"mage": 53, "cleric": 24, "thief": 53, "warrior": 26}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_frenzy, + merc.TAR_CHAR_DEFENSIVE, + merc.POS_STANDING, + None, + const.SLOT(504), + 30, + 24, + "", + "Your rage ebbs.", + "", + ) +) diff --git a/src/rom24/spells/spell_frost_breath.py b/src/rom24/spells/spell_frost_breath.py index 892a125..4c66617 100644 --- a/src/rom24/spells/spell_frost_breath.py +++ b/src/rom24/spells/spell_frost_breath.py @@ -10,8 +10,16 @@ def spell_frost_breath(sn, level, ch, victim, target): - handler_game.act("$n breathes out a freezing cone of frost! ", ch, None, victim, merc.TO_NOTVICT) - handler_game.act("$n breathes a freezing cone of frost over you! ", ch, None, victim, merc.TO_VICT) + handler_game.act( + "$n breathes out a freezing cone of frost! ", ch, None, victim, merc.TO_NOTVICT + ) + handler_game.act( + "$n breathes a freezing cone of frost over you! ", + ch, + None, + victim, + merc.TO_VICT, + ) handler_game.act("You breath out a cone of frost.", ch, None, None, merc.TO_CHAR) hpch = max(12, ch.hit) @@ -22,7 +30,9 @@ def spell_frost_breath(sn, level, ch, victim, target): effects.cold_effect(victim.in_room, level, dam // 2, merc.TARGET_ROOM) for vch in victim.in_room.people[:]: - if fight.is_safe_spell(ch, vch, True) or (vch.is_npc() and ch.is_npc() and (ch.fighting != vch or vch.fighting != ch)): + if fight.is_safe_spell(ch, vch, True) or ( + vch.is_npc() and ch.is_npc() and (ch.fighting != vch or vch.fighting != ch) + ): continue if vch == victim: # full damage */ @@ -41,8 +51,20 @@ def spell_frost_breath(sn, level, ch, victim, target): fight.damage(ch, vch, dam // 2, sn, merc.DAM_COLD, True) -const.register_spell(const.skill_type("frost breath", - {'mage': 34, 'cleric': 36, 'thief': 38, 'warrior': 40}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_frost_breath, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(202), 125, 24, "blast of frost", "!Frost Breath!", "")) +const.register_spell( + const.skill_type( + "frost breath", + {"mage": 34, "cleric": 36, "thief": 38, "warrior": 40}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_frost_breath, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(202), + 125, + 24, + "blast of frost", + "!Frost Breath!", + "", + ) +) diff --git a/src/rom24/spells/spell_gas_breath.py b/src/rom24/spells/spell_gas_breath.py index 9874cb5..0b15bd4 100644 --- a/src/rom24/spells/spell_gas_breath.py +++ b/src/rom24/spells/spell_gas_breath.py @@ -10,8 +10,12 @@ def spell_gas_breath(sn, level, ch, victim, target): - handler_game.act("$n breathes out a cloud of poisonous gas! ", ch, None, None, merc.TO_ROOM) - handler_game.act("You breath out a cloud of poisonous gas.", ch, None, None, merc.TO_CHAR) + handler_game.act( + "$n breathes out a cloud of poisonous gas! ", ch, None, None, merc.TO_ROOM + ) + handler_game.act( + "You breath out a cloud of poisonous gas.", ch, None, None, merc.TO_CHAR + ) hpch = max(16, ch.hit) hp_dam = random.randint(hpch // 15 + 1, 8) @@ -23,7 +27,9 @@ def spell_gas_breath(sn, level, ch, victim, target): for vch_id in ch.in_room.people: vch = instance.characters[vch_id] - if fight.is_safe_spell(ch, vch, True) or (ch.is_npc() and vch.is_npc() and (ch.fighting == vch or vch.fighting == ch)): + if fight.is_safe_spell(ch, vch, True) or ( + ch.is_npc() and vch.is_npc() and (ch.fighting == vch or vch.fighting == ch) + ): continue if handler_magic.saves_spell(level, vch, merc.DAM_POISON): @@ -34,8 +40,20 @@ def spell_gas_breath(sn, level, ch, victim, target): fight.damage(ch, vch, dam, sn, merc.DAM_POISON, True) -const.register_spell(const.skill_type("gas breath", - {'mage': 39, 'cleric': 43, 'thief': 47, 'warrior': 50}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_gas_breath, merc.TAR_IGNORE, merc.POS_FIGHTING, None, - const.SLOT(203), 175, 24, "blast of gas", "!Gas Breath!", "")) +const.register_spell( + const.skill_type( + "gas breath", + {"mage": 39, "cleric": 43, "thief": 47, "warrior": 50}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_gas_breath, + merc.TAR_IGNORE, + merc.POS_FIGHTING, + None, + const.SLOT(203), + 175, + 24, + "blast of gas", + "!Gas Breath!", + "", + ) +) diff --git a/src/rom24/spells/spell_gate.py b/src/rom24/spells/spell_gate.py index 07a7fd1..aa2530a 100644 --- a/src/rom24/spells/spell_gate.py +++ b/src/rom24/spells/spell_gate.py @@ -8,20 +8,24 @@ def spell_gate(sn, level, ch, victim, target): # RT ROM-style gate */ victim = ch.get_char_world(handler_magic.target_name) - if not victim \ - or victim == ch \ - or victim.in_room == None \ - or not ch.can_see_room(victim.in_room.instance_id) \ - or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_SAFE) \ - or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_PRIVATE) \ - or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_SOLITARY) \ - or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_NO_RECALL) \ - or state_checks.IS_SET(ch.in_room.room_flags, merc.ROOM_NO_RECALL) \ - or victim.level >= level + 3 \ - or (victim.is_clan() and not ch.is_same_clan(victim)) \ - or (not victim.is_npc() and victim.level >= merc.LEVEL_HERO) \ - or (victim.is_npc() and victim.imm_flags.is_set(merc.IMM_SUMMON)) \ - or (victim.is_npc() and handler_magic.saves_spell(level, victim, merc.DAM_OTHER) ): + if ( + not victim + or victim == ch + or victim.in_room == None + or not ch.can_see_room(victim.in_room.instance_id) + or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_SAFE) + or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_PRIVATE) + or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_SOLITARY) + or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_NO_RECALL) + or state_checks.IS_SET(ch.in_room.room_flags, merc.ROOM_NO_RECALL) + or victim.level >= level + 3 + or (victim.is_clan() and not ch.is_same_clan(victim)) + or (not victim.is_npc() and victim.level >= merc.LEVEL_HERO) + or (victim.is_npc() and victim.imm_flags.is_set(merc.IMM_SUMMON)) + or ( + victim.is_npc() and handler_magic.saves_spell(level, victim, merc.DAM_OTHER) + ) + ): ch.send("You failed.\n") return @@ -30,7 +34,9 @@ def spell_gate(sn, level, ch, victim, target): else: gate_pet = False - handler_game.act("$n steps through a gate and vanishes.", ch, None, None, merc.TO_ROOM) + handler_game.act( + "$n steps through a gate and vanishes.", ch, None, None, merc.TO_ROOM + ) ch.send("You step through a gate and vanish.\n") ch.in_room.get(ch) victim.in_room.put(ch) @@ -39,16 +45,32 @@ def spell_gate(sn, level, ch, victim, target): ch.do_look("auto") if gate_pet: - handler_game.act("$n steps through a gate and vanishes.", ch.pet, None, None, merc.TO_ROOM) + handler_game.act( + "$n steps through a gate and vanishes.", ch.pet, None, None, merc.TO_ROOM + ) instance.characters[ch.pet].send("You step through a gate and vanish.\n") instance.characters[ch.pet].in_room.get(instance.characters[ch.pet]) ch.in_room.put(instance.characters[ch.pet]) - handler_game.act("$n has arrived through a gate.", ch.pet, None, None, merc.TO_ROOM) + handler_game.act( + "$n has arrived through a gate.", ch.pet, None, None, merc.TO_ROOM + ) ch.pet.do_look("auto") -const.register_spell(const.skill_type("gate", - {'mage': 27, 'cleric': 17, 'thief': 32, 'warrior': 28}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_gate, merc.TAR_IGNORE, merc.POS_FIGHTING, None, const.SLOT(83), - 80, 12, "", "!Gate!", "")) +const.register_spell( + const.skill_type( + "gate", + {"mage": 27, "cleric": 17, "thief": 32, "warrior": 28}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_gate, + merc.TAR_IGNORE, + merc.POS_FIGHTING, + None, + const.SLOT(83), + 80, + 12, + "", + "!Gate!", + "", + ) +) diff --git a/src/rom24/spells/spell_general_purpose.py b/src/rom24/spells/spell_general_purpose.py index 296d898..e5224b1 100644 --- a/src/rom24/spells/spell_general_purpose.py +++ b/src/rom24/spells/spell_general_purpose.py @@ -13,8 +13,20 @@ def spell_general_purpose(sn, level, ch, victim, target): return -const.register_spell(const.skill_type("general purpose", - {'mage': 53, 'cleric': 53, 'thief': 53, 'warrior': 53}, - {'mage': 0, 'cleric': 0, 'thief': 0, 'warrior': 0}, - spell_general_purpose, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(401), 0, 12, "general purpose ammo", "!General Purpose Ammo!", "")) +const.register_spell( + const.skill_type( + "general purpose", + {"mage": 53, "cleric": 53, "thief": 53, "warrior": 53}, + {"mage": 0, "cleric": 0, "thief": 0, "warrior": 0}, + spell_general_purpose, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(401), + 0, + 12, + "general purpose ammo", + "!General Purpose Ammo!", + "", + ) +) diff --git a/src/rom24/spells/spell_giant_strength.py b/src/rom24/spells/spell_giant_strength.py index 383bed3..ca7dc05 100644 --- a/src/rom24/spells/spell_giant_strength.py +++ b/src/rom24/spells/spell_giant_strength.py @@ -9,7 +9,9 @@ def spell_giant_strength(sn, level, ch, victim, target): if victim == ch: ch.send("You are already as strong as you can get! \n") else: - handler_game.act("$N can't get any stronger.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N can't get any stronger.", ch, None, victim, merc.TO_CHAR + ) return af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS @@ -21,11 +23,25 @@ def spell_giant_strength(sn, level, ch, victim, target): af.bitvector = 0 victim.affect_add(af) victim.send("Your muscles surge with heightened power! \n") - handler_game.act("$n's muscles surge with heightened power.", victim, None, None, merc.TO_ROOM) + handler_game.act( + "$n's muscles surge with heightened power.", victim, None, None, merc.TO_ROOM + ) -const.register_spell(const.skill_type("giant strength", - {'mage': 11, 'cleric': 53, 'thief': 22, 'warrior': 20}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_giant_strength, merc.TAR_CHAR_DEFENSIVE, merc.POS_STANDING, - None, const.SLOT(39), 20, 12, "", "You feel weaker.", "")) +const.register_spell( + const.skill_type( + "giant strength", + {"mage": 11, "cleric": 53, "thief": 22, "warrior": 20}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_giant_strength, + merc.TAR_CHAR_DEFENSIVE, + merc.POS_STANDING, + None, + const.SLOT(39), + 20, + 12, + "", + "You feel weaker.", + "", + ) +) diff --git a/src/rom24/spells/spell_harm.py b/src/rom24/spells/spell_harm.py index 241c139..ec19c1e 100644 --- a/src/rom24/spells/spell_harm.py +++ b/src/rom24/spells/spell_harm.py @@ -13,8 +13,20 @@ def spell_harm(sn, level, ch, victim, target): fight.damage(ch, victim, dam, sn, merc.DAM_HARM, True) -const.register_spell(const.skill_type("harm", - {'mage': 53, 'cleric': 23, 'thief': 53, 'warrior': 28}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_harm, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, None, - const.SLOT(27), 35, 12, "harm spell", "!Harm!", "")) +const.register_spell( + const.skill_type( + "harm", + {"mage": 53, "cleric": 23, "thief": 53, "warrior": 28}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_harm, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(27), + 35, + 12, + "harm spell", + "!Harm!", + "", + ) +) diff --git a/src/rom24/spells/spell_haste.py b/src/rom24/spells/spell_haste.py index 45c460c..58c42cd 100644 --- a/src/rom24/spells/spell_haste.py +++ b/src/rom24/spells/spell_haste.py @@ -7,13 +7,23 @@ def spell_haste(sn, level, ch, victim, target): # RT haste spell */ - if state_checks.is_affected(victim, sn) or victim.is_affected( merc.AFF_HASTE) or (victim.is_npc() and state_checks.IS_SET(victim.off_flags,merc.OFF_FAST)): + if ( + state_checks.is_affected(victim, sn) + or victim.is_affected(merc.AFF_HASTE) + or (victim.is_npc() and state_checks.IS_SET(victim.off_flags, merc.OFF_FAST)) + ): if victim == ch: ch.send("You can't move any faster! \n") else: - handler_game.act("$N is already moving as fast as $E can.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N is already moving as fast as $E can.", + ch, + None, + victim, + merc.TO_CHAR, + ) return - if victim.is_affected( merc.AFF_SLOW): + if victim.is_affected(merc.AFF_SLOW): if not handler_magic.check_dispel(level, victim, const.skill_table["slow"]): if victim != ch: ch.send("Spell failed.\n") @@ -39,8 +49,20 @@ def spell_haste(sn, level, ch, victim, target): ch.send("Ok.\n") -const.register_spell(const.skill_type("haste", - {'mage': 21, 'cleric': 53, 'thief': 26, 'warrior': 29}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_haste, merc.TAR_CHAR_DEFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(502), 30, 12, "", "You feel yourself slow down.", "")) +const.register_spell( + const.skill_type( + "haste", + {"mage": 21, "cleric": 53, "thief": 26, "warrior": 29}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_haste, + merc.TAR_CHAR_DEFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(502), + 30, + 12, + "", + "You feel yourself slow down.", + "", + ) +) diff --git a/src/rom24/spells/spell_heal.py b/src/rom24/spells/spell_heal.py index 40ec3fe..d276170 100644 --- a/src/rom24/spells/spell_heal.py +++ b/src/rom24/spells/spell_heal.py @@ -12,8 +12,20 @@ def spell_heal(sn, level, ch, victim, target): return -const.register_spell(const.skill_type("heal", - {'mage': 53, 'cleric': 21, 'thief': 33, 'warrior': 30}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_heal, merc.TAR_CHAR_DEFENSIVE, merc.POS_FIGHTING, None, - const.SLOT(28), 50, 12, "", "!Heal!", "")) +const.register_spell( + const.skill_type( + "heal", + {"mage": 53, "cleric": 21, "thief": 33, "warrior": 30}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_heal, + merc.TAR_CHAR_DEFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(28), + 50, + 12, + "", + "!Heal!", + "", + ) +) diff --git a/src/rom24/spells/spell_heat_metal.py b/src/rom24/spells/spell_heat_metal.py index fdadf7f..c29e448 100644 --- a/src/rom24/spells/spell_heat_metal.py +++ b/src/rom24/spells/spell_heat_metal.py @@ -11,55 +11,103 @@ def spell_heat_metal(sn, level, ch, victim, target): fail = True - if not handler_magic.saves_spell(level + 2, victim, merc.DAM_FIRE) \ - and not state_checks.IS_SET(victim.imm_flags, merc.IMM_FIRE): + if not handler_magic.saves_spell( + level + 2, victim, merc.DAM_FIRE + ) and not state_checks.IS_SET(victim.imm_flags, merc.IMM_FIRE): total_items = set({}) total_items.update([an_item for an_item in victim.equipped.values()]) total_items.update(victim.contents) for item_id in total_items: item = instance.items[item_id] - if random.randint(1, 2 * level) > item.level \ - and not handler_magic.saves_spell(level, victim, merc.DAM_FIRE) \ - and not item.flags.no_n_metal and not item.flags.burn_proof: + if ( + random.randint(1, 2 * level) > item.level + and not handler_magic.saves_spell(level, victim, merc.DAM_FIRE) + and not item.flags.no_n_metal + and not item.flags.burn_proof + ): if item.item_type == merc.ITEM_ARMOR: if item.equipped_to: # remove the item */ - if victim.can_drop_item(item) \ - and (item.weight // 10) < random.randint(1, 2 * victim.stat(merc.STAT_DEX)) \ - and victim.unequip(item.equipped_to, True): - handler_game.act("$n yelps and throws $p to the ground! ", victim, item, None, - merc.TO_ROOM) - handler_game.act("You remove and drop $p before it burns you.", victim, item, None, - merc.TO_CHAR) - dam += (random.randint(1, item.level) // 3) + if ( + victim.can_drop_item(item) + and (item.weight // 10) + < random.randint(1, 2 * victim.stat(merc.STAT_DEX)) + and victim.unequip(item.equipped_to, True) + ): + handler_game.act( + "$n yelps and throws $p to the ground! ", + victim, + item, + None, + merc.TO_ROOM, + ) + handler_game.act( + "You remove and drop $p before it burns you.", + victim, + item, + None, + merc.TO_CHAR, + ) + dam += random.randint(1, item.level) // 3 victim.get(item) victim.in_room.put(item) fail = False else: # stuck on the body! ouch! */ - handler_game.act("Your skin is seared by $p! ", victim, item, None, merc.TO_CHAR) - dam += (random.randint(1, item.level)) + handler_game.act( + "Your skin is seared by $p! ", + victim, + item, + None, + merc.TO_CHAR, + ) + dam += random.randint(1, item.level) fail = False else: # drop it if we can */ if victim.can_drop_item(item): - handler_game.act("$n yelps and throws $p to the ground! ", victim, item, None, - merc.TO_ROOM) - handler_game.act("You and drop $p before it burns you.", victim, item, None, - merc.TO_CHAR) - dam += (random.randint(1, item.level) // 6) + handler_game.act( + "$n yelps and throws $p to the ground! ", + victim, + item, + None, + merc.TO_ROOM, + ) + handler_game.act( + "You and drop $p before it burns you.", + victim, + item, + None, + merc.TO_CHAR, + ) + dam += random.randint(1, item.level) // 6 victim.get(item) victim.in_room.put(item) fail = False else: # can! drop */ - handler_game.act("Your skin is seared by $p! ", victim, item, None, merc.TO_CHAR) - dam += (random.randint(1, item.level) // 2) + handler_game.act( + "Your skin is seared by $p! ", + victim, + item, + None, + merc.TO_CHAR, + ) + dam += random.randint(1, item.level) // 2 fail = False if item.item_type == merc.ITEM_WEAPON: if item.equipped_to: # try to drop it */ if item.flags.flaming: continue - if victim.can_drop_item(item) and victim.unequip(item.equipped_to, True): - handler_game.act("$n is burned by $p, and throws it to the ground.", victim, item, None, - merc.TO_ROOM) - victim.send("You throw your red-hot weapon to the ground! \n") + if victim.can_drop_item(item) and victim.unequip( + item.equipped_to, True + ): + handler_game.act( + "$n is burned by $p, and throws it to the ground.", + victim, + item, + None, + merc.TO_ROOM, + ) + victim.send( + "You throw your red-hot weapon to the ground! \n" + ) dam += 1 victim.get(item) victim.in_room.put(item) @@ -70,17 +118,33 @@ def spell_heat_metal(sn, level, ch, victim, target): fail = False else: # drop it if we can */ if victim.can_drop_item(item): - handler_game.act("$n throws a burning hot $p to the ground! ", victim, item, None, - merc.TO_ROOM) - handler_game.act("You and drop $p before it burns you.", victim, item, None, - merc.TO_CHAR) - dam += (random.randint(1, item.level) // 6) + handler_game.act( + "$n throws a burning hot $p to the ground! ", + victim, + item, + None, + merc.TO_ROOM, + ) + handler_game.act( + "You and drop $p before it burns you.", + victim, + item, + None, + merc.TO_CHAR, + ) + dam += random.randint(1, item.level) // 6 victim.get(item) victim.in_room.put(item) fail = False else: # can! drop */ - handler_game.act("Your skin is seared by $p! ", victim, item, None, merc.TO_CHAR) - dam += (random.randint(1, item.level) // 2) + handler_game.act( + "Your skin is seared by $p! ", + victim, + item, + None, + merc.TO_CHAR, + ) + dam += random.randint(1, item.level) // 2 fail = False if fail: ch.send("Your spell had no effect.\n") @@ -91,7 +155,20 @@ def spell_heat_metal(sn, level, ch, victim, target): fight.damage(ch, victim, dam, sn, merc.DAM_FIRE, True) -const.register_spell(const.skill_type("heat metal", {'mage': 53, 'cleric': 16, 'thief': 53, 'warrior': 23}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_heat_metal, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(516), 25, 18, "spell", "!Heat Metal!", "")) +const.register_spell( + const.skill_type( + "heat metal", + {"mage": 53, "cleric": 16, "thief": 53, "warrior": 23}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_heat_metal, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(516), + 25, + 18, + "spell", + "!Heat Metal!", + "", + ) +) diff --git a/src/rom24/spells/spell_high_explosive.py b/src/rom24/spells/spell_high_explosive.py index 74bd955..1ca2236 100644 --- a/src/rom24/spells/spell_high_explosive.py +++ b/src/rom24/spells/spell_high_explosive.py @@ -12,9 +12,20 @@ def spell_high_explosive(sn, level, ch, victim, target): fight.damage(ch, victim, dam, sn, merc.DAM_PIERCE, True) -const.register_spell(const.skill_type("high explosive", - {'mage': 53, 'cleric': 53, 'thief': 53, 'warrior': 53}, - {'mage': 0, 'cleric': 0, 'thief': 0, 'warrior': 0}, - spell_high_explosive, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(402), 0, 12, "high explosive ammo", "!High Explosive Ammo!", - "")) # combat and weapons skills */) +const.register_spell( + const.skill_type( + "high explosive", + {"mage": 53, "cleric": 53, "thief": 53, "warrior": 53}, + {"mage": 0, "cleric": 0, "thief": 0, "warrior": 0}, + spell_high_explosive, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(402), + 0, + 12, + "high explosive ammo", + "!High Explosive Ammo!", + "", + ) +) # combat and weapons skills */) diff --git a/src/rom24/spells/spell_holy_word.py b/src/rom24/spells/spell_holy_word.py index fcea79d..08d6ba1 100644 --- a/src/rom24/spells/spell_holy_word.py +++ b/src/rom24/spells/spell_holy_word.py @@ -14,22 +14,33 @@ def spell_holy_word(sn, level, ch, victim, target): for vch_id in ch.in_room.people: vch = instance.characters[vch_id] - if (ch.is_good() and vch.is_good()) or ( - ch.is_evil() and vch.is_evil()) or ( - ch.is_neutral() and vch.is_neutral()): + if ( + (ch.is_good() and vch.is_good()) + or (ch.is_evil() and vch.is_evil()) + or (ch.is_neutral() and vch.is_neutral()) + ): vch.send("You feel full more powerful.\n") - const.skill_table['frenzy'].spell_fun('frenzy', level, ch, vch, merc.TARGET_CHAR) - const.skill_table['bless'].spell_fun('bless', level, ch, vch, merc.TARGET_CHAR) + const.skill_table["frenzy"].spell_fun( + "frenzy", level, ch, vch, merc.TARGET_CHAR + ) + const.skill_table["bless"].spell_fun( + "bless", level, ch, vch, merc.TARGET_CHAR + ) elif (ch.is_good() and state_checks.IS_EVIL(vch)) or ( - ch.is_evil() and state_checks.IS_GOOD(vch)): + ch.is_evil() and state_checks.IS_GOOD(vch) + ): if not fight.is_safe_spell(ch, vch, True): - const.skill_table['curse'].spell_fun('curse', level, ch, vch, merc.TARGET_CHAR) + const.skill_table["curse"].spell_fun( + "curse", level, ch, vch, merc.TARGET_CHAR + ) vch.send("You are struck down! \n") dam = game_utils.dice(level, 6) fight.damage(ch, vch, dam, sn, merc.DAM_ENERGY, True) elif state_checks.IS_NEUTRAL(ch): if not fight.is_safe_spell(ch, vch, True): - const.skill_table['curse'].spell_fun('curse', level // 2, ch, vch, merc.TARGET_CHAR) + const.skill_table["curse"].spell_fun( + "curse", level // 2, ch, vch, merc.TARGET_CHAR + ) vch.send("You are struck down! \n") dam = game_utils.dice(level, 4) fight.damage(ch, vch, dam, sn, merc.DAM_ENERGY, True) @@ -38,8 +49,20 @@ def spell_holy_word(sn, level, ch, victim, target): ch.hit = ch.hit // 2 -const.register_spell(const.skill_type("holy word", - {'mage': 53, 'cleric': 36, 'thief': 53, 'warrior': 42}, - {'mage': 2, 'cleric': 2, 'thief': 4, 'warrior': 4}, - spell_holy_word, merc.TAR_IGNORE, merc.POS_FIGHTING, None, - const.SLOT(506), 200, 24, "divine wrath", "!Holy Word!", "")) +const.register_spell( + const.skill_type( + "holy word", + {"mage": 53, "cleric": 36, "thief": 53, "warrior": 42}, + {"mage": 2, "cleric": 2, "thief": 4, "warrior": 4}, + spell_holy_word, + merc.TAR_IGNORE, + merc.POS_FIGHTING, + None, + const.SLOT(506), + 200, + 24, + "divine wrath", + "!Holy Word!", + "", + ) +) diff --git a/src/rom24/spells/spell_identify.py b/src/rom24/spells/spell_identify.py index 9e9fc52..f18ee74 100644 --- a/src/rom24/spells/spell_identify.py +++ b/src/rom24/spells/spell_identify.py @@ -1,50 +1,73 @@ from rom24 import const from rom24 import merc -from rom24.merc import affect_loc_name, affect_bit_name, extra_bit_name, imm_bit_name, weapon_bit_name, cont_bit_name +from rom24.merc import ( + affect_loc_name, + affect_bit_name, + extra_bit_name, + imm_bit_name, + weapon_bit_name, + cont_bit_name, +) -#TODO: Make this ROM-like formatting +# TODO: Make this ROM-like formatting def spell_identify(sn, level, ch, victim, target): item = victim if type(item) is int: item = instance.items[item] - ch.send("Item '{item.name}' is type {item.item_type}, " - "weight is {weight}".format(item=item, weight=(item.weight // 10))) + ch.send( + "Item '{item.name}' is type {item.item_type}, " + "weight is {weight}".format(item=item, weight=(item.weight // 10)) + ) ch.send("Equips to: {item.equips_to_names}\n".format(item=item)) ch.send("Item Attribute Flags: {item.item_attribute_names}\n".format(item=item)) ch.send("Item Restriction Flags: {item.item_restriction_names}\n".format(item=item)) ch.send("Value is {item.cost}, level is {item.level}.\n".format(item=item)) - if item.item_type == merc.ITEM_SCROLL or item.item_type == merc.ITEM_POTION or item.item_type == merc.ITEM_PILL: + if ( + item.item_type == merc.ITEM_SCROLL + or item.item_type == merc.ITEM_POTION + or item.item_type == merc.ITEM_PILL + ): ch.send("Level {item.value[0]} spells of:".format(item=item)) for i in item.value: if 0 <= i < merc.MAX_SKILL: ch.send(" '{skill}'".format(skill=const.skill_table[i].name)) ch.send(".\n") elif item.item_type == merc.ITEM_WAND or item.item_type == merc.ITEM_STAFF: - ch.send("Has {item.value[2]} charges of level {item.value[0]}".format(item=item)) + ch.send( + "Has {item.value[2]} charges of level {item.value[0]}".format(item=item) + ) if 0 <= item.value[3] < merc.MAX_SKILL: ch.send("' {skill}'".format(skill=const.skill_table[item.value[3]].name)) ch.send(".\n") elif item.item_type == merc.ITEM_DRINK_CON: - ch.send("It holds {color}-colored {liquid}.\n".format(color=const.liq_table[item.value[2]].color, - liquid=const.liq_table[item.value[2]].name)) + ch.send( + "It holds {color}-colored {liquid}.\n".format( + color=const.liq_table[item.value[2]].color, + liquid=const.liq_table[item.value[2]].name, + ) + ) elif item.item_type == merc.ITEM_CONTAINER: - ch.send("Capacity: {item.value[0]}# " - "Maximum weight: {item.value[3]}# " - "flags: {cflag}\n".format(item=item, cflag=cont_bit_name(item.value[1]))) + ch.send( + "Capacity: {item.value[0]}# " + "Maximum weight: {item.value[3]}# " + "flags: {cflag}\n".format(item=item, cflag=cont_bit_name(item.value[1])) + ) if item.value[4] != 100: ch.send("Weight multiplier: {item.value[4]}%%\n".format(item=item)) elif item.item_type == merc.ITEM_WEAPON: ch.send("Weapon type is ") - weapons = {merc.WEAPON_EXOTIC: "exotic", - merc.WEAPON_SWORD: "sword", - merc.WEAPON_DAGGER: "dagger", - merc.WEAPON_SPEAR: "spear//staff", - merc.WEAPON_MACE: "mace//club", - merc.WEAPON_AXE: "axe", - merc.WEAPON_FLAIL: "flail", - merc.WEAPON_WHIP: "whip", - merc.WEAPON_POLEARM: "polearm"} + weapons = { + merc.WEAPON_EXOTIC: "exotic", + merc.WEAPON_SWORD: "sword", + merc.WEAPON_DAGGER: "dagger", + merc.WEAPON_SPEAR: "spear//staff", + merc.WEAPON_MACE: "mace//club", + merc.WEAPON_AXE: "axe", + merc.WEAPON_FLAIL: "flail", + merc.WEAPON_WHIP: "whip", + merc.WEAPON_POLEARM: "polearm", + } if item.value[0] not in weapons: ch.send("unknown") @@ -52,18 +75,28 @@ def spell_identify(sn, level, ch, victim, target): ch.send(weapons[item.value[0]]) if item.new_format: - ch.send("Damage is {item.value[1]}d{item.value[2]} " - "(average {average}).\n".format(item=item, average=((1 + item.value[2]) * item.value[1] // 2))) + ch.send( + "Damage is {item.value[1]}d{item.value[2]} " + "(average {average}).\n".format( + item=item, average=((1 + item.value[2]) * item.value[1] // 2) + ) + ) else: - ch.send("Damage is {item.value[1]} to {item.value[2]} " - "(average {average}).\n".format(item=item, average=((item.value[2] + item.value[1]) // 2))) + ch.send( + "Damage is {item.value[1]} to {item.value[2]} " + "(average {average}).\n".format( + item=item, average=((item.value[2] + item.value[1]) // 2) + ) + ) if item.weapon_attributes: # weapon flags */ ch.send("Weapons flags: {item.weapon_attribute_names}\n".format(item=item)) elif item.item_type == merc.ITEM_ARMOR: - ch.send("Armor class is {item.value[0]} pierce, {item.value[1]} bash, " - "{item.value[2]} slash, and {item.value[3]} vs. magic.\n".format(item=item)) + ch.send( + "Armor class is {item.value[0]} pierce, {item.value[1]} bash, " + "{item.value[2]} slash, and {item.value[3]} vs. magic.\n".format(item=item) + ) affected = item.affected if not item.enchanted: @@ -71,25 +104,64 @@ def spell_identify(sn, level, ch, victim, target): for paf in affected: if paf.location != merc.APPLY_NONE and paf.modifier != 0: - ch.send("Affects {aff_loc} by {modifier}.\n".format(aff_loc=affect_loc_name(paf.location), - modifier=paf.modifier)) + ch.send( + "Affects {aff_loc} by {modifier}.\n".format( + aff_loc=affect_loc_name(paf.location), modifier=paf.modifier + ) + ) if paf.bitvector: if paf.where == merc.TO_AFFECTS: - ch.send("Adds {aff_name} affect.\n".format(aff_name=affect_bit_name(paf.bitvector))) + ch.send( + "Adds {aff_name} affect.\n".format( + aff_name=affect_bit_name(paf.bitvector) + ) + ) elif paf.where == merc.TO_OBJECT: - ch.send("Adds {bit_name} item flag.\n".format(bit_name=extra_bit_name(paf.bitvector))) + ch.send( + "Adds {bit_name} item flag.\n".format( + bit_name=extra_bit_name(paf.bitvector) + ) + ) elif paf.where == merc.TO_IMMUNE: - ch.send("Adds immunity to {imm}.\n".format(imm=imm_bit_name(paf.bitvector))) + ch.send( + "Adds immunity to {imm}.\n".format( + imm=imm_bit_name(paf.bitvector) + ) + ) elif paf.where == merc.TO_RESIST: - ch.send("Adds resistance to {res}.\n".format(res=imm_bit_name(paf.bitvector))) + ch.send( + "Adds resistance to {res}.\n".format( + res=imm_bit_name(paf.bitvector) + ) + ) elif paf.where == merc.TO_VULN: - ch.send("Adds vulnerability to {vuln}.\n".format(vuln=imm_bit_name(paf.bitvector))) + ch.send( + "Adds vulnerability to {vuln}.\n".format( + vuln=imm_bit_name(paf.bitvector) + ) + ) else: - ch.send("Unknown bit {bit_name}: {bit}\n".format(bit_name=paf.where, bit=paf.bitvector)) + ch.send( + "Unknown bit {bit_name}: {bit}\n".format( + bit_name=paf.where, bit=paf.bitvector + ) + ) -const.register_spell(const.skill_type("identify", - {'mage': 15, 'cleric': 16, 'thief': 18, 'warrior': 53}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_identify, merc.TAR_OBJ_INV, merc.POS_STANDING, None, - const.SLOT(53), 12, 24, "", "!Identify!", "")) +const.register_spell( + const.skill_type( + "identify", + {"mage": 15, "cleric": 16, "thief": 18, "warrior": 53}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_identify, + merc.TAR_OBJ_INV, + merc.POS_STANDING, + None, + const.SLOT(53), + 12, + 24, + "", + "!Identify!", + "", + ) +) diff --git a/src/rom24/spells/spell_infravision.py b/src/rom24/spells/spell_infravision.py index 1148b14..c4f39fc 100644 --- a/src/rom24/spells/spell_infravision.py +++ b/src/rom24/spells/spell_infravision.py @@ -8,7 +8,9 @@ def spell_infravision(sn, level, ch, victim, target): if victim == ch: ch.send("You can already see in the dark.\n") else: - handler_game.act("$N already has infravision.\n", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N already has infravision.\n", ch, None, victim, merc.TO_CHAR + ) return handler_game.act("$n's eyes glow red.\n", ch, None, None, merc.TO_ROOM) @@ -25,8 +27,20 @@ def spell_infravision(sn, level, ch, victim, target): return -const.register_spell(const.skill_type("infravision", - {'mage': 9, 'cleric': 13, 'thief': 10, 'warrior': 16}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_infravision, merc.TAR_CHAR_DEFENSIVE, merc.POS_STANDING, - None, const.SLOT(77), 5, 18, "", "You no longer see in the dark.", "")) +const.register_spell( + const.skill_type( + "infravision", + {"mage": 9, "cleric": 13, "thief": 10, "warrior": 16}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_infravision, + merc.TAR_CHAR_DEFENSIVE, + merc.POS_STANDING, + None, + const.SLOT(77), + 5, + 18, + "", + "You no longer see in the dark.", + "", + ) +) diff --git a/src/rom24/spells/spell_invis.py b/src/rom24/spells/spell_invis.py index faf82c8..989495c 100644 --- a/src/rom24/spells/spell_invis.py +++ b/src/rom24/spells/spell_invis.py @@ -24,7 +24,7 @@ def spell_invis(sn, level, ch, victim, target): handler_game.act("$p fades out of sight.", ch, obj, None, merc.TO_ALL) return # character invisibility */ - if victim.is_affected( merc.AFF_INVISIBLE): + if victim.is_affected(merc.AFF_INVISIBLE): return handler_game.act("$n fades out of existence.", victim, None, None, merc.TO_ROOM) @@ -41,8 +41,20 @@ def spell_invis(sn, level, ch, victim, target): return -const.register_spell(const.skill_type("invisibility", - {'mage': 5, 'cleric': 53, 'thief': 9, 'warrior': 53}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_invis, merc.TAR_OBJ_CHAR_DEF, merc.POS_STANDING, None, - const.SLOT(29), 5, 12, "", "You are no longer invisible.", "$p fades into view.")) +const.register_spell( + const.skill_type( + "invisibility", + {"mage": 5, "cleric": 53, "thief": 9, "warrior": 53}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_invis, + merc.TAR_OBJ_CHAR_DEF, + merc.POS_STANDING, + None, + const.SLOT(29), + 5, + 12, + "", + "You are no longer invisible.", + "$p fades into view.", + ) +) diff --git a/src/rom24/spells/spell_know_alignment.py b/src/rom24/spells/spell_know_alignment.py index 0d7e579..1d55f74 100644 --- a/src/rom24/spells/spell_know_alignment.py +++ b/src/rom24/spells/spell_know_alignment.py @@ -25,8 +25,20 @@ def spell_know_alignment(sn, level, ch, victim, target): return -const.register_spell(const.skill_type("know alignment", - {'mage': 12, 'cleric': 9, 'thief': 20, 'warrior': 53}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_know_alignment, merc.TAR_CHAR_DEFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(58), 9, 12, "", "!Know Alignment!", "")) +const.register_spell( + const.skill_type( + "know alignment", + {"mage": 12, "cleric": 9, "thief": 20, "warrior": 53}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_know_alignment, + merc.TAR_CHAR_DEFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(58), + 9, + 12, + "", + "!Know Alignment!", + "", + ) +) diff --git a/src/rom24/spells/spell_lightning_bolt.py b/src/rom24/spells/spell_lightning_bolt.py index 6e1d1bb..bf27f5e 100644 --- a/src/rom24/spells/spell_lightning_bolt.py +++ b/src/rom24/spells/spell_lightning_bolt.py @@ -6,12 +6,59 @@ def spell_lightning_bolt(sn, level, ch, victim, target): - dam_each = [0, - 0, 0, 0, 0, 0, 0, 0, 0, 25, 28, - 31, 34, 37, 40, 40, 41, 42, 42, 43, 44, - 44, 45, 46, 46, 47, 48, 48, 49, 50, 50, - 51, 52, 52, 53, 54, 54, 55, 56, 56, 57, - 58, 58, 59, 60, 60, 61, 62, 62, 63, 64] + dam_each = [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 25, + 28, + 31, + 34, + 37, + 40, + 40, + 41, + 42, + 42, + 43, + 44, + 44, + 45, + 46, + 46, + 47, + 48, + 48, + 49, + 50, + 50, + 51, + 52, + 52, + 53, + 54, + 54, + 55, + 56, + 56, + 57, + 58, + 58, + 59, + 60, + 60, + 61, + 62, + 62, + 63, + 64, + ] level = min(level, len(dam_each) - 1) level = max(0, level) @@ -21,8 +68,20 @@ def spell_lightning_bolt(sn, level, ch, victim, target): fight.damage(ch, victim, dam, sn, merc.DAM_LIGHTNING, True) -const.register_spell(const.skill_type("lightning bolt", - {'mage': 13, 'cleric': 23, 'thief': 18, 'warrior': 16}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_lightning_bolt, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(30), 15, 12, "lightning bolt", "!Lightning Bolt!", "")) +const.register_spell( + const.skill_type( + "lightning bolt", + {"mage": 13, "cleric": 23, "thief": 18, "warrior": 16}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_lightning_bolt, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(30), + 15, + 12, + "lightning bolt", + "!Lightning Bolt!", + "", + ) +) diff --git a/src/rom24/spells/spell_lightning_breath.py b/src/rom24/spells/spell_lightning_breath.py index 1156411..9bd526b 100644 --- a/src/rom24/spells/spell_lightning_breath.py +++ b/src/rom24/spells/spell_lightning_breath.py @@ -10,9 +10,15 @@ def spell_lightning_breath(sn, level, ch, victim, target): - handler_game.act("$n breathes a bolt of lightning at $N.", ch, None, victim, merc.TO_NOTVICT) - handler_game.act("$n breathes a bolt of lightning at you! ", ch, None, victim, merc.TO_VICT) - handler_game.act("You breathe a bolt of lightning at $N.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$n breathes a bolt of lightning at $N.", ch, None, victim, merc.TO_NOTVICT + ) + handler_game.act( + "$n breathes a bolt of lightning at you! ", ch, None, victim, merc.TO_VICT + ) + handler_game.act( + "You breathe a bolt of lightning at $N.", ch, None, victim, merc.TO_CHAR + ) hpch = max(10, ch.hit) hp_dam = random.randint(hpch // 9 + 1, hpch // 5) @@ -31,9 +37,21 @@ def spell_lightning_breath(sn, level, ch, victim, target): # * Spells for mega1.are from Glop//Erkenbrand. -const.register_spell(const.skill_type("lightning breath", - {'mage': 37, 'cleric': 40, 'thief': 43, 'warrior': 46}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_lightning_breath, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, None, - const.SLOT(204), 150, 24, "blast of lightning", "!Lightning Breath!", "")) +const.register_spell( + const.skill_type( + "lightning breath", + {"mage": 37, "cleric": 40, "thief": 43, "warrior": 46}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_lightning_breath, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(204), + 150, + 24, + "blast of lightning", + "!Lightning Breath!", + "", + ) +) # * Spells for mega1.are from Glop/Erkenbrand. */) diff --git a/src/rom24/spells/spell_locate_object.py b/src/rom24/spells/spell_locate_object.py index 4bda747..eab961c 100644 --- a/src/rom24/spells/spell_locate_object.py +++ b/src/rom24/spells/spell_locate_object.py @@ -12,9 +12,13 @@ def spell_locate_object(sn, level, ch, victim, target): max_found = 200 if ch.is_immortal() else 2 * level for item in instance.items.values(): - if not ch.can_see_item(item) or not game_utils.is_name(handler_magic.target_name, item.name) \ - or item.flags.no_locate or random.randint(1, 99) > 2 * level \ - or ch.level < item.level: + if ( + not ch.can_see_item(item) + or not game_utils.is_name(handler_magic.target_name, item.name) + or item.flags.no_locate + or random.randint(1, 99) > 2 * level + or ch.level < item.level + ): continue found = True @@ -27,9 +31,15 @@ def spell_locate_object(sn, level, ch, victim, target): ch.send("one is carried by %s\n" % state_checks.PERS(in_item.in_living, ch)) else: if ch.is_immortal() and in_item.in_room is not None: - ch.send("one is in %s [[Room %d]]\n" % (in_item.in_room.name, in_item.in_room.instance_id)) + ch.send( + "one is in %s [[Room %d]]\n" + % (in_item.in_room.name, in_item.in_room.instance_id) + ) else: - ch.send("one is in %s\n" % ("somewhere" if not in_item.in_room else in_item.in_room.name)) + ch.send( + "one is in %s\n" + % ("somewhere" if not in_item.in_room else in_item.in_room.name) + ) if number >= max_found: break @@ -38,8 +48,20 @@ def spell_locate_object(sn, level, ch, victim, target): ch.send("Nothing like that in heaven or earth.\n") -const.register_spell(const.skill_type("locate object", - {'mage': 9, 'cleric': 15, 'thief': 11, 'warrior': 53}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_locate_object, merc.TAR_IGNORE, merc.POS_STANDING, None, - const.SLOT(31), 20, 18, "", "!Locate Object!", "")) +const.register_spell( + const.skill_type( + "locate object", + {"mage": 9, "cleric": 15, "thief": 11, "warrior": 53}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_locate_object, + merc.TAR_IGNORE, + merc.POS_STANDING, + None, + const.SLOT(31), + 20, + 18, + "", + "!Locate Object!", + "", + ) +) diff --git a/src/rom24/spells/spell_magic_missile.py b/src/rom24/spells/spell_magic_missile.py index 3f5e82b..f01e589 100644 --- a/src/rom24/spells/spell_magic_missile.py +++ b/src/rom24/spells/spell_magic_missile.py @@ -6,12 +6,59 @@ def spell_magic_missile(sn, level, ch, victim, target): - dam_each = [0, - 3, 3, 4, 4, 5, 6, 6, 6, 6, 6, - 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, - 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, - 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, - 13, 13, 13, 13, 13, 14, 14, 14, 14, 14] + dam_each = [ + 0, + 3, + 3, + 4, + 4, + 5, + 6, + 6, + 6, + 6, + 6, + 7, + 7, + 7, + 7, + 7, + 8, + 8, + 8, + 8, + 8, + 9, + 9, + 9, + 9, + 9, + 10, + 10, + 10, + 10, + 10, + 11, + 11, + 11, + 11, + 11, + 12, + 12, + 12, + 12, + 12, + 13, + 13, + 13, + 13, + 13, + 14, + 14, + 14, + 14, + 14, + ] level = min(level, len(dam_each) - 1) level = max(0, level) @@ -21,8 +68,20 @@ def spell_magic_missile(sn, level, ch, victim, target): fight.damage(ch, victim, dam, sn, merc.DAM_ENERGY, True) -const.register_spell(const.skill_type("magic missile", - {'mage': 1, 'cleric': 53, 'thief': 2, 'warrior': 2}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_magic_missile, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(32), 15, 12, "magic missile", "!Magic Missile!", "")) +const.register_spell( + const.skill_type( + "magic missile", + {"mage": 1, "cleric": 53, "thief": 2, "warrior": 2}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_magic_missile, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(32), + 15, + 12, + "magic missile", + "!Magic Missile!", + "", + ) +) diff --git a/src/rom24/spells/spell_mass_healing.py b/src/rom24/spells/spell_mass_healing.py index fd22c9e..d02d8ba 100644 --- a/src/rom24/spells/spell_mass_healing.py +++ b/src/rom24/spells/spell_mass_healing.py @@ -6,13 +6,29 @@ def spell_mass_healing(sn, level, ch, victim, target): for gch_id in ch.in_room.people: gch = instance.characters[gch_id] - if (ch.is_npc() and gch.is_npc() ) or (not ch.is_npc() and not gch.is_npc()): - const.skill_table['heal'].spell_fun('heal', level, ch, gch, merc.TARGET_CHAR) - const.skill_table['refresh'].spell_fun('refresh', level, ch, gch, merc.TARGET_CHAR) + if (ch.is_npc() and gch.is_npc()) or (not ch.is_npc() and not gch.is_npc()): + const.skill_table["heal"].spell_fun( + "heal", level, ch, gch, merc.TARGET_CHAR + ) + const.skill_table["refresh"].spell_fun( + "refresh", level, ch, gch, merc.TARGET_CHAR + ) -const.register_spell(const.skill_type("mass healing", - {'mage': 53, 'cleric': 38, 'thief': 53, 'warrior': 46}, - {'mage': 2, 'cleric': 2, 'thief': 4, 'warrior': 4}, - spell_mass_healing, merc.TAR_IGNORE, merc.POS_STANDING, None, - const.SLOT(508), 100, 36, "", "!Mass Healing!", "")) +const.register_spell( + const.skill_type( + "mass healing", + {"mage": 53, "cleric": 38, "thief": 53, "warrior": 46}, + {"mage": 2, "cleric": 2, "thief": 4, "warrior": 4}, + spell_mass_healing, + merc.TAR_IGNORE, + merc.POS_STANDING, + None, + const.SLOT(508), + 100, + 36, + "", + "!Mass Healing!", + "", + ) +) diff --git a/src/rom24/spells/spell_mass_invis.py b/src/rom24/spells/spell_mass_invis.py index 0f17e8f..e6b90a1 100644 --- a/src/rom24/spells/spell_mass_invis.py +++ b/src/rom24/spells/spell_mass_invis.py @@ -9,7 +9,9 @@ def spell_mass_invis(sn, level, ch, victim, target): gch = instance.characters[gch_id] if not gch.is_same_group(ch) or gch.is_affected(merc.AFF_INVISIBLE): continue - handler_game.act("$n slowly fades out of existence.", gch, None, None, merc.TO_ROOM) + handler_game.act( + "$n slowly fades out of existence.", gch, None, None, merc.TO_ROOM + ) gch.send("You slowly fade out of existence.\n") af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS @@ -23,8 +25,20 @@ def spell_mass_invis(sn, level, ch, victim, target): ch.send("Ok.\n") -const.register_spell(const.skill_type("mass invis", - {'mage': 22, 'cleric': 25, 'thief': 31, 'warrior': 53}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_mass_invis, merc.TAR_IGNORE, merc.POS_STANDING, None, - const.SLOT(69), 20, 24, "", "You are no longer invisible.", "")) +const.register_spell( + const.skill_type( + "mass invis", + {"mage": 22, "cleric": 25, "thief": 31, "warrior": 53}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_mass_invis, + merc.TAR_IGNORE, + merc.POS_STANDING, + None, + const.SLOT(69), + 20, + 24, + "", + "You are no longer invisible.", + "", + ) +) diff --git a/src/rom24/spells/spell_nexus.py b/src/rom24/spells/spell_nexus.py index d5866d4..497f238 100644 --- a/src/rom24/spells/spell_nexus.py +++ b/src/rom24/spells/spell_nexus.py @@ -11,38 +11,49 @@ def spell_nexus(sn, level, ch, victim, target): victim = ch.get_char_world(handler_magic.target_name) to_room = victim.in_room - if not victim \ - or victim == ch \ - or not to_room \ - or not ch.can_see_room(to_room.instance_id) or not ch.can_see_room(from_room.instance_id) \ - or state_checks.IS_SET(to_room.room_flags, merc.ROOM_SAFE) \ - or state_checks.IS_SET(from_room.room_flags, merc.ROOM_SAFE) \ - or state_checks.IS_SET(to_room.room_flags, merc.ROOM_PRIVATE) \ - or state_checks.IS_SET(to_room.room_flags, merc.ROOM_SOLITARY) \ - or state_checks.IS_SET(to_room.room_flags, merc.ROOM_NO_RECALL) \ - or state_checks.IS_SET(from_room.room_flags, merc.ROOM_NO_RECALL) \ - or victim.level >= level + 3 \ - or (not victim.is_npc() and victim.level >= merc.LEVEL_HERO) \ - or (victim.is_npc() and state_checks.IS_SET(victim.imm_flags, merc.IMM_SUMMON)) \ - or (victim.is_npc() and handler_magic.saves_spell(level, victim, merc.DAM_NONE) ) \ - or (victim.is_clan() and not ch.is_same_clan(victim)): + if ( + not victim + or victim == ch + or not to_room + or not ch.can_see_room(to_room.instance_id) + or not ch.can_see_room(from_room.instance_id) + or state_checks.IS_SET(to_room.room_flags, merc.ROOM_SAFE) + or state_checks.IS_SET(from_room.room_flags, merc.ROOM_SAFE) + or state_checks.IS_SET(to_room.room_flags, merc.ROOM_PRIVATE) + or state_checks.IS_SET(to_room.room_flags, merc.ROOM_SOLITARY) + or state_checks.IS_SET(to_room.room_flags, merc.ROOM_NO_RECALL) + or state_checks.IS_SET(from_room.room_flags, merc.ROOM_NO_RECALL) + or victim.level >= level + 3 + or (not victim.is_npc() and victim.level >= merc.LEVEL_HERO) + or (victim.is_npc() and state_checks.IS_SET(victim.imm_flags, merc.IMM_SUMMON)) + or (victim.is_npc() and handler_magic.saves_spell(level, victim, merc.DAM_NONE)) + or (victim.is_clan() and not ch.is_same_clan(victim)) + ): ch.send("You failed.\n") return stone = ch.slots.held - if not ch.is_immortal() and (stone is None or stone.item_type != merc.ITEM_WARP_STONE): + if not ch.is_immortal() and ( + stone is None or stone.item_type != merc.ITEM_WARP_STONE + ): ch.send("You lack the proper component for this spell.\n") return if stone and stone.item_type == merc.ITEM_WARP_STONE: - handler_game.act("You draw upon the power of $p.", ch, stone, None, merc.TO_CHAR) - handler_game.act("It flares brightly and vanishes! ", ch, stone, None, merc.TO_CHAR) + handler_game.act( + "You draw upon the power of $p.", ch, stone, None, merc.TO_CHAR + ) + handler_game.act( + "It flares brightly and vanishes! ", ch, stone, None, merc.TO_CHAR + ) ch.unequip(stone.equipped_to) ch.get(stone) stone.extract() # portal one */ - portal = object_creator.create_item(instance.item_templates[merc.OBJ_VNUM_PORTAL], 0) + portal = object_creator.create_item( + instance.item_templates[merc.OBJ_VNUM_PORTAL], 0 + ) portal.timer = 1 + level // 10 portal.value[3] = to_room.instance_id @@ -56,7 +67,9 @@ def spell_nexus(sn, level, ch, victim, target): return # portal two */ - portal = object_creator.create_item(instance.item_templates[merc.OBJ_VNUM_PORTAL], 0) + portal = object_creator.create_item( + instance.item_templates[merc.OBJ_VNUM_PORTAL], 0 + ) portal.timer = 1 + level // 10 portal.value[3] = from_room.instance_id @@ -64,12 +77,28 @@ def spell_nexus(sn, level, ch, victim, target): if to_room.people: vch = instance.characters[to_room.people[0]] - handler_game.act("$p rises up from the ground.", vch, portal, None, merc.TO_ROOM) - handler_game.act("$p rises up from the ground.", vch, portal, None, merc.TO_CHAR) + handler_game.act( + "$p rises up from the ground.", vch, portal, None, merc.TO_ROOM + ) + handler_game.act( + "$p rises up from the ground.", vch, portal, None, merc.TO_CHAR + ) -const.register_spell(const.skill_type("nexus", - {'mage': 40, 'cleric': 35, 'thief': 50, 'warrior': 45}, - {'mage': 2, 'cleric': 2, 'thief': 4, 'warrior': 4}, - spell_nexus, merc.TAR_IGNORE, merc.POS_STANDING, None, const.SLOT(520), - 150, 36, "", "!Nexus!", "")) +const.register_spell( + const.skill_type( + "nexus", + {"mage": 40, "cleric": 35, "thief": 50, "warrior": 45}, + {"mage": 2, "cleric": 2, "thief": 4, "warrior": 4}, + spell_nexus, + merc.TAR_IGNORE, + merc.POS_STANDING, + None, + const.SLOT(520), + 150, + 36, + "", + "!Nexus!", + "", + ) +) diff --git a/src/rom24/spells/spell_pass_door.py b/src/rom24/spells/spell_pass_door.py index 923f772..4f5cfc7 100644 --- a/src/rom24/spells/spell_pass_door.py +++ b/src/rom24/spells/spell_pass_door.py @@ -5,11 +5,13 @@ def spell_pass_door(sn, level, ch, victim, target): - if victim.is_affected( merc.AFF_PASS_DOOR): + if victim.is_affected(merc.AFF_PASS_DOOR): if victim == ch: ch.send("You are already out of phase.\n") else: - handler_game.act("$N is already shifted out of phase.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N is already shifted out of phase.", ch, None, victim, merc.TO_CHAR + ) return af = handler_game.AFFECT_DATA() @@ -25,8 +27,20 @@ def spell_pass_door(sn, level, ch, victim, target): victim.send("You turn translucent.\n") -const.register_spell(const.skill_type("pass door", - {'mage': 24, 'cleric': 32, 'thief': 25, 'warrior': 37}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_pass_door, merc.TAR_CHAR_SELF, merc.POS_STANDING, None, - const.SLOT(74), 20, 12, "", "You feel solid again.", "")) +const.register_spell( + const.skill_type( + "pass door", + {"mage": 24, "cleric": 32, "thief": 25, "warrior": 37}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_pass_door, + merc.TAR_CHAR_SELF, + merc.POS_STANDING, + None, + const.SLOT(74), + 20, + 12, + "", + "You feel solid again.", + "", + ) +) diff --git a/src/rom24/spells/spell_plague.py b/src/rom24/spells/spell_plague.py index 8fe1be3..0c85e03 100644 --- a/src/rom24/spells/spell_plague.py +++ b/src/rom24/spells/spell_plague.py @@ -7,11 +7,14 @@ def spell_plague(sn, level, ch, victim, target): # RT plague spell, very nasty */ if handler_magic.saves_spell(level, victim, merc.DAM_DISEASE) or ( - victim.is_npc() and victim.act.is_set(merc.ACT_UNDEAD)): + victim.is_npc() and victim.act.is_set(merc.ACT_UNDEAD) + ): if ch == victim: ch.send("You feel momentarily ill, but it passes.\n") else: - handler_game.act("$N seems to be unaffected.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N seems to be unaffected.", ch, None, victim, merc.TO_CHAR + ) return af = handler_game.AFFECT_DATA() @@ -25,11 +28,29 @@ def spell_plague(sn, level, ch, victim, target): victim.affect_join(af) victim.send("You scream in agony as plague sores erupt from your skin.\n") - handler_game.act("$n screams in agony as plague sores erupt from $s skin.", victim, None, None, merc.TO_ROOM) + handler_game.act( + "$n screams in agony as plague sores erupt from $s skin.", + victim, + None, + None, + merc.TO_ROOM, + ) -const.register_spell(const.skill_type("plague", - {'mage': 23, 'cleric': 17, 'thief': 36, 'warrior': 26}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_plague, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, None, - const.SLOT(503), 20, 12, "sickness", "Your sores vanish.", "")) +const.register_spell( + const.skill_type( + "plague", + {"mage": 23, "cleric": 17, "thief": 36, "warrior": 26}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_plague, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(503), + 20, + 12, + "sickness", + "Your sores vanish.", + "", + ) +) diff --git a/src/rom24/spells/spell_poison.py b/src/rom24/spells/spell_poison.py index 4186a6f..0c3a6c3 100644 --- a/src/rom24/spells/spell_poison.py +++ b/src/rom24/spells/spell_poison.py @@ -11,24 +11,34 @@ def spell_poison(sn, level, ch, victim, target): if obj.item_type == merc.ITEM_FOOD or obj.item_type == merc.ITEM_DRINK_CON: if obj.flags.bless or obj.flags.burn_proof: - handler_game.act("Your spell fails to corrupt $p.", ch, obj, None, merc.TO_CHAR) + handler_game.act( + "Your spell fails to corrupt $p.", ch, obj, None, merc.TO_CHAR + ) return obj.value[3] = 1 - handler_game.act("$p is infused with poisonous vapors.", ch, obj, None, merc.TO_ALL) + handler_game.act( + "$p is infused with poisonous vapors.", ch, obj, None, merc.TO_ALL + ) return if obj.item_type == merc.ITEM_WEAPON: - if state_checks.IS_WEAPON_STAT(obj, merc.WEAPON_FLAMING) \ - or state_checks.IS_WEAPON_STAT(obj, merc.WEAPON_FROST) \ - or state_checks.IS_WEAPON_STAT(obj, merc.WEAPON_VAMPIRIC) \ - or state_checks.IS_WEAPON_STAT(obj, merc.WEAPON_SHARP) \ - or state_checks.IS_WEAPON_STAT(obj, merc.WEAPON_VORPAL) \ - or state_checks.IS_WEAPON_STAT(obj, merc.WEAPON_SHOCKING) \ - or obj.flags.bless \ - or obj.flags.burn_proof: - handler_game.act("You can't seem to envenom $p.", ch, obj, None, merc.TO_CHAR) + if ( + state_checks.IS_WEAPON_STAT(obj, merc.WEAPON_FLAMING) + or state_checks.IS_WEAPON_STAT(obj, merc.WEAPON_FROST) + or state_checks.IS_WEAPON_STAT(obj, merc.WEAPON_VAMPIRIC) + or state_checks.IS_WEAPON_STAT(obj, merc.WEAPON_SHARP) + or state_checks.IS_WEAPON_STAT(obj, merc.WEAPON_VORPAL) + or state_checks.IS_WEAPON_STAT(obj, merc.WEAPON_SHOCKING) + or obj.flags.bless + or obj.flags.burn_proof + ): + handler_game.act( + "You can't seem to envenom $p.", ch, obj, None, merc.TO_CHAR + ) return if state_checks.IS_WEAPON_STAT(obj, merc.WEAPON_POISON): - handler_game.act("$p is already envenomed.", ch, obj, None, merc.TO_CHAR) + handler_game.act( + "$p is already envenomed.", ch, obj, None, merc.TO_CHAR + ) return af = handler_game.AFFECT_DATA() af.where = merc.TO_WEAPON @@ -39,13 +49,17 @@ def spell_poison(sn, level, ch, victim, target): af.modifier = 0 af.bitvector = merc.WEAPON_POISON obj.affect_add(af) - handler_game.act("$p is coated with deadly venom.", ch, obj, None, merc.TO_ALL) + handler_game.act( + "$p is coated with deadly venom.", ch, obj, None, merc.TO_ALL + ) return handler_game.act("You can't poison $p.", ch, obj, None, merc.TO_CHAR) return if handler_magic.saves_spell(level, victim, merc.DAM_POISON): - handler_game.act("$n turns slightly green, but it passes.", victim, None, None, merc.TO_ROOM) + handler_game.act( + "$n turns slightly green, but it passes.", victim, None, None, merc.TO_ROOM + ) victim.send("You feel momentarily ill, but it passes.\n") return @@ -62,9 +76,20 @@ def spell_poison(sn, level, ch, victim, target): handler_game.act("$n looks very ill.", victim, None, None, merc.TO_ROOM) -const.register_spell(const.skill_type("poison", - {'mage': 17, 'cleric': 12, 'thief': 15, 'warrior': 21}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_poison, merc.TAR_OBJ_CHAR_OFF, merc.POS_FIGHTING, None, - const.SLOT(33), 10, 12, "poison", "You feel less sick.", - "The poison on $p dries up.")) +const.register_spell( + const.skill_type( + "poison", + {"mage": 17, "cleric": 12, "thief": 15, "warrior": 21}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_poison, + merc.TAR_OBJ_CHAR_OFF, + merc.POS_FIGHTING, + None, + const.SLOT(33), + 10, + 12, + "poison", + "You feel less sick.", + "The poison on $p dries up.", + ) +) diff --git a/src/rom24/spells/spell_portal.py b/src/rom24/spells/spell_portal.py index 5c5f516..18d72e3 100644 --- a/src/rom24/spells/spell_portal.py +++ b/src/rom24/spells/spell_portal.py @@ -9,36 +9,46 @@ def spell_portal(sn, level, ch, victim, target): victim = ch.get_char_world(handler_magic.target_name) - if not victim \ - or victim == ch \ - or victim.in_room == None \ - or not ch.can_see_room(victim.in_room.instance_id) \ - or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_SAFE) \ - or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_PRIVATE) \ - or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_SOLITARY) \ - or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_NO_RECALL) \ - or state_checks.IS_SET(ch.in_room.room_flags, merc.ROOM_NO_RECALL) \ - or victim.level >= level + 3 \ - or (not victim.is_npc() and victim.level >= merc.LEVEL_HERO) \ - or (victim.is_npc() and victim.imm_flags.is_set(merc.IMM_SUMMON)) \ - or (victim.is_npc() and handler_magic.saves_spell(level, victim, merc.DAM_NONE) ) \ - or (victim.is_clan() and not ch.is_same_clan(victim)): + if ( + not victim + or victim == ch + or victim.in_room == None + or not ch.can_see_room(victim.in_room.instance_id) + or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_SAFE) + or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_PRIVATE) + or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_SOLITARY) + or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_NO_RECALL) + or state_checks.IS_SET(ch.in_room.room_flags, merc.ROOM_NO_RECALL) + or victim.level >= level + 3 + or (not victim.is_npc() and victim.level >= merc.LEVEL_HERO) + or (victim.is_npc() and victim.imm_flags.is_set(merc.IMM_SUMMON)) + or (victim.is_npc() and handler_magic.saves_spell(level, victim, merc.DAM_NONE)) + or (victim.is_clan() and not ch.is_same_clan(victim)) + ): ch.send("You failed.\n") return stone = ch.slots.held - if not ch.is_immortal() and (stone is None or stone.item_type != merc.ITEM_WARP_STONE): + if not ch.is_immortal() and ( + stone is None or stone.item_type != merc.ITEM_WARP_STONE + ): ch.send("You lack the proper component for this spell.\n") return if stone and stone.item_type == merc.ITEM_WARP_STONE: - handler_game.act("You draw upon the power of $p.", ch, stone, None, merc.TO_CHAR) - handler_game.act("It flares brightly and vanishes! ", ch, stone, None, merc.TO_CHAR) + handler_game.act( + "You draw upon the power of $p.", ch, stone, None, merc.TO_CHAR + ) + handler_game.act( + "It flares brightly and vanishes! ", ch, stone, None, merc.TO_CHAR + ) ch.unequip(stone.equipped_to) ch.get(stone) stone.extract() - portal = object_creator.create_item(instance.item_templates[merc.OBJ_VNUM_PORTAL], 0) + portal = object_creator.create_item( + instance.item_templates[merc.OBJ_VNUM_PORTAL], 0 + ) portal.timer = 2 + level // 25 portal.value[3] = victim.in_room.instance_id @@ -48,8 +58,20 @@ def spell_portal(sn, level, ch, victim, target): handler_game.act("$p rises up before you.", ch, portal, None, merc.TO_CHAR) -const.register_spell(const.skill_type("portal", - {'mage': 35, 'cleric': 30, 'thief': 45, 'warrior': 40}, - {'mage': 2, 'cleric': 2, 'thief': 4, 'warrior': 4}, - spell_portal, merc.TAR_IGNORE, merc.POS_STANDING, None, const.SLOT(519), - 100, 24, "", "!Portal!", "")) +const.register_spell( + const.skill_type( + "portal", + {"mage": 35, "cleric": 30, "thief": 45, "warrior": 40}, + {"mage": 2, "cleric": 2, "thief": 4, "warrior": 4}, + spell_portal, + merc.TAR_IGNORE, + merc.POS_STANDING, + None, + const.SLOT(519), + 100, + 24, + "", + "!Portal!", + "", + ) +) diff --git a/src/rom24/spells/spell_protection_evil.py b/src/rom24/spells/spell_protection_evil.py index 7f78da9..7db01e3 100644 --- a/src/rom24/spells/spell_protection_evil.py +++ b/src/rom24/spells/spell_protection_evil.py @@ -4,8 +4,9 @@ def spell_protection_evil(sn, level, ch, victim, target): - if victim.is_affected( merc.AFF_PROTECT_EVIL) or victim.is_affected( - merc.AFF_PROTECT_GOOD): + if victim.is_affected(merc.AFF_PROTECT_EVIL) or victim.is_affected( + merc.AFF_PROTECT_GOOD + ): if victim == ch: ch.send("You are already protected.\n") else: @@ -25,8 +26,20 @@ def spell_protection_evil(sn, level, ch, victim, target): handler_game.act("$N is protected from evil.", ch, None, victim, merc.TO_CHAR) -const.register_spell(const.skill_type("protection evil", - {'mage': 12, 'cleric': 9, 'thief': 17, 'warrior': 11}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_protection_evil, merc.TAR_CHAR_SELF, merc.POS_STANDING, - None, const.SLOT(34), 5, 12, "", "You feel less protected.", "")) +const.register_spell( + const.skill_type( + "protection evil", + {"mage": 12, "cleric": 9, "thief": 17, "warrior": 11}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_protection_evil, + merc.TAR_CHAR_SELF, + merc.POS_STANDING, + None, + const.SLOT(34), + 5, + 12, + "", + "You feel less protected.", + "", + ) +) diff --git a/src/rom24/spells/spell_protection_good.py b/src/rom24/spells/spell_protection_good.py index c3e3fe9..6ce2705 100644 --- a/src/rom24/spells/spell_protection_good.py +++ b/src/rom24/spells/spell_protection_good.py @@ -4,8 +4,9 @@ def spell_protection_good(sn, level, ch, victim, target): - if victim.is_affected( merc.AFF_PROTECT_GOOD) or victim.is_affected( - merc.AFF_PROTECT_EVIL): + if victim.is_affected(merc.AFF_PROTECT_GOOD) or victim.is_affected( + merc.AFF_PROTECT_EVIL + ): if victim == ch: ch.send("You are already protected.\n") else: @@ -25,8 +26,20 @@ def spell_protection_good(sn, level, ch, victim, target): handler_game.act("$N is protected from good.", ch, None, victim, merc.TO_CHAR) -const.register_spell(const.skill_type("protection good", - {'mage': 12, 'cleric': 9, 'thief': 17, 'warrior': 11}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_protection_good, merc.TAR_CHAR_SELF, merc.POS_STANDING, - None, const.SLOT(514), 5, 12, "", "You feel less protected.", "")) +const.register_spell( + const.skill_type( + "protection good", + {"mage": 12, "cleric": 9, "thief": 17, "warrior": 11}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_protection_good, + merc.TAR_CHAR_SELF, + merc.POS_STANDING, + None, + const.SLOT(514), + 5, + 12, + "", + "You feel less protected.", + "", + ) +) diff --git a/src/rom24/spells/spell_ray_of_truth.py b/src/rom24/spells/spell_ray_of_truth.py index 70ee461..528faa1 100644 --- a/src/rom24/spells/spell_ray_of_truth.py +++ b/src/rom24/spells/spell_ray_of_truth.py @@ -12,11 +12,19 @@ def spell_ray_of_truth(sn, level, ch, victim, target): victim = ch ch.send("The energy explodes inside you! \n") if victim != ch: - handler_game.act("$n raises $s hand, and a blinding ray of light shoots forth! ", ch, None, None, merc.TO_ROOM) + handler_game.act( + "$n raises $s hand, and a blinding ray of light shoots forth! ", + ch, + None, + None, + merc.TO_ROOM, + ) ch.send("You raise your hand and a blinding ray of light shoots forth! \n") if state_checks.IS_GOOD(victim): - handler_game.act("$n seems unharmed by the light.", victim, None, victim, merc.TO_ROOM) + handler_game.act( + "$n seems unharmed by the light.", victim, None, victim, merc.TO_ROOM + ) victim.send("The light seems powerless to affect you.\n") return @@ -33,11 +41,25 @@ def spell_ray_of_truth(sn, level, ch, victim, target): dam = (dam * align * align) // 1000000 fight.damage(ch, victim, dam, sn, merc.DAM_HOLY, True) - const.skill_table['blindness'].spell_fun('blindness', 3 * level // 4, ch, victim, merc.TARGET_CHAR) + const.skill_table["blindness"].spell_fun( + "blindness", 3 * level // 4, ch, victim, merc.TARGET_CHAR + ) -const.register_spell(const.skill_type("ray of truth", - {'mage': 53, 'cleric': 35, 'thief': 53, 'warrior': 47}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_ray_of_truth, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(518), 20, 12, "ray of truth", "!Ray of Truth!", "")) +const.register_spell( + const.skill_type( + "ray of truth", + {"mage": 53, "cleric": 35, "thief": 53, "warrior": 47}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_ray_of_truth, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(518), + 20, + 12, + "ray of truth", + "!Ray of Truth!", + "", + ) +) diff --git a/src/rom24/spells/spell_recharge.py b/src/rom24/spells/spell_recharge.py index 97adf51..1c729cd 100644 --- a/src/rom24/spells/spell_recharge.py +++ b/src/rom24/spells/spell_recharge.py @@ -50,13 +50,29 @@ def spell_recharge(sn, level, ch, victim, target): obj.value[1] -= 1 return else: # whoops! */ - handler_game.act("$p glows brightly and explodes! ", ch, obj, None, merc.TO_CHAR) - handler_game.act("$p glows brightly and explodes! ", ch, obj, None, merc.TO_ROOM) + handler_game.act( + "$p glows brightly and explodes! ", ch, obj, None, merc.TO_CHAR + ) + handler_game.act( + "$p glows brightly and explodes! ", ch, obj, None, merc.TO_ROOM + ) obj.extract() -const.register_spell(const.skill_type("recharge", - {'mage': 9, 'cleric': 53, 'thief': 53, 'warrior': 53}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_recharge, merc.TAR_OBJ_INV, merc.POS_STANDING, None, - const.SLOT(517), 60, 24, "", "!Recharge!", "")) +const.register_spell( + const.skill_type( + "recharge", + {"mage": 9, "cleric": 53, "thief": 53, "warrior": 53}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_recharge, + merc.TAR_OBJ_INV, + merc.POS_STANDING, + None, + const.SLOT(517), + 60, + 24, + "", + "!Recharge!", + "", + ) +) diff --git a/src/rom24/spells/spell_refresh.py b/src/rom24/spells/spell_refresh.py index 63ba3b5..079f1fb 100644 --- a/src/rom24/spells/spell_refresh.py +++ b/src/rom24/spells/spell_refresh.py @@ -13,8 +13,20 @@ def spell_refresh(sn, level, ch, victim, target): return -const.register_spell(const.skill_type("refresh", - {'mage': 8, 'cleric': 5, 'thief': 12, 'warrior': 9}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_refresh, merc.TAR_CHAR_DEFENSIVE, merc.POS_STANDING, - None, const.SLOT(81), 12, 18, "refresh", "!Refresh!", "")) +const.register_spell( + const.skill_type( + "refresh", + {"mage": 8, "cleric": 5, "thief": 12, "warrior": 9}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_refresh, + merc.TAR_CHAR_DEFENSIVE, + merc.POS_STANDING, + None, + const.SLOT(81), + 12, + 18, + "refresh", + "!Refresh!", + "", + ) +) diff --git a/src/rom24/spells/spell_remove_curse.py b/src/rom24/spells/spell_remove_curse.py index c90cb4a..f8e3c1b 100644 --- a/src/rom24/spells/spell_remove_curse.py +++ b/src/rom24/spells/spell_remove_curse.py @@ -12,26 +12,30 @@ def spell_remove_curse(sn, level, ch, victim, target): obj = victim if obj.flags.no_drop or obj.flags.no_remove: - if not obj.flags.no_uncurse and not handler_magic.saves_dispel(level + 2, obj.level, 0): + if not obj.flags.no_uncurse and not handler_magic.saves_dispel( + level + 2, obj.level, 0 + ): state_checks.REMOVE_BIT(obj.extra_flags, merc.ITEM_NODROP) state_checks.REMOVE_BIT(obj.extra_flags, merc.ITEM_NOREMOVE) handler_game.act("$p glows blue.", ch, obj, None, merc.TO_ALL) return - handler_game.act("The curse on $p is beyond your power.", ch, obj, None, merc.TO_CHAR) + handler_game.act( + "The curse on $p is beyond your power.", ch, obj, None, merc.TO_CHAR + ) return - handler_game.act("There doesn't seem to be a curse on $p.", ch, obj, None, merc.TO_CHAR) + handler_game.act( + "There doesn't seem to be a curse on $p.", ch, obj, None, merc.TO_CHAR + ) return # characters */ - if handler_magic.check_dispel(level, victim, const.skill_table['curse']): + if handler_magic.check_dispel(level, victim, const.skill_table["curse"]): victim.send("You feel better.\n") handler_game.act("$n looks more relaxed.", victim, None, None, merc.TO_ROOM) for obj in victim.contents: - if (obj.flags.no_drop \ - or obj.flags.no_remove)\ - and not obj.flags.no_uncurse: + if (obj.flags.no_drop or obj.flags.no_remove) and not obj.flags.no_uncurse: # attempt to remove curse */ if not handler_magic.saves_dispel(level, obj.level, 0): state_checks.REMOVE_BIT(obj.extra_flags, merc.ITEM_NODROP) @@ -41,8 +45,20 @@ def spell_remove_curse(sn, level, ch, victim, target): break -const.register_spell(const.skill_type("remove curse", - {'mage': 53, 'cleric': 18, 'thief': 53, 'warrior': 22}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_remove_curse, merc.TAR_OBJ_CHAR_DEF, merc.POS_STANDING, - None, const.SLOT(35), 5, 12, "", "!Remove Curse!", "")) +const.register_spell( + const.skill_type( + "remove curse", + {"mage": 53, "cleric": 18, "thief": 53, "warrior": 22}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_remove_curse, + merc.TAR_OBJ_CHAR_DEF, + merc.POS_STANDING, + None, + const.SLOT(35), + 5, + 12, + "", + "!Remove Curse!", + "", + ) +) diff --git a/src/rom24/spells/spell_sanctuary.py b/src/rom24/spells/spell_sanctuary.py index b64f6f4..f02b059 100644 --- a/src/rom24/spells/spell_sanctuary.py +++ b/src/rom24/spells/spell_sanctuary.py @@ -4,11 +4,13 @@ def spell_sanctuary(sn, level, ch, victim, target): - if victim.is_affected( merc.AFF_SANCTUARY): + if victim.is_affected(merc.AFF_SANCTUARY): if victim == ch: ch.send("You are already in sanctuary.\n") else: - handler_game.act("$N is already in sanctuary.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N is already in sanctuary.", ch, None, victim, merc.TO_CHAR + ) return af = handler_game.AFFECT_DATA() @@ -20,12 +22,26 @@ def spell_sanctuary(sn, level, ch, victim, target): af.modifier = 0 af.bitvector = merc.AFF_SANCTUARY victim.affect_add(af) - handler_game.act("$n is surrounded by a white aura.", victim, None, None, merc.TO_ROOM) + handler_game.act( + "$n is surrounded by a white aura.", victim, None, None, merc.TO_ROOM + ) victim.send("You are surrounded by a white aura.\n") -const.register_spell(const.skill_type("sanctuary", - {'mage': 36, 'cleric': 20, 'thief': 42, 'warrior': 30}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_sanctuary, merc.TAR_CHAR_DEFENSIVE, merc.POS_STANDING, None, - const.SLOT(36), 75, 12, "", "The white aura around your body fades.", "")) +const.register_spell( + const.skill_type( + "sanctuary", + {"mage": 36, "cleric": 20, "thief": 42, "warrior": 30}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_sanctuary, + merc.TAR_CHAR_DEFENSIVE, + merc.POS_STANDING, + None, + const.SLOT(36), + 75, + 12, + "", + "The white aura around your body fades.", + "", + ) +) diff --git a/src/rom24/spells/spell_shield.py b/src/rom24/spells/spell_shield.py index 8accf86..fdd2beb 100644 --- a/src/rom24/spells/spell_shield.py +++ b/src/rom24/spells/spell_shield.py @@ -9,7 +9,9 @@ def spell_shield(sn, level, ch, victim, target): if victim == ch: ch.send("You are already shielded from harm.\n") else: - handler_game.act("$N is already protected by a shield.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N is already protected by a shield.", ch, None, victim, merc.TO_CHAR + ) return af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS @@ -20,13 +22,27 @@ def spell_shield(sn, level, ch, victim, target): af.modifier = -20 af.bitvector = 0 victim.affect_add(af) - handler_game.act("$n is surrounded by a force shield.", victim, None, None, merc.TO_ROOM) + handler_game.act( + "$n is surrounded by a force shield.", victim, None, None, merc.TO_ROOM + ) victim.send("You are surrounded by a force shield.\n") return -const.register_spell(const.skill_type("shield", - {'mage': 20, 'cleric': 35, 'thief': 35, 'warrior': 40}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_shield, merc.TAR_CHAR_DEFENSIVE, merc.POS_STANDING, None, - const.SLOT(67), 12, 18, "", "Your force shield shimmers then fades away.", "")) +const.register_spell( + const.skill_type( + "shield", + {"mage": 20, "cleric": 35, "thief": 35, "warrior": 40}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_shield, + merc.TAR_CHAR_DEFENSIVE, + merc.POS_STANDING, + None, + const.SLOT(67), + 12, + 18, + "", + "Your force shield shimmers then fades away.", + "", + ) +) diff --git a/src/rom24/spells/spell_shocking_grasp.py b/src/rom24/spells/spell_shocking_grasp.py index a2dd037..909dc01 100644 --- a/src/rom24/spells/spell_shocking_grasp.py +++ b/src/rom24/spells/spell_shocking_grasp.py @@ -6,12 +6,59 @@ def spell_shocking_grasp(sn, level, ch, victim, target): - dam_each = [0, - 0, 0, 0, 0, 0, 0, 20, 25, 29, 33, - 36, 39, 39, 39, 40, 40, 41, 41, 42, 42, - 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, - 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, - 53, 53, 54, 54, 55, 55, 56, 56, 57, 57] + dam_each = [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 20, + 25, + 29, + 33, + 36, + 39, + 39, + 39, + 40, + 40, + 41, + 41, + 42, + 42, + 43, + 43, + 44, + 44, + 45, + 45, + 46, + 46, + 47, + 47, + 48, + 48, + 49, + 49, + 50, + 50, + 51, + 51, + 52, + 52, + 53, + 53, + 54, + 54, + 55, + 55, + 56, + 56, + 57, + 57, + ] level = min(level, len(dam_each) - 1) level = max(0, level) @@ -21,8 +68,20 @@ def spell_shocking_grasp(sn, level, ch, victim, target): fight.damage(ch, victim, dam, sn, merc.DAM_LIGHTNING, True) -const.register_spell(const.skill_type("shocking grasp", - {'mage': 10, 'cleric': 53, 'thief': 14, 'warrior': 13}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_shocking_grasp, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, - None, const.SLOT(53), 15, 12, "shocking grasp", "!Shocking Grasp!", "")) +const.register_spell( + const.skill_type( + "shocking grasp", + {"mage": 10, "cleric": 53, "thief": 14, "warrior": 13}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_shocking_grasp, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(53), + 15, + 12, + "shocking grasp", + "!Shocking Grasp!", + "", + ) +) diff --git a/src/rom24/spells/spell_sleep.py b/src/rom24/spells/spell_sleep.py index 8ade391..7e622b8 100644 --- a/src/rom24/spells/spell_sleep.py +++ b/src/rom24/spells/spell_sleep.py @@ -6,10 +6,12 @@ def spell_sleep(sn, level, ch, victim, target): - if victim.is_affected( merc.AFF_SLEEP) \ - or (victim.is_npc() and victim.act.is_set(merc.ACT_UNDEAD)) \ - or (level + 2) < victim.level \ - or handler_magic.saves_spell(level - 4, victim, merc.DAM_CHARM): + if ( + victim.is_affected(merc.AFF_SLEEP) + or (victim.is_npc() and victim.act.is_set(merc.ACT_UNDEAD)) + or (level + 2) < victim.level + or handler_magic.saves_spell(level - 4, victim, merc.DAM_CHARM) + ): return af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS @@ -27,8 +29,20 @@ def spell_sleep(sn, level, ch, victim, target): victim.position = merc.POS_SLEEPING -const.register_spell(const.skill_type("sleep", - {'mage': 10, 'cleric': 53, 'thief': 11, 'warrior': 53}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_sleep, merc.TAR_CHAR_OFFENSIVE, merc.POS_STANDING, None, - const.SLOT(38), 15, 12, "", "You feel less tired.", "")) +const.register_spell( + const.skill_type( + "sleep", + {"mage": 10, "cleric": 53, "thief": 11, "warrior": 53}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_sleep, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_STANDING, + None, + const.SLOT(38), + 15, + 12, + "", + "You feel less tired.", + "", + ) +) diff --git a/src/rom24/spells/spell_slow.py b/src/rom24/spells/spell_slow.py index 56790ad..c1359df 100644 --- a/src/rom24/spells/spell_slow.py +++ b/src/rom24/spells/spell_slow.py @@ -6,21 +6,25 @@ def spell_slow(sn, level, ch, victim, target): - if state_checks.is_affected(victim, sn) or victim.is_affected( merc.AFF_SLOW): + if state_checks.is_affected(victim, sn) or victim.is_affected(merc.AFF_SLOW): if victim == ch: ch.send("You can't move any slower! \n") else: - handler_game.act("$N can't get any slower than that.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N can't get any slower than that.", ch, None, victim, merc.TO_CHAR + ) return - if handler_magic.saves_spell(level, victim, merc.DAM_OTHER) or state_checks.IS_SET(victim.imm_flags, merc.IMM_MAGIC): + if handler_magic.saves_spell(level, victim, merc.DAM_OTHER) or state_checks.IS_SET( + victim.imm_flags, merc.IMM_MAGIC + ): if victim != ch: ch.send("Nothing seemed to happen.\n") victim.send("You feel momentarily lethargic.\n") return - if victim.is_affected( merc.AFF_HASTE): - if not handler_magic.check_dispel(level, victim, const.skill_table['haste']): + if victim.is_affected(merc.AFF_HASTE): + if not handler_magic.check_dispel(level, victim, const.skill_table["haste"]): if victim != ch: ch.send("Spell failed.\n") victim.send("You feel momentarily slower.\n") @@ -38,11 +42,25 @@ def spell_slow(sn, level, ch, victim, target): af.bitvector = merc.AFF_SLOW victim.affect_add(af) victim.send("You feel yourself slowing d o w n...\n") - handler_game.act("$n starts to move in slow motion.", victim, None, None, merc.TO_ROOM) + handler_game.act( + "$n starts to move in slow motion.", victim, None, None, merc.TO_ROOM + ) -const.register_spell(const.skill_type("slow", - {'mage': 23, 'cleric': 30, 'thief': 29, 'warrior': 32}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_slow, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, None, - const.SLOT(515), 30, 12, "", "You feel yourself speed up.", "")) +const.register_spell( + const.skill_type( + "slow", + {"mage": 23, "cleric": 30, "thief": 29, "warrior": 32}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_slow, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(515), + 30, + 12, + "", + "You feel yourself speed up.", + "", + ) +) diff --git a/src/rom24/spells/spell_stone_skin.py b/src/rom24/spells/spell_stone_skin.py index 17a87e9..c339d54 100644 --- a/src/rom24/spells/spell_stone_skin.py +++ b/src/rom24/spells/spell_stone_skin.py @@ -9,7 +9,9 @@ def spell_stone_skin(sn, level, ch, victim, target): if victim == ch: ch.send("Your skin is already as hard as a rock.\n") else: - handler_game.act("$N is already as hard as can be.", ch, None, victim, merc.TO_CHAR) + handler_game.act( + "$N is already as hard as can be.", ch, None, victim, merc.TO_CHAR + ) return af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS @@ -24,8 +26,20 @@ def spell_stone_skin(sn, level, ch, victim, target): victim.send("Your skin turns to stone.\n") -const.register_spell(const.skill_type("stone skin", - {'mage': 25, 'cleric': 40, 'thief': 40, 'warrior': 45}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_stone_skin, merc.TAR_CHAR_SELF, merc.POS_STANDING, None, - const.SLOT(66), 12, 18, "", "Your skin feels soft again.", "")) +const.register_spell( + const.skill_type( + "stone skin", + {"mage": 25, "cleric": 40, "thief": 40, "warrior": 45}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_stone_skin, + merc.TAR_CHAR_SELF, + merc.POS_STANDING, + None, + const.SLOT(66), + 12, + 18, + "", + "Your skin feels soft again.", + "", + ) +) diff --git a/src/rom24/spells/spell_summon.py b/src/rom24/spells/spell_summon.py index 249e309..1d56ae5 100644 --- a/src/rom24/spells/spell_summon.py +++ b/src/rom24/spells/spell_summon.py @@ -7,22 +7,26 @@ def spell_summon(sn, level, ch, victim, target): victim = ch.get_char_world(handler_magic.target_name) - if not victim \ - or victim == ch \ - or victim.in_room == None \ - or state_checks.IS_SET(ch.in_room.room_flags, merc.ROOM_SAFE) \ - or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_SAFE) \ - or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_PRIVATE) \ - or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_SOLITARY) \ - or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_NO_RECALL) \ - or (victim.is_npc() and victim.act.is_set(merc.ACT_AGGRESSIVE)) \ - or victim.level >= level + 3 \ - or (not victim.is_npc() and victim.level >= merc.LEVEL_IMMORTAL) \ - or victim.fighting is not None \ - or (victim.is_npc() and victim.imm_flags.is_set(merc.IMM_SUMMON)) \ - or (victim.is_npc() and victim.pShop is not None) \ - or (not victim.is_npc() and victim.act.is_set(merc.PLR_NOSUMMON)) \ - or (victim.is_npc() and handler_magic.saves_spell(level, victim, merc.DAM_OTHER)): + if ( + not victim + or victim == ch + or victim.in_room == None + or state_checks.IS_SET(ch.in_room.room_flags, merc.ROOM_SAFE) + or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_SAFE) + or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_PRIVATE) + or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_SOLITARY) + or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_NO_RECALL) + or (victim.is_npc() and victim.act.is_set(merc.ACT_AGGRESSIVE)) + or victim.level >= level + 3 + or (not victim.is_npc() and victim.level >= merc.LEVEL_IMMORTAL) + or victim.fighting is not None + or (victim.is_npc() and victim.imm_flags.is_set(merc.IMM_SUMMON)) + or (victim.is_npc() and victim.pShop is not None) + or (not victim.is_npc() and victim.act.is_set(merc.PLR_NOSUMMON)) + or ( + victim.is_npc() and handler_magic.saves_spell(level, victim, merc.DAM_OTHER) + ) + ): ch.send("You failed.\n") return @@ -34,8 +38,20 @@ def spell_summon(sn, level, ch, victim, target): victim.do_look("auto") -const.register_spell(const.skill_type("summon", - {'mage': 24, 'cleric': 12, 'thief': 29, 'warrior': 22}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_summon, merc.TAR_IGNORE, merc.POS_STANDING, None, - const.SLOT(40), 50, 12, "", "!Summon!", "")) +const.register_spell( + const.skill_type( + "summon", + {"mage": 24, "cleric": 12, "thief": 29, "warrior": 22}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_summon, + merc.TAR_IGNORE, + merc.POS_STANDING, + None, + const.SLOT(40), + 50, + 12, + "", + "!Summon!", + "", + ) +) diff --git a/src/rom24/spells/spell_teleport.py b/src/rom24/spells/spell_teleport.py index 6c7f3eb..9f3ad36 100644 --- a/src/rom24/spells/spell_teleport.py +++ b/src/rom24/spells/spell_teleport.py @@ -7,12 +7,16 @@ def spell_teleport(sn, level, ch, victim, target): - if victim.in_room == None \ - or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_NO_RECALL) \ - or ( victim != ch and victim.imm_flags.is_set(merc.IMM_SUMMON)) \ - or ( not ch.is_npc() and victim.fighting is not None ) \ - or ( victim != ch \ - and ( handler_magic.saves_spell(level - 5, victim, merc.DAM_OTHER))): + if ( + victim.in_room == None + or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_NO_RECALL) + or (victim != ch and victim.imm_flags.is_set(merc.IMM_SUMMON)) + or (not ch.is_npc() and victim.fighting is not None) + or ( + victim != ch + and (handler_magic.saves_spell(level - 5, victim, merc.DAM_OTHER)) + ) + ): ch.send("You failed.\n") return @@ -24,12 +28,26 @@ def spell_teleport(sn, level, ch, victim, target): handler_game.act("$n vanishes! ", victim, None, None, merc.TO_ROOM) victim.in_room.get(victim) random_room.put(victim) - handler_game.act("$n slowly fades into existence.", victim, None, None, merc.TO_ROOM) + handler_game.act( + "$n slowly fades into existence.", victim, None, None, merc.TO_ROOM + ) victim.do_look("auto") -const.register_spell(const.skill_type("teleport", - {'mage': 13, 'cleric': 22, 'thief': 25, 'warrior': 36}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_teleport, merc.TAR_CHAR_SELF, merc.POS_FIGHTING, None, - const.SLOT(2), 35, 12, "", "!Teleport!", "")) +const.register_spell( + const.skill_type( + "teleport", + {"mage": 13, "cleric": 22, "thief": 25, "warrior": 36}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_teleport, + merc.TAR_CHAR_SELF, + merc.POS_FIGHTING, + None, + const.SLOT(2), + 35, + 12, + "", + "!Teleport!", + "", + ) +) diff --git a/src/rom24/spells/spell_ventriloquate.py b/src/rom24/spells/spell_ventriloquate.py index 2e1b7f9..fcf4526 100644 --- a/src/rom24/spells/spell_ventriloquate.py +++ b/src/rom24/spells/spell_ventriloquate.py @@ -12,4 +12,6 @@ def spell_ventriloquate(sn, level, ch, victim, target): for vch_id in ch.in_room.people: vch = instance.characters[vch_id] if not is_exact_name(speaker, vch.name) and state_checks.IS_AWAKE(vch): - vch.send(buf2 if handler_magic.saves_spell(level, vch, merc.DAM_OTHER) else buf1) + vch.send( + buf2 if handler_magic.saves_spell(level, vch, merc.DAM_OTHER) else buf1 + ) diff --git a/src/rom24/spells/spell_weaken.py b/src/rom24/spells/spell_weaken.py index e6355db..60ebfd6 100644 --- a/src/rom24/spells/spell_weaken.py +++ b/src/rom24/spells/spell_weaken.py @@ -6,7 +6,9 @@ def spell_weaken(sn, level, ch, victim, target): - if state_checks.is_affected(victim, sn) or handler_magic.saves_spell(level, victim, merc.DAM_OTHER): + if state_checks.is_affected(victim, sn) or handler_magic.saves_spell( + level, victim, merc.DAM_OTHER + ): return af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS @@ -21,8 +23,20 @@ def spell_weaken(sn, level, ch, victim, target): handler_game.act("$n looks tired and weak.", victim, None, None, merc.TO_ROOM) -const.register_spell(const.skill_type("weaken", - {'mage': 11, 'cleric': 14, 'thief': 16, 'warrior': 17}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_weaken, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, None, - const.SLOT(68), 20, 12, "spell", "You feel stronger.", "")) +const.register_spell( + const.skill_type( + "weaken", + {"mage": 11, "cleric": 14, "thief": 16, "warrior": 17}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_weaken, + merc.TAR_CHAR_OFFENSIVE, + merc.POS_FIGHTING, + None, + const.SLOT(68), + 20, + 12, + "spell", + "You feel stronger.", + "", + ) +) diff --git a/src/rom24/spells/spell_word_of_recall.py b/src/rom24/spells/spell_word_of_recall.py index 6d89dd9..48a9ede 100644 --- a/src/rom24/spells/spell_word_of_recall.py +++ b/src/rom24/spells/spell_word_of_recall.py @@ -16,7 +16,9 @@ def spell_word_of_recall(sn, level, ch, victim, target): victim.send("You are completely lost.\n") return - if state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_NO_RECALL) or victim.is_affected(merc.AFF_CURSE): + if state_checks.IS_SET( + victim.in_room.room_flags, merc.ROOM_NO_RECALL + ) or victim.is_affected(merc.AFF_CURSE): victim.send("Spell failed.\n") return @@ -31,8 +33,20 @@ def spell_word_of_recall(sn, level, ch, victim, target): victim.do_look("auto") -const.register_spell(const.skill_type("word of recall", - {'mage': 32, 'cleric': 28, 'thief': 40, 'warrior': 30}, - {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2}, - spell_word_of_recall, merc.TAR_CHAR_SELF, merc.POS_RESTING, None, - const.SLOT(42), 5, 12, "", "!Word of Recall!", "")) # * Dragon breath */) +const.register_spell( + const.skill_type( + "word of recall", + {"mage": 32, "cleric": 28, "thief": 40, "warrior": 30}, + {"mage": 1, "cleric": 1, "thief": 2, "warrior": 2}, + spell_word_of_recall, + merc.TAR_CHAR_SELF, + merc.POS_RESTING, + None, + const.SLOT(42), + 5, + 12, + "", + "!Word of Recall!", + "", + ) +) # * Dragon breath */) diff --git a/src/rom24/state_checks.py b/src/rom24/state_checks.py index a718a02..2081159 100644 --- a/src/rom24/state_checks.py +++ b/src/rom24/state_checks.py @@ -1,5 +1,4 @@ - -__author__ = 'syn' +__author__ = "syn" import time import logging @@ -20,8 +19,8 @@ def REMOVE_BIT(var, bit): return var & ~bit -#utility functions -def name_lookup(pdict, arg, key='name'): +# utility functions +def name_lookup(pdict, arg, key="name"): for i, n in pdict.items(): if getattr(n, key) == arg: return i @@ -105,16 +104,21 @@ def IS_AWAKE(ch): def GET_AC(ch, ptype): from rom24.const import dex_app - return ch.armor[ptype] + (dex_app[ch.stat(merc.STAT_DEX)].defensive if IS_AWAKE(ch) else 0) + + return ch.armor[ptype] + ( + dex_app[ch.stat(merc.STAT_DEX)].defensive if IS_AWAKE(ch) else 0 + ) def GET_HITROLL(ch): from rom24.const import str_app + return ch.hitroll + str_app[ch.stat(merc.STAT_STR)].tohit def GET_DAMROLL(ch): from rom24.const import str_app + return ch.damroll + str_app[ch.stat(merc.STAT_STR)].todam @@ -134,7 +138,8 @@ def get_carry_weight(ch): return ch.carry_weight + (ch.silver // 10 + (ch.gold * 2 // 5)) - # Object macros. +# Object macros. + def CAN_WEAR(item, part): return IS_SET(item.wear_flags, part) @@ -147,6 +152,7 @@ def IS_WEAPON_STAT(item, stat): def WEIGHT_MULT(item): return item.value[4] if item.item_type is merc.ITEM_CONTAINER else 100 + def check_blind(ch): if not IS_NPC(ch) and IS_SET(ch.act, merc.PLR_HOLYLIGHT): return True diff --git a/src/rom24/sys_utils.py b/src/rom24/sys_utils.py index 50abe30..b9c1109 100644 --- a/src/rom24/sys_utils.py +++ b/src/rom24/sys_utils.py @@ -1,4 +1,4 @@ -__author__ = 'quixadhal' +__author__ = "quixadhal" import psutil import time @@ -6,6 +6,7 @@ from collections import Iterable import itertools import logging + logger = logging.getLogger(__name__) @@ -23,6 +24,7 @@ class ResourceSnapshot: """ Creates a snapshot of system information as an object. """ + def __init__(self): sysmem = psutil.virtual_memory() proc = psutil.Process() @@ -38,7 +40,7 @@ def __init__(self): self._proc_io_read = proc_io.read_count self._proc_io_write = proc_io.write_count - def system_boot_time(self, raw: bool=False): + def system_boot_time(self, raw: bool = False): """ Returns the host machine's boot time. If raw is True, it returns the raw time value, otherwise @@ -54,7 +56,7 @@ def system_boot_time(self, raw: bool=False): else: return sysTimeStamp(self._boot_time) - def system_memory_available(self, raw: bool=False): + def system_memory_available(self, raw: bool = False): """ Returns the current amount of system RAM available. If raw is True, the number is in bytes, otherwise @@ -68,7 +70,7 @@ def system_memory_available(self, raw: bool=False): else: return self._sysmem_available // (1024 * 1024) - def system_memory_total(self, raw: bool=False): + def system_memory_total(self, raw: bool = False): """ Returns the total amount of RAM in the system. If raw is True, the number is in bytes, otherwise @@ -90,7 +92,7 @@ def system_memory_percent_used(self): """ return self._sysmem_percent - def process_start_time(self, raw: bool=False): + def process_start_time(self, raw: bool = False): """ Returns the time this process started running. If raw is True, it returns the raw time value, otherwise @@ -104,7 +106,7 @@ def process_start_time(self, raw: bool=False): else: return sysTimeStamp(self._proc_create_time) - def current_time(self, raw: bool=False): + def current_time(self, raw: bool = False): """ Returns the time the snapshot was taken. If raw is True, it returns the raw time value, otherwise @@ -118,7 +120,7 @@ def current_time(self, raw: bool=False): else: return sysTimeStamp(self._time) - def process_memory(self, raw: bool=False): + def process_memory(self, raw: bool = False): """ Returns the RSS size of the process. If raw is True, the number is in bytes, otherwise @@ -132,7 +134,7 @@ def process_memory(self, raw: bool=False): else: return self._proc_rss // (1024 * 1024) - def process_io(self, write: bool=False): + def process_io(self, write: bool = False): """ Returns the number of I/O operations the process has performed. If write is True, it returns the number of output operations, @@ -156,17 +158,20 @@ def log_data(self): :return: """ results = ( - 'Snapshot time: %s' % (self.current_time()), - 'System booted at: %s' % (self.system_boot_time()), - 'System has %dM of %dM available (%.3f%% used)' % (self.system_memory_available(), - self.system_memory_total(), - self.system_memory_percent_used()), - 'Driver started at: %s' % (self.process_start_time()), - 'Driver is currently using %dM of RAM' % (self.process_memory()), - 'Driver has performed %d read and %d write I/O operations.' % (self.process_io(), - self.process_io(True)), + "Snapshot time: %s" % (self.current_time()), + "System booted at: %s" % (self.system_boot_time()), + "System has %dM of %dM available (%.3f%% used)" + % ( + self.system_memory_available(), + self.system_memory_total(), + self.system_memory_percent_used(), + ), + "Driver started at: %s" % (self.process_start_time()), + "Driver is currently using %dM of RAM" % (self.process_memory()), + "Driver has performed %d read and %d write I/O operations." + % (self.process_io(), self.process_io(True)), ) - spaces = '\n' + ' ' * 51 + spaces = "\n" + " " * 51 output = spaces.join(results) return output diff --git a/src/rom24/tables.py b/src/rom24/tables.py index 1ab8a4d..953cc90 100644 --- a/src/rom24/tables.py +++ b/src/rom24/tables.py @@ -1,13 +1,12 @@ - from collections import OrderedDict, namedtuple import logging logger = logging.getLogger(__name__) -clan_type = namedtuple('clan_type', 'name, who_name, hall, independent') +clan_type = namedtuple("clan_type", "name, who_name, hall, independent") clan_table = OrderedDict() -position_type = namedtuple('position_type', 'name, short_name') +position_type = namedtuple("position_type", "name, short_name") position_table = OrderedDict() sex_table = OrderedDict() @@ -16,7 +15,7 @@ size_table = [] # various flag tables */ -flag_type = namedtuple('flag_type', 'name, bit, settable') +flag_type = namedtuple("flag_type", "name, bit, settable") act_flags = OrderedDict() plr_flags = OrderedDict() affect_flags = OrderedDict() diff --git a/src/rom24/type_bypass.py b/src/rom24/type_bypass.py index 5971bcd..e5a5fec 100644 --- a/src/rom24/type_bypass.py +++ b/src/rom24/type_bypass.py @@ -1,9 +1,10 @@ -__author__ = 'syn' +__author__ = "syn" import logging logger = logging.getLogger(__name__) + class ObjectType: def __init__(self): super().__init__() @@ -11,5 +12,5 @@ def __init__(self): self.is_room = False self.is_living = False self.is_area = False - #self.is_npc = False - #self.is_pc = False + # self.is_npc = False + # self.is_pc = False diff --git a/src/rom24/uait/legacy_loads.py b/src/rom24/uait/legacy_loads.py index d8842a2..9891f50 100644 --- a/src/rom24/uait/legacy_loads.py +++ b/src/rom24/uait/legacy_loads.py @@ -21,6 +21,7 @@ serializer_list = [] + class AREA_SERIALIZER: def __init__(self): self.area_name = "" @@ -45,45 +46,50 @@ def to_Pickle(self): os.makedirs(reset_save_dir, 0o755, True) os.makedirs(shop_save_dir, 0o755, True) for area in self.area: - with open(area_save_dir + "/" + self.area_name + '.pickle', 'wb') as af: + with open(area_save_dir + "/" + self.area_name + ".pickle", "wb") as af: pickle.dump(area, af, pickle.HIGHEST_PROTOCOL) - af.close() for room in self.rooms: - with open(room_save_dir + "/" + str(room.vnum) + settings.PKL_EXTN, 'wb') as rf: + with open( + room_save_dir + "/" + str(room.vnum) + settings.PKL_EXTN, "wb" + ) as rf: pickle.dump(room, rf, pickle.HIGHEST_PROTOCOL) - rf.close() for mob in self.mobiles: - with open(mobile_save_dir + "/" + str(mob.vnum) + settings.PKL_EXTN, 'wb') as mf: + with open( + mobile_save_dir + "/" + str(mob.vnum) + settings.PKL_EXTN, "wb" + ) as mf: pickle.dump(mob, mf, pickle.HIGHEST_PROTOCOL) - mf.close() for object in self.objects: - with open(obj_save_dir + "/" + str(object.vnum) + settings.PKL_EXTN, 'wb') as of: + with open( + obj_save_dir + "/" + str(object.vnum) + settings.PKL_EXTN, "wb" + ) as of: pickle.dump(object, of, pickle.HIGHEST_PROTOCOL) - of.close() for shop in self.shops: - with open(shop_save_dir + "/" + str(shop.keeper) + settings.PKL_EXTN, 'wb') as sf: + with open( + shop_save_dir + "/" + str(shop.keeper) + settings.PKL_EXTN, "wb" + ) as sf: pickle.dump(shop, sf, pickle.HIGHEST_PROTOCOL) - sf.close() for reset in self.resets: - with open(reset_save_dir + "/" + str(reset) + settings.PKL_EXTN, 'wb') as ref: + with open( + reset_save_dir + "/" + str(reset) + settings.PKL_EXTN, "wb" + ) as ref: pickle.dump(reset, ref, pickle.HIGHEST_PROTOCOL) - ref.close() -__author__ = 'syn' def do_apickle(ch, argument): ch.send("Saving areas to pickle format..\n\n") save.area_pickler(ch) - open(os.path.join(settings.LEGACY_AREA_DIR, settings.PAREA_LIST), 'w').close() # lets write a clean list - open(os.path.join(settings.LEGACY_AREA_DIR, settings.SOCIAL_LIST), 'w').close() - with open(os.path.join(settings.LEGACY_AREA_DIR, settings.PAREA_LIST), 'a') as alf: + open( + os.path.join(settings.LEGACY_AREA_DIR, settings.PAREA_LIST), "w" + ).close() # lets write a clean list + open(os.path.join(settings.LEGACY_AREA_DIR, settings.SOCIAL_LIST), "w").close() + with open(os.path.join(settings.LEGACY_AREA_DIR, settings.PAREA_LIST), "a") as alf: ch.send("Writing Area List...\n\n") for area in merc.area_list: alf.write(area.name) alf.write("$") alf.close() ch.send("Area List Saved.\n\n") - with open(os.path.join(settings.LEGACY_AREA_DIR, settings.SOCIAL_LIST), 'a') as slf: + with open(os.path.join(settings.LEGACY_AREA_DIR, settings.SOCIAL_LIST), "a") as slf: ch.send("Writing Social List...\n\n") for social in merc.social_list: slf.write(social.name) @@ -92,23 +98,27 @@ def do_apickle(ch, argument): ch.send("Social List Saved.\n\n") return -interp.register_command(interp.cmd_type('apickle', do_apickle, merc.POS_DEAD, merc.ML, merc.LOG_ALWAYS, 1)) +interp.register_command( + interp.cmd_type("apickle", do_apickle, merc.POS_DEAD, merc.ML, merc.LOG_ALWAYS, 1) +) + + +# to_Pickle() +# os.makedirs(settings.HELP_DIR, 0o755, True) +# with open(os.path.join(settings.HELP_DIR, 'help_files' + settings.PKL_EXTN), 'wb') as hf: +# pickle.dump(merc.help_list, hf, pickle.HIGHEST_PROTOCOL) +# print("\n\nSaving Helpfiles...\n\n") +# hf.close() +# for zsocial in merc.social_list: +# os.makedirs(settings.SOCIAL_DIR, exist_ok=True) +# social_file = zsocial.name + settings.PKL_EXTN +# with open(os.path.join(settings.SOCIAL_DIR, social_file), 'wb') as sf: +# pickle.dump(zsocial, sf, pickle.HIGHEST_PROTOCOL) +# print("Saving Social: %s\n" % zsocial.name) +# sf.close() +# print("All Done..\n\n") -to_Pickle() - os.makedirs(settings.HELP_DIR, 0o755, True) - with open(os.path.join(settings.HELP_DIR, 'help_files' + settings.PKL_EXTN), 'wb') as hf: - pickle.dump(merc.help_list, hf, pickle.HIGHEST_PROTOCOL) - print("\n\nSaving Helpfiles...\n\n") - hf.close() - for zsocial in merc.social_list: - os.makedirs(settings.SOCIAL_DIR, 0o755, True) - social_file = zsocial.name + settings.PKL_EXTN - with open(os.path.join(settings.SOCIAL_DIR, social_file), 'wb') as sf: - pickle.dump(zsocial, sf, pickle.HIGHEST_PROTOCOL) - print("Saving Social: %s\n" % zsocial.name) - sf.close() - print("All Done..\n\n") def to_Pickle(): for area_serial in world_classes.serializer_list: @@ -125,36 +135,51 @@ def to_Pickle(): os.makedirs(reset_save_dir, 0o755, True) os.makedirs(shop_save_dir, 0o755, True) for area in area_serial.area: - with open(area_save_dir + "/" + area_serial.area_name + '.pickle', 'wb') as af: + with open( + area_save_dir + "/" + area_serial.area_name + ".pickle", "wb" + ) as af: pickle.dump(area, af, pickle.HIGHEST_PROTOCOL) af.close() for room in area_serial.rooms: - with open(room_save_dir + "/" + str(room.vnum) + settings.PKL_EXTN, 'wb') as rf: + with open( + room_save_dir + "/" + str(room.vnum) + settings.PKL_EXTN, "wb" + ) as rf: pickle.dump(room, rf, pickle.HIGHEST_PROTOCOL) rf.close() for mob in area_serial.mobiles: - with open(mobile_save_dir + "/" + str(mob.vnum) + settings.PKL_EXTN, 'wb') as mf: + with open( + mobile_save_dir + "/" + str(mob.vnum) + settings.PKL_EXTN, "wb" + ) as mf: pickle.dump(mob, mf, pickle.HIGHEST_PROTOCOL) mf.close() for object in area_serial.objects: - with open(obj_save_dir + "/" + str(object.vnum) + settings.PKL_EXTN, 'wb') as of: + with open( + obj_save_dir + "/" + str(object.vnum) + settings.PKL_EXTN, "wb" + ) as of: pickle.dump(object, of, pickle.HIGHEST_PROTOCOL) of.close() for shop in area_serial.shops: - with open(shop_save_dir + "/" + str(shop.keeper) + settings.PKL_EXTN, 'wb') as sf: + with open( + shop_save_dir + "/" + str(shop.keeper) + settings.PKL_EXTN, "wb" + ) as sf: pickle.dump(shop, sf, pickle.HIGHEST_PROTOCOL) sf.close() for reset in area_serial.resets: - with open(reset_save_dir + "/" + str(reset) + settings.PKL_EXTN, 'wb') as ref: + with open( + reset_save_dir + "/" + str(reset) + settings.PKL_EXTN, "wb" + ) as ref: pickle.dump(reset, ref, pickle.HIGHEST_PROTOCOL) ref.close() + def load_areas(): area_list = os.path.join(settings.LEGACY_AREA_DIR, settings.PAREA_LIST) - alf = open(area_list, 'r') + alf = open(area_list, "r") parea = alf.readline().strip() while parea != "$": - with open(os.path.join(settings.LEGACY_AREA_DIR, parea, parea + ".pickle"), 'rb') as af: + with open( + os.path.join(settings.LEGACY_AREA_DIR, parea, parea + ".pickle"), "rb" + ) as af: zarea = pickle.load(af) merc.area_list.append(zarea) load_rooms(zarea.room_dict()) @@ -165,12 +190,14 @@ def load_areas(): logger.info("Area %s loaded", zarea.name) af.close() alf.close() - logger.info('Game Data Load Complete.') + logger.info("Game Data Load Complete.") def load_helps(): count = 0 - with open(os.path.join(settings.HELP_DIR, settings.HELP_FILE + settings.PKL_EXTN), 'rb') as hf: + with open( + os.path.join(settings.HELP_DIR, settings.HELP_FILE + settings.PKL_EXTN), "rb" + ) as hf: helps = pickle.load(hf) for item in helps: count += 1 @@ -220,38 +247,43 @@ def load_shops(shop_dict): def load_socials(): - slf = open(settings.SOCIAL_LIST, 'r') + slf = open(settings.SOCIAL_LIST, "r") social = slf.readline().strip() while social != "$": - with open(os.path.join(settings.SOCIAL_DIR, social + settings.PKL_EXTN), 'rb') as sf: + with open( + os.path.join(settings.SOCIAL_DIR, social + settings.PKL_EXTN), "rb" + ) as sf: social_file = pickle.load(sf) merc.social_list.append(social_file) logger.info("Social %s loaded", social_file.name) sf.close() slf.close() + def load_areas(): - logger.info('Loading Areas...') + logger.info("Loading Areas...") parea_list = os.path.join(settings.LEGACY_AREA_DIR, settings.PAREA_LIST) - fp = open(settings.AREA_LIST_FILE, 'r') + fp = open(settings.AREA_LIST_FILE, "r") area = fp.readline().strip() while area != "$": - afp = open(os.path.join(settings.LEGACY_AREA_DIR, area), 'r') + afp = open(os.path.join(settings.LEGACY_AREA_DIR, area), "r") load_area(afp.read()) area = fp.readline().strip() afp.close() fp.close() - fp = open(parea_list, 'r') + fp = open(parea_list, "r") parea = fp.readline().strip() while parea != "$": - with open(os.path.join(settings.LEGACY_AREA_DIR, parea, parea + ".pickle"), 'rb') as ff: + with open( + os.path.join(settings.LEGACY_AREA_DIR, parea, parea + ".pickle"), "rb" + ) as ff: zarea = pickle.load(ff) merc.area_list.append(zarea) parea = fp.readline().strip() print(zarea.name, "loaded area name from pickle") ff.close() fp.close() - logger.info('Done. (loading areas)') + logger.info("Done. (loading areas)") def load_area(area): @@ -286,10 +318,10 @@ def load_area(area): area = load_socials(area) elif w == "#SPECIALS": area = load_specials(area) - elif w == '#$': + elif w == "#$": break else: - logger.error('Bad section name: %s', w) + logger.error("Bad section name: %s", w) area, w = game_utils.read_word(area, False) @@ -300,7 +332,7 @@ def load_helps(area): area, nhelp.level = game_utils.read_int(area) area, nhelp.keyword = game_utils.read_string(area) - if nhelp.keyword == '$': + if nhelp.keyword == "$": del nhelp break @@ -317,7 +349,7 @@ def load_mobiles(area, pArea): area, w = game_utils.read_word(area, False) w = w[1:] # strip the pound - while w != '0': + while w != "0": mob = handler_ch.Mobile() mob.vnum = int(w) instance.npc_templates[mob.vnum] = mob @@ -366,8 +398,12 @@ def load_mobiles(area, pArea): mob.vuln_flags = mob.vuln_flags | mob.race.vuln area, mob.start_pos = game_utils.read_word(area, False) area, mob.default_pos = game_utils.read_word(area, False) - mob.start_pos = state_checks.name_lookup(tables.position_table, mob.start_pos, 'short_name') - mob.default_pos = state_checks.name_lookup(tables.position_table, mob.default_pos, 'short_name') + mob.start_pos = state_checks.name_lookup( + tables.position_table, mob.start_pos, "short_name" + ) + mob.default_pos = state_checks.name_lookup( + tables.position_table, mob.default_pos, "short_name" + ) area, sex = game_utils.read_word(area, False) mob.sex = state_checks.value_lookup(tables.sex_table, sex) area, mob.wealth = game_utils.read_int(area) @@ -379,7 +415,7 @@ def load_mobiles(area, pArea): area, mob.material = game_utils.read_word(area, False) area, w = game_utils.read_word(area, False) mob.size = tables.size_table.index(mob.size) - while w == 'F': + while w == "F": area, word = game_utils.read_word(area, False) area, vector = game_utils.read_flags(area) area, w = game_utils.read_word(area, False) @@ -391,7 +427,7 @@ def load_mobiles(area, pArea): def load_objects(area, pArea): area, w = game_utils.read_word(area, False) w = w[1:] # strip the pound - while w != '0': + while w != "0": obj = handler_item.Items() obj.vnum = int(w) instance.item_templates[obj.vnum] = obj @@ -418,7 +454,9 @@ def load_objects(area, pArea): area, obj.value[2] = game_utils.read_int(area) area, obj.value[3] = game_utils.read_int(area) area, obj.value[4] = game_utils.read_int(area) - elif obj.item_type == merc.ITEM_DRINK_CON or obj.item_type == merc.ITEM_FOUNTAIN: + elif ( + obj.item_type == merc.ITEM_DRINK_CON or obj.item_type == merc.ITEM_FOUNTAIN + ): area, obj.value[0] = game_utils.read_int(area) area, obj.value[1] = game_utils.read_int(area) area, obj.value[2] = game_utils.read_word(area, False) @@ -430,7 +468,11 @@ def load_objects(area, pArea): area, obj.value[2] = game_utils.read_int(area) area, obj.value[3] = game_utils.read_word(area, False) area, obj.value[4] = game_utils.read_int(area) - elif obj.item_type == merc.ITEM_POTION or obj.item_type == merc.ITEM_SCROLL or obj.item_type == merc.ITEM_PILL: + elif ( + obj.item_type == merc.ITEM_POTION + or obj.item_type == merc.ITEM_SCROLL + or obj.item_type == merc.ITEM_PILL + ): area, obj.value[0] = game_utils.read_int(area) area, obj.value[1] = game_utils.read_word(area, False) area, obj.value[2] = game_utils.read_word(area, False) @@ -447,35 +489,35 @@ def load_objects(area, pArea): area, obj.weight = game_utils.read_int(area) area, obj.cost = game_utils.read_int(area) area, obj.condition = game_utils.read_word(area, False) - if obj.condition == 'P': + if obj.condition == "P": obj.condition = 100 - elif obj.condition == 'G': + elif obj.condition == "G": obj.condition = 90 - elif obj.condition == 'A': + elif obj.condition == "A": obj.condition = 75 - elif obj.condition == 'W': + elif obj.condition == "W": obj.condition = 50 - elif obj.condition == 'D': + elif obj.condition == "D": obj.condition = 25 - elif obj.condition == 'B': + elif obj.condition == "B": obj.condition = 10 - elif obj.condition == 'R': + elif obj.condition == "R": obj.condition = 0 else: obj.condition = 100 area, w = game_utils.read_word(area, False) - while w == 'F' or w == 'A' or w == 'E': - if w == 'F': + while w == "F" or w == "A" or w == "E": + if w == "F": area, word = game_utils.read_word(area, False) area, number = game_utils.read_int(area) area, number = game_utils.read_int(area) area, flags = game_utils.read_flags(area) - elif w == 'A': + elif w == "A": area, number = game_utils.read_int(area) area, number = game_utils.read_int(area) - elif w == 'E': + elif w == "E": ed = world_classes.ExtraDescrData() area, ed.keyword = game_utils.read_string(area) area, ed.description = game_utils.read_string(area) @@ -491,10 +533,10 @@ def load_objects(area, pArea): def load_resets(area, pArea): while True: area, letter = game_utils.read_letter(area) - if letter == 'S': + if letter == "S": break - if letter == '*': + if letter == "*": area, t = game_utils.read_to_eol(area) continue @@ -503,8 +545,12 @@ def load_resets(area, pArea): area, number = game_utils.read_int(area) # if_flag area, reset.arg1 = game_utils.read_int(area) area, reset.arg2 = game_utils.read_int(area) - area, reset.arg3 = (area, 0) if letter == 'G' or letter == 'R' else game_utils.read_int(area) - area, reset.arg4 = game_utils.read_int(area) if letter == 'P' or letter == 'M' else (area, 0) + area, reset.arg3 = ( + (area, 0) if letter == "G" or letter == "R" else game_utils.read_int(area) + ) + area, reset.arg4 = ( + game_utils.read_int(area) if letter == "P" or letter == "M" else (area, 0) + ) area, t = game_utils.read_to_eol(area) pArea.reset_list.append(reset) merc.reset_list.append(reset) @@ -515,11 +561,11 @@ def load_resets(area, pArea): def load_rooms(area, pArea): area, w = game_utils.read_word(area, False) w = w[1:] # strip the pound - while w != '0': + while w != "0": room = handler_room.Room() room.vnum = int(w) if room.vnum in instance.room_templates: - logger.critical('Dupicate room Vnum: %d', room.vnum) + logger.critical("Dupicate room Vnum: %d", room.vnum) sys.exit(1) instance.room_templates[room.vnum] = room @@ -532,15 +578,15 @@ def load_rooms(area, pArea): while True: area, letter = game_utils.read_letter(area) - if letter == 'S': + if letter == "S": break - elif letter == 'H': # Healing Room + elif letter == "H": # Healing Room area, room.heal_rate = game_utils.read_int(area) - elif letter == 'M': # Mana Room + elif letter == "M": # Mana Room area, room.mana_rate = game_utils.read_int(area) - elif letter == 'C': # Clan + elif letter == "C": # Clan area, room.clan = game_utils.read_string(area) - elif letter == 'D': # exit + elif letter == "D": # exit nexit = world_classes.Exit() area, door = game_utils.read_int(area) area, nexit.description = game_utils.read_string(area) @@ -549,15 +595,18 @@ def load_rooms(area, pArea): area, nexit.key = game_utils.read_int(area) area, nexit.to_room = game_utils.read_int(area) room.exit[door] = nexit - elif letter == 'E': + elif letter == "E": ed = world_classes.ExtraDescrData() area, ed.keyword = game_utils.read_string(area) area, ed.description = game_utils.read_string(area) room.extra_descr.append(ed) - elif letter == 'O': + elif letter == "O": area, room.owner = game_utils.read_string(area) else: - logger.critical("RoomIndexData(%d) has flag other than SHMCDEO: %s", (room.vnum, letter)) + logger.critical( + "RoomIndexData(%d) has flag other than SHMCDEO: %s", + (room.vnum, letter), + ) sys.exit(1) area, w = game_utils.read_word(area, False) w = w[1:] # strip the pound @@ -590,15 +639,15 @@ def load_socials(area): while True: area, word = game_utils.read_word(area, False) - if word == '#0': + if word == "#0": return social = handler_game.SOCIAL_DATA() social.name = word area, throwaway = game_utils.read_to_eol(area) area, line = game_utils.read_to_eol(area) - if line == '$': + if line == "$": social.char_no_arg = None - elif line == '#': + elif line == "#": if social not in merc.social_list: merc.social_list.append(social) continue @@ -607,9 +656,9 @@ def load_socials(area): area, line = game_utils.read_to_eol(area) - if line == '$': + if line == "$": social.others_no_arg = None - elif line == '#': + elif line == "#": if social not in merc.social_list: merc.social_list.append(social) continue @@ -617,9 +666,9 @@ def load_socials(area): social.others_no_arg = line area, line = game_utils.read_to_eol(area) - if line == '$': + if line == "$": social.char_found = None - elif line == '#': + elif line == "#": if social not in merc.social_list: merc.social_list.append(social) continue @@ -627,9 +676,9 @@ def load_socials(area): social.char_found = line area, line = game_utils.read_to_eol(area) - if line == '$': + if line == "$": social.others_found = None - elif line == '#': + elif line == "#": if social not in merc.social_list: merc.social_list.append(social) continue @@ -637,9 +686,9 @@ def load_socials(area): social.others_found = line area, line = game_utils.read_to_eol(area) - if line == '$': + if line == "$": social.vict_found = None - elif line == '#': + elif line == "#": if social not in merc.social_list: merc.social_list.append(social) continue @@ -647,9 +696,9 @@ def load_socials(area): social.vict_found = line area, line = game_utils.read_to_eol(area) - if line == '$': + if line == "$": social.char_not_found = None - elif line == '#': + elif line == "#": if social not in merc.social_list: merc.social_list.append(social) continue @@ -657,9 +706,9 @@ def load_socials(area): social.char_not_found = line area, line = game_utils.read_to_eol(area) - if line == '$': + if line == "$": social.char_auto = None - elif line == '#': + elif line == "#": if social not in merc.social_list: merc.social_list.append(social) continue @@ -667,9 +716,9 @@ def load_socials(area): social.char_auto = line area, line = game_utils.read_to_eol(area) - if line == '$': + if line == "$": social.others_auto = None - elif line == '#': + elif line == "#": if social not in merc.social_list: merc.social_list.append(social) continue @@ -685,14 +734,16 @@ def load_specials(area): while True: area, letter = game_utils.read_letter(area) - if letter == '*': + if letter == "*": area, t = game_utils.read_to_eol(area) continue - elif letter == 'S': + elif letter == "S": return area - elif letter == 'M': + elif letter == "M": area, vnum = game_utils.read_int(area) - area, instance.npc_templates[vnum].spec_fun = game_utils.read_word(area, False) + area, instance.npc_templates[vnum].spec_fun = game_utils.read_word( + area, False + ) else: logger.error("Load_specials: letter noth *SM: %s", letter) diff --git a/src/rom24/update.py b/src/rom24/update.py index 799c284..d7bdda3 100644 --- a/src/rom24/update.py +++ b/src/rom24/update.py @@ -1,5 +1,3 @@ - - import os import random import time @@ -25,11 +23,19 @@ def advance_level(ch, hide): ch.last_level = (ch.played + (int)(merc.current_time - ch.logon)) // 3600 - buf = "the %s" % (const.title_table[ch.guild.name][ch.level][1 if ch.sex == merc.SEX_FEMALE else 0]) + buf = "the %s" % ( + const.title_table[ch.guild.name][ch.level][ + 1 if ch.sex == merc.SEX_FEMALE else 0 + ] + ) game_utils.set_title(ch, buf) - add_hp = const.con_app[ch.stat(merc.STAT_CON)].hitp + random.randint(ch.guild.hp_min, ch.guild.hp_max) - add_mana = random.randint(2, (2 * ch.stat(merc.STAT_INT) + ch.stat(merc.STAT_WIS)) // 5) + add_hp = const.con_app[ch.stat(merc.STAT_CON)].hitp + random.randint( + ch.guild.hp_min, ch.guild.hp_max + ) + add_mana = random.randint( + 2, (2 * ch.stat(merc.STAT_INT) + ch.stat(merc.STAT_WIS)) // 5 + ) if not ch.guild.fMana: add_mana //= 2 add_move = random.randint(1, (ch.stat(merc.STAT_CON) + ch.stat(merc.STAT_DEX)) // 6) @@ -54,8 +60,17 @@ def advance_level(ch, hide): ch.perm_move += add_move if not hide: - ch.send("You gain %d hit point%s, %d mana, %d move, and %d practice%s.\n" % ( - add_hp, "" if add_hp == 1 else "s", add_mana, add_move, add_prac, "" if add_prac == 1 else "s")) + ch.send( + "You gain %d hit point%s, %d mana, %d move, and %d practice%s.\n" + % ( + add_hp, + "" if add_hp == 1 else "s", + add_mana, + add_move, + add_prac, + "" if add_prac == 1 else "s", + ) + ) def gain_exp(ch, gain): @@ -63,11 +78,15 @@ def gain_exp(ch, gain): return ch.exp = max(ch.exp_per_level(ch.points), ch.exp + gain) - while ch.level < merc.LEVEL_HERO and ch.exp >= ch.exp_per_level(ch.points) * (ch.level + 1): + while ch.level < merc.LEVEL_HERO and ch.exp >= ch.exp_per_level(ch.points) * ( + ch.level + 1 + ): ch.send("You raise a level!! ") ch.level += 1 print("%s gained level %d\r\n" % (ch.name, ch.level)) - handler_game.wiznet("$N has attained level %d!" % ch.level, ch, None, merc.WIZ_LEVELS, 0, 0) + handler_game.wiznet( + "$N has attained level %d!" % ch.level, ch, None, merc.WIZ_LEVELS, 0, 0 + ) advance_level(ch, False) ch.save() @@ -94,11 +113,11 @@ def hit_gain(ch): gain = max(3, ch.stat(merc.STAT_CON) - 3 + ch.level // 2) gain += ch.guild.hp_max - 10 number = random.randint(1, 99) - if number < ch.get_skill('fast healing'): + if number < ch.get_skill("fast healing"): gain += number * gain // 100 if ch.hit < ch.max_hit: if ch.is_pc: - ch.check_improve('fast healing', True, 8) + ch.check_improve("fast healing", True, 8) if ch.position == merc.POS_SLEEPING: pass @@ -149,11 +168,11 @@ def mana_gain(ch): else: gain = (ch.stat(merc.STAT_WIS) + ch.stat(merc.STAT_INT) + ch.level) // 2 number = random.randint(1, 99) - if number < ch.get_skill('meditation'): + if number < ch.get_skill("meditation"): gain += number * gain // 100 if ch.mana < ch.max_mana: if ch.is_pc: - ch.check_improve( 'meditation', True, 8) + ch.check_improve("meditation", True, 8) if not ch.guild.fMana: gain //= 2 @@ -254,7 +273,9 @@ def npc_update(): if not npc.is_npc() or npc.in_room is None or npc.is_affected(merc.AFF_CHARM): continue - if instance.area_templates[npc.in_room.area] and not npc.act.is_set(merc.ACT_UPDATE_ALWAYS): + if instance.area_templates[npc.in_room.area] and not npc.act.is_set( + merc.ACT_UPDATE_ALWAYS + ): continue # Examine call for special procedure */ @@ -272,12 +293,21 @@ def npc_update(): continue # Scavenge */ - if npc.act.is_set(merc.ACT_SCAVENGER) and npc.in_room.items is not None and random.randint(0, 6) == 0: + if ( + npc.act.is_set(merc.ACT_SCAVENGER) + and npc.in_room.items is not None + and random.randint(0, 6) == 0 + ): top = 1 item_best = None for item_id in npc.in_room.items: item = instance.items[item_id] - if item.take and npc.can_loot(item) and item.cost > top and item.cost > 0: + if ( + item.take + and npc.can_loot(item) + and item.cost > top + and item.cost > 0 + ): item_best = item top = item.cost @@ -290,18 +320,32 @@ def npc_update(): door = random.randint(0, 5) pexit = npc.in_room.exit[door] - if not npc.act.is_set(merc.ACT_SENTINEL) \ - and random.randint(0, 3) == 0 \ - and pexit \ - and pexit.to_room \ - and not pexit.exit_info.is_set(merc.EX_CLOSED) \ - and not state_checks.IS_SET(instance.rooms[pexit.to_room].room_flags, merc.ROOM_NO_MOB) \ - and (not npc.act.is_set(merc.ACT_STAY_AREA) - or instance.rooms[pexit.to_room].area == npc.in_room.area) \ - and (not npc.act.is_set(merc.ACT_OUTDOORS) - or not state_checks.IS_SET(instance.rooms[pexit.to_room].room_flags, merc.ROOM_INDOORS)) \ - and (not npc.act.is_set(merc.ACT_INDOORS) - or state_checks.IS_SET(instance.rooms[pexit.to_room].room_flags, merc.ROOM_INDOORS)): + if ( + not npc.act.is_set(merc.ACT_SENTINEL) + and random.randint(0, 3) == 0 + and pexit + and pexit.to_room + and not pexit.exit_info.is_set(merc.EX_CLOSED) + and not state_checks.IS_SET( + instance.rooms[pexit.to_room].room_flags, merc.ROOM_NO_MOB + ) + and ( + not npc.act.is_set(merc.ACT_STAY_AREA) + or instance.rooms[pexit.to_room].area == npc.in_room.area + ) + and ( + not npc.act.is_set(merc.ACT_OUTDOORS) + or not state_checks.IS_SET( + instance.rooms[pexit.to_room].room_flags, merc.ROOM_INDOORS + ) + ) + and ( + not npc.act.is_set(merc.ACT_INDOORS) + or state_checks.IS_SET( + instance.rooms[pexit.to_room].room_flags, merc.ROOM_INDOORS + ) + ) + ): handler_ch.move_char(npc, door, False) @@ -333,7 +377,6 @@ def weather_update(): handler_game.time_info.month = 0 handler_game.time_info.year += 1 - # # * Weather change. if 9 <= handler_game.time_info.month <= 16: @@ -341,7 +384,9 @@ def weather_update(): else: diff = -2 if handler_game.weather_info.mmhg > 1015 else 2 - handler_game.weather_info.change += diff * game_utils.dice(1, 4) + game_utils.dice(2, 6) - game_utils.dice(2, 6) + handler_game.weather_info.change += ( + diff * game_utils.dice(1, 4) + game_utils.dice(2, 6) - game_utils.dice(2, 6) + ) handler_game.weather_info.change = max(handler_game.weather_info.change, -12) handler_game.weather_info.change = min(handler_game.weather_info.change, 12) @@ -351,12 +396,14 @@ def weather_update(): if handler_game.weather_info.sky == merc.SKY_CLOUDLESS: if handler_game.weather_info.mmhg < 990 or ( - handler_game.weather_info.mmhg < 1010 and random.randint(0, 2) == 0 ): + handler_game.weather_info.mmhg < 1010 and random.randint(0, 2) == 0 + ): buf += "The sky is getting cloudy.\n" handler_game.weather_info.sky = merc.SKY_CLOUDY elif handler_game.weather_info.sky == merc.SKY_CLOUDY: if handler_game.weather_info.mmhg < 970 or ( - handler_game.weather_info.mmhg < 990 and random.randint(0, 2) == 0 ): + handler_game.weather_info.mmhg < 990 and random.randint(0, 2) == 0 + ): buf += "It starts to rain.\n" handler_game.weather_info.sky = merc.SKY_RAINING if handler_game.weather_info.mmhg > 1030 and random.randint(0, 2) == 0: @@ -367,12 +414,14 @@ def weather_update(): buf += "Lightning flashes in the sky.\n" handler_game.weather_info.sky = merc.SKY_LIGHTNING if handler_game.weather_info.mmhg > 1030 or ( - handler_game.weather_info.mmhg > 1010 and random.randint(0, 2) == 0 ): + handler_game.weather_info.mmhg > 1010 and random.randint(0, 2) == 0 + ): buf += "The rain stopped.\n" handler_game.weather_info.sky = merc.SKY_CLOUDY elif handler_game.weather_info.sky == merc.SKY_LIGHTNING: if handler_game.weather_info.mmhg > 1010 or ( - handler_game.weather_info.mmhg > 990 and random.randint(0, 2) == 0 ): + handler_game.weather_info.mmhg > 990 and random.randint(0, 2) == 0 + ): buf += "The lightning has stopped.\n" handler_game.weather_info.sky = merc.SKY_RAINING else: @@ -381,9 +430,13 @@ def weather_update(): if buf: import nanny + for char in instance.players.items(): - if char.desc.is_connected(nanny.con_playing) and state_checks.IS_OUTSIDE(char) and state_checks.IS_AWAKE( - char): + if ( + char.desc.is_connected(nanny.con_playing) + and state_checks.IS_OUTSIDE(char) + and state_checks.IS_AWAKE(char) + ): char.send(buf) return @@ -407,9 +460,15 @@ def char_update(): if ch.position >= merc.POS_STUNNED: # check to see if we need to go home */ - if ch.is_npc() and ch.zone and ch.zone != instance.area_templates[ch.zone] \ - and not ch.desc and not ch.fighting\ - and not ch.is_affected(merc.AFF_CHARM) and random.randint(1, 99) < 5: + if ( + ch.is_npc() + and ch.zone + and ch.zone != instance.area_templates[ch.zone] + and not ch.desc + and not ch.fighting + and not ch.is_affected(merc.AFF_CHARM) + and random.randint(1, 99) < 5 + ): handler_game.act("$n wanders on home.", ch, None, None, merc.TO_ROOM) ch.extract(True) id_list.remove(character_id) @@ -434,13 +493,15 @@ def char_update(): fight.update_pos(ch) if not ch.is_npc() and ch.level < merc.LEVEL_IMMORTAL: - item = ch.get_eq('light') + item = ch.get_eq("light") if item and item.item_type == merc.ITEM_LIGHT and item.value[2] > 0: item.value[2] -= 1 if item.value[2] == 0 and ch.in_room is not None: ch.in_room.available_light -= 1 handler_game.act("$p goes out.", ch, item, None, merc.TO_ROOM) - handler_game.act("$p flickers and goes out.", ch, item, None, merc.TO_CHAR) + handler_game.act( + "$p flickers and goes out.", ch, item, None, merc.TO_CHAR + ) item.extract() elif item.value[2] <= 5 and ch.in_room: handler_game.act("$p flickers.", ch, item, None, merc.TO_CHAR) @@ -453,7 +514,9 @@ def char_update(): ch.was_in_room = ch.in_room if ch.fighting: fight.stop_fighting(ch, True) - handler_game.act("$n disappears into the void.", ch, None, None, merc.TO_ROOM) + handler_game.act( + "$n disappears into the void.", ch, None, None, merc.TO_ROOM + ) ch.send("You disappear into the void.\n") if ch.level > 1: ch.save() @@ -465,7 +528,9 @@ def char_update(): gain_condition(ch, merc.COND_DRUNK, -1) gain_condition(ch, merc.COND_FULL, -4 if ch.size > merc.SIZE_MEDIUM else -2) gain_condition(ch, merc.COND_THIRST, -1) - gain_condition(ch, merc.COND_HUNGER, -2 if ch.size > merc.SIZE_MEDIUM else -1) + gain_condition( + ch, merc.COND_HUNGER, -2 if ch.size > merc.SIZE_MEDIUM else -1 + ) for paf in ch.affected[:]: if paf.duration > 0: @@ -476,7 +541,11 @@ def char_update(): pass else: # multiple affects. don't send the spelldown msg - multi = [a for a in ch.affected if a.type == paf.type and a is not paf and a.duration > 0] + multi = [ + a + for a in ch.affected + if a.type == paf.type and a is not paf and a.duration > 0 + ] if not multi and paf.type and const.skill_table[paf.type].msg_off: ch.send(const.skill_table[paf.type].msg_off + "\n") @@ -487,13 +556,19 @@ def char_update(): # * as it may be lethal damage (on NPC). # */ - if state_checks.is_affected(ch, 'plague') and ch: + if state_checks.is_affected(ch, "plague") and ch: if ch.in_room is None: continue - handler_game.act("$n writhes in agony as plague sores erupt from $s skin.", ch, None, None, merc.TO_ROOM) + handler_game.act( + "$n writhes in agony as plague sores erupt from $s skin.", + ch, + None, + None, + merc.TO_ROOM, + ) ch.send("You writhe in agony from the plague.\n") - af = [a for a in ch.affected if af.type == 'plague'][:1] + af = [a for a in ch.affected if af.type == "plague"][:1] if not af: ch.affected_by.rem_bit(merc.AFF_PLAGUE) continue @@ -501,7 +576,7 @@ def char_update(): continue plague = handler_game.AFFECT_DATA() plague.where = merc.TO_AFFECTS - plague.type = 'plague' + plague.type = "plague" plague.level = af.level - 1 plague.duration = random.randint(1, 2 * plague.level) plague.location = merc.APPLY_STR @@ -510,21 +585,35 @@ def char_update(): for vch_id in ch.in_room.people[:]: vch = instance.characters[vch_id] - if not handler_magic.saves_spell(plague.level - 2, vch, merc.DAM_DISEASE) and not vch.is_immmortal() \ - and not vch.is_affected(merc.AFF_PLAGUE) and random.randint(0, 4) == 0: + if ( + not handler_magic.saves_spell( + plague.level - 2, vch, merc.DAM_DISEASE + ) + and not vch.is_immmortal() + and not vch.is_affected(merc.AFF_PLAGUE) + and random.randint(0, 4) == 0 + ): vch.send("You feel hot and feverish.\n") - handler_game.act("$n shivers and looks very ill.", vch, None, None, merc.TO_ROOM) + handler_game.act( + "$n shivers and looks very ill.", vch, None, None, merc.TO_ROOM + ) vch.affect_join(plague) dam = min(ch.level, af.level // 5 + 1) ch.mana -= dam ch.move -= dam - fight.damage(ch, ch, dam, 'plague', merc.DAM_DISEASE, False) - elif ch.is_affected(merc.AFF_POISON) and ch and not ch.is_affected(merc.AFF_SLOW): - poison = state_checks.affect_find(ch.affected, 'poison') + fight.damage(ch, ch, dam, "plague", merc.DAM_DISEASE, False) + elif ( + ch.is_affected(merc.AFF_POISON) and ch and not ch.is_affected(merc.AFF_SLOW) + ): + poison = state_checks.affect_find(ch.affected, "poison") if poison: - handler_game.act("$n shivers and suffers.", ch, None, None, merc.TO_ROOM) + handler_game.act( + "$n shivers and suffers.", ch, None, None, merc.TO_ROOM + ) ch.send("You shiver and suffer.\n") - fight.damage(ch, ch, poison.level // 10 + 1, 'poison', merc.DAM_POISON, False) + fight.damage( + ch, ch, poison.level // 10 + 1, "poison", merc.DAM_POISON, False + ) elif ch.position == merc.POS_INCAP and random.randint(0, 1) == 0: fight.damage(ch, ch, 1, merc.TYPE_UNDEFINED, merc.DAM_NONE, False) elif ch.position == merc.POS_MORTAL: @@ -557,15 +646,30 @@ def item_update(): elif paf.duration < 0: pass else: - multi = [a for a in item.affected if a.type == paf.type and a is not paf and a.duration > 0] + multi = [ + a + for a in item.affected + if a.type == paf.type and a is not paf and a.duration > 0 + ] if multi and paf.type > 0 and const.skill_table[paf.type].msg_obj: if item.in_living: rch = instance.characters[item.in_living] - handler_game.act(const.skill_table[paf.type].msg_obj, rch, item, None, merc.TO_CHAR) + handler_game.act( + const.skill_table[paf.type].msg_obj, + rch, + item, + None, + merc.TO_CHAR, + ) if item.in_room is not None and item.in_room.people[:]: - handler_game.act(const.skill_table[paf.type].msg_obj, - item.in_room.people, item, None, merc.TO_ALL) + handler_game.act( + const.skill_table[paf.type].msg_obj, + item.in_room.people, + item, + None, + merc.TO_ALL, + ) item.affect_remove(paf) item.timer -= 1 if item.timer <= 0 or item.timer > 0: @@ -595,19 +699,43 @@ def item_update(): message = "$p crumbles into dust." if item.in_living: - if state_checks.IS_NPC(instance.characters[item.in_living]) and instance.characters[item.in_living].pShop: + if ( + state_checks.IS_NPC(instance.characters[item.in_living]) + and instance.characters[item.in_living].pShop + ): instance.characters[item.in_living].silver += item.cost // 5 else: - handler_game.act(message, instance.characters[item.in_living], item, None, merc.TO_CHAR) - if 'float' in item.equipped_to: - handler_game.act(message, instance.characters[item.in_living], item, None, merc.TO_ROOM) + handler_game.act( + message, + instance.characters[item.in_living], + item, + None, + merc.TO_CHAR, + ) + if "float" in item.equipped_to: + handler_game.act( + message, + instance.characters[item.in_living], + item, + None, + merc.TO_ROOM, + ) elif item.in_room and item.in_room.people[:]: - if not (item.in_item and instance.items[item.in_item].vnum == merc.OBJ_VNUM_PIT - and not item.take): - handler_game.act(message, item.in_room.people[:1], item, None, merc.TO_ROOM) - handler_game.act(message, item.in_room.people[:1], item, None, merc.TO_CHAR) - - if (item.item_type == merc.ITEM_CORPSE_PC or 'float' in item.equipped_to) and item.inventory: + if not ( + item.in_item + and instance.items[item.in_item].vnum == merc.OBJ_VNUM_PIT + and not item.take + ): + handler_game.act( + message, item.in_room.people[:1], item, None, merc.TO_ROOM + ) + handler_game.act( + message, item.in_room.people[:1], item, None, merc.TO_CHAR + ) + + if ( + item.item_type == merc.ITEM_CORPSE_PC or "float" in item.equipped_to + ) and item.inventory: # save the contents */ for t_item_id in item.inventory[:]: t_item = instance.items[t_item_id] @@ -616,7 +744,7 @@ def item_update(): if item.in_item: # in another object */ t_item.put(item.in_item) elif item.in_living: # carried */ - if 'float' in item.equipped_to: + if "float" in item.equipped_to: if item.in_living.in_room is None: t_item.extract() else: @@ -647,24 +775,28 @@ def item_update(): # */ def aggr_update(): for wch in instance.characters.values(): - if wch.is_npc() \ - or wch.level >= merc.LEVEL_IMMORTAL \ - or wch.in_room is None \ - or wch.in_area.empty: + if ( + wch.is_npc() + or wch.level >= merc.LEVEL_IMMORTAL + or wch.in_room is None + or wch.in_area.empty + ): continue for ch_id in wch.in_room.people[:]: ch = instance.characters[ch_id] - if not ch.is_npc() \ - or not ch.act.is_set(merc.ACT_AGGRESSIVE) \ - or state_checks.IS_SET(ch.in_room.room_flags, merc.ROOM_SAFE) \ - or ch.is_affected(merc.AFF_CALM) \ - or ch.fighting is not None \ - or ch.is_affected(merc.AFF_CHARM) \ - or not ch.is_awake() \ - or (ch.act.is_set(merc.ACT_WIMPY) and wch.is_awake()) \ - or not ch.can_see(wch) \ - or random.randint(0, 1) == 0: + if ( + not ch.is_npc() + or not ch.act.is_set(merc.ACT_AGGRESSIVE) + or state_checks.IS_SET(ch.in_room.room_flags, merc.ROOM_SAFE) + or ch.is_affected(merc.AFF_CALM) + or ch.fighting is not None + or ch.is_affected(merc.AFF_CHARM) + or not ch.is_awake() + or (ch.act.is_set(merc.ACT_WIMPY) and wch.is_awake()) + or not ch.can_see(wch) + or random.randint(0, 1) == 0 + ): continue # @@ -675,11 +807,13 @@ def aggr_update(): victim = None for vch_id in wch.in_room.people[:]: vch = instance.characters[vch_id] - if not vch.is_npc() \ - and vch.level < merc.LEVEL_IMMORTAL \ - and ch.level >= vch.level - 5 \ - and (not ch.act.is_set(merc.ACT_WIMPY) or not vch.is_awake()) \ - and ch.can_see(vch): + if ( + not vch.is_npc() + and vch.level < merc.LEVEL_IMMORTAL + and ch.level >= vch.level - 5 + and (not ch.act.is_set(merc.ACT_WIMPY) or not vch.is_awake()) + and ch.can_see(vch) + ): if random.randint(0, count) == 0: victim = vch count += 1 @@ -693,11 +827,16 @@ def aggr_update(): def instance_number_save(): if instance.max_instance_id > instance.previous_max_instance_id: instance.previous_max_instance_id = instance.max_instance_id - instance_num_file = os.path.join(settings.LEGACY_AREA_DIR, "instance_tracker.txt") - fp = open(settings.INSTANCE_NUM_FILE, 'w') + instance_num_file = os.path.join( + settings.LEGACY_AREA_DIR, "instance_tracker.txt" + ) + fp = open(settings.INSTANCE_NUM_FILE, "w") fp.write(str(instance.max_instance_id)) fp.close() - logger.info("Saved the current instance number: %d" % (instance.max_instance_id,)) + logger.info( + "Saved the current instance number: %d" % (instance.max_instance_id,) + ) + # # * Handle all kinds of updates. @@ -720,7 +859,7 @@ def update_handler(): current_time = get_precise_time() if previous_pulse == -1: - previous_pulse = current_time-1 + previous_pulse = current_time - 1 while current_time >= previous_pulse + merc.MILLISECONDS_PER_PULSE: previous_pulse += merc.MILLISECONDS_PER_PULSE @@ -758,4 +897,4 @@ def update_handler(): def get_precise_time(): - return int(round(time.time()*1000)) + return int(round(time.time() * 1000)) diff --git a/src/rom24/world_classes.py b/src/rom24/world_classes.py index 4385b6a..0dc4355 100644 --- a/src/rom24/world_classes.py +++ b/src/rom24/world_classes.py @@ -14,7 +14,7 @@ from rom24 import type_bypass from rom24 import bit -__author__ = 'syn' +__author__ = "syn" class Area(instance.Instancer, type_bypass.ObjectType, environment.Environment): @@ -37,14 +37,18 @@ def __init__(self, template=None, **kwargs): self.high_range = 0 self.min_vnum = 0 self.max_vnum = 0 - #Empty is a check for if the area contains player_characters or not for use in resets, should default True - #As in, this area is just loaded and has no PC objects, True + # Empty is a check for if the area contains player_characters or not for use in resets, should default True + # As in, this area is just loaded and has no PC objects, True self.empty = False self.player_chars = [] if kwargs: [setattr(self, k, copy.deepcopy(v)) for k, v in kwargs.items()] if template: - [setattr(self, k, copy.deepcopy(v)) for k, v in template.__dict__.items() if k not in instance.not_to_instance] + [ + setattr(self, k, copy.deepcopy(v)) + for k, v in template.__dict__.items() + if k not in instance.not_to_instance + ] self.instancer() if self.instance_id: self.instance_setup() @@ -69,15 +73,22 @@ def __del__(self): def __repr__(self): if self.instance_id: - return "" % (self.instance_id, self.index, self.name, - self.file_name, - self.min_vnum, - self.max_vnum) + return "" % ( + self.instance_id, + self.index, + self.name, + self.file_name, + self.min_vnum, + self.max_vnum, + ) else: - return "" % (self.index, self.name, - self.file_name, - self.min_vnum, - self.max_vnum) + return "" % ( + self.index, + self.name, + self.file_name, + self.min_vnum, + self.max_vnum, + ) @property def player_count(self): @@ -86,24 +97,36 @@ def player_count(self): def add_pc(self, player_char): if player_char.is_living and not player_char.is_npc(): if not player_char.instance_id in self.player_chars: - #Transition an empty area, to an occupied one, for Resets + # Transition an empty area, to an occupied one, for Resets if self.empty: self.empty = False self.age = 0 self.player_chars += [player_char.instance_id] else: - raise ValueError('Player Character already in player_chars list! %d' % player_char.instance_id) + raise ValueError( + "Player Character already in player_chars list! %d" + % player_char.instance_id + ) else: - raise KeyError('Entity not a player character, or is an NPC on area addition! %r' % type(player_char)) + raise KeyError( + "Entity not a player character, or is an NPC on area addition! %r" + % type(player_char) + ) def remove_pc(self, player_char): if player_char.is_living and not player_char.is_npc(): if player_char.instance_id in self.player_chars: self.player_chars.remove(player_char.instance_id) else: - raise ValueError('Player Character not in player_chars list! %d' % player_char.instance_id) + raise ValueError( + "Player Character not in player_chars list! %d" + % player_char.instance_id + ) else: - raise KeyError('Entity not a player character, or is an NPC on area removal! %r' % type(player_char)) + raise KeyError( + "Entity not a player character, or is an NPC on area removal! %r" + % type(player_char) + ) def instance_setup(self): instance.global_instances[self.instance_id] = self @@ -126,12 +149,12 @@ def to_json(self, outer_encoder=None): for k, v in self.__dict__.items(): if str(type(v)) in ("", ""): continue - elif str(k) in ('_last_saved', '_md5'): + elif str(k) in ("_last_saved", "_md5"): continue else: tmp_dict[k] = v - cls_name = '__class__/' + __name__ + '.' + self.__class__.__name__ + cls_name = "__class__/" + __name__ + "." + self.__class__.__name__ return {cls_name: outer_encoder(tmp_dict)} @classmethod @@ -139,13 +162,13 @@ def from_json(cls, data, outer_decoder=None): if outer_decoder is None: outer_decoder = json.JSONDecoder.decode - cls_name = '__class__/' + __name__ + '.' + cls.__name__ + cls_name = "__class__/" + __name__ + "." + cls.__name__ if cls_name in data: tmp_data = outer_decoder(data[cls_name]) return cls(**tmp_data) return data - def save(self, force: bool=False): + def save(self, force: bool = False): if self._last_saved is None: self._last_saved = time.time() - settings.SAVE_LIMITER - 2 if not force and time.time() < self._last_saved + settings.SAVE_LIMITER: @@ -157,23 +180,23 @@ def save(self, force: bool=False): else: top_dir = settings.AREA_DIR number = self.index - pathname = os.path.join(top_dir, '%d-%s' % (number, self.name)) + pathname = os.path.join(top_dir, "%d-%s" % (number, self.name)) os.makedirs(pathname, 0o755, True) - filename = os.path.join(pathname, '%d-area.json' % number) + filename = os.path.join(pathname, "%d-area.json" % number) # logger.info('Saving %s', filename) js = json.dumps(self, default=instance.to_json, indent=4, sort_keys=True) - md5 = hashlib.md5(js.encode('utf-8')).hexdigest() + md5 = hashlib.md5(js.encode("utf-8")).hexdigest() if self._md5 != md5: self._md5 = md5 - with open(filename, 'w') as fp: + with open(filename, "w") as fp: fp.write(js) @classmethod - def load(cls, index: int=None, instance_id: int=None): + def load(cls, index: int = None, instance_id: int = None): if instance_id: if instance_id in instance.characters: - logger.warn('Instance %d of npc already loaded!', instance_id) + logger.warn("Instance %d of npc already loaded!", instance_id) return top_dir = settings.INSTANCE_DIR number = instance_id @@ -181,21 +204,21 @@ def load(cls, index: int=None, instance_id: int=None): top_dir = settings.AREA_DIR number = index - target_file = '%d-area.json' % number + target_file = "%d-area.json" % number filename = None for a_path, a_directory, i_files in os.walk(top_dir): if target_file in i_files: filename = os.path.join(a_path, target_file) break if not filename: - raise ValueError('Cannot find %s' % target_file) + raise ValueError("Cannot find %s" % target_file) - with open(filename, 'r') as fp: + with open(filename, "r") as fp: obj = json.load(fp, object_hook=instance.from_json) if isinstance(obj, Area): return obj else: - logger.error('Could not load area data for %d', number) + logger.error("Could not load area data for %d", number) return None @@ -205,6 +228,7 @@ def __init__(self, **kwargs): self.description = "" if kwargs: import copy + [setattr(self, k, copy.deepcopy(v)) for k, v in kwargs.items()] def to_json(self, outer_encoder=None): @@ -218,7 +242,7 @@ def to_json(self, outer_encoder=None): else: tmp_dict[k] = v - cls_name = '__class__/' + __name__ + '.' + self.__class__.__name__ + cls_name = "__class__/" + __name__ + "." + self.__class__.__name__ return {cls_name: outer_encoder(tmp_dict)} @classmethod @@ -226,7 +250,7 @@ def from_json(cls, data, outer_decoder=None): if outer_decoder is None: outer_decoder = json.JSONDecoder.decode - cls_name = '__class__/' + __name__ + '.' + cls.__name__ + cls_name = "__class__/" + __name__ + "." + cls.__name__ if cls_name in data: tmp_data = outer_decoder(data[cls_name]) return cls(**tmp_data) @@ -246,8 +270,13 @@ def __init__(self, template=None, **kwargs): self.is_broken = False if template: import copy + [setattr(self, k, copy.deepcopy(v)) for k, v in template.__dict__.items()] - if self.to_room_vnum != -1 and not None and self.to_room_vnum in instance.instances_by_room: + if ( + self.to_room_vnum != -1 + and not None + and self.to_room_vnum in instance.instances_by_room + ): self.to_room = instance.instances_by_room[self.to_room_vnum][0] elif self.to_room_vnum not in instance.instances_by_room: self.is_broken = True @@ -258,6 +287,7 @@ def __init__(self, template=None, **kwargs): self.key = None if kwargs: import copy + [setattr(self, k, copy.deepcopy(v)) for k, v in kwargs.items()] def to_json(self, outer_encoder=None): @@ -271,7 +301,7 @@ def to_json(self, outer_encoder=None): else: tmp_dict[k] = v - cls_name = '__class__/' + __name__ + '.' + self.__class__.__name__ + cls_name = "__class__/" + __name__ + "." + self.__class__.__name__ return {cls_name: outer_encoder(tmp_dict)} @classmethod @@ -279,7 +309,7 @@ def from_json(cls, data, outer_decoder=None): if outer_decoder is None: outer_decoder = json.JSONDecoder.decode - cls_name = '__class__/' + __name__ + '.' + cls.__name__ + cls_name = "__class__/" + __name__ + "." + cls.__name__ if cls_name in data: tmp_data = outer_decoder(data[cls_name]) return cls(**tmp_data) @@ -308,8 +338,11 @@ def __init__(self, template=None, **kwargs): def __repr__(self): if not self.instance_id: - return "Reset Area: %s Room: %d Type: %s" % (instance.room_templates[self.room].area, - self.room, self.command) + return "Reset Area: %s Room: %d Type: %s" % ( + instance.room_templates[self.room].area, + self.room, + self.command, + ) def to_json(self, outer_encoder=None): if outer_encoder is None: @@ -322,7 +355,7 @@ def to_json(self, outer_encoder=None): else: tmp_dict[k] = v - cls_name = '__class__/' + __name__ + '.' + self.__class__.__name__ + cls_name = "__class__/" + __name__ + "." + self.__class__.__name__ return {cls_name: outer_encoder(tmp_dict)} @classmethod @@ -330,7 +363,7 @@ def from_json(cls, data, outer_decoder=None): if outer_decoder is None: outer_decoder = json.JSONDecoder.decode - cls_name = '__class__/' + __name__ + '.' + cls.__name__ + cls_name = "__class__/" + __name__ + "." + cls.__name__ if cls_name in data: tmp_data = outer_decoder(data[cls_name]) return cls(**tmp_data) @@ -353,7 +386,10 @@ def __init__(self, template=None, **kwargs): [setattr(self, k, copy.deepcopy(v)) for k, v in kwargs.items()] def __repr__(self): - return "Shop Mob: %s Room: %d" % (instance.characters[self.keeper].name, self.room) + return "Shop Mob: %s Room: %d" % ( + instance.characters[self.keeper].name, + self.room, + ) def to_json(self, outer_encoder=None): if outer_encoder is None: @@ -366,7 +402,7 @@ def to_json(self, outer_encoder=None): else: tmp_dict[k] = v - cls_name = '__class__/' + __name__ + '.' + self.__class__.__name__ + cls_name = "__class__/" + __name__ + "." + self.__class__.__name__ return {cls_name: outer_encoder(tmp_dict)} @classmethod @@ -374,7 +410,7 @@ def from_json(cls, data, outer_decoder=None): if outer_decoder is None: outer_decoder = json.JSONDecoder.decode - cls_name = '__class__/' + __name__ + '.' + cls.__name__ + cls_name = "__class__/" + __name__ + "." + cls.__name__ if cls_name in data: tmp_data = outer_decoder(data[cls_name]) return cls(**tmp_data) @@ -401,7 +437,7 @@ def to_json(self, outer_encoder=None): else: tmp_dict[k] = v - cls_name = '__class__/' + __name__ + '.' + self.__class__.__name__ + cls_name = "__class__/" + __name__ + "." + self.__class__.__name__ return {cls_name: outer_encoder(tmp_dict)} @classmethod @@ -409,7 +445,7 @@ def from_json(cls, data, outer_decoder=None): if outer_decoder is None: outer_decoder = json.JSONDecoder.decode - cls_name = '__class__/' + __name__ + '.' + cls.__name__ + cls_name = "__class__/" + __name__ + "." + cls.__name__ if cls_name in data: tmp_data = outer_decoder(data[cls_name]) return cls(**tmp_data) From 227fa0575d823453b37d07677824c310a48b7174 Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Wed, 1 Dec 2021 23:56:26 -0800 Subject: [PATCH 22/40] Implementing mypy typing improvements and bug fixes from that. --- src/rom24/auth.py | 8 ++-- src/rom24/commands/do_authenticator.py | 2 +- src/rom24/const.py | 36 ++++++++------- src/rom24/database/write/write_tables.py | 4 +- src/rom24/game_utils.py | 3 +- src/rom24/handler_item.py | 2 +- src/rom24/handler_pc.py | 2 +- src/rom24/hotfix.py | 5 ++- src/rom24/instance.py | 45 +++++++++---------- src/rom24/interp.py | 3 +- src/rom24/item_flags.py | 56 ------------------------ src/rom24/living.py | 1 - src/rom24/miniboa/asyncio.py | 2 +- src/rom24/miniboa/colors.py | 15 ++++++- src/rom24/miniboa/terminal.py | 5 ++- src/rom24/nanny.py | 3 +- src/rom24/pyprogs.py | 2 +- src/rom24/tables.py | 28 ++++++------ src/rom24/uait/legacy_loads.py | 3 +- src/rom24/update.py | 2 +- 20 files changed, 95 insertions(+), 132 deletions(-) diff --git a/src/rom24/auth.py b/src/rom24/auth.py index 9b23fb5..3642e8b 100644 --- a/src/rom24/auth.py +++ b/src/rom24/auth.py @@ -33,6 +33,8 @@ import json import logging +from typing import Optional + logger = logging.getLogger(__name__) from rom24 import instance @@ -81,7 +83,7 @@ def __init__(self, s: str = "ABCDEFGHIJKLMNOP"): self._raw_secret = s.upper().rjust(16, "A")[0:16] self._secret = base64.b32decode(self._raw_secret.encode()) - def time_code(self, moment: int = None): + def time_code(self, moment: float): """ Returns a string indicating the current valid token which will be generated, and which should be matched to authenticate the user. @@ -91,9 +93,7 @@ def time_code(self, moment: int = None): :return: A 6-digit authentication token :rtype: str """ - if moment is None: - moment = time.time() - moment = int(moment // 30) + moment = moment // 30 time_bytes = struct.pack(">q", moment) hash_digest = hmac.HMAC(self._secret, time_bytes, hashlib.sha1).digest() offset = hash_digest[-1] & 0x0F diff --git a/src/rom24/commands/do_authenticator.py b/src/rom24/commands/do_authenticator.py index e5ba974..1210ec5 100644 --- a/src/rom24/commands/do_authenticator.py +++ b/src/rom24/commands/do_authenticator.py @@ -23,7 +23,7 @@ def do_authenticator(ch, argument): ch.send("Usage: authenticator [token]\n") if ch.auth: import time - import sys_utils + from rom24 import sys_utils trials = [ ch.auth.time_code(time.time() + offset) for offset in (-30, 0, 30) diff --git a/src/rom24/const.py b/src/rom24/const.py index f88b3c8..f101ba6 100644 --- a/src/rom24/const.py +++ b/src/rom24/const.py @@ -1,19 +1,21 @@ from collections import OrderedDict, namedtuple import logging +from typing import * + logger = logging.getLogger(__name__) -spell_lookup_dict = {} +spell_lookup_dict: Dict[str, Any] = {} race_type = namedtuple( "race_type", "name, pc_race, act, aff, off, imm, res, vuln, form, parts" ) -race_table = OrderedDict() +race_table: Dict[str, Any] = OrderedDict() pc_race_type = namedtuple( "pc_race_type", "name, who_name, points, class_mult, skills, stats, max_stats, size" ) -pc_race_table = OrderedDict() +pc_race_table: Dict[str, Any] = OrderedDict() def SLOT(i): @@ -21,12 +23,12 @@ def SLOT(i): skill_type = namedtuple( - "skilltype", + "skill_type", "name, skill_level, rating, spell_fun, " "target, minimum_position, pgsn, slot, " "min_mana, beats, noun_damage, msg_off, msg_obj", ) -skill_table = OrderedDict() +skill_table: Dict[str, Any] = OrderedDict() def register_spell(entry: skill_type): @@ -37,7 +39,7 @@ def register_spell(entry: skill_type): group_type = namedtuple("group_type", "name, rating, spells") -group_table = OrderedDict() +group_table: Dict[str, Any] = OrderedDict() guild_type = namedtuple( "guild_type", @@ -45,37 +47,37 @@ def register_spell(entry: skill_type): "skill_adept, thac0_00, thac0_32, hp_min, hp_max, " "fMana, base_group, default_group", ) -guild_table = OrderedDict() +guild_table: Dict[str, Any] = OrderedDict() weapon_type = namedtuple("weapon_type", "name, vnum, type, gsn") -weapon_table = OrderedDict() +weapon_table: Dict[str, Any] = OrderedDict() -title_table = {} +title_table: Dict[str, Any] = {} # * Attribute bonus structures. str_app_type = namedtuple("str_app_type", "tohit, todam, carry, wield") -str_app = OrderedDict() +str_app: Dict[str, Any] = OrderedDict() int_app_type = namedtuple("int_app_type", "learn") -int_app = OrderedDict() +int_app: Dict[str, Any] = OrderedDict() wis_app_type = namedtuple("wis_app_type", "practice") -wis_app = OrderedDict() +wis_app: Dict[str, Any] = OrderedDict() dex_app_type = namedtuple("dex_app_type", "defensive") -dex_app = OrderedDict() +dex_app: Dict[str, Any] = OrderedDict() con_app_type = namedtuple("con_app_type", "hitp, shock") -con_app = OrderedDict() +con_app: Dict[str, Any] = OrderedDict() # /* attack table -- not very organized :( */ attack_type = namedtuple("attack_type", "name, noun, damage") -attack_table = OrderedDict() +attack_table: Dict[str, Any] = OrderedDict() wiznet_type = namedtuple("wiznet_type", "name bit level") -wiznet_table = OrderedDict() +wiznet_table: Dict[str, Any] = OrderedDict() liq_type = namedtuple("liq_type", "name color proof full thirst food ssize") -liq_table = OrderedDict() +liq_table: Dict[str, Any] = OrderedDict() diff --git a/src/rom24/database/write/write_tables.py b/src/rom24/database/write/write_tables.py index 188b43a..092a10b 100644 --- a/src/rom24/database/write/write_tables.py +++ b/src/rom24/database/write/write_tables.py @@ -4,8 +4,8 @@ logger = logging.getLogger(__name__) -from database.tracker import tables -from settings import DATA_EXTN, DATA_DIR +from rom24.database.tracker import tables +from rom24.settings import DATA_EXTN, DATA_DIR def write_tables(listener=None, loc=DATA_DIR, extn=DATA_EXTN): diff --git a/src/rom24/game_utils.py b/src/rom24/game_utils.py index 1ca1c4a..16f3929 100644 --- a/src/rom24/game_utils.py +++ b/src/rom24/game_utils.py @@ -6,6 +6,7 @@ import collections import random import logging +from typing import * logger = logging.getLogger(__name__) @@ -318,7 +319,7 @@ def item_bitvector_flag_str(bits: int, in_type="extra flags"): def item_flags_from_bits( - bits: int, out_data: collections.namedtuple, in_type="wear flags" + bits: int, out_data: Any, in_type="wear flags" ): if not out_data or not bits or not in_type: return None diff --git a/src/rom24/handler_item.py b/src/rom24/handler_item.py index f07b059..ec15bee 100644 --- a/src/rom24/handler_item.py +++ b/src/rom24/handler_item.py @@ -174,7 +174,7 @@ def equipped_to(self): return None @property - def equips_to_names(self, check_occupied=False): + def equips_to_names(self, check_occupied: bool = False): """ return equips_to flags as string diff --git a/src/rom24/handler_pc.py b/src/rom24/handler_pc.py index e8b3c29..b521692 100644 --- a/src/rom24/handler_pc.py +++ b/src/rom24/handler_pc.py @@ -315,7 +315,7 @@ def list_group_chosen(self): # this procedure handles the input parsing for the skill generator */ def parse_gen_groups(self, argument): - from game_utils import read_word + from rom24.game_utils import read_word if not argument.strip(): return False diff --git a/src/rom24/hotfix.py b/src/rom24/hotfix.py index 33eb66f..66abc00 100644 --- a/src/rom24/hotfix.py +++ b/src/rom24/hotfix.py @@ -2,12 +2,13 @@ import importlib import traceback import logging +from typing import * logger = logging.getLogger(__name__) # dictionary of files to track. will be key'd by file name and the value will be modified unix timestamp -tracked_files = {} -modified_files = {} +tracked_files: Dict[str, int] = {} +modified_files: Dict[str, int] = {} # Looks like we need to fix the directory for this init so that it will find the commands. diff --git a/src/rom24/instance.py b/src/rom24/instance.py index 386bf87..11b1b45 100644 --- a/src/rom24/instance.py +++ b/src/rom24/instance.py @@ -5,6 +5,7 @@ from collections import OrderedDict, namedtuple import re import logging +from typing import * logger = logging.getLogger(__name__) @@ -38,42 +39,42 @@ max_instance_id = 0 previous_max_instance_id = 0 -area_templates = {} -item_templates = {} -room_templates = {} -npc_templates = {} -shop_templates = {} +area_templates: Dict[str, Any] = {} +item_templates: Dict[str, Any] = {} +room_templates: Dict[str, Any] = {} +npc_templates: Dict[str, Any] = {} +shop_templates: Dict[str, Any] = {} global_instances = ( {} ) # This is the global instance list, the heart of the game data set -areas = {} -items = {} -rooms = {} -npcs = {} -shops = {} -players = {} -characters = {} # This is PC and NPC combined +areas: Dict[str, Any] = {} +items: Dict[int, Any] = {} +rooms: Dict[str, Any] = {} +npcs: Dict[str, Any] = {} +shops: Dict[str, Any] = {} +players: Dict[str, Any] = {} +characters: Dict[str, Any] = {} # This is PC and NPC combined -helps = {} -socials = {} -resets = {} +helps: Dict[str, Any] = {} +socials: Dict[str, Any] = {} +resets: Dict[str, Any] = {} """ Contains lists of instances, Key: string VNUM Value: list Instance_ID of object associated with Key:VNUM """ -instances_by_area = {} -instances_by_item = {} -instances_by_room = {} -instances_by_npc = {} -instances_by_shop = {} -instances_by_player = {} +instances_by_area: Dict[str, Any] = {} +instances_by_item: Dict[str, Any] = {} +instances_by_room: Dict[str, Any] = {} +instances_by_npc: Dict[str, Any] = {} +instances_by_shop: Dict[str, Any] = {} +instances_by_player: Dict[str, Any] = {} # Things to omit from instances that are in templates. -not_to_instance = [] +not_to_instance: list = [] def isnamedtuple(obj): diff --git a/src/rom24/interp.py b/src/rom24/interp.py index 2bb3a9c..918416f 100644 --- a/src/rom24/interp.py +++ b/src/rom24/interp.py @@ -1,5 +1,6 @@ from collections import OrderedDict import logging +from typing import * logger = logging.getLogger(__name__) @@ -19,7 +20,7 @@ def __init__(self, name, do_fun, position, level, log, show, default_arg=None): # These commands don't need to be here but are, for order. These will always match first with prefixes. -cmd_table = OrderedDict() +cmd_table: Dict[str, Any] = OrderedDict() cmd_table["north"] = None cmd_table["east"] = None diff --git a/src/rom24/item_flags.py b/src/rom24/item_flags.py index 0636024..010710c 100644 --- a/src/rom24/item_flags.py +++ b/src/rom24/item_flags.py @@ -876,62 +876,6 @@ def no_locate(self, has_restr): self._item_restrictions -= {func_name} # Weapon Attributes - @property - def no_remove(self): - """ - TODO: write documentation - """ - func_name = sys._getframe().f_code.co_name - return func_name if func_name in self._item_restrictions else False - - @no_remove.setter - def no_remove(self, has_restr): - """ - TODO: write documentation - """ - func_name = sys._getframe().f_code.co_name - if has_restr: - self._item_restrictions |= {func_name} - else: - self._item_restrictions -= {func_name} - - @property - def no_uncurse(self): - """ - TODO: write documentation - """ - func_name = sys._getframe().f_code.co_name - return func_name if func_name in self._item_restrictions else False - - @no_uncurse.setter - def no_uncurse(self, has_restr): - """ - TODO: write documentation - """ - func_name = sys._getframe().f_code.co_name - if has_restr: - self._item_restrictions |= {func_name} - else: - self._item_restrictions -= {func_name} - - @property - def no_purge(self): - """ - TODO: write documentation - """ - func_name = sys._getframe().f_code.co_name - return func_name if func_name in self._item_restrictions else False - - @no_purge.setter - def no_purge(self, has_restr): - """ - TODO: write documentation - """ - func_name = sys._getframe().f_code.co_name - if has_restr: - self._item_restrictions |= {func_name} - else: - self._item_restrictions -= {func_name} @property def two_handed(self): diff --git a/src/rom24/living.py b/src/rom24/living.py index 571badf..47cee93 100644 --- a/src/rom24/living.py +++ b/src/rom24/living.py @@ -1123,7 +1123,6 @@ def equip( self.raw_equip(item, to_loc) return else: - possible_slots = item.equips_to & self.slots.available if len(possible_slots) > 0: if not verbose: diff --git a/src/rom24/miniboa/asyncio.py b/src/rom24/miniboa/asyncio.py index 3546db0..c91d58c 100644 --- a/src/rom24/miniboa/asyncio.py +++ b/src/rom24/miniboa/asyncio.py @@ -64,7 +64,7 @@ def _on_disconnect(client): """ Placeholder lost connection handler. """ - logger.info("-- Lost connection to %s".format(client.addrport())) + logger.info("-- Lost connection to %s", client.addrport()) class TelnetServer(object): diff --git a/src/rom24/miniboa/colors.py b/src/rom24/miniboa/colors.py index 36b13ba..4dcca9c 100644 --- a/src/rom24/miniboa/colors.py +++ b/src/rom24/miniboa/colors.py @@ -46,6 +46,7 @@ """ import logging +from typing import * logger = logging.getLogger(__name__) @@ -63,9 +64,19 @@ "mxp", ) -ColorToken = namedtuple("ColorToken", TERMINAL_TYPES) +ColorToken = namedtuple("ColorToken", ( + "unknown", + "pyom", + "rom", + "smaug", + "imc2", + "ansi", + "greyscale", + "i3", + "mxp", +)) -COLOR_MAP = {} +COLOR_MAP: Dict[str, Any] = {} COLOR_MAP["unknown"] = {} diff --git a/src/rom24/miniboa/terminal.py b/src/rom24/miniboa/terminal.py index 1782993..7b3c100 100644 --- a/src/rom24/miniboa/terminal.py +++ b/src/rom24/miniboa/terminal.py @@ -50,10 +50,11 @@ """ import logging +import re +from typing import * logger = logging.getLogger(__name__) -import re from rom24.miniboa.colors import TERMINAL_TYPES, COLOR_MAP @@ -112,7 +113,7 @@ def xlat(self, text, otype): return self._make_regex().sub(self, text) -def color_convert(text: str or None, input_type="pyom", output_type="ansi"): +def color_convert(text: Optional[str] = None, input_type="pyom", output_type="ansi"): """ Given a chunk of text, replace color tokens of the specified input type with the appropriate color codes for the given output terminal type diff --git a/src/rom24/nanny.py b/src/rom24/nanny.py index 745eb52..7102f04 100644 --- a/src/rom24/nanny.py +++ b/src/rom24/nanny.py @@ -1,6 +1,7 @@ import hashlib import os import logging +from typing import * logger = logging.getLogger(__name__) @@ -32,7 +33,7 @@ def send(self, pstr): pass -ch_selections = {} +ch_selections: dict = {} retries = 0 diff --git a/src/rom24/pyprogs.py b/src/rom24/pyprogs.py index 8a5ea74..30e716f 100644 --- a/src/rom24/pyprogs.py +++ b/src/rom24/pyprogs.py @@ -13,7 +13,7 @@ from rom24 import settings from rom24 import instance -signals = {"say": []} +signals: dict = {"say": []} def emit_signal(signal, actor=None, victim=None, argument=None, audience=None): diff --git a/src/rom24/tables.py b/src/rom24/tables.py index 953cc90..98f4449 100644 --- a/src/rom24/tables.py +++ b/src/rom24/tables.py @@ -4,25 +4,25 @@ logger = logging.getLogger(__name__) clan_type = namedtuple("clan_type", "name, who_name, hall, independent") -clan_table = OrderedDict() +clan_table: dict = OrderedDict() position_type = namedtuple("position_type", "name, short_name") -position_table = OrderedDict() +position_table: dict = OrderedDict() -sex_table = OrderedDict() +sex_table: dict = OrderedDict() # for sizes */ -size_table = [] +size_table: list = [] # various flag tables */ flag_type = namedtuple("flag_type", "name, bit, settable") -act_flags = OrderedDict() -plr_flags = OrderedDict() -affect_flags = OrderedDict() -off_flags = OrderedDict() -imm_flags = OrderedDict() -form_flags = OrderedDict() -part_flags = OrderedDict() -comm_flags = OrderedDict() -exit_flags = OrderedDict() -vuln_flags = OrderedDict() +act_flags: dict = OrderedDict() +plr_flags: dict = OrderedDict() +affect_flags: dict = OrderedDict() +off_flags: dict = OrderedDict() +imm_flags: dict = OrderedDict() +form_flags: dict = OrderedDict() +part_flags: dict = OrderedDict() +comm_flags: dict = OrderedDict() +exit_flags: dict = OrderedDict() +vuln_flags: dict = OrderedDict() diff --git a/src/rom24/uait/legacy_loads.py b/src/rom24/uait/legacy_loads.py index 9891f50..92284ee 100644 --- a/src/rom24/uait/legacy_loads.py +++ b/src/rom24/uait/legacy_loads.py @@ -19,7 +19,7 @@ from rom24 import merc from rom24 import state_checks -serializer_list = [] +serializer_list: list = [] class AREA_SERIALIZER: @@ -103,6 +103,7 @@ def do_apickle(ch, argument): interp.cmd_type("apickle", do_apickle, merc.POS_DEAD, merc.ML, merc.LOG_ALWAYS, 1) ) +# Not sure what was happening here - commented out because it's just broken. # to_Pickle() # os.makedirs(settings.HELP_DIR, 0o755, True) diff --git a/src/rom24/update.py b/src/rom24/update.py index d7bdda3..de672a6 100644 --- a/src/rom24/update.py +++ b/src/rom24/update.py @@ -429,7 +429,7 @@ def weather_update(): handler_game.weather_info.sky = merc.SKY_CLOUDLESS if buf: - import nanny + from rom24 import nanny for char in instance.players.items(): if ( From 901635f825d08d022e638675882f333da1ce6359 Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Thu, 2 Dec 2021 00:19:38 -0800 Subject: [PATCH 23/40] mypy passing and blacked --- setup.py | 2 +- src/rom24/game_utils.py | 38 ++++---- src/rom24/handler_item.py | 21 ++-- src/rom24/instance.py | 6 +- src/rom24/merc.py | 10 +- src/rom24/miniboa/colors.py | 25 ++--- src/rom24/save.py | 8 +- src/rom24/sys_utils.py | 2 +- src/rom24/uait/legacy_loads.py | 172 ++++++++++++++++----------------- src/rom24/world_classes.py | 13 ++- 10 files changed, 154 insertions(+), 143 deletions(-) diff --git a/setup.py b/setup.py index 36e23fa..952247e 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ """Setup configuration and dependencies for rom24.""" -from setuptools import find_packages +from setuptools import find_packages # type: ignore from setuptools import setup diff --git a/src/rom24/game_utils.py b/src/rom24/game_utils.py index 16f3929..9547683 100644 --- a/src/rom24/game_utils.py +++ b/src/rom24/game_utils.py @@ -15,23 +15,23 @@ from rom24 import instance -def find_instance_file( - instance_id: int = None, from_char_dir: str = None, from_world: bool = False -): - if not instance_id: - return None - if from_char_dir: - pathname = os.path.join( - settings.PLAYER_DIR, - from_char_dir[0].capitalize(), - from_char_dir.capitalize(), - ) - for start, directories, file in os.walk(pathname): - if str(instance_id) in file: - return os.path.join(start, directories, file) - return None - if from_world: - pass +# def find_instance_file( +# instance_id: int = None, from_char_dir: str = None, from_world: bool = False +# ): +# if not instance_id: +# return None +# if from_char_dir: +# pathname = os.path.join( +# settings.PLAYER_DIR, +# from_char_dir[0].capitalize(), +# from_char_dir.capitalize(), +# ) +# for start, directories, file in os.walk(pathname): +# if str(instance_id) in file: +# return os.path.join(start, directories, file) +# return None +# if from_world: +# pass def read_forward(pstr, jump=1): @@ -318,9 +318,7 @@ def item_bitvector_flag_str(bits: int, in_type="extra flags"): return None -def item_flags_from_bits( - bits: int, out_data: Any, in_type="wear flags" -): +def item_flags_from_bits(bits: int, out_data: Any, in_type="wear flags"): if not out_data or not bits or not in_type: return None if bits == 0: diff --git a/src/rom24/handler_item.py b/src/rom24/handler_item.py index ec15bee..b1a91a1 100644 --- a/src/rom24/handler_item.py +++ b/src/rom24/handler_item.py @@ -174,13 +174,14 @@ def equipped_to(self): return None @property - def equips_to_names(self, check_occupied: bool = False): + def equips_to_names(self): """ return equips_to flags as string :param check_occupied: :return: :rtype: str """ + check_occupied: bool = False things = set({}) used = self.equipped_to if check_occupied else None for name in self.equips_to: @@ -605,19 +606,19 @@ def load(cls, instance_id: int = None, vnum: int = None, player_name: str = None logger.warn("Instance %d of item already loaded!", instance_id) return - if not player_name: - if instance_id: - pathname = settings.INSTANCE_DIR - number = instance_id - else: - pathname = settings.AREA_DIR - number = vnum - else: + if player_name: pathname = os.path.join( settings.PLAYER_DIR, player_name[0].lower(), player_name.capitalize() ) number = instance_id - target_file = "%d-item.json" % number + elif instance_id: + pathname = settings.INSTANCE_DIR + number = instance_id + else: + pathname = settings.AREA_DIR + number = vnum + + target_file = f"{number}-item.json" filename = None for a_path, a_directory, i_files in os.walk(pathname): if target_file in i_files: diff --git a/src/rom24/instance.py b/src/rom24/instance.py index 11b1b45..1c9668d 100644 --- a/src/rom24/instance.py +++ b/src/rom24/instance.py @@ -45,9 +45,9 @@ npc_templates: Dict[str, Any] = {} shop_templates: Dict[str, Any] = {} -global_instances = ( - {} -) # This is the global instance list, the heart of the game data set +global_instances: Dict[ + int, Any +] = {} # This is the global instance list, the heart of the game data set areas: Dict[str, Any] = {} items: Dict[int, Any] = {} diff --git a/src/rom24/merc.py b/src/rom24/merc.py index 036303f..8c542b2 100644 --- a/src/rom24/merc.py +++ b/src/rom24/merc.py @@ -66,11 +66,11 @@ current_time = 0 # Old Style Lists -descriptor_list = [] -shop_list = [] -help_list = [] -greeting_list = [] -social_list = [] +descriptor_list: list = [] +shop_list: list = [] +help_list: list = [] +greeting_list: list = [] +social_list: list = [] """ Game Defines diff --git a/src/rom24/miniboa/colors.py b/src/rom24/miniboa/colors.py index 4dcca9c..fe333e5 100644 --- a/src/rom24/miniboa/colors.py +++ b/src/rom24/miniboa/colors.py @@ -64,17 +64,20 @@ "mxp", ) -ColorToken = namedtuple("ColorToken", ( - "unknown", - "pyom", - "rom", - "smaug", - "imc2", - "ansi", - "greyscale", - "i3", - "mxp", -)) +ColorToken = namedtuple( + "ColorToken", + ( + "unknown", + "pyom", + "rom", + "smaug", + "imc2", + "ansi", + "greyscale", + "i3", + "mxp", + ), +) COLOR_MAP: Dict[str, Any] = {} diff --git a/src/rom24/save.py b/src/rom24/save.py index 23e78a4..3d83e3f 100644 --- a/src/rom24/save.py +++ b/src/rom24/save.py @@ -96,7 +96,9 @@ def recursive_item_jsonify( to_equipped = json.dumps( item_to_json, default=instance.to_json, indent=4, sort_keys=True ) - equip_write = os.path.join(equip_dir, str(item_to_json.instance_id) + ".json") + if not equip_dir: + raise ValueError("Must have an equip_dir.") + equip_write = os.path.join(equip_dir, f"{item_to_json.instance_id}.json") with open(equip_write, "w") as eq: eq.write(to_equipped) if item_to_json.inventory: @@ -109,7 +111,9 @@ def recursive_item_jsonify( to_inventory = json.dumps( item_to_json, default=instance.to_json, indent=4, sort_keys=True ) - inventory_write = os.path.join(inv_dir, str(item_to_json.instance_id) + ".json") + if not inv_dir: + raise ValueError("Must have an inv_dir.") + inventory_write = os.path.join(inv_dir, f"{item_to_json.instance_id}.json") with open(inventory_write, "w") as inv: inv.write(to_inventory) if item_to_json.inventory: diff --git a/src/rom24/sys_utils.py b/src/rom24/sys_utils.py index b9c1109..3510f0c 100644 --- a/src/rom24/sys_utils.py +++ b/src/rom24/sys_utils.py @@ -1,6 +1,6 @@ __author__ = "quixadhal" -import psutil +import psutil # type: ignore import time from datetime import datetime from collections import Iterable diff --git a/src/rom24/uait/legacy_loads.py b/src/rom24/uait/legacy_loads.py index 92284ee..64940b1 100644 --- a/src/rom24/uait/legacy_loads.py +++ b/src/rom24/uait/legacy_loads.py @@ -173,92 +173,92 @@ def to_Pickle(): ref.close() -def load_areas(): - area_list = os.path.join(settings.LEGACY_AREA_DIR, settings.PAREA_LIST) - alf = open(area_list, "r") - parea = alf.readline().strip() - while parea != "$": - with open( - os.path.join(settings.LEGACY_AREA_DIR, parea, parea + ".pickle"), "rb" - ) as af: - zarea = pickle.load(af) - merc.area_list.append(zarea) - load_rooms(zarea.room_dict()) - load_mobiles(zarea.mobile_dict()) - load_objects(zarea.object_dict()) - load_shops(zarea.shop_dict()) - parea = alf.readline().strip() - logger.info("Area %s loaded", zarea.name) - af.close() - alf.close() - logger.info("Game Data Load Complete.") - - -def load_helps(): - count = 0 - with open( - os.path.join(settings.HELP_DIR, settings.HELP_FILE + settings.PKL_EXTN), "rb" - ) as hf: - helps = pickle.load(hf) - for item in helps: - count += 1 - merc.help_list.append(item) - logger.info("Loaded %d helps", count) - hf.close() - - -def load_mobiles(mobile_dict): - count = 0 - for k, v in mobile_dict.items(): - instance.npc_templates[k] = v - count += 1 - logger.info("%d mobiles loaded", count) - - -def load_objects(object_dict): - count = 0 - for k, v in object_dict.items(): - instance.item_templates[k] = v - count += 1 - logger.info("%d items loaded", count) - - -def load_resets(reset_dict): - count = 0 - for k, v in reset_dict.items(): - merc.reset_list[k] = v - count += 1 - logger.info("%d resets loaded", count) - - -def load_rooms(room_dict): - count = 0 - for k, v in room_dict.items(): - instance.room_templates[k] = v - count += 1 - logger.info("%d rooms loaded", count) - - -def load_shops(shop_dict): - count = 0 - for k, v in shop_dict.items(): - merc.shop_list[k] = v - count += 1 - logger.info("%d shops loaded", count) - - -def load_socials(): - slf = open(settings.SOCIAL_LIST, "r") - social = slf.readline().strip() - while social != "$": - with open( - os.path.join(settings.SOCIAL_DIR, social + settings.PKL_EXTN), "rb" - ) as sf: - social_file = pickle.load(sf) - merc.social_list.append(social_file) - logger.info("Social %s loaded", social_file.name) - sf.close() - slf.close() +# def load_areas(): +# area_list = os.path.join(settings.LEGACY_AREA_DIR, settings.PAREA_LIST) +# alf = open(area_list, "r") +# parea = alf.readline().strip() +# while parea != "$": +# with open( +# os.path.join(settings.LEGACY_AREA_DIR, parea, parea + ".pickle"), "rb" +# ) as af: +# zarea = pickle.load(af) +# merc.area_list.append(zarea) +# load_rooms(zarea.room_dict()) +# load_mobiles(zarea.mobile_dict()) +# load_objects(zarea.object_dict()) +# load_shops(zarea.shop_dict()) +# parea = alf.readline().strip() +# logger.info("Area %s loaded", zarea.name) +# af.close() +# alf.close() +# logger.info("Game Data Load Complete.") + + +# def load_helps(): +# count = 0 +# with open( +# os.path.join(settings.HELP_DIR, settings.HELP_FILE + settings.PKL_EXTN), "rb" +# ) as hf: +# helps = pickle.load(hf) +# for item in helps: +# count += 1 +# merc.help_list.append(item) +# logger.info("Loaded %d helps", count) +# hf.close() + + +# def load_mobiles(mobile_dict): +# count = 0 +# for k, v in mobile_dict.items(): +# instance.npc_templates[k] = v +# count += 1 +# logger.info("%d mobiles loaded", count) + + +# def load_objects(object_dict): +# count = 0 +# for k, v in object_dict.items(): +# instance.item_templates[k] = v +# count += 1 +# logger.info("%d items loaded", count) + + +# def load_resets(reset_dict): +# count = 0 +# for k, v in reset_dict.items(): +# merc.reset_list[k] = v +# count += 1 +# logger.info("%d resets loaded", count) + + +# def load_rooms(room_dict): +# count = 0 +# for k, v in room_dict.items(): +# instance.room_templates[k] = v +# count += 1 +# logger.info("%d rooms loaded", count) + + +# def load_shops(shop_dict): +# count = 0 +# for k, v in shop_dict.items(): +# merc.shop_list[k] = v +# count += 1 +# logger.info("%d shops loaded", count) + + +# def load_socials(): +# slf = open(settings.SOCIAL_LIST, "r") +# social = slf.readline().strip() +# while social != "$": +# with open( +# os.path.join(settings.SOCIAL_DIR, social + settings.PKL_EXTN), "rb" +# ) as sf: +# social_file = pickle.load(sf) +# merc.social_list.append(social_file) +# logger.info("Social %s loaded", social_file.name) +# sf.close() +# slf.close() def load_areas(): diff --git a/src/rom24/world_classes.py b/src/rom24/world_classes.py index 0dc4355..3fef13b 100644 --- a/src/rom24/world_classes.py +++ b/src/rom24/world_classes.py @@ -194,15 +194,20 @@ def save(self, force: bool = False): @classmethod def load(cls, index: int = None, instance_id: int = None): + if instance_id and instance_id in instance.characters: + logger.warn("Instance %d of npc already loaded!", instance_id) + return + if instance_id: - if instance_id in instance.characters: - logger.warn("Instance %d of npc already loaded!", instance_id) - return top_dir = settings.INSTANCE_DIR number = instance_id - else: + elif index: top_dir = settings.AREA_DIR number = index + else: + raise ValueError( + "Must have an instance_id that's in characters, an instance_id, or an index." + ) target_file = "%d-area.json" % number filename = None From 496b7d33eb0bfbbfe422f4c71e75c5922355ceac Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Thu, 2 Dec 2021 00:21:48 -0800 Subject: [PATCH 24/40] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5850991..bb79934 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,6 @@ The more up-to-date home of the project that this was not forked from is [here]( * Straighten out legacy loads vs. new loads and remove anything legacy * Make data consistently relative and make it deployable in docker with volumes * Add docker and compose for simple local build and testing -* Start adding basic type checking * start adding some unit testing * Move to a more functional paradigm for as much as possible to improve iteration speed (less stateful class shenanigans is better imho) * Add docstrings to everything as I figure out what the hell it's doing @@ -44,3 +43,5 @@ The more up-to-date home of the project that this was not forked from is [here]( For the love of god, someone please help - I'm doing this because it's fun, but it's more fun to do it together! Just PR changes - I'm not going to be very picky as long as they're an improvement. Even if you just pull it and test it locally to open bugs, opening bugs is awesome and appreciated. If you're interested in becoming an owner on the repo, send me an email at bubthegreat@gmail.com + +The typing is incredibly loose with lots of Any getting thrown around - as we add more typing, we'll find more bugs ahead of time. We're using black for formatting to keep formatting consistent. From 69f0e622463baed70bcb11ff9ee96cb7b29eff9e Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Thu, 2 Dec 2021 00:24:18 -0800 Subject: [PATCH 25/40] Added our first pytest test! --- requirements.txt | 1 + tests/basic_import_test.py | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 tests/basic_import_test.py diff --git a/requirements.txt b/requirements.txt index 89330e4..68ea86f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,4 @@ psutil ipdb mypy black +pytest diff --git a/tests/basic_import_test.py b/tests/basic_import_test.py new file mode 100644 index 0000000..3564de8 --- /dev/null +++ b/tests/basic_import_test.py @@ -0,0 +1,7 @@ +"""Test that you can import the main rom24 function.""" + +import importlib + +def test_import_rom24(): + """Import the rom24 module to make sure it can resolve things for import.""" + importlib.import_module("rom24") From bc42a586ccdd200a99307d8e61a6d43a11d42357 Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Thu, 2 Dec 2021 00:26:30 -0800 Subject: [PATCH 26/40] Adding pre-commit and some basic hooks --- .pre-commit-config.yaml | 11 +++++++++++ requirements.txt | 1 + 2 files changed, 12 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..ddf6ce4 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,11 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.3.0 + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace +- repo: https://github.com/psf/black + rev: 19.3b0 + hooks: + - id: black diff --git a/requirements.txt b/requirements.txt index 68ea86f..052733c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,3 +3,4 @@ ipdb mypy black pytest +pre-commit From 05366141e3f42d744b0a946de2cda6ed31208256 Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Thu, 2 Dec 2021 00:33:02 -0800 Subject: [PATCH 27/40] More pre-commit hooks --- .pre-commit-config.yaml | 25 ++++++++++++++++++++++--- README.md | 8 +++++++- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ddf6ce4..cf206cf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,11 +1,30 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.3.0 + rev: v4.0.1 hooks: - - id: check-yaml - - id: end-of-file-fixer - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-docstring-first + - id: check-yaml + - id: debug-statements + - id: name-tests-test + - id: requirements-txt-fixer + - id: double-quote-string-fixer - repo: https://github.com/psf/black rev: 19.3b0 hooks: - id: black +- repo: https://github.com/asottile/add-trailing-comma + rev: v2.2.1 + hooks: + - id: add-trailing-comma + args: [--py36-plus] +- repo: https://github.com/pre-commit/mirrors-mypy + rev: v0.910-1 + hooks: + - id: mypy + additional_dependencies: [types-all] +- repo: meta + hooks: + - id: check-hooks-apply + - id: check-useless-excludes diff --git a/README.md b/README.md index bb79934..c45aec7 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ cd PyRom pip install -e . rom24 ``` -Normal python install via pip should get things started. +Normal python install via pip should get things started. The more up-to-date home of the project that this was not forked from is [here](https://bitbucket.org/mudbytes/pyom). @@ -45,3 +45,9 @@ For the love of god, someone please help - I'm doing this because it's fun, but Even if you just pull it and test it locally to open bugs, opening bugs is awesome and appreciated. If you're interested in becoming an owner on the repo, send me an email at bubthegreat@gmail.com The typing is incredibly loose with lots of Any getting thrown around - as we add more typing, we'll find more bugs ahead of time. We're using black for formatting to keep formatting consistent. + +If you're going to contribute, please use the pre-commit hooks. It's got some things that will keep consistent formatting, clean up line endings, etc. +``` +pip install -r requirements.txt +pre-commit install +``` From 6d92d7e5fee16ba010b86effb155d4a194f74d90 Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Thu, 2 Dec 2021 00:48:28 -0800 Subject: [PATCH 28/40] Yay whitespace fixes! --- .pre-commit-config.yaml | 6 - doc/Rom2.4.doc | 1800 ++++++++++++++++----------------- doc/area.txt | 4 +- doc/drool.txt | 23 +- doc/equipment-system | 1 - doc/hacker.txt | 1 - doc/license.doc | 3 +- doc/memory.txt | 2 +- doc/new.txt | 2 +- doc/pyTiming.txt | 1 - doc/rom.license | 10 +- doc/vnum.txt | 34 +- requirements.txt | 6 +- setup.py | 10 +- src/area/astral.are | 72 +- src/area/canyon.are | 10 +- src/area/chapel.are | 2 +- src/area/daycare.are | 2 +- src/area/draconia.are | 136 +-- src/area/dwarven.are | 8 +- src/area/galaxy.are | 44 +- src/area/gnome.are | 14 +- src/area/grave.are | 2 +- src/area/group.are | 128 +-- src/area/grove.are | 26 +- src/area/haon.are | 2 +- src/area/help.are | 96 +- src/area/hood.are | 2 +- src/area/immort.are | 34 +- src/area/mahntor.are | 18 +- src/area/marsh.are | 20 +- src/area/midennir.are | 14 +- src/area/midgaard.are | 120 +-- src/area/mirror.are | 42 +- src/area/mobfact.are | 2 +- src/area/moria.are | 50 +- src/area/music.txt | 4 +- src/area/newthalos.are | 14 +- src/area/nirvana.are | 68 +- src/area/ofcol2.are | 58 +- src/area/olympus.are | 8 +- src/area/proto.are | 2 +- src/area/pyramid.are | 60 +- src/area/quifael.are | 8 +- src/area/redferne.are | 10 +- src/area/rom.are | 106 +- src/area/school.are | 6 +- src/area/sewer.are | 160 +-- src/area/shire.are | 24 +- src/area/smurf.are | 4 +- src/area/social.are | 648 ++++++------ src/area/tohell.are | 128 +-- src/area/wyvern.are | 14 +- src/rom24/__init__.py | 34 +- src/rom24/auth.py | 6 +- src/rom24/effects.py | 2 +- src/rom24/handler_item.py | 9 +- src/rom24/handler_log.py | 188 ---- src/rom24/instance.py | 33 +- src/rom24/merc.py | 29 +- src/rom24/miniboa/LICENSE.TXT | 2 - src/rom24/miniboa/colors.py | 12 +- src/rom24/miniboa/terminal.py | 4 +- tests/basic_import_test.py | 1 + 64 files changed, 2065 insertions(+), 2324 deletions(-) delete mode 100644 src/rom24/handler_log.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cf206cf..d1e530a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,16 +9,10 @@ repos: - id: debug-statements - id: name-tests-test - id: requirements-txt-fixer - - id: double-quote-string-fixer - repo: https://github.com/psf/black rev: 19.3b0 hooks: - id: black -- repo: https://github.com/asottile/add-trailing-comma - rev: v2.2.1 - hooks: - - id: add-trailing-comma - args: [--py36-plus] - repo: https://github.com/pre-commit/mirrors-mypy rev: v0.910-1 hooks: diff --git a/doc/Rom2.4.doc b/doc/Rom2.4.doc index a2f084a..8e5f763 100644 --- a/doc/Rom2.4.doc +++ b/doc/Rom2.4.doc @@ -16,15 +16,15 @@ E. The area format breakdown I. #AREA II. filename.are~ III. Area Name - IV. {1 50} Builder Sample Area - V. ZX00 ZX99 + IV. {1 50} Builder Sample Area + V. ZX00 ZX99 2. #MOBILES - I. + I. II. name list - III. short description - IV. long description - V. look description + III. short description + IV. long description + V. look description VI. race VII. Act, Affect, Alignment and group VIII. Level, hit bonus, hit dice, mana dice, damage, damtype @@ -37,12 +37,12 @@ E. The area format breakdown I. II. III. - IV. + IV. V. VI. VII. Flags, Extras, Wear locations VIII. V0 through V4 - IX. + IX. X. XI. XII. Object extra descriptions @@ -61,16 +61,16 @@ E. The area format breakdown XI. 5. #RESETS - I. M load a mobile into a room + I. M load a mobile into a room II. O load an object into a room - III. P put an object in an object (gold in a safe, etc.) - IV. G give an object to mobile - V. E equip an object to mobile - VI. D set state of door - VII. S stop (END OF LIST) + III. P put an object in an object (gold in a safe, etc.) + IV. G give an object to mobile + V. E equip an object to mobile + VI. D set state of door + VII. S stop (END OF LIST) 6. #SHOPS - + 7. #SPECIALS M @@ -94,21 +94,21 @@ A. Last modification date Rom 2.4/2.5 docs version 1, compiled by Satin (Gabrielle Taylor) 7-9-1995. -Don't forget to look for appendices dated past this document on the ftp +Don't forget to look for appendices dated past this document on the ftp site! There may be additional area-related code added in future Rom releases, and rather than force you to print out a whole new copy each time, a dated appendix will be placed on this ftp site. B. Credits - -This file contains material and information from the Merc release 2.1 -Area help files (done by Furey, Hatchet, and Kahn), material from the -Merc Diku Mud code itself, material and examples from various area files -that are found in both ROM2 and MadROM, as well as coding material that -was adapted and modified by Alander for ROM1 and ROM2, and later by -Madman for MadROM. It also contains information from Alander written -for ROM 2.3 and ROM2.4x, from Zump for Rom 2.4x, and information from + +This file contains material and information from the Merc release 2.1 +Area help files (done by Furey, Hatchet, and Kahn), material from the +Merc Diku Mud code itself, material and examples from various area files +that are found in both ROM2 and MadROM, as well as coding material that +was adapted and modified by Alander for ROM1 and ROM2, and later by +Madman for MadROM. It also contains information from Alander written +for ROM 2.3 and ROM2.4x, from Zump for Rom 2.4x, and information from ozy.doc by Ozymandias. It was compiled and rewritten by Satin for Tesseract (hypercube.org 9000), and then adapted by her to Rom 2.4x. Many of my examples are drawn from Diku's Midgaard, and my example of a fountain is drawn from Conner's New Thalos area. @@ -125,15 +125,15 @@ The shops: a listing of any shops that the area contains Specials: procedures to enchance the performance of mobiles -Areas may also include special notes and procedures, such as a help -file, information on where on the area should be placed, and any special -code that should be written to make the area work properly. This should +Areas may also include special notes and procedures, such as a help +file, information on where on the area should be placed, and any special +code that should be written to make the area work properly. This should be included outside the main body of the area, but within the same file. D. Organization -I. The sections should all be contained in one large file, organized in +I. The sections should all be contained in one large file, organized in the following manner (the file proto.are can be used as a template): #AREA @@ -163,25 +163,25 @@ S S -#$ +#$ II. Numbering -You will notice below that all these sections require numbers. For -example, Hassan is mobile #1203, and the temple of Midgaard is room -#3001. To make your area as simple to add as possible, number your +You will notice below that all these sections require numbers. For +example, Hassan is mobile #1203, and the temple of Midgaard is room +#3001. To make your area as simple to add as possible, number your files as follows: XX00-XX99 (1st 100 of anything) XY00-XY99 (2nd 100 of anything) -And so on. Thus, your mobile, object, and world files should ALL begin +And so on. Thus, your mobile, object, and world files should ALL begin with XX00 as the first entry. III. mailing -If you are on a unix system, please use the following protocol for -mailing your area: ([name] is the name of the area, preferably a short +If you are on a unix system, please use the following protocol for +mailing your area: ([name] is the name of the area, preferably a short one, i.e. shire.are or chapel.are. If you have gzip: @@ -196,8 +196,8 @@ person you are mailing it to can handle receiving large files. IV. A note about help files -It used to be possible to include help files in areas. However, it is -now preferred that the help file be sent in a separate file for +It used to be possible to include help files in areas. However, it is +now preferred that the help file be sent in a separate file for inclusion in another file set aside specifically for helps. V. @@ -211,735 +211,735 @@ E. The area format I. #AREA II. filename.are~ III. Area Name~ -IV. {1 50} Builder Sample Area~ -V. ZX00 ZX99 +IV. {1 50} Builder Sample Area~ +V. ZX00 ZX99 Breakdown: -I. #AREA is the signifier that the code uses to mark the beginning of a +I. #AREA is the signifier that the code uses to mark the beginning of a zone. -II. Select an appropriately unique filename for your area to be saved +II. Select an appropriately unique filename for your area to be saved as. Keep it short -- for instance, if your area is titled 'The Dell of the Darkness' an appropriate name is darkdell.are. Do not forget to close with a tilde. -III. Type in the area name here as you expect it to appear when the +III. Type in the area name here as you expect it to appear when the 'area' command is typed, plus a closing tilde. -IV. This is the line that will appear in the 'area' command. The -numbers in brackets signify the minimum and maximum levels that a player -character should be before venturing into the area. Insert the area -author's name in the spot labeled 'Builder' above, and the area name -where the example says 'Sample Area'. Do not forget to close with a +IV. This is the line that will appear in the 'area' command. The +numbers in brackets signify the minimum and maximum levels that a player +character should be before venturing into the area. Insert the area +author's name in the spot labeled 'Builder' above, and the area name +where the example says 'Sample Area'. Do not forget to close with a tilde. -V. This is the virtual number (vnum) range your area is using. You -must declare a range from 0 to 99 here even if you don't use that many -numbers, or a range from 0 to 199 if you use more than 100, etc. Use a -placeholder or variable such as 'ZX' instead of a specific range unless -you have been assigned a range by the implementor of the mud you are +V. This is the virtual number (vnum) range your area is using. You +must declare a range from 0 to 99 here even if you don't use that many +numbers, or a range from 0 to 199 if you use more than 100, etc. Use a +placeholder or variable such as 'ZX' instead of a specific range unless +you have been assigned a range by the implementor of the mud you are writing for. 2. #MOBILES -I. -II. name list~ -III. short description~ -IV. long description +I. +II. name list~ +III. short description~ +IV. long description ~ -V. look description +V. look description ~ -VI. race~ -VII. -VIII. <+ to hit> -IX. -X. -XI. -XII.
- -example mobile: +VI. race~ +VII. +VIII. <+ to hit> +IX. +X. +XI. +XII. + +example mobile: #ZX01 Sample~ Sample~ A sample mobile is here, waiting for a face. ~ -It looks bland and boring, and like it belongs nowhere near an area +It looks bland and boring, and like it belongs nowhere near an area file, but is a good example of a mobile. ~ human~ -ABTV CDFJVZ 1000 3000 -45 30 1d1+3999 1d1+499 5d4+40 crush --25 -25 -25 -15 -ACDEFHIKLNOT ABP CD 0 -stand stand either 0 -0 0 medium 0 +ABTV CDFJVZ 1000 3000 +45 30 1d1+3999 1d1+499 5d4+40 crush +-25 -25 -25 -15 +ACDEFHIKLNOT ABP CD 0 +stand stand either 0 +0 0 medium 0 Breakdown: - -I. The vnum is the number used to reference your mobile. There may + +I. The vnum is the number used to reference your mobile. There may only be one mobile of any given vnum at one time. (see definitions) -II. name list~ -This is a list of names that the mobile can be referenced by, for -example a fat, ugly worm might have a name list of: +II. name list~ +This is a list of names that the mobile can be referenced by, for +example a fat, ugly worm might have a name list of: fat worm~ -It's best to have more than one name per mobile. Don't forget the ~ at -the end of the line. - -III. short description~ -The short description is seen when the mobile fights or performs -actions, i.e. "The large orc". It should be kept fairly short, -preferably 20 characters or less. Don't forget the ~ at the end of the -line. - -IV. long description~ -The long description is seen whenever a character looks at the room a -mobile is in (provided, of course, that they can see the mobile in question). +It's best to have more than one name per mobile. Don't forget the ~ at +the end of the line. + +III. short description~ +The short description is seen when the mobile fights or performs +actions, i.e. "The large orc". It should be kept fairly short, +preferably 20 characters or less. Don't forget the ~ at the end of the +line. + +IV. long description~ +The long description is seen whenever a character looks at the room a +mobile is in (provided, of course, that they can see the mobile in question). Example: The large orc peers suspiciously at you. ~ -Ideally it should be one line in length, but in some cases two line or -longer long descriptions are justified. Be sure to put a ~ BELOW the -description (not at the end of the line). - -V. look description~ -This is the equivalent of a character's description, and is seen when -you look at a mobile. It can be as long as you like, but 1-5 lines is -probably best. Try and make it at least a little descriptive, players should feel rewarded for looking at a mobile. Be sure to put a ~ BELOW the description (not at the end of the line). - -VI. race~ -Every mobile should have a race, whether it be goblin, orc, troll, or -whatever. See the list below for races that already exist. If you feel +Ideally it should be one line in length, but in some cases two line or +longer long descriptions are justified. Be sure to put a ~ BELOW the +description (not at the end of the line). + +V. look description~ +This is the equivalent of a character's description, and is seen when +you look at a mobile. It can be as long as you like, but 1-5 lines is +probably best. Try and make it at least a little descriptive, players should feel rewarded for looking at a mobile. Be sure to put a ~ BELOW the description (not at the end of the line). + +VI. race~ +Every mobile should have a race, whether it be goblin, orc, troll, or +whatever. See the list below for races that already exist. If you feel your race is sufficiently distinct to merit creation of a new one, include a note containing the abilities the race should have to the implementor you are working with. Do not forget to put a ~ at the end of the line. The following is a list of acceptable races on Tesseract. Your mileage on other muds may vary. -bat - affect flags: flying, dark vision - offensive flags: dodge, fast - vulnerabilities: light - form: edible, animal, mammal - parts: ACDEFHJKP - -bear - offensive flags: crush, disarm, berserk - resistances: bash, cold - form: edible, animal, mammal - parts: ABCDEFHJKUV - -cat - affect flags: dark vision - offensive flags: fast, dodge - form: edible, animal, mammal - parts: ACDEFHJKQUV - -centipede - affect flags: dark vision - resistances: pierce, cold - vulnerabilities: bash - form: edible, poison, animal, insect - parts: ACK - -dog - offensive flags: fast - form: edible, animal, mammal - parts: ACDEFHJKUVo - -doll - immunities: cold, poison, holy, negative, mental, disease, drowning - resistances: bash, light - vulnerabilities: slash, fire, acid, lightning, energy - form: other, construct, biped, cold-blooded - parts: ABCGHK +bat + affect flags: flying, dark vision + offensive flags: dodge, fast + vulnerabilities: light + form: edible, animal, mammal + parts: ACDEFHJKP + +bear + offensive flags: crush, disarm, berserk + resistances: bash, cold + form: edible, animal, mammal + parts: ABCDEFHJKUV + +cat + affect flags: dark vision + offensive flags: fast, dodge + form: edible, animal, mammal + parts: ACDEFHJKQUV + +centipede + affect flags: dark vision + resistances: pierce, cold + vulnerabilities: bash + form: edible, poison, animal, insect + parts: ACK + +dog + offensive flags: fast + form: edible, animal, mammal + parts: ACDEFHJKUVo + +doll + immunities: cold, poison, holy, negative, mental, disease, drowning + resistances: bash, light + vulnerabilities: slash, fire, acid, lightning, energy + form: other, construct, biped, cold-blooded + parts: ABCGHK dragon (NPC dragons will typically have some flags stripped) - affect flags: infravision, flying - resistances: fire, bash - vulnerabilities: pierce, cold - form: edible, sentient, dragon - parts: ACDEFGHIJKPQUVX - -dwarf - affect flags: infravision - resistances: poison, disease - vulnerabilities: drowning - form: edible, sentient, biped, mammal - parts: ABCDEFGHIJK - -elf - affect flags: infravision - resistances: charm - vulnerabilities: iron - form: edible, sentient, biped, mammal - parts: ABCDEFGHIJK - -fido - offensive flags: dodge, assist race - vulnerabilities: magic - form: edible, poison, animal, mammal - parts: ACDEFHJKQV - -fox - affect flags: dark vision - offensive flags: fast, dodge - form: edible, animal, mammal - parts: ACDEFHJKQV - -giant - resistances: fire, cold - vulnerabilities: mental, lightning - form: edible, sentient, biped, mammal - parts: ABCDEFGHIJK - -goblin - affect flags: infravision - resistances: disease - vulnerabilities: magic - form: edible, sentient, biped, mammal - parts: ABCDEFGHIJK - -hobgoblin - affect flags: infravision - resistances: disease, poison - form: edible, sentient, biped, mammal - parts: ABCDEFGHIJKY - -human - form: edible, sentient, biped, mammal - parts: ABCDEFGHIJK - -kobold - affect flags: infravision - resistances: poison - vulnerabilities: magic - form: edible, poison, sentient, biped, mammal - parts: ABCDEFGHIJKQ - -lizard - resistances: poison - vulnerabilities: cold - form: edible, animal, reptile, cold-blooded - parts: ACDEFHKQV - -modron - affect flags: infravision - offensive flags: assist race, assist alignment - immunities: charm, disease, mental, holy, negative - resistances: fire, cold, acid - form: sentient - parts: ABCGHJK - -orc - affect flags: infravision - resistances: disease - vulnerabilities: light - form: edible, sentient, biped, mammal - parts: ABCDEFGHIJK - -pig - form: edible, animal, mammal - parts: ACDEFHJK - -rabbit - offensive flags: dodge, fast - form: edible, animal, mammal - parts: ACDEFHJK - -school monster - action flags: no alignment - immunities: charm, summon - vulnerabilities: magic - form: edible, biped, mammal - parts: ABCDEFHJKQU - -snake - resistances: poison - vulnerabilities: cold - form: edible, animal, reptile, snake, cold-blooded - parts: ADEFKLQVX - -song bird - affect flags: flying - offensive flags: fast, dodge - form: edible, animal, bird - parts: ACDEFHKP - -troll - affect flags: regeneration, infravision, detect hidden - offensive flags: berserk - resistances: charm, bash - vulnerabilities: fire, acid - form: edible, poison, sentient, biped, mammal - parts: ABCDEFGHIJKUV - -water fowl - affect flags: swim, flying - resistances: drowning - form: edible, animal, bird - parts: ACDEFHKP - -wolf - affect flags: dark vision - offensive flags: fast, dodge - form: edible, animal, mammal - parts: ACDEFJQV - -wyvern - affect flags: flying, detect invisible, detect hidden - offensive flags: bash, fast, dodge - immunities: poison - vulnerabilities: light - form: edible, poison, animal, dragon - parts: ACDEFHJKQVX + affect flags: infravision, flying + resistances: fire, bash + vulnerabilities: pierce, cold + form: edible, sentient, dragon + parts: ACDEFGHIJKPQUVX + +dwarf + affect flags: infravision + resistances: poison, disease + vulnerabilities: drowning + form: edible, sentient, biped, mammal + parts: ABCDEFGHIJK + +elf + affect flags: infravision + resistances: charm + vulnerabilities: iron + form: edible, sentient, biped, mammal + parts: ABCDEFGHIJK + +fido + offensive flags: dodge, assist race + vulnerabilities: magic + form: edible, poison, animal, mammal + parts: ACDEFHJKQV + +fox + affect flags: dark vision + offensive flags: fast, dodge + form: edible, animal, mammal + parts: ACDEFHJKQV + +giant + resistances: fire, cold + vulnerabilities: mental, lightning + form: edible, sentient, biped, mammal + parts: ABCDEFGHIJK + +goblin + affect flags: infravision + resistances: disease + vulnerabilities: magic + form: edible, sentient, biped, mammal + parts: ABCDEFGHIJK + +hobgoblin + affect flags: infravision + resistances: disease, poison + form: edible, sentient, biped, mammal + parts: ABCDEFGHIJKY + +human + form: edible, sentient, biped, mammal + parts: ABCDEFGHIJK + +kobold + affect flags: infravision + resistances: poison + vulnerabilities: magic + form: edible, poison, sentient, biped, mammal + parts: ABCDEFGHIJKQ + +lizard + resistances: poison + vulnerabilities: cold + form: edible, animal, reptile, cold-blooded + parts: ACDEFHKQV + +modron + affect flags: infravision + offensive flags: assist race, assist alignment + immunities: charm, disease, mental, holy, negative + resistances: fire, cold, acid + form: sentient + parts: ABCGHJK + +orc + affect flags: infravision + resistances: disease + vulnerabilities: light + form: edible, sentient, biped, mammal + parts: ABCDEFGHIJK + +pig + form: edible, animal, mammal + parts: ACDEFHJK + +rabbit + offensive flags: dodge, fast + form: edible, animal, mammal + parts: ACDEFHJK + +school monster + action flags: no alignment + immunities: charm, summon + vulnerabilities: magic + form: edible, biped, mammal + parts: ABCDEFHJKQU + +snake + resistances: poison + vulnerabilities: cold + form: edible, animal, reptile, snake, cold-blooded + parts: ADEFKLQVX + +song bird + affect flags: flying + offensive flags: fast, dodge + form: edible, animal, bird + parts: ACDEFHKP + +troll + affect flags: regeneration, infravision, detect hidden + offensive flags: berserk + resistances: charm, bash + vulnerabilities: fire, acid + form: edible, poison, sentient, biped, mammal + parts: ABCDEFGHIJKUV + +water fowl + affect flags: swim, flying + resistances: drowning + form: edible, animal, bird + parts: ACDEFHKP + +wolf + affect flags: dark vision + offensive flags: fast, dodge + form: edible, animal, mammal + parts: ACDEFJQV + +wyvern + affect flags: flying, detect invisible, detect hidden + offensive flags: bash, fast, dodge + immunities: poison + vulnerabilities: light + form: edible, poison, animal, dragon + parts: ACDEFHJKQVX VII. Act, Affects, Aggression, Alignment, Mobile group -Act flags (short for "action") determine the in-game behavior of your +Act flags (short for "action") determine the in-game behavior of your mobile. Input all of the flags you have chosen into the proper mobile section (as shown in the examples above). Following is a listing of act flags: -A NPC Mobile is an NPC (set automatically by the game) -B sentinel Mobile doesn't wander -C scavenger Mobile picks up items on the floor +A NPC Mobile is an NPC (set automatically by the game) +B sentinel Mobile doesn't wander +C scavenger Mobile picks up items on the floor F aggressive Mobile attacks any character in the same room - (see the section dealing with aggression) -G stay area Mobile will not leave a zone (this should be set) -H wimpy Mobile will fly when badly hurt -J pet Mobile is a pet (and hence safe from attack) -K train Mobile can train statistics -O undead Mobile has special undead powers (i.e. life draining) -Q cleric Mobile has cleric casting powers -R mage Mobile has mage casting powers -S thief Mobile has thief combat skills (backstab, etc.) -T warrior Mobile has warrior combat skills (disarm, parry, etc.) + (see the section dealing with aggression) +G stay area Mobile will not leave a zone (this should be set) +H wimpy Mobile will fly when badly hurt +J pet Mobile is a pet (and hence safe from attack) +K train Mobile can train statistics +O undead Mobile has special undead powers (i.e. life draining) +Q cleric Mobile has cleric casting powers +R mage Mobile has mage casting powers +S thief Mobile has thief combat skills (backstab, etc.) +T warrior Mobile has warrior combat skills (disarm, parry, etc.) U noalign Mobile is unaligned (unintelligent animals, golems, etc.) -V nopurge Mobile isn't removed by the purge command -W outdoors Mobile will not wander outside a building -Y indoors Mobile will not wander into a building -a healer Mobile can heal characters (i.e. the heal command) -b gain Mobile can grant new skills (i.e. the gain command) -c update Mobile is always updated, even in idle zones (rarely - needed) -d changer Mobile can change coins (i.e. Otho the Money Changer) - - -Affect Flags -Affect flags are used to assign various spell and spell-like effects to -a mobile, such as sanctuary, hidden, or detections. The following list +V nopurge Mobile isn't removed by the purge command +W outdoors Mobile will not wander outside a building +Y indoors Mobile will not wander into a building +a healer Mobile can heal characters (i.e. the heal command) +b gain Mobile can grant new skills (i.e. the gain command) +c update Mobile is always updated, even in idle zones (rarely + needed) +d changer Mobile can change coins (i.e. Otho the Money Changer) + + +Affect Flags +Affect flags are used to assign various spell and spell-like effects to +a mobile, such as sanctuary, hidden, or detections. The following list contains all usable affect flags: -B invisible Mobile is invisible -C detect evil Mobile can sense evil +B invisible Mobile is invisible +C detect evil Mobile can sense evil D detect invis Mobile can see invisible. ** E detect magic Mobile can see magic -F detect hide Mobile can see hidden (sneaking/hiding) characters -G detect good Mobile can sense good +F detect hide Mobile can see hidden (sneaking/hiding) characters +G detect good Mobile can sense good H sanctuary Mobile is protected by a sanctuary spell. ** -I faerie fire Mobile is surrounded by faerie fire (a hindrance) -J infravision Mobile can see heat sources in the dark -N protect evil Mobile takes less damage from evil characters -O protect good Mobile takes less damage from good characters -P sneaking Mobile is sneaking (hard to detect while moving) -Q hiding Mobile is hiding (cannot be seen without detect hidden) -T flying Mobile is flying -U pass door Mobile can walk through closed doors -V haste Mobile is affected by a haste spell -Z dark vision Mobile can see in the dark without a light source -b swimming Mobile is swimming (or capable of swimming) -c regeneration Mobile recovers hit points and mana faster than usual - -** Sanctuary and detect invisible are often overused, so please be -careful with them. Not every mobile should be able to see invisible, or the spell is worthless, and similarly not every hard mobile should have a sanctuary spell. - -Example: a glowing ghost might have faerie fire, flying, and protect +I faerie fire Mobile is surrounded by faerie fire (a hindrance) +J infravision Mobile can see heat sources in the dark +N protect evil Mobile takes less damage from evil characters +O protect good Mobile takes less damage from good characters +P sneaking Mobile is sneaking (hard to detect while moving) +Q hiding Mobile is hiding (cannot be seen without detect hidden) +T flying Mobile is flying +U pass door Mobile can walk through closed doors +V haste Mobile is affected by a haste spell +Z dark vision Mobile can see in the dark without a light source +b swimming Mobile is swimming (or capable of swimming) +c regeneration Mobile recovers hit points and mana faster than usual + +** Sanctuary and detect invisible are often overused, so please be +careful with them. Not every mobile should be able to see invisible, or the spell is worthless, and similarly not every hard mobile should have a sanctuary spell. + +Example: a glowing ghost might have faerie fire, flying, and protect good, for an affect flag of IOT. There is no limit to the number of affect flags that may be set on a mobile, but be sure not to type the same letter twice. -Alignment -Alignment is a number between -1000 and 1000, meant to represent the -ethos of your creature. -1000 is irredeemably evil, 1000 is saintly. All but the most extreme monsters should fall between -500 and 500, and in particular it is hard to justify any low-level mobiles having extreme alignment. +Alignment +Alignment is a number between -1000 and 1000, meant to represent the +ethos of your creature. -1000 is irredeemably evil, 1000 is saintly. All but the most extreme monsters should fall between -500 and 500, and in particular it is hard to justify any low-level mobiles having extreme alignment. -Mobile Group -The mobile is used to group mobiles into allied groups. They are -assigned by XXYY, where XX is your zone number (for Midgaard 30) and YY is some increasing number (so Midgaard's groups will be 3000, 3001, etc.). Any mobile in the same group as another mobile will assist it in combat. The actual number has no real meaning, but please use the numbering system above so that each area keeps unique grouping. +Mobile Group +The mobile is used to group mobiles into allied groups. They are +assigned by XXYY, where XX is your zone number (for Midgaard 30) and YY is some increasing number (so Midgaard's groups will be 3000, 3001, etc.). Any mobile in the same group as another mobile will assist it in combat. The actual number has no real meaning, but please use the numbering system above so that each area keeps unique grouping. VIII. Level, Hit bonus, Hit dice, Mana dice, Damage, Damage type: -(See the appendix at the end of the documentation for details on +(See the appendix at the end of the documentation for details on recommended values depending on the mobile level) -Level -This is a very important statistic, as it determines the recommended -values for your mobile's combat abilities. Try and make the level choice reasonable to believe. Just as a level 2 Ancient Blue Wyrm makes no sense, neither does a level 50 snail. Look over the recommended values for the level and please try to stay fairly close to them, otherwise your mobile may well be out of balance with the others in the game. +Level +This is a very important statistic, as it determines the recommended +values for your mobile's combat abilities. Try and make the level choice reasonable to believe. Just as a level 2 Ancient Blue Wyrm makes no sense, neither does a level 50 snail. Look over the recommended values for the level and please try to stay fairly close to them, otherwise your mobile may well be out of balance with the others in the game. Hit bonus -This statistic is normally 0, but in mobiles with exceptional (and I do -mean exceptional) combat abilities it may be higher. Clumsy mobiles may -deserve a -1 or -2. +This statistic is normally 0, but in mobiles with exceptional (and I do +mean exceptional) combat abilities it may be higher. Clumsy mobiles may +deserve a -1 or -2. Hit dice -Hit dice are expressed as ndn+n (so many d-whatevers + a bonus). +Hit dice are expressed as ndn+n (so many d-whatevers + a bonus). Consult the recommended mobile values to get a rough idea how many hit points your mobile should have. The hit points will determine how much raw damage your monster can take before expiring. For a fixed quantity of hit points enter it as x+1d1: i.e., for 100 hps, 1d1+99. Mana dice -Mana dice are expressed as ndn+n. Consult the recommended mobile values -to get a rough idea how much mana your mobile should have. +Mana dice are expressed as ndn+n. Consult the recommended mobile values +to get a rough idea how much mana your mobile should have. This value will determine how many spells your mobile can cast in a combat (non-spellcasters have a mana value as well, as their mana can be tapped by the energy drain spell). Note that the mana value is not currently used, but mobiles WILL in future use it (and therefore be able to run out of it) so don't forget to define this section. Damage -The damaging power of a mobile is expressed as ndn+n, just like hit -points and mana. It is very important to stay close to the values recommended, in particular where the damage bonus is concerned, or the mobile's balance will be skewed. +The damaging power of a mobile is expressed as ndn+n, just like hit +points and mana. It is very important to stay close to the values recommended, in particular where the damage bonus is concerned, or the mobile's balance will be skewed. -Damage Types -A mobile's damage type defines three things: what message is seen when -it attacks in combat, what armor class is used to defend against the -attack, and what type of resistance or vulnerability affects the damage received from the attack. The following damage types are supported, listed by the type of attack and the damage messaged sent (if a name follows the damage message, you should use that name in your area file, otherwise just use the message itself). If you can't find a damage type that fits your mobiles, by all means make a new one (but be sure to note that a new damage type was added and how it should be defined, or your mobile will not function properly!) +Damage Types +A mobile's damage type defines three things: what message is seen when +it attacks in combat, what armor class is used to defend against the +attack, and what type of resistance or vulnerability affects the damage received from the attack. The following damage types are supported, listed by the type of attack and the damage messaged sent (if a name follows the damage message, you should use that name in your area file, otherwise just use the message itself). If you can't find a damage type that fits your mobiles, by all means make a new one (but be sure to note that a new damage type was added and how it should be defined, or your mobile will not function properly!) -piercing attacks (pierce ac): -bite pierce sting -chomp scratch thrust -peck stab +piercing attacks (pierce ac): +bite pierce sting +chomp scratch thrust +peck stab -bashing attacks (bash ac): -beating crush smash -blast peck(peckb) suction -pound punch thwack -charge slap +bashing attacks (bash ac): +beating crush smash +blast peck(peckb) suction +pound punch thwack +charge slap -slashing attacks (slash ac): -claw grep slice -cleave slash whip +slashing attacks (slash ac): +claw grep slice +cleave slash whip -acid attacks (magic ac): -acidic bite (acbite) digestion slime +acid attacks (magic ac): +acidic bite (acbite) digestion slime -cold attacks (magic ac): -chill freezing bite (frbite) +cold attacks (magic ac): +chill freezing bite (frbite) -energy attacks (magic ac): -magic wrath +energy attacks (magic ac): +magic wrath -fire attacks (magic ac): -flame flaming bite (flbite) +fire attacks (magic ac): +flame flaming bite (flbite) -holy attacks (magic ac): -divine power (divine) +holy attacks (magic ac): +divine power (divine) -lightning attacks (magic ac): -shock shocking bite(shbite) +lightning attacks (magic ac): +shock shocking bite(shbite) -negative attacks (magic ac): -life drain (drain) +negative attacks (magic ac): +life drain (drain) -The acceptable kinds of damage (some with no damage messages as yet) -are: -bash disease light -pierce drowning lightning -slash energy mental -acid fire negative -charm harm poison -cold holy sound +The acceptable kinds of damage (some with no damage messages as yet) +are: +bash disease light +pierce drowning lightning +slash energy mental +acid fire negative +charm harm poison +cold holy sound -Harm, disease, and poison are generally used only on spells, but are -included here on the outside chance that a mobile might need them. +Harm, disease, and poison are generally used only on spells, but are +included here on the outside chance that a mobile might need them. -This list is by no means exhaustive, so please feel free to expand it as -your write your area. +This list is by no means exhaustive, so please feel free to expand it as +your write your area. -IX. Armor Classes -In order, the 4 armor class values for a mobile are piercing (i.e. -daggers and spears), bashing (i.e. clubs, rocks), slashing (swords and axes), and magical (everything else). Usually the first three will be fairly close to each other (it's nice to have them be a little different, however), and the magical AC will be considerably weaker. Please adhere to the AC guidelines set out in the appendix dealing with recommended values for such. +IX. Armor Classes +In order, the 4 armor class values for a mobile are piercing (i.e. +daggers and spears), bashing (i.e. clubs, rocks), slashing (swords and axes), and magical (everything else). Usually the first three will be fairly close to each other (it's nice to have them be a little different, however), and the magical AC will be considerably weaker. Please adhere to the AC guidelines set out in the appendix dealing with recommended values for such. X. Offensive flags, Vulnerabilities, Resistances and Immunities: -Offensive Flags -Offensive flags control mobile behavior in combat -- allowing some -variety in how your mobiles fight back against players. A typical mobile should have a few (2-3) attack abilities and one or none defensive abilities, more skilled mobiles may have more, but try not to make them too flexible. - -The following offensive flags are available, although not all are currently active (please use them anyway if they are appropriate, as they will be enabled at some future date): - -A area attack Mobile hits all characters fighting against it. Very -powerful. -B backstab Mobile can backstab to start a combat -C bash Mobile can bash characters off their feet -D berserk Mobile may go berserk in a fight -E disarm Mobile can disarm _without_ a weapon wielded** -F dodge Mobile dodges blows -G fade* Mobile can fade "out of phase" to avoid blows -H fast Mobile is faster than most others, so has extra attacks -I kick Mobile can kick in combat for extra damage -J kick dirt Mobile kicks dirt, blinding opponents -K parry Mobile can parry _without_ a weapon wielded** -L rescue* Mobile may rescue allies in a fight -M tail* Mobile can legsweep with its tail or tentacles -N trip Mobile trips in combat -O crush* Mobile can crush opponents in its arms - -* not yet enabled -** warrior and thief mobs (see action bits) can disarm and parry - with a weapon wielded automatically - -Offensive flags also control the assisting behavior of a mobile, by -using the following flags: - -P all Mobile helps all other mobiles in combat -Q align Mobile assists mobiles of like alignment -R race Mobile will assist other mobiles of the same race +Offensive Flags +Offensive flags control mobile behavior in combat -- allowing some +variety in how your mobiles fight back against players. A typical mobile should have a few (2-3) attack abilities and one or none defensive abilities, more skilled mobiles may have more, but try not to make them too flexible. + +The following offensive flags are available, although not all are currently active (please use them anyway if they are appropriate, as they will be enabled at some future date): + +A area attack Mobile hits all characters fighting against it. Very +powerful. +B backstab Mobile can backstab to start a combat +C bash Mobile can bash characters off their feet +D berserk Mobile may go berserk in a fight +E disarm Mobile can disarm _without_ a weapon wielded** +F dodge Mobile dodges blows +G fade* Mobile can fade "out of phase" to avoid blows +H fast Mobile is faster than most others, so has extra attacks +I kick Mobile can kick in combat for extra damage +J kick dirt Mobile kicks dirt, blinding opponents +K parry Mobile can parry _without_ a weapon wielded** +L rescue* Mobile may rescue allies in a fight +M tail* Mobile can legsweep with its tail or tentacles +N trip Mobile trips in combat +O crush* Mobile can crush opponents in its arms + +* not yet enabled +** warrior and thief mobs (see action bits) can disarm and parry + with a weapon wielded automatically + +Offensive flags also control the assisting behavior of a mobile, by +using the following flags: + +P all Mobile helps all other mobiles in combat +Q align Mobile assists mobiles of like alignment +R race Mobile will assist other mobiles of the same race S players Mobile will assist players (by race/alignment) T guard Mobile assists as a cityguard -U vnum Mobile assists mobiles of the same number only +U vnum Mobile assists mobiles of the same number only -Assisting by race and vnum are by the far the most common assist types. -Mobiles also assist mobiles in the same group, as defined by the group +Assisting by race and vnum are by the far the most common assist types. +Mobiles also assist mobiles in the same group, as defined by the group number. -Notes: The area attack and fast flags are quite powerful, and mustn't be - overused. Only the most powerful mobiles should be capable of area - attack, and only mobiles that really are faster than most should be +Notes: The area attack and fast flags are quite powerful, and mustn't be + overused. Only the most powerful mobiles should be capable of area + attack, and only mobiles that really are faster than most should be fast. Proper assist flag setting can greatly enhance the - cooperation within an area. + cooperation within an area. -Example: An orc might have bash, kick, and kick dirt (it will probably -be a warrior, so will parry and disarm if armed), and will assist by -race and alignment, for an offensive flag of CIJQR. There is no limit to -the number of offensive flags that may be set on a mobile, but be sure +Example: An orc might have bash, kick, and kick dirt (it will probably +be a warrior, so will parry and disarm if armed), and will assist by +race and alignment, for an offensive flag of CIJQR. There is no limit to +the number of offensive flags that may be set on a mobile, but be sure not to use the same letter twice. -Immunities, resistances, and vulnerabilities -Mobiles have differing immunities, resistances, and vulnerabilites both -to better explain certain creatures (i.e. dragons) and to make fighting -them take a little more strategy than just mindlessly pumping out damage. Most normal mobiles probably won't have much in the way of these flags, so don't add flags without sound reason. It's important to make shopkeeper-type mobiles (as well as guild masters, healers, et cetera) immune to summon, charm, magic, and weapons (immunity flag ABCD) just to insure that they cannot be killed. Similarly, weak, low-level mobiles (goblins, for example) might be made vulnerable to magic just to accent their weakness. All three flags share the same fields, which are as follows: - -A summon Summoning and gating magic -B charm Charm spells (the beguiling spell group) -C magic All magic (be very careful using this flag) -D weapons All physical attacks (be very careful using this flag) -E bash Blunt weapons -F pierce Piercing weapons -G slash Slashing weapons -H Fire Flame and heat attacks and spells -I Cold Cold and ice attacks and spells -J Lightning Electrical attacks and spells -K Acid Corrosive attacks and spells -L Poison Venoms and toxic vapors -M Negative Life draining attacks and spells, or unholy energies -N Holy Holy or blessed attacks -O Energy Generic magical force (i.e. magic missile) -P Mental Mental attacks (such as a mind flayer's mind blasts) -Q Disease Disease, from the common cold to the black death -R Drowning Watery attacks and suffocation -S Light Light-based attacks, whether blinding or cutting -T Sound Sonic attacks and weapons, or deafening noises -X Wood Wooden weapons and creatures -Y Silver Silver or mithril weapons and creatures -Z Iron Iron and steel weapons and creatures - -Note: Resist the temptation to make "Achilles Heel" style mobiles, that -is creatures that are immune (or almost immune) to all but a single -attack type. Such mobiles are extremely boring to fight, and ultimately -not very hard to defeat. Strive to make a balanced mobile, with no flags that aren't explainable by its nature. - -Important Note: the two generic categories (weapon and magic) are merged -with more specific flags, so that a mobile which is (for example) immune -to magic but vulnerable to fire will take normal damage from fire. - -Example: a fire demon might be immune to fire and negative energy (HM), -resistant to mental attacks and weapons (DP), and vulnerable to holy attacks as well as cold (IN). +Immunities, resistances, and vulnerabilities +Mobiles have differing immunities, resistances, and vulnerabilites both +to better explain certain creatures (i.e. dragons) and to make fighting +them take a little more strategy than just mindlessly pumping out damage. Most normal mobiles probably won't have much in the way of these flags, so don't add flags without sound reason. It's important to make shopkeeper-type mobiles (as well as guild masters, healers, et cetera) immune to summon, charm, magic, and weapons (immunity flag ABCD) just to insure that they cannot be killed. Similarly, weak, low-level mobiles (goblins, for example) might be made vulnerable to magic just to accent their weakness. All three flags share the same fields, which are as follows: + +A summon Summoning and gating magic +B charm Charm spells (the beguiling spell group) +C magic All magic (be very careful using this flag) +D weapons All physical attacks (be very careful using this flag) +E bash Blunt weapons +F pierce Piercing weapons +G slash Slashing weapons +H Fire Flame and heat attacks and spells +I Cold Cold and ice attacks and spells +J Lightning Electrical attacks and spells +K Acid Corrosive attacks and spells +L Poison Venoms and toxic vapors +M Negative Life draining attacks and spells, or unholy energies +N Holy Holy or blessed attacks +O Energy Generic magical force (i.e. magic missile) +P Mental Mental attacks (such as a mind flayer's mind blasts) +Q Disease Disease, from the common cold to the black death +R Drowning Watery attacks and suffocation +S Light Light-based attacks, whether blinding or cutting +T Sound Sonic attacks and weapons, or deafening noises +X Wood Wooden weapons and creatures +Y Silver Silver or mithril weapons and creatures +Z Iron Iron and steel weapons and creatures + +Note: Resist the temptation to make "Achilles Heel" style mobiles, that +is creatures that are immune (or almost immune) to all but a single +attack type. Such mobiles are extremely boring to fight, and ultimately +not very hard to defeat. Strive to make a balanced mobile, with no flags that aren't explainable by its nature. + +Important Note: the two generic categories (weapon and magic) are merged +with more specific flags, so that a mobile which is (for example) immune +to magic but vulnerable to fire will take normal damage from fire. + +Example: a fire demon might be immune to fire and negative energy (HM), +resistant to mental attacks and weapons (DP), and vulnerable to holy attacks as well as cold (IN). XI. Start position, Default position, Gender, Treasure -start and default position -The start position is the position a mobile will be loaded in, the +start and default position +The start position is the position a mobile will be loaded in, the default position is the position it returns to after a fight. These are often the same, but a sleeping mobile (for example) is not likely to go back to sleep. - -The acceptable positions are stand, sit, rest, and sleep. -sex -Mobile sex (as in gender, mobiles don't reproduce) can be none, male, -female, or either (either will be set randomly for each mobile of that type which is loaded). It has no real game effects, but does add color. It's a good idea to make generic mobiles (i.e. rabbits) sex 'either', just for variety. +The acceptable positions are stand, sit, rest, and sleep. + +sex +Mobile sex (as in gender, mobiles don't reproduce) can be none, male, +female, or either (either will be set randomly for each mobile of that type which is loaded). It has no real game effects, but does add color. It's a good idea to make generic mobiles (i.e. rabbits) sex 'either', just for variety. -treasure -The average treasure carried by the mobile, in silver pieces. Most -mobiles should carry no more than 100 coins per level, and usually much less unless they are supposed to be wealthy. Non-intelligent mobiles should usually have no treasure. +treasure +The average treasure carried by the mobile, in silver pieces. Most +mobiles should carry no more than 100 coins per level, and usually much less unless they are supposed to be wealthy. Non-intelligent mobiles should usually have no treasure. XII. Form, Part, Size, Material -Form flags +Form flags -The forms flag is used to define a body form for your mobile, and also +The forms flag is used to define a body form for your mobile, and also related data like what happens to its corpse when it dies, and whether or not it is edible. Much of the forms code is not yet implemented, but please be as thorough as possible when defining your mobile, as it will all be used at some future point in time. The acceptable flags for body form are as follows (use your best judgment to determine which flags should be mutually exclusive): -corpse-related flags: +corpse-related flags: -A edible Mobile can be eaten -B poison Mobile is poisonous when eaten (should also be edible) +A edible Mobile can be eaten +B poison Mobile is poisonous when eaten (should also be edible) C magical* Mobile's magic nature causes strange effects when eaten -D vanishes* Mobile vanishes after death (i.e. a wraith) -E other* Mobile is not flesh and blood (defined by material type) - -form-related flags: -G animal Mobile is a "dumb" animal -H sentient Mobile is capable of higher reasoning -I undead Mobile is an undead, and not truly alive at all -J construct Mobile is a magical construct, such as a golem -K mist Mobile is a partially material mist -L intangible Mobile is immaterial (like a ghost) -M biped Mobile is bipedal (like a human) -N centaur Mobile has a humanoid torso, but a beast's lower body -O insect Mobile is an insect -P spider Mobile is an arachnid -Q crustacean Mobile is a crustacean (i.e. a crab or lobster) -R worm Mobile is a worm, that is a tube-shaped invertebrate -S blob Mobile is a formless blob (when used with mist, a cloud) -V mammal Mobile is a mammal -W bird Mobile is a bird -X reptile Mobile is a reptile (and should be cold-blooded) -Y snake Mobile is a snake (and should be a reptile) +D vanishes* Mobile vanishes after death (i.e. a wraith) +E other* Mobile is not flesh and blood (defined by material type) + +form-related flags: +G animal Mobile is a "dumb" animal +H sentient Mobile is capable of higher reasoning +I undead Mobile is an undead, and not truly alive at all +J construct Mobile is a magical construct, such as a golem +K mist Mobile is a partially material mist +L intangible Mobile is immaterial (like a ghost) +M biped Mobile is bipedal (like a human) +N centaur Mobile has a humanoid torso, but a beast's lower body +O insect Mobile is an insect +P spider Mobile is an arachnid +Q crustacean Mobile is a crustacean (i.e. a crab or lobster) +R worm Mobile is a worm, that is a tube-shaped invertebrate +S blob Mobile is a formless blob (when used with mist, a cloud) +V mammal Mobile is a mammal +W bird Mobile is a bird +X reptile Mobile is a reptile (and should be cold-blooded) +Y snake Mobile is a snake (and should be a reptile) Z dragon Mobile is a dragon -a amphibian Mobile is an amphibian (and should be able to swim) -b fish Mobile is a fish (and should be able to swim) -c cold blood Mobile is cold-blooded, cannot be seen with infravis. - -* Not yet implemented - -parts flags -The body parts flag is used to detail what limbs and organs a creature -has, and currently has no game effect beyond determining what hits the ground when you kill a monster. In the future, body parts will also determine what can be worn by the creature in question, and possibly special attacks (i.e. the tail attack) that the mobile may do, so please do try to be thorough in describing your mobile's body parts. The following body parts are defined: - -A head Mobile has a head -B arms Mobile has arm(s) (usually assumed to be 2) -C legs Mobile has leg(s) -D heart Mobile has a heart -E brains Mobile has brains (not all mobs with heads have brains) -F guts Mobile has intestines -G hands Mobile has hands capable of manipulating objects -H feet Mobile has feet -I fingers Mobile has fingers capable of wearing rings -J ear Mobile has ear(s) -K eye Mobile has eye(s) -L tongue Mobile has a _long_ tongue (like a lizard) -M eyestalks Mobile has eyestalks (it should also have eyes) -N tentacles Mobile has one or more tentacles -O fins Mobile has fins -P wings Mobile has wings -Q tail Mobile has a usable tail (no stubs) -U claws Mobile has combat-capable claws -V fangs Mobile has combat-capable teeth -W horns Mobile has horns, not necessarily dangerous ones -X scales Mobile is covered with scales -Y tusks Mobile has some teeth elongated into tusks - - -size -The size of the mobile has many game effects, and should be chosen -carefully. -The acceptable sizes are as follows: -tiny: small birds and anything smaller -small: large birds (ducks and up) to halflings -medium: elves and dwarves to humans -large: ogres, gnolls, and other large humanoids -huge: giants, small dragons, and wyverns -giant: for VERY large critters, i.e. dragons, titans, and the biggest -giants - -material -The material type for mobiles is not currently supported. It should be -left blank (0) for flesh-and-blood creatures, or spirits, but golems and -other animated beings should have a material appropriate to their body -construction (i.e. stone, iron, diamond). Put the material in single -quotes if it is longer than one word. - -Appendix A: Recommended Values -The following values should be followed closely for all mobiles -- try -not to go more than 1 level away from the recommended values unless you are absolutely sure you want your mobile to be harder or easier than a -default monster. In particular, avoid making them easier. Certain action flags (namely the 4 class-related flags) can modify the recommendations, they are explained in detail at the end of this section. - -level hit pts ac damage level hit pts ac damage - 1 2d6+10 9 1d4+0 31 6d12+928 -10 4d6+9 - 2 2d7+21 8 1d5+0 32 10d10+1000 -10 6d4+9 - 3 2d6+35 7 1d6+0 33 10d10+1100 -11 6d4+10 - 4 2d7+46 6 1d5+1 34 10d10+1200 -11 4d7+10 - 5 2d6+60 5 1d6+1 35 10d10+1300 -11 4d7+11 - - 6 2d7+71 4 1d7+1 36 10d10+1400 -12 3d10+11 - 7 2d6+85 4 1d8+1 37 10d10+1500 -12 3d10+12 - 8 2d7+96 3 1d7+2 38 10d10+1600 -13 5d6+12 - 9 2d6+110 2 1d8+2 39 15d10+1700 -13 5d6+13 - 10 2d7+121 1 2d4+2 40 15d10+1850 -13 4d8+13 - - 11 2d8+134 1 1d10+2 41 25d10+2000 -14 4d8+14 - 12 2d10+150 0 1d10+3 42 25d10+2250 -14 3d12+14 - 13 2d10+170 -1 2d5+3 43 25d10+2500 -15 3d12+15 - 14 2d10+190 -1 1d12+3 44 25d10+2750 -15 8d4+15 - 15 3d9+208 -2 2d6+3 45 25d10+3000 -15 8d4+16 - - 16 3d9+233 -2 2d6+4 46 25d10+3250 -16 6d6+16 - 17 3d9+258 -3 3d4+4 47 25d10+3500 -17 6d6+17 - 18 3d9+283 -3 2d7+4 48 25d10+3750 -18 6d6+18 - 19 3d9+308 -4 2d7+5 49 50d10+4000 -19 4d10+18 - 20 3d9+333 -4 2d8+5 50 50d10+4500 -20 5d8+19 - - 21 4d10+360 -5 4d4+5 51 50d10+5000 -21 5d8+20 - 22 5d10+400 -5 4d4+6 52 50d10+5500 -22 6d7+20 - 23 5d10+450 -6 3d6+6 53 50d10+6000 -23 6d7+21 - 24 5d10+500 -6 2d10+6 54 50d10+6500 -24 7d6+22 - 25 5d10+550 -7 2d10+7 55 50d10+7000 -25 10d4+23 - - 26 5d10+600 -7 3d7+7 56 50d10+7500 -26 10d4+24 - 27 5d10+650 -8 5d4+7 57 50d10+8000 -27 6d8+24 - 28 6d12+703 -8 2d12+8 58 50d10+8500 -28 5d10+25 - 29 6d12+778 -9 2d12+8 59 50d10+9000 -29 8d6+26 - 30 6d12+853 -9 4d6+8 60 50d10+9500 -30 8d6+28 - -Thief* mobiles should read their hp, ac, and damage at one level lower -Mage mobiles read hp and ac at one level lower, and damage three levels -lower -Cleric mobiles read damage at two levels lower -Warrior mobiles read hit points one level higher -Armor class vs. magical attacks should be computed by this formula: -(ac - 10) / n + 10, where n is 4 for most mobiles, 3 for thieves and -clerics, and 2 for mages. +a amphibian Mobile is an amphibian (and should be able to swim) +b fish Mobile is a fish (and should be able to swim) +c cold blood Mobile is cold-blooded, cannot be seen with infravis. + +* Not yet implemented + +parts flags +The body parts flag is used to detail what limbs and organs a creature +has, and currently has no game effect beyond determining what hits the ground when you kill a monster. In the future, body parts will also determine what can be worn by the creature in question, and possibly special attacks (i.e. the tail attack) that the mobile may do, so please do try to be thorough in describing your mobile's body parts. The following body parts are defined: + +A head Mobile has a head +B arms Mobile has arm(s) (usually assumed to be 2) +C legs Mobile has leg(s) +D heart Mobile has a heart +E brains Mobile has brains (not all mobs with heads have brains) +F guts Mobile has intestines +G hands Mobile has hands capable of manipulating objects +H feet Mobile has feet +I fingers Mobile has fingers capable of wearing rings +J ear Mobile has ear(s) +K eye Mobile has eye(s) +L tongue Mobile has a _long_ tongue (like a lizard) +M eyestalks Mobile has eyestalks (it should also have eyes) +N tentacles Mobile has one or more tentacles +O fins Mobile has fins +P wings Mobile has wings +Q tail Mobile has a usable tail (no stubs) +U claws Mobile has combat-capable claws +V fangs Mobile has combat-capable teeth +W horns Mobile has horns, not necessarily dangerous ones +X scales Mobile is covered with scales +Y tusks Mobile has some teeth elongated into tusks + + +size +The size of the mobile has many game effects, and should be chosen +carefully. +The acceptable sizes are as follows: +tiny: small birds and anything smaller +small: large birds (ducks and up) to halflings +medium: elves and dwarves to humans +large: ogres, gnolls, and other large humanoids +huge: giants, small dragons, and wyverns +giant: for VERY large critters, i.e. dragons, titans, and the biggest +giants + +material +The material type for mobiles is not currently supported. It should be +left blank (0) for flesh-and-blood creatures, or spirits, but golems and +other animated beings should have a material appropriate to their body +construction (i.e. stone, iron, diamond). Put the material in single +quotes if it is longer than one word. + +Appendix A: Recommended Values +The following values should be followed closely for all mobiles -- try +not to go more than 1 level away from the recommended values unless you are absolutely sure you want your mobile to be harder or easier than a +default monster. In particular, avoid making them easier. Certain action flags (namely the 4 class-related flags) can modify the recommendations, they are explained in detail at the end of this section. + +level hit pts ac damage level hit pts ac damage + 1 2d6+10 9 1d4+0 31 6d12+928 -10 4d6+9 + 2 2d7+21 8 1d5+0 32 10d10+1000 -10 6d4+9 + 3 2d6+35 7 1d6+0 33 10d10+1100 -11 6d4+10 + 4 2d7+46 6 1d5+1 34 10d10+1200 -11 4d7+10 + 5 2d6+60 5 1d6+1 35 10d10+1300 -11 4d7+11 + + 6 2d7+71 4 1d7+1 36 10d10+1400 -12 3d10+11 + 7 2d6+85 4 1d8+1 37 10d10+1500 -12 3d10+12 + 8 2d7+96 3 1d7+2 38 10d10+1600 -13 5d6+12 + 9 2d6+110 2 1d8+2 39 15d10+1700 -13 5d6+13 + 10 2d7+121 1 2d4+2 40 15d10+1850 -13 4d8+13 + + 11 2d8+134 1 1d10+2 41 25d10+2000 -14 4d8+14 + 12 2d10+150 0 1d10+3 42 25d10+2250 -14 3d12+14 + 13 2d10+170 -1 2d5+3 43 25d10+2500 -15 3d12+15 + 14 2d10+190 -1 1d12+3 44 25d10+2750 -15 8d4+15 + 15 3d9+208 -2 2d6+3 45 25d10+3000 -15 8d4+16 + + 16 3d9+233 -2 2d6+4 46 25d10+3250 -16 6d6+16 + 17 3d9+258 -3 3d4+4 47 25d10+3500 -17 6d6+17 + 18 3d9+283 -3 2d7+4 48 25d10+3750 -18 6d6+18 + 19 3d9+308 -4 2d7+5 49 50d10+4000 -19 4d10+18 + 20 3d9+333 -4 2d8+5 50 50d10+4500 -20 5d8+19 + + 21 4d10+360 -5 4d4+5 51 50d10+5000 -21 5d8+20 + 22 5d10+400 -5 4d4+6 52 50d10+5500 -22 6d7+20 + 23 5d10+450 -6 3d6+6 53 50d10+6000 -23 6d7+21 + 24 5d10+500 -6 2d10+6 54 50d10+6500 -24 7d6+22 + 25 5d10+550 -7 2d10+7 55 50d10+7000 -25 10d4+23 + + 26 5d10+600 -7 3d7+7 56 50d10+7500 -26 10d4+24 + 27 5d10+650 -8 5d4+7 57 50d10+8000 -27 6d8+24 + 28 6d12+703 -8 2d12+8 58 50d10+8500 -28 5d10+25 + 29 6d12+778 -9 2d12+8 59 50d10+9000 -29 8d6+26 + 30 6d12+853 -9 4d6+8 60 50d10+9500 -30 8d6+28 + +Thief* mobiles should read their hp, ac, and damage at one level lower +Mage mobiles read hp and ac at one level lower, and damage three levels +lower +Cleric mobiles read damage at two levels lower +Warrior mobiles read hit points one level higher +Armor class vs. magical attacks should be computed by this formula: +(ac - 10) / n + 10, where n is 4 for most mobiles, 3 for thieves and +clerics, and 2 for mages. Remember, +hit should only be given to very exceptional mobiles. -* a thief mobile either has ACT_THIEF set or is decidedly thief-like in -nature. The same holds true for the other modifiers. +* a thief mobile either has ACT_THIEF set or is decidedly thief-like in +nature. The same holds true for the other modifiers. + +Appendix B: Removing Flags +There are times when a mobile will clearly belong to a certain race, but +for whatever reason you will not it to have certain flags belonging to +that race. For examples, dragons may normally be resistant to fire, but you may wish to make a white dragon that is vulnerable to fire and immune to cold. To remove flags from the mobile, add flag removal commands at the end of the entry (below the form/parts/size/material line). -Appendix B: Removing Flags -There are times when a mobile will clearly belong to a certain race, but -for whatever reason you will not it to have certain flags belonging to -that race. For examples, dragons may normally be resistant to fire, but you may wish to make a white dragon that is vulnerable to fire and immune to cold. To remove flags from the mobile, add flag removal commands at the end of the entry (below the form/parts/size/material line). +The base syntax is: +F -The base syntax is: -F +Flag type may be either action, affect, offensive, immunity, resistance, +vulnerability, form, or parts ( usually just written as act, aff, off, +imm, res, vul, for, and par). -Flag type may be either action, affect, offensive, immunity, resistance, -vulnerability, form, or parts ( usually just written as act, aff, off, -imm, res, vul, for, and par). +For example, to make a dragon that is not vulnerable to cold or +resistant to fire, use: -For example, to make a dragon that is not vulnerable to cold or -resistant to fire, use: +F res H +F vul I -F res H -F vul I +More than one flag can be removed on the same line, as long as they are +all part of the same flag group. So to remove fast and dodge from a wolf, you would type: -More than one flag can be removed on the same line, as long as they are -all part of the same flag group. So to remove fast and dodge from a wolf, you would type: +F off FH -F off FH - -Don't be afraid to move flags if you have to, and absolutely do NOT -define a new race just because a few of the default flags don't agree with you. +Don't be afraid to move flags if you have to, and absolutely do NOT +define a new race just because a few of the default flags don't agree with you. 4. #OBJECTS -I. # -II. ~ -III. ~ -IV. ~ -V. ~ +I. # +II. ~ +III. ~ +IV. ~ +V. ~ VI. VII. -VIII. +VIII. **IX **XI. **XII. ~ @@ -953,20 +953,20 @@ VIII. Breakdown: -I. The vnum is the number used to reference your object. There may +I. The vnum is the number used to reference your object. There may only be one object of any given vnum at one time. (see glossary) -II. This is a list of names by which the object may be referenced. Do +II. This is a list of names by which the object may be referenced. Do not forget to put a tilde at the end of it. -III. This is the short description of the object. It is seen when the -object is used, picked up or worn. Example: a short sword named +III. This is the short description of the object. It is seen when the +object is used, picked up or worn. Example: a short sword named 'Nightbringer', THE Long Sword, a scale mail coif, etc. Do not forget to put a tilde at the end. -IV. This is the description seen when the object is on the ground. +IV. This is the description seen when the object is on the ground. Example: A short sword lies here on the ground.~ Do not forget to put a tilde at the end. -V. This is the substance of which the object is composed. Ie: a sword +V. This is the substance of which the object is composed. Ie: a sword might have material steel~, or a cloak have material wool~. If you must define a new material type in your area, go ahead, but please make a note of this to the person you are submitting the area to. A listing of material types that are already defined follows: plastic slime jelly wax rubber @@ -986,13 +986,13 @@ flint lodestone granite enamel obsidian adamantite glass pottery crystal ice bone shell coral energy fire air water acid coal sandstone -clay ash earth diamond etherealness +clay ash earth diamond etherealness nothingness -dragonscale, blue dragonscale, black dragonscale, white dragonscale, red +dragonscale, blue dragonscale, black dragonscale, white dragonscale, red dragonscale. -Although you would normally have to place multiple words in single +Although you would normally have to place multiple words in single quotes, in this instance, do NOT. Do not forget to end the material type with a tilde. VII. Type, Extras, Wear @@ -1028,8 +1028,8 @@ trash * indicates that the item has special values, examples of which will be given at the end of this section. -Many of the item types have no practical purpose aside from to -control what shops they may be sold at. A jeweler might buy only jewelry, and not gems or treasure, for example. +Many of the item types have no practical purpose aside from to +control what shops they may be sold at. A jeweler might buy only jewelry, and not gems or treasure, for example. V0 through V4 @@ -1070,7 +1070,7 @@ v3 is the damage message (cleave) and v4 holds the weapon flags (E is vorpal, F A flaming D sharp G shocking (electrical) B frost E vorpal H poisoned - C vampiric F two-handed + C vampiric F two-handed (energy drain) Armor: @@ -1090,7 +1090,7 @@ by the code, but please enter it so that when it is implemented, your file will be current. A listing of example bulks follows: clothing 0 buckler 0 -hard leather 1 small shield 1 +hard leather 1 small shield 1 scale/chainmail 2 medium shield 2 platemail 3 kite shield 3 light plate armor 4 tower shield 4 @@ -1160,44 +1160,44 @@ two settings: 0 for normal and A for poisoned. V4 is unused. A listing of acceptable liquid types follows: - Name Color Proof Hunger Thirst - - water clear 0, 1, 10, - beer amber 12, 1, 8, - red wine burgundy 30, 1, 8, - ale brown 15, 1, 8, - dark ale dark 16, 1, 8, - whisky golden 120, 1, 5, - lemonade pink 0, 1, 9, - firebreather boiling 190, 0, 4, - local specialty clear 151, 1, 3, - slime mold juice green 0, 2, -8, - milk white 0, 2, 9, - tea tan 0, 1, 8, - coffee black 0, 1, 8, - blood red 0, 2, -1, - salt water clear 0, 1, -2, - coke brown 0, 2, 9, - root beer brown 0, 2, 9, - elvish wine green 35, 2, 8, - white wine golden 28, 1, 8, - champagne golden 32, 1, 8, - mead honey-colored 34, 2, 8, - rose wine pink 26, 1, 8, - benedictine wine burgundy 40, 1, 8, - vodka clear 130, 1, 5, - cranberry juice red 0, 1, 9, - orange juice orange 0, 2, 9, - absinthe green 200, 1, 4, - brandy golden 80, 1, 5, - aquavit clear 140, 1, 5, - schnapps clear 90, 1, 5, - icewine purple 50, 2, 6, - amontillado burgundy 35, 2, 8, - sherry red 38, 2, 7, - framboise red 50, 1, 7, - rum amber 151, 1, 4, - cordial clear 100, 1, 5, + Name Color Proof Hunger Thirst + + water clear 0, 1, 10, + beer amber 12, 1, 8, + red wine burgundy 30, 1, 8, + ale brown 15, 1, 8, + dark ale dark 16, 1, 8, + whisky golden 120, 1, 5, + lemonade pink 0, 1, 9, + firebreather boiling 190, 0, 4, + local specialty clear 151, 1, 3, + slime mold juice green 0, 2, -8, + milk white 0, 2, 9, + tea tan 0, 1, 8, + coffee black 0, 1, 8, + blood red 0, 2, -1, + salt water clear 0, 1, -2, + coke brown 0, 2, 9, + root beer brown 0, 2, 9, + elvish wine green 35, 2, 8, + white wine golden 28, 1, 8, + champagne golden 32, 1, 8, + mead honey-colored 34, 2, 8, + rose wine pink 26, 1, 8, + benedictine wine burgundy 40, 1, 8, + vodka clear 130, 1, 5, + cranberry juice red 0, 1, 9, + orange juice orange 0, 2, 9, + absinthe green 200, 1, 4, + brandy golden 80, 1, 5, + aquavit clear 140, 1, 5, + schnapps clear 90, 1, 5, + icewine purple 50, 2, 6, + amontillado burgundy 35, 2, 8, + sherry red 38, 2, 7, + framboise red 50, 1, 7, + rum amber 151, 1, 4, + cordial clear 100, 1, 5, Fountains: @@ -1325,7 +1325,7 @@ a black hole~ A swirling black hole spins in the centre of the room.~ energy~ portal 0 0 -0 +0 0 0 0 P V0 is the number of charges the portal has (for limited use portals) -- @@ -1350,8 +1350,8 @@ furniture 0 0 2 200 BEHKN 100 100 0 0 0 P -V0 is the number of people that can fit onto the piece of furniture -(in the case of the couch, 2 people). V1 is the total weight the +V0 is the number of people that can fit onto the piece of furniture +(in the case of the couch, 2 people). V1 is the total weight the piece of furniture can support (200 pounds here, meaning while in theory 2 people can sit on the couch, the people sitting on it can't weigh more than a total of 200 pounds). V2 is furniture flags, which @@ -1384,7 +1384,7 @@ P Put inside Extra flags -Extra flags are visual effects and other controls on how the object may +Extra flags are visual effects and other controls on how the object may be used. A listing of extra flags follows: (Glowing) A (Humming) B @@ -1392,92 +1392,92 @@ Dark (hidden) C Evil E Invis F Magic G Nodrop H Bless I Anti-good J Anti-evil K -Anti-Neutral L Noremove M -Inventory N Nopurge O +Anti-Neutral L Noremove M +Inventory N Nopurge O Rot_death P Vis_death Q -Nosac R Nolocate T +Nosac R Nolocate T Melt_drop U Sell extract W Burn proof Y -Items with applies or other magical effects should be flagged magic. Anti-good/evil/neutral prevents the item from being worn by persons of those aligns -- you may mix and match two of three, but do NOT flag an item as unwearable by all three aligns, it will cause problems for the mud. Inventory should usually be present on items given to a shopkeeper, and NEVER on any other object. It ensures that the item never runs out in a shop. A shop item not flagged inventory will only be able to be sold once. Nopurge means that the 'purge' command cannot affect this item unless it is directly purged -- stationary objects like furniture should be flagged this. Rot death places a short timer on the object when the mobile carrying it dies and it disintegrates when the timer is up. Vis death means that the item is undetectable until after the mobile carrying it is dead. Nosac means the item cannot be sacrificed. Nolocate prevents locate object from finding the object. Melt drop means that the item dissolves when dropped (used for sub issue eq to prevent clutter). Sell extract ensures that the item will be purchased at the full value it was sold at (this should ONLY be used for gem stores where people may convert gold, which is very heavy, into more +Items with applies or other magical effects should be flagged magic. Anti-good/evil/neutral prevents the item from being worn by persons of those aligns -- you may mix and match two of three, but do NOT flag an item as unwearable by all three aligns, it will cause problems for the mud. Inventory should usually be present on items given to a shopkeeper, and NEVER on any other object. It ensures that the item never runs out in a shop. A shop item not flagged inventory will only be able to be sold once. Nopurge means that the 'purge' command cannot affect this item unless it is directly purged -- stationary objects like furniture should be flagged this. Rot death places a short timer on the object when the mobile carrying it dies and it disintegrates when the timer is up. Vis death means that the item is undetectable until after the mobile carrying it is dead. Nosac means the item cannot be sacrificed. Nolocate prevents locate object from finding the object. Melt drop means that the item dissolves when dropped (used for sub issue eq to prevent clutter). Sell extract ensures that the item will be purchased at the full value it was sold at (this should ONLY be used for gem stores where people may convert gold, which is very heavy, into more valuable and light gemstones). Burn proof makes the item invulnerable to damage by fire or acid. Wear flags -Wear flags determine where an object may be worn. Note that if you want +Wear flags determine where an object may be worn. Note that if you want the item to be able to be picked up it should be flagged Take, AS WELL AS having a wear location flagged if the object should be worn. Leaving off a take flag but flagging it wearable will make it impossible to pick up the object should it be dropped. So to make a ring that can be picked up and worn on finger it should be flagged AB. Note that items can not have multiple wear locations (take does not count as a wear location, it only determines if the item can be picked up). -A Take H Hands O Hold -B Finger I Arms Q Float -C Neck J Shield -D Body K About body -E Head L Waist -F Legs M Wrist -G Feet N Wield +A Take H Hands O Hold +B Finger I Arms Q Float +C Neck J Shield +D Body K About body +E Head L Waist +F Legs M Wrist +G Feet N Wield IX. Level, Weight, Cost -Level determines how high of level a character must be to use an item. +Level determines how high of level a character must be to use an item. Higher level items should be more powerful, and lower level correspondingly less powerful. -Weight determines how heavy an object is, which factors into how much a -character may carry. It is entered into the area file as tenths of +Weight determines how heavy an object is, which factors into how much a +character may carry. It is entered into the area file as tenths of pounds, so a three pound dagger would have an entry of 30. -Cost determines how much an item may be sold to a shop for (although +Cost determines how much an item may be sold to a shop for (although shops virtually always buy for less than they will sell at) or how much a shop will charge for it. When in doubt on an item sold in a shop, overprice it; when in doubt on an item that can be found in an area, underprice it. The fourth slot on objects is timer, which is not implemented, and should be set to P. So far as I'm aware, setting it to anything other than P can cause the area to not boot. XI. Applies -apply +apply -Location is the type of affect being placed on the item. Modifier is a -positive or negative number that will increase or decrease the location +Location is the type of affect being placed on the item. Modifier is a +positive or negative number that will increase or decrease the location in question. A listing of locations follows: -1 Strength 12 Mana -2 Dexterity 13 Hitpoints -3 Intelligence 14 Movement -4 Wisdom 17 AC -5 Constitution 18 Hitroll -6 Sex 19 Damroll +1 Strength 12 Mana +2 Dexterity 13 Hitpoints +3 Intelligence 14 Movement +4 Wisdom 17 AC +5 Constitution 18 Hitroll +6 Sex 19 Damroll 7 Charisma 20 Spell (includes rods, staves, etc.) -example -apply 1 1 -apply 13 4 +example +apply 1 1 +apply 13 4 The above would be the pink ice ring's affects. -XII. Flags +XII. Flags -flag +flag -Flags let you put what are usually perm aff bits as well as -immune/resist and vulnerability bits when wearing an item. Note that you may also specify a location here (or 0 if none) so that spells with two effects can be done (like a ring of haste would have a dex modifier in addition to the bit). -A +Flags let you put what are usually perm aff bits as well as +immune/resist and vulnerability bits when wearing an item. Note that you may also specify a location here (or 0 if none) so that spells with two effects can be done (like a ring of haste would have a dex modifier in addition to the bit). +A listing of affects follows: -affect bits: - *A Blind *I Faerie_fire Q Hide *Y Weaken +affect bits: + *A Blind *I Faerie_fire Q Hide *Y Weaken B Invisible J Infrared *R Sleep Z Dark_vis - C Detect_evil K Curse *S Charm *a Berserk - D Detect_invis **L Flaming T Flying **b Swim - E Detect_magic *M Poisoned U Pass_door c Regen. - F Detect_hidden N Prot_evil V Haste d Slow - G Detect_good O Prot_good *W Calm - H Sanctuary P Sneak *X Plague - * items will be detrimental to the character, possibly for cursed + C Detect_evil K Curse *S Charm *a Berserk + D Detect_invis **L Flaming T Flying **b Swim + E Detect_magic *M Poisoned U Pass_door c Regen. + F Detect_hidden N Prot_evil V Haste d Slow + G Detect_good O Prot_good *W Calm + H Sanctuary P Sneak *X Plague + * items will be detrimental to the character, possibly for cursed items. ** not yet implemented -examples: -flag affect 2 3 V dex+3 and AFF_HASTE -flag affect 0 0 CDEFG a true sight item -flag immune 0 0 CD immune to weapons and magic! :) +examples: +flag affect 2 3 V dex+3 and AFF_HASTE +flag affect 0 0 CDEFG a true sight item +flag immune 0 0 CD immune to weapons and magic! :) -For obvious reasons, be VERY careful in creating permanent affected +For obvious reasons, be VERY careful in creating permanent affected items. A permanent sanctuary item, for instance, would be of questionable balance and will likely be stripped from your area unless you have some extreme justification for it. See the #MOBILES section for a listing of imm/resist/vul flags. @@ -1489,9 +1489,9 @@ extra description~ Yep, this is an extra desc alright. ~ -extra signifies the start of an extra description. 'extra description' -are the keywords that 'examine' will accept. Typing 'examine extra' or -'examine description' would yield the output of 'Yep, this is an extra desc alright.' +extra signifies the start of an extra description. 'extra description' +are the keywords that 'examine' will accept. Typing 'examine extra' or +'examine description' would yield the output of 'Yep, this is an extra desc alright.' For further examples, see the section dealing with extra descs in #ROOMS. @@ -1516,28 +1516,28 @@ VIII. } *XI. XII. -* denotes optional, not necessary for the room to function. +* denotes optional, not necessary for the room to function. -Sections that are enclosed in braces must be kept together, and placed +Sections that are enclosed in braces must be kept together, and placed in the order that the above example shows. Example: if there are doors north, south and west, all of three sets of door data must go before the extended description related information. Example: #1000 The Lego temple~ -You stand in a tiny, red temple; built entirely from Lego bricks. It is, +You stand in a tiny, red temple; built entirely from Lego bricks. It is, sadly, not a very interesting place, and perhaps you should leave through the portal which leads south to a sunny garden. ~ 0 BC 0 D2 -You see the grand portal of the Lego church. Beyond is an inviting +You see the grand portal of the Lego church. Beyond is an inviting garden. ~ portal grand~ 1 1001 1007 extra portal~ -The portal is high and arched, built out of lego bricks of the finest +The portal is high and arched, built out of lego bricks of the finest quality. ~ extra @@ -1550,18 +1550,18 @@ S -I. The vnum is the number used to reference your room. There may only +I. The vnum is the number used to reference your room. There may only be one room of any given vnum at one time. (see glossary) -II. This is the label of the room, and should be short. Characters +II. This is the label of the room, and should be short. Characters with 'brief' mode on will only see this section of the room. Do not forget to end it with a tilde. -III. This is the room description. It should be a minimum of three +III. This is the room description. It should be a minimum of three lines, preferably at least four or five, but not more than eight to ten. (if you want more information than that, do it in extra descriptions) Do not forget to end it with a tilde. IV. Room flags, sector types -The first slot of line IV is a hangover from old file format, retained +The first slot of line IV is a hangover from old file format, retained for compatibility. The second slot is room flags. A listing of room flags follows: @@ -1573,10 +1573,10 @@ PRIVATE (J) Room is limited to two characters (i.e. chat rooms) SAFE (K) Safe from pkilling and aggressive mobs SOLITARY (L) One character only can enter this room PET_SHOP (M) see addendum about pet shops -NO_RECALL (N) players cannot use the 'recall' command to leave +NO_RECALL (N) players cannot use the 'recall' command to leave this room -Pet shops: the room that the pets are to be sold in must be flagged +Pet shops: the room that the pets are to be sold in must be flagged act_pet. However, the pets themselves must be loaded into the sequentially next room (ie if the shop is 1036, the pets MUST be loaded into 1037 for the shop to work). The third slot is sector type. A listing of sector types follows: @@ -1584,7 +1584,7 @@ The third slot is sector type. A listing of sector types follows: Sector types: type number move pts notes -INSIDE 0 1 +INSIDE 0 1 CITY 1 2 FIELD 2 2 FOREST 3 3 @@ -1597,18 +1597,18 @@ DESERT 10 9 will eventually affect thirst and recovery V. Exit directions -Exit directions are signified by a line with D# on it, with # replaced +Exit directions are signified by a line with D# on it, with # replaced by 0 for north, 1 for east, 2 for south, 3 for west, 4 for up and 5 for down. An exit line containing D2 signifies an exit south. VI. Exit descriptions -This section determines what will be seen if a character looks in the +This section determines what will be seen if a character looks in the direction the exit designates. Ie: You see a river south. -Would be what would be seen if a character typed 'look south' and the -above was the exit description. Do not forget to put a tilde on the line *after*. +Would be what would be seen if a character typed 'look south' and the +above was the exit description. Do not forget to put a tilde on the line *after*. Ie: You see a river south. @@ -1616,8 +1616,8 @@ You see a river south. VII. Door keyphrase -If the exit you are working on is to be a door, you may define a -keyphrase that the character may access to open the door and will see when he opens it. +If the exit you are working on is to be a door, you may define a +keyphrase that the character may access to open the door and will see when he opens it. Ie: D5 @@ -1625,29 +1625,29 @@ You see a dusty trap door. ~ trap door~ -as the keyphrase will allow the character to type 'open trap' or 'open -door' or 'open down' to open the entryway, and when they do, they will see the message: +as the keyphrase will allow the character to type 'open trap' or 'open +door' or 'open down' to open the entryway, and when they do, they will see the message: 'You open the trap door.' VIII. Door state, Connecting room vnum, Key vnum -Slot one sets the door as open, closed, locked, etc. 0 denotes an open +Slot one sets the door as open, closed, locked, etc. 0 denotes an open door, 1 denotes closed, and 2 denotes closed and locked. Slot two denotes the vnum of the room that this exit links to. -Slot three denotes the vnum of the key used to unlock the door, if the +Slot three denotes the vnum of the key used to unlock the door, if the door is lockable and if you choose to have a key that allows it to be unlocked. IX. extra, extra keywords, and extra description text - -E denotes the beginning of an extra description. Extras are used to flesh out room descriptions by giving keywords that may be looked at or -examined to give more information. Also, to have multiple sets of + +E denotes the beginning of an extra description. Extras are used to flesh out room descriptions by giving keywords that may be looked at or +examined to give more information. Also, to have multiple sets of extras, you must input all of the data under independent extra lines. Example: in the following room description: -You stand under a trellis on which climb beautiful roses. A lovely +You stand under a trellis on which climb beautiful roses. A lovely flower garden extends to the north and west of here, and a path leads to a small white summerhouse to the south. with the extended descriptions @@ -1661,7 +1661,7 @@ trellis~ It is made of wicker and painted white. ~ -would yield the following result when 'exa beautiful', 'exa roses', +would yield the following result when 'exa beautiful', 'exa roses', 'look beautiful' or 'look roses' was typed: They smell sweet and are delicately soft to the touch. @@ -1674,14 +1674,14 @@ Do not forget to put a tilde after the keywords or the text. X. Mana recovery adjustments, Healing recovery adjustments -The default recovery rate is 100% (normal). However, you may adjust +The default recovery rate is 100% (normal). However, you may adjust recovery of mana or hit points up or down to 1% of normal or 200% of normal. To adjust mana, the syntax is M (ie: M 90 to decrease mana to 90% of normal recovery rate) or H to adjust hit point recovery (ie: H 110 to increase healing by 10%). Example: M 75 H 125 -Note! Increasing healing or mana recovery is a room option that should +Note! Increasing healing or mana recovery is a room option that should be used very sparingly. Decrease of healing/mana recovery may be used more frequently. XI. If your mud has clans, you may wish to have clan halls that are restricted from access by anyone who is not a member of that clan. @@ -1695,48 +1695,48 @@ XII. S S signifies the end of the room. All rooms MUST be ended with S. 6. #RESETS - -This is the section that installs all the mobiles in their various -locations,equips the mobiles, locks and closes any necessary doors, randomizes any random room exits, and generally sets up the area and populates it. - -To reset an area, the server executes each command in the list of reset -commands once. Each area is reset once when the server loads, and again + +This is the section that installs all the mobiles in their various +locations,equips the mobiles, locks and closes any necessary doors, randomizes any random room exits, and generally sets up the area and populates it. + +To reset an area, the server executes each command in the list of reset +commands once. Each area is reset once when the server loads, and again periodically as it ages. An area is reset if it is at least 3 area- -minutes old and is empty of players, or if it is 15 area-minutes old and has players in it. - -An 'area-minute' varies between 30 and 90 seconds of real time, with an -average of 60 seconds. The variation defeats area time-keepers. - -The #RESETS section contains a series of single lines. - -The reset commands are: - -I. M load a mobile into a room +minutes old and is empty of players, or if it is 15 area-minutes old and has players in it. + +An 'area-minute' varies between 30 and 90 seconds of real time, with an +average of 60 seconds. The variation defeats area time-keepers. + +The #RESETS section contains a series of single lines. + +The reset commands are: + +I. M load a mobile into a room II. O load an object into a room -III. P put an object in an object (gold in a safe, etc.) -IV. G give an object to mobile -V. E equip an object to mobile -VI. D set state of door -VII. S stop (END OF LIST) +III. P put an object in an object (gold in a safe, etc.) +IV. G give an object to mobile +V. E equip an object to mobile +VI. D set state of door +VII. S stop (END OF LIST) -Note! You may put a comment after an asterisk (*) on any line, but NOT +Note! You may put a comment after an asterisk (*) on any line, but NOT on a line that is blank otherwise. Breakdown: - + I. Loading a mobile into a room M 0 -M signifies that a mobile is being loaded. 0 is a placeholder for a no +M signifies that a mobile is being loaded. 0 is a placeholder for a no longer used field. The third slot is the vnum of the mobile to be loaded; the fourth slot is the number of the room that the mobile is being loaded into; the fifth slot is the total number of copies of that mobile that may exist in the game world; the sixth is the number of copies of that mobile that may exist in that room. Example: M 0 1000 1000 6 1 -Will reset mobile 1000 into room 1000 once, but allow you to place five +Will reset mobile 1000 into room 1000 once, but allow you to place five other copies of that mobile in other rooms. -Note that if you wish to have multiple copies of the same mobile you +Note that if you wish to have multiple copies of the same mobile you must enter multiple resets for them. Example: M 0 1000 1000 6 2 @@ -1752,18 +1752,18 @@ O 0 0 Breakdown: -O denotes that an object is being loaded. 0 in both instances is a -placeholder for a defunct reset slot. The third slot is the object vnum -and the fifth slot is the room it is being reset into. Ergo, the above +O denotes that an object is being loaded. 0 in both instances is a +placeholder for a defunct reset slot. The third slot is the object vnum +and the fifth slot is the room it is being reset into. Ergo, the above example will reset object 1000 into room 1000. - + That loads (O)bject ZX01 once into room ZX02. Again, 0 denotes unused. III. Putting an object into another object: P 0 1001 0 1000 3 -P denotes that this reset is putting an object into another object. +P denotes that this reset is putting an object into another object. Both 0 entries denote placeholders for defunct slots. The third slot is the vnum of the object that is being contained, the fifth slot denotes the vnum of the container. The sixth slot denotes the number of copies of the object that will be loaded into the container. The above example will put 3 copies of object 1001 into container 1000. Note! If you wish to have, for example, five mobiles carrying containers called 'backpacks' with 'bread' 'cheese' and 'water jug' items in them, and have an abandoned backpack with the same gear as would be in the carried backpacks, you are best off making a total of six *individual* 'backpack' containers and resetting the *same* 'bread', 'cheese' and 'water' items. @@ -1778,26 +1778,26 @@ IV. Giving an object to a mobile G 0 1006 0 -G denotes that a give reset to a mobile is being done. This reset +G denotes that a give reset to a mobile is being done. This reset places the object being given into the inventory of the mobile. 0 denotes, as before, a placeholder for a defunct option. The third slot in the reset is the vnum of the object being given. -Note! The give reset MUST be placed, in the reset ordering, DIRECTLY +Note! The give reset MUST be placed, in the reset ordering, DIRECTLY after the loading of the mobile that the object is being given to. Example: -M 0 1000 1000 6 2 -G 0 1006 0 V. Equipping an object to a mobile E 0 1007 0 3 -E denotes that an equip reset is being done. 0 denotes unused slots. +E denotes that an equip reset is being done. 0 denotes unused slots. The third slot indicates the vnum of the object being equipped. The fifth slot is the number of the wear location that is being equipped to (in this instance, 3, which is ). -Wear flags are as follows: - +Wear flags are as follows: + Left finger 1 Right finger 2 Neck (1) 3 Neck (2) 4 On Torso 5 Head 6 @@ -1812,7 +1812,7 @@ VI. Door resets D 0 1000 1 BC -D denotes that a door reset is being generated. 0 denotes a placeholder +D denotes that a door reset is being generated. 0 denotes a placeholder for an unused slot. The third slot is the vnum of the room that the door reset is being generated in. The fourth slot is the direction of the door reset is being generated in (since any room may have up to six doors) and the fifth is the condition that the door is being placed in. The above example shows the eastern door of room 1000 being set in a closed and locked position. The following list shows the correlating numbers for the door directions: 0 North 1 East 2 South @@ -1825,7 +1825,7 @@ A -- door that may be opened and closed, but no lock and resets to open B -- door resets to closed C -- door that is locked F -- door with a lock that cannot be picked (key needed to open) -G -- door that the 'pass door' spell will not allow passage through (the +G -- door that the 'pass door' spell will not allow passage through (the lock may still be picked, however) H -- lock that is easy to pick * I -- lock that is hard to pick * @@ -1833,10 +1833,10 @@ J -- lock that is infuriating to pick * K -- door that cannot be closed L -- door that cannot be locked -* not yet implemented, but use them in conjunction with C (door resets +* not yet implemented, but use them in conjunction with C (door resets to locked) for when the code is enabled. -So for a closed, locked door that can't be passed through but which is +So for a closed, locked door that can't be passed through but which is easy to pick, the flags are BCGH. Note! If you have a door going north from room 1001 to room 1002, you must also have a door going south from room 1002 to room 1001, unless you wish the door in 1001 to be ONE WAY ONLY. @@ -1847,16 +1847,16 @@ S S denotes the end of the #RESETS section. -Remember, for all LIMIT-NUMBERS, a '-1' means an infinite number of the -objects, mobiles, etc. can exist in the world, and the game will keep -loading up these objects/mobiles. Keep this in mind, if you are thinking of using a '-1' for a limit-number. - -It's a good idea to comment your resets thoroughly for debugging +Remember, for all LIMIT-NUMBERS, a '-1' means an infinite number of the +objects, mobiles, etc. can exist in the world, and the game will keep +loading up these objects/mobiles. Keep this in mind, if you are thinking of using a '-1' for a limit-number. + +It's a good idea to comment your resets thoroughly for debugging purposes. - + 7. #SHOPS - + 0 Example: @@ -1864,10 +1864,10 @@ Example: 3000 2 3 4 10 0 105 15 0 23 * the wizard All of these options are on the same line. 0 ends the section. - -The first value, the mobile-vnum, is the 'keeper', or the mobile who is -the shopkeeper. ALL MOBILES with that vnum will be shopkeepers. - + +The first value, the mobile-vnum, is the 'keeper', or the mobile who is +the shopkeeper. ALL MOBILES with that vnum will be shopkeepers. + The section designates what the keeper will buy. He may buy up to five types of items, and zeroes must be placed in the shop entry for anything less than five. (The wizard above buys scrolls, wands, staves and potions, and a zero is placed in the last option since he only buys four types of things. If all the slots were set to zero, he wouldn't buy anything, but he would still sell what he was loaded as having.) The following is a list of acceptable object numbers and their corresponding types: @@ -1891,24 +1891,24 @@ The following is a list of acceptable object numbers and their corresponding typ 30 Warpstone 32 Gem 33 Jewelry - + (Any item type not listed in the above is not listed either because it is not appropriate to have a shopkeeper that would buy that type of item, or because that type of item can't be sold (like money :).) -The 'profit-buy' number is a markup for players buying the item, in -percentage points. 100 is nominal price; 150 is 50% markup, and so on. The 'profit-sell' number is a markdown for players selling the item, in percentage points. 100 is nominal price, 75 is 25% markdown, and so on. The buying markup should be at least 100, generally greater, and the selling markdown should be no more than 100, generally lower. - -The 'open-hour' and 'close-hour' numbers define the hours when the -shopkeeper will do business. For a 24-hour shop, these numbers would be 0 and 23. - -Everything beyond 'close-hour' to the end of the line is taken to be a -comment. - -Note that there is no room number for a shop. Just load the shopkeeper -mobile in to the room of your choice, via that #RESETS section, and make the mobile a sentinel in the ACT-FLAGS section of the mobile in #MOBILES. Or, for a wandering shopkeeper, just make it non-sentinel. - -The objects the shopkeeper sells are exactly those loaded by the 'G' -reset command in #RESETS for that shopkeeper. These items replenish -automatically. If a player sells an object to a shopkeeper, the shopkeeper will keep it for resale if he, she, or it doesn't already have an identical object. The items a player sells to a shopkeeper, however, do not replenish. +The 'profit-buy' number is a markup for players buying the item, in +percentage points. 100 is nominal price; 150 is 50% markup, and so on. The 'profit-sell' number is a markdown for players selling the item, in percentage points. 100 is nominal price, 75 is 25% markdown, and so on. The buying markup should be at least 100, generally greater, and the selling markdown should be no more than 100, generally lower. + +The 'open-hour' and 'close-hour' numbers define the hours when the +shopkeeper will do business. For a 24-hour shop, these numbers would be 0 and 23. + +Everything beyond 'close-hour' to the end of the line is taken to be a +comment. + +Note that there is no room number for a shop. Just load the shopkeeper +mobile in to the room of your choice, via that #RESETS section, and make the mobile a sentinel in the ACT-FLAGS section of the mobile in #MOBILES. Or, for a wandering shopkeeper, just make it non-sentinel. + +The objects the shopkeeper sells are exactly those loaded by the 'G' +reset command in #RESETS for that shopkeeper. These items replenish +automatically. If a player sells an object to a shopkeeper, the shopkeeper will keep it for resale if he, she, or it doesn't already have an identical object. The items a player sells to a shopkeeper, however, do not replenish. Shopkeepers should generally be flagged as NO_PURGE. @@ -1919,46 +1919,46 @@ M example M 1000 breath_gas -Special procedures are not assigned in the mobile structure itself, but -they do relate directly to mobiles. The procedure for assigning procedures will be detailed in another document, but the basic function is covered here. - -A special procedure gives a mobile some added functionality, allowing it -do more complicated actions than are normally possible. Examples are -Hassan's guardian duties, the fido's ability to eat corpses, and the warring mobiles in the dangerous neighborhood. New specials can be requested, but don't rely on someone else being willing to code one for you. At this time, no mobile may have more than one special procedure. - -The following specials are available: - -breath_acid Mobile breathes acid in combat -breath_fire Mobile breathes fire in combat (area attack) -breath_frost Mobile breathes frost in combat (area attack) -breath_gas Mobile breathes poison gas in combat area attack) -breath_lightning Mobile breathes lightning in combat -breath_any Mobile may use any breath weapon -cast_adept Mobile casts helpful spells on low-level players -cast_cleric Mobile casts clerical spells (ALWAYS cleric act flag) -cast_judge Mobile fires bullets (for Mega-City One only) -cast_mage Mobile casts mage spells (ALWAYS set the mage act flag) -cast_undead Mobile casts spells appropriate for the undead -executioner Mobile attacks Killers and Thieves -fido Mobile devours corpses -guard Mobile protects good-aligned people from attack -janitor Mobile cleans up junk lying on the ground -poison Mobile has a poison attack -thief Mobile steals gold (ALWAYS set the thief act flag) +Special procedures are not assigned in the mobile structure itself, but +they do relate directly to mobiles. The procedure for assigning procedures will be detailed in another document, but the basic function is covered here. + +A special procedure gives a mobile some added functionality, allowing it +do more complicated actions than are normally possible. Examples are +Hassan's guardian duties, the fido's ability to eat corpses, and the warring mobiles in the dangerous neighborhood. New specials can be requested, but don't rely on someone else being willing to code one for you. At this time, no mobile may have more than one special procedure. + +The following specials are available: + +breath_acid Mobile breathes acid in combat +breath_fire Mobile breathes fire in combat (area attack) +breath_frost Mobile breathes frost in combat (area attack) +breath_gas Mobile breathes poison gas in combat area attack) +breath_lightning Mobile breathes lightning in combat +breath_any Mobile may use any breath weapon +cast_adept Mobile casts helpful spells on low-level players +cast_cleric Mobile casts clerical spells (ALWAYS cleric act flag) +cast_judge Mobile fires bullets (for Mega-City One only) +cast_mage Mobile casts mage spells (ALWAYS set the mage act flag) +cast_undead Mobile casts spells appropriate for the undead +executioner Mobile attacks Killers and Thieves +fido Mobile devours corpses +guard Mobile protects good-aligned people from attack +janitor Mobile cleans up junk lying on the ground +poison Mobile has a poison attack +thief Mobile steals gold (ALWAYS set the thief act flag) nasty_thief Mobile attacks, robs, and runs (ALWAYS set thief flag) - -The following specials are coded, but should NOT be used because they -are tailored to specific mobiles. Check them out online for examples of + +The following specials are coded, but should NOT be used because they +are tailored to specific mobiles. Check them out online for examples of unique or area-specific specials that can possibly be coded for your mobiles: -cast_judge Mobile fires bullets (for Mega-City One only) -troll_member Mobile attacks ogre gang members (gangland mobs only) -ogre_member Mobile attacks troll gang members (gangland mobs only) -patrolman Mobile tries to break up fights (gangland mobs only) -mayor The Midgaard mayor special (opens/closes city gates, +cast_judge Mobile fires bullets (for Mega-City One only) +troll_member Mobile attacks ogre gang members (gangland mobs only) +ogre_member Mobile attacks troll gang members (gangland mobs only) +patrolman Mobile tries to break up fights (gangland mobs only) +mayor The Midgaard mayor special (opens/closes city gates, etc.) - + 9. Closing your area file: The syntax to end the file is: @@ -1970,28 +1970,28 @@ Be sure to put a couple of carriage returns at the end of the file. F. Definitions Vnum -A vnum is a unique number used to identify a mobile, object or room. +A vnum is a unique number used to identify a mobile, object or room. You can use the same vnum for a mob as for an object or for a room (since the code keeps track of them separately) but NOT for different mobs, objects or rooms. Warpstone -A component used in the portal and nexus spells. Further spell +A component used in the portal and nexus spells. Further spell components will eventually be implemented. Keep them rare and NEVER describe an object in such a way as to suggest that it might be a warpstone. It should be indistinguishable from a normal gem or rock except by identifying it. Lore will eventually identify components (including warpstones) as such. Trash -Mobs will spec_janitor target trash as the first thing to pick up. It's -the catch-all for objects that fall under no other categories. +Mobs will spec_janitor target trash as the first thing to pick up. It's +the catch-all for objects that fall under no other categories. Pickproof Immune to being picked with the pick lock spell. Dice -Role playing games commonly use dice of more or less than six sides for -purpose of generating random numbers for damage, hit probability, etc. -For example, 1d11 (not possible in real life, but possible in the game) +Role playing games commonly use dice of more or less than six sides for +purpose of generating random numbers for damage, hit probability, etc. +For example, 1d11 (not possible in real life, but possible in the game) would generate a value from 1 to 11. 2d4 would generate a range from 2 to 8. Usage of multiple dice generates a belled result where a range generates a linear one (for example, 2d4 averages 5, whereas a range from 1 to 8 averages 4.5). Mobile or mob -A being/monster within the game capable of the functions the area +A being/monster within the game capable of the functions the area builder defines. Note that mobiles that have ACT_SENTINEL (stay in one place) aren't mobile per se, but why quibble? :) Jukebox @@ -1999,49 +1999,49 @@ The jukebox will 'play' songs either in the room you are in or play them loud (o G. Closing Notes -Make your rooms direction insensitive unless there is only one exit. If -a room has a south exit and a west exit, the line 'You enter through the -southern door' is a bad line. However, if the southern door is the only -entrance to the room, it's permissible. Also, if you are using one way +Make your rooms direction insensitive unless there is only one exit. If +a room has a south exit and a west exit, the line 'You enter through the +southern door' is a bad line. However, if the southern door is the only +entrance to the room, it's permissible. Also, if you are using one way doors, direction sensitivity is permissible. -Also, a room doesn't know if you've seen it before, so avoid lines like +Also, a room doesn't know if you've seen it before, so avoid lines like 'you gaze on the mighty mirror of Zenabit for the first time'. -Avoid putting sentiments into the mind of the reader. If the line has +Avoid putting sentiments into the mind of the reader. If the line has 'you think' in it, it's probably bad, since you don't know if that's really what they think. Try to convey things in another manner as to make them think what you want them to think. -Avoid pointless anachronism. It's tacky. Areas should have some +Avoid pointless anachronism. It's tacky. Areas should have some internal logic, as well as logic to the rest of the world, instead of just being a lump of anachronism to provoke a titter the first time, and gradually to become tiresome. Strive for cleverness and wit instead. -Put in extra descriptions in rooms especially, but also on objects. It -fleshes the area out more. Overdo extra descs rather than underdoing +Put in extra descriptions in rooms especially, but also on objects. It +fleshes the area out more. Overdo extra descs rather than underdoing them. -Write utility linker rooms. If you have a long and winding road going +Write utility linker rooms. If you have a long and winding road going up to the castle -- write at least a couple of road rooms. Be sure to say 'the castle to the north' and not 'the castle in front of you' since the person might have left it. Write 'useless' objects for colour. If the princess is the sort to wear -perfume, put some type furniture perfume in a type object vanity table +perfume, put some type furniture perfume in a type object vanity table that could be found if looked for. It too fleshes out the world. (Note that Satin wrote 600 useless objects for Cordreas Heart, but you don't have to be asthorough (read, insane) as her. ;) -If there's furniture in a room, write it as an object and load it there, +If there's furniture in a room, write it as an object and load it there, so that it could be sat on/etc. -If you have no_take objects (such as the donation pit) or mobs that +If you have no_take objects (such as the donation pit) or mobs that cannot be killed and are sentinel (shopkeepers, adepts, etc.) write them as normal objects/mobs, consider giving them no long description, just a ~, and describe them as part of the room, to blend them into the world more. If the mob can be killed, or the object taken, though, you should give it a long desc, since it might not be there. -Do NOT write descriptions of a mobile into the room description if you +Do NOT write descriptions of a mobile into the room description if you also load that mobile in the area. Do not do the following: -You are in a throne room. A huge gold throne with the king of the +You are in a throne room. A huge gold throne with the king of the goblins sitting on it is in front of you. He cries out and several bodyguards attack! Instead do: -You are in a throne room. A huge gold throne is immediately in front of +You are in a throne room. A huge gold throne is immediately in front of you. Tapestries depicting the greatness of the ruler whose castle you have intruded hang on all walls. The king of the goblins is here. He cries for help! diff --git a/doc/area.txt b/doc/area.txt index c2f8163..8afc392 100644 --- a/doc/area.txt +++ b/doc/area.txt @@ -191,7 +191,7 @@ This provides for an escape mechanism from the usual leading-blank stripping of strings, so that picturesque greeting screens may be used. - + === The #MOBILES section @@ -448,7 +448,7 @@ other sections. The reset commands are: * comment - M read a mobile + M read a mobile O read an object P put object in object G give object to mobile diff --git a/doc/drool.txt b/doc/drool.txt index 15f1a31..1135282 100644 --- a/doc/drool.txt +++ b/doc/drool.txt @@ -38,7 +38,7 @@ Magic-User: find familiar- extra mana, hp...if it stays alive.. fireball- make it into an area affect spell... power word kill- VERY high level- insta-kill monsters - of levels below the caster-possibly 5 or more levels + of levels below the caster-possibly 5 or more levels below chain lightning- lightning hits more than one opponent (or friend)... @@ -46,10 +46,10 @@ Magic-User: conjuer elemental- make this this WORK! prismatic sphere- high-level (28th, mabye)-- offers protection from breath, ect.. - polymorph- change shape into a lower level monster's...keep + polymorph- change shape into a lower level monster's...keep hp's and AC...could couse problems with other players meteor swarm- area affect- high-level... - + General ideas: @@ -59,7 +59,7 @@ General ideas: -* restrict groups to alignment(good cannot group with evil)... --* Martial Arts- cost more for Mages, Clerics than for Warriors and +-* Martial Arts- cost more for Mages, Clerics than for Warriors and Thieves... -* MORE MOBS!, MORE AREAS!, MORE MAGIC ITEMS! @@ -74,7 +74,7 @@ General ideas: - castles(room) for players at high levels- players can recall to it and store items temporarily... castles cause chars to heal and regain mana - at double the normal rate... + at double the normal rate... - races....multi-class for non-humans...level restrict... - random abitlies...cant see stats till 15th level - verify feature for new players- auto e-mail and reply to prevent multi playing... @@ -82,32 +82,32 @@ General ideas: so the mud is never down for more then a couple of hours... - Make money worth something!- make quality items for sale - at really high prices... possibly the char could + at really high prices... possibly the char could buy a castle instead of leveling to get it...(50 mil?) - IF there is the castle purchace option- chars must own a castle before they can become immort... - gossip and auction chanels are good... - get rid of recall...buy scrolls or recall items(more than one recall)... - - WE NEED A BETTER BAR! + - WE NEED A BETTER BAR! screwdrivers, magaritas, vodka sours, lemonballs AAAAAAAHHHH! - no-trip...players can either prac a no-trip skill or get a no-trip item(ring of free action)... - class restricted eq.... - - allow players to rename thier own eq... + - allow players to rename thier own eq... you could do a lot with this... make the eq exclusive to the player once he renames it--(this would cost money-the armorer or weaponsmith could do it)... - - setmin and setmout (for chars)- set what other players - see when the char walks in or out...this + - setmin and setmout (for chars)- set what other players + see when the char walks in or out...this could also be done for money(small amount) I think that's all.....we might come up with a few more later... - The WhooPIe Drool Co.! + The WhooPIe Drool Co.! Onethumb-...Sith Baka-...Orrik Penn-...Ender @@ -115,4 +115,3 @@ I think that's all.....we might come up with a few more later... Merry X-mas!....well.... later onethumb! - diff --git a/doc/equipment-system b/doc/equipment-system index 5c7349f..25537bc 100644 --- a/doc/equipment-system +++ b/doc/equipment-system @@ -208,4 +208,3 @@ In the case of Equip, a nested method, wear, was created to handle the brunt of an item. it is not directly callable. --Will add more to this later. Syn. - diff --git a/doc/hacker.txt b/doc/hacker.txt index f396317..f0e14a0 100644 --- a/doc/hacker.txt +++ b/doc/hacker.txt @@ -355,4 +355,3 @@ Kernighan and Plaugher, _The Elements of Programming Style_. Kernighan and Ritchie, _The C Programming Language_. Brooks, _The Mythical Man Month_ - diff --git a/doc/license.doc b/doc/license.doc index 4b83734..20c1983 100644 --- a/doc/license.doc +++ b/doc/license.doc @@ -72,7 +72,7 @@ Rules: If you wish to setup a version of DikuMud on any computer system, you must send us a message , by snail-mail or e-mail, and inform us where - and when you are running the game. (remember to include + and when you are running the game. (remember to include your address, name etc.) @@ -100,4 +100,3 @@ time. We have so far put extremely many programming hours into this project. If you make any major improvements on DikuMud we would be happy to hear from you. As you will naturally honor the above rules, you will receive new updates and improvements made to the game. - diff --git a/doc/memory.txt b/doc/memory.txt index 175bebd..9c4b9a3 100644 --- a/doc/memory.txt +++ b/doc/memory.txt @@ -120,7 +120,7 @@ Unlike string space, permanent space grows on demand; alloc_perm() calloc's and carves up as many blocks as needed as the game runs. You can adjust the block size by changing MAX_PERM_BLOCK in 'db.c'. Adjustment -will have only a minor effect on space and time usage. If you port Merc to a +will have only a minor effect on space and time usage. If you port Merc to a new system with a 64k or 32k limit on calloc() size, you could simply change MAX_PERM_BLOCK to the largest calloc'able block on your system. diff --git a/doc/new.txt b/doc/new.txt index 74b1661..86b8a65 100644 --- a/doc/new.txt +++ b/doc/new.txt @@ -223,7 +223,7 @@ Several nasty memory allocation bugs were fixed. These didn't show up on SunOS or Ultrix, but crashed Linux, NextOS, and many other OS's. Thanks to Vic for debugging help. -The bug where getting killed with an 'armor' spell on left one's AC at 120 +The bug where getting killed with an 'armor' spell on left one's AC at 120 (instead of 100) has been fixed. The server emits a telnet GA sequence at the end of the prompt. diff --git a/doc/pyTiming.txt b/doc/pyTiming.txt index 2ac8b1d..62089a5 100644 --- a/doc/pyTiming.txt +++ b/doc/pyTiming.txt @@ -13,4 +13,3 @@ PULSE_AREA PULSE_VIOLENCE PULSE_MOBILE PULSE_TICK - diff --git a/doc/rom.license b/doc/rom.license index 93696dc..b82426f 100644 --- a/doc/rom.license +++ b/doc/rom.license @@ -1,7 +1,7 @@ In compiling this code, you have agreed to the following restrictions on any operating version of ROM code: -1) following all guidelines in the diku license (contained in the file +1) following all guidelines in the diku license (contained in the file license.doc) 2) following all guidelines in the Merc license (contained in the file license.txt) @@ -22,16 +22,16 @@ any operating version of ROM code: (rtaylor@efn.org), so that I can keep track of sites for future code releases. 5) Any use of the term Rivers of Mud remains the exclusive right of - Russ Taylor, this includes the sole right to release future versions + Russ Taylor, this includes the sole right to release future versions of ROM source code, and the title Rivers of Mud and ROM as pertains to a mud. Names such as John's ROM, AnotherROM, and JustaROM are also forbidden. Permission to use the name Rivers of Mud has been granted - to Zump, the current ROM implementer, his mud will remain the only one + to Zump, the current ROM implementer, his mud will remain the only one with that privilige. As a coder, you have full rights to release your own derivatives of the ROM code, provided they follow the restrictions of this license, contain all appropriate README and credits files, and are properly labelled as being derivatives of the ROM 2.4 code (just as ROM - is itself a derivative of Gamma 0.0 and Merc 2.1 code). + is itself a derivative of Gamma 0.0 and Merc 2.1 code). 6) Anyone not wishing to follow terms of the ROM license shall be obligated to delete all copies of this code in their possession. This includes, but is not limited to, failure to display full credits for ROM, Merc, and Diku. @@ -47,4 +47,4 @@ cannot call your mud ROM even though it uses ROM code. You also aren't allowed to deal with code thieves) If you have any questions about this license, please send email to -rtaylor@efn.org. +rtaylor@efn.org. diff --git a/doc/vnum.txt b/doc/vnum.txt index aba020a..a694c0a 100644 --- a/doc/vnum.txt +++ b/doc/vnum.txt @@ -12,23 +12,23 @@ Kahn michael@uclink.berkeley.edu === Vnum Assignments -00 limbo.are 20 catacomb.are 40 moria.are 60 haon.are 80 mega1.are -01 smurf.are 21 hood.are 41 moria.are 61 haon.are 81 - -02 - 22 draconia.are 42 - 62 - 82 - -03 plains.are 23 mahntor.are 43 - 63 arachnos.are 83 marsh.are -04 - 24 - 44 - 64 - 84 - -05 - 25 - 45 - 65 dwarven.are 85 - -06 ofcol2.are 26 - 46 - 66 daycare.are 86 dream.are -07 - 27 - 47 - 67 - 87 - -08 - 28 trollden.are 48 - 68 - 88 - -09 olympus.are 29 - 49 - 69 - 89 grove.are -10 air.are 30 midgaard.are 50 eastern.are 70 sewer.are 90 - -11 shire.are 31 midgaard.are 51 drow.are 71 sewer.are 91 dylan.are -12 hitower.are 32 midgaard.are 52 thalos.are 72 sewer.are 92 canyon.are -13 hitower.are 33 midgaard.are 53 mirror.are 73 sewer.are 93 galaxy.are -14 hitower.are 34 chapel.are 54 - 74 sewer.are 94 mobfact.are +00 limbo.are 20 catacomb.are 40 moria.are 60 haon.are 80 mega1.are +01 smurf.are 21 hood.are 41 moria.are 61 haon.are 81 - +02 - 22 draconia.are 42 - 62 - 82 - +03 plains.are 23 mahntor.are 43 - 63 arachnos.are 83 marsh.are +04 - 24 - 44 - 64 - 84 - +05 - 25 - 45 - 65 dwarven.are 85 - +06 ofcol2.are 26 - 46 - 66 daycare.are 86 dream.are +07 - 27 - 47 - 67 - 87 - +08 - 28 trollden.are 48 - 68 - 88 - +09 olympus.are 29 - 49 - 69 - 89 grove.are +10 air.are 30 midgaard.are 50 eastern.are 70 sewer.are 90 - +11 shire.are 31 midgaard.are 51 drow.are 71 sewer.are 91 dylan.are +12 hitower.are 32 midgaard.are 52 thalos.are 72 sewer.are 92 canyon.are +13 hitower.are 33 midgaard.are 53 mirror.are 73 sewer.are 93 galaxy.are +14 hitower.are 34 chapel.are 54 - 74 sewer.are 94 mobfact.are 15 gnome.are 35 midennir.are 55 ofcol.are 75 - 95 newthalos.are 16 wyvern.are 36 grave.are 56 - 76 - 96 newthalos.are 17 wyvern.are 37 school.are 57 - 77 - 97 newthalos.are -18 - 38 - 58 - 78 valley.are 98 - -19 - 39 moria.are 59 - 79 redferne.are 99 - +18 - 38 - 58 - 78 valley.are 98 - +19 - 39 moria.are 59 - 79 redferne.are 99 - diff --git a/requirements.txt b/requirements.txt index 052733c..d5f191d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ -psutil +black ipdb mypy -black -pytest pre-commit +psutil +pytest diff --git a/setup.py b/setup.py index 952247e..7f903ca 100644 --- a/setup.py +++ b/setup.py @@ -6,9 +6,7 @@ REQUIREMENTS = [requirement for requirement in open("requirements.txt").readlines()] -COMMANDS = [ - "rom24=rom24.pyom:pyom", -] +COMMANDS = ["rom24=rom24.pyom:pyom"] setup( name="rom24", @@ -18,10 +16,8 @@ url="", include_package_data=True, description="Attempt at properly packaging rom24 python.", - packages=find_packages('src'), - package_dir={ - '': 'src', - }, + packages=find_packages("src"), + package_dir={"": "src"}, python_requires=">=3.6.6", entry_points={"console_scripts": COMMANDS}, install_requires=REQUIREMENTS, diff --git a/src/area/astral.are b/src/area/astral.are index 4182825..36993d2 100644 --- a/src/area/astral.are +++ b/src/area/astral.are @@ -25,7 +25,7 @@ oldstyle nightmare~ A pitch-black nightmare~ A nightmare is here, kicking at you with its flaming hooves. ~ -The nightmare is a wholly evil being, sent out by the rulers of the lower +The nightmare is a wholly evil being, sent out by the rulers of the lower planes to torment mortals. It vaguely resembles a horse, with a hide blacker than the darkest night, and hooves that burn with unholy fires. ~ @@ -41,7 +41,7 @@ oldstyle night hag~ An evil night hag~ A night hag reaches out to steal your soul. ~ -You see a shadowy creature with long talons and an evil grin, whose sole +You see a shadowy creature with long talons and an evil grin, whose sole purpose is to hunt down and slay mortals in order to obtain souls for her foul master to torment. ~ @@ -763,7 +763,7 @@ You can see the Temple of Midgaard below you. 0 -1 1036 E rainbow~ -The rainbow softly glows with beams of light, in colours that defie +The rainbow softly glows with beams of light, in colours that defie description. ~ S @@ -786,14 +786,14 @@ The rainbow extends below you towards Midgaard. 0 -1 7700 E rainbow~ -The rainbow softly glows with beams of light, in colours that defie +The rainbow softly glows with beams of light, in colours that defie description. ~ S #7702 On the Rainbow~ You are standing on the rainbow, surrounded by many beams of multicoloured -light. Through the bottom of the rainbow you see the City of Midgaard and the +light. Through the bottom of the rainbow you see the City of Midgaard and the land surrounding it. It seems to be miles below you. ~ 0 0 5 @@ -820,7 +820,7 @@ light. The rainbow extends above and below you as far as you can see. ~ 0 0 5 D4 -The rainbow extends far above you. You see a glowing white light at the +The rainbow extends far above you. You see a glowing white light at the rainbow's end. ~ ~ @@ -866,7 +866,7 @@ intangible -- your hand passes right through them. ~ E rainbow~ -The rainbow brilliantly glows with beams of blinding light, in colours that +The rainbow brilliantly glows with beams of blinding light, in colours that sweep together and merge before your eyes. ~ S @@ -874,7 +874,7 @@ S The Glowing Bridge at the Rainbow's End~ After a long climb you have reached the end of the rainbow. The brilliant colours have twisted and merged into a beautiful glowing bridge that leads -toward a massive white gate to the north. All around you is a soft, peaceful +toward a massive white gate to the north. All around you is a soft, peaceful glow interrupted only by the passing of starlike dust motes before your eyes. ~ 0 0 1 @@ -931,18 +931,18 @@ below you. 0 -1 7705 E plaque~ -The plaque reads: +The plaque reads: -Let this gate stand to protect mortal man for all time against the perils of +Let this gate stand to protect mortal man for all time against the perils of the outer planes of existence and the creatures fair and foul that dwell within. -(The Astral Plane and Githyanki Keep were written by Andersen.) +(The Astral Plane and Githyanki Keep were written by Andersen.) ~ E gate~ -You see a huge, glowing gate wrought from an incredibly hard translucent -material. Each of the intricately carved bars of this mighty gate are about -as thick as a man's wrist, rising from the floor to a height of forty feet. +You see a huge, glowing gate wrought from an incredibly hard translucent +material. Each of the intricately carved bars of this mighty gate are about +as thick as a man's wrist, rising from the floor to a height of forty feet. A plaque is inset into the wall next to one side of the gate. ~ S @@ -997,7 +997,7 @@ S Exploring the Astral Plane~ You find yourself floating in a field of blackness, filled with tiny tendrils of silvery light and insubstantial shining motes of dust. The weightlessness -of this environment is very disorienting, and it is difficult to maintain your +of this environment is very disorienting, and it is difficult to maintain your bearings and sense of direction. ~ 0 0 2 @@ -1031,7 +1031,7 @@ S Exploring the Astral Plane~ You find yourself floating in a field of blackness, filled with tiny tendrils of silvery light and insubstantial shining motes of dust. The weightlessness -of this environment is very disorienting, and it is difficult to maintain your +of this environment is very disorienting, and it is difficult to maintain your bearings and sense of direction. ~ 0 0 2 @@ -1065,7 +1065,7 @@ S Exploring the Astral Plane~ You find yourself floating in a field of blackness, filled with tiny tendrils of silvery light and insubstantial shining motes of dust. The weightlessness -of this environment is very disorienting, and it is difficult to maintain your +of this environment is very disorienting, and it is difficult to maintain your bearings and sense of direction. ~ 0 0 2 @@ -1099,7 +1099,7 @@ S Exploring the Astral Plane~ You find yourself floating in a field of blackness, filled with tiny tendrils of silvery light and insubstantial shining motes of dust. The weightlessness -of this environment is very disorienting, and it is difficult to maintain your +of this environment is very disorienting, and it is difficult to maintain your bearings and sense of direction. ~ 0 0 2 @@ -1133,7 +1133,7 @@ S Exploring the Astral Plane~ You find yourself floating in a field of blackness, filled with tiny tendrils of silvery light and insubstantial shining motes of dust. The weightlessness -of this environment is very disorienting, and it is difficult to maintain your +of this environment is very disorienting, and it is difficult to maintain your bearings and sense of direction. ~ 0 0 2 @@ -1245,7 +1245,7 @@ S Roaming the Astral Plane~ You find yourself floating in a field of blackness, filled with tiny tendrils of silvery light and insubstantial shining motes of dust. The weightlessness -of this environment is somewhat disorienting, though your instincts say you are +of this environment is somewhat disorienting, though your instincts say you are close to home. All exits lead off into the astral field. ~ @@ -1285,7 +1285,7 @@ S Roaming the Astral Plane~ You find yourself floating in a field of blackness, filled with tiny tendrils of silvery light and insubstantial shining motes of dust. The weightlessness -of this environment is somewhat disorienting, though your instincts say you are +of this environment is somewhat disorienting, though your instincts say you are close to home. All exits lead off into the astral field. ~ @@ -1325,7 +1325,7 @@ S Roaming the Astral Plane~ You find yourself floating in a field of blackness, filled with tiny tendrils of silvery light and insubstantial shining motes of dust. The weightlessness -of this environment is somewhat disorienting, though your instincts say you are +of this environment is somewhat disorienting, though your instincts say you are close to home. All exits lead off into the astral field. ~ @@ -1760,7 +1760,7 @@ S Traversing the Astral Plane~ You find yourself deep within in a dark field filled with tiny tendrils of silvery light and insubstantial shining motes of dust. The weightlessness -of this environment is extremely disorienting, and you are having trouble +of this environment is extremely disorienting, and you are having trouble keeping your sense of direction. All exits lead off into the astral field. ~ @@ -1800,7 +1800,7 @@ S Traversing the Astral Plane~ You find yourself deep within in a dark field filled with tiny tendrils of silvery light and insubstantial shining motes of dust. The weightlessness -of this environment is extremely disorienting, and you are having trouble +of this environment is extremely disorienting, and you are having trouble keeping your sense of direction. All exits lead off into the astral field. ~ @@ -1840,7 +1840,7 @@ S Traversing the Astral Plane~ You find yourself deep within in a dark field filled with tiny tendrils of silvery light and insubstantial shining motes of dust. The weightlessness -of this environment is extremely disorienting, and you are having trouble +of this environment is extremely disorienting, and you are having trouble keeping your sense of direction. All exits lead off into the astral field. ~ @@ -1880,7 +1880,7 @@ S Traversing the Astral Plane~ You find yourself deep within in a dark field filled with tiny tendrils of silvery light and insubstantial shining motes of dust. The weightlessness -of this environment is extremely disorienting, and you are having trouble +of this environment is extremely disorienting, and you are having trouble keeping your sense of direction. All exits lead off into the astral field. ~ @@ -1920,7 +1920,7 @@ S Traversing the Astral Plane~ You find yourself deep within in a dark field filled with tiny tendrils of silvery light and insubstantial shining motes of dust. The weightlessness -of this environment is extremely disorienting, and you are having trouble +of this environment is extremely disorienting, and you are having trouble keeping your sense of direction. All exits lead off into the astral field. ~ @@ -1960,7 +1960,7 @@ S Lost in the Astral Plane~ You find yourself in in a field of blackness, filled with tiny tendrils of silvery light and insubstantial shining motes of dust. The weightlessness -of this environment is incredibly disorienting, and you are having trouble +of this environment is incredibly disorienting, and you are having trouble keeping your senses straight. All exits lead off into the astral field. ~ @@ -1995,7 +1995,7 @@ S Lost in the Astral Plane~ You find yourself in in a field of blackness, filled with tiny tendrils of silvery light and insubstantial shining motes of dust. The weightlessness -of this environment is incredibly disorienting, and you are having trouble +of this environment is incredibly disorienting, and you are having trouble keeping your senses straight. All exits lead off into the astral field. ~ @@ -2030,7 +2030,7 @@ S Lost in the Astral Plane~ You find yourself in in a field of blackness, filled with tiny tendrils of silvery light and insubstantial shining motes of dust. The weightlessness -of this environment is incredibly disorienting, and you are having trouble +of this environment is incredibly disorienting, and you are having trouble keeping your senses straight. All exits lead off into the astral field. ~ @@ -2555,7 +2555,7 @@ A grey road~ The ground beneath your feet is a uniformly grey cobblestone. A dull red sun hangs in an orange sky above your head; you hear none of the sounds you would commonly associate with a normal city. - The cobblestone road continues to the east and west. To the north you see a + The cobblestone road continues to the east and west. To the north you see a massive building and a pair of large doors. ~ 0 0 1 @@ -2753,7 +2753,7 @@ S #7762 A small building~ You have stepped inside a dimly lit building, which apparently serves as -living quarters for several githyanki gish. The walls are heavy stone blocks, +living quarters for several githyanki gish. The walls are heavy stone blocks, covered with panels of strangely knotted and twisted wood. A couple of candles burn dimly in sconces here and there. ~ @@ -2771,7 +2771,7 @@ S #7763 A small building~ You have stepped inside a dimly lit building, which apparently serves as -living quarters for several githyanki gish. The walls are heavy stone blocks, +living quarters for several githyanki gish. The walls are heavy stone blocks, covered with panels of strangely knotted and twisted wood. A couple of candles burn dimly in sconces here and there. ~ @@ -2807,7 +2807,7 @@ S #7765 The Githyanki Weaponry~ A large chamber, full of weapons in various states of completion. Strange -glowing blocks of silvery metal are being pounded and rolled out into deadly +glowing blocks of silvery metal are being pounded and rolled out into deadly razor-sharp knives, daggers, and swords. Sounds of hammering and blasts of heat and strange smells come from the open doorway to the north. An iron door stands to the west. @@ -2832,7 +2832,7 @@ S The Forge~ In the center of the room is a massive furnace which emits great gouts of heat and a strange smell which comes from the melting of the silvery metal used -by the githyanki. A large trough of icy water stands to the west, used for +by the githyanki. A large trough of icy water stands to the west, used for quenching hot metal. Doorways stand to the north and south. The furnace door lies to the east. ~ @@ -2915,7 +2915,7 @@ S #7769 A guard station~ You are standing in a small, fairly empty building that serves as the prison -for the keep. The building is small because the githyanki do not make a habit +for the keep. The building is small because the githyanki do not make a habit of taking prisoners, and those that they do capture do not last long. The cellblock lies to the west and the grey stone road is to the east. ~ diff --git a/src/area/canyon.are b/src/area/canyon.are index 30ad945..8682865 100644 --- a/src/area/canyon.are +++ b/src/area/canyon.are @@ -107,8 +107,8 @@ oldstyle earth elemental ruler~ the Earth Ruler~ The Ruler of the earth elementals. ~ -He looks as old as the earth itself. He seems to know all the -secrets and knowledge of the Earth. You can't really tell where +He looks as old as the earth itself. He seems to know all the +secrets and knowledge of the Earth. You can't really tell where he begins and the rock wall ends. ~ human~ @@ -349,7 +349,7 @@ oldstyle blue flame~ the Blue Flame~ The Blue Flame burns mysteriously here. ~ -As you look you see what seems to be a face and almost a +As you look you see what seems to be a face and almost a humanoid figure somehow trapped in the fire. ~ human~ @@ -435,7 +435,7 @@ oldstyle rainbow warrior~ a rainbow warrior~ A warrior of the Rainbow Cult swears his loyalty. ~ -The Rainbow Cult has received special powers for their service to +The Rainbow Cult has received special powers for their service to the elemental forces. ~ human~ @@ -1859,7 +1859,7 @@ S #9259 Windy Tunnel~ A tunnel leads east. To the west you can enter a portal. The wind in -this tunnel is quite fierce, it seems as if it's forced. +this tunnel is quite fierce, it seems as if it's forced. ~ 0 0 4 D1 diff --git a/src/area/chapel.are b/src/area/chapel.are index 47923d0..33f989b 100644 --- a/src/area/chapel.are +++ b/src/area/chapel.are @@ -908,7 +908,7 @@ oak~ 1 -1 3422 D4 You see a large set of stone stairs leading upwards to a small stone door at -the top. +the top. ~ stone trapdoor door~ 2 3410 3405 diff --git a/src/area/daycare.are b/src/area/daycare.are index 901fb01..de9e75a 100644 --- a/src/area/daycare.are +++ b/src/area/daycare.are @@ -164,7 +164,7 @@ A 1 1 E ring pink ice~ -How strange...it's made of ice, but it doesn't melt. It feels pleasantly +How strange...it's made of ice, but it doesn't melt. It feels pleasantly cool to the touch. ~ #6621 diff --git a/src/area/draconia.are b/src/area/draconia.are index 4c99157..371fe8f 100644 --- a/src/area/draconia.are +++ b/src/area/draconia.are @@ -27,8 +27,8 @@ oldstyle draconian~ the Draconian~ The Draconian is standing here. ~ -This horrible creature is a bizarre cross between a man and a dragon. He -has black scales and a seven foot wingspan. He scowls at you and hefts his +This horrible creature is a bizarre cross between a man and a dragon. He +has black scales and a seven foot wingspan. He scowls at you and hefts his spear as you enter the room. ~ human~ @@ -71,10 +71,10 @@ stand stand male 30 #2204 oldstyle cleric draconian~ the holy Draconian~ -A Draconian is here, deep in thought. +A Draconian is here, deep in thought. ~ -A Draconian stands here, dressed in simple robes. Around his neck you -notice a golden medallion in the shape of a five headed dragon. +A Draconian stands here, dressed in simple robes. Around his neck you +notice a golden medallion in the shape of a five headed dragon. ~ human~ ABCFQ DH -900 0 @@ -86,11 +86,11 @@ stand stand male 20 #2205 oldstyle king draconian~ the Draconian King~ -A Draconian wearing fine clothes is here, pondering his greatness. +A Draconian wearing fine clothes is here, pondering his greatness. ~ -The king of the draconians sits here on a golden throne. He looks as -though he could crush your head with a single blow. Yet you sense that he -is controlled by a greater power. +The king of the draconians sits here on a golden throne. He looks as +though he could crush your head with a single blow. Yet you sense that he +is controlled by a greater power. ~ human~ ABC DH -900 0 @@ -102,11 +102,11 @@ stand stand male 40 #2206 oldstyle concubine draconian~ a concubine~ -A concubine is resting here. +A concubine is resting here. ~ -This is a concubine of the king. She is lounging here, wearing nothing at -all. You find yourself strangely repulsed as she draws a knife and -prepares to defend herself. +This is a concubine of the king. She is lounging here, wearing nothing at +all. You find yourself strangely repulsed as she draws a knife and +prepares to defend herself. ~ human~ AB 0 -500 0 @@ -118,7 +118,7 @@ stand stand female 5 #2207 oldstyle bodyguard draconian~ A bodyguard~ -A bodyguard is here, staring at you menacingly. +A bodyguard is here, staring at you menacingly. ~ This creature has devoted its life to defending the king. Your intrusion has not pleased it. @@ -148,10 +148,10 @@ stand stand female 2500 #2221 oldstyle dragon red~ the Great Red Dragon~ -A red dragon is here, contemplating your existence. +A red dragon is here, contemplating your existence. ~ This huge red dragon dominates the chamber. As you turn to flee, he grins at -you and invites you to stay ... forever! +you and invites you to stay ... forever! ~ dragon~ ABCF DF -1000 0 @@ -164,7 +164,7 @@ F res H #2222 oldstyle dragon black~ the Great Black Dragon~ -A black dragon is here, laughing at your insolence. +A black dragon is here, laughing at your insolence. ~ This huge black wyrm laughs at your puny weapons. You realize that he is not going to roll over and die for you. @@ -181,7 +181,7 @@ F vul I #2223 oldstyle dragon white~ the Great White Dragon~ -A white dragon is here, waiting for you. +A white dragon is here, waiting for you. ~ This dragon towers over you. Recalling your previous experiences with white dragons, you are not afraid. She smiles at you and says 'I think you will find @@ -199,10 +199,10 @@ F vul I #2225 oldstyle dragon green~ the Ancient Green Dragon~ -A green dragon is here, looking distraught. +A green dragon is here, looking distraught. ~ -This huge beast appears to be the most directly related to the draconians. -She looks at you with sorrow in her eyes and says 'You have slaughtered my +This huge beast appears to be the most directly related to the draconians. +She looks at you with sorrow in her eyes and says 'You have slaughtered my children. Prepare to die.' ~ dragon~ @@ -217,7 +217,7 @@ F vul I #2226 oldstyle hydra~ a large hydra~ -A hydra is here, blocking the doorway. +A hydra is here, blocking the doorway. ~ A hydra is here, guarding the entrance to a sealed vault. You have the feeling it isn't happy to see you. @@ -232,7 +232,7 @@ stand stand none 250 #2227 oldstyle slave human~ A human slave~ -A Human slave is here, hard at work. +A Human slave is here, hard at work. ~ He looks like he's under a lot of stress. He would probably like it if you left him alone. @@ -262,9 +262,9 @@ stand stand none 75 #2241 oldstyle dragon phase~ the phase dragon~ -A Phase Dragon is darting around the room. +A Phase Dragon is darting around the room. ~ -This small dragon looks like he's up to no good. +This small dragon looks like he's up to no good. ~ dragon~ ACFGH DF -300 0 @@ -276,10 +276,10 @@ stand stand male 250 #2242 oldstyle fool draconian~ the draconian fool~ -A Fool is here, making fun of you. +A Fool is here, making fun of you. ~ -This dragon man looks VERY foolish, dressed in a green and blue striped -suit. As you enter the room, he points at you and laughs. +This dragon man looks VERY foolish, dressed in a green and blue striped +suit. As you enter the room, he points at you and laughs. ~ human~ AGHS DF 0 0 @@ -291,10 +291,10 @@ stand stand male 25 #2243 oldstyle queen draconian~ the Draconian Queen~ -A Female Draconian sits, here, looking very important. +A Female Draconian sits, here, looking very important. ~ -This draconian looks VERY busy as she orders her slaves around. You think -it might be a good idea to leave her alone. +This draconian looks VERY busy as she orders her slaves around. You think +it might be a good idea to leave her alone. ~ human~ ABC DFH -600 0 @@ -705,55 +705,55 @@ S #2202 The Foyer~ This is the entrance to the Tower. The hallway continues to the north, -leading towards a staircase. You notice a grim painting on the wall, and +leading towards a staircase. You notice a grim painting on the wall, and quickly look away. ~ 0 CD 0 D0 -You see a long hallway. +You see a long hallway. ~ ~ 0 -1 2203 D2 -You see the gate. +You see the gate. ~ ~ 0 -1 2201 E painting~ -This painting depicts the grisly death of a foolish human. You hope you do +This painting depicts the grisly death of a foolish human. You hope you do not share his fate. ~ S #2203 Hallway~ -This hallway seems to stretch on forever. You notice a stairway in -the distance. +This hallway seems to stretch on forever. You notice a stairway in +the distance. ~ 0 D 0 D0 -The hall continues. +The hall continues. ~ ~ 0 -1 2204 D2 -You see the foyer. +You see the foyer. ~ ~ 0 -1 2202 S #2204 Hallway~ -You trudge down the hallway. You notice doors to the east and west. +You trudge down the hallway. You notice doors to the east and west. ~ 0 D 0 D0 -The hall continues. +The hall continues. ~ ~ 0 -1 2207 D1 -You see a door. You notice a sign. +You see a door. You notice a sign. ~ door~ 1 -1 2205 @@ -763,7 +763,7 @@ The hall continues. ~ 0 -1 2203 D3 -You see an oak door. There is an inscription on it. +You see an oak door. There is an inscription on it. ~ oak~ 1 -1 2206 @@ -773,13 +773,13 @@ It says "STORAGE" ~ E sign~ -The sign says "NURSERY" in bold letters. +The sign says "NURSERY" in bold letters. ~ S #2205 Nursery~ It looks like a tornado has been through here. Toys are scattered everywhere, -and a small group of dragon hatchlings are fighting over a bone. +and a small group of dragon hatchlings are fighting over a bone. ~ 0 D 1 D1 @@ -788,7 +788,7 @@ You see a large stone door. door stone~ 2 2297 2223 D3 -You see the hallway. +You see the hallway. ~ ~ 1 -1 2204 @@ -799,28 +799,28 @@ This room is covered with dust, it looks as if no one has been here in ages. ~ 0 D 1 D1 -You see the hallway. +You see the hallway. ~ ~ 1 -1 2204 D5 -You see nothing special. +You see nothing special. ~ trapdoor~ 1 -1 2208 E dust~ -As you look closely at the dust, you notice the outline of a trapdoor! +As you look closely at the dust, you notice the outline of a trapdoor! ~ S #2207 End of the Hallway~ You have finally reached the end of the hallway. A huge staircase leads up. -You see a sign at the base of the staircase. +You see a sign at the base of the staircase. ~ 0 D 0 D2 -The hall continues. +The hall continues. ~ ~ 0 -1 2204 @@ -832,15 +832,15 @@ The second floor. E sign~ The sign reads: - This area is kind of tough. You probably shouldn't go up these stairs - alone if you are under 18th level, or at all if you under 14th level. + This area is kind of tough. You probably shouldn't go up these stairs + alone if you are under 18th level, or at all if you under 14th level. Have fun! -- Wench ~ S #2208 Guardian's Room~ -You climb down the rickety stairs and find yourself face to face with a -gargantuan hydra. How fast can you climb UP stairs? +You climb down the rickety stairs and find yourself face to face with a +gargantuan hydra. How fast can you climb UP stairs? ~ 0 D 1 D2 @@ -849,20 +849,20 @@ A large grey door. grey~ 1 2234 2209 D4 -You see the storage room. +You see the storage room. ~ door trap trapdoor~ 1 -1 2206 S #2209 The Treasure Room~ -You have made it past the hydra into the vault. You are astounded by +You have made it past the hydra into the vault. You are astounded by the treasure here. Not only are you now rich, you can probably rest here safely. The west wall seems to have a large door made entirely of ruby. ~ 0 CD 1 D0 -You see nothing special. +You see nothing special. ~ grey~ 2 2234 2208 @@ -901,7 +901,7 @@ You see nothing special. ~ 0 -1 2210 D1 -You see a wooden door. +You see a wooden door. ~ door wooden~ 1 -1 2212 @@ -914,7 +914,7 @@ S #2212 Hall O' Pleasure~ You stop dead in your tracks as you enter this ornately decorated room - it -is populated with the king's harem. +is populated with the king's harem. ~ 0 D 1 D3 @@ -1022,7 +1022,7 @@ S #2219 Crypt~ You are in a large room which continues to the west. You notice many -coffins here. Open coffins reveal remains of something other than man. +coffins here. Open coffins reveal remains of something other than man. The smell of reptile is very strong here. ~ 0 D 1 @@ -1063,7 +1063,7 @@ You the cave opening. S #2222 The Crypt Ends~ -You have come to the end of the Crypt. It seems deserted. There is a +You have come to the end of the Crypt. It seems deserted. There is a strange coffin lying against the wall. ~ 0 D 1 @@ -1261,7 +1261,7 @@ S Tunnel~ This tunnel seems to stretch for miles. You try to distinguish the end but your eyes soon tire from the strain. The smell here has increased two fold. -The tunnel continues to go to the east. The wine cellar lies back to the +The tunnel continues to go to the east. The wine cellar lies back to the west. ~ 0 AI 2 @@ -1325,7 +1325,7 @@ trapdoor S #2237 The Bridge~ -You are walking along an old wooden bridge. Its not that secure. You +You are walking along an old wooden bridge. Its not that secure. You might want to hurry along. To the south, on the other side of the bridge, lies a small opening. ~ @@ -1361,7 +1361,7 @@ clearing S #2239 Clearing~ -You stand out in a clearing. Mountains are all around you. There is a +You stand out in a clearing. Mountains are all around you. There is a well in the middle of the clearing. Lying against the well is a sign. A path leads up the mountain. The small opening is back to the north. ~ @@ -1385,7 +1385,7 @@ E sign~ The sign reads: This is a bottomless pit cleverly disguised as a well. People have -fallen in and never been heard from again. Trust me, you don't want to go +fallen in and never been heard from again. Trust me, you don't want to go down there. The All Powerful Well Keeper ~ @@ -1420,7 +1420,7 @@ S #2241 A cave opening~ You stand before a huge cave opening. You hearing heavy breathing from -within the cave. There are a few skeletons lying about. The cave lies to +within the cave. There are a few skeletons lying about. The cave lies to the south. The path is back to the east. ~ 0 0 2 @@ -1459,7 +1459,7 @@ the world. To your north lies a huge platinum door. You hear very pronounced grumbling from behind the doors. It sounds like something huge and hungry. But if you don't have the key you don't have to worry because you can't get in. If you do have the key I would suggest not going in. Some believe the Five -Headed dragon Tiamat was imprisoned here by the gods. But who believes in +Headed dragon Tiamat was imprisoned here by the gods. But who believes in fairy tales. Well, if you're scared, you can always go down the mountain. ~ 0 0 2 diff --git a/src/area/dwarven.are b/src/area/dwarven.are index e185f8f..a02cf0d 100644 --- a/src/area/dwarven.are +++ b/src/area/dwarven.are @@ -459,9 +459,9 @@ map castle strangelove~ #ROOMS #6500 Path to Dwarven Village~ -All around you are the mountains of the southern range, home of dwarves and -giants. You can climb back down the mountains to the west and leave these -realms, or seek riches in the northern mineshafts. A dirt road leads south, +All around you are the mountains of the southern range, home of dwarves and +giants. You can climb back down the mountains to the west and leave these +realms, or seek riches in the northern mineshafts. A dirt road leads south, towards a small building. You can hear crying and shrieking coming from it. ~ 0 0 2 @@ -1269,7 +1269,7 @@ S #6562 The mountains of the dwarven kingdom~ You are standing at the foot of the mountains of the dwarven kingdom, where -dwarves and giants toil endlessly to pry gems and mithril from the mother +dwarves and giants toil endlessly to pry gems and mithril from the mother earth. Here lies the palace of the dwarven queen, and untold riches. But beware, for the mines are said to be haunted by demon and spirit alike. The dwarven kingdom lies to the east. diff --git a/src/area/galaxy.are b/src/area/galaxy.are index f4bcac4..adee2a0 100644 --- a/src/area/galaxy.are +++ b/src/area/galaxy.are @@ -79,7 +79,7 @@ sleep sleep male 100 #9306 oldstyle white dwarf~ a white dwarf~ -A tiny white dwarf is trying to sneak away from duty. +A tiny white dwarf is trying to sneak away from duty. ~ Like the red giant, he is also appointed to stand guard for the galaxy. But somehow he manages to escape. Though tiny, it can take a lot of hits! @@ -159,7 +159,7 @@ Orion is still hunting for Scorpio. He is the legendary hunter who almost defeated Taurus the bull, but got killed by Scorpio. The gods put them both up as constellations but one appears on one side of the sky and the other the other side so they will -never meet. +never meet. ~ human~ ABG H 300 0 @@ -188,8 +188,8 @@ oldstyle draco head~ the Head of Draco~ The gigantic Head of Draco lurks out from beneath and prepares to roast you. ~ -This evil-looking head is even larger than a giant. He is the last guardian -before entering the inner galaxy. His neck is flexing in a random fashion so +This evil-looking head is even larger than a giant. He is the last guardian +before entering the inner galaxy. His neck is flexing in a random fashion so hitting the head is certainly not easy. ~ human~ @@ -235,7 +235,7 @@ oldstyle taurus~ Taurus~ Taurus wants to leave, but has been forced to stay as a guardian here. ~ -You see a wild-looking bull with a bad temper. He is well-built and looks like +You see a wild-looking bull with a bad temper. He is well-built and looks like he can fight well ... indeed he has fought with Orion before and survived. ~ human~ @@ -282,7 +282,7 @@ Cancer the crab is here, hoarding the treasure away from you. ~ You see a gigantic crab (YES, it is bigger than you!) with a crushed shell. Legend is that he was crushed by Hercules when he was sent by Hera to kill him. -So Hera made Cancer a constellation for his work. +So Hera made Cancer a constellation for his work. ~ human~ ABGQ H 0 0 @@ -343,7 +343,7 @@ oldstyle scorpio~ Scorpio~ Scorpio is moving his tail towards you, waiting to put an end to some mortals. ~ -Ever since he killed Orion in the myths, he has been punished by having +Ever since he killed Orion in the myths, he has been punished by having Sagittarius' arrow aimed at his heart forever. ~ human~ @@ -373,7 +373,7 @@ Capricorn~ Capricorn is here, feeling bored ... he wants a fight! ~ You see a mean-looking ram here. He used to be a fierce fighter in the ancient -war but now the gods have decided to put him here, to live out the rest of his +war but now the gods have decided to put him here, to live out the rest of his days in peace. ~ human~ @@ -388,8 +388,8 @@ oldstyle aquarius~ Aquarius~ The beautiful Aquarius is standing here, holding THE vessel. ~ -The pretty Water Bearer is smiling at you, you think you'd better give her a -hand with holding the vessel. +The pretty Water Bearer is smiling at you, you think you'd better give her a +hand with holding the vessel. ~ human~ ABGQ H 1000 0 @@ -433,7 +433,7 @@ oldstyle bear ursa major~ Ursa Major the bear~ Ursa Major the bear is the last defense against any intruders. ~ -The Huge Bear which resides in the northern skies is here. +The Huge Bear which resides in the northern skies is here. You think you'd better turn back. At least you have got a chance of survival. ~ bear~ @@ -477,8 +477,8 @@ oldstyle polaris polar star~ Polaris, the polar star~ Polaris, the polar star, who commands the whole Universe, stands before you! ~ -He is the Master of the Universe, (NOT He-Man!), the most powerful! -Even the King and the Queen obey him. As you look at him you notice he is +He is the Master of the Universe, (NOT He-Man!), the most powerful! +Even the King and the Queen obey him. As you look at him you notice he is actually a STAR, with dazzling bright light ... maybe you shouldn't have come here at all? ~ @@ -1143,7 +1143,7 @@ Indeed it is too bright to tell. Because what you are witnessing is the rare event of a Supernova, how a star explodes itself into galactic dust. You may find yourself lucky to witness this rare event but even luckier, you have finally got out of this galaxy as your body turns into dust. -That really HURTS! +That really HURTS! ~ 0 BC 0 S @@ -1183,7 +1183,7 @@ S #9323 Corner of the Galaxy~ You wonder why the galaxy is limited. All you have done in Astronomy -courses now prove worthless. Well who told you to take one at the start? +courses now prove worthless. Well who told you to take one at the start? ~ 0 0 1 D0 @@ -1353,7 +1353,7 @@ S #9332 Hercules' Mighty Throne~ You stand before the throne of a long-forgotten hero. It is full of bounty -that he got from the Ten Labours. +that he got from the Ten Labours. ~ 0 0 1 D2 @@ -1481,7 +1481,7 @@ S #9345 Along the seashore~ You start to feel the heat of Summer. Amongst the rocky beach you notice -hidden forms which could be camouflaged crabs. +hidden forms which could be camouflaged crabs. ~ 0 0 2 D1 @@ -1602,7 +1602,7 @@ S End of the Mystic Chains~ You have reached the end of the mystic chains. Looking up, you notice a small landing on which you can climb. However, there seems to be another -forcefield blocking your way. +forcefield blocking your way. ~ 0 0 5 D4 @@ -1635,7 +1635,7 @@ S Tail of the Draco~ At last you realize that you are on a giant snake-like dragon called the Draco, the guardian of the inner galaxy. You realize that the Draco is -actually flying now! +actually flying now! ~ 0 A 4 D0 @@ -1778,7 +1778,7 @@ S #9365 Cassiopeia's Throne~ This is the Throne room of the Queen of the Universe. From here you can see -every star and constellation in the Universe. +every star and constellation in the Universe. ~ 0 0 1 D0 @@ -1807,7 +1807,7 @@ S #9367 Cepheus' Throne~ This is the Throne room of the King of the Universe. From here you can see -every star and constellation in the Universe. +every star and constellation in the Universe. ~ 0 0 1 D0 @@ -1855,7 +1855,7 @@ S End of the Dipper~ You have finished the path of the Dipper. Here, the most prominent feature is a set of claw-marks. You also notice a room to the south; it looks as -if Polaris could lie here. +if Polaris could lie here. ~ 0 0 1 D0 diff --git a/src/area/gnome.are b/src/area/gnome.are index 425cdce..0949b13 100644 --- a/src/area/gnome.are +++ b/src/area/gnome.are @@ -10,7 +10,7 @@ oldstyle child gnome~ a gnome child~ A gnome child is playing around here. ~ -The little tyke looks so innocent playing with his boomerang that you +The little tyke looks so innocent playing with his boomerang that you just want to pick him up and hug him. ~ human~ @@ -969,7 +969,7 @@ You see a small stream. S #1521 On the Stream~ -The current here flows from the east, but a logjam blocks you from +The current here flows from the east, but a logjam blocks you from continuing onward. ~ 0 0 7 @@ -1073,7 +1073,7 @@ You see a long hallway. S #1528 A Long Hallway~ -You are now inside of the fortress; you must be lucky that the guards +You are now inside of the fortress; you must be lucky that the guards haven't killed you. As you glance around, you notice that the walls and floors are spotlessly cleaned. The barracks are to the north and a storage room is to the south. @@ -1102,7 +1102,7 @@ You see a long hallway. S #1529 A Long Hallway~ -You are now inside of the fortress; you must be lucky that the guards +You are now inside of the fortress; you must be lucky that the guards haven't killed you. As you glance around, you notice that the walls and floors are spotlessly cleaned. A mess hall is to the south. ~ @@ -1184,7 +1184,7 @@ You see a small room. S #1534 The Mess Hall~ -You are in the room where the guards come to get their grub. The benches +You are in the room where the guards come to get their grub. The benches and tables are neatly cleaned and straightened, while shiny plates line the walls. ~ @@ -1262,7 +1262,7 @@ D3 0 -1 1537 E machine~ -The machine consists of a large rack with winches on each end. You can +The machine consists of a large rack with winches on each end. You can almost feel them pulling your arms out of their sockets. ~ S @@ -1571,7 +1571,7 @@ You see a path. S #1559 The Unused Path~ -You are now on a fairly unused path that leads east out of the village. +You are now on a fairly unused path that leads east out of the village. You wonder what could be out this way. ~ 0 C 1 diff --git a/src/area/grave.are b/src/area/grave.are index 205edcc..9f18667 100644 --- a/src/area/grave.are +++ b/src/area/grave.are @@ -243,7 +243,7 @@ grate is to the north and narrow gravel paths lead east and west. ~ 0 0 2 D0 -Through the solid iron bars you see Elm Street. +Through the solid iron bars you see Elm Street. ~ grate~ 1 3121 3124 diff --git a/src/area/group.are b/src/area/group.are index 8d8c78e..247613a 100644 --- a/src/area/group.are +++ b/src/area/group.are @@ -17,14 +17,14 @@ For more information, see the help files for each race (i.e. 'help dwarf') -1 DWARF DWARVES~ Dwarves are short, stocky demi-humans, known for foul temper and great stamina. Dwarves have high strength and constitution, but poor dexterity. -They are not as smart as humans, but are usually wiser due to their long +They are not as smart as humans, but are usually wiser due to their long lifespans. Dwarves make excellent fighters and priests, but are very poor -mages or thieves. +mages or thieves. Dwarves are very resistant to poison and disease, but cannot swim, and so are very vulnerable to drowning. They recieve the berserk skill for free (if warriors), and can see in the dark with infravision. -~ +~ -1 ELF ELVES~ Elves are slightly taller than humans, but have a much lighter build. They @@ -34,7 +34,7 @@ best fair talent as warriors or priests. Elves resist charm spells most effectively, due to their magical nature. However, they are burned by the touch of iron, and so are barred from the -use of iron or steel in their adventuring careers. Elves are notoriously +use of iron or steel in their adventuring careers. Elves are notoriously hard to spot, and so elven warriors and thieves recieve the sneak and hiding automatically. They may see in the dark with infravision. ~ @@ -49,7 +49,7 @@ gain more benefit from magical devices. -1 GIANT GIANTS~ Giants are the largest of the races, ranging from 9-12 feet in height. They -are stronger than any other race, and almost as durable as the dwarves. +are stronger than any other race, and almost as durable as the dwarves. They aren't too bright, however, and their huge size makes them more clumsy than the other races. Giants make the best warriors of any race, but are ill-suited for any other profession. @@ -67,9 +67,9 @@ item skills are as follows: scrolls The reading of magical scrolls and books (see 'help recite') staves The use of staves and similar devices (see 'help brandish') -wands The use of wands and similar items (see 'help zap') +wands The use of wands and similar items (see 'help zap') ~ - + -1 'GROUP HEADER'~ The following skills and groups are available to your chacter: (this list may be seen again by typing list) @@ -78,7 +78,7 @@ The following skills and groups are available to your chacter: -1 'GROUP HELP'~ The following commands are available: list display all groups and skills not yet bought -learned show all groups and skills bought +learned show all groups and skills bought premise brief explanation of creation points and skill groups add buy a skill or group drop discard a skill or group @@ -93,22 +93,22 @@ Choice (add,drop,list,help)?~ -1 'GROUPS' 'INFO' 'PREMISE'~ The ROM skill system allows you to fully customize your new character, making him or her skilled in the skills you choose. But beware, the skills you pick -at character creation are the only skills you will ever learn. Skills are +at character creation are the only skills you will ever learn. Skills are paid for with creation points, and the more creation points you have, the harder it is to gain a level. Furthermore, higher-cost skills are harder to practice. Skill groups are like package deals for characters -- sets of skills or spells -that are closely related, and hence can be learned as a unit. There is a -default skill group for each class, which can be selected for a balanced +that are closely related, and hence can be learned as a unit. There is a +default skill group for each class, which can be selected for a balanced selection of skills at a somewhat reduced cost. -The experience breakdown is as follows: +The experience breakdown is as follows: points exp/level points exp/level 40 1000 90 6000 50 1500 100 8000 60 2000 110 12000 -70 3000 120 16000 +70 3000 120 16000 80 4000 130 24000 The table continues in a similar manner for higher point totals. ~ @@ -131,7 +131,7 @@ for class defaults, check the classes themselves. Mages specialize in the casting of spells, offensive ones in particular. Mages have the highest-powered magic of any class, and are the only classes able to use the draconian and enchanting spell groups. They are also very -skilled at the use of magical items, though their combat skills are the +skilled at the use of magical items, though their combat skills are the weakest of any class. All mages begin with skill in the dagger. Any other weapon skills must be @@ -156,12 +156,12 @@ weather spells for conjuring and mastering the elements -1 CLERIC 'CLERIC BASICS' 'CLERIC DEFAULT'~ Clerics are the most defensively orientated of all the classes. Most of their spells focus on healing or defending the faithful, with their few combat spells -being far less powerful than those of mages. However, clerics are the best +being far less powerful than those of mages. However, clerics are the best class by far at healing magics, and they posess an impressive area of protective magics, as well as fair combat prowess. All clerics begin with skill in the mace. Other weapon or shield skills must -be purchased, many at a very dear cost. The default skill selection for +be purchased, many at a very dear cost. The default skill selection for clerics is as follows: skills: @@ -187,7 +187,7 @@ thievery and covert actions, being capable of entering areas undetected where more powerful adventurers would fear to tread. They are better fighters than clerics, but lack the wide weapon selection of warriors. -All thieves begin with the dagger combat skill, and are learned in steal as +All thieves begin with the dagger combat skill, and are learned in steal as well. Any other weapon skills must be purchased, unless the default selection is chosen. This default skill package includes: @@ -230,7 +230,7 @@ Each weapon skill applies to a specific group of armaments, and determines how well a character fights with a particular weapon. The weaponsmaster group provides talent in all weapons (save exotics), from chair legs to halberds. If the character has the parry skill as well, he can parry incoming attacks. -The chance of parrying is best if the character in question is skilled at +The chance of parrying is best if the character in question is skilled at both his weapon and his opponent's. The weapon skills consist of the following: @@ -260,8 +260,8 @@ whips have an easier time getting around them. Axes may split shields in two. -1 ATTACK~ The attack spells are essentially powerful curses, fueled by divine energy rather than magical power (like the combat spells are). They are less powerful -than the combat spells, but can still deal out a stinging blow. Mages and -thieves cannot use this group. The attack spell group consists of the +than the combat spells, but can still deal out a stinging blow. Mages and +thieves cannot use this group. The attack spell group consists of the following spells: demonfire a powerful, but very evil, spell @@ -286,7 +286,7 @@ sleep puts a foe into enchanted slumber -1 BENEDICTIONS~ Benedictions are priestly spells, used to bestow divine favor upon your allies. -They are often restricted to those of like alignment. Only clerics and +They are often restricted to those of like alignment. Only clerics and warriors may use these spells. The benedictions spell group consists of the following: @@ -312,12 +312,12 @@ lightning bolt sends forth a single bolt of lightning into an enemy colour spray blasts your opponent with a rainbow spray, which may blind him fireball a powerful spell, great for burning your enemy to ashes acid blast sends forth a stream of acid to eradicate your foes -chain lightning sends lightning bolts arcing through foes +chain lightning sends lightning bolts arcing through foes ~ -1 CREATION~ The creation spell group is used to create objects, of temporary or permanent -duration. Skill creators can travel without food or drink, and use their +duration. Skill creators can travel without food or drink, and use their powers to create nourishment as required. All classes may become learned in this group, which contains these spells: @@ -342,7 +342,7 @@ cure poison removes the harmful effects of poison -1 DETECTION~ The detection spells have may uses, all related to gathering information. They can be used to see hidden objects, give information about treasure, or even -scry out the true nature of your foe. All classes except warriors can use +scry out the true nature of your foe. All classes except warriors can use detection spells. detect evil reveals the aura of evil monsters @@ -358,7 +358,7 @@ locate object finds a specific item ~ -1 DRACONIAN~ -The Draconian spell group deals with the magic of dragons -- in this case, +The Draconian spell group deals with the magic of dragons -- in this case, bringing forth the devastating power of their breath weapons upon your foes. Only mages have the mental training necessary to cast these spells, and few of them ever reach the level of mastery required to use them. @@ -367,12 +367,12 @@ acid breath uses the black dragon's attack upon an enemy fire breath calls forth the flames of a red dragon frost breath drains the life from a foe with the power a white dragon gas breath suffocates your enemies with poison gas -lightning breath summons the electrical fury of a blue dragon +lightning breath summons the electrical fury of a blue dragon ~ -1 ENCHANTMENT~ The enchantment spell group is used to imbue items with magical properties. -Currently, this spell group consists of enchant weapon and enchant armor, +Currently, this spell group consists of enchant weapon and enchant armor, although more will be added in the future. Only mages may enchant. enchant weapon increases the hit and damage bonuses of a weapon @@ -423,7 +423,7 @@ mass healing casts a heal spell on each player in the room The illusions spells are dedicated to deception and trickery. They can be used to mask appearances, or create distractions for the party. Currently, the illusion group is very small, but it will be expanded in the future. -Only thieves and mages can cast illusion spells, which consist of the +Only thieves and mages can cast illusion spells, which consist of the following: invis turns the target invisible @@ -441,7 +441,7 @@ curse prevents recalling and weakens the target in combat energy drain drains experience and mana, while strengthening the caster plague causes the target to suffer a slow, painful death from plague poison weaker than plague, but often fatal -slow slows your enemies down, reducing their rate of attack +slow slows your enemies down, reducing their rate of attack weaken drains the strength of the target ~ @@ -449,7 +449,7 @@ weaken drains the strength of the target The protective spells are used to shield against harm, whether from spells or physical attack. They range from the weak armor spell to the sought-after sanctuary charm. Also included in this group are several spells for dispeling -hostile magics. Any class may use this group, which consists of the following +hostile magics. Any class may use this group, which consists of the following spells: armor provides the target with an extra layer of defense @@ -493,7 +493,7 @@ lightning bolt sends a bolt of electricity into the target ~ -1 BACKSTAB~ -Backstab is the favored attack of thieves, murderers, and other rogues. It +Backstab is the favored attack of thieves, murderers, and other rogues. It can be used with any weapon type, but is most effective with piercing weapons. The damage inflicted by a backstab is determined by the attacker's level, his weapon skill, his backstab skill, and the power of his opponent. @@ -510,12 +510,12 @@ is not generally a wise idea. -1 BERSERK~ Only powerful warriors can master berserking, the ability to enter insane rage in combat. Its effects are not altogether unlike the frenzy spell -- a huge -surge of combat prowess, coupled with a disregard for personal safety. +surge of combat prowess, coupled with a disregard for personal safety. Berserking warriors are more resistant to the effects of magic. ~ -1 DIRT 'DIRT KICKING'~ -Consider by some to be a cowardly skill, dirt kicking gives the clever +Consider by some to be a cowardly skill, dirt kicking gives the clever combatant a chance to blind his opponent by casting dirt into his eyes. The blindness does not last long, but can provide an edge in combat. Dexterity helps in hitting or avoiding a dirt kick. Only warriors and thieves may @@ -532,7 +532,7 @@ and warriors may learn this skill. -1 DODGE~ In the words of one wise warrior, 'the best way to block a blow is to not be where it lands'. The dodge skill honors this tradition, by improving the -character's natural agility to the point where many blows will miss the +character's natural agility to the point where many blows will miss the target. The chance of dodging is also affected by the dexterity of the attacker and the target. Any class may learn dodging. ~ @@ -552,8 +552,8 @@ Food, drink, and weapons may be envenomed, with varying effects. Poisoned food or drink puts a mild poison spell on the consumer, and is unlikely to be more than a minor inconvience (after all, the typical adventurer could drink sewer water with only a trace of the runs). A poisoned weapon, on -the other hand, can inflict serious damage on an opponent as the poison -burns through his bloodstream. But be careful, blade venom evaporates +the other hand, can inflict serious damage on an opponent as the poison +burns through his bloodstream. But be careful, blade venom evaporates quickly and is rendered almost powerless by repeated blows in combat. ~ @@ -573,7 +573,7 @@ it. ~ -1 PARRY~ -If at first you fail to dodge, block it. Parry is useful for deflecting +If at first you fail to dodge, block it. Parry is useful for deflecting attacks, and is succesful more often than dodge. Parry requires a weapon for full success, the hand-to-hand skill may also be used, but results in reduced damage instead of no damage. The best chance of parrying occurs when the @@ -599,7 +599,7 @@ find the attack easy to avoid. Thieves and warriors may learn trip. -1 'SECOND ATTACK'~ Training in second attack allows the character a chance at additional strikes in combat -- allow a 100% second attack does NOT guarantee 2 attacks every -round. Any class may learn this skill, although clerics and mages have a +round. Any class may learn this skill, although clerics and mages have a very hard time with it. ~ @@ -620,8 +620,8 @@ thieves may learn these skills. -1 'FAST HEALING'~ The fast healing skill improves wound healing rates, whether walking, resting, -or sleeping. It represents knowledge of healing herbs or just general -toughness and stamina. Fast healing is checked every tick, and it is +or sleeping. It represents knowledge of healing herbs or just general +toughness and stamina. Fast healing is checked every tick, and it is possible for it to fail. All class may learn this skill, but mages find it very difficult to master, due to their bookish lifestyle. ~ @@ -638,9 +638,9 @@ to use. -1 HAGGLE HAGGLING~ Haggling is an indispensable skill to the trader. It allows a character to match wits with a merchant, seeking to get a better price for merchandise, -or to buy at the lowest possible cost. Unfortunately, most merchants are -already very skilled at haggling, so the untrainined adventurer had best -guard his treasure closely. Thieves are natural masters at haggling, +or to buy at the lowest possible cost. Unfortunately, most merchants are +already very skilled at haggling, so the untrainined adventurer had best +guard his treasure closely. Thieves are natural masters at haggling, although other classes may learn it as well. ~ @@ -653,7 +653,7 @@ common practicioners. -1 PICK 'PICK LOCK'~ Lock picking is one of the prime skills of thieves, allowing them to gain -access to many secured areas. Lock picking chances are improved by +access to many secured areas. Lock picking chances are improved by intelligence, and hindered by the difficulty of the lock. Other classes may learn to pick locks, but they will never find it easy. ~ @@ -668,22 +668,22 @@ much trouble learning to meditate. -1 STEAL~ Theft is the defining skill of the thief, and is only available to that class. It allows items to be stolen from the inventory of monsters and characters, -and even from shops! But beware, shop keepers gaurd their merchandise +and even from shops! But beware, shop keepers gaurd their merchandise carefully, and attempting to steal from a character earns you a THIEF flag if you are caught (making you free game for killing). -~ +~ -1 'DETECT GOOD'~ Syntax: cast 'detect good' - + This spell enables the caster to detect good characters, which will reveal a characteristic golden aura. ~ -1 'DISPEL GOOD'~ Syntax: cast 'dispel good' - -Dispel good brings forth evil energies that inflict horrific torment on + +Dispel good brings forth evil energies that inflict horrific torment on the pure of heart. Good-aligned characters use this dark magic at their peril. ~ @@ -702,7 +702,7 @@ recharged one time successfully. Syntax: cast 'demonfire' Demonfire is a spell of blackest evil, and as such can only be used by those -who follow the paths of darkness. It conjures forth demonic spirits to +who follow the paths of darkness. It conjures forth demonic spirits to inflict terrible wounds on the enemies of the caster. ~ @@ -711,7 +711,7 @@ Syntax: cast 'ray of truth' Ray of truth opens a portal to the planes of positive energy, bringing forth a beam of light of sufficient purity to harm or or annihilate the servants -of evil. It cannot harm the pure of heart, and will turn and strike +of evil. It cannot harm the pure of heart, and will turn and strike casters who are tainted by evil. ~ @@ -730,7 +730,7 @@ secret of this material component has been lost... Syntax: cast 'nexus' This spell is virtually identical to portal (see 'help portal'), with the -only difference being that while portal creates a one-way gate, a nexus +only difference being that while portal creates a one-way gate, a nexus spell makes a two-sided gate. It also lasts longer than the lower-powered portal spell. Both spells require an additional power source, the secret of which has been lost... @@ -739,7 +739,7 @@ of which has been lost... -1 'HEAT METAL'~ Syntax: cast 'heat metal' -Heat metal is a powerful clerical attack spell, with effects that vary +Heat metal is a powerful clerical attack spell, with effects that vary according to the armor of the victim. It heats up the metal equipment (assumed to be all weapons and armor at this point in time) on the target, causing him or her to drop them if possible, taking serious burns in the @@ -756,7 +756,7 @@ blessings on the priest's allies. All creatures of like alignment in the room are blessed and filled with righteous divine wrath, while those of opposite morals (or both good and evil in the case of neutral priests) are struck down by holy (or unholy might) and cursed. The cleric suffers -greatly from the strain of this spell, being left unable to move and +greatly from the strain of this spell, being left unable to move and drained of vitality. Experience loss is no longer associated with the spell. ~ @@ -765,19 +765,19 @@ Syntax: cast 'frenzy' The frenzy spell fills the target with righteous fury, greatly increasing his or her attack skill and damaging capacity. Unfortunately, this divine -wrath is coupled with a tendency to ignore threats to personal safety, +wrath is coupled with a tendency to ignore threats to personal safety, making the character easier to hit. Frenzy provides immunity to the calm -spell (see 'help calm'), and may only be used on those of the caster's +spell (see 'help calm'), and may only be used on those of the caster's alignment. ~ -1 CALM~ -Syntax: cast 'calm' +Syntax: cast 'calm' One of the most useful and often overlooked abilities of the master cleric is the calm spell, which can put an end to all violence in a room. Calmed creatures will not attack of their own volition, and are at a disadvantage -in combat as long as the spell soothes their minds. The more violence +in combat as long as the spell soothes their minds. The more violence activity there is in a room, the harder the spell, and it is all or nothing -- either all combat in the room is ended (with the exception of those who are immune to magic) or none is. @@ -830,7 +830,7 @@ time. ~ 0 'GIANT STRENGTH'~ Syntax: cast 'giant strength' - + This spell increases the strength of the target character. ~ @@ -839,7 +839,7 @@ Syntax : cast 'chain lightning' Chain lightning is a deadly spell, producing a powerful bolt of lightning that arcs from target to target in the room, until its force is fully -expended. Allies of the caster may be hit by this spell if they are members +expended. Allies of the caster may be hit by this spell if they are members of a clan, while the caster himself will not be struck unless no other viable target remains. Chain lightning is most effective when used on groups of creatures. @@ -858,7 +858,7 @@ farther away. ~ -1 MASS HEALING~ -Syntax: cast 'mass healing' +Syntax: cast 'mass healing' The mass healing spell, as its name might suggest, performs a healing spell on all players in the room. It also throws in a refresh spell for good @@ -871,7 +871,7 @@ Syntax: cast 'floating disc' This useful spell creates a floating field of force which follows the caser around, allowing him or her to pile treasure high with no fear of weight penalties. It lasts no more than twice the casters level in hours, and -usually less. It can hold 10 pounds per level of the caster, with a +usually less. It can hold 10 pounds per level of the caster, with a maximum of five pounds per item. The spell requires an open float location on the character, and the only way to remove the disc is to die or allow it to run out of energy. @@ -895,8 +895,8 @@ Syntax: alias The alias command allows limited shortening of command names. At this time, aliases cannot call other aliases, and cannot generate more than one command. -Alias by itself lists your current aliases, Alias lists the alias with -that name (if such exist), and alias with both a word and and argument +Alias by itself lists your current aliases, Alias lists the alias with +that name (if such exist), and alias with both a word and and argument produces a new alias. You cannot alias either alias or unalias to a new command. Examples of use: diff --git a/src/area/grove.are b/src/area/grove.are index 09cc091..3a59c17 100644 --- a/src/area/grove.are +++ b/src/area/grove.are @@ -86,7 +86,7 @@ oldstyle deer~ a deer~ A deer is here, staring back at you. ~ -The deer looks angered at your intrusion. He butts his head against you, +The deer looks angered at your intrusion. He butts his head against you, albeit ineffectively. ~ human~ @@ -227,7 +227,7 @@ trash 0 AO 0 10 0 P E paper wad~ -It looks old and worn, but You can still make out a faint lettering on it, +It looks old and worn, but You can still make out a faint lettering on it, written in a strange, alien hand: o WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! o @@ -391,7 +391,7 @@ S A clearing in the woods~ You are standing in a clearing in the light woods. Somehow, this place seems powerfully DIFFERENT from the rest of the forest, as if something is -severely strained in the fabric of reality here. There is a small tablet +severely strained in the fabric of reality here. There is a small tablet on one of the trees. ~ 0 C 3 @@ -757,10 +757,10 @@ S The greenhouse~ This is Dragons' greenhouse. Green light filters in slantwise through the plants, giving the room a subtropical ambience. It is not really hot in here, -though, rather a pleasantly warm temperature. The walls are all windows, except -the eastern one joining the greenhouse to the main building, but it is hard to +though, rather a pleasantly warm temperature. The walls are all windows, except +the eastern one joining the greenhouse to the main building, but it is hard to see out for all the greenery here. There is a set of easy-chairs and a glass -coffee table. To the south, there is a wide double door out to a sunlit +coffee table. To the south, there is a wide double door out to a sunlit terrace. ~ 0 DJ 0 @@ -798,13 +798,13 @@ painting paintings~ There are many, many beautiful paintings of famous dragons of history and literature. There is a big one of Smaug, a group picture of Cuspidorian Toxic Dragons, a rather fearsome picture of Norse Chaos incarnate, a grainy black- -and-white photograph of Vorgulremik the Steel Dragon, a romantic picture of +and-white photograph of Vorgulremik the Steel Dragon, a romantic picture of Dalvenjah the Mindijaran and Allan the man become dragon. There are three empty frames labeled 'The Chimerical', 'The Mythical' and 'The Hypothetical', -A panoramic picture of Strabo flying between the worlds dominate one wall, -while a dragons-eye view of Pern (with dragons in the foreground, of course) -fills another. There even are a few rare medieval renditions of the great -beast of the Revelation. Over the head of the table hangs a rather modest +A panoramic picture of Strabo flying between the worlds dominate one wall, +while a dragons-eye view of Pern (with dragons in the foreground, of course) +fills another. There even are a few rare medieval renditions of the great +beast of the Revelation. Over the head of the table hangs a rather modest portrait of a silver Dragon, sparkling with blue lightening, looking amused. ~ S @@ -852,7 +852,7 @@ A wide road lies to the south. S #8951 Inside the grove~ -As you walk among the stately oaks of this grove, you feel at peace and +As you walk among the stately oaks of this grove, you feel at peace and in harmony with this beautiful forest. If only the rest of the lands were so tranquil. The trail turns towards the east, leading into the secluded trees of the druids' holy grove, and a path back to the eastern road lies @@ -873,7 +873,7 @@ S #8999 The fog~ You are in a grey fog, falling, screaming in pain as you realize -that you are being torn to nothing, atom by atom, falling and falling +that you are being torn to nothing, atom by atom, falling and falling and falling ... ... . diff --git a/src/area/haon.are b/src/area/haon.are index bf3df84..32d65fa 100644 --- a/src/area/haon.are +++ b/src/area/haon.are @@ -1844,7 +1844,7 @@ S A junction on the river bank in the deep, dark forest~ You are by a junction where three paths meet. Ancient, grey trees seem to observe you silently you from all around. To the south a dark river flows from -east to west through the forest. Paths lead north, east and west. +east to west through the forest. Paths lead north, east and west. ~ 0 AD 3 D0 diff --git a/src/area/help.are b/src/area/help.are index b728d66..d99acd3 100644 --- a/src/area/help.are +++ b/src/area/help.are @@ -21,7 +21,7 @@ Developed at: DIKU -- The Department of Computer Science -1 GOLD SILVER MONEY~ Midgaard's economy is based on gold and silver coinage (and the lowly copper, which you as an adventurer are far too proud to carry). Gold coins are worth -100 silver coins, but are also four times as heavy (25 to the pound, as +100 silver coins, but are also four times as heavy (25 to the pound, as opposed to 100 to the pound for silver). Gems can be bought to alleviate weight problems from the Midgaard jeweller, he charges a mere 10% more than they are worth. 10 gems weigh one pound, and they can be worth more than 100 gold pieces for @@ -31,7 +31,7 @@ the highest quality stones. 0 BRIEF COMPACT~ Brief and compact help set your display options for the game. Typing brief toggles on and off the showing of room descriptions when you move around -(considerably reducing the text to be processed), and typing compact +(considerably reducing the text to be processed), and typing compact removes the extra blank line before your prompt. ~ @@ -39,7 +39,7 @@ removes the extra blank line before your prompt. The deaf toggle turns off incoming tells, helpfull if you are being bombarded by messages from other players. You can still use reply (see 'help reply') to reply to people who were telling you before you went deaf, although you -cannot reply to a deaf person unless you or they are a diety (it's mostly +cannot reply to a deaf person unless you or they are a diety (it's mostly useful for sending a quick "I'm being spammed so I went deaf" message to a person). ~ @@ -60,13 +60,13 @@ reading them). Syntax: prompt Syntax: prompt all Syntax: prompt <%*> - + PROMPT with out an argument will turn your prompt on or off. - + PROMPT ALL will give you the standard "" prompt. - + PROMPT <%*> where the %* are the various variables you may set yourself. - + %h : Display your current hits %H : Display your maximum hits %m : Display your current mana @@ -83,10 +83,10 @@ PROMPT <%*> where the %* are the various variables you may set yourself. %c : Display a carriage return (useful for multi-line prompts) %R : Display the vnum you are in (IMMORTAL ONLY) %z : Display the area name you are in (IMMORTAL ONLY) - + Example: PROMPT <%hhp %mm %vmv> Will set your prompt to "<10hp 100m 100mv>" - + ~ -1 SUMMARY~ MOVEMENT GROUP @@ -121,7 +121,7 @@ Any spells which were affecting you are canceled by death. Following and groups are not affected by death. -You lose experience points for dying. The amount you lose is two-thirds of +You lose experience points for dying. The amount you lose is two-thirds of the way back to the beginning of your level. Corpses decay after time, and the objects inside corpses decay with them. @@ -134,7 +134,7 @@ from a player's corpse. 0 EXPERIENCE LEVEL XP~ -Your character advances in power by gaining experience. You need a set +Your character advances in power by gaining experience. You need a set amount of experience points for each level based on your creation points. You gain experience by: @@ -157,7 +157,7 @@ lately; and some random variation. 0 PET PETS~ -You can buy pets in the pet shop. You may own only one pet at a time, after +You can buy pets in the pet shop. You may own only one pet at a time, after the old one dies you may purchase a replacement. New pets are planned for a shop in New Thalos. @@ -260,14 +260,14 @@ INVENTORY lists your inventory. 0 COMPARE~ Syntax: compare Syntax: compare - + COMPARE compares two objects in your inventory. If both objects are weapons, it will report the one with the better average damage. If both objects are armor, it will report the one with the better armor class. - + COMPARE with one argument compares an object in your inventory to the object you are currently wearing or wielding of the same type. - + COMPARE doesn't consider any special modifiers of the objects. ~ @@ -321,7 +321,7 @@ Syntax: sleep Syntax: stand Syntax: wake -These commands change your position. When you REST or SLEEP, you +These commands change your position. When you REST or SLEEP, you regenerate hit points, mana points, and movement points faster. However, you are more vulnerable to attack, and if you SLEEP, you won't hear many things happen. @@ -371,7 +371,7 @@ note post : posts a new note. This MUST be done to post a note. When you log in, you will be informed if there are unread notes waiting. Type note read to scroll through them one at a time. -Four other note directories exist, these are ideas, news, changes, and +Four other note directories exist, these are ideas, news, changes, and penalties (gods only). They are used the exact same way, for example idea read 5 will read idea #5. Posting to the news and changes boards is restricted. The 'unread' command can be used to show your unread notes on @@ -386,7 +386,7 @@ Syntax: yell SHOUT sends a message to all awake players in the world. To curb excessive shouting, SHOUT imposes a three-second delay on the shouter. -GOSSIP and CGOSSIP are variants of SHOUT (without the delay). '.' is a +GOSSIP and CGOSSIP are variants of SHOUT (without the delay). '.' is a synonym for GOSSIP. YELL sends a message to all awake players within your area. @@ -487,12 +487,12 @@ Syntax: who WHO shows the people currently in the game. Some people may choose to remain unseen and won't appear on the WHO - + WHO without any arguments shows all of the (visible) people currently playing. With arguments, WHO can show players of certain classes or levels. For example: - + who 10 lists all players of level 10 or above who 15 20 lists all players between level 15 and 20 who cleric lists all clerics playing @@ -534,7 +534,7 @@ all the commands, spells, and skills listed in the game. 0 DESCRIPTION DESC~ Syntax: description Syntax: description + -Syntax: description - +Syntax: description - Sets your long description to the given string. If the description string starts with a '+', the part after the '+' is appended to your current @@ -620,7 +620,7 @@ When multiple items of the same name are listed, type 'buy n.item', where n is the position of the item in a list of that name. So if there are two swords, buy 2.sword will buy the second. If you want to buy multiples of an item, use an * (buy 5*pie will buy 5 pies). These can be combined into -(for example) buy 2*2.shield, as long as the * is first. +(for example) buy 2*2.shield, as long as the * is first. LIST lists the objects the shop keeper will sell you. List shows you only objects of that name. @@ -641,7 +641,7 @@ The nature of the reward depends upon the type of object. Syntax: scroll Syntax: scroll -This command changes the number of lines the mud sends you in a page (the +This command changes the number of lines the mud sends you in a page (the default is 24 lines). Change this to a higher number for larger screen sizes, or to 0 to disabling paging. ~ @@ -716,7 +716,7 @@ will block all other command for about 20 seconds, so use it sparingly. Some objects, such as keys and potions, may not be saved. -QUIT leaves the game. You may QUIT anywhere. When you re-enter the game +QUIT leaves the game. You may QUIT anywhere. When you re-enter the game you will be back in the same room. QUIT automatically does a SAVE, so you can safely leave the game with just one @@ -735,7 +735,7 @@ back to the Temple of Midgaard. '/' is a synonym for RECALL. If you RECALL during combat, you will lose experience (more than for fleeing), and you will have a chance of failing (again, more than for fleeing). This -chance is based on your recall skill, although a 100% recall does not +chance is based on your recall skill, although a 100% recall does not insure success. RECALL costs half of your movement points. @@ -834,7 +834,7 @@ the ban list, if the remover is of equal or higher level than the banner. A site may have all players, new players, or non-permitted players (set by editing the player file) banned, by changing the argument after the site. -*s may be used to ban either by suffix (*.edu), prefix (labmac*), or +*s may be used to ban either by suffix (*.edu), prefix (labmac*), or content (*andrews*), but be careful not to accidently lock out too many sites with a wildcard. Bans do not save unless the permban command is used. ~ @@ -885,7 +885,7 @@ players. Syntax: freeze FREEZE is a toggle which prevents a character from issuing any -commands at all. It can be removed from within the game, so freezing a +commands at all. It can be removed from within the game, so freezing a troublemaker is usually a better option than they deny command. ~ @@ -896,7 +896,7 @@ Syntax: force all FORCE forces one character to execute a command, except of course delete. Below level 57 (Deity) force can only be used on mobiles, and force all is -unavailable. You also cannot 'force orc murder hugo', for example. +unavailable. You also cannot 'force orc murder hugo', for example. FORCE 'all' forces all player characters to execute a command. This is typically used for 'force all save'. @@ -904,11 +904,11 @@ This is typically used for 'force all save'. 56 SOCKETS~ Syntax: sockets - sockets + sockets -SOCKETS reports all of the visible users connected to the server, including -users in the process of logging in. The two numbers inside brackets are the -channel number and the 'connected' state. The 'connected' states are listed in +SOCKETS reports all of the visible users connected to the server, including +users in the process of logging in. The two numbers inside brackets are the +channel number and the 'connected' state. The 'connected' states are listed in merc.h: 0 is CON_PLAYING; non-zero values are various states of logging in. The optional name argument shows the site of a player, or optional can be used @@ -920,7 +920,7 @@ into an orc). Syntax: load mob load obj -The load command is used to load new objects or mobiles (use clone to +The load command is used to load new objects or mobiles (use clone to duplicate strung items and mobs). The vnums can be found with the vnum command, or by stat'ing an existing mob or object. @@ -955,7 +955,7 @@ The sset command is a shortcut for `set skill`. ~ 58 at~ -Syntax: at +Syntax: at THIS NEEDS A HELPFILE ~ @@ -1039,7 +1039,7 @@ Syntax: owhere owhere command will allow you to find the vnum and location of keywords. The result is the short description, vnum, and then the room or mob that carries It -along with the room vnum. +along with the room vnum. <551hp 218m 454mv> owhere vorpal 1) the Vorpal Blade (10407) is carried by skeletal warrior [Room 10426] @@ -1056,9 +1056,9 @@ Syntax: transfer transfer all Transfer transfers the target character, or ALL player characters, -to your current location (default) or to a specified location. Trans all +to your current location (default) or to a specified location. Trans all should almost never be used, as 100 players popping into one room can have -horrible effects on slow links. Teleport is a synonym for transfer. +horrible effects on slow links. Teleport is a synonym for transfer. ~ 54 DOAT~ @@ -1110,7 +1110,7 @@ easily. Without holy light, you can see what mortal players see. Wizinvis takes a level argument, and will mke you invisible to all players of a lower level than your invisibility level. It defaults to the maximum -(your level) if no argument is given. Wizi 60 characters are totally +(your level) if no argument is given. Wizi 60 characters are totally invisible. ~ @@ -1119,7 +1119,7 @@ Toggling your incognito status will hide your presence from people outside the room you are in, but leave you visible to those who are with you. It takes a level argument similar to wizinvis, people at that level or higher can see you regarless of location. -~ +~ 52 MEMORY~ Syntax: memory @@ -1156,7 +1156,7 @@ Syntax: stat The stat command gives you detailed information on an object, mobile, or room within the game. Without a class argument, the command will return a object -(if found), a mobile (if no object exists, but a mobile does), or a room +(if found), a mobile (if no object exists, but a mobile does), or a room (if a number is given). Stat room with no argument stats the room you are standing in. Stat can be used to find room vnums for goto. (see also goto, transfer) @@ -1191,7 +1191,7 @@ Poofin and poofout only show to characters who can see you. 59 PROTECT~ Syntax: protect -Protect is used to protect a character from unwanted snooping. Removing +Protect is used to protect a character from unwanted snooping. Removing protected status from a character WILL be seen by that character. ~ @@ -1239,14 +1239,14 @@ turns it back on). ~ 52 WIZNET~ -Syntax: wiznet +Syntax: wiznet wiznet show wiznet status wiznet Wiznet is sort of an immortal news service, to show important events to -the wiznetted immoral. Wiznet by itself turns wiznet on and off, -wiznet show lists all settable flags (they are not detailed here), +the wiznetted immoral. Wiznet by itself turns wiznet on and off, +wiznet show lists all settable flags (they are not detailed here), wiznet status shows your current wiznet settings, and wiznet toggles a field on and off. The events should be self-explanatory, if they are not, fiddle with them a while. More events are available at higher levels. @@ -1443,13 +1443,13 @@ dangerous for casters who are not pure of heart. 0 'DISPEL MAGIC' CANCELLATION~ Syntax: cast 'dispel magic' cast 'cancellation' - + Both of these spells remove magical effects from the target. Dispel magic has a reduced chance of working, and is considering an attack spell. Cancellation can only be used on allies, but is much more effective and does not provoke attack. Unfortunately, the spells do not discriminate between harmful and benign spells. - + The chance of dispelling is based on the level of the spell. Permanent spells (such as mobile sanctuary) are much harder to remove. Not all spells may be dispelled, notable examples are poison and plague. @@ -1527,7 +1527,7 @@ This spell enables the target character to see warm-blooded creatures even while in the dark, and exits of a room as well. ~ -0 INVIS 'MASS INVIS' INVISIBLITY~ +0 INVIS 'MASS INVIS' INVISIBLITY~ Syntax: cast 'invisibility' Syntax: cast 'invisibility' Syntax: cast 'mass invis' @@ -1564,7 +1564,7 @@ Syntax: cast poison This spell reduces the strength of the victim by two, as well as reducing the victim's regeneration rate. It may also be used to poison food, drink, or -a weapon in a fashion similar to envenom ('help envenom'), but with +a weapon in a fashion similar to envenom ('help envenom'), but with drastically reduced effectiveness. ~ diff --git a/src/area/hood.are b/src/area/hood.are index 99fb368..0239a4b 100644 --- a/src/area/hood.are +++ b/src/area/hood.are @@ -138,7 +138,7 @@ gang leader ogre~ the Ogre gang leader~ The Ogre gang leader snaps out his stiletto. "Care to dance?" ~ -He's smaller, but undoubtably smarter, than the Troll's leader. +He's smaller, but undoubtably smarter, than the Troll's leader. ~ human~ ABFGS 0 0 2101 diff --git a/src/area/immort.are b/src/area/immort.are index 4e77680..ee30278 100644 --- a/src/area/immort.are +++ b/src/area/immort.are @@ -33,7 +33,7 @@ The Chat Room~ You are lounging in a quiet cosy parlour, warmed by a gentle magical fire which twinkles happily in a warm fireplace. This is one of the many rooms where the heroes and gods come to socialize. It is by far one of the most -comfortable! +comfortable! ~ 0 DJQ 0 D2 @@ -73,9 +73,9 @@ S #1203 Valhalla~ This is the huge Hall of Valhalla, where the Gods rule supreme. The -cavernous building stretches infinitely in all directions. Valhalla +cavernous building stretches infinitely in all directions. Valhalla continues to the east, and the gods make their homes north and south of -the halls. The golden gates are to the west. You know not what lies +the halls. The golden gates are to the west. You know not what lies upward... ~ 0 DP 0 @@ -335,7 +335,7 @@ S Office~ The first thing you notice about this office is the floor; it is a black & white checkerboard pattern, with 8 squares to a side. The -south wall is a HUGE picture window that produces a magnificent view of +south wall is a HUGE picture window that produces a magnificent view of the land. In front of the window is a large desk. Completely covering the east wall is a bookshelf, that is crammed full. In the northwest corner, you notice a statue. @@ -348,14 +348,14 @@ door~ 1 -1 1217 E desk~ -This desk is much larger than anyone could possibly need. At one end you +This desk is much larger than anyone could possibly need. At one end you notice a large, disorderly mass of papers; it must be all his immortal paperwork. At the other end is a magnificent wooden inlaid board with handcrafted ebony and hardwood pieces. ~ E statue~ -You recognize this as a statue of Robert James Fischer, one of the most +You recognize this as a statue of Robert James Fischer, one of the most creative, if not eccentric, players of all time. The inscription on the base reads, "I like the moment when I crush a man's ego." ~ @@ -428,10 +428,10 @@ scratch on it. S #1213 Asgard~ -You stand on a huge expanse of glass. Below you are clouds and the +You stand on a huge expanse of glass. Below you are clouds and the pains of mortality. As you stand in Asgard, home of the bravest of the -brave, you are frozen in awe of the power held within these walls. A -huge mansion lies to the east beyond a set of magnificent golden doors. +brave, you are frozen in awe of the power held within these walls. A +huge mansion lies to the east beyond a set of magnificent golden doors. ~ 0 0 0 D0 @@ -462,7 +462,7 @@ The Rainbow Bridge is below you. You can barely see it through the clouds. S #1214 The Room of Lost Souls~ -This is the room full of souls that never made it to Asgard. They are +This is the room full of souls that never made it to Asgard. They are trapped here eternally, left to wander about in misery. They were infidels and cowards. Their cries of misery send a shiver down your spine. ~ @@ -474,8 +474,8 @@ D5 S #1215 Head of the Rainbow Bridge~ -Standing on the mortal end of the Rainbow Bridge, the bridge arches up -before you and seems to disappear into the clouds. You wonder if it is +Standing on the mortal end of the Rainbow Bridge, the bridge arches up +before you and seems to disappear into the clouds. You wonder if it is wise to venture upward into the realm of the gods. But it seems so calm and peaceful here that it would be a shame to leave... ~ @@ -515,7 +515,7 @@ S Valhalla~ You are standing in the halls of Valhalla. Pictures of Odin, Thor, Tyr, Loki, Freyr, Feyja, and Balder line the walls. The cavernous hall extends -to the east and west. Rooms belonging to the gods lie to the north and +to the east and west. Rooms belonging to the gods lie to the north and south. There appears to be an exit above you, but you do not know what is up there... ~ @@ -550,7 +550,7 @@ S Valhalla~ You are standing in the halls of Valhalla. Tapestries of the gods line the walls. A statue of Odin is here. The halls continue to the east and -west, and there are doors to the north and south of you. There is some +west, and there are doors to the north and south of you. There is some sort of exit above you, but you do not know where it leads... ~ 0 P 0 @@ -622,7 +622,7 @@ S #1220 On the Rainbow Bridge~ You have reached the center of the Rainbow Bridge. Clouds and mist swirl -around your feet. The view from here is incredible. It is little wonder +around your feet. The view from here is incredible. It is little wonder that the heavens were saved for the gods personal pleasures. ~ 0 0 1 @@ -644,9 +644,9 @@ into the blue sky. S #1221 The End of the Rainbow Bridge~ -You have reached the end of the Rainbow Bridge. Asgard stretches out above +You have reached the end of the Rainbow Bridge. Asgard stretches out above you. Looking around, you search for the legendary guardian of Asgard. The -clouds are far below you and a sense of beauty and peacefulness surrounds you. +clouds are far below you and a sense of beauty and peacefulness surrounds you. ~ 0 0 -1 D4 diff --git a/src/area/mahntor.are b/src/area/mahntor.are index c0ca722..bed56be 100644 --- a/src/area/mahntor.are +++ b/src/area/mahntor.are @@ -27,7 +27,7 @@ the Old Treant~ A huge, gnarled tree stands here, battered by age and nature. ~ The old tree looks as though the wind has battered and torn at it for years. -Very few leaves remain. Its limbs are crooked and gnarled. It moans as the +Very few leaves remain. Its limbs are crooked and gnarled. It moans as the wind pushes it back and forth. ~ human~ @@ -536,7 +536,7 @@ A 18 1 E gloves combat~ -These gloves are plated with metal plates that provide strength and +These gloves are plated with metal plates that provide strength and protection. ~ #2301 @@ -1682,7 +1682,7 @@ This is a small intersection. Paths lead east, west, and south. You are struck by the carnage here when you enter the clearing. There appears to have been a great battle here. Blood is everywhere and the ground is all torn up. Pieces of beaten armour and broken blades lie all around. Examining the tracks here -lead you to believe that the dead and wounded were dragged off in two +lead you to believe that the dead and wounded were dragged off in two directions, south and east. ~ 0 A 4 @@ -2039,7 +2039,7 @@ D1 S #2324 The Blood Sea Portal~ -You stand on a small pedestal like altar that has been built on the shore +You stand on a small pedestal like altar that has been built on the shore here. Standing here, you can look out across the sea. You can almost imagine that you see a far away island. Dominating the altar is a small blue portal of light. It is possible to walk south into the portal. The shore itself extends @@ -2430,8 +2430,8 @@ S #2343 Inside the gates~ You stand just north of the gates to the village. Looking around, you see many -crude huts and cooking fires. To the north, you see a huge fire pit. Behind -it, there appears to be a hut of sorts. Small paths lead east and west among +crude huts and cooking fires. To the north, you see a huge fire pit. Behind +it, there appears to be a hut of sorts. Small paths lead east and west among the crude huts. The gates to the south provide an exit from the village. ~ 0 0 1 @@ -2552,7 +2552,7 @@ The throne room~ You stand in a large, crudely decorated throne room. A huge throne adorned with humanoid skulls sits against the west wall. A crude, blood stained altar is against the east wall. A doorway is directly to the north, long strands of -beads blocking the view of the other side. Crude torches light the hall and +beads blocking the view of the other side. Crude torches light the hall and smoke clings to the ceiling. ~ 0 D 0 @@ -2827,7 +2827,7 @@ Before the gates of Mahn-Tor~ You stand at the edge of a high cliff. Directly south, set back off the cliff's edge, you see a huge pair of gates. These gates appear to be carved almost completely out of ice. A huge city and keep appear to be on the other -side of these gates. There is also a possibility of climbing down the cliff +side of these gates. There is also a possibility of climbing down the cliff face. ~ 0 0 5 @@ -3773,7 +3773,7 @@ E 1 2309 3 16 * a shortsword named "Nightbringer" M 0 2327 1 2374 1 * Tyrgoth E 1 2310 10 6 * a golden helm and visor E 1 2311 5 5 * a gilded gold breast plate -E 1 2312 15 4 * a billowing white cape +E 1 2312 15 4 * a billowing white cape E 1 2313 20 11 * a huge tower shield E 1 2314 3 16 * a huge mace named "Dawnbringer" M 0 2328 1 2391 1 * Amyrok diff --git a/src/area/marsh.are b/src/area/marsh.are index 0cf18a6..659eede 100644 --- a/src/area/marsh.are +++ b/src/area/marsh.are @@ -10,7 +10,7 @@ oldstyle troll~ a swamp troll~ A swamp troll charges towards you. ~ -This huge behemoth towers to a height of 15 feet. He sneers at you +This huge behemoth towers to a height of 15 feet. He sneers at you as he approaches and raises two black taloned claws to strike you. ~ troll~ @@ -84,7 +84,7 @@ a huge hairy beast~ A huge hairy beast shambles towards you with death in his eyes. ~ This huge beast stands about 20 feet in height and has huge green clawed -appendages. +appendages. ~ human~ ACFG DF -450 0 @@ -425,10 +425,10 @@ A gloomy path leads down the hill into the swamp. S #8305 An Oozing Bog~ -You stand in an oozing quagmire. A creaking beat fills the air, +You stand in an oozing quagmire. A creaking beat fills the air, accompanied by groans and soughing of the air. Several large winged beasts flap over you and send chilling glares your way. You feel out -of place, and feel that the occupants of this realm will soon +of place, and feel that the occupants of this realm will soon have you for a feast. ~ 0 A 5 @@ -541,8 +541,8 @@ S #8310 Gloomy Path Through the Marsh.~ To the north lies a hill, shrouded in dark clouds, and to the south lies -a huge patch of vegetation. You sense an evil presence and notice -a beast flying overhead to the south east, towards what looks to be a +a huge patch of vegetation. You sense an evil presence and notice +a beast flying overhead to the south east, towards what looks to be a huge fortress, half buried in the marsh. ~ 0 A 6 @@ -615,7 +615,7 @@ S #8313 By the Monolith.~ You are standing near a monolith which protrudes some 20 feet from the -marsh into the air. Its black obsidian surface shines darkly in the +marsh into the air. Its black obsidian surface shines darkly in the strange, almost unearthly light that enters through the clouds above. ~ 0 A 5 @@ -669,9 +669,9 @@ This is a huge obsidian stone block stuck in the marsh. S #8315 Northern Lake Side.~ -Floating on this boiling lake is not what you would consider an enjoyable -experience. Many a creature bumps the bottom of your boat, and glares -at you through unblinking eyes from the waters below. The southern +Floating on this boiling lake is not what you would consider an enjoyable +experience. Many a creature bumps the bottom of your boat, and glares +at you through unblinking eyes from the waters below. The southern portion of the lake looks calm and serene compared to this wild place. ~ 0 A 7 diff --git a/src/area/midennir.are b/src/area/midennir.are index 09257ab..139fa1f 100644 --- a/src/area/midennir.are +++ b/src/area/midennir.are @@ -519,7 +519,7 @@ The forest continues. S #3515 Light Forest~ -The forest is light here and you can easily pick your way through the +The forest is light here and you can easily pick your way through the trail. To the east, the forest becomes thick and darker. South, the trail continues. ~ @@ -755,7 +755,7 @@ S Along the Eastern Road~ You are travelling down the eastern road between Midgaard and the eastern lands. The road back to Midgaard is west of you, and a heavily guarded -checkpoint is east. A beautiful grove of trees is north, and a dirt path +checkpoint is east. A beautiful grove of trees is north, and a dirt path wanders off to the south. ~ 0 0 1 @@ -800,7 +800,7 @@ The road continues west towards midgaard. S #3528 Along the Eastern Road~ -You are walking along a well-travelled road, just east of a heavily +You are walking along a well-travelled road, just east of a heavily guarded checkpoint. You have covered about half the distance between the city of Midgaard and New Thalos. The air is getting drier and the heat more oppressive as you near the the barren wastes of the Sands of Sorrow. @@ -839,8 +839,8 @@ S Near the Sands of Sorrow~ The eastern road is losing ground to the creeping desert here. You stagger in the growing heat, and wonder if you have enough water. The endless waste -of the Sands of Sorrows is south, and the road continues east and west. The -sun paints illusions at the edge of your vision, one of them looks like a far +of the Sands of Sorrows is south, and the road continues east and west. The +sun paints illusions at the edge of your vision, one of them looks like a far off city... ~ 0 0 10 @@ -850,7 +850,7 @@ The road ahead is almost lost in the desert. ~ 0 -1 3531 D3 -You see a clearer section of road. +You see a clearer section of road. ~ ~ 0 -1 3529 @@ -880,7 +880,7 @@ The sun is hot enough to melt your armor, but salvation is at hand. To the east, you see the mighty gates of New Thalos, one of the most prosperous cities of all of Thera. To the south, you see the endless wasteland of the Sands of Sorrows, and to the west you can barely make out a faint, but well-used, -road leading to the City of Midgaard. +road leading to the City of Midgaard. ~ 0 0 10 D1 diff --git a/src/area/midgaard.are b/src/area/midgaard.are index 04bf07d..0d826bc 100644 --- a/src/area/midgaard.are +++ b/src/area/midgaard.are @@ -172,7 +172,7 @@ Hassan is here, waiting to dispense some justice. Big. Very big. Stupid. Very stupid. -Hassan, the guardian of the Temple of Mota, towers over you. He's over 12 +Hassan, the guardian of the Temple of Mota, towers over you. He's over 12 feet tall, every inch of it muscle. It would be a Bad Thing to commit a crime in his presence. ~ @@ -896,7 +896,7 @@ Melancholy~ Melancholy is here, digging through a pile of scrolls, papers, and maps. ~ Ragged brown hair frames a ghostly, pale face. Puffy eyelids surround two -sky blue, haunting eyes. An old, brown robe is wrapped around her frail +sky blue, haunting eyes. An old, brown robe is wrapped around her frail frame. She looks up from her pile of papers and maps and looks inquiringly at you, smiling faintly. ~ @@ -912,7 +912,7 @@ lister green tree snake~ Lister~ A green tree snake is sitting here on a pile of books. ~ -This is Melancholy's pet tree snake, Lister. Something seems odd about his +This is Melancholy's pet tree snake, Lister. Something seems odd about his jaw, almost as if he were smiling at you. He's quite friendly, but don't get him drunk. ~ @@ -2032,7 +2032,7 @@ map midgaard~ . * * * MIDGAARD * * * = = ========== = = - + Rainbow Bridge (Asgard and Valhalla) / North Temple Altar Mud School <--- ** NEWBIES ** @@ -2073,7 +2073,7 @@ Haon-Dor | Guild | Guild Wall Road ~ #3163 map thera~ -a map of Thera~ +a map of Thera~ A rolled up map is here.~ paper~ map 0 A @@ -2084,7 +2084,7 @@ map thera~ . * * * Northern Thera * * * = = ================== = = - + Moria Olympus New | Dwarven--Mines Mage Elven Valley | Ofcol--Ofcol +----Kingdom @@ -2109,7 +2109,7 @@ Grove---Galaxy Midgaard G'harne | \Holy (Harpies) | \ \ Elemental Miden'nir Church Mega-City Canyon (Goblins) Catacombs One - + This map shows just about all the major areas on ROM. This map is NOT drawn to scale, some of the directions were changed to make everything fit. This map shows the GENERAL location of an area with respect to the other areas. @@ -2128,7 +2128,7 @@ map southern midgaard~ . * * * SOUTHERN MIDGAARD * * * = = =================== = = - + West South Kate's East Bridge Bridge Diner Bridge | | | | @@ -2180,7 +2180,7 @@ map dwarven kingdom dwarf~ . * * * The Dwarven Kingdom * * * = = ===================== = = - + Dwarven Hospital | *Path to @@ -2212,7 +2212,7 @@ Bakery of Shop Barracks Path Midgaard <----Cross Dwarven South Roads Drop-off (Day-Care) - + *key required ~ #3166 @@ -2334,7 +2334,7 @@ map olympus~ . *****OLYMPUS***** ================= - + Bedroom | Northern @@ -2863,7 +2863,7 @@ appearance, and most of the walls are covered by ancient wall paintings picturing gods, giants and peasants. Large steps lead down through the grand temple gate, descending the huge mound upon which the temple is built and ends on the temple square below. - Equally large steps lead UP through a small door into the ENTRANCE to MUD + Equally large steps lead UP through a small door into the ENTRANCE to MUD SCHOOL. (type 'up' to go to MUD SCHOOL.) A small plaque is on this wall. ~ 0 CDS 0 @@ -3412,7 +3412,7 @@ S #3024 Eastern End of Poor Alley~ You are at the poor alley. South of here is the Grubby Inn and to the -east you see common square. Melancholy's map shop is north. The alley continues +east you see common square. Melancholy's map shop is north. The alley continues further west. ~ 0 S 1 @@ -3921,9 +3921,9 @@ The alley leads west. S #3046 Eastern end of Alley~ -You are standing at the eastern end of the alley, near the city walls. -Wall road loops around the city to your east, and you can see an old -three-story warehouse to the south. The Fountain of Youth Apothecary is +You are standing at the eastern end of the alley, near the city walls. +Wall road loops around the city to your east, and you can see an old +three-story warehouse to the south. The Fountain of Youth Apothecary is north. ~ 0 S 1 @@ -4257,7 +4257,7 @@ S Promenade~ The river gently flows west just north of here. The promenade continues both east and west. A rickety bridge crosses the river to the north, towards -the city dump (fortunately, the wind is blowing towards the dump today). +the city dump (fortunately, the wind is blowing towards the dump today). South of here you see the entrance to the park, and a small building seems to be just west of the entrance. Austral Square, home of Kate's Diner, lies to your east. @@ -4318,7 +4318,7 @@ S #3104 Northeast end of Concourse~ You are at the Concourse. The city wall is just east and Austral Square, -home of Kate's Diner, is west. Looking across the river you see an old +home of Kate's Diner, is west. Looking across the river you see an old warehouse. A strong stone bridge crosses the river to the north, where the concourse becomes wall road. The Concourse continues south along the wall. ~ @@ -4755,9 +4755,9 @@ The fresh young leaves of the elm tree wave gently in the wind. E sign~ The sign says :- - + Graveyard of Midgaard - + Many brave adventurers have found their final resting place here. Please show respect and do not desecrate their tombs. ~ @@ -4813,7 +4813,7 @@ S #3128 On the Concourse~ You are walking around the scenic concourse as it continues its path around -the city of Midgaard. The south gate of the city lies to your east, and the +the city of Midgaard. The south gate of the city lies to your east, and the southwestern corner of the city wall is west. Emerald Avenue stretches out to the north. ~ @@ -4885,7 +4885,7 @@ D2 S #3132 Emerald Avenue~ -You are standing on the north end of Emerald Avenue. To the north is +You are standing on the north end of Emerald Avenue. To the north is Austral Square and Kate's Diner, to the east is the small street Penny Lane. ~ 0 S 1 @@ -5144,12 +5144,12 @@ S #3160 Melancholy's Maps~ As you walk in, a sudden gust of wind enters the shop and sends several -scraps of paper fly around the room. You blink as the dust you've stirred -up stings your eyes, and take a look around the shop. This shop is cluttered -with old pieces of parchment, stacks of books, and odd scraps. A desk with -slightly less clutter than the rest of the shop is in front of you. A scroll -case full of scrolls is behind the desk. A bookcase is to the right of you, -and to the left is a window overlooking the Common Square. A small door, +scraps of paper fly around the room. You blink as the dust you've stirred +up stings your eyes, and take a look around the shop. This shop is cluttered +with old pieces of parchment, stacks of books, and odd scraps. A desk with +slightly less clutter than the rest of the shop is in front of you. A scroll +case full of scrolls is behind the desk. A bookcase is to the right of you, +and to the left is a window overlooking the Common Square. A small door, half hidden by a stack of books, leads to a room in the back of the shop. ~ 0 BCS 0 @@ -5175,12 +5175,12 @@ quite a few tomes written by someone named "Anson MacDonald". S #3161 Melancholy's Room~ -A faint smell of incense teases your nose as you enter this room. You +A faint smell of incense teases your nose as you enter this room. You step onto a soft bearskin rug and look around. A simple bed lies against the far wall. At the foot of it is a sturdy, ironbound chest, most likely full of Melancholy's trappings from her adventuring days. On a small table under a window to the east is a vase with a single white rose. Other than -that, the room is quite bare. +that, the room is quite bare. ~ 0 BCJS 0 D2 @@ -5289,7 +5289,7 @@ D1 ~ 0 -1 3204 D2 -You see the landing in the back of Kate's Diner. +You see the landing in the back of Kate's Diner. ~ ~ 0 -1 3150 @@ -5301,7 +5301,7 @@ S #3204 On the River~ You see the warehouse on the northern riverbank. East of here the river -passes under the eastern bridge and through the city wall. The banks of the +passes under the eastern bridge and through the city wall. The banks of the levee are west, in the direction of the current. ~ 0 S 7 @@ -5352,9 +5352,9 @@ You see an intersection with a dark alley. S #3251 Wall Road~ -You are walking along the eastern wall of the city, on a road extending -between the east gate and a bridge to the south. A dark, dirty alley lies west -of here. You step carefully around a pool of liquid...who knows what it could +You are walking along the eastern wall of the city, on a road extending +between the east gate and a bridge to the south. A dark, dirty alley lies west +of here. You step carefully around a pool of liquid...who knows what it could be in a place this foul... ~ 0 S 1 @@ -5379,7 +5379,7 @@ S Wall Road~ The walls of Midgaard tower above you to the east, keeping the city safe from its enemies...you hope. An intersection with a dark alley lies north, -and a bridge over the Midgaard river is south. Beyond the bridge wall road +and a bridge over the Midgaard river is south. Beyond the bridge wall road turns in the concourse. ~ 0 S 1 @@ -5422,9 +5422,9 @@ S #3254 The South Bridge~ You are standing on a small, rickety bridge leading from the Midgaard -City Dump to the much more attractive promenade of the southern parts of +City Dump to the much more attractive promenade of the southern parts of Midgaard. You can smell the stench of the dump to the north, the fresher -air of the promenade seems preferable. Below you are the swift-moving +air of the promenade seems preferable. Below you are the swift-moving currents of the Midgaard river. ~ 0 S 1 @@ -5468,7 +5468,7 @@ Outside the South Gate of Midgaard~ You are standing outside the strong wooden gate on the southern walls of Midgaard. Guards eye you suspiciously from the two towers on either side of the gate, as they stand watch to protect the city from the goblins of this -forest. The trees and goblins of the Miden'nir are south, the gate back to +forest. The trees and goblins of the Miden'nir are south, the gate back to Migaard lies north. ~ 0 S 3 @@ -5485,7 +5485,7 @@ The green forests of the Miden'nir are south, hiding countless goblin warriors. S #3257 Wall Road~ -You are walking along wall road, just north of the west gate of Midgaard. +You are walking along wall road, just north of the west gate of Midgaard. The road continues along the western wall to the north, towards an intersection with a busy Clan street. ~ @@ -5546,7 +5546,7 @@ S #3260 The Northwest Corner~ You are standing beneath the northwestern corner of the city wall, on a turn -in wall road. You can head south, towards the west gate, or east, to the +in wall road. You can head south, towards the west gate, or east, to the north gate. ~ 0 S 1 @@ -5581,7 +5581,7 @@ S #3262 Inside the North Gate of Midgaard~ Two small towers surround a strong wooden gate, connected by a small stone -bridge set with murder holes. This gate is not as heavily guarded as the +bridge set with murder holes. This gate is not as heavily guarded as the others, as the plains outside are safe to travel. You can leave midgaard to the north, or continues along wall road to the west and east. A teeming clan street is visible to the south, and beyond that the graceful spires of the @@ -5642,8 +5642,8 @@ Wall road continues to the west, along the northern wall of the city. S #3265 Wall Road~ -Just south of you is an intersection with a crowded clan street. The -eastern wall of Midgaard is beside you, and to the north you can see the +Just south of you is an intersection with a crowded clan street. The +eastern wall of Midgaard is beside you, and to the north you can see the northeast corner of the city wall. ~ 0 S 1 @@ -5660,7 +5660,7 @@ You see an intersection with a crowded street. S #3266 Wall Road~ -Here, wall road meets up with a busy clan street heading off towards the +Here, wall road meets up with a busy clan street heading off towards the west, and the far wall of the city. You can smell spices, perfume, freshly cured hide, and other strange scents, all mingle together in one heady aroma. Wall road continues to the north and south. @@ -5702,9 +5702,9 @@ You see the well-guarded east gate of Midgaard. S #3268 Outside the North Gate of Midgaard~ -You stand outside the north gate of the walled city of Midgaard. A dusty -trail is visibile to the north, it stretches around the walls of the city. -Further north are the wide expanses of the northern plains, leading to the +You stand outside the north gate of the walled city of Midgaard. A dusty +trail is visibile to the north, it stretches around the walls of the city. +Further north are the wide expanses of the northern plains, leading to the village of Ofcol. You can return to Midgaard to the south. ~ 0 S 2 @@ -5722,7 +5722,7 @@ S #3270 On the Concourse~ The strong stone walls of Midgaard rise up to the west, keeping evil at bay. -The concourse heads towards a bridge to the north, and continues south +The concourse heads towards a bridge to the north, and continues south alongside a beautiful park. ~ 0 S 1 @@ -5758,7 +5758,7 @@ S #3272 On the Concourse at Penny Lane~ You are on a road leading around the inner walls of Midgaard. To the north, -the concourse heads towards a bridge into northern Midgaard. To the south, +the concourse heads towards a bridge into northern Midgaard. To the south, you can see an intersection with Elm Street. The quaint paved streets of Penny Lane lie west. ~ @@ -5804,7 +5804,7 @@ You see Elm Street and the graveyard entrance. S #3301 Clan Road~ -You are standing on the western end of Clan Road. The traffic here +You are standing on the western end of Clan Road. The traffic here is light. This is a quieter section of Midgaard. You can hear the sound of haggling coming from the east. ~ @@ -5822,8 +5822,8 @@ Wall Road is to the west. S #3302 Clan Road~ -You are walking along Clan Road. To the south of you is the money changer. -Clan Road continues on to the east and the west. +You are walking along Clan Road. To the south of you is the money changer. +Clan Road continues on to the east and the west. ~ 0 S 1 D1 @@ -5845,7 +5845,7 @@ S #3303 Clan Road~ The shops on this stretch of Clan road are long-closed and boarded up. -Not much traffic passes through this part, as there is nothing to buy. +Not much traffic passes through this part, as there is nothing to buy. ~ 0 S 1 D1 @@ -5878,7 +5878,7 @@ Clan Road continues to the west. S #3315 Clan Road~ -Clan Road seems to widen here slightly, allowing more traffic to +Clan Road seems to widen here slightly, allowing more traffic to travel through the area. To the south is another entrance to the busy pub. This door is also open wide and spilling forth the sounds of happy patrons. Clan Road continues to the east and west. @@ -5902,9 +5902,9 @@ Clan Road continues to the west. S #3316 Clan Road~ -You are at the eastern end of Clan Road. To the east of you, the +You are at the eastern end of Clan Road. To the east of you, the tall wall around the city looms up before you and casts its shadow on -you. Clan Road continues to the west. +you. Clan Road continues to the west. ~ 0 S 1 D1 @@ -5920,8 +5920,8 @@ Clan Road continues to the west. S #3334 A Money Changer's Room~ -A few strategically placed lanterns keep this place well-lit in the -absence of any windows. The room is surprisingly well appointed with +A few strategically placed lanterns keep this place well-lit in the +absence of any windows. The room is surprisingly well appointed with tapestries hanging on the walls. You'd wager your life the moneylender's guards are behind them, as there are none here. The moneylender himself works from behind a large desk, no doubt holding a fortune in gold and silver. @@ -6223,7 +6223,7 @@ G 1 3150 -1 * a cup of cinnamon coffee G 1 3100 -1 * a cup of tea M 0 3160 1 3160 1 * Melancholy G 1 3168 -1 * a map of Olympus -G 1 3167 -1 * a map of New Thalos +G 1 3167 -1 * a map of New Thalos G 1 3166 -1 * a map of the first level of Moria G 1 3165 -1 * a map of the Dwarven Kingdom G 1 3164 -1 * a map of southern Midgaard diff --git a/src/area/mirror.are b/src/area/mirror.are index 791e310..67b8ec5 100644 --- a/src/area/mirror.are +++ b/src/area/mirror.are @@ -10,7 +10,7 @@ oldstyle baby beholder~ the baby beholder~ You meet a baby beholder's cute gaze! ~ -It has a large central eye that blinks like a guppy and eyestalks atop the +It has a large central eye that blinks like a guppy and eyestalks atop the round body which can charm you with its cuteness. Baby beholders are known for their playful personality. Hmmm.... It looks like the baby is teething! ~ @@ -357,7 +357,7 @@ oldstyle deer~ a deer~ A deer stares back at you. ~ -The deer looks angered at your intrusion. He butts his head against you, +The deer looks angered at your intrusion. He butts his head against you, albeit ineffectively. ~ human~ @@ -603,7 +603,7 @@ container 0 0 0 0 0 P E cabinet~ -A cabinet made of oak and mahogany, this piece of woodmanship is just splendid +A cabinet made of oak and mahogany, this piece of woodmanship is just splendid to view. The wood is varnished with a very strong stain that looks as if it would last longer than the cabinet itself. ~ @@ -899,7 +899,7 @@ A The Grand Gate of Thalos~ You stand in the archway of a gigantic stone archway. The two steel gates look indestructible, yet they are elaborate in engravings. You can -hear laughter and good cheer from the other side of these gates. Obviously, +hear laughter and good cheer from the other side of these gates. Obviously, the city is teeming with activity! There is a small gold plaque on mounted on the archway. ~ @@ -955,9 +955,9 @@ S Main Street~ This is a magnificent street, immaculate all over. The streets are filled with people rushing from building to building and a balmy zephyr blows by you. -The whole city is teeming with activity. On one side is a beautiful house +The whole city is teeming with activity. On one side is a beautiful house while on the other is the entrance to a large mansion. Sounds of people hard -at work echo within the mansion. Near the center of town you see a large +at work echo within the mansion. Near the center of town you see a large domed building, magnificent and immense. ~ 0 0 1 @@ -985,7 +985,7 @@ S #5303 A Garden Path~ A circular path surrounds a magnificent domed temple in the center -of the city. Flowers grow on the sides of the path and the lush trees are +of the city. Flowers grow on the sides of the path and the lush trees are laden with fruit. Vines and ivy snake up the sides of the temple, making this temple truly a blend of nature and man's work of art. ~ @@ -1076,7 +1076,7 @@ S #5307 The market place~ You stand in the middle of a large square lined on each side with -baskets, carts, and stands of all shapes and sizes. The little shops are +baskets, carts, and stands of all shapes and sizes. The little shops are filled with goods sold to the demanding public. ~ 0 0 1 @@ -1197,7 +1197,7 @@ S #5312 A side street~ This small side street leads south away from the temple into the -business section of town. To the east is the famous City Hall of Thalos. +business section of town. To the east is the famous City Hall of Thalos. Well disciplined guards stand at attention, watching over the city hall, but you don't see any source of threats in THIS city. North is a garden path, west is a smithy, and this side street continues south. @@ -1571,7 +1571,7 @@ S The city hall~ This is the main reception area of Thalos' city hall. The walls have been painted in pure white and thick lush carpet line the floor wall to wall. -A side door on the west wall allows you to go out to one of the city's side +A side door on the west wall allows you to go out to one of the city's side streets. Hallways lead south and east. ~ 0 D 1 @@ -1749,9 +1749,9 @@ You see up the powerful watchtower. S #5342 A bath house~ -This is the bath house for the commoners of the city. Hot steamy water -wells up from a hole in the floor. Obviously there is a hot spring located -under the city (making the decision to put a city here seem much more +This is the bath house for the commoners of the city. Hot steamy water +wells up from a hole in the floor. Obviously there is a hot spring located +under the city (making the decision to put a city here seem much more reasonable). To the west is another room. ~ 0 D 1 @@ -1792,8 +1792,8 @@ S #5344 A Resting Room~ You are in a resting room. Soft mats line the floor, and you see many -people just relaxing on them. The comfort of this place is so inviting, you -want to join them. Great amounts of steam issue forth from the hole in the +people just relaxing on them. The comfort of this place is so inviting, you +want to join them. Great amounts of steam issue forth from the hole in the east wall. ~ 0 D 1 @@ -1821,7 +1821,7 @@ S #5346 The north-west watchtower~ You stand atop one of the city watchtowers. The view is magnificent -from here and you can see all the way to the western mountains. You are +from here and you can see all the way to the western mountains. You are confident nothing can touch this tower. ~ 0 0 1 @@ -1860,10 +1860,10 @@ The city lies below. S #5350 The Temple of Thalos~ -You stand within one of the most holy places in the realm. This stunning -domed temple houses the city's worshipers en masse. Long benches line the -aisles and the altar glistens with the gold and platinum inlay.The walls and -roof are all made of ceramic, making this place reflect the sun well. +You stand within one of the most holy places in the realm. This stunning +domed temple houses the city's worshipers en masse. Long benches line the +aisles and the altar glistens with the gold and platinum inlay.The walls and +roof are all made of ceramic, making this place reflect the sun well. The greenery around the temple itself makes this place a great blend of nature and man's works of art. ~ @@ -2113,7 +2113,7 @@ City Entrance~ You stand on the outskirts of a construction site - Midgaard; the capital of this land. The road leads east into the peace and quiet - and dangers - of the forest; and to the west it becomes the main street of the town; -surrounded by building foundations of unfinished shops, houses, and temple. +surrounded by building foundations of unfinished shops, houses, and temple. ~ 0 C 1 D1 diff --git a/src/area/mobfact.are b/src/area/mobfact.are index bd1dc97..457f66c 100644 --- a/src/area/mobfact.are +++ b/src/area/mobfact.are @@ -72,7 +72,7 @@ oldstyle toxic slime~ The toxic slime~ A pool of toxic slime lies on the floor. ~ -Yick. Looks like someone had digestion problems! Either that, or the +Yick. Looks like someone had digestion problems! Either that, or the hydraulic fluid is leaking again. ~ human~ diff --git a/src/area/moria.are b/src/area/moria.are index 2319392..f2906a6 100644 --- a/src/area/moria.are +++ b/src/area/moria.are @@ -8,7 +8,7 @@ Moria~ #4000 python snake~ the huge python~ -The huge python rears its head and hisses at you. +The huge python rears its head and hisses at you. ~ It sways back and forth contemplating whether or not to eat you. ~ @@ -182,7 +182,7 @@ orc~ the orc~ An orc is here, looking for something (or perhaps someone) to eat. ~ -As you already know, orcs have quite a ravenous appetite. +As you already know, orcs have quite a ravenous appetite. Care to be dinner? ~ orc~ @@ -227,7 +227,7 @@ stand stand male 500 mage~ the Mage~ A small intelligent looking mage is standing here. It looks like he -knows his way with magic. +knows his way with magic. ~ This guy can ace the SAT with his frontal lobe tied behind his back. ~ @@ -940,7 +940,7 @@ map moria third~ West trail around Midgaard~ You are on a dusty trail following the outside wall of Midgaard. To the east the wall towers over you and to the west you see the -forest of Haon-Dor. The trail leads north and south along the wall. +forest of Haon-Dor. The trail leads north and south along the wall. ~ 0 0 2 D0 @@ -958,11 +958,11 @@ S West trail around Midgaard~ You are on a dusty trail following the outside wall of Midgaard. To the east the wall towers over you and to the west you see the -forest of Haon-Dor. The trail leads north and south along the wall. +forest of Haon-Dor. The trail leads north and south along the wall. ~ 0 0 2 D0 -To the north you notice the path makes a turn, following the City wall. +To the north you notice the path makes a turn, following the City wall. ~ ~ 0 -1 3902 @@ -975,7 +975,7 @@ S #3902 Northwest corner of dusty trail.~ You are standing outside the northwestern corner of the city wall. -The trail leads east following the north wall and south towards the gate. +The trail leads east following the north wall and south towards the gate. ~ 0 0 2 D1 @@ -992,7 +992,7 @@ S #3903 Dusty trail along north wall.~ You are walking on the trail following the outside of Midgaard's -northern wall. +northern wall. ~ 0 0 2 D1 @@ -1001,7 +1001,7 @@ The dusty trail is winding along the north wall of Midgaard. ~ 0 -1 3904 D3 -The dusty trail turns left around the corner of the wall, behind it Haon-Dor. +The dusty trail turns left around the corner of the wall, behind it Haon-Dor. ~ ~ 0 -1 3902 @@ -1012,7 +1012,7 @@ You are just outside the northern gate of Midgaard. You can continue along the trail to the east or west, head onwards to the plains of the north, or enter Midgaard to the south. You can just barely make out the buildings of Midgaard from here, the Temple of Mota looks impressive even from this -distance. +distance. ~ 0 0 2 D0 @@ -1021,7 +1021,7 @@ A small path extends into the plains. ~ 0 -1 300 D1 -The dusty trail is winding along the north wall of Midgaard. +The dusty trail is winding along the north wall of Midgaard. ~ ~ 0 -1 3905 @@ -1039,11 +1039,11 @@ S #3905 Dusty trail along north wall.~ You are walking on the trail following the outside of Midgaard's -northern wall. +northern wall. ~ 0 0 2 D1 -The dusty trail turns right around the corner of the wall. +The dusty trail turns right around the corner of the wall. You notice some mountains in the distance. ~ ~ @@ -1057,7 +1057,7 @@ S #3906 Northeast corner of dusty trail.~ You are standing outside the northeastern corner of the city wall. -The trail leads west following the north wall and south towards the gate. +The trail leads west following the north wall and south towards the gate. ~ 0 0 2 D2 @@ -1075,11 +1075,11 @@ S East trail around Midgaard~ You are on a dusty trail following the outside wall of Midgaard. To the west the wall towers over you and far to the east you see -some mountains. The trail leads north and south along the wall. +some mountains. The trail leads north and south along the wall. ~ 0 0 2 D0 -To the north you notice the path makes a turn, following the City wall. +To the north you notice the path makes a turn, following the City wall. ~ ~ 0 -1 3906 @@ -1093,7 +1093,7 @@ S East trail around Midgaard~ You are on a dusty trail following the outside wall of Midgaard. To the west the wall towers over you and far to the east you see -some mountains. The trail leads north and south along the wall. +some mountains. The trail leads north and south along the wall. ~ 0 0 2 D0 @@ -1123,7 +1123,7 @@ D0 ~ 0 0 4001 D1 -You see the mountains of the dwarven kingdom. +You see the mountains of the dwarven kingdom. ~ ~ 0 0 6562 @@ -1223,7 +1223,7 @@ S #4011 The tunnel~ You squeeze your way through a small, narrow tunnel. The sharp-edged rocks -protruding from the walls threaten to scratch and cut you. +protruding from the walls threaten to scratch and cut you. To the south you sense a freshness in the air which is rather unusual in these damp, stuffy tunnels. To the north the tunnel continues. ~ @@ -1256,7 +1256,7 @@ S #4013 The tunnel~ This tunnel, leading east-west, seems seldom used. A thick layer of dust -covers the floor, making the air stuffy and dry. +covers the floor, making the air stuffy and dry. ~ 0 AD 3 D1 @@ -1535,7 +1535,7 @@ D2 S #4030 The light cave~ -You are in a light cave, through a hole large above you, you see +You are in a light cave, through a hole large above you, you see the sky. A small tunnel to the south is the only way out. ~ 0 0 2 @@ -1546,7 +1546,7 @@ D2 S #4031 The valley~ -You are in a small valley, surrounded by hills and a mountain to +You are in a small valley, surrounded by hills and a mountain to the south. In the mountain there is a cave. ~ 0 0 2 @@ -1897,7 +1897,7 @@ D1 S #4060 The tunnel~ -You are in a small tunnel, to the west the tunnel continues and +You are in a small tunnel, to the west the tunnel continues and to the east you see some light. ~ 0 AD 3 @@ -2326,7 +2326,7 @@ D3 S #4113 The passage~ -You are in a passage that leads towards the south. To the east +You are in a passage that leads towards the south. To the east you see a tunnel. ~ 0 AD 3 @@ -2346,7 +2346,7 @@ S #4114 The golden cave~ You are in a giant cave, all the walls are shining with a soft golden -light. The cave continues to the north, to the west you see a dark +light. The cave continues to the north, to the west you see a dark passage. ~ 0 D 1 diff --git a/src/area/music.txt b/src/area/music.txt index f553742..8aa305b 100644 --- a/src/area/music.txt +++ b/src/area/music.txt @@ -414,7 +414,7 @@ Let's go, let's strike a light We're gonna blow like dynamite I don't care if it takes all night Gonna set this town alight -What do you want? +What do you want? What do you want? I want rock'n'roll, alright! Long live rock'n'roll @@ -428,7 +428,7 @@ I'm burnin' burnin' I got the fever I know for sure, there ain't no cure So feel it, don't fight it, go with the flow gimme, gimme, gimme, gimme one more for the road -What do you want? +What do you want? What do you want? I want rock'n'roll, you betcha Long live rock'n'roll diff --git a/src/area/newthalos.are b/src/area/newthalos.are index 6d959bc..0143ace 100644 --- a/src/area/newthalos.are +++ b/src/area/newthalos.are @@ -189,7 +189,7 @@ oldstyle Nabil shopkeeper~ Nabil~ Nabil, purveyor of exotic pets, is waiting to serve you. ~ -A large, well-fed shopkeeper, Nabil is adept at finding animals from all +A large, well-fed shopkeeper, Nabil is adept at finding animals from all parts of the world. He welcomes you warmly and offers to show you a pair of priceless parrots. ~ @@ -791,7 +791,7 @@ oldstyle harem girl~ a harem girl~ A lovely, veiled harem girl stands here. ~ -You see a dark skinned beauty, wearing almost transparent silks and +You see a dark skinned beauty, wearing almost transparent silks and light blue viel. Her loyalty to the sultan is unwavering. ~ human~ @@ -2556,7 +2556,7 @@ D3 S #9511 Outside the Southern Gate of New Thalos~ -You see before you the expanse of the Sands of Sorrow. The shifting sands +You see before you the expanse of the Sands of Sorrow. The shifting sands stretch on endlessly to the south, hiding treasure and adventure. ~ 0 0 1 @@ -4644,7 +4644,7 @@ You stand in a large building decorated with black marble and red satin. A lavishly flourished sign details several exotics creatures and Nabil's smiling face. Cages crowd the room, some large, some small, and filled with animals from the four corners of the world. Various feeding and grooming -supplies fill the back half of the room, along with an assortment of +supplies fill the back half of the room, along with an assortment of leashes for everything from giant rats to minotaur lizards. ~ 0 DEFGM 0 @@ -5291,7 +5291,7 @@ North-West Tower~ You stand on one of the four towers guarding the city. The view from here is great! To the west you see the tall mountains that make up the divide between here an Midgaard. The Ishtar river slowly flows from that direction. -South you can see the entire city of New Thalos and the Sands of Sorrow +South you can see the entire city of New Thalos and the Sands of Sorrow to the south. ~ 0 D 0 @@ -7115,7 +7115,7 @@ D 0 9617 2 1 * Base of the Tower south M 0 9512 1 9621 1 * Nabil M 0 3097 1 9706 1 M 0 3096 1 9706 1 -M 0 3095 1 9706 1 +M 0 3095 1 9706 1 M 0 9544 20 9622 2 * the vulture M 0 9515 1 9622 1 * Butch the meatcutter E 1 9584 1 16 * a meat cleaver @@ -7200,7 +7200,7 @@ M 0 9583 1 9638 1 * Patch the bartender G 1 9577 10 * a shot G 1 9576 10 * a barrel of beer G 1 9575 10 * a flaming scorpion -O 1 3200 -1 9638 +O 1 3200 -1 9638 M 0 9566 1 9644 1 * the blacksmith G 1 9589 100 * a riding crop G 1 9588 10 * a saddle diff --git a/src/area/nirvana.are b/src/area/nirvana.are index a9e1788..a6189a0 100644 --- a/src/area/nirvana.are +++ b/src/area/nirvana.are @@ -213,7 +213,7 @@ warp_stone AT AO 0 0 500 P E moonstone moon stone white~ -Looking into the smooth surface of this moonstone, you feel strangely at +Looking into the smooth surface of this moonstone, you feel strangely at peace and balance with the world around you. ~ #0 @@ -224,7 +224,7 @@ Entrance to the Plane of Nirvana~ You stand before the entrance to a plane of absolute balance and order. It is equally hot and cold, equally light and dark, and made of equal parts of solid and liquid. - + The plane extends to the west and east, while an exit lies downward. ~ 0 0 2 @@ -263,7 +263,7 @@ To the west, the plane seems to extend forever. S #9002 The Plane of Nirvana~ -You are on a western strech of the plane. Boundaries to the east and west seem +You are on a western strech of the plane. Boundaries to the east and west seem nonexistent. ~ 0 0 2 @@ -280,7 +280,7 @@ The plane continues to the west where is appears to change direction S #9003 A Change in Direction~ -Here, the plane seems to direct you to the north. Also, the plane continues +Here, the plane seems to direct you to the north. Also, the plane continues to the west. ~ 0 0 2 @@ -345,7 +345,7 @@ To the south, the plane stretches as far as the eye can see. S #9007 In the Tower of Nirvana~ -Entering the tower, there seems to be enough light to see by, but no source is +Entering the tower, there seems to be enough light to see by, but no source is visible. The hall continues to the east, while a door lies to the west. ~ 0 D 0 @@ -362,7 +362,7 @@ door~ S #9008 A hallway in the Tower of Nirvana~ -You are in a east-west hallway in the tower. to the west, the hall continues +You are in a east-west hallway in the tower. to the west, the hall continues and a door lies to the east. ~ 0 D 0 @@ -410,7 +410,7 @@ The Hallway contiues west into oblivion S #9011 An intersection in the Tower of Nirvana~ -You are at an intersection where the east-west passage continues, but a large +You are at an intersection where the east-west passage continues, but a large passage leads to the north. ~ 0 D 0 @@ -433,7 +433,7 @@ S #9012 At the door to the Tower of Nirvana~ You stand on the plane where a mighty door lies to the west. -The plane also continues north and southward. There is a large sign on the +The plane also continues north and southward. There is a large sign on the door. ~ 0 0 2 @@ -462,7 +462,7 @@ enter the Tower of Nirvana. S #9013 At the door to the Tower of Nirvana~ -The plane continue to the north and south, while a mighty door lies to the +The plane continue to the north and south, while a mighty door lies to the east. There is a sign on the door. ~ 0 0 2 @@ -579,8 +579,8 @@ The passage continues westward into oblivion. S #9020 The Lair of Primus~ -You are in a large hall, with a massive pool of what appears to be pure energy -in the center of the room. Exits lead in all the cardinal directions. From +You are in a large hall, with a massive pool of what appears to be pure energy +in the center of the room. Exits lead in all the cardinal directions. From the pool rises the master of the Plane of Nirvana.... ~ 0 D 0 @@ -607,7 +607,7 @@ A passage leads west into the unknown. S #9021 A Tertian's lair~ -Maybe coming here wasn't such a hot idea. You feel very unwelcome here. +Maybe coming here wasn't such a hot idea. You feel very unwelcome here. Exits lead north and south ~ 0 D 0 @@ -625,8 +625,8 @@ S #9022 The office of a Quinton~ You have stumbled upon the office of a page to Primus. -Scrolls lie about the room along with many strange objects...you can't imagine -what kind of creature would use them. Exits lead in all the cardinal +Scrolls lie about the room along with many strange objects...you can't imagine +what kind of creature would use them. Exits lead in all the cardinal directions. ~ 0 D 0 @@ -701,7 +701,7 @@ To the south you stare into darkness. S #9026 An intersection of passages~ -You stand at an intersection. Exits lead off to the east and south. +You stand at an intersection. Exits lead off to the east and south. A door lies to the north ~ 0 D 0 @@ -882,7 +882,7 @@ Looking west, you can see an intersection ahead. S #9036 Lair of a Hexton~ -You are in a room that is in complete disrepair. Items are thrown throughout +You are in a room that is in complete disrepair. Items are thrown throughout the room making them worthless piles of junk. The only exit is back south ~ @@ -906,8 +906,8 @@ Looking north, you can make out a hallway. S #9038 Office of a Secundus~ -You are standing in a office of one of the Viceroys of the Plane of Nirvana. -The occupant doesn't look real thrilled with your presence. The only exits is +You are standing in a office of one of the Viceroys of the Plane of Nirvana. +The occupant doesn't look real thrilled with your presence. The only exits is west. ~ 0 D 0 @@ -957,7 +957,7 @@ To the south you can make out a junction. S #9041 Office of a Septon~ -A neat and tidy room, it appear to be inhabited my a neatenss freak. The only +A neat and tidy room, it appear to be inhabited my a neatenss freak. The only exit lies to the north. ~ 0 D 0 @@ -995,7 +995,7 @@ To the west you can see what appears to be a cavernous room. S #9043 The Barracks~ -A dusty room, with a almost untolerable odor, the barracks are being inspected +A dusty room, with a almost untolerable odor, the barracks are being inspected by a Hexton and his personal enterage. The only exit lies to the south. ~ @@ -1008,8 +1008,8 @@ To the south you can see junction S #9044 The Commander's Post~ -You have stumbled on to the office of the Commander of the forces in the Plane -Of Nirvana. The room is well furnished and a sense of courage and bravery +You have stumbled on to the office of the Commander of the forces in the Plane +Of Nirvana. The room is well furnished and a sense of courage and bravery overtakes you as you enter the room. The only exit lies to the north. ~ 0 D 0 @@ -1021,7 +1021,7 @@ To the north you can visualize a junction of passages. S #9045 The chamber of the second Secundus~ -This huge room is furnished with the finest, and a personal legion guards the +This huge room is furnished with the finest, and a personal legion guards the Secundus. the only exit is to the east. ~ 0 D 0 @@ -1033,7 +1033,7 @@ To the east you can see a junction S #9046 A Passageway~ -You are in a well lit passage. A sense of forboding danger envelopes you. +You are in a well lit passage. A sense of forboding danger envelopes you. Exits lead in all cardinal directions. ~ 0 D 0 @@ -1060,7 +1060,7 @@ To the west, a large tunnel can be found. S #9047 Chamber of the Octon~ -A small room, sparsely furnished, it leaves you with a sense of fear. The +A small room, sparsely furnished, it leaves you with a sense of fear. The only exit is to the south ~ 0 D 0 @@ -1072,7 +1072,7 @@ To the south you can see a passage. S #9048 Chamber of the Nonaton~ -You have entered the chamber of the principal law and order overseers. The +You have entered the chamber of the principal law and order overseers. The only exit lies to the north ~ 0 D 0 @@ -1084,7 +1084,7 @@ To the north you can see a passageway. S #9049 End of the passageway~ -You have reached the end of a long east-west passage. The passage contiues to +You have reached the end of a long east-west passage. The passage contiues to the west, and rooms lie to the north, south, and east. ~ 0 D 0 @@ -1111,7 +1111,7 @@ to the west, the passageway continues S #9050 Chamber of a Hexton~ -You have entered the chamber of a Hexton. Trophies adorn the walls, some of +You have entered the chamber of a Hexton. Trophies adorn the walls, some of which are human. the only exit is to the south. ~ 0 D 0 @@ -1123,7 +1123,7 @@ To the south you can see a passageway. S #9051 Chamber of a Hexton~ -You have entered a room where you are not very popular. The only exit lies +You have entered a room where you are not very popular. The only exit lies northbound. ~ 0 D 0 @@ -1135,7 +1135,7 @@ To the north you can see a passage. S #9052 Chamber of the Secudus~ -A large canvernous room, this chamber serves as the sleeping quarters for the +A large canvernous room, this chamber serves as the sleeping quarters for the third Secudus, Viceroy to Primus. The only exit lies to the west. ~ 0 D 0 @@ -1195,7 +1195,7 @@ To the north, you can see a passageway. S #9056 A large room~ -You have entered a room where you are not wanted. The only exit lies to the +You have entered a room where you are not wanted. The only exit lies to the south. ~ 0 D 0 @@ -1207,7 +1207,7 @@ To the south you can visualize a east-west passage. S #9057 A room~ -You have entered a room where there was obviously a hurried move going on. +You have entered a room where there was obviously a hurried move going on. The only exit lies to the north. ~ 0 D 0 @@ -1219,8 +1219,8 @@ To the north you can make out a passageway. S #9058 Chamber of The First Secundus~ -You have disturbed the rest of the First Viceroy to Primus the Prime, The -Secundus. He does not look like a happy camper. The only exit lies to the +You have disturbed the rest of the First Viceroy to Primus the Prime, The +Secundus. He does not look like a happy camper. The only exit lies to the east. ~ 0 D 0 diff --git a/src/area/ofcol2.are b/src/area/ofcol2.are index 84ff099..c93b828 100644 --- a/src/area/ofcol2.are +++ b/src/area/ofcol2.are @@ -11,7 +11,7 @@ the Ofcol cityguard~ An Ofcol cityguard is standing here, making sure there is no trouble. ~ This guard is surely a trained and skilled fighter. He is fully armed and -armored, and he uses his equipment with a practiced precision. Luckily for +armored, and he uses his equipment with a practiced precision. Luckily for you, this guard will only use his deadly skills for the good of the citizens of Ofcol. ~ @@ -30,7 +30,7 @@ Diana, the Marshall of Ofcol, stands here proudly. Diana is a beautiful, powerfully built woman. She wears platinum armor for three reasons. The first is to show she is strong enough to withstand the weight. The second is to show her rank of office. The third is that platinum -is the hardest metal she can find. She is willing to defend Ofcol to her +is the hardest metal she can find. She is willing to defend Ofcol to her death. ~ human~ @@ -376,7 +376,7 @@ the Ofcol cityguard~ An Ofcol cityguard is posted here to guard the gate. ~ This guard is surely a trained and skilled fighter. He is fully armed and -armored, and he uses his equipment with a practiced precision. Luckily for +armored, and he uses his equipment with a practiced precision. Luckily for you, this guard will only use his deadly skills for the good of the citizens of Ofcol. ~ @@ -448,10 +448,10 @@ stand stand male 5 #628 oldstyle priestess~ the Priestess of Ofcol~ -The Priestess of Ofcol is here, blessing you +The Priestess of Ofcol is here, blessing you with her beatific smile. ~ -The Priestess of Ofcol is an old woman, perfectly at peace with herself and +The Priestess of Ofcol is an old woman, perfectly at peace with herself and with the world. She devotes all her time to help teach you the ways of her god, Bahamut. The dragon symbol around her neck looks almost alive. ~ @@ -465,7 +465,7 @@ stand stand female 50 #629 oldstyle chaplain Jerrold~ Chaplain Jerrold~ -Jerrold, the chaplain of this Citadel, is here +Jerrold, the chaplain of this Citadel, is here directing the activities of the people around here. ~ He smiles at you, with the enthusiasm of a little kid. "What're you doing just @@ -486,7 +486,7 @@ A knight wearing the scales of a dragon stands here. ~ This person looks almost like a dragon itself. His golden scales gleam with power. He smiles at you with a vicious grin. You're happy that he doesn't -look upset at your presence. +look upset at your presence. ~ human~ AB BHN 1000 0 @@ -498,7 +498,7 @@ stand stand male 50 #631 oldstyle dragon gold~ The Ancient Gold Dragon~ -An old dragon shimmering with the colors of this +An old dragon shimmering with the colors of this cavern peers at you sleepily. ~ This dragon's head is taller than you. He is annoyed at your disturbance, but @@ -530,7 +530,7 @@ stand stand male 250 #633 oldstyle dragonknight knight dragon~ a Dragonknight~ -A person dressed in the scales of a gold dragon +A person dressed in the scales of a gold dragon stands here, guarding the Golden Citadel. ~ This person looks like a dragon itself. His golden scales gleam with power. @@ -549,7 +549,7 @@ the Ofcol cityguard~ An Ofcol cityguard is posted here to guard the gate. ~ This guard is surely a trained and skilled fighter. He is fully armed and -armored, and he uses his equipment with a practiced precision. Luckily for +armored, and he uses his equipment with a practiced precision. Luckily for you, this guard will only use his deadly skills for the good of the citizens of Ofcol. ~ @@ -1329,7 +1329,7 @@ door~ S #601 The Big Intersection~ -You are in the big intersection between Raff Way and Impy Way. Crowds +You are in the big intersection between Raff Way and Impy Way. Crowds of people walk past you as they go on their daily tasks. Raff Way continues east and west, and Impy Way runs north and south. ~ @@ -1385,7 +1385,7 @@ S #603 The Blacksmith~ You are in a black and smelly room. Pieces of metal are strewn all over -the floor, and a wave of heat from a big furnace hits you. An anvil sits on +the floor, and a wave of heat from a big furnace hits you. An anvil sits on one side of the room, and on the other side is a workbench. The exit is east. ~ 0 D 0 @@ -1543,8 +1543,8 @@ S #612 Fields~ You are in a corn field. You can't see far, since the corn stalks are -taller than you are. You remember that the end of Impy Way is east of here, -and you think you see a building to the north. The field continues south and +taller than you are. You remember that the end of Impy Way is east of here, +and you think you see a building to the north. The field continues south and west. ~ 0 0 2 @@ -1571,7 +1571,7 @@ You can make a path to the fields west. S #613 Fields~ -You are among fruit trees in a field. You see many apple and orange +You are among fruit trees in a field. You see many apple and orange trees. You can make out the corn fields north and some vegetable patches west. The sight of the fruit makes your mouth water. ~ @@ -1708,7 +1708,7 @@ You see the dirt road. S #621 Dirt Road~ -You are on a dirt road. To the north and south, you see some grass +You are on a dirt road. To the north and south, you see some grass fields. There is a pigsty west, and the dirt road continues east. ~ 0 0 2 @@ -2096,7 +2096,7 @@ S Big House~ You are in a big house. Evidently, the owners of this house are richer than the average citizen, since there is more than one room to this house. A -door leads to the kitchen north, and a bedroom is upstairs. The exit is to +door leads to the kitchen north, and a bedroom is upstairs. The exit is to the south. ~ 0 D 0 @@ -2118,7 +2118,7 @@ You see the bedroom. S #644 Bedroom~ -You are in the bedroom. There isn't much of interest except for a bed +You are in the bedroom. There isn't much of interest except for a bed and a closet. The stairs lead back down. ~ 0 D 0 @@ -2488,8 +2488,8 @@ You see the end of Swiftest Way. S #666 Raff Way~ -You are on Raff Way. To the west, you can see a big intersection. To -the east, you see Raff Way continue toward the Golden Citadel. There are +You are on Raff Way. To the west, you can see a big intersection. To +the east, you see Raff Way continue toward the Golden Citadel. There are beautiful flowers growing along the road here, making this more of a garden than a road. ~ @@ -2507,8 +2507,8 @@ You see the big intersection. S #667 Raff Way~ -You are on Raff Way. Raff Way continues west to the city of Ofcol. To -the east, you see Raff Way continue toward the Golden Citadel. There are +You are on Raff Way. Raff Way continues west to the city of Ofcol. To +the east, you see Raff Way continue toward the Golden Citadel. There are beautiful flowers growing along the road here, making this more of a garden than a road. ~ @@ -2871,7 +2871,7 @@ You are in one of the upper chambers of the Golden Citadel. The decora- tions of this place surpass even those of the first floor. Gold tiles etched with platinum cover the floor, walls and the ceiling. The lights from numerous torches reflect from these shimmering planes, giving the illusion that you are -standing in a gem. Stairways lead up and down, and the hall leads south. +standing in a gem. Stairways lead up and down, and the hall leads south. ~ 0 D 0 D2 @@ -2893,7 +2893,7 @@ You are in one of the upper chambers of the Golden Citadel. The decora- tions of this place surpass even those of the first floor. Gold tiles etched with platinum cover the floor, walls and the ceiling. The lights from numerous torches reflect from these shimmering planes, giving the illusion that you are -standing in a gem. Stairways lead up and down, and the hall leads east. +standing in a gem. Stairways lead up and down, and the hall leads east. ~ 0 D 0 D1 @@ -2914,8 +2914,8 @@ The Hall of the DragonLords~ You are in a vast hall, filled with the commanders of the Golden Citadel. Golden tiles etched with platinum cover the floors, and weapons of all types are mounted on the walls of this meeting hall. Surrounding a solid gold table -are four sons of the Keeper of the Golden Citadel. They smile at you and ask -you to join them in lunch. Exits lead to the cardinal directions. +are four sons of the Keeper of the Golden Citadel. They smile at you and ask +you to join them in lunch. Exits lead to the cardinal directions. ~ 0 D 0 D0 @@ -2941,7 +2941,7 @@ You are in one of the upper chambers of the Golden Citadel. The decora- tions of this place surpass even those of the first floor. Gold tiles etched with platinum cover the floor, walls and the ceiling. The lights from numerous torches reflect from these shimmering planes, giving the illusion that you are -standing in a gem. Stairways lead up and down, and the hall leads west. +standing in a gem. Stairways lead up and down, and the hall leads west. ~ 0 D 0 D3 @@ -2963,7 +2963,7 @@ You are in one of the upper chambers of the Golden Citadel. The decora- tions of this place surpass even those of the first floor. Gold tiles etched with platinum cover the floor, walls and the ceiling. The lights from numerous torches reflect from these shimmering planes, giving the illusion that you are -standing in a gem. Stairways lead up and down, and the hall leads north. +standing in a gem. Stairways lead up and down, and the hall leads north. ~ 0 D 0 D0 @@ -3101,7 +3101,7 @@ S #697 In the Shaft from the Dragon Chamber~ You are in the shaft leading from the Dragon Chamber. Below you lies the -Dragon Chamber of the Golden Citadel. Above you, you see the sky, but +Dragon Chamber of the Golden Citadel. Above you, you see the sky, but currently, the way out is sealed by a layer of diamond that looks impenetrable. ~ 0 D 0 diff --git a/src/area/olympus.are b/src/area/olympus.are index b09dec1..ed4a6f4 100644 --- a/src/area/olympus.are +++ b/src/area/olympus.are @@ -678,7 +678,7 @@ map olympus secret~ . The Secret Map Of *****OLYMPUS***** - + (Hermes) Bedroom The Portal | | @@ -896,7 +896,7 @@ S #910 Throne Room~ You stop dead in your tracks as you enter this room. Before you is Zeus, -in all his glory, sitting on a huge golden throne. You had thought him to be +in all his glory, sitting on a huge golden throne. You had thought him to be just a myth, but here he is ... you wonder who else lives in this castle. ~ 0 D 1 @@ -1053,7 +1053,7 @@ trapdoor throne~ S #919 Dungeon~ -You are in Zeus's Dungeon. There are cells to the north, west, and east. +You are in Zeus's Dungeon. There are cells to the north, west, and east. From the east and west, you hear guttural noises. From the north, nothing ... ~ 0 AD 1 @@ -1320,7 +1320,7 @@ S Second Floor~ You are on the second floor of this castle. You are numb from your discoveries on the first floor, and wonder what secrets the upper floor of this -castle holds. Hallways extend in all directions, and you see a small, closed +castle holds. Hallways extend in all directions, and you see a small, closed hatch above you. ~ 0 D 1 diff --git a/src/area/proto.are b/src/area/proto.are index cde310a..a6fc174 100644 --- a/src/area/proto.are +++ b/src/area/proto.are @@ -1,4 +1,4 @@ -#AREA +#AREA proto.are~ protype~ { 5 35} Merc Prototype for New Area~ diff --git a/src/area/pyramid.are b/src/area/pyramid.are index dd767c9..ac140e0 100644 --- a/src/area/pyramid.are +++ b/src/area/pyramid.are @@ -102,7 +102,7 @@ oldstyle magic carpet~ The magic carpet~ A small woven carpet lies under your feet. ~ -The carpet is simply beautiful, made from intricately woven silken material. +The carpet is simply beautiful, made from intricately woven silken material. It seems to rise up at the touch of your feet. Wait, it is rising, a few feet above the ground! In fact, it seems to be ALIVE! ~ @@ -149,7 +149,7 @@ oldstyle efreeti efreet~ The efreeti~ The efreeti stands here, sheathed in a column of fire. ~ -The efreeti is a mighty being formed from living fire. He gazes down at you +The efreeti is a mighty being formed from living fire. He gazes down at you with disdain and scorn, arms folded across his mighty chest. ~ human~ @@ -182,7 +182,7 @@ The djinn issues forth from the confines of a small lamp. ~ The djinn is a mighty being formed from the air itself and frequently imprisoned in a small lamp, used to do the bidding of those who find him. -He smiles down at you congenially, arms folded across his blue-tinged +He smiles down at you congenially, arms folded across his blue-tinged skin, and strokes his goatee. ~ human~ @@ -216,7 +216,7 @@ A gynosphinx sits here, befuddled by a riddle. ~ The gynosphinx is a crafty but gentle creature, having the body of a beautiful dark-skinned woman from the waist up, a feathery set of wings -and the hind legs of a mighty cat. Right now she is confused, having +and the hind legs of a mighty cat. Right now she is confused, having just heard a puzzling riddle from a cousin criosphinx. ~ human~ @@ -249,7 +249,7 @@ A mighty androsphinx tosses its lion-like mane. ~ The mighty androsphinx is a huge creature, with the body of a lion whose face is quite man-like, perhaps even handsome, and a massive pair of feathered -wings. Tales are told of pharoahs that were rendered permanently deaf by the +wings. Tales are told of pharoahs that were rendered permanently deaf by the mighty roar of this sphinx. ~ human~ @@ -265,7 +265,7 @@ The great sphinx~ A mighty sphinx rests here in the sand, dormant now for centuries. The great sphinx appears to be indestructible! ~ -The great sphinx towers tens of feet above you, resting here in a state of +The great sphinx towers tens of feet above you, resting here in a state of dormancy. It has become almost indistinguishable from the sand that surrounds it, although you can still make out the features of the handsome face that once advised many rulers. @@ -285,7 +285,7 @@ You have awakened the mighty servant to the pharoahs, Ramses. As your light spills over his face and body, you can see his features begin to fill out, swell, and harden, until an apparently healthy man stands before you, clad only in the raiments he was left in when he last slept. His hair is -a soft black, his skin a deep chocolate, and his tall frame is totally still, +a soft black, his skin a deep chocolate, and his tall frame is totally still, his chest not even moving to breathe. ~ human~ @@ -573,7 +573,7 @@ money 0 A 0 200 0 P E treasure~ -The treasure is incredibly large, filled with gold coins and valuables, more +The treasure is incredibly large, filled with gold coins and valuables, more wealth than you could ever possibly imagine accumulated in one place. ~ #8719 @@ -608,7 +608,7 @@ A 1 -3 E curse mummy~ -Rumor has it that whomever disturbs the grave of the mummy shall be +Rumor has it that whomever disturbs the grave of the mummy shall be cursed for all eternity, and that the descendents of that person shall likewise be cursed for ten generations to follow. ~ @@ -676,8 +676,8 @@ A 20 -2 E sun wand~ -This small brass shaft is a holy weapon used by the ancient people of -this land to defend against the deadliest of foes. It shines with the +This small brass shaft is a holy weapon used by the ancient people of +this land to defend against the deadliest of foes. It shines with the brilliant blazing light of the sun. ~ #8725 @@ -728,7 +728,7 @@ A E sphinxian leggings~ These magically fashioned leggings impart the strength and stamina -of the mightiest of the ancient sphinxes. You feel ancient power +of the mightiest of the ancient sphinxes. You feel ancient power emanating from them; they seem to be almost alive. ~ #0 @@ -961,13 +961,13 @@ This area (Great Pyramid) written by Andersen. E stones~ As you look closer you can make out a crack in the center of the stones -beneath your feet. With some effort you might be able to lift that +beneath your feet. With some effort you might be able to lift that section up and get inside! ~ S #8707 Climbing the Great Pyramid~ -Here the elements have carved away at the sides of the pyramid quite a +Here the elements have carved away at the sides of the pyramid quite a bit. You aren't so sure of your footing anymore... Suddenly the wind picks up, and you lose your balance! @@ -998,13 +998,13 @@ You see a small dusty chamber. E stones~ As you look closer you can make out a crack in the center of the stones -above your head. With some effort you might be able to lift that +above your head. With some effort you might be able to lift that section up and get outside! ~ S #8709 A Musty Chamber~ -You are standing in a dank, musty chamber just inside the pyramid. +You are standing in a dank, musty chamber just inside the pyramid. Footprints and other strange marks are set into the dusty floor here. It would seem that some of the tenants of this monument are still alive. Exits lead in all directions. The door to the west is covered with @@ -1071,7 +1071,7 @@ S #8711 The Chamber of the Efreet~ You make your way across the fire pool, and into a small stone chamber. -Here the flames are nearly as high as your head, singeing your face and +Here the flames are nearly as high as your head, singeing your face and evaporating your sweat instantaneously. ~ 0 D 7 @@ -1107,7 +1107,7 @@ S #8713 A Tiny Crawlway~ You are on your hands and knees, inside a small crawlway that winds -through the inside of the pyramid. The crawlway is thick with sand, dust, +through the inside of the pyramid. The crawlway is thick with sand, dust, and markings of the passage of other creatures. ~ 0 AD 0 @@ -1125,7 +1125,7 @@ S #8714 A Tiny Crawlway~ You are on your hands and knees, inside a small crawlway that winds -through the inside of the pyramid. The crawlway is thick with sand, dust, +through the inside of the pyramid. The crawlway is thick with sand, dust, and markings of the passage of other creatures. ~ 0 AD 0 @@ -1180,7 +1180,7 @@ The crawlway gets a little larger to the north. S #8717 A Slippery Hole~ -The sides of this hole are slippery-smooth. You lower yourself in, and +The sides of this hole are slippery-smooth. You lower yourself in, and proceed to move downward... when suddenly you lose your purchase! You fall for what seems like an eternity, and smash into the stones below... @@ -1198,7 +1198,7 @@ You see a rocky crevasse that proceeds deep under the pyramid. 0 -1 8719 E bones~ -The bones have whitened and cracked in the dry air, apparently the remains +The bones have whitened and cracked in the dry air, apparently the remains of adventurers, thieves, and creatures that did not survive the fall. ~ E @@ -1220,7 +1220,7 @@ You see a rocky crevasse that proceeds deep under the pyramid. 0 -1 8719 E bones~ -The bones have whitened and cracked in the dry air, apparently the remains +The bones have whitened and cracked in the dry air, apparently the remains of adventurers, thieves, and creatures that did not survive the fall. ~ E @@ -1273,7 +1273,7 @@ man old~ The old man looks like he has been trapped down here far too long, and has begun to lose his mind. He moves about slowly, cackling to himself. -He turns to you and shouts, 'nope measse! nope measse!', then turns +He turns to you and shouts, 'nope measse! nope measse!', then turns back and stares into the fire. 'What a strange person,' you think to yourself. @@ -1377,7 +1377,7 @@ You see a tomb. S #8725 A Looted Tomb~ -The floor of this small tomb is littered with the lids of +The floor of this small tomb is littered with the lids of smashed sarcophagi, bits of treasure dropped by thieves and looters, and corpses pulled from their resting places. ~ @@ -1427,7 +1427,7 @@ E coffin lid~ The coffin is sculpted into the form of a man, standing several heads above you, and clad in the garments of pharoahs. It has apparently been untouched -by the ravages of time and the activities of looters. Several markings on the +by the ravages of time and the activities of looters. Several markings on the side indicate spots where unsuccessful attempts were made to open the coffin. You can't see any way to open it. @@ -1503,8 +1503,8 @@ S #8730 The Ancient Hall~ Here the air is deathly still, motes of dust thickly obscuring your -vision. Several stone statues line the walls of the hall, depicting the -gods of an ancient society. Strange glyphs and sigils cover the walls, a +vision. Several stone statues line the walls of the hall, depicting the +gods of an ancient society. Strange glyphs and sigils cover the walls, a peculiar pictorial form of written language that you don't understand. Some steps lead to a raised dais to the south. ~ @@ -1639,7 +1639,7 @@ S #8737 A Dank Chamber~ This chamber has a dank, dusty, musty smell to it. Small footprints -in the dust betray the recent passage of some sort of creatures. A hole +in the dust betray the recent passage of some sort of creatures. A hole in the floor lies to the west and a stairway is to the east. ~ 0 D 0 @@ -1829,8 +1829,8 @@ S A Rubble-Strewn Hallway~ This hallway formerly had a beautiful arch to the ceiling, now collapsed under the weight of the slowly settling stones of the -pyramid. Now, a massive pile of rubble leads up into a hole high -in the northern portion of the hallway. To the south, through the +pyramid. Now, a massive pile of rubble leads up into a hole high +in the northern portion of the hallway. To the south, through the rubble and fallen stones you see a sandstone crypt. ~ 0 ACD 0 diff --git a/src/area/quifael.are b/src/area/quifael.are index a8268c0..eba1b61 100644 --- a/src/area/quifael.are +++ b/src/area/quifael.are @@ -120,15 +120,15 @@ E plate~ The transparent bronze plate looks quite strange, but the engraved letters are quite easy to read, nevertheless :- - + Quifael's Virtual Balcony - + Do not lean out! - + Please do not try to attract the attention of any adventurers in the forest, as you are not really in existence at the moment. - + (This could possibly mess up Reality, and we wouldn't want to do that, would we?) ~ diff --git a/src/area/redferne.are b/src/area/redferne.are index 22163ce..a08b6f0 100644 --- a/src/area/redferne.are +++ b/src/area/redferne.are @@ -273,7 +273,7 @@ This is truly a wonderful relic of the past. In it is a large cushion. S #7906 The Kitchen of Naris~ -This must be the place of food and drink. You can hear the faint noise of +This must be the place of food and drink. You can hear the faint noise of rats feasting on meat and bread from somewhere undeterminable. The sound makes you feel the agony of HUNGER. The only visible exit is south to the Northern end of the hall. To the north there is a larder, and to the east @@ -320,7 +320,7 @@ S #7909 On the stairs~ You can see up and down the stairway. It seems to take forever, either going -up OR down. It's just a seemingly insurmountable climb, either way. Up is the +up OR down. It's just a seemingly insurmountable climb, either way. Up is the bedroom of Redferne, and Down leads to the Southern end of the hall. ~ 0 CDJ 0 @@ -355,7 +355,7 @@ A large fireplace adorns the east wall, and sizzling away is the wood that is ablaze within. The bed is enormous, covering at least HALF of this great room. This stretches at least 300 square feet, so can you imagine the BED? A large staircase leads down to the hall. A couple of doors open up to a -broad balcony to the south. +broad balcony to the south. ~ 0 CDJ 0 D2 @@ -391,8 +391,8 @@ S #7913 The Monster Pen~ This looks like the cage in which a large carnivore is being kept. Judging by -the state the walls are in, this could very well be a large AGGRESSIVE animal. -This makes you pretty insecure, this stating your feeling about the place, +the state the walls are in, this could very well be a large AGGRESSIVE animal. +This makes you pretty insecure, this stating your feeling about the place, quite mildly. ~ 0 D 0 diff --git a/src/area/rom.are b/src/area/rom.are index 5ff8c98..ec49103 100644 --- a/src/area/rom.are +++ b/src/area/rom.are @@ -86,7 +86,7 @@ And the man pages, outdate. -By Liralen ~ -1 ROM~ -ROM started in early February 1993, using Merc 1.0 code. In July of 1993, +ROM started in early February 1993, using Merc 1.0 code. In July of 1993, ROM II was started, eventually replacing the original ROM. ROM was up for a little over a year, after which the code (version 2.3) was released, and various other ROM muds were started, including Rivers of Mud under @@ -174,7 +174,7 @@ fraught with misconceptions, poor examples, and outrageous hypocrisies. :) ~ -1 SOCIALS~ - + This is a complete list of socials for this MUD: Compiled originally by: Sara accuse adjust air apologize applaud babble @@ -212,12 +212,12 @@ tank starve aargh homework puff differ yae lightbulb voodoo ogg confused beam bite discodance scuff whap lag chortle zerbert twitch - + ~ -1 MERC~ -This mud is based on Merc 2.1, created by Furey, Hatchet, and Kahn. -Merc 2.1 is available as Merc_21.tar.gz from ftp.tcp.com and +This mud is based on Merc 2.1, created by Furey, Hatchet, and Kahn. +Merc 2.1 is available as Merc_21.tar.gz from ftp.tcp.com and ftp.math.okstate.edu. E-mail to 'majordomo@webnexus.com' to join the merc mailing list. @@ -255,16 +255,16 @@ THIS IS A MUD BASED ON..... ROM 2.4 copyright (c) 1993-1998 Russ Taylor By what name do you wish to be known? ~ - --1 MOTD~ -* You are responsible for knowing the rules (type 'rules'). Ignorance of + +-1 MOTD~ +* You are responsible for knowing the rules (type 'rules'). Ignorance of the rules is no excuse. * Important commands: help, commands, news, notes * Use the delete command to erase unwanted characters - + [Hit Return to continue] -~ - +~ + 52 IMOTD~ Welcome Immortal! @@ -285,7 +285,7 @@ This is a partial list of what a god of any given level should be doing. It is not complete yet. Angels:(52-54) -Angels and higher level gods may not assist mortals directly in any way. +Angels and higher level gods may not assist mortals directly in any way. An Angel's main job is to help with quests (via switch), or possibly run small quest of their own -- but the rewards should be minimal. @@ -311,7 +311,7 @@ Not fufilling the roles of your office can result in demotion or deletion. ~ -1 PKILL PKILLING PKILLER 'PLAYER KILLING' PSTEAL PSTEALING 'PLAYER STEALING'~ -Player killing and player stealing are allowed to all clan members +Player killing and player stealing are allowed to all clan members (including loners), provided the victim is is within 8 levels of the character and is also in a clan. This will flag you as a "killer" or "thief", allowing any character to attack, and also provoking action @@ -323,38 +323,38 @@ from the city guard. ********************** ** The Rules of ROM ** ********************** - + 1) Do not kill mortals, do not kill mortals, do not kill mortals. This includes transferring/summoning them to aggressive mobs. - -2) Do not cheat for ANY mortal in ANY way, especially your own. + +2) Do not cheat for ANY mortal in ANY way, especially your own. Unless of course you LIKE deletion. Yes this includes tanking, - healing/restoring, casting protection spells , + healing/restoring, casting protection spells , and softening up or altering mobs. - + 3) Do not transfer or summon mobs to mortals or mortals to mobs. They have legs, if they want to kill a mob, they can easilly go there themselves. - + 4) DO NOT kill the shopkeepers for any reason at ALL. - + 5) DO NOT use reboot. <--- Note, simple English. - + 6) Do not give out free equipment. You don't need to win brownie points with the mortals. Quest are fine but handing out items isn't. - -7) A note on quests: Quests are a good thing, more or less, BUT - do not give out overly extravagant prizes. Exercise some + +7) A note on quests: Quests are a good thing, more or less, BUT + do not give out overly extravagant prizes. Exercise some common sense here folks. Do not load items more than 4 levels below their normal level (i.e. no level 5 ogre gauntlets). - -8) Do not undermine the authority of a higher level god. If you + +8) Do not undermine the authority of a higher level god. If you see that someone has been frozen or nochannelled do not restore their priveleges. They are being punished for a reason. - -9) Do not try to overrule each other. - + +9) Do not try to overrule each other. + 10) Trusted mortals: Do not use your god powers to help your mortal character. If you do, your trust will be taken away. @@ -368,14 +368,14 @@ These are the rules of ROM. For other matters, use common sense. * Your presence here is a privilege not a right. Obey any orders from gods, and you will be fine. Deletion does not require a reason, appeals are to be sent to the implementors. - + * Sitting around idle with a client is hazardous to your health. If we catch you doing it, you will lose half your playing time. -* No multiple logins, multiple playing, or helping your own characters with +* No multiple logins, multiple playing, or helping your own characters with other characters you own -- by any arrangment. - -* No kill stealing. This means you cannot attack a mob someone else is + +* No kill stealing. This means you cannot attack a mob someone else is fighting, unless they ask you to. Also avoid attacking fleeing mobs. * Cheating will not be tolerated. This includes accepting favors from gods @@ -393,17 +393,17 @@ and you cannot be forced to delete. Typing delete with an argument will return your character to 'safe' status if you change your mind after the first delete. ~ - + 0 HEALER~ The healer decided to grab a quick buck, and now charges for his heals. Some services are still free to players of level 10 or below, however. To see a full listing of the healer's services, type 'heal' at his residence. To receive healing, bring plenty of money, and type 'heal '. -~ +~ -1 GAIN~ -The gain command is used to learn new skills, once the proper trainer has +The gain command is used to learn new skills, once the proper trainer has been found. (Check New Thalos) The following options can be used with gain: gain list: list all groups and skills that can be learned @@ -413,7 +413,7 @@ gain convert: turns 10 practices into one training session Gain uses training sessions, not practices. (see 'help train') Gained skills and groups do NOT increase your experience per level or total -number of creation points. +number of creation points. ~ 52 CLONE~ @@ -426,7 +426,7 @@ The clone command duplicates an object or mobile. The level of item or mobile that may be cloned depends on your level. The target object or mob must be in the same room as you, or in your posession. Strung and set information is preserved by clone, as well as any spell effects and container contents or -mobile inventory, except for items which are too high for you to clone. +mobile inventory, except for items which are too high for you to clone. Strung extended descriptions on objects are not kept, however. ~ @@ -441,7 +441,7 @@ listed where applicable. 0 OUTFIT~ The outfit command, usable by levels 5 and below, equips your character with -a new set of sub issue gear (banner, weapon, helmet, shield, and vest), +a new set of sub issue gear (banner, weapon, helmet, shield, and vest), courtesy of the Mayor's warehouses. Only empty equipment slots are affected. ~ @@ -457,30 +457,30 @@ autoexit : display room exits upon entering a room autosplit : split up spoils from combat among your group members autoassit : makes you help group members in combat -Typing a command sets the action , typing it again removes it. -~ +Typing a command sets the action , typing it again removes it. +~ -1 CLAN~ A Clan is a collection of players, united to follow and further a common cause. Each clan has rules and regulations, to find out more about clans and their 'beliefs' type "help ". Only Clan members can kill or steal from other players. To join a Clan you must be level 5 or above and level 25 or below. Speak to the -Clan Leader about joining. If you go Loner before level 25 you may +Clan Leader about joining. If you go Loner before level 25 you may join a Clan later. - Joining a Clan is a dangerous step. Many adventurers live to + Joining a Clan is a dangerous step. Many adventurers live to kill and torture others and chances are that your paths will cross. -Remember, attacking or killing fellow clan members *IS* illegal except to +Remember, attacking or killing fellow clan members *IS* illegal except to mutiny your Clan leader. - Existing Clans may buy special rooms and mobiles by acquiring + Existing Clans may buy special rooms and mobiles by acquiring diamonds as payment. To see room prices, type "help prices". New -Clans may be formed by petitioning the immortals. Please remember that +Clans may be formed by petitioning the immortals. Please remember that their word is final on all matters not covered by this help. ~ -1 PRICES PRICE~ New Clan Hall Rooms cost 50 diamonds. Boosting the mana or healing gains for a room costs 250 diamonds. Both in the same room costs double. -Making the Healer or Store +Making the Healer or Store lower costs 1,000 diamonds. ~ @@ -488,17 +488,17 @@ Making the Healer or Store The count command displays the number of people (that you can see) logged into the mud. It also displays the highest number observed that day, if it is higher. -~ - +~ + -1 GATE~ -The gate spell is a powerful transportation magic that opens up a portal +The gate spell is a powerful transportation magic that opens up a portal between your character and another person or creature somewhere else in the world. This portal will transport you and any pet you might have, but not other members of your group. Monsters recieve a save against gate, and -monster or players more than 3 levels higher than you can not be gated to at +monster or players more than 3 levels higher than you can not be gated to at all. God rooms, private rooms, and no recall rooms cannot be gated to, and -no recall rooms cannot be gated out of. Finally, any god or hero is also -immune to gate, as well as in player who has no summon set. Clan members +no recall rooms cannot be gated out of. Finally, any god or hero is also +immune to gate, as well as in player who has no summon set. Clan members may not be gated to except by their fellow Clan members. ~ diff --git a/src/area/school.are b/src/area/school.are index 5393669..15e529f 100644 --- a/src/area/school.are +++ b/src/area/school.are @@ -2063,7 +2063,7 @@ S #3758 Furey's Training Room~ You are in Furey's Training Room. Around you are all sorts of physical -and mental training tools. The whole room is filled with magic, holiness, +and mental training tools. The whole room is filled with magic, holiness, and sweat. There is a sign on the wall. ~ 0 CDR 1 @@ -2074,9 +2074,9 @@ You see the room you came from, and the room you should go to. 0 0 3757 E sign~ -Welcome to Furey's Training Room. Here you can train your attributes. To +Welcome to Furey's Training Room. Here you can train your attributes. To train an attribute, you need enough practices. To find out how many practice -sessions you have, type 'train' while you are in this room. To train for a +sessions you have, type 'train' while you are in this room. To train for a specific attribute, type 'train ' where attr is the first 3 letters of the attribute you want increased. Type 'help train' for more information. ~ diff --git a/src/area/sewer.are b/src/area/sewer.are index f3ba661..dad2ea0 100644 --- a/src/area/sewer.are +++ b/src/area/sewer.are @@ -11,7 +11,7 @@ the horrifying mudmonster~ A horrifying mudmonster is slowly evolving from the mud ... ~ It sure looks like something out of a horror movie. It strongly resembles -a huge figure made up from mud alone, and it sure looks like it had human +a huge figure made up from mud alone, and it sure looks like it had human flesh for breakfast and is strongly intent on having the same for dinner. ~ human~ @@ -169,7 +169,7 @@ the horrifying mudmonster~ A horrifying mudmonster is slowly evolving from the mud ... ~ It sure looks like something out of a horror movie. It strongly resembles -a huge figure made up from mud alone, and it sure looks like it had human +a huge figure made up from mud alone, and it sure looks like it had human flesh for breakfast and is strongly intent on having the same for dinner. ~ human~ @@ -331,7 +331,7 @@ the junior mindflayer~ The junior mindflayer is here, watching you carefully from the corner. ~ This mindflayer is six foot high. It has a small mace in its belt, and is -dressed in purple and black cloth. It has four small tentacles in the +dressed in purple and black cloth. It has four small tentacles in the center of its head. ~ human~ @@ -558,7 +558,7 @@ A 1 3 E plate breast silvery~ -On the breast plate you notice a relief of large rose. The metal seems to be +On the breast plate you notice a relief of large rose. The metal seems to be some kind of silver or platinum. ~ #7218 @@ -820,7 +820,7 @@ the smell is absolutely OVERWHELMING. S #7002 The muddy sewer junction~ -The muddy sewer stretches into the dark to the south. It looks as if +The muddy sewer stretches into the dark to the south. It looks as if no person has ever sat his foot here before. It's too muddy for that anyway. The sewer leads north, south and east from here. ~ @@ -848,7 +848,7 @@ the smell is absolutely OVERWHELMING. S #7003 The mudhole~ -You stand in mud all the way up to your thighs and it's not too +You stand in mud all the way up to your thighs and it's not too comfortable since you are used to a somewhat different environment. The sewer leads to the north of here. In the middle you can just make out an enormous drainpipe leading down. @@ -883,7 +883,7 @@ East. The sewer leads into the sewer junction. ~ 0 -1 7009 D5 -The Dark Pit leads down and down and down ... well you can't see the +The Dark Pit leads down and down and down ... well you can't see the bottom anyway. There are bars that function as a ladder on the side. ~ ~ @@ -902,7 +902,7 @@ East. The mud stretches on into the darkness. ~ 0 -1 7011 D2 -South. There is even more mud in that direction than where you are now. +South. There is even more mud in that direction than where you are now. Incredible. ~ ~ @@ -916,7 +916,7 @@ S #7006 The muddy sewer~ You are standing in something that reminds you very much of porridge, this -has the advantage that it's not hot, it's rather cold actually. The pipe +has the advantage that it's not hot, it's rather cold actually. The pipe bends to the north and east. ~ 0 AD 5 @@ -945,13 +945,13 @@ bend in which you stand leads west and south. ~ 0 AD 5 D2 -The pipe leads into a intersection that goes south and east. The floor here +The pipe leads into a intersection that goes south and east. The floor here is still covered in mud. ~ ~ 0 -1 7008 D3 -The pipe (still filled with mud) leads into a intersection that goes north +The pipe (still filled with mud) leads into a intersection that goes north and south. Interesting. ~ ~ @@ -978,13 +978,13 @@ The bend leads west. 0 -1 7007 D1 East. This way like a place for the annual mud festival, although the stench -wouldn't allow any happiness at all. The pipe leads into a bend that leads +wouldn't allow any happiness at all. The pipe leads into a bend that leads north. ~ ~ 0 -1 7014 D2 -South. There's less mud in that direction. *smile*. Your light doesn't +South. There's less mud in that direction. *smile*. Your light doesn't cover enough space for you to see much more than that it leads into some sort of junction. ~ @@ -1014,7 +1014,7 @@ YYEEUUCH! BOOH! THAT looks like a nice place for creepy crawlies. ~ 0 -1 7017 D2 -North. This direction looks quite nice actually. The pipe leads into +North. This direction looks quite nice actually. The pipe leads into a bend that goes east. ~ ~ @@ -1051,7 +1051,7 @@ S #7011 The muddy sewer pipe~ You have entered a kind of tube intersection that leads south, west and east. -Your legs are covered in mud up to the knees. REAL yucky! +Your legs are covered in mud up to the knees. REAL yucky! ~ 0 AD 5 D1 @@ -1103,8 +1103,8 @@ the smell is absolutely OVERWHELMING. S #7013 A MUDDY intersection~ -You wouldn't want to know the true feeling of standing in this mud up to -your hips. >BWAADR<. All that fills your mind right now is the dream of +You wouldn't want to know the true feeling of standing in this mud up to +your hips. >BWAADR<. All that fills your mind right now is the dream of a hot bath. This is NOT very clean mud you know, remember you're in the sewer! The pipes leads north, south and east. ~ @@ -1194,7 +1194,7 @@ enough for you to climb down, WITH both hands on them. S #7016 The ordinary bend~ -You are in the middle of a bend in the pipe system of the sewer system, +You are in the middle of a bend in the pipe system of the sewer system, WHAT a place!!! The pipe leads to the south and the east. ~ 0 AD 1 @@ -1244,7 +1244,7 @@ To the north you can see a junction like this one, leading north and west. ~ 0 -1 7017 D1 -To the east there's nothing of particular interest, though there's a +To the east there's nothing of particular interest, though there's a junction with pipelines leading north and east. ~ ~ @@ -1299,7 +1299,7 @@ entryway~ S #7024 The sewer~ -You are standing in mud up to your ankles. This is an intersection with +You are standing in mud up to your ankles. This is an intersection with sewer pipes leading east, south and west. ~ 0 ACD 1 @@ -1333,7 +1333,7 @@ east. You notice that the floor to the west is covered in mud. ~ 0 -1 7024 D1 -East. You see nothing of interest in that direction, just another +East. You see nothing of interest in that direction, just another intersection. This one leads east and south. ~ ~ @@ -1347,7 +1347,7 @@ S #7026 A junction~ This one seems interesting, a big difference from all the other junctions. -It seems cleaner than the rest of them. Weird. Something that looks like +It seems cleaner than the rest of them. Weird. Something that looks like an air shaft leads upwards, but it looks far too slippery to climb. The pipes lead to the south, west and north. ~ @@ -1396,7 +1396,7 @@ To the west you can just make out an old well. S #7029 The Triple Junction~ -You stand in the middle of a huge junction of concrete sewer pipes. The +You stand in the middle of a huge junction of concrete sewer pipes. The pipes lead into three different directions : east, south and west. ~ 0 AD 1 @@ -1412,7 +1412,7 @@ an odd light. ~ 0 -1 7030 D3 -To the west you can just make out another junction similar to the one +To the west you can just make out another junction similar to the one you are standing in. ~ ~ @@ -1421,9 +1421,9 @@ S #7030 The Quadruple Junction Under the Dump~ You are standing in something that reminds you of an entry to an ant hive. -There are enormous concrete pipes leading north, south, east and west. +There are enormous concrete pipes leading north, south, east and west. There's also a metal ladder built into the concrete wall leading up through -a layer of garbage. +a layer of garbage. ~ 0 ACD 1 D0 @@ -1500,7 +1500,7 @@ West. You can just make out a triple junction leading north and west. S #7035 The sewer pipe bend~ -You can look in two different directions where the pipe goes : west and +You can look in two different directions where the pipe goes : west and north. ~ 0 AD 2 @@ -1571,7 +1571,7 @@ West. You see another junction similar to this one leading north and south. S #7039 The Sewer Store Room~ -You stand in a small room lit by a single torch set in the wall. The only +You stand in a small room lit by a single torch set in the wall. The only way out of here is to the north. ~ 0 D 1 @@ -1594,7 +1594,7 @@ To the south you can see the pipe leading further south into darkness. ~ 0 -1 7043 D5 -Down and utter darkness. There's absolutely nothing to be seen in that +Down and utter darkness. There's absolutely nothing to be seen in that direction. ~ ~ @@ -1736,7 +1736,7 @@ and west. S #7050 The small room~ -The only thing in this room of interest is a chair, and that's tight to the +The only thing in this room of interest is a chair, and that's tight to the rock floor. A doorway leads south and another leads east into darkness. ~ 0 AD 1 @@ -1758,7 +1758,7 @@ floor makes you think twice about taking it along with you. S #7051 The Sewer pipe~ -You are in what reminds you of a foul sewer, as if you liked being here! +You are in what reminds you of a foul sewer, as if you liked being here! You can see two exits leading either north or south. ~ 0 D 1 @@ -1774,7 +1774,7 @@ To the south you can see a strange light flowing from there. S #7052 The Grand Sewer~ -You are in a Grand Sewer Pipe. This stretches toward the south. It's large +You are in a Grand Sewer Pipe. This stretches toward the south. It's large indeed! A doorway leads to the east from here. ~ 0 D 1 @@ -1817,7 +1817,7 @@ leads east and a doorway leads west. ~ 0 AD 3 D1 -You can hardly make out much more than that the next place is in a pipe +You can hardly make out much more than that the next place is in a pipe with more water. ~ ~ @@ -1850,7 +1850,7 @@ You see a lot of light, bright as daylight, but nothing of interest. S #7057 The dark passageway~ -You can't see anything but the ground where you put your feet. The +You can't see anything but the ground where you put your feet. The passageway seems to continue south and north. ~ 0 AD 1 @@ -2134,9 +2134,9 @@ S #7069 A ledge by the dark pool~ You can't see much here but the echo tells you that there's quite a drop -down. You can just make out a huge dark pool out there in the darkness, +down. You can just make out a huge dark pool out there in the darkness, mostly because of the trickling of water. The water from the sewer actually -washes over this ledge and makes it quite slippery. From here it drops, +washes over this ledge and makes it quite slippery. From here it drops, like a waterfall, into the pool far down. ~ 0 AD 5 @@ -2187,7 +2187,7 @@ S #7099 The fissure under the ledge~ This is a small fissure in the solid rock. Under you lies the deep dark pool. -The water trickles quietly down from the ledge above you. The water smells +The water trickles quietly down from the ledge above you. The water smells like the water in a sewer. ~ 0 ACD 5 @@ -2204,9 +2204,9 @@ S #7101 Under the mudhole~ You stand in a small room with a great big opening in the ceiling. From this -opening there's mud dripping down in large lumps. >YUCK<. You can smell the -foul stench of the slimy sediment as you try not to get covered by the -falling sludge. To the east there is an entryway leading out from here and +opening there's mud dripping down in large lumps. >YUCK<. You can smell the +foul stench of the slimy sediment as you try not to get covered by the +falling sludge. To the east there is an entryway leading out from here and it seems absolutely impossible to force the muddy descent. ~ 0 ACD 5 @@ -2261,7 +2261,7 @@ You have a feeling it would be nice to have your feet free from mud again. ~ 0 -1 7104 D3 -You can see a room in which mud drips from the roof onto the floor in +You can see a room in which mud drips from the roof onto the floor in great cakes of sludge. There doesn't seem to be any exits from that room apart from in you direction. ~ @@ -2297,7 +2297,7 @@ S #7105 Down the old well~ You are dangling on the slippery sides of the old well leading down and up. -The only secure point here is the metal bars that are cemented into the +The only secure point here is the metal bars that are cemented into the sides, the ones that you cling frantically to so that you don't fall. Who knows how deep this well is? ~ @@ -2310,7 +2310,7 @@ Anyway it SEEMS darker down here than up there, if that is possible. 0 -1 7015 D5 Down there nothing at all can be spotted. The darkness that engulfs this -descent seems utterly impossible in a mortal world. It's so thick that a +descent seems utterly impossible in a mortal world. It's so thick that a torch down there would be utterly useless. You'd better not go down any further. ~ @@ -2324,7 +2324,7 @@ not go down any further. S #7106 The northwestern corner of the ledge~ -You stand, swaying out from the ledge, with only a couple of inches of safe, +You stand, swaying out from the ledge, with only a couple of inches of safe, solid ledge under your feet. The ledge continues to the east but not back south. It seems that the ledge is too narrow to turn on so you'll have to continue forward. @@ -2355,7 +2355,7 @@ North. The ledge leads into a corner and turns eastward. ~ 0 -1 7106 D1 -You stare into mid-air, and right under there's absolutely nothing but +You stare into mid-air, and right under there's absolutely nothing but darkness. You shiver by the thought of falling an utterly unknown distance. ~ ~ @@ -2443,8 +2443,8 @@ South. You can just make out the south-western corner of this ledge. S #7111 The southwestern corner of the ledge~ -This seems like a ledge that is a little broader than the one just to the -north of here. The ledge seems to lead around some sort of Abyss of total +This seems like a ledge that is a little broader than the one just to the +north of here. The ledge seems to lead around some sort of Abyss of total darkness. The ledge seems to have an odd-looking edge here. ~ 0 ACD 5 @@ -2481,7 +2481,7 @@ SPLAT!!! E edge odd-looking~ This is truly a weird piece of craftsmanship in your eyes. The edge seems to -form a step leading down, but WHAT a STEP DOWN. The Abyss opens down there +form a step leading down, but WHAT a STEP DOWN. The Abyss opens down there leading to seemingly total destruction. ~ S @@ -2546,9 +2546,9 @@ You've fallen, and you can't get up!!! S #7115 The Broad ledge~ -You are standing on a ledge that seems quite a lot larger than the rest +You are standing on a ledge that seems quite a lot larger than the rest of the ledges. This one leads to the west and the east, plus it has an exit -going to the south. Though you could jump into mid-air, but it probably +going to the south. Though you could jump into mid-air, but it probably wouldn't be such a good idea. The way south is in utter darkness. ~ 0 ACD 4 @@ -2598,7 +2598,7 @@ into the seemingly solid rock face of the ledge. E ground ledge rock~ The ground here seems a little different from all the other ledges along the -Abyss. There's a kind of soft soil on this ledge, maybe you should look +Abyss. There's a kind of soft soil on this ledge, maybe you should look carefully at this. It seems to be of some interest. ~ S @@ -2782,7 +2782,7 @@ S The Edge of the Water~ The pool side is dimly lit up by your light. You can see absolutely nothing else nearby. The darkness here seems enormously oppressive. The air is -damp and the rock on which you stand is slippery. The pool seems too dark +damp and the rock on which you stand is slippery. The pool seems too dark to make anything clear. The rock can be climbed upwards from here. ~ 0 ACD 5 @@ -2814,7 +2814,7 @@ This is a heavy black stone door it looks very solid. S #7201 The inner Lair~ -You are in a octagonal room with smooth purple stone walls. The floor is +You are in a octagonal room with smooth purple stone walls. The floor is made from black stone. In the western wall you see a large black stone door. ~ 0 AD 0 @@ -2832,7 +2832,7 @@ S #7202 The Lair~ On the floor you see a lot of human decay, like bones and skulls. You also -see a lot of slime. On the wall is a torch sitting in its sconce. To the north +see a lot of slime. On the wall is a torch sitting in its sconce. To the north are a wooden door. ~ 0 D 1 @@ -2861,7 +2861,7 @@ The slime is slimy and uninteresting. ~ E skull skulls bones decay~ -On all the skulls you notice that there is a three inch hole in the +On all the skulls you notice that there is a three inch hole in the forehead. All the bones are broken and old. ~ S @@ -2896,7 +2896,7 @@ The slime is slimy and uninteresting. ~ E skull skulls bones decay~ -On all the skulls you notice that there is a three inch hole in the +On all the skulls you notice that there is a three inch hole in the forehead. All the bones are broken and old. ~ S @@ -2931,7 +2931,7 @@ The slime is slimy and uninteresting. ~ E skull skulls bones decay~ -On all the skulls you notice that there is a three inch hole in the +On all the skulls you notice that there is a three inch hole in the forehead. All the bones are broken and old. ~ S @@ -2961,7 +2961,7 @@ The slime is slimy and uninteresting. ~ E skull skulls bones decay~ -On all the skulls you notice that there is a three inch hole in the +On all the skulls you notice that there is a three inch hole in the forehead. All the bones are broken and old. ~ S @@ -3025,13 +3025,13 @@ The slime is slimy and uninteresting. ~ E skull skulls bones decay~ -On all the skulls you notice that there is a three inch hole in the +On all the skulls you notice that there is a three inch hole in the forehead. All the bones are broken and old. ~ S #7208 The lair entrance.~ -You are in a dry part of the sewer. To the north is a wooden door, you +You are in a dry part of the sewer. To the north is a wooden door, you can see some slime at the lower part of the door. You also see some skulls and some broken bones. ~ @@ -3172,7 +3172,7 @@ The water is dirty but it looks like you would be able to swim in it. S #7216 Under water in the sewer.~ -You swim in some dirty water and is holding you breath. You'll better +You swim in some dirty water and is holding you breath. You'll better continue before you drown. It is a good thing that you can hold your light above water-level. ~ @@ -3264,7 +3264,7 @@ You can see another drain to the east. S #7221 The sewer drain.~ -You are in a sewer drain, there is nothing special in here, except for a +You are in a sewer drain, there is nothing special in here, except for a loud echo. ~ 0 AD 3 @@ -3323,7 +3323,7 @@ S #7224 The sewer junction~ You stand in a junction of three sewer drains. You see some odd scratches on -the pipe wall, as from a gigantic rat.North and south the sewer continues +the pipe wall, as from a gigantic rat.North and south the sewer continues as usual, but west it looks a little strange. ~ 0 AD 3 @@ -3346,7 +3346,7 @@ S #7225 The sewer~ You are in a sewer, where the slimy water runs down through a tiny hole. -You see some odd scratches on the pipe wall, as from a gigantic rat. There +You see some odd scratches on the pipe wall, as from a gigantic rat. There is a sewer drain south. ~ 0 AD 3 @@ -3376,7 +3376,7 @@ You see a slimy sewer drain. S #7230 The damp sewer~ -You are in a sewer drain with a funny damp substance on the floor, in the +You are in a sewer drain with a funny damp substance on the floor, in the substance you see a lot of decay. You see some odd scratches on the wall, as from a gigantic rat. Both to the east and west the pipe seems to run down. ~ @@ -3433,7 +3433,7 @@ S #7233 The sewer drain~ You stand in in a sewer drain, you are able to see some kind of cave-like -room. You see some odd scratches on the drain wall, as from a gigantic rat. +room. You see some odd scratches on the drain wall, as from a gigantic rat. The sewer leads south. ~ 0 AD 3 @@ -3450,7 +3450,7 @@ You see a sewer. S #7234 The rat's lair~ -You are in a little cave. You are able to see quite a lot of debris on the +You are in a little cave. You are able to see quite a lot of debris on the floor. There is a sewer drain west of here. ~ 0 AD 3 @@ -3462,7 +3462,7 @@ You see the sewer system that way. S #7279 The Wall of the Abyss~ -You hang onto some steps leading down into utter darkness. There's an exit +You hang onto some steps leading down into utter darkness. There's an exit leading up as well, though you'll have to open the tiny rock again to do so. ~ 0 AD 5 @@ -3535,8 +3535,8 @@ S #7282 The Realm of lost souls~ You are standing in nothing. All around you there are stars. -Sometimes a shadow flies closely by you, wailing very loudly. -To the north there is a small bright hole. To the west there is +Sometimes a shadow flies closely by you, wailing very loudly. +To the north there is a small bright hole. To the west there is a small red hole. ~ 0 D 0 @@ -3603,8 +3603,8 @@ One of them looks like he has written something at the wall. S #7285 The tortureroom.~ -You are standing in a middle of a square room. Along the walls skeletons -are hanging in rusty chains. In the middle of the room there is a big metal +You are standing in a middle of a square room. Along the walls skeletons +are hanging in rusty chains. In the middle of the room there is a big metal box, covered with dust. To the south you can just make out a small exit. ~ 0 D 1 @@ -3620,7 +3620,7 @@ filled with coal, as you see some of them. ~ E skeletons~ -When you look at the skeletons, you can see that they once had been in great +When you look at the skeletons, you can see that they once had been in great pain. They are hanging in their arms, and some of them has been killed with a sharp instrument. ~ @@ -3629,7 +3629,7 @@ S The hells yard~ You are standing in a lot of mud. A disgusting smell surrounds the place, and makes you feel sick. Small flames sometimes shoot -up from the hot mud. To the west there is a small door. To the +up from the hot mud. To the west there is a small door. To the north you can see an iron door. ~ 0 CD 5 @@ -3648,8 +3648,8 @@ S The Entrance to the Realm of silence~ This is an utterly silent place. As you look around you see that there hasn't been a living thing in a long time. The dust lies here in a thick -layer on the floor and on the furniture. On the wall hangs a bleak and -worn tapestry. A winding stone staircase leads up into darkness. On the +layer on the floor and on the furniture. On the wall hangs a bleak and +worn tapestry. A winding stone staircase leads up into darkness. On the wall to the west you can see a huge torch stuck into the solid rock. A large portcullis blocks your way to the north. ~ @@ -3665,13 +3665,13 @@ D4 0 -1 -1 E stairs staircase~ -This looks as if it has been standing here for at least 12 centuries. It's +This looks as if it has been standing here for at least 12 centuries. It's Very worn and cracks in the surface mingle with the cores of mineral that penetrates the rock from which these steps are chiselled. ~ E torch light~ -This VERY old torch looks as if it has burned for ages, yet no traces of +This VERY old torch looks as if it has burned for ages, yet no traces of the searing flame can be seen on it! ~ E @@ -3684,7 +3684,7 @@ On the walls of the Abyss~ You are clutching the steps on the wall so that you don't fall to the ground down below. A large sign says : I haven't gotten any further ... Yet. But I'm pushing - to get finished with this sewer. + to get finished with this sewer. Greetings and Good Health :) Redferne The Gentle @@ -4566,7 +4566,7 @@ The hay is very dirty. The smell of it makes you feel sick. S #7440 South-western part of basilisks cave~ -You can see nothing but smoke. +You can see nothing but smoke. ~ 0 AD 5 D0 diff --git a/src/area/shire.are b/src/area/shire.are index 33586d4..ebcec5c 100644 --- a/src/area/shire.are +++ b/src/area/shire.are @@ -793,7 +793,7 @@ S #1105 The General Store~ You are inside the general store. All sorts of goodies are stacked on the -many shelves. Your local friendly shopkeeper is smiling patiently, waiting to +many shelves. Your local friendly shopkeeper is smiling patiently, waiting to serve you to the best of his abilities. The only exit is to the south. ~ 0 D 0 @@ -883,7 +883,7 @@ S Shiriff Post of the Eastern Shire~ You are in the Shiriff Post which acts as the nucleus for the three shiriffs of the Eastern Shire. As you examine the shiriffs on duty, you come to realize -that the halflings of the Shire are not to be reckoned with. You cower with +that the halflings of the Shire are not to be reckoned with. You cower with awe. A door offers passage to the east. ~ 0 D 0 @@ -1011,7 +1011,7 @@ S Shiriff Training Grounds~ The sounds of mock battle and feigned death cries fill your ears. Every which way you turn you see halfling trainees at the prime of their youth. A -wizened old battle instructor meets your gaze and asks if he may be of +wizened old battle instructor meets your gaze and asks if he may be of service. The only exit lies to the west. ~ 0 0 0 @@ -1091,8 +1091,8 @@ S The Grocer's Delight~ You tremble with ecstasy as the tempting odors of freshly made pipeweed bread fill your lungs. Rumor has it that the pipeweed bread sold here can -restore vitality. You look around but find no one to take your order. -You then peep over the counter and discover a friendly grocer who is too +restore vitality. You look around but find no one to take your order. +You then peep over the counter and discover a friendly grocer who is too short to be seen over the counter. The only exit is to the north. ~ 0 D 0 @@ -1289,7 +1289,7 @@ To the south runs Bywater Road. S #1132 Delving Lane~ -Delving Lane runs north and south in this small borough of the Shire. To +Delving Lane runs north and south in this small borough of the Shire. To the south stands Brandywine Bridge. The Green Dragon, the undisputed leader in the art of innkeeping, offers rest and comfort to the east. You hear the bray of horses from the west. @@ -1313,7 +1313,7 @@ Brandywine Bridge offers safe passage across the tumultuous river. S #1133 Delving Lane~ -Delving Lane runs north and south in this small borough of the Shire. A +Delving Lane runs north and south in this small borough of the Shire. A large, imposing building lies to the east. You hear the bray of horses from the west. ~ @@ -1477,7 +1477,7 @@ S #1141 Gamgee Residence~ You stand inside a modest home. You deduce that this is indeed the home -of whomever owns the surrounding lands. The air is somewhat musty and +of whomever owns the surrounding lands. The air is somewhat musty and the smell reminds you of a stable. As you look around disdainfully, you think to yourself that this is more of a shack than a proper residence and you long for the urban riches of the Shire proper. @@ -1684,7 +1684,7 @@ Above a great oak door you see a sign which reads 'Shirriff Post'. S #1152 A dark tunnel~ -You stand inside a small underground tunnel. The ceiling is so low that +You stand inside a small underground tunnel. The ceiling is so low that you must crouch to avoid hitting your head. The tunnel continues north and south. To the west lies a small home. All you can see is darkness. ~ @@ -1707,7 +1707,7 @@ You see a halfling hole. S #1153 Shiriff Post of the Lower Shire~ -You are in the shiriff Post which acts as the nucleus for the three shiriffs +You are in the shiriff Post which acts as the nucleus for the three shiriffs of the Lower Shire. As you examine the shiriffs on duty, you come to realize that the halflings of the Shire are not to be reckoned with. You cower with awe. The only exit is to the east. @@ -1764,8 +1764,8 @@ A trapdoor on the ceiling reveals a passageway. S #1157 The Inn of the Green Dragon~ -You are standing in the Inn of the Green dragon. Large paintings of -halflings at work, and halflings at play adorn the walls. Comfortable +You are standing in the Inn of the Green dragon. Large paintings of +halflings at work, and halflings at play adorn the walls. Comfortable benches and seats line the walls. A stairway leads down. ~ 0 DE 0 diff --git a/src/area/smurf.are b/src/area/smurf.are index 4c2c1b2..328ded7 100644 --- a/src/area/smurf.are +++ b/src/area/smurf.are @@ -330,7 +330,7 @@ S #104 Entrance to Smurf Village~ You stand at the entrance to a tiny village. You can see across the whole -village easily. Little blue creatures with white hats and boots and little +village easily. Little blue creatures with white hats and boots and little fluffy tails scamper about. They sing continuously. The singing is getting on your nerves and you have the urge to squash them. ~ @@ -703,7 +703,7 @@ Smurfy Road S #121 Hefty Smurf's Home~ -Hefty is anything but wimpy. So is his house. It actually took you a +Hefty is anything but wimpy. So is his house. It actually took you a couple of minutes to destroy his house. Better watch out -- he might be a little mad at you. Smurfy Road is back to the north. ~ diff --git a/src/area/social.are b/src/area/social.are index b261201..ff42856 100644 --- a/src/area/social.are +++ b/src/area/social.are @@ -385,14 +385,14 @@ hiccup 0 0 $n hiccups. # -lick 0 0 -You lick your mouth and smile. -$n licks $s mouth and smiles. -You lick $N's jawline delicately. -$n licks $N's jawline delicately. -$n licks your jawline delicately. -Lick away, nobody's here with that name. -You lick your own eyebrows. +lick 0 0 +You lick your mouth and smile. +$n licks $s mouth and smiles. +You lick $N's jawline delicately. +$n licks $N's jawline delicately. +$n licks your jawline delicately. +Lick away, nobody's here with that name. +You lick your own eyebrows. $n licks $s own eyebrows. love 0 0 @@ -490,15 +490,15 @@ You want to smirk to whom? You smirk at yourself. Okay..... $n smirks at $s own 'wisdom'. -snap 0 0 -Eureka! You snap your fingers. -$n snaps $s fingers. -You snap back at $M. -$n snaps back at $N. -$n snaps back at you! -You must be very agitated. -You snap yourself to attention. -$n snaps $mself to attention. +snap 0 0 +Eureka! You snap your fingers. +$n snaps $s fingers. +You snap back at $M. +$n snaps back at $N. +$n snaps back at you! +You must be very agitated. +You snap yourself to attention. +$n snaps $mself to attention. sneeze 0 0 Gesundheit ! @@ -820,7 +820,7 @@ $n yodels to you...you cringe and turn away. That person just escaped! Well, it's up to you if you want to damage your hearing. $n yodels to $mself. What a sado-masochist. - + faint 1 0 You faint. $n faints. @@ -829,29 +829,29 @@ $n faints into $N's open arms. $n just fainted into YOUR arms. You fall on the floor and look stupid--really suave. # - -pinch 1 0 -You say, 'A pinch of this, and a dab of that.' -$n says, 'A pinch of this and a dab of that.' -You squeeze $S bottom and grin. -$n pinches $N's bottom and grins. -$n pinches your bottom and grins. -You'd like to, wouldn't you? -You pinch yourself to see if you are dreaming! -$n pinches $mself to see if $e is dreaming! - - -stroke 1 0 -You stroke the air vaguely. -$n makes vague stroking motions. -You gently stroke $S inner thigh. $N inhales sharply. -$N exhales sharply and suddenly. -$n gently strokes your inner thigh. You inhale sharply. -Maybe you should practice on yourself first. -You are about to do something you'd rather not be caught doing. -# - - + +pinch 1 0 +You say, 'A pinch of this, and a dab of that.' +$n says, 'A pinch of this and a dab of that.' +You squeeze $S bottom and grin. +$n pinches $N's bottom and grins. +$n pinches your bottom and grins. +You'd like to, wouldn't you? +You pinch yourself to see if you are dreaming! +$n pinches $mself to see if $e is dreaming! + + +stroke 1 0 +You stroke the air vaguely. +$n makes vague stroking motions. +You gently stroke $S inner thigh. $N inhales sharply. +$N exhales sharply and suddenly. +$n gently strokes your inner thigh. You inhale sharply. +Maybe you should practice on yourself first. +You are about to do something you'd rather not be caught doing. +# + + apologize 1 0 You apologize until you are blue in the face. $n apologizes profusely. @@ -860,7 +860,7 @@ $n apologizes to $N with a very sincere look on $s face. $n apologizes to you and begs for forgiveness. Who's that? # - + caress 1 0 Who do you wish to caress? $n looks for someone to caress. @@ -869,7 +869,7 @@ $n tenderly caresses $N. $n tenderly caresses your body. You're S.O.L., buddy. # - + stagger 1 8 You stagger blindly around the room. $n staggers blindly around the room. @@ -878,17 +878,17 @@ $n staggers into $N. $n staggers blindly into you. Stagger into whom!?!? # - -snort 1 0 -You snort derisively. -$n snorts derisively. -You snort derisively at $N. -$n snorts derisively at $N. -$n snorts at you. -Snort at whom? -You snort derisively at yourself. + +snort 1 0 +You snort derisively. +$n snorts derisively. +You snort derisively at $N. +$n snorts derisively at $N. +$n snorts at you. +Snort at whom? +You snort derisively at yourself. $n snorts derisively at $sself. - + slobber 1 0 You slobber down your front. $n slobbers all over $mself. @@ -897,7 +897,7 @@ $n slobbers on $N **Yuck** $n slobbers disgustingly on you. Slobber on WHOM? # - + blink 1 0 You bat your eyelashes. $n blinks innocently. @@ -907,7 +907,7 @@ $n blinks innocently at you. Feign innocence for whom? You try to convince yourself of your innocence. # - + tease 1 0 What a tease. SHEESH. $n looks around for someone to tease. @@ -917,7 +917,7 @@ $n sticks $s tongue out at you, what a DORK!! Tease whom? You tease yourself. NYAH NYAH NYAH. $n teases $mself. - + knee 1 8 You raise one knee, preparing to do justice... $n cocks one knee threateningly. @@ -927,7 +927,7 @@ $n suddenly knees you in the groin! You fall to your knees in agony. Whom do you wish to render impotent? What ARE you thinking !?!??!?!?!?! # - + flirt 1 0 You flirt outrageously. $n is an outrageous flirt. @@ -937,7 +937,7 @@ $n flirts with you. Sorry no one here to flirt with. :( You flirt with yourself -- what ARE you trying to gain!?!?!? $n flirts with $mself, wonder what $e is trying to accomplish? - + tip 1 0 You tip your hat gallantly. $n gallantly tips $s hat. @@ -946,7 +946,7 @@ $n gallantly tips $s hat to $N. $n gallantly tips $s hat to you. But there is no one here to impress?!?! # - + lust 1 0 Your hormones begin to rage. $n has that look of lust in $s eyes --- Get away QUICK! @@ -956,7 +956,7 @@ $n lusts after your delectable body. Whom are you trying to lust after? Oh, please! You aren't THAT great... $n lusts after $mself, lonely eh? - + flutter 1 0 You flutter your eyelashes seductively. $n flutters $s eyelashes seductively. @@ -965,7 +965,7 @@ $n flirts with $N, flutters $s eyelashes at $M. $n flutters $s eyelashes at you coyly. EH? Can't see them here. # - + bark 1 0 You bark loudly. $n barks like a dog. GO DAWGS SIC 'EM!!! WOOF! WOOF! WOOF! WOOF! @@ -975,7 +975,7 @@ $n barks loudly at you, you back away, because $e might bite too!! Bark at whom? You bark at yourself and jump back in fear. $n barks at $mself and cowers in fear. - + howl 1 0 You howl at the moon. $n howls at the moon. @@ -984,7 +984,7 @@ $n howls at $N. $n howls soulfully at you. Who? What? Where? # - + babble 1 0 You babble endlessly. $n babbles endlessly, won't $e EVER shut up? @@ -994,7 +994,7 @@ $n babbles at you. You nod mechanically, hoping $e will shut up soon. Whom do you wish to annoy with your babble? You babble on and on to yourself, FINALLY! someone who LISTENS!! $n babbles quietly to $mself. - + ramble 1 0 You ramble on and on. $n rambles on about a boring exploit. @@ -1003,7 +1003,7 @@ $n blithers on and on to $N about something. $n tells you a rather boring tale, you feign interest. ??EH?? # - + hush 1 0 SHHHHHHHHHHHHHHHHHHHHHH $n requests everyone quiet down. Shhhhhhhhhhh... @@ -1013,7 +1013,7 @@ $n kindly requests that you please quiet down. Who needs to be silenced? You realize you are loud and obnoxious and try to silence yourself. $n covers $s mouth in an attempt to silence $mself. - + threaten 1 8 You threaten everyone with your overwhelming presence. You feel threatened in the presence of the great $n. @@ -1022,7 +1022,7 @@ $n threatens $N forcefully. $n threatens you...oooooooh scary *laugh* Whom do you wish to intimidate? # - + roll 1 0 You roll your eyes in disgust. $n rolls $s eyes, disgusted. @@ -1032,7 +1032,7 @@ $n rolls $s eyes at you. You should be disgusted with yourself because you look so foolish. At whom do you wish to roll your eyes? # - + swoon 1 0 You swoon. $n swoons in absolute ecstasy. @@ -1041,7 +1041,7 @@ $n looks at $N and swoons in ecstasy. $n looks at you and swoons in ecstasy. Who? # - + bird 1 0 You flick a bird...How obscene! $n flicks a bird at no one in particular. @@ -1050,7 +1050,7 @@ $n gives $N the bird. $n gives you the bird...What an ass! Don't you hate to waste a good obscene gesture like that? # - + eyebrow 1 0 You raise an eyebrow at the notion. $n raises an eyebrow. @@ -1059,7 +1059,7 @@ $n raises an eyebrow at $N's weird actions. $n raises an eyebrow at you. Forget it. They aren't here. # - + serenade 1 0 You raise your voice in a loud serenade to your invisible love. $n raises $s voice to serenade the world. @@ -1069,7 +1069,7 @@ $n serenades you, you are swept away by $s voice. The one that you wish to serenade has left you to sing to yourself. You sing a loud serenade to yourself. What type of person are you?! $n serenades $mself. What an ego! - + grimace 1 0 You grimace painfully at the thought. $n grimaces painfully at the thought. @@ -1079,7 +1079,7 @@ $n grimaces at you. What could be wrong? You grimace at no one in particular. You grimace painfully at your thoughts. $n grimaces painfully to $mself. - + boggle 1 0 You boggle at the concept. $n boggles at the concept. @@ -1089,7 +1089,7 @@ $n boggles at you. Boggle away. They've left. You boggle at yourself. Hmmm...intriguing. $n boggles quietly to $mself. - + beckon 1 0 You beckon for everyone to follow. $n beckons for everyone to follow. @@ -1099,7 +1099,7 @@ $n beckons for you to follow. So sorry, that person has already left. You beckon to your shadow to follow. $n beckons to $s shadow to follow. - + wonder 1 0 You wonder about how things could have been. $n gets a blank stare on $s face. What could $e be wondering about? @@ -1109,7 +1109,7 @@ $n looks at you quizzically. You wonder what would have happened had they been here. You wonder about yourself and your purpose here. A blank stare crosses $n's face. What could $e be wondering about? - + worry 1 0 You worry about what's going to happen. A troubled look suddenly crosses $n's face. Wonder what's wrong? @@ -1119,7 +1119,7 @@ $n looks at you worriedly. Well they obviously aren't worried -- they left! You worry about what's going to happen. A troubled look suddenly crosses $n's face. Wonder what's wrong? - + drool 1 0 You drool down the front of your shirt. $n drools all over $mself -- making a TERRIBLE mess! @@ -1129,7 +1129,7 @@ $n looks at you lustily and drools. Oh fine, make a pool of slobber -- they aren't even here! You drool down the front of your shirt. $n drools all over $mself -- making a TERRIBLE mess! - + nod 1 0 You nod. $n nods. @@ -1139,7 +1139,7 @@ $n nods at you in agreement. Nod your head off -- they aren't here. You attempt to nod at yourself and get dizzy instead. $n nods quietly to $mself. What a wacko. - + purr 1 0 MMMMMMEEEEEEEEEOOOOOOOOOOOOOWWWWWWWWWWW!!!!!!!!!!! $n purrs contentedly. @@ -1149,7 +1149,7 @@ $n rubs up against you and purrs contentedly. You silly cat! They aren't here. You purr quietly to yourself. $n purrs contentedly to $mself. - + point 1 0 You point in every direction. $n points excitedly! @@ -1159,7 +1159,7 @@ $n points at you. How rude! You point at no one in particular. You point at yourself, obviously very confused. $n points at $mself, obviously very confused. - + rub 1 0 You rub your hands together in greedy anticipation. $n rubs $s hands together in greedy anticipation. @@ -1169,7 +1169,7 @@ $n gives you a rubdown, running $s hands over your tense shoulders...Mmmm... Shame to waste those talented hands, but they've already left. You rub yourself...lingering a little too long in some places. $n rubs $mself...what a creep! - + bleed 1 0 You bleed profusely -- making a horrible mess! $n weakly bleeds all over the floor. @@ -1179,7 +1179,7 @@ $n bleeds on you -- ewww! Get away!! Bleed on whom? You bleed all over yourself. $n bleeds profusely all over $mself. - + highfive 1 0 You jump in the air and give a BIG high five to...umm...absolutely nothing. $n wildly high fives the air, looking very foolish -- very foolish indeed. @@ -1189,7 +1189,7 @@ $n gives you a BIG high five! Way to go!! Sorry, they have already left. You try to give yourself a high five. What ARE you thinking? $n tries to high five $mself, but ends up looking foolish instead. - + propose 1 0 You propose to everyone in the room. $n proposes to everyone in the room. Very odd. @@ -1199,7 +1199,7 @@ $n gets down on one knee and romantically proposes to you. You must be lonely. They aren't here. You are SO full of yourself! $n proposes to $mself -- how narcissistic! - + peer 1 0 You peer around yourself intently. $n peers around $mself intently. @@ -1209,7 +1209,7 @@ $n peers at you intently. They aren't here. You get a little cross-eyed with your attempts to stare yourself down. $n peers at $mself, crossing $s eyes in the process. - + worship 1 0 You prostrate yourself and worship the gods! $n prostrates $mself and worships the gods! @@ -1242,10 +1242,10 @@ Don't even TRY -- they've already left. collapse 1 0 You collapse on the floor from exhaustion. -$n dramatically collapses to the floor from exhaustion. +$n dramatically collapses to the floor from exhaustion. You collapse right into $N's arms. $n collapses right into $N's arms. -Suddenly, $n collapses into your arms from exhaustion. +Suddenly, $n collapses into your arms from exhaustion. They've already left, just collapse on the floor. # @@ -1277,7 +1277,7 @@ $n boasts to $mself -- what an ego! squirm 1 0 You squirm uncontrollably in your consternation. $n squirms uncontrollably, suddenly looking very uncomfortable. -You look at $N and squirm with delight. +You look at $N and squirm with delight. $n looks at $N and squirms with delight. $n looks at you and squirms with delight. # @@ -1338,7 +1338,7 @@ mutter 1 0 You mutter quietly to yourself. $n mutters something quietly to $mself. You mutter something to $N. -$n looks at $N and mutters something nasty under $s breath. +$n looks at $N and mutters something nasty under $s breath. $n looks at you and mutters something nasty under $s breath. There's nothing left for you to say, they've left! You mutter quietly to yourself. @@ -1391,7 +1391,7 @@ $n flexes $s muscles in a vain attempt to show off to you. embrace 1 0 -Who would you like to embrace? +Who would you like to embrace? $ You wrap your arms around $N in a warm and loving embrace. $n wraps $s arms around $N in a warm and loving embrace. @@ -1419,7 +1419,7 @@ $n bonks you on the head for being so foolish. You bonk yourself, fool that you are. $n bonks $mself and grimaces in pain. -squeal 1 0 +squeal 1 0 You squeal with delight! $n lets out a sudden squeal of delight! You look at $N and squeal with delight! @@ -1466,7 +1466,7 @@ $n slams into you, moshing painfully against you. That REALLY hurts! Hmmm... your victim found a new dance partner. Masochist! $n throws $mself on the floor, grinding $mself into a bloody pulp - + flinch 0 0 EEEK... You flinch in obvious pain. $n flinches in obvious pain... you wonder what $e did THIS time. @@ -1476,17 +1476,17 @@ $n flinches in response to your cold rebuke. Relax, $E is gone. You can't belive what you've done... $n twitches violently, shocked at $s own behavior. - + air 0 0 You grab your air guitar and play for all you're worth. $n air-guitars like a mad man ... EXCELLENT!!! You hope $E appreciates your (total lack of) talent. -$n is surrounded by air groupies. +$n is surrounded by air groupies. $n plays a most excellent tune for you on $s most excellent air guitar. Awww... you have no audience! You play softly to yourself. # - + tweak 0 0 Tweak who? $ @@ -1496,7 +1496,7 @@ $n lovingly tweaks your cheek. It reminds you of Grandma... sniff... *Sniff* That cheek seems to be missing. You can't DO that. # - + peck 5 0 Wouldn't you like to do that to a person, or do you prefer air? $ @@ -1506,8 +1506,8 @@ $n pecks you on the cheek, how sweet! I guess you scared them away... You must REALLY like yourself. $n tries in vain to wrap $s lips around $s cheeks. - -explode 0 0 + +explode 0 0 You feel the blood boiling in your veins! $n turns a deep red, fighting to contain $s temper... You feel your rage explode deep in the pit of your stomach... @@ -1516,7 +1516,7 @@ $n is ANGRY with you... I'd run if I were you!!! Temper Temper... they left. Your soul burns brightly then fades to nothing. $n implodes!!! Only a grease spot remains where $e once stood. - + raspberry 4 0 You stick your tongue out at ... well, no one. $n sticks $s tongue out, catching a few flies in the process. @@ -1526,7 +1526,7 @@ You are splattered with saliva as $n gives you the raspberry... HOW RUDE! Hang your tongue out if you like, $e isn't here. You try to stick your tongue out at yourself... somehow, it isn't the same. # - + flash 0 0 You grin and strut as you open your coat and show what you've got! $n rips $s clothes off and parades naked around the room! @@ -1536,7 +1536,7 @@ You gasp! $n has just revealed $s "equipment" to you! Exhibitionist, that person isn't here! That's sick. PERVERT PRESENT! $n is trying to flash $mself - + strip 0 0 You do a slow strip tease for the people... $n begins a slow, erotic strip-tease act... @@ -1546,10 +1546,10 @@ $n has started to strip you... woah BABY! Your toy doesn't seem to be here... You can't DO that in public! # - + undress 0 0 You start to undress in the shadows, waiting for someone to notice. -$n begins to undress... $e is VERY sexy... *Pant* +$n begins to undress... $e is VERY sexy... *Pant* You undress $M with your eyes... Kinky. You feel the temperature of the room rise as $n lusts on $N... Feeling exposed, you sense $n undressing you with $s eyes... @@ -1566,12 +1566,12 @@ $n wraps $s tongue around you, moving it across your young, nubile flesh... Never around when required... You slowly tongue yourself. $n slowly tongues $mself... ICK. - + view 0 0 You sit back and watch the world go by. $n kicks back and enjoys the view. # - + grumble 0 0 You grumble distractedly to yourself $n grumbles and growls. You wonder what's wrong... @@ -1581,7 +1581,7 @@ $n is grumbling at you... what'd you do? That person is presently AWOL. Why bother? # - + cheer 0 0 You cheer and dance as the joy within you bursts forth! $n cheers and sings... $e is just BURSTING with joy! @@ -1591,13 +1591,13 @@ You are cheered on by $n... you feel so loved! Who? Huh? Where? They're not here, that's for sure You cheer silently for yourself since nobody else will $n resorts to cheering for $mself... how sad. - + plead 0 0 You beg and plead to anyone who will listen. $n pleads $s case to anyone who will listen... You ALMOST feel sorry for $s. # - -charge 0 0 + +charge 0 0 You charge into the fray! $n charges into the fray! All guts, no brains. With surprising dexterity, you head-butt $N! @@ -1606,7 +1606,7 @@ OOF! $n rammed $s head into your stomach! That HURT. Nobody 'round with that name, Mister! You run your head into a brick wall. OUCH! # - + criticize 0 0 Yes, but who? $ @@ -1616,7 +1616,7 @@ $n informs you that your attempts need some MAJOR adjustments. Where oh where has my victim gone, oh where oh where... You criticize yourself profusely. $n tears $mself apart, cursing $s own stupidity. - + run 0 0 You run away in terror and horror! $n runs away in utter terror! @@ -1626,7 +1626,7 @@ $n runs from you, fearing for $s life! No reason to be afraid, they aren't here. Are you THAT ugly? $n looks in the mirror, sees $s face, and runs away terrified! - + judge 0 0 Yes, but who? $ @@ -1636,12 +1636,12 @@ $n judges your actions on a scale of 1 to 10 and comes up with ZERO!!! They aren't here right now. You don't REALLY want to do that. # - + insane 0 0 You feel your sanity slipping away... Before your eyes, $n's sanity is slipping away... # - + cover 0 0 You cover your ears to protect them from the noise. $n covers $s ears to protect them from all the noise. @@ -1651,7 +1651,7 @@ $n covers $s ears because of you... you are TOO LOUD! They aren't here right now. No... I don't think so. # - + flare 0 0 You flare your nostrils disdainfully. $n flares $s nostrils disdainfully. @@ -1661,7 +1661,7 @@ $n flares $s nostrils disdainfully at you... what'd you DO??? Flare if you wish, but that person isn't here to see it. *Sniff* But you should LOVE yourself! # - + head 0 0 You toss your head haughtily. $n tosses $s head haughtily. @@ -1671,7 +1671,7 @@ $n tossed $s head haughtily at you... :( That person is AWOL. Why would you do that? # - + pie 0 0 You pick up a pie and toss it around for a bit. $n picks up a pie and tosses it around for a bit. @@ -1681,7 +1681,7 @@ $n tossed a pie in your face... and now you are all covered in GOO! That person isn't here... You bury your face in the pie... yummmmm!!! :) $n buries $s face in the pie, licking the pan clean. - + cower 0 0 You cower in a corner. $n cowers in a corner and whimpers softly. @@ -1691,7 +1691,7 @@ You scared poor $n! Now $S is cowering in a corner, afraid for $s life. That person is AWOL at the moment. You are afraid of your own shadow! $n cowers in the corner afraid of $s own shadow - + noogie 5 0 You can't noogie the AIR! It has no head. $ @@ -1701,12 +1701,12 @@ Oh NO, $n grabs you, throws you in a head lock and NOOGIES you! That person has gone off to other lands... You rub your head and create a static charge... $n rubs $s OWN head and creates a static charge... *ZAP* - + yeehaw 5 0 You mount your pony(?) and shout YEEEEEEEHAAAAAAAW! $n bounces up and down screaming *YEEEEEEHAAAAAAW!* # - + pissed 5 0 You are PISSED! $n is PISSED so watch out! @@ -1716,27 +1716,27 @@ $n is pissed at you now... What do you think $e'll DO? That person is not here... You are PISSED at yourself! $n is so pissed at $mself. How could $e be so stupid??? - + passout 5 0 You belch and pass out. $n is OBVIOUSLY intoxicated... $e burps loudly and passes out! # - + adjust 5 0 You look around, make sure nobody is watching, and you adjust your "Tool." $n looks around slyly, smiles, then reaches down and "adjusts" $mself... # - + scratch 5 0 You scratch yourself contentedly. $n reaches down and scratches $mself... Now $e looks VERY happy. # - + meditate 0 0 You assume a very comfortable position and begin to meditate. $n rests and begins to meditate... $e chants softly to $mself. # - + bkiss 0 0 You blow kisses to the air. $n blows kisses at no one in particular. @@ -1746,7 +1746,7 @@ $n blows a kiss at you and hopes you'll blow one back at $m. You kiss falls to the ground with no one to go to. You blow a kiss to yourself... isn't the world beautiful? $n blows a kiss to $mself, obviously very in love. - + beer 0 0 You pull out a six-pack. $n starts to juggle a six-pack of beer. @@ -1756,12 +1756,12 @@ $n tossed you a bottle of beer... I think $e wants something... The bottle crashes to the floor and shatters. You pop off the top and down a beer. $n pops the top off a bottle of beer and downs it in one gulp. - + bcatch 0 0 You reach out and rescue the bottle from its flight. $n reaches out and grabs the bottle of beer tossed to $m. # - + claw 0 0 You tighten your hands into a fist. $n clenches $s fists until blood drips from them... @@ -1791,7 +1791,7 @@ You try to take a step, and you hit the world facedown! Someone must have tied Whose laces? You tie your own shoelaces together, try to walk, and promptly fall. $n cleverly ties $s own shoelaces together, tries to walk, and sprawls flat on the floor. - + tag Tag whom? $n casts about for someone to tag. @@ -1801,7 +1801,7 @@ $n pounces on you and >>> TAGS <<< you! You're IT! Who were you going to tag, then? Unable to catch anyone else, you do the intelligent thing and tag yourself. You're still IT! Unable to catch anyone else, $n tags $mself. Are you impressed? - + tank You boldly offer to tank for your everyone else. Are you sure you know what you're getting into? $n offers to tank! @@ -1811,7 +1811,7 @@ $n offers to tank for you! Tank for whom? No one will tank for you, eh?!? WELL, YOU'LL SHOW THEM! (right?) In dazzling chivalry, $n offers to tank-- for $mself! - + starve You show your prominent ribs and hope that someone will take pity. $n is withering before your eyes! Starvation! @@ -1820,7 +1820,7 @@ $n begs $N for food. One would think that magic would have cured hunger by now. $n is starving before your eyes! Could you spare some food, please? Sorry, but that person isn't around-- looks like you'll starve. # - + aargh AAAAAARRRRRRGGGGGGHHHHHH!!!!!! $n throws back $s head and howls in profound frustration! @@ -1830,23 +1830,23 @@ $n grabs for your throat with two hands, howling in frustration! You get even MORE frustrated when you can't find anyone to throttle! You scream in frustration at your own stupidity! $n screams in frustration at $s own stupidity! - + homework Your suddenly remember that you have to defend your thesis today... $n looks stricken. Could $e have blown off some important homework? # - + puff You mimic Puff at her most annoying. $n says, "Did you know that I'm written in C?" # - + yae You sigh, burdened with Yet Another Eeediot. $n sighs, burdened with Yet Another Eeediot. There's Yet Another Eeediot in the room, and you're looking right at $M. -$n clearly believes that $N is an Eeediot! +$n clearly believes that $N is an Eeediot! $n glares at you, obviously not impressed with your intelligence. There are plenty of Eeediots, but that one doesn't seem to be present. You bonk yourself for the Eeediot you are! @@ -1856,7 +1856,7 @@ lightbulb *Ding!* Inspiration! A light bulb appears above $n's head! # - + voodoo Bad juju like this has to be directed at a person. $n looks hostile for a moment. @@ -1973,78 +1973,78 @@ leer 0 0 You peer around the room, leering like the pervert you are! $n peers about, leering like a filthy pervert! You leer at $N like the pervert you are. -$n eyes $N up and down, leering like a filthy pervert! +$n eyes $N up and down, leering like a filthy pervert! $n eyes you up and down, leering like a filthy pervert! You'll have to settle for memories -- that person isn't here. Desperation has reached new heights, hasn't it? $n leers at $mself shamelessly. -polite 0 0 -You give a polite little chuckle. -$n gives a polite little chuckle. -You indicate your underappreciation of $S joke. -$n gives a polite little chuckle to $N's joke. -$n gives a politle but unappreciative chuckle to your joke. -You can't find a friend to chuckle with. -You chuckle at your own joke, since no one else would. -$n chuckles at $s own joke, since none of you would. - -mischievous 0 0 -You give a mischievous smile at the trouble you have in mind. -$n grins mischievously at a nasty idea. -You grin mischievously at $M, thinking an evil thought. +polite 0 0 +You give a polite little chuckle. +$n gives a polite little chuckle. +You indicate your underappreciation of $S joke. +$n gives a polite little chuckle to $N's joke. +$n gives a politle but unappreciative chuckle to your joke. +You can't find a friend to chuckle with. +You chuckle at your own joke, since no one else would. +$n chuckles at $s own joke, since none of you would. + +mischievous 0 0 +You give a mischievous smile at the trouble you have in mind. +$n grins mischievously at a nasty idea. +You grin mischievously at $M, thinking an evil thought. $n grins mischievously at $N. $m must be thinking something evil. -$n grins mischievously at you. You inch toward the door. -You must be delirious. -You grin mischievously to yourself. +$n grins mischievously at you. You inch toward the door. +You must be delirious. +You grin mischievously to yourself. $n grins mischievously to $mself. accept 0 0 -You accept the proferred apology graciously. -$n graciously accepts the proferred apology. +You accept the proferred apology graciously. +$n graciously accepts the proferred apology. # - + anticipate 0 0 -You murmur 'Sssssoonnn, my presssssciousssss...' -$n murmurs 'Ssssssooonnnn, my pressssscioussss...' +You murmur 'Sssssoonnn, my presssssciousssss...' +$n murmurs 'Ssssssooonnnn, my pressssscioussss...' # - + shudder 0 0 -You shudder at the horror and repress tears. -$n shudders at the horror and represses tears. +You shudder at the horror and repress tears. +$n shudders at the horror and represses tears. # - + powertrip 0 0 -You scream 'The PPppppPOOOOoooWWWwwwErrRRR!' and writhe. -$n writhes, screaming 'The PPppppPOOOOoooWWWwwwErrRRR!' +You scream 'The PPppppPOOOOoooWWWwwwErrRRR!' and writhe. +$n writhes, screaming 'The PPppppPOOOOoooWWWwwwErrRRR!' # - + mull 0 0 -You mull over the idea at hand, asking for patience. -$n mulls over the idea at hand. Please be patient. -# - -wait 0 0 -You wait patiently. -$n waits patiently. -# - -bat 0 0 -You bat your long, dark lashes and smile innocently. -$n bats $s long, dark lashes and smiles innocently. -# - -sage 0 0 -You nod sagely. -$n nods sagely. -# - -contemplate 0 0 -You bite your lip contemplatively. -$n bites $s lip contemplatively. -# - -agree 0 0 +You mull over the idea at hand, asking for patience. +$n mulls over the idea at hand. Please be patient. +# + +wait 0 0 +You wait patiently. +$n waits patiently. +# + +bat 0 0 +You bat your long, dark lashes and smile innocently. +$n bats $s long, dark lashes and smiles innocently. +# + +sage 0 0 +You nod sagely. +$n nods sagely. +# + +contemplate 0 0 +You bite your lip contemplatively. +$n bites $s lip contemplatively. +# + +agree 0 0 You agree absolutely. $n agrees absolutely. You nod in enthusiastic agreement with $N. @@ -2053,56 +2053,56 @@ $n nods in enthusiastic agreement with you. Sorry, your target is absent. You find yourself most agreeable. $n finds $mself the most agreeable being alive. - -toast 0 0 -You raise a glass of champagne in a toast. -$n raises $s glass of champagne in a toast. -You raise your glass of champagne to $S. -$n silently toasts $N. -$n silently toasts you. -Your object of praise is absent. -You grin evilly and toast yourself. -$n grins evilly and toasts $mself. - -conspire 0 0 -You wink conspiratorily, waiting for the countersign. -$n winks conspiratorily, waiting for the countersign. -You induct $S into your private conspiracy with a wink. -$n winks conspiratorily at $N. You wonder what this can mean. -$n inducts you into $m private conspiracy with a wink. -Even you conspire against yourself. -$n is paranoid enough to distrust even $mself. -# - -support 0 0 -You fully support the plan. -$n fully supports the plan. -You hug $M supportively and smile. -$n hugs $N supportively and smiles. -$n hugs you supportively and smiles. -Sorry, friend, I can't see that person here. -You hug yourself sadly. -$n hugs $mself sadly. Perhaps you could help? - -pound 0 0 -You make vague pounding motions with your fist at the thought. -$n makes vague pounding motions with $m fist at the thought. -You pound $M into a bloody mass. -$n pounds $N into a bloody mass. -$n pounds you into a bloody mass. -Sorry, friend, I can't see that person here. -# - -wrist 0 0 -You hold out out a wrist for a slap. -$n holds out a wrist for a slap. -You slaps $M wrist sharply. -$n slaps $N's wrist sharply. -$n slaps your wrist sharply. -Sorry, friend, I can't see that person here. -You slap your own wrist. -$n slaps $m own wrist. - + +toast 0 0 +You raise a glass of champagne in a toast. +$n raises $s glass of champagne in a toast. +You raise your glass of champagne to $S. +$n silently toasts $N. +$n silently toasts you. +Your object of praise is absent. +You grin evilly and toast yourself. +$n grins evilly and toasts $mself. + +conspire 0 0 +You wink conspiratorily, waiting for the countersign. +$n winks conspiratorily, waiting for the countersign. +You induct $S into your private conspiracy with a wink. +$n winks conspiratorily at $N. You wonder what this can mean. +$n inducts you into $m private conspiracy with a wink. +Even you conspire against yourself. +$n is paranoid enough to distrust even $mself. +# + +support 0 0 +You fully support the plan. +$n fully supports the plan. +You hug $M supportively and smile. +$n hugs $N supportively and smiles. +$n hugs you supportively and smiles. +Sorry, friend, I can't see that person here. +You hug yourself sadly. +$n hugs $mself sadly. Perhaps you could help? + +pound 0 0 +You make vague pounding motions with your fist at the thought. +$n makes vague pounding motions with $m fist at the thought. +You pound $M into a bloody mass. +$n pounds $N into a bloody mass. +$n pounds you into a bloody mass. +Sorry, friend, I can't see that person here. +# + +wrist 0 0 +You hold out out a wrist for a slap. +$n holds out a wrist for a slap. +You slaps $M wrist sharply. +$n slaps $N's wrist sharply. +$n slaps your wrist sharply. +Sorry, friend, I can't see that person here. +You slap your own wrist. +$n slaps $m own wrist. + romeo 0 0 You light up a Romeo y Julietta cigar and puff contentedly. $n lights up a Romeo y Julietta cigar and puffs contentedly. @@ -2118,101 +2118,101 @@ You don't see that personhere. You light a Camel cigarette and inhale sharply. $n lights a Camel cigarette and inhales sharply. -whip 0 0 -You crack your bullwhip menacingly. -$n cracks a bullwhip menacingly. -You flick your whip across $M bare back. -$n flicks $s whip across $N's bare back. -$n flicks a whip across your back... the pain.. the pleasure.. -Sorry, friend, I can't see that person here. -You whip yourself into a frenzy. +whip 0 0 +You crack your bullwhip menacingly. +$n cracks a bullwhip menacingly. +You flick your whip across $M bare back. +$n flicks $s whip across $N's bare back. +$n flicks a whip across your back... the pain.. the pleasure.. +Sorry, friend, I can't see that person here. +You whip yourself into a frenzy. $n whips $mself into a frenzy. -cramp 0 0 -You gasp and clutch your abdomen, wheezing with the pain. -$n gasps and clutches $m abdomen in agony. -You hammerlock $M, screaming, "AAAAARRRRRGH!! I HAVE A CRAMP!!!" -$n hammerlocks $N, screaming, "AAAAARRRRRGH!! I HAVE A CRAMP!!!". +cramp 0 0 +You gasp and clutch your abdomen, wheezing with the pain. +$n gasps and clutches $m abdomen in agony. +You hammerlock $M, screaming, "AAAAARRRRRGH!! I HAVE A CRAMP!!!" +$n hammerlocks $N, screaming, "AAAAARRRRRGH!! I HAVE A CRAMP!!!". $n hammerlocks you, screaming "AAAAARRRRRGH!! I HAVE A CRAMP!!!" -Suffering as you are, you didn't see that person slip out. -# - -make 0 0 -You breathe heavily and wetly. -$n breathes heavily and wetly. -You steam up the windows with $M. -$n and $N start steaming up the windows. -$n starts steaming up the windows with you. -Sorry, friend, I can't see that person here. -# - -sweep 0 0 -You look at your empty arms and sigh. -$n looks at $s empty arms and sighs. -You sweep $M into your arms and kiss $M long and deeply. -$n sweeps $N into $s arms and kisses $M long and deeply. -$n sweeps you into $s arms and kisses you long and deeply. -The object of your kiss is absent. -# - -buff 0 0 -You buff your nails on your cloak. -$n buffs $s nails on $s cloak. -# - -liver 0 0 -You look angrily for someone to disembowel. -$n angrily for someone to disembowel. -You rip out $S liver and eat it. -$n rips out $N's liver and eats it. -$n rips out your liver and eats it. -The object of your wrath is absent. -# - -wrestle 0 0 +Suffering as you are, you didn't see that person slip out. +# + +make 0 0 +You breathe heavily and wetly. +$n breathes heavily and wetly. +You steam up the windows with $M. +$n and $N start steaming up the windows. +$n starts steaming up the windows with you. +Sorry, friend, I can't see that person here. +# + +sweep 0 0 +You look at your empty arms and sigh. +$n looks at $s empty arms and sighs. +You sweep $M into your arms and kiss $M long and deeply. +$n sweeps $N into $s arms and kisses $M long and deeply. +$n sweeps you into $s arms and kisses you long and deeply. +The object of your kiss is absent. +# + +buff 0 0 +You buff your nails on your cloak. +$n buffs $s nails on $s cloak. +# + +liver 0 0 +You look angrily for someone to disembowel. +$n angrily for someone to disembowel. +You rip out $S liver and eat it. +$n rips out $N's liver and eats it. +$n rips out your liver and eats it. +The object of your wrath is absent. +# + +wrestle 0 0 $ $ -You wrestle $M to the floor and pin $M there. -$n wrestles $N to the floor, pinning $M there. -$n wrestles you to the floor and pins you. -Sorry, friend, I can't see that person here. -You wrestle with your conscience. -$n wrestles with $m conscience. - +You wrestle $M to the floor and pin $M there. +$n wrestles $N to the floor, pinning $M there. +$n wrestles you to the floor and pins you. +Sorry, friend, I can't see that person here. +You wrestle with your conscience. +$n wrestles with $m conscience. + tie 0 0 -You toy with a pair of handcuffs suggestively. -$n toys suggestively with a pair of handcuffs. -You grab $N and tie $M to the bedposts. -$n grabs $N and ties $S to a four poster bed. -$n grabs you and ties you securely to a four poster bed. -Sorry, friend, I can't see that person here. -# - -tight 0 0 +You toy with a pair of handcuffs suggestively. +$n toys suggestively with a pair of handcuffs. +You grab $N and tie $M to the bedposts. +$n grabs $N and ties $S to a four poster bed. +$n grabs you and ties you securely to a four poster bed. +Sorry, friend, I can't see that person here. +# + +tight 0 0 $ $ -You hold $M tightly in your arms. -$n holds $N tightly in $m arms. -$n holds you in $m arms. -Sorry, friend, I can't see that person here. +You hold $M tightly in your arms. +$n holds $N tightly in $m arms. +$n holds you in $m arms. +Sorry, friend, I can't see that person here. # - -fatality 0 0 + +fatality 0 0 $ $ -You intone, '$N wins. Fatality.' -$n intones, '$N wins. Fatality.' -$n intones, '$N wins. Fatality.' +You intone, '$N wins. Fatality.' +$n intones, '$N wins. Fatality.' +$n intones, '$N wins. Fatality.' # - + yowl 0 0 -You yowl in frustration. -$n yowls in frustration! +You yowl in frustration. +$n yowls in frustration! # - + silly 0 0 -You do the silly walk all around the room. -$n does the silly walk all around the room. $e *is* silly. +You do the silly walk all around the room. +$n does the silly walk all around the room. $e *is* silly. # #0 diff --git a/src/area/tohell.are b/src/area/tohell.are index c2f6e08..99fa702 100644 --- a/src/area/tohell.are +++ b/src/area/tohell.are @@ -127,7 +127,7 @@ oldstyle damned soul~ a damned soul~ A damned soul wanders aimlessly here. ~ -You see the faint silhouette of a person. Looking closely at it, you can barely +You see the faint silhouette of a person. Looking closely at it, you can barely make out features that would identify it as the person it was in life. ~ human~ @@ -390,7 +390,7 @@ oldstyle burning fool~ the burning fool~ A burning fool is here, crisping away. ~ -You can barely make out anything on it. All you can make out are the flames +You can barely make out anything on it. All you can make out are the flames of Hell consuming it, and the smell of burning flesh. ~ human~ @@ -503,9 +503,9 @@ the ice devil~ A Greater Ice Devil stands here, cheerfully freezing souls. ~ This devil is a mix of bug, bird, humanoid, and who knows what else. -Its multi-faceted eyes stare everywhere. It goes about its business of +Its multi-faceted eyes stare everywhere. It goes about its business of slowly and painfully freezing the damned souls, quickly thawing them -and then starting over. Every couple of minutes, it takes time out to +and then starting over. Every couple of minutes, it takes time out to break an appendage off a nearby soul and beat the soul with it. ~ human~ @@ -607,7 +607,7 @@ A Demonic Foreman sits here, looking at blueprints. This huge demon has somehow managed to fit himself into a oversized, orange jumpsuit. The words, -'4th DEMONsion Construction Co.' are written on the +'4th DEMONsion Construction Co.' are written on the back in large, black letters. He seems none too happy to see you. ~ @@ -639,7 +639,7 @@ oldstyle office worker hell~ office worker from Hell~ An office worker from Hell is looking for a boss to piss off. ~ -Just looking at him makes your blood boil. +Just looking at him makes your blood boil. AAAAAAAAAAaaaaaaaaaaaarrrrrrrrgggggghhhhh!!!!!!!!!!! ~ human~ @@ -815,7 +815,7 @@ stand stand none 5000 #10454 oldstyle stanley~ Stanley~ -Stanley stands here, waiting to sell you one of his wonderful figurines. +Stanley stands here, waiting to sell you one of his wonderful figurines. ~ He is a crafty old fart who looks about 1000 years old, but his figurines are pretty well-known. He was rumored to have disappeared around Solace 100 @@ -831,7 +831,7 @@ stand stand male 5000 #10455 oldstyle half eaten horse carcass~ horse carcass~ -A half-eaten horse carcass is here being digested. +A half-eaten horse carcass is here being digested. ~ This is what used to be a horse. Hmm, maybe - it's hard to tell. Half of it has been digested already. @@ -1718,7 +1718,7 @@ make your blood run cold... S #10405 Gateway to Hell~ -You stand next to the very gateway of Hell. You are surrounded by +You stand next to the very gateway of Hell. You are surrounded by the sounds of torture and pain. Screams pierce the air and rattle your nerves. Displays of the treats of Hell are in all directions. A large black iron gates tower over you to the east. @@ -1934,8 +1934,8 @@ It's too smoky to see. S #10413 Trapped souls~ -There are many souls trapped behind the walls of this room, almost as though -they were trapped beneath the surface of a frozen lake. Even the floor and +There are many souls trapped behind the walls of this room, almost as though +they were trapped beneath the surface of a frozen lake. Even the floor and ceiling show the screaming faces behind them. ~ 0 AD 0 @@ -2050,7 +2050,7 @@ vandalized and torn apart. What used to be the shrine has been reduced to a large pile of stone and other debris. Various runes and demonic faces have been spray-painted on the walls and floor. Nailed to the ceiling are an assortment of skeletons. All seem to have been dead for a very long -time. All surfaces of the room are covered with dried blood and dust. +time. All surfaces of the room are covered with dried blood and dust. ~ 0 AD 0 D1 @@ -2326,7 +2326,7 @@ It is too dark to see. S #10432 Stone Hall~ -This is a roughly carved hallway. The air here is damp and musty. You +This is a roughly carved hallway. The air here is damp and musty. You hear the sound of something dripping in the distance. Your footsteps echo down the hall as you walk. There is a strange and deathly silence that fills these halls... @@ -2359,7 +2359,7 @@ bars~ S #10434 Stone Hall~ -This is a roughly carved hallway. The air here is damp and musty. You +This is a roughly carved hallway. The air here is damp and musty. You hear the sound of something dripping in the distance. Your footsteps echo down the hall as you walk. There is a strange and deathly silence that fills these halls... @@ -2379,7 +2379,7 @@ It is too dark to see. S #10435 Stone Hall~ -This is a roughly carved hallway. The air here is damp and musty. You +This is a roughly carved hallway. The air here is damp and musty. You hear the sound of something dripping in the distance. Your footsteps echo down the hall as you walk. There is a strange and deathly silence that fills these halls... @@ -2404,7 +2404,7 @@ It is too dark to see. S #10436 Stone Hall~ -This is a roughly carved hallway. The air here is damp and musty. You +This is a roughly carved hallway. The air here is damp and musty. You hear the sound of something dripping in the distance. Your footsteps echo down the hall as you walk. There is a strange and deathly silence that fills these halls... @@ -2437,7 +2437,7 @@ bars~ S #10438 Stone Hall~ -This is a roughly carved hallway. The air here is damp and musty. You +This is a roughly carved hallway. The air here is damp and musty. You hear the sound of something dripping in the distance. Your footsteps echo down the hall as you walk. There is a strange and deathly silence that fills these halls... @@ -2457,7 +2457,7 @@ It is too dark to see. S #10439 Stone Hall~ -This is a roughly carved hallway. The air here is damp and musty. You +This is a roughly carved hallway. The air here is damp and musty. You hear the sound of something dripping in the distance. Your footsteps echo down the hall as you walk. There is a strange and deathly silence that fills these halls... @@ -2513,7 +2513,7 @@ It's too dark to see. S #10442 Stone Hall~ -This is a roughly carved hallway. The air here is damp and musty. You +This is a roughly carved hallway. The air here is damp and musty. You hear the sound of something dripping in the distance. Your footsteps echo down the hall as you walk. There is a strange and deathly silence that fills these halls... @@ -2533,7 +2533,7 @@ It's too dark to see. S #10443 Stone Hall~ -This is a roughly carved hallway. The air here is damp and musty. You +This is a roughly carved hallway. The air here is damp and musty. You hear the sound of something dripping in the distance. Your footsteps echo down the hall as you walk. There is a strange and deathly silence that fills these halls... @@ -2559,7 +2559,7 @@ It's too dark to see. S #10444 Stone Hall~ -This is a roughly carved hallway. The air here is damp and musty. You +This is a roughly carved hallway. The air here is damp and musty. You hear the sound of something dripping in the distance. Your footsteps echo down the hall as you walk. There is a strange and deathly silence that fills these halls... @@ -2592,7 +2592,7 @@ bars~ S #10446 Stone Hall~ -This is a roughly carved hallway. The air here is damp and musty. You +This is a roughly carved hallway. The air here is damp and musty. You hear the sound of something dripping in the distance. Your footsteps echo down the hall as you walk. There is a strange and deathly silence that fills these halls... @@ -2612,7 +2612,7 @@ It's too dark to see. S #10447 Stone Hall~ -This is a roughly carved hallway. The air here is damp and musty. You +This is a roughly carved hallway. The air here is damp and musty. You hear the sound of something dripping in the distance. Your footsteps echo down the hall as you walk. There is a strange and deathly silence that fills these halls... @@ -2638,7 +2638,7 @@ It's too dark to see. S #10448 Stone Hall~ -This is a roughly carved hallway. The air here is damp and musty. You +This is a roughly carved hallway. The air here is damp and musty. You hear the sound of something dripping in the distance. Your footsteps echo down the hall as you walk. There is a strange and deathly silence that fills these halls... @@ -2928,7 +2928,7 @@ S Foreman's Office~ You stand in a crudly constructed office. Blueprints and change orders are scattered everywhere. A metal filing cabinet stands in the corner. Before -you stands a stone table covered with blueprints. On the wall is a +you stands a stone table covered with blueprints. On the wall is a construction plaque that reads, "4th DEMONsion Contruction" ~ 0 AD 0 @@ -3177,7 +3177,7 @@ Meat Locker~ You are standing in what looks like a meat locker. Rows of beef and other meats hang from large steel hooks. You also notice that many of the things hanging from the hooks are corpses of people. They reach out to -you as you pass them as if to plead for help from their frozen mouths. +you as you pass them as if to plead for help from their frozen mouths. The meat locker continues to the east and south. ~ 0 AD 0 @@ -3194,10 +3194,10 @@ You see more of the Meat locker S #10475 Meat Locker~ -Rows of beef and other meats hang from large steel hooks. You notice that -many of the things hanging from the hooks are corpses of people. They -reach out to you as you pass them as if to plead for help from their frozen -mouths. +Rows of beef and other meats hang from large steel hooks. You notice that +many of the things hanging from the hooks are corpses of people. They +reach out to you as you pass them as if to plead for help from their frozen +mouths. The meat locker continues to the south and west. There is a freezer door to the east. ~ @@ -3218,7 +3218,7 @@ Penguin Room~ This is what appears to be a replica of an iceberg. Penguins waddle about the room pecking at many poor souls half trapped in the icy floor. You seem to be outside, as the walls are painted to seem as if you are standing -on a vast icy slab with nothing but ocean around you. +on a vast icy slab with nothing but ocean around you. The iceberg continues to the south and east. There is a freezer door to the west. ~ @@ -3244,7 +3244,7 @@ Penguin Room~ This is what appears to be a replica of an iceberg. Penguins waddle about the room pecking at many poor souls half trapped in the icy floor. You seem to be outside, as the walls are painted to seem as if you are standing -on a vast icy slab with nothing but ocean around you. +on a vast icy slab with nothing but ocean around you. The iceberg continues to the south and west. ~ 0 AD 0 @@ -3280,7 +3280,7 @@ S #10479 Ice Creamery~ You appear to be standing in a ice-creamery. There seems to be a -group of people here shouting into containers and then quickly covering +group of people here shouting into containers and then quickly covering them. How odd... The factory continues to the south and west. There is a steel door to the east. @@ -3387,8 +3387,8 @@ You see a room of ice. S #10484 Meat Locker~ -You stand in a large meat locker. Chunks of meat hang on the wall and -larger corpses hang from steel hooks. Frozen blood and other +You stand in a large meat locker. Chunks of meat hang on the wall and +larger corpses hang from steel hooks. Frozen blood and other unrecognizable pieces are littered on the floor. The meat locker continues to the north and east. There is a freezer door to the west. @@ -3412,7 +3412,7 @@ door freezer~ S #10485 Meat Locker~ -Rows of beef and other meats hang from large steel hooks. +Rows of beef and other meats hang from large steel hooks. The meat locker continues to the north and west. ~ 0 AD 0 @@ -3432,7 +3432,7 @@ Penguin Room~ This is what appears to be a replica of an iceberg. Penguins waddle about the room pecking at many poor souls half trapped in the icy floor. You seem to be outside, as the walls are painted to seem as if you are standing -on a vast icy slab with nothing but ocean around you. +on a vast icy slab with nothing but ocean around you. The iceberg continues to the north and east. ~ 0 AD 0 @@ -3452,7 +3452,7 @@ Penguin Room~ This is what appears to be a replica of an iceberg. Penguins waddle about the room pecking at many poor souls half trapped in the icy floor. You seem to be outside, as the walls are painted to seem as if you are standing -on a vast icy slab with nothing but ocean around you. +on a vast icy slab with nothing but ocean around you. The iceberg continues to the north and west. You can hear sounds of machinery to the east. ~ @@ -3629,8 +3629,8 @@ S #10496 Blackened Hall~ This hall looks as if it was burned out recently. The walls are charred and -smoking. Ashes and bits of burnt timber crunch under your feet as you -walk down the hall. A sign on the wall reads, 'No Non-smoking Please'. +smoking. Ashes and bits of burnt timber crunch under your feet as you +walk down the hall. A sign on the wall reads, 'No Non-smoking Please'. The hall continues to the south. There is a stone door to the east and a prayer room to the west. ~ @@ -3668,8 +3668,8 @@ S #10498 Blackened Hall~ This hall looks as if it was burned out recently. The walls are charred and -smoking. Ashes and bits of burnt timber crunch under your feet as you -walk down the hall. A sign on the wall reads, 'No Non-smoking Please'. +smoking. Ashes and bits of burnt timber crunch under your feet as you +walk down the hall. A sign on the wall reads, 'No Non-smoking Please'. The hall continues to the east and south. ~ 0 AD 0 @@ -3687,10 +3687,10 @@ S #10499 Blackened Hall~ This hall looks as if it was burned out recently. The walls are charred and -smoking. Ashes and bits of burnt timber crunch under your feet as you +smoking. Ashes and bits of burnt timber crunch under your feet as you walk down the hall. A sign on the wall reads, 'No Non-smoking Please'. The hall continues to the west. -A glass door is to the east. +A glass door is to the east. ~ 0 AD 0 D1 @@ -3748,7 +3748,7 @@ soon.... S #10501 Halls of Judgement~ -You are standing in the Halls of Judgement. There are many alcoves +You are standing in the Halls of Judgement. There are many alcoves which contain different methods of torture. Each more grotesque than the one before it. On the wall a plaque reads, 'If you are here...You are Guilty...You have been judged...sound fair? Too bad..' @@ -3769,9 +3769,9 @@ You see the Court of Hell. S #10502 Halls of Judgement~ -You are standing in the Halls of Judgement. There are many alcoves +You are standing in the Halls of Judgement. There are many alcoves which contain different methods of torture. Each more grotesque than -the one before it. +the one before it. The hall continues to the east and west. The hall of records is to the north. ~ @@ -3794,9 +3794,9 @@ You see the Halls of Judgement. S #10503 Halls of Judgement~ -You are standing in the Halls of Judgement. There are many alcoves +You are standing in the Halls of Judgement. There are many alcoves which contain different methods of torture. Each more grotesque than -the one before it. +the one before it. The hall continues to the east and west. The Office of Complaints is to the south. ~ @@ -3819,9 +3819,9 @@ You see the Halls of Judgement. S #10504 Halls of Judgement~ -You are standing in the Halls of Judgement. There are many alcoves +You are standing in the Halls of Judgement. There are many alcoves which contain different methods of torture. Each more grotesque than -the one before it. +the one before it. The hall continues to the east and west. ~ 0 AD 0 @@ -3838,9 +3838,9 @@ You see the Halls of Judgement. S #10505 Halls of Judgement~ -You are standing in the Halls of Judgement. There are many alcoves +You are standing in the Halls of Judgement. There are many alcoves which contain different methods of torture. Each more grotesque than -the one before it. +the one before it. The hall continues to the east and west. ~ 0 AD 0 @@ -3858,7 +3858,7 @@ S #10506 Blackened Hall~ This hall looks as if it was burned out recently. The walls are charred and -smoking. Ashes and bits of burnt timber crunch under your feet as you +smoking. Ashes and bits of burnt timber crunch under your feet as you walk down the hall. A sign on the wall reads, 'No Non-smoking Please'. There are exits in all directions. ~ @@ -3887,7 +3887,7 @@ S #10507 Blackened Hall~ This hall looks as if it was burned out recently. The walls are charred and -smoking. Ashes and bits of burnt timber crunch under your feet as you +smoking. Ashes and bits of burnt timber crunch under your feet as you walk down the hall. A sign on the wall reads, 'No Non-smoking Please'. The hallway continues to the east and west. ~ @@ -3906,7 +3906,7 @@ S #10508 Blackened Hall~ This hall looks as if it was burned out recently. The walls are charred and -smoking. Ashes and bits of burnt timber crunch under your feet as you +smoking. Ashes and bits of burnt timber crunch under your feet as you walk down the hall. A sign on the wall reads, 'No Non-smoking Please'. The hallway continues to the north and west. ~ @@ -3938,7 +3938,7 @@ You see the eternal darkness of the Abyss. S #10510 Maintenance Walkway~ -This is a maintence accessway. You walk on a metal catwalk hundreds of +This is a maintence accessway. You walk on a metal catwalk hundreds of feet above the floor. The catwalk sways unsteadily as you walk on it. The catwalk continues to the south. To the north is a steel door. @@ -4001,7 +4001,7 @@ You see a courtyard. S #10513 Office of Complaints~ -This is a relatively small office. There is a large hole in the wall where a +This is a relatively small office. There is a large hole in the wall where a clerk usually sits and takes complaints about Hell. As you peek behind the counter you see a large paper shredder and alot of shredded complaints. a sign over the clerks desk reads, 'Hours: 12:00am - 12:01am' @@ -4123,7 +4123,7 @@ You see the eternal darkness of the Abyss. S #10519 Maintenance Walkway~ -This is a maintence accessway. You walk on a metal catwalk hundreds of +This is a maintence accessway. You walk on a metal catwalk hundreds of feet above the floor. The catwalk sways unsteadily as you walk on it. The catwalk continues to the east and south. ~ @@ -4141,7 +4141,7 @@ You see a maintenance walkway. S #10520 Maintenance Walkway~ -This is a maintence accessway. You walk on a metal catwalk hundreds of +This is a maintence accessway. You walk on a metal catwalk hundreds of feet above the floor. The catwalk sways unsteadily as you walk on it. The catwalk continues to the north and west. ~ @@ -4161,7 +4161,7 @@ S Judge's Chambers~ This is the private chambers of the High Judge of Hell. He has a cushy job and his office reflects that. Golden torches light the walls with dancing -blue and yellow flames. The judge's black crystal desk sparkles in the +blue and yellow flames. The judge's black crystal desk sparkles in the torchlight. ~ 0 D 0 @@ -4264,7 +4264,7 @@ S #10526 Inside Big Mouth's Stomach~ You are standing inside Big Mouth's stomach. It is roomy in here. Small -animals and other odds and ends lie about the stomach. Is that a dragon +animals and other odds and ends lie about the stomach. Is that a dragon you see? Nah...couldn't be... ~ 0 AD 0 @@ -4507,7 +4507,7 @@ S Secondary Control Room~ This is the secondary control room for the reactor core. It is usually used in emergencies when the primary control room is contaminated or damaged. -It isn't used very often since the primary control room is in perfect +It isn't used very often since the primary control room is in perfect working order. ~ 0 AD 0 @@ -4519,7 +4519,7 @@ You see the primary maintenance room. S #10540 Office of the Chief Engineer~ -This office belongs to the chief engineer of Hell. Blueprints and pencils +This office belongs to the chief engineer of Hell. Blueprints and pencils are scattered about the room. The air is heavy with the smell of ammonia and sweat. A display of the reactor core is mounted into the wall. One wall is completely filled with monitors, each showing various diff --git a/src/area/wyvern.are b/src/area/wyvern.are index 31c0f1d..4234253 100644 --- a/src/area/wyvern.are +++ b/src/area/wyvern.are @@ -674,7 +674,7 @@ S West Side of Moat~ You stand on the west side of a moat that encircles two towers, each over 50 feet high. You will need a boat to go east across the moat. A -rugged path heads west, and another one heads north to a cluster of low +rugged path heads west, and another one heads north to a cluster of low buildings. ~ 0 0 2 @@ -834,7 +834,7 @@ D0 S #1623 Tower Foyer~ -You are on a foyer on the west side of the structure. The moat is west of +You are on a foyer on the west side of the structure. The moat is west of here. There is also a large door eastward into the structure. You notice that the walls are ornately decorated with very life-like stone gargoyles. ~ @@ -1110,9 +1110,9 @@ D0 S #1640 Second Level of the Western Tower~ -You are in the center of the western tower's second floor. A large spiral +You are in the center of the western tower's second floor. A large spiral staircase of 29 steps connects this level with the third. There are doors -to the east and west. Except for a torch bracket in each corner, the +to the east and west. Except for a torch bracket in each corner, the room is barren. ~ 0 D 1 @@ -1143,7 +1143,7 @@ D1 S #1642 The Spiral Stairs~ -You are on a large spiral staircase of 29 steps, leading between the +You are on a large spiral staircase of 29 steps, leading between the second and third floors. You can go up or down. ~ 0 D 2 @@ -1257,7 +1257,7 @@ D5 S #1649 On the Catwalk~ -You are outdoors on a catwalk between the turrets of the eastern and +You are outdoors on a catwalk between the turrets of the eastern and western towers. There is a 40 foot drop to the north and south. You have a fabulous view of the surrounding countryside, which consists of a bleak wilderness. At the east end of the catwalk is a small opening leading @@ -1345,7 +1345,7 @@ You are at a crossroads to the wilderness areas east and north of here, and the more civilized areas to the west. The main road is west, an older road continues east, and a simple trail heads north. To the south, an old ram-shackle building is being used as a trading post for the -surrounding wilderness. +surrounding wilderness. ~ 0 0 3 D0 diff --git a/src/rom24/__init__.py b/src/rom24/__init__.py index 3c3f083..fe232f9 100644 --- a/src/rom24/__init__.py +++ b/src/rom24/__init__.py @@ -48,20 +48,10 @@ def filter(self, record: logging.LogRecord) -> bool: LOGGING_CONFIG = { "version": 1, "disable_existing_loggers": False, - "filters": { - "errorfilter": { - "()": ErrorFilter, - }, - }, + "filters": {"errorfilter": {"()": ErrorFilter}}, "formatters": { - "verbose": { - "datefmt": LOGGING_DATE_FORMAT, - "format": VERBOSE_LOGGING_FORMAT, - }, - "normal": { - "datefmt": LOGGING_DATE_FORMAT, - "format": NORMAL_LOGGING_FORMAT, - }, + "verbose": {"datefmt": LOGGING_DATE_FORMAT, "format": VERBOSE_LOGGING_FORMAT}, + "normal": {"datefmt": LOGGING_DATE_FORMAT, "format": NORMAL_LOGGING_FORMAT}, }, "handlers": { "console": { @@ -89,14 +79,7 @@ def filter(self, record: logging.LogRecord) -> bool: }, }, "loggers": { - LIBRARY_NAME: { - "handlers": [ - "console", - "info", - "error", - ], - "level": LOGGING_LEVEL, - }, + LIBRARY_NAME: {"handlers": ["console", "info", "error"], "level": LOGGING_LEVEL} }, } @@ -104,14 +87,7 @@ def filter(self, record: logging.LogRecord) -> bool: # This will log everything from all libraries (altering the root logger). Use when # troubleshooting third party libraries rather than your own. LOGGING_CONFIG["loggers"] = { - "": { - "handlers": [ - "console", - "info", - "error", - ], - "level": 0, - }, + "": {"handlers": ["console", "info", "error"], "level": 0} } diff --git a/src/rom24/auth.py b/src/rom24/auth.py index 3642e8b..cf2332b 100644 --- a/src/rom24/auth.py +++ b/src/rom24/auth.py @@ -178,11 +178,7 @@ def to_json(self, outer_encoder=None): outer_encoder = json.JSONEncoder.default cls_name = "__class__/" + __name__ + "." + self.__class__.__name__ - return { - cls_name: { - "secret": outer_encoder(self._raw_secret), - } - } + return {cls_name: {"secret": outer_encoder(self._raw_secret)}} @classmethod def from_json(cls, data, outer_decoder=None): diff --git a/src/rom24/effects.py b/src/rom24/effects.py index 1bf6280..77ade73 100644 --- a/src/rom24/effects.py +++ b/src/rom24/effects.py @@ -28,7 +28,7 @@ /************ * Ported to Python by Davion of MudBytes.net * Using Miniboa https://code.google.com/p/miniboa/ - * Now using Python 3 version https://code.google.com/p/miniboa-py3/ + * Now using Python 3 version https://code.google.com/p/miniboa-py3/ ************/ """ import random diff --git a/src/rom24/handler_item.py b/src/rom24/handler_item.py index b1a91a1..6b63427 100644 --- a/src/rom24/handler_item.py +++ b/src/rom24/handler_item.py @@ -1,3 +1,5 @@ +"""All item handlers we could ever need.""" + import json import os import copy @@ -21,11 +23,10 @@ from rom24 import state_checks from rom24 import item_flags -# * One object. +# Equip "Flags": +# Keyword: internal identifier +# Value: String Representation -"""Equip "Flags": -Keyword: internal identifier -Value: String Representation""" equips_to_strings = { "left_finger": "Left Finger", "right_finger": "Right Finger", diff --git a/src/rom24/handler_log.py b/src/rom24/handler_log.py deleted file mode 100644 index 310a162..0000000 --- a/src/rom24/handler_log.py +++ /dev/null @@ -1,188 +0,0 @@ -__author__ = "syn" -import sys -import functools -import inspect -import logging - -logger = logging.getLogger(__name__) - -from rom24 import merc -from rom24 import handler_pc - -"""So far this wrapper class will allow debugging of a function as such: -@logger("Debug") -def some_func(stuff) - -Once attached, it will safely try the function and print a failure. -It will also send a message to the calling character about a failure, -if there was a calling character. - -Will add actual logfile support soon, and build out additional logging templates""" - - -class GlobalDebugFlag: - """Enable or disable our global flags""" - - def gdfset(state): - merc.GDF = state - return - - def gdcfset(state): - merc.GDCF = state - return - - -def value_to_str(v): - from rom24 import interp - - if isinstance(v, handler_pc.Pc): - return v.name - elif isinstance(v, interp.cmd_type): - return v.do_fun - elif isinstance(v, str): - return "".join(["'", v.replace("\n", "\\n"), "'"]) - else: - # noinspection PyBroadException - try: - return str(v).replace("\n", "\\n") - except: - return "" - - -def char_parse_exception( - error_object, *args, ch -): # Parser for exceptions with a CH entity for extra msging - merc.GDF = False - wrap_call = inspect.getinnerframes(sys.exc_info()[2]) - if ch.level == merc.ML: - ch.send( - "An Exception Occurred: \n%s %s\n\n" - % (type(error_object), str(error_object)) - ) - logger.debug("Exception: %s %s" % (type(error_object), str(error_object))) - for call_info in reversed(wrap_call): - local_calls = call_info[0].f_locals - if "_logged__tracer_var_" in local_calls: - continue - if ch.level == merc.ML: - ch.send( - "--Frame Trace-- \nFile: %s \nFunction: %s \nLine: %d \nCode: %s " - % (call_info[1], call_info[3], call_info[2], call_info[4][0].lstrip()) - ) - ch.send("\n") - logger.debug( - "--Frame Trace-- \nFile: %s \nFunction: %s \nLine: %d \nCode: %s " - % (call_info[1], call_info[3], call_info[2], call_info[4][0].lstrip()) - ) - logger.debug("Local Env Variables: ") - for k, v in local_calls.items(): - levtrace = value_to_str(v) - logger.debug("%s : %s", k, levtrace) - - -def noch_parse_exception(error_object, *args): - merc.GDF = False - wrap_call = inspect.getinnerframes(sys.exc_info()[2]) - logger.debug("Exception: %s %s" % (type(error_object), str(error_object))) - for call_info in reversed(wrap_call): - local_calls = call_info[0].f_locals - if "_logged__tracer_var_" in local_calls: - continue - tracestring = ( - "Frame Trace: \nFile: %s \nLine: %d \n ", - call_info[1], - call_info[2], - ) - tracestring += ( - "Function: %s \nCode: %s ", - call_info[3], - call_info[4][0].lstrip(), - ) - logger.debug(tracestring) - logger.debug("Local Env Variables: ") - for k, v in local_calls.items(): - levtrace = value_to_str(v) - logger.debug("%s : %s", k, levtrace) - - -class logged(object): - def __init__(self, log_type, ch=None): - """Init the logger, log_type""" - self.log_type = log_type - self.ch = ch - - def __call__(self, func): - """the class needs to be callable for this to work""" - functools.update_wrapper(self, func) - - # Add debug log for any function you wish for TS, provides trace of incident - if ( - self.log_type == "Debug" - ): # Used to wrap any function and does not know about or care about flags - - def debug(*args, **kwargs): - if args and isinstance(args[0], handler_pc.Pc): - mch = args[0] - else: - mch = self.ch - """__tracer_var_ becomes _logger__tracer_var_ in the trace. - This is used to determine if we are within the wrapping frame - or the wrapped frame. - - Leave this in place to receive only the wrapped frame trace info - - we dont care about the wrapping frame information.""" - __tracer_var_ = 0 - try: - return func(*args, **kwargs) - except Exception as err: - if isinstance(mch, handler_pc.Pc): - if mch.level == merc.ML: - mch.send("Debug has been Enabled\n\n") - char_parse_exception(err, args, ch=mch) - else: - noch_parse_exception(err, args) - return - - return debug - - if ( - self.log_type == "Interp" - ): # Used with interp and either debug command, or global debug flag - - def interp_debug(*args, **kwargs): - if ( - merc.GDF is False and merc.GDCF is False - ): # Check for global/debug command flags - return func( - *args, **kwargs - ) # if none of the debugs are on, just send the command as normal - if args and isinstance(args[0], handler_pc.Pc): - """check if there are args, and the args entail a character structure""" - mch = args[ - 0 - ] # If so, lets make a char object so we can send messages as needed - else: - mch = ( - self.ch - ) # If so, lets make a char object so we can send messages as needed - """__tracer_var_ becomes _logger__tracer_var_ in the trace. - This is used to determine if we are within the wrapping frame - or the wrapped frame. - - Leave this in place to receive only the wrapped frame trace info - - we dont care about the wrapping frame information.""" - __tracer_var_ = 0 - try: - return func(*args, **kwargs) - except Exception as err: - if isinstance(mch, handler_pc.Pc): - mch.send("Debug has been Enabled\n\n") - char_parse_exception(err, args, ch=mch) - else: - noch_parse_exception(err, args) - return - - return interp_debug - - else: - return func diff --git a/src/rom24/instance.py b/src/rom24/instance.py index 1c9668d..f6cebcb 100644 --- a/src/rom24/instance.py +++ b/src/rom24/instance.py @@ -1,16 +1,3 @@ -__author__ = "quixadhal" - -import os -import json -from collections import OrderedDict, namedtuple -import re -import logging -from typing import * - -logger = logging.getLogger(__name__) - -from rom24 import settings - """For the instance dicts, we are not going to make another pointer, or copy, of the original entity. We are going to alias, or bind, the specific entity _instances[dict key] [entity] back to the original global_instances[dict key] @@ -36,6 +23,18 @@ 'bob' """ +import os +import json +from collections import OrderedDict, namedtuple +import re +import logging +from typing import * + +logger = logging.getLogger(__name__) + +from rom24 import settings + + max_instance_id = 0 previous_max_instance_id = 0 @@ -61,11 +60,9 @@ socials: Dict[str, Any] = {} resets: Dict[str, Any] = {} -""" -Contains lists of instances, -Key: string VNUM -Value: list Instance_ID of object associated with Key:VNUM -""" +# Contains lists of instances, +# Key: string VNUM +# Value: list Instance_ID of object associated with Key:VNUM instances_by_area: Dict[str, Any] = {} instances_by_item: Dict[str, Any] = {} instances_by_room: Dict[str, Any] = {} diff --git a/src/rom24/merc.py b/src/rom24/merc.py index 8c542b2..b7a7451 100644 --- a/src/rom24/merc.py +++ b/src/rom24/merc.py @@ -1,3 +1,4 @@ +"""Lots of bits and shifts. All the binary operations you could ever want.""" import time import collections import logging @@ -72,9 +73,7 @@ greeting_list: list = [] social_list: list = [] -""" -Game Defines -""" +# Game Defines # Wiznet Flags WIZ_ON = A @@ -254,12 +253,10 @@ AFF_SLOW = dd -""" -Character Defines -""" +## Character Defines -""" Equipment Slot Strings - for use with displaying EQ to characters """ +# Equipment Slot Strings - for use with displaying EQ to characters eq_slot_strings = collections.OrderedDict( [ @@ -569,11 +566,7 @@ MEM_HOSTILE = C MEM_AFRAID = D - -""" -Room Defines -""" - +#### Room Defines # Room Sector Types SECT_INSIDE = 0 @@ -642,9 +635,7 @@ EX_NOLOCK = L -""" -Item Defines -""" +# Item Defines # Apply Types @@ -787,9 +778,7 @@ CONT_PUT_ON = 16 -""" -Conversion Maps -""" +# Conversion Maps # Item Bits @@ -865,9 +854,7 @@ ) -""" -Legacy Bits n Bobs -""" +# Legacy Bits n Bobs # legacy WEAR locations diff --git a/src/rom24/miniboa/LICENSE.TXT b/src/rom24/miniboa/LICENSE.TXT index f55cad6..3b789cc 100644 --- a/src/rom24/miniboa/LICENSE.TXT +++ b/src/rom24/miniboa/LICENSE.TXT @@ -86,5 +86,3 @@ APPENDIX: How to apply the Apache License to your work 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. - - diff --git a/src/rom24/miniboa/colors.py b/src/rom24/miniboa/colors.py index fe333e5..f8c1cde 100644 --- a/src/rom24/miniboa/colors.py +++ b/src/rom24/miniboa/colors.py @@ -66,17 +66,7 @@ ColorToken = namedtuple( "ColorToken", - ( - "unknown", - "pyom", - "rom", - "smaug", - "imc2", - "ansi", - "greyscale", - "i3", - "mxp", - ), + ("unknown", "pyom", "rom", "smaug", "imc2", "ansi", "greyscale", "i3", "mxp"), ) COLOR_MAP: Dict[str, Any] = {} diff --git a/src/rom24/miniboa/terminal.py b/src/rom24/miniboa/terminal.py index 7b3c100..2fd4cc8 100644 --- a/src/rom24/miniboa/terminal.py +++ b/src/rom24/miniboa/terminal.py @@ -58,9 +58,7 @@ from rom24.miniboa.colors import TERMINAL_TYPES, COLOR_MAP -_TTYPE_MAP = { - "tinyfugue": "ansi", -} +_TTYPE_MAP = {"tinyfugue": "ansi"} _PARA_BREAK = re.compile(r"(\n\s*\n)", re.MULTILINE) diff --git a/tests/basic_import_test.py b/tests/basic_import_test.py index 3564de8..b4d54a1 100644 --- a/tests/basic_import_test.py +++ b/tests/basic_import_test.py @@ -2,6 +2,7 @@ import importlib + def test_import_rom24(): """Import the rom24 module to make sure it can resolve things for import.""" importlib.import_module("rom24") From 55c9e504f356214e51da253af338d870374befa3 Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Thu, 2 Dec 2021 00:50:20 -0800 Subject: [PATCH 29/40] create basic pytest workflow --- .github/workflows/django.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/django.yml diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml new file mode 100644 index 0000000..c738ff0 --- /dev/null +++ b/.github/workflows/django.yml @@ -0,0 +1,30 @@ +name: Django CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + max-parallel: 4 + matrix: + python-version: [3.7, 3.8, 3.9] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install Dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + - name: Run Tests + run: | + pytest tests From 86d43f4a91b145c1322952a43df3164798e2e840 Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Thu, 2 Dec 2021 00:54:56 -0800 Subject: [PATCH 30/40] Updates workflow name and fixes pytest requirements --- .github/workflows/{django.yml => pytest.yml} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{django.yml => pytest.yml} (90%) diff --git a/.github/workflows/django.yml b/.github/workflows/pytest.yml similarity index 90% rename from .github/workflows/django.yml rename to .github/workflows/pytest.yml index c738ff0..6071f08 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/pytest.yml @@ -1,4 +1,4 @@ -name: Django CI +name: Pytest on: push: @@ -24,7 +24,7 @@ jobs: - name: Install Dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt + pip install -e . - name: Run Tests run: | pytest tests From 585630517999050af5bb82ec2979519d62b8128d Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Thu, 2 Dec 2021 00:58:41 -0800 Subject: [PATCH 31/40] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c45aec7..4f2255c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ ## Welcome to the Pyom project! ## +![pytest](https://github.com/bubthegreat/rom24/actions/workflows/pytest.yml/badge.svg) + *rom24* is a re-authoring of the *Rom DikuMUD* derivative using python3. We've tried to use as few external modules as possible, but are using the excellent *Miniboa* telnet stack as our core. @@ -50,4 +52,4 @@ If you're going to contribute, please use the pre-commit hooks. It's got some t ``` pip install -r requirements.txt pre-commit install -``` +``` From 6e7959db6b56bce21a4cbe808f06486487c4103d Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Thu, 2 Dec 2021 01:00:30 -0800 Subject: [PATCH 32/40] Adding mypy workflow and badge --- .github/workflows/mypy.yml | 30 ++++++++++++++++++++++++++++++ README.md | 1 + 2 files changed, 31 insertions(+) create mode 100644 .github/workflows/mypy.yml diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml new file mode 100644 index 0000000..12819c3 --- /dev/null +++ b/.github/workflows/mypy.yml @@ -0,0 +1,30 @@ +name: mypy + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + max-parallel: 4 + matrix: + python-version: [3.7, 3.8, 3.9] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install Dependencies + run: | + python -m pip install --upgrade pip + pip install -e . + - name: Run mypy + run: | + mypy src diff --git a/README.md b/README.md index 4f2255c..2ba409a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ ## Welcome to the Pyom project! ## ![pytest](https://github.com/bubthegreat/rom24/actions/workflows/pytest.yml/badge.svg) +![mypy](https://github.com/bubthegreat/rom24/actions/workflows/mypy.yml/badge.svg) *rom24* is a re-authoring of the *Rom DikuMUD* derivative using python3. We've tried to use as few external modules as From 1d495f9ae676dacbf8d59c3947dce6391eb56d84 Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Thu, 2 Dec 2021 01:04:39 -0800 Subject: [PATCH 33/40] Create python-publish.yml --- .github/workflows/python-publish.yml | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/python-publish.yml diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000..3bfabfc --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,36 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Upload Python Package + +on: + release: + types: [published] + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + - name: Build package + run: python -m build + - name: Publish package + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} From dff5685ad0045d8212580af3545100976ac00917 Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Thu, 2 Dec 2021 01:05:59 -0800 Subject: [PATCH 34/40] Add publish badge to readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2ba409a..2143cd7 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ ![pytest](https://github.com/bubthegreat/rom24/actions/workflows/pytest.yml/badge.svg) ![mypy](https://github.com/bubthegreat/rom24/actions/workflows/mypy.yml/badge.svg) +![python-publish](https://github.com/bubthegreat/rom24/actions/workflows/python-publish.yml/badge.svg) *rom24* is a re-authoring of the *Rom DikuMUD* derivative using python3. We've tried to use as few external modules as From 6de60f38b10d10283d08df0ab0287e0b6b861375 Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Thu, 2 Dec 2021 01:09:04 -0800 Subject: [PATCH 35/40] Incrementing version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 7f903ca..548b046 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setup( name="rom24", - version="0.0.0.alpha0", + version="0.0.1.alpha0", author="Micheal Taylor", author_email="bubthegreat@gmail.com", url="", From 66663bd855d9c07082290356b20748050071a37d Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Thu, 2 Dec 2021 01:14:11 -0800 Subject: [PATCH 36/40] Adding manifest --- MANIFEST.in | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..d16989f --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,3 @@ +include ./requirements.txt +include README.md +include src/area/* From 3788caf92e7053cf850c2ab475649db6dae7539c Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Thu, 2 Dec 2021 01:14:47 -0800 Subject: [PATCH 37/40] incrementing version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 548b046..0508ac0 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setup( name="rom24", - version="0.0.1.alpha0", + version="0.0.1.alpha1", author="Micheal Taylor", author_email="bubthegreat@gmail.com", url="", From 78573ea0f93437d40366f8a5743bc807dd6ac00f Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Thu, 2 Dec 2021 01:20:39 -0800 Subject: [PATCH 38/40] Updating manifest --- MANIFEST.in | 1 + 1 file changed, 1 insertion(+) diff --git a/MANIFEST.in b/MANIFEST.in index d16989f..78af07a 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,4 @@ include ./requirements.txt include README.md include src/area/* +graft *.are From 65fb069f382374aa7ca427f67d4223705657fae9 Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Thu, 2 Dec 2021 01:20:55 -0800 Subject: [PATCH 39/40] Updating version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 0508ac0..4881238 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setup( name="rom24", - version="0.0.1.alpha1", + version="0.0.1.alpha2", author="Micheal Taylor", author_email="bubthegreat@gmail.com", url="", From decb4bc20e4911e1787977a57c83df38e16ad6a7 Mon Sep 17 00:00:00 2001 From: Micheal Taylor Date: Sun, 26 Dec 2021 14:07:09 -0700 Subject: [PATCH 40/40] Fixed data missing json and added default char --- .gitignore | 3 +- src/data/act_flags.json | 112 + src/data/affect_flags.json | 147 + src/data/attack_table.json | 202 + src/data/clan_table.json | 20 + src/data/comm_flags.json | 117 + src/data/con_app.json | 106 + src/data/dex_app.json | 80 + src/data/exit_flags.json | 52 + src/data/form_flags.json | 132 + src/data/group_table.json | 457 ++ src/data/guild_table.json | 74 + src/data/imm_flags.json | 117 + src/data/int_app.json | 80 + src/data/liq_table.json | 326 ++ src/data/off_flags.json | 107 + src/data/part_flags.json | 112 + src/data/pc_race_table.json | 120 + .../players/b/Bub/inventory/15249-item.json | 987 ++++ .../players/b/Bub/inventory/15250-item.json | 961 ++++ .../players/b/Bub/inventory/15251-item.json | 974 ++++ .../players/b/Bub/inventory/15252-item.json | 961 ++++ .../players/b/Bub/inventory/15253-item.json | 958 ++++ src/data/players/b/Bub/login.json | 11 + src/data/players/b/Bub/player.json | 4442 +++++++++++++++++ src/data/plr_flags.json | 87 + src/data/position_table.json | 38 + src/data/race_table.json | 350 ++ src/data/sex_table.json | 5 + src/data/size_table.json | 8 + src/data/skill_table.json | 952 ++++ src/data/str_app.json | 158 + src/data/title_table.json | 986 ++++ src/data/weapon_table.json | 50 + src/data/wis_app.json | 80 + src/data/wiznet_table.json | 102 + src/data/world/instances/.gitkeep | 0 src/rom24/game_utils.py | 2 +- 38 files changed, 14474 insertions(+), 2 deletions(-) create mode 100644 src/data/act_flags.json create mode 100644 src/data/affect_flags.json create mode 100644 src/data/attack_table.json create mode 100644 src/data/clan_table.json create mode 100644 src/data/comm_flags.json create mode 100644 src/data/con_app.json create mode 100644 src/data/dex_app.json create mode 100644 src/data/exit_flags.json create mode 100644 src/data/form_flags.json create mode 100644 src/data/group_table.json create mode 100644 src/data/guild_table.json create mode 100644 src/data/imm_flags.json create mode 100644 src/data/int_app.json create mode 100644 src/data/liq_table.json create mode 100644 src/data/off_flags.json create mode 100644 src/data/part_flags.json create mode 100644 src/data/pc_race_table.json create mode 100644 src/data/players/b/Bub/inventory/15249-item.json create mode 100644 src/data/players/b/Bub/inventory/15250-item.json create mode 100644 src/data/players/b/Bub/inventory/15251-item.json create mode 100644 src/data/players/b/Bub/inventory/15252-item.json create mode 100644 src/data/players/b/Bub/inventory/15253-item.json create mode 100644 src/data/players/b/Bub/login.json create mode 100644 src/data/players/b/Bub/player.json create mode 100644 src/data/plr_flags.json create mode 100644 src/data/position_table.json create mode 100644 src/data/race_table.json create mode 100644 src/data/sex_table.json create mode 100644 src/data/size_table.json create mode 100644 src/data/skill_table.json create mode 100644 src/data/str_app.json create mode 100644 src/data/title_table.json create mode 100644 src/data/weapon_table.json create mode 100644 src/data/wis_app.json create mode 100644 src/data/wiznet_table.json create mode 100644 src/data/world/instances/.gitkeep diff --git a/.gitignore b/.gitignore index fcbd8a6..87e27eb 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ __pycache__/ *.suo .idea/ venv/ -data/ +data/players/ +data/world/instances/ instance_tracker.txt *.egg-info/ diff --git a/src/data/act_flags.json b/src/data/act_flags.json new file mode 100644 index 0000000..3feddc3 --- /dev/null +++ b/src/data/act_flags.json @@ -0,0 +1,112 @@ +{ + "npc": [ + "npc", + 1, + false + ], + "sentinel": [ + "sentinel", + 2, + true + ], + "scavenger": [ + "scavenger", + 4, + true + ], + "aggressive": [ + "aggressive", + 32, + true + ], + "stay_area": [ + "stay_area", + 64, + true + ], + "wimpy": [ + "wimpy", + 128, + true + ], + "pet": [ + "pet", + 256, + true + ], + "train": [ + "train", + 512, + true + ], + "practice": [ + "practice", + 1024, + true + ], + "undead": [ + "undead", + 16384, + true + ], + "cleric": [ + "cleric", + 65536, + true + ], + "mage": [ + "mage", + 131072, + true + ], + "thief": [ + "thief", + 262144, + true + ], + "warrior": [ + "warrior", + 524288, + true + ], + "noalign": [ + "noalign", + 1048576, + true + ], + "nopurge": [ + "nopurge", + 2097152, + true + ], + "outdoors": [ + "outdoors", + 4194304, + true + ], + "indoors": [ + "indoors", + 16777216, + true + ], + "healer": [ + "healer", + 67108864, + true + ], + "gain": [ + "gain", + 134217728, + true + ], + "update_always": [ + "update_always", + 268435456, + true + ], + "changer": [ + "changer", + 536870912, + true + ] +} \ No newline at end of file diff --git a/src/data/affect_flags.json b/src/data/affect_flags.json new file mode 100644 index 0000000..0f0866d --- /dev/null +++ b/src/data/affect_flags.json @@ -0,0 +1,147 @@ +{ + "blind": [ + "blind", + 1, + true + ], + "invisible": [ + "invisible", + 2, + true + ], + "detect_evil": [ + "detect_evil", + 4, + true + ], + "detect_invis": [ + "detect_invis", + 8, + true + ], + "detect_magic": [ + "detect_magic", + 16, + true + ], + "detect_hidden": [ + "detect_hidden", + 32, + true + ], + "detect_good": [ + "detect_good", + 64, + true + ], + "sanctuary": [ + "sanctuary", + 128, + true + ], + "faerie_fire": [ + "faerie_fire", + 256, + true + ], + "infrared": [ + "infrared", + 512, + true + ], + "curse": [ + "curse", + 1024, + true + ], + "poison": [ + "poison", + 4096, + true + ], + "protect_evil": [ + "protect_evil", + 8192, + true + ], + "protect_good": [ + "protect_good", + 16384, + true + ], + "sneak": [ + "sneak", + 32768, + true + ], + "hide": [ + "hide", + 65536, + true + ], + "sleep": [ + "sleep", + 131072, + true + ], + "charm": [ + "charm", + 262144, + true + ], + "flying": [ + "flying", + 524288, + true + ], + "pass_door": [ + "pass_door", + 1048576, + true + ], + "haste": [ + "haste", + 2097152, + true + ], + "calm": [ + "calm", + 4194304, + true + ], + "plague": [ + "plague", + 8388608, + true + ], + "weaken": [ + "weaken", + 16777216, + true + ], + "dark_vision": [ + "dark_vision", + 33554432, + true + ], + "berserk": [ + "berserk", + 67108864, + true + ], + "swim": [ + "swim", + 134217728, + true + ], + "regeneration": [ + "regeneration", + 268435456, + true + ], + "slow": [ + "slow", + 536870912, + true + ] +} \ No newline at end of file diff --git a/src/data/attack_table.json b/src/data/attack_table.json new file mode 100644 index 0000000..aba154b --- /dev/null +++ b/src/data/attack_table.json @@ -0,0 +1,202 @@ +{ + "0": [ + "none", + "hit", + -1 + ], + "1": [ + "slice", + "slice", + 3 + ], + "2": [ + "stab", + "stab", + 2 + ], + "3": [ + "slash", + "slash", + 3 + ], + "4": [ + "whip", + "whip", + 3 + ], + "5": [ + "claw", + "claw", + 3 + ], + "6": [ + "blast", + "blast", + 1 + ], + "7": [ + "pound", + "pound", + 1 + ], + "8": [ + "crush", + "crush", + 1 + ], + "9": [ + "grep", + "grep", + 3 + ], + "10": [ + "bite", + "bite", + 2 + ], + "11": [ + "pierce", + "pierce", + 2 + ], + "12": [ + "suction", + "suction", + 1 + ], + "13": [ + "beating", + "beating", + 1 + ], + "14": [ + "digestion", + "digestion", + 7 + ], + "15": [ + "charge", + "charge", + 1 + ], + "16": [ + "slap", + "slap", + 1 + ], + "17": [ + "punch", + "punch", + 1 + ], + "18": [ + "wrath", + "wrath", + 11 + ], + "19": [ + "magic", + "magic", + 11 + ], + "20": [ + "divine", + "divine power", + 10 + ], + "21": [ + "cleave", + "cleave", + 3 + ], + "22": [ + "scratch", + "scratch", + 2 + ], + "23": [ + "peck", + "peck", + 2 + ], + "24": [ + "peckb", + "peck", + 1 + ], + "25": [ + "chop", + "chop", + 3 + ], + "26": [ + "sting", + "sting", + 2 + ], + "27": [ + "smash", + "smash", + 1 + ], + "28": [ + "shbite", + "shocking bite", + 6 + ], + "29": [ + "flbite", + "flaming bite", + 4 + ], + "30": [ + "frbite", + "freezing bite", + 5 + ], + "31": [ + "acbite", + "acidic bite", + 7 + ], + "32": [ + "chomp", + "chomp", + 2 + ], + "33": [ + "drain", + "life drain", + 9 + ], + "34": [ + "thrust", + "thrust", + 2 + ], + "35": [ + "slime", + "slime", + 7 + ], + "36": [ + "shock", + "shock", + 6 + ], + "37": [ + "thwack", + "thwack", + 1 + ], + "38": [ + "flame", + "flame", + 4 + ], + "39": [ + "chill", + "chill", + 5 + ] +} \ No newline at end of file diff --git a/src/data/clan_table.json b/src/data/clan_table.json new file mode 100644 index 0000000..340b719 --- /dev/null +++ b/src/data/clan_table.json @@ -0,0 +1,20 @@ +{ + "": [ + "", + "", + 3054, + true + ], + "loner": [ + "loner", + "[ Loner ] ", + 3054, + true + ], + "rom": [ + "rom", + "[ ROM ] ", + 3054, + false + ] +} \ No newline at end of file diff --git a/src/data/comm_flags.json b/src/data/comm_flags.json new file mode 100644 index 0000000..5fe8700 --- /dev/null +++ b/src/data/comm_flags.json @@ -0,0 +1,117 @@ +{ + "quiet": [ + "quiet", + 1, + true + ], + "deaf": [ + "deaf", + 2, + true + ], + "nowiz": [ + "nowiz", + 4, + true + ], + "noclangossip": [ + "noclangossip", + 8, + true + ], + "nogossip": [ + "nogossip", + 16, + true + ], + "noquestion": [ + "noquestion", + 32, + true + ], + "nomusic": [ + "nomusic", + 64, + true + ], + "noclan": [ + "noclan", + 128, + true + ], + "noquote": [ + "noquote", + 256, + true + ], + "shoutsoff": [ + "shoutsoff", + 512, + true + ], + "compact": [ + "compact", + 2048, + true + ], + "brief": [ + "brief", + 4096, + true + ], + "prompt": [ + "prompt", + 8192, + true + ], + "combine": [ + "combine", + 16384, + true + ], + "telnet_ga": [ + "telnet_ga", + 32768, + true + ], + "show_affects": [ + "show_affects", + 65536, + true + ], + "nograts": [ + "nograts", + 131072, + true + ], + "noemote": [ + "noemote", + 524288, + false + ], + "noshout": [ + "noshout", + 1048576, + false + ], + "notell": [ + "notell", + 2097152, + false + ], + "nochannels": [ + "nochannels", + 4194304, + false + ], + "snoop_proof": [ + "snoop_proof", + 16777216, + false + ], + "afk": [ + "afk", + 33554432, + true + ] +} \ No newline at end of file diff --git a/src/data/con_app.json b/src/data/con_app.json new file mode 100644 index 0000000..1603275 --- /dev/null +++ b/src/data/con_app.json @@ -0,0 +1,106 @@ +{ + "0": [ + -4, + 20 + ], + "1": [ + -3, + 25 + ], + "2": [ + -2, + 30 + ], + "3": [ + -2, + 35 + ], + "4": [ + -1, + 40 + ], + "5": [ + -1, + 45 + ], + "6": [ + -1, + 50 + ], + "7": [ + 0, + 55 + ], + "8": [ + 0, + 60 + ], + "9": [ + 0, + 65 + ], + "10": [ + 0, + 70 + ], + "11": [ + 0, + 75 + ], + "12": [ + 0, + 80 + ], + "13": [ + 0, + 85 + ], + "14": [ + 0, + 88 + ], + "15": [ + 1, + 90 + ], + "16": [ + 2, + 95 + ], + "17": [ + 2, + 97 + ], + "18": [ + 3, + 99 + ], + "19": [ + 3, + 99 + ], + "20": [ + 4, + 99 + ], + "21": [ + 4, + 99 + ], + "22": [ + 5, + 99 + ], + "23": [ + 6, + 99 + ], + "24": [ + 7, + 99 + ], + "25": [ + 8, + 99 + ] +} \ No newline at end of file diff --git a/src/data/dex_app.json b/src/data/dex_app.json new file mode 100644 index 0000000..e89d37d --- /dev/null +++ b/src/data/dex_app.json @@ -0,0 +1,80 @@ +{ + "0": [ + 60 + ], + "1": [ + 50 + ], + "2": [ + 50 + ], + "3": [ + 40 + ], + "4": [ + 30 + ], + "5": [ + 20 + ], + "6": [ + 10 + ], + "7": [ + 0 + ], + "8": [ + 0 + ], + "9": [ + 0 + ], + "10": [ + 0 + ], + "11": [ + 0 + ], + "12": [ + 0 + ], + "13": [ + 0 + ], + "14": [ + 0 + ], + "15": [ + -10 + ], + "16": [ + -15 + ], + "17": [ + -20 + ], + "18": [ + -30 + ], + "19": [ + -40 + ], + "20": [ + -50 + ], + "21": [ + -60 + ], + "22": [ + -75 + ], + "23": [ + -90 + ], + "24": [ + -105 + ], + "25": [ + -120 + ] +} \ No newline at end of file diff --git a/src/data/exit_flags.json b/src/data/exit_flags.json new file mode 100644 index 0000000..db58dcc --- /dev/null +++ b/src/data/exit_flags.json @@ -0,0 +1,52 @@ +{ + "isdoor": [ + "isdoor", + 1, + false + ], + "closed": [ + "closed", + 4, + false + ], + "locked": [ + "locked", + 8, + false + ], + "pickproof": [ + "pickproof", + 16, + false + ], + "nopass": [ + "nopass", + 32, + false + ], + "easy": [ + "easy", + 64, + false + ], + "hard": [ + "hard", + 128, + false + ], + "infuriating": [ + "infuriating", + 8192, + false + ], + "noclose": [ + "noclose", + 32768, + false + ], + "nolock": [ + "nolock", + 65536, + false + ] +} diff --git a/src/data/form_flags.json b/src/data/form_flags.json new file mode 100644 index 0000000..6f34161 --- /dev/null +++ b/src/data/form_flags.json @@ -0,0 +1,132 @@ +{ + "edible": [ + "edible", + 1, + true + ], + "poison": [ + "poison", + 2, + true + ], + "magical": [ + "magical", + 4, + true + ], + "instant_decay": [ + "instant_decay", + 8, + true + ], + "other": [ + "other", + 16, + true + ], + "animal": [ + "animal", + 64, + true + ], + "sentient": [ + "sentient", + 128, + true + ], + "undead": [ + "undead", + 256, + true + ], + "construct": [ + "construct", + 512, + true + ], + "mist": [ + "mist", + 1024, + true + ], + "intangible": [ + "intangible", + 2048, + true + ], + "biped": [ + "biped", + 4096, + true + ], + "centaur": [ + "centaur", + 8192, + true + ], + "insect": [ + "insect", + 16384, + true + ], + "spider": [ + "spider", + 32768, + true + ], + "crustacean": [ + "crustacean", + 65536, + true + ], + "worm": [ + "worm", + 131072, + true + ], + "blob": [ + "blob", + 262144, + true + ], + "mammal": [ + "mammal", + 2097152, + true + ], + "bird": [ + "bird", + 4194304, + true + ], + "reptile": [ + "reptile", + 8388608, + true + ], + "snake": [ + "snake", + 16777216, + true + ], + "dragon": [ + "dragon", + 33554432, + true + ], + "amphibian": [ + "amphibian", + 67108864, + true + ], + "fish": [ + "fish", + 134217728, + true + ], + "cold_blood": [ + "cold_blood", + 268435456, + true + ] +} \ No newline at end of file diff --git a/src/data/group_table.json b/src/data/group_table.json new file mode 100644 index 0000000..325e3f1 --- /dev/null +++ b/src/data/group_table.json @@ -0,0 +1,457 @@ +{ + "rom basics": [ + "rom basics", + { + "cleric": 0, + "thief": 0, + "mage": 0, + "warrior": 0 + }, + [ + "scrolls", + "staves", + "wands", + "recall" + ] + ], + "mage basics": [ + "mage basics", + { + "cleric": -1, + "thief": -1, + "mage": 0, + "warrior": -1 + }, + [ + "dagger" + ] + ], + "cleric basics": [ + "cleric basics", + { + "cleric": 0, + "thief": -1, + "mage": -1, + "warrior": -1 + }, + [ + "mace" + ] + ], + "thief basics": [ + "thief basics", + { + "cleric": -1, + "thief": 0, + "mage": -1, + "warrior": -1 + }, + [ + "dagger", + "steal" + ] + ], + "warrior basics": [ + "warrior basics", + { + "cleric": -1, + "thief": -1, + "mage": -1, + "warrior": 0 + }, + [ + "sword", + "second attack" + ] + ], + "mage default": [ + "mage default", + { + "cleric": -1, + "thief": -1, + "mage": 40, + "warrior": -1 + }, + [ + "lore", + "beguiling", + "combat", + "detection", + "enhancement", + "illusion", + "maladictions", + "protective", + "transportation", + "weather" + ] + ], + "cleric default": [ + "cleric default", + { + "cleric": 40, + "thief": -1, + "mage": -1, + "warrior": -1 + }, + [ + "flail", + "attack", + "creation", + "curative", + "benedictions", + "detection", + "healing", + "maladictions", + "protective", + "shield block", + "transportation", + "weather" + ] + ], + "thief default": [ + "thief default", + { + "cleric": -1, + "thief": 40, + "mage": -1, + "warrior": -1 + }, + [ + "mace", + "sword", + "backstab", + "disarm", + "dodge", + "second attack", + "trip", + "hide", + "peek", + "pick lock", + "sneak" + ] + ], + "warrior default": [ + "warrior default", + { + "cleric": -1, + "thief": -1, + "mage": -1, + "warrior": 40 + }, + [ + "weaponsmaster", + "shield block", + "bash", + "disarm", + "enhanced damage", + "parry", + "rescue", + "third attack" + ] + ], + "weaponsmaster": [ + "weaponsmaster", + { + "cleric": 40, + "thief": 40, + "mage": 40, + "warrior": 20 + }, + [ + "axe", + "dagger", + "flail", + "mace", + "polearm", + "spear", + "sword", + "whip" + ] + ], + "attack": [ + "attack", + { + "cleric": 5, + "thief": -1, + "mage": -1, + "warrior": 8 + }, + [ + "demonfire", + "dispel evil", + "dispel good", + "earthquake", + "flamestrike", + "heat metal", + "ray of truth" + ] + ], + "beguiling": [ + "beguiling", + { + "cleric": -1, + "thief": 6, + "mage": 4, + "warrior": -1 + }, + [ + "calm", + "charm person", + "sleep" + ] + ], + "benedictions": [ + "benedictions", + { + "cleric": 4, + "thief": -1, + "mage": -1, + "warrior": 8 + }, + [ + "bless", + "calm", + "frenzy", + "holy word", + "remove curse" + ] + ], + "combat": [ + "combat", + { + "cleric": -1, + "thief": 10, + "mage": 6, + "warrior": 9 + }, + [ + "acid blast", + "burning hands", + "chain lightning", + "chill touch", + "colour spray", + "fireball", + "lightning bolt", + "magic missile", + "shocking grasp" + ] + ], + "creation": [ + "creation", + { + "cleric": 4, + "thief": 8, + "mage": 4, + "warrior": 8 + }, + [ + "continual light", + "create food", + "create spring", + "create water", + "create rose", + "floating disc" + ] + ], + "curative": [ + "curative", + { + "cleric": 4, + "thief": -1, + "mage": -1, + "warrior": 8 + }, + [ + "cure blindness", + "cure disease", + "cure poison" + ] + ], + "detection": [ + "detection", + { + "cleric": 3, + "thief": 6, + "mage": 4, + "warrior": -1 + }, + [ + "detect evil", + "detect good", + "detect hidden", + "detect invis", + "detect magic", + "detect poison", + "farsight", + "identify", + "know alignment", + "locate object" + ] + ], + "draconian": [ + "draconian", + { + "cleric": -1, + "thief": -1, + "mage": 8, + "warrior": -1 + }, + [ + "acid breath", + "fire breath", + "frost breath", + "gas breath", + "lightning breath" + ] + ], + "enchantment": [ + "enchantment", + { + "cleric": -1, + "thief": -1, + "mage": 6, + "warrior": -1 + }, + [ + "enchant armor", + "enchant weapon", + "fireproof", + "recharge" + ] + ], + "enhancement": [ + "enhancement", + { + "cleric": -1, + "thief": 9, + "mage": 5, + "warrior": 9 + }, + [ + "giant strength", + "haste", + "infravision", + "refresh" + ] + ], + "harmful": [ + "harmful", + { + "cleric": 3, + "thief": -1, + "mage": -1, + "warrior": 6 + }, + [ + "cause critical", + "cause light", + "cause serious", + "harm" + ] + ], + "healing": [ + "healing", + { + "cleric": 3, + "thief": -1, + "mage": -1, + "warrior": 6 + }, + [ + "cure critical", + "cure light", + "cure serious", + "heal", + "mass healing", + "refresh" + ] + ], + "illusion": [ + "illusion", + { + "cleric": -1, + "thief": 7, + "mage": 4, + "warrior": -1 + }, + [ + "invis", + "mass invis", + "ventriloquate" + ] + ], + "maladictions": [ + "maladictions", + { + "cleric": 5, + "thief": 9, + "mage": 5, + "warrior": 9 + }, + [ + "blindness", + "change sex", + "curse", + "energy drain", + "plague", + "poison", + "slow", + "weaken" + ] + ], + "protective": [ + "protective", + { + "cleric": 4, + "thief": 7, + "mage": 4, + "warrior": 8 + }, + [ + "armor", + "cancellation", + "dispel magic", + "fireproof", + "protection evil", + "protection good", + "sanctuary", + "shield", + "stone skin" + ] + ], + "transportation": [ + "transportation", + { + "cleric": 4, + "thief": 8, + "mage": 4, + "warrior": 9 + }, + [ + "fly", + "gate", + "nexus", + "pass door", + "portal", + "summon", + "teleport", + "word of recall" + ] + ], + "weather": [ + "weather", + { + "cleric": 4, + "thief": 8, + "mage": 4, + "warrior": 8 + }, + [ + "call lightning", + "control weather", + "faerie fire", + "faerie fog", + "lightning bolt" + ] + ] +} \ No newline at end of file diff --git a/src/data/guild_table.json b/src/data/guild_table.json new file mode 100644 index 0000000..a03c19b --- /dev/null +++ b/src/data/guild_table.json @@ -0,0 +1,74 @@ +{ + "mage": [ + "mage", + "Mag", + 1, + 3701, + [ + 3018, + 9618 + ], + 75, + 20, + 6, + 6, + 8, + true, + "mage basics", + "mage default" + ], + "cleric": [ + "cleric", + "Cle", + 2, + 3700, + [ + 3003, + 9619 + ], + 75, + 20, + 2, + 7, + 10, + true, + "cleric basics", + "cleric default" + ], + "thief": [ + "thief", + "Thi", + 3, + 3701, + [ + 3028, + 9639 + ], + 75, + 20, + -4, + 8, + 13, + false, + "thief basics", + "thief default" + ], + "warrior": [ + "warrior", + "War", + 0, + 3702, + [ + 3022, + 9633 + ], + 75, + 20, + -10, + 11, + 15, + false, + "warrior basics", + "warrior default" + ] +} \ No newline at end of file diff --git a/src/data/imm_flags.json b/src/data/imm_flags.json new file mode 100644 index 0000000..0f63214 --- /dev/null +++ b/src/data/imm_flags.json @@ -0,0 +1,117 @@ +{ + "summon": [ + "summon", + 1, + true + ], + "charm": [ + "charm", + 2, + true + ], + "magic": [ + "magic", + 4, + true + ], + "weapon": [ + "weapon", + 8, + true + ], + "bash": [ + "bash", + 16, + true + ], + "pierce": [ + "pierce", + 32, + true + ], + "slash": [ + "slash", + 64, + true + ], + "fire": [ + "fire", + 128, + true + ], + "cold": [ + "cold", + 256, + true + ], + "lightning": [ + "lightning", + 512, + true + ], + "acid": [ + "acid", + 1024, + true + ], + "poison": [ + "poison", + 2048, + true + ], + "negative": [ + "negative", + 4096, + true + ], + "holy": [ + "holy", + 8192, + true + ], + "energy": [ + "energy", + 16384, + true + ], + "mental": [ + "mental", + 32768, + true + ], + "disease": [ + "disease", + 65536, + true + ], + "drowning": [ + "drowning", + 131072, + true + ], + "light": [ + "light", + 262144, + true + ], + "sound": [ + "sound", + 524288, + true + ], + "wood": [ + "wood", + 8388608, + true + ], + "silver": [ + "silver", + 16777216, + true + ], + "iron": [ + "iron", + 33554432, + true + ] +} \ No newline at end of file diff --git a/src/data/int_app.json b/src/data/int_app.json new file mode 100644 index 0000000..ae145b7 --- /dev/null +++ b/src/data/int_app.json @@ -0,0 +1,80 @@ +{ + "0": [ + 3 + ], + "1": [ + 5 + ], + "2": [ + 7 + ], + "3": [ + 8 + ], + "4": [ + 9 + ], + "5": [ + 10 + ], + "6": [ + 11 + ], + "7": [ + 12 + ], + "8": [ + 13 + ], + "9": [ + 15 + ], + "10": [ + 17 + ], + "11": [ + 19 + ], + "12": [ + 22 + ], + "13": [ + 25 + ], + "14": [ + 28 + ], + "15": [ + 31 + ], + "16": [ + 34 + ], + "17": [ + 37 + ], + "18": [ + 40 + ], + "19": [ + 44 + ], + "20": [ + 49 + ], + "21": [ + 55 + ], + "22": [ + 60 + ], + "23": [ + 70 + ], + "24": [ + 80 + ], + "25": [ + 85 + ] +} \ No newline at end of file diff --git a/src/data/liq_table.json b/src/data/liq_table.json new file mode 100644 index 0000000..7bb3572 --- /dev/null +++ b/src/data/liq_table.json @@ -0,0 +1,326 @@ +{ + "water": [ + "water", + "clear", + 0, + 1, + 10, + 0, + 16 + ], + "beer": [ + "beer", + "amber", + 12, + 1, + 8, + 1, + 12 + ], + "red wine": [ + "red wine", + "burgundy", + 30, + 1, + 8, + 1, + 5 + ], + "ale": [ + "ale", + "brown", + 15, + 1, + 8, + 1, + 12 + ], + "dark ale": [ + "dark ale", + "dark", + 16, + 1, + 8, + 1, + 12 + ], + "whisky": [ + "whisky", + "golden", + 120, + 1, + 5, + 0, + 2 + ], + "lemonade": [ + "lemonade", + "pink", + 0, + 1, + 9, + 2, + 12 + ], + "firebreather": [ + "firebreather", + "boiling", + 190, + 0, + 4, + 0, + 2 + ], + "local specialty": [ + "local specialty", + "clear", + 151, + 1, + 3, + 0, + 2 + ], + "slime mold juice": [ + "slime mold juice", + "green", + 0, + 2, + -8, + 1, + 2 + ], + "milk": [ + "milk", + "white", + 0, + 2, + 9, + 3, + 12 + ], + "tea": [ + "tea", + "tan", + 0, + 1, + 8, + 0, + 6 + ], + "coffee": [ + "coffee", + "black", + 0, + 1, + 8, + 0, + 6 + ], + "blood": [ + "blood", + "red", + 0, + 2, + -1, + 2, + 6 + ], + "salt water": [ + "salt water", + "clear", + 0, + 1, + -2, + 0, + 1 + ], + "coke": [ + "coke", + "brown", + 0, + 2, + 9, + 2, + 12 + ], + "root beer": [ + "root beer", + "brown", + 0, + 2, + 9, + 2, + 12 + ], + "elvish wine": [ + "elvish wine", + "green", + 35, + 2, + 8, + 1, + 5 + ], + "white wine": [ + "white wine", + "golden", + 28, + 1, + 8, + 1, + 5 + ], + "champagne": [ + "champagne", + "golden", + 32, + 1, + 8, + 1, + 5 + ], + "mead": [ + "mead", + "honey-colored", + 34, + 2, + 8, + 2, + 12 + ], + "rose wine": [ + "rose wine", + "pink", + 26, + 1, + 8, + 1, + 5 + ], + "benedictine wine": [ + "benedictine wine", + "burgundy", + 40, + 1, + 8, + 1, + 5 + ], + "vodka": [ + "vodka", + "clear", + 130, + 1, + 5, + 0, + 2 + ], + "cranberry juice": [ + "cranberry juice", + "red", + 0, + 1, + 9, + 2, + 12 + ], + "orange juice": [ + "orange juice", + "orange", + 0, + 2, + 9, + 3, + 12 + ], + "absinthe": [ + "absinthe", + "green", + 200, + 1, + 4, + 0, + 2 + ], + "brandy": [ + "brandy", + "golden", + 80, + 1, + 5, + 0, + 4 + ], + "aquavit": [ + "aquavit", + "clear", + 140, + 1, + 5, + 0, + 2 + ], + "schnapps": [ + "schnapps", + "clear", + 90, + 1, + 5, + 0, + 2 + ], + "icewine": [ + "icewine", + "purple", + 50, + 2, + 6, + 1, + 5 + ], + "amontillado": [ + "amontillado", + "burgundy", + 35, + 2, + 8, + 1, + 5 + ], + "sherry": [ + "sherry", + "red", + 38, + 2, + 7, + 1, + 5 + ], + "framboise": [ + "framboise", + "red", + 50, + 1, + 7, + 1, + 5 + ], + "rum": [ + "rum", + "amber", + 151, + 1, + 4, + 0, + 2 + ], + "cordial": [ + "cordial", + "clear", + 100, + 1, + 5, + 0, + 2 + ] +} \ No newline at end of file diff --git a/src/data/off_flags.json b/src/data/off_flags.json new file mode 100644 index 0000000..727ad3d --- /dev/null +++ b/src/data/off_flags.json @@ -0,0 +1,107 @@ +{ + "area_attack": [ + "area_attack", + 1, + true + ], + "backstab": [ + "backstab", + 2, + true + ], + "bash": [ + "bash", + 4, + true + ], + "berserk": [ + "berserk", + 8, + true + ], + "disarm": [ + "disarm", + 16, + true + ], + "dodge": [ + "dodge", + 32, + true + ], + "fade": [ + "fade", + 64, + true + ], + "fast": [ + "fast", + 128, + true + ], + "kick": [ + "kick", + 256, + true + ], + "dirt_kick": [ + "dirt_kick", + 512, + true + ], + "parry": [ + "parry", + 1024, + true + ], + "rescue": [ + "rescue", + 2048, + true + ], + "tail": [ + "tail", + 4096, + true + ], + "trip": [ + "trip", + 8192, + true + ], + "crush": [ + "crush", + 16384, + true + ], + "assist_all": [ + "assist_all", + 32768, + true + ], + "assist_align": [ + "assist_align", + 65536, + true + ], + "assist_race": [ + "assist_race", + 131072, + true + ], + "assist_players": [ + "assist_players", + 262144, + true + ], + "assist_guard": [ + "assist_guard", + 524288, + true + ], + "assist_vnum": [ + "assist_vnum", + 1048576, + true + ] +} \ No newline at end of file diff --git a/src/data/part_flags.json b/src/data/part_flags.json new file mode 100644 index 0000000..9299fd3 --- /dev/null +++ b/src/data/part_flags.json @@ -0,0 +1,112 @@ +{ + "head": [ + "head", + 1, + true + ], + "arms": [ + "arms", + 2, + true + ], + "legs": [ + "legs", + 4, + true + ], + "heart": [ + "heart", + 8, + true + ], + "brains": [ + "brains", + 16, + true + ], + "guts": [ + "guts", + 32, + true + ], + "hands": [ + "hands", + 64, + true + ], + "feet": [ + "feet", + 128, + true + ], + "fingers": [ + "fingers", + 256, + true + ], + "ear": [ + "ear", + 512, + true + ], + "eye": [ + "eye", + 1024, + true + ], + "long_tongue": [ + "long_tongue", + 2048, + true + ], + "eyestalks": [ + "eyestalks", + 4096, + true + ], + "tentacles": [ + "tentacles", + 8192, + true + ], + "fins": [ + "fins", + 16384, + true + ], + "wings": [ + "wings", + 32768, + true + ], + "tail": [ + "tail", + 65536, + true + ], + "claws": [ + "claws", + 1048576, + true + ], + "fangs": [ + "fangs", + 2097152, + true + ], + "horns": [ + "horns", + 4194304, + true + ], + "scales": [ + "scales", + 8388608, + true + ], + "tusks": [ + "tusks", + 16777216, + true + ] +} \ No newline at end of file diff --git a/src/data/pc_race_table.json b/src/data/pc_race_table.json new file mode 100644 index 0000000..61ef6ed --- /dev/null +++ b/src/data/pc_race_table.json @@ -0,0 +1,120 @@ +{ + "human": [ + "human", + "Human", + 0, + { + "cleric": 100, + "thief": 100, + "mage": 100, + "warrior": 100 + }, + [ + "" + ], + [ + 13, + 13, + 13, + 13, + 13 + ], + [ + 18, + 18, + 18, + 18, + 18 + ], + 2 + ], + "elf": [ + "elf", + " Elf ", + 5, + { + "cleric": 125, + "thief": 100, + "mage": 100, + "warrior": 120 + }, + [ + "sneak", + "hide" + ], + [ + 12, + 14, + 13, + 15, + 11 + ], + [ + 16, + 20, + 18, + 21, + 15 + ], + 1 + ], + "dwarf": [ + "dwarf", + "Dwarf", + 8, + { + "cleric": 100, + "thief": 125, + "mage": 150, + "warrior": 100 + }, + [ + "berserk" + ], + [ + 14, + 12, + 14, + 10, + 15 + ], + [ + 20, + 16, + 19, + 14, + 21 + ], + 2 + ], + "giant": [ + "giant", + "Giant", + 6, + { + "cleric": 150, + "thief": 150, + "mage": 200, + "warrior": 105 + }, + [ + "bash", + "fast healing" + ], + [ + 16, + 11, + 13, + 11, + 14 + ], + [ + 22, + 15, + 18, + 15, + 20 + ], + 3 + ] +} \ No newline at end of file diff --git a/src/data/players/b/Bub/inventory/15249-item.json b/src/data/players/b/Bub/inventory/15249-item.json new file mode 100644 index 0000000..1d9ece3 --- /dev/null +++ b/src/data/players/b/Bub/inventory/15249-item.json @@ -0,0 +1,987 @@ +{ + "__class__/rom24.handler_item.Items": { + "_environment": 15248, + "_equipped": null, + "_equipped_to": null, + "_equips_to": null, + "_room_vnum": null, + "affected": [ + { + "__class__/rom24.handler_game.AFFECT_DATA": { + "bitvector": 0, + "duration": -1, + "level": 20, + "location": 17, + "modifier": -1, + "type": -1, + "valid": true, + "where": 1 + } + }, + { + "__class__/rom24.handler_game.AFFECT_DATA": { + "bitvector": 0, + "duration": -1, + "level": 20, + "location": 20, + "modifier": -1, + "type": -1, + "valid": true, + "where": 1 + } + } + ], + "area": "mud school", + "available_light": 0, + "carry_number": 0, + "carry_weight": 0, + "condition": 100, + "cost": 0, + "count": 0, + "description": "A war banner is on the floor here.", + "enchanted": false, + "extra_descr": [ + { + "__class__/rom24.world_classes.ExtraDescrData": { + "description": "This is the official Merc war banner to see you through the darkest realm!", + "keyword": "banner" + } + } + ], + "flags": { + "__class__/rom24.item_flags.ItemFlags": { + "equips_to": { + "__type__/set": [ + "light" + ] + }, + "item_attributes": { + "__type__/set": [ + "glow", + "take", + "magic" + ] + }, + "item_restrictions": { + "__type__/set": [] + }, + "weapon_attributes": { + "__type__/set": [] + } + } + }, + "form": { + "__class__/rom24.bit.Bit": { + "bits": 0, + "flags": { + "__type__/OrderedDict": [ + [ + "edible", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "edible", + 1, + true + ] + } + } + ], + [ + "poison", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "poison", + 2, + true + ] + } + } + ], + [ + "magical", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "magical", + 4, + true + ] + } + } + ], + [ + "instant_decay", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "instant_decay", + 8, + true + ] + } + } + ], + [ + "other", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "other", + 16, + true + ] + } + } + ], + [ + "animal", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "animal", + 64, + true + ] + } + } + ], + [ + "sentient", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "sentient", + 128, + true + ] + } + } + ], + [ + "undead", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "undead", + 256, + true + ] + } + } + ], + [ + "construct", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "construct", + 512, + true + ] + } + } + ], + [ + "mist", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "mist", + 1024, + true + ] + } + } + ], + [ + "intangible", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "intangible", + 2048, + true + ] + } + } + ], + [ + "biped", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "biped", + 4096, + true + ] + } + } + ], + [ + "centaur", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "centaur", + 8192, + true + ] + } + } + ], + [ + "insect", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "insect", + 16384, + true + ] + } + } + ], + [ + "spider", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "spider", + 32768, + true + ] + } + } + ], + [ + "crustacean", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "crustacean", + 65536, + true + ] + } + } + ], + [ + "worm", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "worm", + 131072, + true + ] + } + } + ], + [ + "blob", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "blob", + 262144, + true + ] + } + } + ], + [ + "mammal", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "mammal", + 2097152, + true + ] + } + } + ], + [ + "bird", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "bird", + 4194304, + true + ] + } + } + ], + [ + "reptile", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "reptile", + 8388608, + true + ] + } + } + ], + [ + "snake", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "snake", + 16777216, + true + ] + } + } + ], + [ + "dragon", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "dragon", + 33554432, + true + ] + } + } + ], + [ + "amphibian", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "amphibian", + 67108864, + true + ] + } + } + ], + [ + "fish", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "fish", + 134217728, + true + ] + } + } + ], + [ + "cold_blood", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "cold_blood", + 268435456, + true + ] + } + } + ] + ] + } + } + }, + "instance_id": 15249, + "inventory": [], + "is_area": false, + "is_item": true, + "is_living": false, + "is_room": false, + "item_type": "light", + "level": 0, + "long_descr": "", + "material": "cloth", + "name": "banner war merc", + "new_format": true, + "on": null, + "owner": "", + "parts": { + "__class__/rom24.bit.Bit": { + "bits": 0, + "flags": { + "__type__/OrderedDict": [ + [ + "head", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "head", + 1, + true + ] + } + } + ], + [ + "arms", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "arms", + 2, + true + ] + } + } + ], + [ + "legs", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "legs", + 4, + true + ] + } + } + ], + [ + "heart", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "heart", + 8, + true + ] + } + } + ], + [ + "brains", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "brains", + 16, + true + ] + } + } + ], + [ + "guts", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "guts", + 32, + true + ] + } + } + ], + [ + "hands", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "hands", + 64, + true + ] + } + } + ], + [ + "feet", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "feet", + 128, + true + ] + } + } + ], + [ + "fingers", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "fingers", + 256, + true + ] + } + } + ], + [ + "ear", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "ear", + 512, + true + ] + } + } + ], + [ + "eye", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "eye", + 1024, + true + ] + } + } + ], + [ + "long_tongue", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "long_tongue", + 2048, + true + ] + } + } + ], + [ + "eyestalks", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "eyestalks", + 4096, + true + ] + } + } + ], + [ + "tentacles", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "tentacles", + 8192, + true + ] + } + } + ], + [ + "fins", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "fins", + 16384, + true + ] + } + } + ], + [ + "wings", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "wings", + 32768, + true + ] + } + } + ], + [ + "tail", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "tail", + 65536, + true + ] + } + } + ], + [ + "claws", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "claws", + 1048576, + true + ] + } + } + ], + [ + "fangs", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "fangs", + 2097152, + true + ] + } + } + ], + [ + "horns", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "horns", + 4194304, + true + ] + } + } + ], + [ + "scales", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "scales", + 8388608, + true + ] + } + } + ], + [ + "tusks", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "tusks", + 16777216, + true + ] + } + } + ] + ] + } + } + }, + "reset_num": 0, + "short_descr": "a war banner", + "size": 0, + "timer": 0, + "valid": false, + "value": [ + 0, + 0, + 200, + 0, + 0 + ], + "vnum": 3716, + "was_in_room": null, + "weight": 20, + "zone": 0, + "zone_template": "" + } +} \ No newline at end of file diff --git a/src/data/players/b/Bub/inventory/15250-item.json b/src/data/players/b/Bub/inventory/15250-item.json new file mode 100644 index 0000000..56f50cd --- /dev/null +++ b/src/data/players/b/Bub/inventory/15250-item.json @@ -0,0 +1,961 @@ +{ + "__class__/rom24.handler_item.Items": { + "_environment": 15248, + "_equipped": null, + "_equipped_to": null, + "_equips_to": null, + "_room_vnum": null, + "affected": [], + "area": "mud school", + "available_light": 0, + "carry_number": 0, + "carry_weight": 0, + "condition": 100, + "cost": 0, + "count": 0, + "description": "You see a sub issue vest here.", + "enchanted": false, + "extra_descr": [ + { + "__class__/rom24.world_classes.ExtraDescrData": { + "description": "You see a vest of great but cheap craftsmanship. Stamped on the side is:\nMerc Industries", + "keyword": "vest" + } + } + ], + "flags": { + "__class__/rom24.item_flags.ItemFlags": { + "equips_to": { + "__type__/set": [ + "body" + ] + }, + "item_attributes": { + "__type__/set": [ + "melt_drop", + "take" + ] + }, + "item_restrictions": { + "__type__/set": [] + }, + "weapon_attributes": { + "__type__/set": [] + } + } + }, + "form": { + "__class__/rom24.bit.Bit": { + "bits": 0, + "flags": { + "__type__/OrderedDict": [ + [ + "edible", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "edible", + 1, + true + ] + } + } + ], + [ + "poison", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "poison", + 2, + true + ] + } + } + ], + [ + "magical", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "magical", + 4, + true + ] + } + } + ], + [ + "instant_decay", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "instant_decay", + 8, + true + ] + } + } + ], + [ + "other", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "other", + 16, + true + ] + } + } + ], + [ + "animal", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "animal", + 64, + true + ] + } + } + ], + [ + "sentient", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "sentient", + 128, + true + ] + } + } + ], + [ + "undead", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "undead", + 256, + true + ] + } + } + ], + [ + "construct", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "construct", + 512, + true + ] + } + } + ], + [ + "mist", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "mist", + 1024, + true + ] + } + } + ], + [ + "intangible", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "intangible", + 2048, + true + ] + } + } + ], + [ + "biped", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "biped", + 4096, + true + ] + } + } + ], + [ + "centaur", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "centaur", + 8192, + true + ] + } + } + ], + [ + "insect", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "insect", + 16384, + true + ] + } + } + ], + [ + "spider", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "spider", + 32768, + true + ] + } + } + ], + [ + "crustacean", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "crustacean", + 65536, + true + ] + } + } + ], + [ + "worm", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "worm", + 131072, + true + ] + } + } + ], + [ + "blob", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "blob", + 262144, + true + ] + } + } + ], + [ + "mammal", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "mammal", + 2097152, + true + ] + } + } + ], + [ + "bird", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "bird", + 4194304, + true + ] + } + } + ], + [ + "reptile", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "reptile", + 8388608, + true + ] + } + } + ], + [ + "snake", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "snake", + 16777216, + true + ] + } + } + ], + [ + "dragon", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "dragon", + 33554432, + true + ] + } + } + ], + [ + "amphibian", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "amphibian", + 67108864, + true + ] + } + } + ], + [ + "fish", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "fish", + 134217728, + true + ] + } + } + ], + [ + "cold_blood", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "cold_blood", + 268435456, + true + ] + } + } + ] + ] + } + } + }, + "instance_id": 15250, + "inventory": [], + "is_area": false, + "is_item": true, + "is_living": false, + "is_room": false, + "item_type": "armor", + "level": 0, + "long_descr": "", + "material": "leather", + "name": "vest sub merc", + "new_format": true, + "on": null, + "owner": "", + "parts": { + "__class__/rom24.bit.Bit": { + "bits": 0, + "flags": { + "__type__/OrderedDict": [ + [ + "head", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "head", + 1, + true + ] + } + } + ], + [ + "arms", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "arms", + 2, + true + ] + } + } + ], + [ + "legs", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "legs", + 4, + true + ] + } + } + ], + [ + "heart", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "heart", + 8, + true + ] + } + } + ], + [ + "brains", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "brains", + 16, + true + ] + } + } + ], + [ + "guts", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "guts", + 32, + true + ] + } + } + ], + [ + "hands", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "hands", + 64, + true + ] + } + } + ], + [ + "feet", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "feet", + 128, + true + ] + } + } + ], + [ + "fingers", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "fingers", + 256, + true + ] + } + } + ], + [ + "ear", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "ear", + 512, + true + ] + } + } + ], + [ + "eye", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "eye", + 1024, + true + ] + } + } + ], + [ + "long_tongue", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "long_tongue", + 2048, + true + ] + } + } + ], + [ + "eyestalks", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "eyestalks", + 4096, + true + ] + } + } + ], + [ + "tentacles", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "tentacles", + 8192, + true + ] + } + } + ], + [ + "fins", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "fins", + 16384, + true + ] + } + } + ], + [ + "wings", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "wings", + 32768, + true + ] + } + } + ], + [ + "tail", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "tail", + 65536, + true + ] + } + } + ], + [ + "claws", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "claws", + 1048576, + true + ] + } + } + ], + [ + "fangs", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "fangs", + 2097152, + true + ] + } + } + ], + [ + "horns", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "horns", + 4194304, + true + ] + } + } + ], + [ + "scales", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "scales", + 8388608, + true + ] + } + } + ], + [ + "tusks", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "tusks", + 16777216, + true + ] + } + } + ] + ] + } + } + }, + "reset_num": 0, + "short_descr": "a sub issue vest", + "size": 0, + "timer": 0, + "valid": false, + "value": [ + 1, + 1, + 1, + 0, + 0 + ], + "vnum": 3703, + "was_in_room": null, + "weight": 50, + "zone": 0, + "zone_template": "" + } +} \ No newline at end of file diff --git a/src/data/players/b/Bub/inventory/15251-item.json b/src/data/players/b/Bub/inventory/15251-item.json new file mode 100644 index 0000000..3805ff9 --- /dev/null +++ b/src/data/players/b/Bub/inventory/15251-item.json @@ -0,0 +1,974 @@ +{ + "__class__/rom24.handler_item.Items": { + "_environment": 15248, + "_equipped": null, + "_equipped_to": null, + "_equips_to": null, + "_room_vnum": null, + "affected": [ + { + "__class__/rom24.handler_game.AFFECT_DATA": { + "bitvector": 0, + "duration": -1, + "level": 20, + "location": 18, + "modifier": 1, + "type": -1, + "valid": true, + "where": 1 + } + } + ], + "area": "mud school", + "available_light": 0, + "carry_number": 0, + "carry_weight": 0, + "condition": 100, + "cost": 210, + "count": 0, + "description": "You see a sub issue dagger here.", + "enchanted": false, + "extra_descr": [ + { + "__class__/rom24.world_classes.ExtraDescrData": { + "description": "You see a dagger of great but cheap craftsmanship. Imprinted on the side is:\nMerc Industries", + "keyword": "dagger" + } + } + ], + "flags": { + "__class__/rom24.item_flags.ItemFlags": { + "equips_to": { + "__type__/set": [ + "main_hand" + ] + }, + "item_attributes": { + "__type__/set": [ + "melt_drop", + "take" + ] + }, + "item_restrictions": { + "__type__/set": [] + }, + "weapon_attributes": { + "__type__/set": [] + } + } + }, + "form": { + "__class__/rom24.bit.Bit": { + "bits": 0, + "flags": { + "__type__/OrderedDict": [ + [ + "edible", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "edible", + 1, + true + ] + } + } + ], + [ + "poison", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "poison", + 2, + true + ] + } + } + ], + [ + "magical", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "magical", + 4, + true + ] + } + } + ], + [ + "instant_decay", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "instant_decay", + 8, + true + ] + } + } + ], + [ + "other", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "other", + 16, + true + ] + } + } + ], + [ + "animal", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "animal", + 64, + true + ] + } + } + ], + [ + "sentient", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "sentient", + 128, + true + ] + } + } + ], + [ + "undead", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "undead", + 256, + true + ] + } + } + ], + [ + "construct", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "construct", + 512, + true + ] + } + } + ], + [ + "mist", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "mist", + 1024, + true + ] + } + } + ], + [ + "intangible", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "intangible", + 2048, + true + ] + } + } + ], + [ + "biped", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "biped", + 4096, + true + ] + } + } + ], + [ + "centaur", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "centaur", + 8192, + true + ] + } + } + ], + [ + "insect", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "insect", + 16384, + true + ] + } + } + ], + [ + "spider", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "spider", + 32768, + true + ] + } + } + ], + [ + "crustacean", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "crustacean", + 65536, + true + ] + } + } + ], + [ + "worm", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "worm", + 131072, + true + ] + } + } + ], + [ + "blob", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "blob", + 262144, + true + ] + } + } + ], + [ + "mammal", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "mammal", + 2097152, + true + ] + } + } + ], + [ + "bird", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "bird", + 4194304, + true + ] + } + } + ], + [ + "reptile", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "reptile", + 8388608, + true + ] + } + } + ], + [ + "snake", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "snake", + 16777216, + true + ] + } + } + ], + [ + "dragon", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "dragon", + 33554432, + true + ] + } + } + ], + [ + "amphibian", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "amphibian", + 67108864, + true + ] + } + } + ], + [ + "fish", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "fish", + 134217728, + true + ] + } + } + ], + [ + "cold_blood", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "cold_blood", + 268435456, + true + ] + } + } + ] + ] + } + } + }, + "instance_id": 15251, + "inventory": [], + "is_area": false, + "is_item": true, + "is_living": false, + "is_room": false, + "item_type": "weapon", + "level": 0, + "long_descr": "", + "material": "bronze", + "name": "dagger sub merc", + "new_format": true, + "on": null, + "owner": "", + "parts": { + "__class__/rom24.bit.Bit": { + "bits": 0, + "flags": { + "__type__/OrderedDict": [ + [ + "head", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "head", + 1, + true + ] + } + } + ], + [ + "arms", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "arms", + 2, + true + ] + } + } + ], + [ + "legs", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "legs", + 4, + true + ] + } + } + ], + [ + "heart", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "heart", + 8, + true + ] + } + } + ], + [ + "brains", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "brains", + 16, + true + ] + } + } + ], + [ + "guts", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "guts", + 32, + true + ] + } + } + ], + [ + "hands", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "hands", + 64, + true + ] + } + } + ], + [ + "feet", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "feet", + 128, + true + ] + } + } + ], + [ + "fingers", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "fingers", + 256, + true + ] + } + } + ], + [ + "ear", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "ear", + 512, + true + ] + } + } + ], + [ + "eye", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "eye", + 1024, + true + ] + } + } + ], + [ + "long_tongue", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "long_tongue", + 2048, + true + ] + } + } + ], + [ + "eyestalks", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "eyestalks", + 4096, + true + ] + } + } + ], + [ + "tentacles", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "tentacles", + 8192, + true + ] + } + } + ], + [ + "fins", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "fins", + 16384, + true + ] + } + } + ], + [ + "wings", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "wings", + 32768, + true + ] + } + } + ], + [ + "tail", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "tail", + 65536, + true + ] + } + } + ], + [ + "claws", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "claws", + 1048576, + true + ] + } + } + ], + [ + "fangs", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "fangs", + 2097152, + true + ] + } + } + ], + [ + "horns", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "horns", + 4194304, + true + ] + } + } + ], + [ + "scales", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "scales", + 8388608, + true + ] + } + } + ], + [ + "tusks", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "tusks", + 16777216, + true + ] + } + } + ] + ] + } + } + }, + "reset_num": 0, + "short_descr": "a sub issue dagger", + "size": 0, + "timer": 0, + "valid": false, + "value": [ + "dagger", + 1, + 4, + 11, + 0 + ], + "vnum": 3701, + "was_in_room": null, + "weight": 10, + "zone": 0, + "zone_template": "" + } +} \ No newline at end of file diff --git a/src/data/players/b/Bub/inventory/15252-item.json b/src/data/players/b/Bub/inventory/15252-item.json new file mode 100644 index 0000000..a61c8ce --- /dev/null +++ b/src/data/players/b/Bub/inventory/15252-item.json @@ -0,0 +1,961 @@ +{ + "__class__/rom24.handler_item.Items": { + "_environment": 15248, + "_equipped": null, + "_equipped_to": null, + "_equips_to": null, + "_room_vnum": null, + "affected": [], + "area": "mud school", + "available_light": 0, + "carry_number": 0, + "carry_weight": 0, + "condition": 100, + "cost": 0, + "count": 0, + "description": "You see a sub issue shield here.", + "enchanted": false, + "extra_descr": [ + { + "__class__/rom24.world_classes.ExtraDescrData": { + "description": "You see a shield of great but cheap craftsmanship. Imprinted on the side is:\nMerc Industries", + "keyword": "shield" + } + } + ], + "flags": { + "__class__/rom24.item_flags.ItemFlags": { + "equips_to": { + "__type__/set": [ + "off_hand" + ] + }, + "item_attributes": { + "__type__/set": [ + "melt_drop", + "take" + ] + }, + "item_restrictions": { + "__type__/set": [] + }, + "weapon_attributes": { + "__type__/set": [] + } + } + }, + "form": { + "__class__/rom24.bit.Bit": { + "bits": 0, + "flags": { + "__type__/OrderedDict": [ + [ + "edible", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "edible", + 1, + true + ] + } + } + ], + [ + "poison", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "poison", + 2, + true + ] + } + } + ], + [ + "magical", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "magical", + 4, + true + ] + } + } + ], + [ + "instant_decay", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "instant_decay", + 8, + true + ] + } + } + ], + [ + "other", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "other", + 16, + true + ] + } + } + ], + [ + "animal", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "animal", + 64, + true + ] + } + } + ], + [ + "sentient", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "sentient", + 128, + true + ] + } + } + ], + [ + "undead", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "undead", + 256, + true + ] + } + } + ], + [ + "construct", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "construct", + 512, + true + ] + } + } + ], + [ + "mist", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "mist", + 1024, + true + ] + } + } + ], + [ + "intangible", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "intangible", + 2048, + true + ] + } + } + ], + [ + "biped", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "biped", + 4096, + true + ] + } + } + ], + [ + "centaur", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "centaur", + 8192, + true + ] + } + } + ], + [ + "insect", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "insect", + 16384, + true + ] + } + } + ], + [ + "spider", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "spider", + 32768, + true + ] + } + } + ], + [ + "crustacean", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "crustacean", + 65536, + true + ] + } + } + ], + [ + "worm", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "worm", + 131072, + true + ] + } + } + ], + [ + "blob", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "blob", + 262144, + true + ] + } + } + ], + [ + "mammal", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "mammal", + 2097152, + true + ] + } + } + ], + [ + "bird", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "bird", + 4194304, + true + ] + } + } + ], + [ + "reptile", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "reptile", + 8388608, + true + ] + } + } + ], + [ + "snake", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "snake", + 16777216, + true + ] + } + } + ], + [ + "dragon", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "dragon", + 33554432, + true + ] + } + } + ], + [ + "amphibian", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "amphibian", + 67108864, + true + ] + } + } + ], + [ + "fish", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "fish", + 134217728, + true + ] + } + } + ], + [ + "cold_blood", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "cold_blood", + 268435456, + true + ] + } + } + ] + ] + } + } + }, + "instance_id": 15252, + "inventory": [], + "is_area": false, + "is_item": true, + "is_living": false, + "is_room": false, + "item_type": "armor", + "level": 0, + "long_descr": "", + "material": "wood", + "name": "shield sub merc", + "new_format": true, + "on": null, + "owner": "", + "parts": { + "__class__/rom24.bit.Bit": { + "bits": 0, + "flags": { + "__type__/OrderedDict": [ + [ + "head", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "head", + 1, + true + ] + } + } + ], + [ + "arms", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "arms", + 2, + true + ] + } + } + ], + [ + "legs", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "legs", + 4, + true + ] + } + } + ], + [ + "heart", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "heart", + 8, + true + ] + } + } + ], + [ + "brains", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "brains", + 16, + true + ] + } + } + ], + [ + "guts", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "guts", + 32, + true + ] + } + } + ], + [ + "hands", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "hands", + 64, + true + ] + } + } + ], + [ + "feet", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "feet", + 128, + true + ] + } + } + ], + [ + "fingers", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "fingers", + 256, + true + ] + } + } + ], + [ + "ear", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "ear", + 512, + true + ] + } + } + ], + [ + "eye", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "eye", + 1024, + true + ] + } + } + ], + [ + "long_tongue", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "long_tongue", + 2048, + true + ] + } + } + ], + [ + "eyestalks", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "eyestalks", + 4096, + true + ] + } + } + ], + [ + "tentacles", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "tentacles", + 8192, + true + ] + } + } + ], + [ + "fins", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "fins", + 16384, + true + ] + } + } + ], + [ + "wings", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "wings", + 32768, + true + ] + } + } + ], + [ + "tail", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "tail", + 65536, + true + ] + } + } + ], + [ + "claws", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "claws", + 1048576, + true + ] + } + } + ], + [ + "fangs", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "fangs", + 2097152, + true + ] + } + } + ], + [ + "horns", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "horns", + 4194304, + true + ] + } + } + ], + [ + "scales", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "scales", + 8388608, + true + ] + } + } + ], + [ + "tusks", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "tusks", + 16777216, + true + ] + } + } + ] + ] + } + } + }, + "reset_num": 0, + "short_descr": "a sub issue shield", + "size": 0, + "timer": 0, + "valid": false, + "value": [ + 1, + 1, + 1, + 0, + 0 + ], + "vnum": 3704, + "was_in_room": null, + "weight": 30, + "zone": 0, + "zone_template": "" + } +} \ No newline at end of file diff --git a/src/data/players/b/Bub/inventory/15253-item.json b/src/data/players/b/Bub/inventory/15253-item.json new file mode 100644 index 0000000..ced9ac5 --- /dev/null +++ b/src/data/players/b/Bub/inventory/15253-item.json @@ -0,0 +1,958 @@ +{ + "__class__/rom24.handler_item.Items": { + "_environment": 15248, + "_equipped": null, + "_equipped_to": null, + "_equips_to": null, + "_room_vnum": null, + "affected": [], + "area": "Midgaard", + "available_light": 0, + "carry_number": 0, + "carry_weight": 0, + "condition": 100, + "cost": 500, + "count": 0, + "description": "A rolled up map is here.", + "enchanted": false, + "extra_descr": [ + { + "__class__/rom24.world_classes.ExtraDescrData": { + "description": ".\n * * * MIDGAARD * * *\n = = ========== = =\n\n Rainbow Bridge (Asgard and Valhalla)\n /\n North Temple Altar Mud School <--- ** NEWBIES **\n | /Up (Healer, Pit) | ** GO HERE **\n | / | /Entrance to\n West---+---East | / Mud School\n / | Temple of |\n Down/ | Mota Arena\n South (Recall)\n |\n | /In the Air /Defunct Reception\n Cleric | / /\n Northern Guild----Temple Square---Grunting---Bar Northern\n Midgaard (Fountain) Boar Inn Midgaard\n (Clan Road) Magic | (Clan Road)\n | Shop Bakery | Grocer Weaponsmith |\n | | | | | | |\nTo <---West---Main-Street---Market----Main-Street-+--------East--->Cross\nShire, Gate | | Square | | Gate Roads\nForest of | Mage Armoury | Jeweler Warrior |\nHaon-Dor | Guild | Guild Wall Road\n Wall | |\n Road Leather Map | Grebe's Pet Apothecary |\n | Shop Shop | Tavern Shop (Potions) |\n | | | Common | | | |\n Wall---Poor-Alley----Square---Dark-Alley------+----Wall Road\n Road | | | | | | |\n | Temple Grubby | Thieves Levee Warehouse |\n | Of Stupid Inn | Guild (Boats) (Sailor) |\n | Dump | |\n Wall Mob Sewers/ | | Wall\n Road--Factory | | Road\n | South Midgaard | To the\n Bridge Bridge River---------> Bridge <--> Sands\n | | | of\n Southern Southern Southern Sorrow\n Midgaard Midgaard Midgaard", + "keyword": "map midgaard" + } + } + ], + "flags": { + "__class__/rom24.item_flags.ItemFlags": { + "equips_to": { + "__type__/set": [] + }, + "item_attributes": { + "__type__/set": [ + "take" + ] + }, + "item_restrictions": { + "__type__/set": [] + }, + "weapon_attributes": { + "__type__/set": [] + } + } + }, + "form": { + "__class__/rom24.bit.Bit": { + "bits": 0, + "flags": { + "__type__/OrderedDict": [ + [ + "edible", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "edible", + 1, + true + ] + } + } + ], + [ + "poison", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "poison", + 2, + true + ] + } + } + ], + [ + "magical", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "magical", + 4, + true + ] + } + } + ], + [ + "instant_decay", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "instant_decay", + 8, + true + ] + } + } + ], + [ + "other", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "other", + 16, + true + ] + } + } + ], + [ + "animal", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "animal", + 64, + true + ] + } + } + ], + [ + "sentient", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "sentient", + 128, + true + ] + } + } + ], + [ + "undead", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "undead", + 256, + true + ] + } + } + ], + [ + "construct", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "construct", + 512, + true + ] + } + } + ], + [ + "mist", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "mist", + 1024, + true + ] + } + } + ], + [ + "intangible", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "intangible", + 2048, + true + ] + } + } + ], + [ + "biped", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "biped", + 4096, + true + ] + } + } + ], + [ + "centaur", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "centaur", + 8192, + true + ] + } + } + ], + [ + "insect", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "insect", + 16384, + true + ] + } + } + ], + [ + "spider", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "spider", + 32768, + true + ] + } + } + ], + [ + "crustacean", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "crustacean", + 65536, + true + ] + } + } + ], + [ + "worm", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "worm", + 131072, + true + ] + } + } + ], + [ + "blob", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "blob", + 262144, + true + ] + } + } + ], + [ + "mammal", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "mammal", + 2097152, + true + ] + } + } + ], + [ + "bird", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "bird", + 4194304, + true + ] + } + } + ], + [ + "reptile", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "reptile", + 8388608, + true + ] + } + } + ], + [ + "snake", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "snake", + 16777216, + true + ] + } + } + ], + [ + "dragon", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "dragon", + 33554432, + true + ] + } + } + ], + [ + "amphibian", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "amphibian", + 67108864, + true + ] + } + } + ], + [ + "fish", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "fish", + 134217728, + true + ] + } + } + ], + [ + "cold_blood", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "cold_blood", + 268435456, + true + ] + } + } + ] + ] + } + } + }, + "instance_id": 15253, + "inventory": [], + "is_area": false, + "is_item": true, + "is_living": false, + "is_room": false, + "item_type": "map", + "level": 0, + "long_descr": "", + "material": "paper", + "name": "map midgaard", + "new_format": true, + "on": null, + "owner": "", + "parts": { + "__class__/rom24.bit.Bit": { + "bits": 0, + "flags": { + "__type__/OrderedDict": [ + [ + "head", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "head", + 1, + true + ] + } + } + ], + [ + "arms", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "arms", + 2, + true + ] + } + } + ], + [ + "legs", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "legs", + 4, + true + ] + } + } + ], + [ + "heart", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "heart", + 8, + true + ] + } + } + ], + [ + "brains", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "brains", + 16, + true + ] + } + } + ], + [ + "guts", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "guts", + 32, + true + ] + } + } + ], + [ + "hands", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "hands", + 64, + true + ] + } + } + ], + [ + "feet", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "feet", + 128, + true + ] + } + } + ], + [ + "fingers", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "fingers", + 256, + true + ] + } + } + ], + [ + "ear", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "ear", + 512, + true + ] + } + } + ], + [ + "eye", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "eye", + 1024, + true + ] + } + } + ], + [ + "long_tongue", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "long_tongue", + 2048, + true + ] + } + } + ], + [ + "eyestalks", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "eyestalks", + 4096, + true + ] + } + } + ], + [ + "tentacles", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "tentacles", + 8192, + true + ] + } + } + ], + [ + "fins", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "fins", + 16384, + true + ] + } + } + ], + [ + "wings", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "wings", + 32768, + true + ] + } + } + ], + [ + "tail", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "tail", + 65536, + true + ] + } + } + ], + [ + "claws", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "claws", + 1048576, + true + ] + } + } + ], + [ + "fangs", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "fangs", + 2097152, + true + ] + } + } + ], + [ + "horns", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "horns", + 4194304, + true + ] + } + } + ], + [ + "scales", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "scales", + 8388608, + true + ] + } + } + ], + [ + "tusks", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "tusks", + 16777216, + true + ] + } + } + ] + ] + } + } + }, + "reset_num": 0, + "short_descr": "a map of the city of Midgaard", + "size": 0, + "timer": 0, + "valid": false, + "value": [ + 1, + 0, + 0, + 0, + 0 + ], + "vnum": 3162, + "was_in_room": null, + "weight": 10, + "zone": 0, + "zone_template": "" + } +} \ No newline at end of file diff --git a/src/data/players/b/Bub/login.json b/src/data/players/b/Bub/login.json new file mode 100644 index 0000000..d779bea --- /dev/null +++ b/src/data/players/b/Bub/login.json @@ -0,0 +1,11 @@ +{ + "auth": null, + "instance_id": 15248, + "is_banned": 0, + "is_immortal": true, + "last_login": 1640552616.4545052, + "last_logout": null, + "name": "Bub", + "pwd": "ce57d8bc990447c7ec35557040756db2a9ff7cdab53911f3c7995bc6bf3572cda8c94fa53789e523a680de9921c067f6717e79426df467185fc7a6dbec4b2d57", + "room": 3001 +} \ No newline at end of file diff --git a/src/data/players/b/Bub/player.json b/src/data/players/b/Bub/player.json new file mode 100644 index 0000000..b638b43 --- /dev/null +++ b/src/data/players/b/Bub/player.json @@ -0,0 +1,4442 @@ +{ + "__class__/rom24.handler_pc.Pc": { + "_clan": "", + "_environment": 10414, + "_equipped": null, + "_equipped_to": null, + "_equips_to": null, + "_fighting": null, + "_guild": "mage", + "_last_login": 1640552616.4545052, + "_last_logout": null, + "_race": "human", + "_room_vnum": 3700, + "_saved_room_vnum": 3001, + "_title": " the Implementor", + "_trust": 0, + "act": { + "__class__/rom24.bit.Bit": { + "bits": 65544, + "flags": { + "__type__/OrderedDict": [ + [ + "npc", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "npc", + 1, + false + ] + } + } + ], + [ + "sentinel", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "sentinel", + 2, + true + ] + } + } + ], + [ + "scavenger", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "scavenger", + 4, + true + ] + } + } + ], + [ + "aggressive", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "aggressive", + 32, + true + ] + } + } + ], + [ + "stay_area", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "stay_area", + 64, + true + ] + } + } + ], + [ + "wimpy", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "wimpy", + 128, + true + ] + } + } + ], + [ + "pet", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "pet", + 256, + true + ] + } + } + ], + [ + "train", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "train", + 512, + true + ] + } + } + ], + [ + "practice", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "practice", + 1024, + true + ] + } + } + ], + [ + "undead", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "undead", + 16384, + true + ] + } + } + ], + [ + "cleric", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "cleric", + 65536, + true + ] + } + } + ], + [ + "mage", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "mage", + 131072, + true + ] + } + } + ], + [ + "thief", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "thief", + 33554432, + false + ] + } + } + ], + [ + "warrior", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "warrior", + 524288, + true + ] + } + } + ], + [ + "noalign", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "noalign", + 1048576, + true + ] + } + } + ], + [ + "nopurge", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "nopurge", + 2097152, + true + ] + } + } + ], + [ + "outdoors", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "outdoors", + 4194304, + true + ] + } + } + ], + [ + "indoors", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "indoors", + 16777216, + true + ] + } + } + ], + [ + "healer", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "healer", + 67108864, + true + ] + } + } + ], + [ + "gain", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "gain", + 134217728, + true + ] + } + } + ], + [ + "update_always", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "update_always", + 268435456, + true + ] + } + } + ], + [ + "changer", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "changer", + 536870912, + true + ] + } + } + ], + [ + "autoassist", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "autoassist", + 4, + false + ] + } + } + ], + [ + "autoexit", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "autoexit", + 8, + false + ] + } + } + ], + [ + "autoloot", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "autoloot", + 16, + false + ] + } + } + ], + [ + "autosac", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "autosac", + 32, + false + ] + } + } + ], + [ + "autogold", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "autogold", + 64, + false + ] + } + } + ], + [ + "autosplit", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "autosplit", + 128, + false + ] + } + } + ], + [ + "holylight", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "holylight", + 8192, + false + ] + } + } + ], + [ + "can_loot", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "can_loot", + 32768, + false + ] + } + } + ], + [ + "nosummon", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "nosummon", + 65536, + false + ] + } + } + ], + [ + "nofollow", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "nofollow", + 131072, + false + ] + } + } + ], + [ + "permit", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "permit", + 1048576, + true + ] + } + } + ], + [ + "log", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "log", + 4194304, + false + ] + } + } + ], + [ + "deny", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "deny", + 8388608, + false + ] + } + } + ], + [ + "freeze", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "freeze", + 16777216, + false + ] + } + } + ], + [ + "killer", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "killer", + 67108864, + false + ] + } + } + ] + ] + } + } + }, + "affected": [], + "affected_by": { + "__class__/rom24.bit.Bit": { + "bits": 0, + "flags": { + "__type__/OrderedDict": [ + [ + "blind", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "blind", + 1, + true + ] + } + } + ], + [ + "invisible", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "invisible", + 2, + true + ] + } + } + ], + [ + "detect_evil", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "detect_evil", + 4, + true + ] + } + } + ], + [ + "detect_invis", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "detect_invis", + 8, + true + ] + } + } + ], + [ + "detect_magic", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "detect_magic", + 16, + true + ] + } + } + ], + [ + "detect_hidden", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "detect_hidden", + 32, + true + ] + } + } + ], + [ + "detect_good", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "detect_good", + 64, + true + ] + } + } + ], + [ + "sanctuary", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "sanctuary", + 128, + true + ] + } + } + ], + [ + "faerie_fire", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "faerie_fire", + 256, + true + ] + } + } + ], + [ + "infrared", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "infrared", + 512, + true + ] + } + } + ], + [ + "curse", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "curse", + 1024, + true + ] + } + } + ], + [ + "poison", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "poison", + 4096, + true + ] + } + } + ], + [ + "protect_evil", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "protect_evil", + 8192, + true + ] + } + } + ], + [ + "protect_good", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "protect_good", + 16384, + true + ] + } + } + ], + [ + "sneak", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "sneak", + 32768, + true + ] + } + } + ], + [ + "hide", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "hide", + 65536, + true + ] + } + } + ], + [ + "sleep", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "sleep", + 131072, + true + ] + } + } + ], + [ + "charm", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "charm", + 262144, + true + ] + } + } + ], + [ + "flying", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "flying", + 524288, + true + ] + } + } + ], + [ + "pass_door", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "pass_door", + 1048576, + true + ] + } + } + ], + [ + "haste", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "haste", + 2097152, + true + ] + } + } + ], + [ + "calm", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "calm", + 4194304, + true + ] + } + } + ], + [ + "plague", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "plague", + 8388608, + true + ] + } + } + ], + [ + "weaken", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "weaken", + 16777216, + true + ] + } + } + ], + [ + "dark_vision", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "dark_vision", + 33554432, + true + ] + } + } + ], + [ + "berserk", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "berserk", + 67108864, + true + ] + } + } + ], + [ + "swim", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "swim", + 134217728, + true + ] + } + } + ], + [ + "regeneration", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "regeneration", + 268435456, + true + ] + } + } + ], + [ + "slow", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "slow", + 536870912, + true + ] + } + } + ] + ] + } + } + }, + "alias": {}, + "alignment": 0, + "area": null, + "armor": [ + 97, + 97, + 97, + 99 + ], + "auth": null, + "available_light": 0, + "bamfin": "", + "bamfout": "", + "buffer": [], + "carry_number": 5, + "carry_weight": 120, + "comm": { + "__class__/rom24.bit.Bit": { + "bits": 24576, + "flags": { + "__type__/OrderedDict": [ + [ + "quiet", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "quiet", + 1, + true + ] + } + } + ], + [ + "deaf", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "deaf", + 2, + true + ] + } + } + ], + [ + "nowiz", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "nowiz", + 4, + true + ] + } + } + ], + [ + "noclangossip", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "noclangossip", + 8, + true + ] + } + } + ], + [ + "nogossip", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "nogossip", + 16, + true + ] + } + } + ], + [ + "noquestion", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "noquestion", + 32, + true + ] + } + } + ], + [ + "nomusic", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "nomusic", + 64, + true + ] + } + } + ], + [ + "noclan", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "noclan", + 128, + true + ] + } + } + ], + [ + "noquote", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "noquote", + 256, + true + ] + } + } + ], + [ + "shoutsoff", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "shoutsoff", + 512, + true + ] + } + } + ], + [ + "compact", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "compact", + 2048, + true + ] + } + } + ], + [ + "brief", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "brief", + 4096, + true + ] + } + } + ], + [ + "prompt", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "prompt", + 8192, + true + ] + } + } + ], + [ + "combine", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "combine", + 16384, + true + ] + } + } + ], + [ + "telnet_ga", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "telnet_ga", + 32768, + true + ] + } + } + ], + [ + "show_affects", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "show_affects", + 65536, + true + ] + } + } + ], + [ + "nograts", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "nograts", + 131072, + true + ] + } + } + ], + [ + "noemote", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "noemote", + 524288, + false + ] + } + } + ], + [ + "noshout", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "noshout", + 1048576, + false + ] + } + } + ], + [ + "notell", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "notell", + 2097152, + false + ] + } + } + ], + [ + "nochannels", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "nochannels", + 4194304, + false + ] + } + } + ], + [ + "snoop_proof", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "snoop_proof", + 16777216, + false + ] + } + } + ], + [ + "afk", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "afk", + 33554432, + true + ] + } + } + ] + ] + } + } + }, + "condition": [ + 48, + 48, + 48, + 0 + ], + "confirm_delete": false, + "dam_type": 17, + "dampen": false, + "damroll": 0, + "daze": 0, + "description": "", + "exp": 60000, + "failed_attempts": 0, + "form": { + "__class__/rom24.bit.Bit": { + "bits": 2101377, + "flags": { + "__type__/OrderedDict": [ + [ + "edible", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "edible", + 1, + true + ] + } + } + ], + [ + "poison", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "poison", + 2, + true + ] + } + } + ], + [ + "magical", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "magical", + 4, + true + ] + } + } + ], + [ + "instant_decay", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "instant_decay", + 8, + true + ] + } + } + ], + [ + "other", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "other", + 16, + true + ] + } + } + ], + [ + "animal", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "animal", + 64, + true + ] + } + } + ], + [ + "sentient", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "sentient", + 128, + true + ] + } + } + ], + [ + "undead", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "undead", + 256, + true + ] + } + } + ], + [ + "construct", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "construct", + 512, + true + ] + } + } + ], + [ + "mist", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "mist", + 1024, + true + ] + } + } + ], + [ + "intangible", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "intangible", + 2048, + true + ] + } + } + ], + [ + "biped", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "biped", + 4096, + true + ] + } + } + ], + [ + "centaur", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "centaur", + 8192, + true + ] + } + } + ], + [ + "insect", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "insect", + 16384, + true + ] + } + } + ], + [ + "spider", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "spider", + 32768, + true + ] + } + } + ], + [ + "crustacean", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "crustacean", + 65536, + true + ] + } + } + ], + [ + "worm", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "worm", + 131072, + true + ] + } + } + ], + [ + "blob", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "blob", + 262144, + true + ] + } + } + ], + [ + "mammal", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "mammal", + 2097152, + true + ] + } + } + ], + [ + "bird", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "bird", + 4194304, + true + ] + } + } + ], + [ + "reptile", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "reptile", + 8388608, + true + ] + } + } + ], + [ + "snake", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "snake", + 16777216, + true + ] + } + } + ], + [ + "dragon", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "dragon", + 33554432, + true + ] + } + } + ], + [ + "amphibian", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "amphibian", + 67108864, + true + ] + } + } + ], + [ + "fish", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "fish", + 134217728, + true + ] + } + } + ], + [ + "cold_blood", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "cold_blood", + 268435456, + true + ] + } + } + ] + ] + } + } + }, + "gen_data": null, + "gold": 0, + "group": null, + "group_known": { + "beguiling": true, + "combat": true, + "detection": true, + "enhancement": true, + "illusion": true, + "mage basics": true, + "mage default": true, + "maladictions": true, + "protective": true, + "rom basics": true, + "transportation": true, + "weather": true + }, + "hit": 20, + "hitroll": 1, + "id": 0, + "imm_flags": { + "__class__/rom24.bit.Bit": { + "bits": 0, + "flags": { + "__type__/OrderedDict": [ + [ + "summon", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "summon", + 1, + true + ] + } + } + ], + [ + "charm", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "charm", + 2, + true + ] + } + } + ], + [ + "magic", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "magic", + 4, + true + ] + } + } + ], + [ + "weapon", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "weapon", + 8, + true + ] + } + } + ], + [ + "bash", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "bash", + 16, + true + ] + } + } + ], + [ + "pierce", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "pierce", + 32, + true + ] + } + } + ], + [ + "slash", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "slash", + 64, + true + ] + } + } + ], + [ + "fire", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "fire", + 128, + true + ] + } + } + ], + [ + "cold", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "cold", + 256, + true + ] + } + } + ], + [ + "lightning", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "lightning", + 512, + true + ] + } + } + ], + [ + "acid", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "acid", + 1024, + true + ] + } + } + ], + [ + "poison", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "poison", + 2048, + true + ] + } + } + ], + [ + "negative", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "negative", + 4096, + true + ] + } + } + ], + [ + "holy", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "holy", + 8192, + true + ] + } + } + ], + [ + "energy", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "energy", + 16384, + true + ] + } + } + ], + [ + "mental", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "mental", + 32768, + true + ] + } + } + ], + [ + "disease", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "disease", + 65536, + true + ] + } + } + ], + [ + "drowning", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "drowning", + 131072, + true + ] + } + } + ], + [ + "light", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "light", + 262144, + true + ] + } + } + ], + [ + "sound", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "sound", + 524288, + true + ] + } + } + ], + [ + "wood", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "wood", + 8388608, + true + ] + } + } + ], + [ + "silver", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "silver", + 16777216, + true + ] + } + } + ], + [ + "iron", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "iron", + 33554432, + true + ] + } + } + ] + ] + } + } + }, + "incog_level": 0, + "instance_id": 15248, + "inventory": [ + 15249, + 15250, + 15251, + 15252, + 15253 + ], + "invis_level": 0, + "is_area": false, + "is_item": false, + "is_living": true, + "is_room": false, + "last_changes": 0, + "last_idea": 0, + "last_level": 0, + "last_news": 0, + "last_note": 0, + "last_penalty": 0, + "leader": null, + "learned": { + "acid blast": 1, + "armor": 1, + "blindness": 1, + "burning hands": 1, + "call lightning": 1, + "calm": 1, + "cancellation": 1, + "chain lightning": 1, + "change sex": 1, + "charm person": 1, + "chill touch": 1, + "colour spray": 1, + "control weather": 1, + "curse": 1, + "dagger": 40, + "detect evil": 1, + "detect good": 1, + "detect hidden": 1, + "detect invis": 1, + "detect magic": 1, + "detect poison": 1, + "dispel magic": 1, + "energy drain": 1, + "faerie fire": 1, + "faerie fog": 1, + "farsight": 1, + "fireball": 1, + "fireproof": 1, + "fly": 1, + "gate": 1, + "giant strength": 1, + "haste": 1, + "identify": 1, + "infravision": 1, + "know alignment": 1, + "lightning bolt": 1, + "locate object": 1, + "lore": 1, + "magic missile": 1, + "mass invis": 1, + "nexus": 1, + "pass door": 1, + "plague": 1, + "poison": 1, + "portal": 1, + "protection evil": 1, + "protection good": 1, + "recall": 50, + "refresh": 1, + "sanctuary": 1, + "scrolls": 1, + "shield": 1, + "shocking grasp": 1, + "sleep": 1, + "slow": 1, + "staves": 1, + "stone skin": 1, + "summon": 1, + "teleport": 1, + "wands": 1, + "weaken": 1, + "word of recall": 1 + }, + "level": 60, + "lines": 22, + "logon": 0, + "long_descr": "", + "mana": 100, + "master": null, + "material": "", + "max_hit": 374, + "max_mana": 395, + "max_move": 454, + "mod_stat": [ + 0, + 0, + 0, + 0, + 0 + ], + "move": 100, + "name": "Bub", + "on": null, + "parts": { + "__class__/rom24.bit.Bit": { + "bits": 2047, + "flags": { + "__type__/OrderedDict": [ + [ + "head", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "head", + 1, + true + ] + } + } + ], + [ + "arms", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "arms", + 2, + true + ] + } + } + ], + [ + "legs", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "legs", + 4, + true + ] + } + } + ], + [ + "heart", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "heart", + 8, + true + ] + } + } + ], + [ + "brains", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "brains", + 16, + true + ] + } + } + ], + [ + "guts", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "guts", + 32, + true + ] + } + } + ], + [ + "hands", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "hands", + 64, + true + ] + } + } + ], + [ + "feet", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "feet", + 128, + true + ] + } + } + ], + [ + "fingers", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "fingers", + 256, + true + ] + } + } + ], + [ + "ear", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "ear", + 512, + true + ] + } + } + ], + [ + "eye", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "eye", + 1024, + true + ] + } + } + ], + [ + "long_tongue", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "long_tongue", + 2048, + true + ] + } + } + ], + [ + "eyestalks", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "eyestalks", + 4096, + true + ] + } + } + ], + [ + "tentacles", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "tentacles", + 8192, + true + ] + } + } + ], + [ + "fins", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "fins", + 16384, + true + ] + } + } + ], + [ + "wings", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "wings", + 32768, + true + ] + } + } + ], + [ + "tail", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "tail", + 65536, + true + ] + } + } + ], + [ + "claws", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "claws", + 1048576, + true + ] + } + } + ], + [ + "fangs", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "fangs", + 2097152, + true + ] + } + } + ], + [ + "horns", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "horns", + 4194304, + true + ] + } + } + ], + [ + "scales", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "scales", + 8388608, + true + ] + } + } + ], + [ + "tusks", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "tusks", + 16777216, + true + ] + } + } + ] + ] + } + } + }, + "perm_hit": 374, + "perm_mana": 395, + "perm_move": 454, + "perm_stat": [ + 13, + 16, + 13, + 13, + 13 + ], + "pet": null, + "played": 0, + "points": 40, + "position": 8, + "practice": 64, + "prefix": "", + "prompt": "<%hhp %mm %vmv> ", + "pwd": "ce57d8bc990447c7ec35557040756db2a9ff7cdab53911f3c7995bc6bf3572cda8c94fa53789e523a680de9921c067f6717e79426df467185fc7a6dbec4b2d57", + "reply": 0, + "res_flags": { + "__class__/rom24.bit.Bit": { + "bits": 0, + "flags": { + "__type__/OrderedDict": [ + [ + "summon", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "summon", + 1, + true + ] + } + } + ], + [ + "charm", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "charm", + 2, + true + ] + } + } + ], + [ + "magic", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "magic", + 4, + true + ] + } + } + ], + [ + "weapon", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "weapon", + 8, + true + ] + } + } + ], + [ + "bash", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "bash", + 16, + true + ] + } + } + ], + [ + "pierce", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "pierce", + 32, + true + ] + } + } + ], + [ + "slash", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "slash", + 64, + true + ] + } + } + ], + [ + "fire", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "fire", + 128, + true + ] + } + } + ], + [ + "cold", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "cold", + 256, + true + ] + } + } + ], + [ + "lightning", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "lightning", + 512, + true + ] + } + } + ], + [ + "acid", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "acid", + 1024, + true + ] + } + } + ], + [ + "poison", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "poison", + 2048, + true + ] + } + } + ], + [ + "negative", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "negative", + 4096, + true + ] + } + } + ], + [ + "holy", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "holy", + 8192, + true + ] + } + } + ], + [ + "energy", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "energy", + 16384, + true + ] + } + } + ], + [ + "mental", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "mental", + 32768, + true + ] + } + } + ], + [ + "disease", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "disease", + 65536, + true + ] + } + } + ], + [ + "drowning", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "drowning", + 131072, + true + ] + } + } + ], + [ + "light", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "light", + 262144, + true + ] + } + } + ], + [ + "sound", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "sound", + 524288, + true + ] + } + } + ], + [ + "wood", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "wood", + 8388608, + true + ] + } + } + ], + [ + "silver", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "silver", + 16777216, + true + ] + } + } + ], + [ + "iron", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "iron", + 33554432, + true + ] + } + } + ] + ] + } + } + }, + "saving_throw": -1, + "sex": 1, + "short_descr": "", + "silver": 0, + "size": 2, + "slots": { + "__class__/rom24.equipment.Equipped": { + "equipped": { + "__type__/OrderedDict": [ + [ + "light", + 15249 + ], + [ + "left_finger", + null + ], + [ + "right_finger", + null + ], + [ + "neck", + null + ], + [ + "collar", + null + ], + [ + "body", + 15250 + ], + [ + "head", + null + ], + [ + "legs", + null + ], + [ + "feet", + null + ], + [ + "hands", + null + ], + [ + "arms", + null + ], + [ + "about_body", + null + ], + [ + "waist", + null + ], + [ + "left_wrist", + null + ], + [ + "right_wrist", + null + ], + [ + "main_hand", + 15251 + ], + [ + "off_hand", + 15252 + ], + [ + "held", + null + ], + [ + "float", + null + ] + ] + } + } + }, + "timer": 0, + "train": 62, + "true_sex": 1, + "valid": false, + "version": 5, + "vuln_flags": { + "__class__/rom24.bit.Bit": { + "bits": 0, + "flags": { + "__type__/OrderedDict": [ + [ + "summon", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "summon", + 1, + true + ] + } + } + ], + [ + "charm", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "charm", + 2, + true + ] + } + } + ], + [ + "magic", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "magic", + 4, + true + ] + } + } + ], + [ + "weapon", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "weapon", + 8, + true + ] + } + } + ], + [ + "bash", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "bash", + 16, + true + ] + } + } + ], + [ + "pierce", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "pierce", + 32, + true + ] + } + } + ], + [ + "slash", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "slash", + 64, + true + ] + } + } + ], + [ + "fire", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "fire", + 128, + true + ] + } + } + ], + [ + "cold", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "cold", + 256, + true + ] + } + } + ], + [ + "lightning", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "lightning", + 512, + true + ] + } + } + ], + [ + "acid", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "acid", + 1024, + true + ] + } + } + ], + [ + "poison", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "poison", + 2048, + true + ] + } + } + ], + [ + "negative", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "negative", + 4096, + true + ] + } + } + ], + [ + "holy", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "holy", + 8192, + true + ] + } + } + ], + [ + "energy", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "energy", + 16384, + true + ] + } + } + ], + [ + "mental", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "mental", + 32768, + true + ] + } + } + ], + [ + "disease", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "disease", + 65536, + true + ] + } + } + ], + [ + "drowning", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "drowning", + 131072, + true + ] + } + } + ], + [ + "light", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "light", + 262144, + true + ] + } + } + ], + [ + "sound", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "sound", + 524288, + true + ] + } + } + ], + [ + "wood", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "wood", + 8388608, + true + ] + } + } + ], + [ + "silver", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "silver", + 16777216, + true + ] + } + } + ], + [ + "iron", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "settable" + ], + "type": "flag_type", + "values": [ + "iron", + 33554432, + true + ] + } + } + ] + ] + } + } + }, + "wait": 0, + "was_in_room": null, + "weight": 0, + "wimpy": 0, + "wiznet": { + "__class__/rom24.bit.Bit": { + "bits": 0, + "flags": { + "__type__/OrderedDict": [ + [ + "on", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "level" + ], + "type": "wiznet_type", + "values": [ + "on", + 1, + 52 + ] + } + } + ], + [ + "prefix", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "level" + ], + "type": "wiznet_type", + "values": [ + "prefix", + 262144, + 52 + ] + } + } + ], + [ + "ticks", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "level" + ], + "type": "wiznet_type", + "values": [ + "ticks", + 2, + 52 + ] + } + } + ], + [ + "logins", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "level" + ], + "type": "wiznet_type", + "values": [ + "logins", + 4, + 52 + ] + } + } + ], + [ + "sites", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "level" + ], + "type": "wiznet_type", + "values": [ + "sites", + 8, + 56 + ] + } + } + ], + [ + "links", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "level" + ], + "type": "wiznet_type", + "values": [ + "links", + 16, + 53 + ] + } + } + ], + [ + "newbies", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "level" + ], + "type": "wiznet_type", + "values": [ + "newbies", + 131072, + 52 + ] + } + } + ], + [ + "spam", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "level" + ], + "type": "wiznet_type", + "values": [ + "spam", + 524288, + 55 + ] + } + } + ], + [ + "deaths", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "level" + ], + "type": "wiznet_type", + "values": [ + "deaths", + 32, + 52 + ] + } + } + ], + [ + "resets", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "level" + ], + "type": "wiznet_type", + "values": [ + "resets", + 64, + 56 + ] + } + } + ], + [ + "mobdeaths", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "level" + ], + "type": "wiznet_type", + "values": [ + "mobdeaths", + 128, + 56 + ] + } + } + ], + [ + "flags", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "level" + ], + "type": "wiznet_type", + "values": [ + "flags", + 256, + 55 + ] + } + } + ], + [ + "penalties", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "level" + ], + "type": "wiznet_type", + "values": [ + "penalties", + 512, + 55 + ] + } + } + ], + [ + "saccing", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "level" + ], + "type": "wiznet_type", + "values": [ + "saccing", + 1024, + 55 + ] + } + } + ], + [ + "levels", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "level" + ], + "type": "wiznet_type", + "values": [ + "levels", + 2048, + 52 + ] + } + } + ], + [ + "load", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "level" + ], + "type": "wiznet_type", + "values": [ + "load", + 65536, + 58 + ] + } + } + ], + [ + "restore", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "level" + ], + "type": "wiznet_type", + "values": [ + "restore", + 32768, + 58 + ] + } + } + ], + [ + "snoops", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "level" + ], + "type": "wiznet_type", + "values": [ + "snoops", + 16384, + 58 + ] + } + } + ], + [ + "switches", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "level" + ], + "type": "wiznet_type", + "values": [ + "switches", + 8192, + 58 + ] + } + } + ], + [ + "secure", + { + "__type__/namedtuple": { + "fields": [ + "name", + "bit", + "level" + ], + "type": "wiznet_type", + "values": [ + "secure", + 4096, + 59 + ] + } + } + ] + ] + } + } + }, + "zone": 0, + "zone_template": "" + } +} \ No newline at end of file diff --git a/src/data/plr_flags.json b/src/data/plr_flags.json new file mode 100644 index 0000000..5e036d9 --- /dev/null +++ b/src/data/plr_flags.json @@ -0,0 +1,87 @@ +{ + "npc": [ + "npc", + 1, + false + ], + "autoassist": [ + "autoassist", + 4, + false + ], + "autoexit": [ + "autoexit", + 8, + false + ], + "autoloot": [ + "autoloot", + 16, + false + ], + "autosac": [ + "autosac", + 32, + false + ], + "autogold": [ + "autogold", + 64, + false + ], + "autosplit": [ + "autosplit", + 128, + false + ], + "holylight": [ + "holylight", + 8192, + false + ], + "can_loot": [ + "can_loot", + 32768, + false + ], + "nosummon": [ + "nosummon", + 65536, + false + ], + "nofollow": [ + "nofollow", + 131072, + false + ], + "permit": [ + "permit", + 1048576, + true + ], + "log": [ + "log", + 4194304, + false + ], + "deny": [ + "deny", + 8388608, + false + ], + "freeze": [ + "freeze", + 16777216, + false + ], + "thief": [ + "thief", + 33554432, + false + ], + "killer": [ + "killer", + 67108864, + false + ] +} \ No newline at end of file diff --git a/src/data/position_table.json b/src/data/position_table.json new file mode 100644 index 0000000..97da107 --- /dev/null +++ b/src/data/position_table.json @@ -0,0 +1,38 @@ +{ + "0": [ + "dead", + "dead" + ], + "1": [ + "mortally wounded", + "mort" + ], + "2": [ + "incapacitated", + "incap" + ], + "3": [ + "stunned", + "stun" + ], + "4": [ + "sleeping", + "sleep" + ], + "5": [ + "resting", + "rest" + ], + "6": [ + "sitting", + "sit" + ], + "7": [ + "fighting", + "fight" + ], + "8": [ + "standing", + "stand" + ] +} \ No newline at end of file diff --git a/src/data/race_table.json b/src/data/race_table.json new file mode 100644 index 0000000..9f660a8 --- /dev/null +++ b/src/data/race_table.json @@ -0,0 +1,350 @@ +{ + "unique": [ + "unique", + false, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "human": [ + "human", + true, + 0, + 0, + 0, + 0, + 0, + 0, + 2101377, + 2047 + ], + "elf": [ + "elf", + true, + 0, + 512, + 0, + 0, + 2, + 33554432, + 2101377, + 2047 + ], + "dwarf": [ + "dwarf", + true, + 0, + 512, + 0, + 0, + 67584, + 131072, + 2101377, + 2047 + ], + "giant": [ + "giant", + true, + 0, + 0, + 0, + 0, + 384, + 33280, + 2101377, + 2047 + ], + "bat": [ + "bat", + false, + 0, + 34078720, + 160, + 0, + 0, + 262144, + 2097217, + 34493 + ], + "bear": [ + "bear", + false, + 0, + 0, + 16408, + 0, + 272, + 0, + 2097217, + 3147455 + ], + "cat": [ + "cat", + false, + 0, + 33554432, + 160, + 0, + 0, + 0, + 2097217, + 3212989 + ], + "centipede": [ + "centipede", + false, + 0, + 33554432, + 0, + 0, + 288, + 16, + 16451, + 1029 + ], + "dog": [ + "dog", + false, + 0, + 0, + 128, + 0, + 0, + 0, + 2097217, + 3147453 + ], + "doll": [ + "doll", + false, + 0, + 0, + 0, + 243968, + 262160, + 18112, + 268440080, + 1223 + ], + "dragon": [ + "dragon", + false, + 0, + 524800, + 0, + 0, + 146, + 288, + 33554561, + 11634685 + ], + "fido": [ + "fido", + false, + 0, + 0, + 131104, + 0, + 0, + 4, + 2097219, + 2164413 + ], + "fox": [ + "fox", + false, + 0, + 33554432, + 160, + 0, + 0, + 0, + 2097217, + 2164413 + ], + "goblin": [ + "goblin", + false, + 0, + 512, + 0, + 0, + 65536, + 4, + 2101377, + 2047 + ], + "hobgoblin": [ + "hobgoblin", + false, + 0, + 512, + 0, + 0, + 67584, + 0, + 2101377, + 16779263 + ], + "kobold": [ + "kobold", + false, + 0, + 512, + 0, + 0, + 2048, + 4, + 2101379, + 67583 + ], + "lizard": [ + "lizard", + false, + 0, + 0, + 0, + 0, + 2048, + 256, + 276824129, + 2163901 + ], + "modron": [ + "modron", + false, + 0, + 512, + 196608, + 110594, + 1408, + 0, + 128, + 1735 + ], + "orc": [ + "orc", + false, + 0, + 512, + 0, + 0, + 65536, + 262144, + 2101377, + 2047 + ], + "pig": [ + "pig", + false, + 0, + 0, + 0, + 0, + 0, + 0, + 2097217, + 1725 + ], + "rabbit": [ + "rabbit", + false, + 0, + 0, + 160, + 0, + 0, + 0, + 2097217, + 1725 + ], + "school monster": [ + "school monster", + false, + 1048576, + 0, + 0, + 3, + 0, + 4, + 2101249, + 1115839 + ], + "snake": [ + "snake", + false, + 0, + 0, + 0, + 0, + 2048, + 256, + 293601345, + 10554425 + ], + "song bird": [ + "song bird", + false, + 0, + 524288, + 160, + 0, + 0, + 0, + 4194369, + 33981 + ], + "troll": [ + "troll", + false, + 0, + 268436000, + 8, + 0, + 18, + 1152, + 2101379, + 3147775 + ], + "water fowl": [ + "water fowl", + false, + 0, + 134742016, + 0, + 0, + 131072, + 0, + 4194369, + 33981 + ], + "wolf": [ + "wolf", + false, + 0, + 33554432, + 160, + 0, + 0, + 0, + 2097217, + 2164285 + ], + "wyvern": [ + "wyvern", + false, + 0, + 524328, + 164, + 2048, + 0, + 262144, + 33554499, + 10553021 + ] +} \ No newline at end of file diff --git a/src/data/sex_table.json b/src/data/sex_table.json new file mode 100644 index 0000000..97e8894 --- /dev/null +++ b/src/data/sex_table.json @@ -0,0 +1,5 @@ +{ + "1": "male", + "2": "female", + "0": "either" +} \ No newline at end of file diff --git a/src/data/size_table.json b/src/data/size_table.json new file mode 100644 index 0000000..883a797 --- /dev/null +++ b/src/data/size_table.json @@ -0,0 +1,8 @@ +[ + "tiny", + "small", + "medium", + "large", + "huge", + "giant" +] \ No newline at end of file diff --git a/src/data/skill_table.json b/src/data/skill_table.json new file mode 100644 index 0000000..9209202 --- /dev/null +++ b/src/data/skill_table.json @@ -0,0 +1,952 @@ +{ + "mace": [ + "mace", + { + "cleric": 1, + "thief": 1, + "mage": 1, + "warrior": 1 + }, + { + "cleric": 2, + "thief": 3, + "mage": 5, + "warrior": 3 + }, + null, + 0, + 7, + null, + 0, + 0, + 0, + "", + "!Mace!", + "" + ], + "axe": [ + "axe", + { + "cleric": 1, + "thief": 1, + "mage": 1, + "warrior": 1 + }, + { + "cleric": 6, + "thief": 5, + "mage": 6, + "warrior": 4 + }, + null, + 0, + 7, + null, + 0, + 0, + 0, + "", + "!Axe!", + "" + ], + "trip": [ + "trip", + { + "cleric": 53, + "thief": 1, + "mage": 53, + "warrior": 15 + }, + { + "cleric": 0, + "thief": 4, + "mage": 0, + "warrior": 8 + }, + null, + 0, + 7, + null, + 0, + 0, + 24, + "trip", + "!Trip!", + "" + ], + "backstab": [ + "backstab", + { + "cleric": 53, + "thief": 1, + "mage": 53, + "warrior": 53 + }, + { + "cleric": 0, + "thief": 5, + "mage": 0, + "warrior": 0 + }, + null, + 0, + 8, + null, + 0, + 0, + 24, + "backstab", + "!Backstab!", + "" + ], + "envenom": [ + "envenom", + { + "cleric": 53, + "thief": 10, + "mage": 53, + "warrior": 53 + }, + { + "cleric": 0, + "thief": 4, + "mage": 0, + "warrior": 0 + }, + null, + 0, + 5, + null, + 0, + 0, + 36, + "", + "!Envenom!", + "" + ], + "steal": [ + "steal", + { + "cleric": 53, + "thief": 5, + "mage": 53, + "warrior": 53 + }, + { + "cleric": 0, + "thief": 4, + "mage": 0, + "warrior": 0 + }, + null, + 0, + 8, + null, + 0, + 0, + 24, + "", + "!Steal!", + "" + ], + "fast healing": [ + "fast healing", + { + "cleric": 9, + "thief": 16, + "mage": 15, + "warrior": 6 + }, + { + "cleric": 5, + "thief": 6, + "mage": 8, + "warrior": 4 + }, + null, + 0, + 4, + null, + 0, + 0, + 0, + "", + "!Fast Healing!", + "" + ], + "wands": [ + "wands", + { + "cleric": 1, + "thief": 1, + "mage": 1, + "warrior": 1 + }, + { + "cleric": 3, + "thief": 5, + "mage": 2, + "warrior": 8 + }, + null, + 0, + 8, + null, + 0, + 0, + 12, + "", + "!Wands!", + "" + ], + "dodge": [ + "dodge", + { + "cleric": 22, + "thief": 1, + "mage": 20, + "warrior": 13 + }, + { + "cleric": 8, + "thief": 4, + "mage": 8, + "warrior": 6 + }, + null, + 0, + 7, + null, + 0, + 0, + 0, + "", + "!Dodge!", + "" + ], + "peek": [ + "peek", + { + "cleric": 21, + "thief": 1, + "mage": 8, + "warrior": 14 + }, + { + "cleric": 7, + "thief": 3, + "mage": 5, + "warrior": 6 + }, + null, + 0, + 8, + null, + 0, + 0, + 0, + "", + "!Peek!", + "" + ], + "polearm": [ + "polearm", + { + "cleric": 1, + "thief": 1, + "mage": 1, + "warrior": 1 + }, + { + "cleric": 6, + "thief": 6, + "mage": 6, + "warrior": 4 + }, + null, + 0, + 7, + null, + 0, + 0, + 0, + "", + "!Polearm!", + "" + ], + "recall": [ + "recall", + { + "cleric": 1, + "thief": 1, + "mage": 1, + "warrior": 1 + }, + { + "cleric": 2, + "thief": 2, + "mage": 2, + "warrior": 2 + }, + null, + 0, + 8, + null, + 0, + 0, + 12, + "", + "!Recall!", + "" + ], + "dagger": [ + "dagger", + { + "cleric": 1, + "thief": 1, + "mage": 1, + "warrior": 1 + }, + { + "cleric": 3, + "thief": 2, + "mage": 2, + "warrior": 2 + }, + null, + 0, + 7, + null, + 0, + 0, + 0, + "", + "!Dagger!", + "" + ], + "haggle": [ + "haggle", + { + "cleric": 18, + "thief": 1, + "mage": 7, + "warrior": 14 + }, + { + "cleric": 8, + "thief": 3, + "mage": 5, + "warrior": 6 + }, + null, + 0, + 5, + null, + 0, + 0, + 0, + "", + "!Haggle!", + "" + ], + "lore": [ + "lore", + { + "cleric": 10, + "thief": 6, + "mage": 10, + "warrior": 20 + }, + { + "cleric": 6, + "thief": 4, + "mage": 6, + "warrior": 8 + }, + null, + 0, + 5, + null, + 0, + 0, + 36, + "", + "!Lore!", + "" + ], + "third attack": [ + "third attack", + { + "cleric": 53, + "thief": 24, + "mage": 53, + "warrior": 12 + }, + { + "cleric": 0, + "thief": 10, + "mage": 0, + "warrior": 4 + }, + null, + 0, + 7, + null, + 0, + 0, + 0, + "", + "!Third Attack!", + "" + ], + "reserved": [ + "reserved", + { + "cleric": 99, + "thief": 99, + "mage": 99, + "warrior": 99 + }, + { + "cleric": 99, + "thief": 99, + "mage": 99, + "warrior": 99 + }, + null, + 0, + 8, + null, + 0, + 0, + 0, + "", + "", + "" + ], + "dirt kicking": [ + "dirt kicking", + { + "cleric": 53, + "thief": 3, + "mage": 53, + "warrior": 3 + }, + { + "cleric": 0, + "thief": 4, + "mage": 0, + "warrior": 4 + }, + null, + 0, + 7, + null, + 0, + 0, + 24, + "kicked dirt", + "You rub the dirt out of your eyes.", + "" + ], + "kick": [ + "kick", + { + "cleric": 12, + "thief": 14, + "mage": 53, + "warrior": 8 + }, + { + "cleric": 4, + "thief": 6, + "mage": 0, + "warrior": 3 + }, + null, + 1, + 7, + null, + 0, + 0, + 12, + "kick", + "!Kick!", + "" + ], + "hand to hand": [ + "hand to hand", + { + "cleric": 10, + "thief": 15, + "mage": 25, + "warrior": 6 + }, + { + "cleric": 5, + "thief": 6, + "mage": 8, + "warrior": 4 + }, + null, + 0, + 7, + null, + 0, + 0, + 0, + "", + "!Hand to Hand!", + "" + ], + "rescue": [ + "rescue", + { + "cleric": 53, + "thief": 53, + "mage": 53, + "warrior": 1 + }, + { + "cleric": 0, + "thief": 0, + "mage": 0, + "warrior": 4 + }, + null, + 0, + 7, + null, + 0, + 0, + 12, + "", + "!Rescue!", + "" + ], + "second attack": [ + "second attack", + { + "cleric": 24, + "thief": 12, + "mage": 30, + "warrior": 5 + }, + { + "cleric": 8, + "thief": 5, + "mage": 10, + "warrior": 3 + }, + null, + 0, + 7, + null, + 0, + 0, + 0, + "", + "!Second Attack!", + "" + ], + "parry": [ + "parry", + { + "cleric": 20, + "thief": 13, + "mage": 22, + "warrior": 1 + }, + { + "cleric": 8, + "thief": 6, + "mage": 8, + "warrior": 4 + }, + null, + 0, + 7, + null, + 0, + 0, + 0, + "", + "!Parry!", + "" + ], + "shield block": [ + "shield block", + { + "cleric": 1, + "thief": 1, + "mage": 1, + "warrior": 1 + }, + { + "cleric": 4, + "thief": 6, + "mage": 6, + "warrior": 2 + }, + null, + 0, + 7, + null, + 0, + 0, + 0, + "", + "!Shield!", + "" + ], + "spear": [ + "spear", + { + "cleric": 1, + "thief": 1, + "mage": 1, + "warrior": 1 + }, + { + "cleric": 4, + "thief": 4, + "mage": 4, + "warrior": 3 + }, + null, + 0, + 7, + null, + 0, + 0, + 0, + "", + "!Spear!", + "" + ], + "disarm": [ + "disarm", + { + "cleric": 53, + "thief": 12, + "mage": 53, + "warrior": 11 + }, + { + "cleric": 0, + "thief": 6, + "mage": 0, + "warrior": 4 + }, + null, + 0, + 7, + null, + 0, + 0, + 24, + "", + "!Disarm!", + "" + ], + "sword": [ + "sword", + { + "cleric": 1, + "thief": 1, + "mage": 1, + "warrior": 1 + }, + { + "cleric": 6, + "thief": 3, + "mage": 5, + "warrior": 2 + }, + null, + 0, + 7, + null, + 0, + 0, + 0, + "", + "!sword!", + "" + ], + "pick lock": [ + "pick lock", + { + "cleric": 25, + "thief": 7, + "mage": 25, + "warrior": 25 + }, + { + "cleric": 8, + "thief": 4, + "mage": 8, + "warrior": 8 + }, + null, + 0, + 8, + null, + 0, + 0, + 12, + "", + "!Pick!", + "" + ], + "meditation": [ + "meditation", + { + "cleric": 6, + "thief": 15, + "mage": 6, + "warrior": 15 + }, + { + "cleric": 5, + "thief": 8, + "mage": 5, + "warrior": 8 + }, + null, + 0, + 4, + null, + 0, + 0, + 0, + "", + "Meditation", + "" + ], + "whip": [ + "whip", + { + "cleric": 1, + "thief": 1, + "mage": 1, + "warrior": 1 + }, + { + "cleric": 5, + "thief": 5, + "mage": 6, + "warrior": 4 + }, + null, + 0, + 7, + null, + 0, + 0, + 0, + "", + "!Whip!", + "" + ], + "flail": [ + "flail", + { + "cleric": 1, + "thief": 1, + "mage": 1, + "warrior": 1 + }, + { + "cleric": 3, + "thief": 6, + "mage": 6, + "warrior": 4 + }, + null, + 0, + 7, + null, + 0, + 0, + 0, + "", + "!Flail!", + "" + ], + "scrolls": [ + "scrolls", + { + "cleric": 1, + "thief": 1, + "mage": 1, + "warrior": 1 + }, + { + "cleric": 3, + "thief": 5, + "mage": 2, + "warrior": 8 + }, + null, + 0, + 8, + null, + 0, + 0, + 24, + "", + "!Scrolls!", + "" + ], + "enhanced damage": [ + "enhanced damage", + { + "cleric": 30, + "thief": 25, + "mage": 45, + "warrior": 1 + }, + { + "cleric": 9, + "thief": 5, + "mage": 10, + "warrior": 3 + }, + null, + 0, + 7, + null, + 0, + 0, + 0, + "", + "!Enhanced Damage!", + "" + ], + "berserk": [ + "berserk", + { + "cleric": 53, + "thief": 53, + "mage": 53, + "warrior": 18 + }, + { + "cleric": 0, + "thief": 0, + "mage": 0, + "warrior": 5 + }, + null, + 0, + 7, + null, + 0, + 0, + 24, + "", + "You feel your pulse slow down.", + "" + ], + "staves": [ + "staves", + { + "cleric": 1, + "thief": 1, + "mage": 1, + "warrior": 1 + }, + { + "cleric": 3, + "thief": 5, + "mage": 2, + "warrior": 8 + }, + null, + 0, + 8, + null, + 0, + 0, + 12, + "", + "!Staves!", + "" + ], + "sneak": [ + "sneak", + { + "cleric": 53, + "thief": 4, + "mage": 53, + "warrior": 10 + }, + { + "cleric": 0, + "thief": 4, + "mage": 0, + "warrior": 6 + }, + null, + 0, + 8, + null, + 0, + 0, + 12, + "", + "You no longer feel stealthy.", + "" + ], + "bash": [ + "bash", + { + "cleric": 53, + "thief": 53, + "mage": 53, + "warrior": 1 + }, + { + "cleric": 0, + "thief": 0, + "mage": 0, + "warrior": 4 + }, + null, + 0, + 7, + null, + 0, + 0, + 24, + "bash", + "!Bash!", + "" + ], + "hide": [ + "hide", + { + "cleric": 53, + "thief": 1, + "mage": 53, + "warrior": 12 + }, + { + "cleric": 0, + "thief": 4, + "mage": 0, + "warrior": 6 + }, + null, + 0, + 5, + null, + 0, + 0, + 12, + "", + "!Hide!", + "" + ] +} \ No newline at end of file diff --git a/src/data/str_app.json b/src/data/str_app.json new file mode 100644 index 0000000..7596add --- /dev/null +++ b/src/data/str_app.json @@ -0,0 +1,158 @@ +{ + "0": [ + -5, + -4, + 0, + 0 + ], + "1": [ + -5, + -4, + 3, + 1 + ], + "2": [ + -3, + -2, + 3, + 2 + ], + "3": [ + -3, + -1, + 10, + 3 + ], + "4": [ + -2, + -1, + 25, + 4 + ], + "5": [ + -2, + -1, + 55, + 5 + ], + "6": [ + -1, + 0, + 80, + 6 + ], + "7": [ + -1, + 0, + 90, + 7 + ], + "8": [ + 0, + 0, + 100, + 8 + ], + "9": [ + 0, + 0, + 100, + 9 + ], + "10": [ + 0, + 0, + 115, + 10 + ], + "11": [ + 0, + 0, + 115, + 11 + ], + "12": [ + 0, + 0, + 130, + 12 + ], + "13": [ + 0, + 0, + 130, + 13 + ], + "14": [ + 0, + 1, + 140, + 14 + ], + "15": [ + 1, + 1, + 150, + 15 + ], + "16": [ + 1, + 2, + 165, + 16 + ], + "17": [ + 2, + 3, + 180, + 22 + ], + "18": [ + 2, + 3, + 200, + 25 + ], + "19": [ + 3, + 4, + 225, + 30 + ], + "20": [ + 3, + 5, + 250, + 35 + ], + "21": [ + 4, + 6, + 300, + 40 + ], + "22": [ + 4, + 6, + 350, + 45 + ], + "23": [ + 5, + 7, + 400, + 50 + ], + "24": [ + 5, + 8, + 450, + 55 + ], + "25": [ + 6, + 9, + 500, + 60 + ] +} \ No newline at end of file diff --git a/src/data/title_table.json b/src/data/title_table.json new file mode 100644 index 0000000..7875bfc --- /dev/null +++ b/src/data/title_table.json @@ -0,0 +1,986 @@ +{ + "cleric": [ + [ + "Man", + "Woman" + ], + [ + "Believer", + "Believer" + ], + [ + "Attendant", + "Attendant" + ], + [ + "Acolyte", + "Acolyte" + ], + [ + "Novice", + "Novice" + ], + [ + "Missionary", + "Missionary" + ], + [ + "Adept", + "Adept" + ], + [ + "Deacon", + "Deaconess" + ], + [ + "Vicar", + "Vicaress" + ], + [ + "Priest", + "Priestess" + ], + [ + "Minister", + "Lady Minister" + ], + [ + "Canon", + "Canon" + ], + [ + "Levite", + "Levitess" + ], + [ + "Curate", + "Curess" + ], + [ + "Monk", + "Nun" + ], + [ + "Healer", + "Healess" + ], + [ + "Chaplain", + "Chaplain" + ], + [ + "Expositor", + "Expositress" + ], + [ + "Bishop", + "Bishop" + ], + [ + "Arch Bishop", + "Arch Lady of the Church" + ], + [ + "Patriarch", + "Matriarch" + ], + [ + "Elder Patriarch", + "Elder Matriarch" + ], + [ + "Grand Patriarch", + "Grand Matriarch" + ], + [ + "Great Patriarch", + "Great Matriarch" + ], + [ + "Demon Killer", + "Demon Killer" + ], + [ + "Greater Demon Killer", + "Greater Demon Killer" + ], + [ + "Cardinal of the Sea", + "Cardinal of the Sea" + ], + [ + "Cardinal of the Earth", + "Cardinal of the Earth" + ], + [ + "Cardinal of the Air", + "Cardinal of the Air" + ], + [ + "Cardinal of the Ether", + "Cardinal of the Ether" + ], + [ + "Cardinal of the Heavens", + "Cardinal of the Heavens" + ], + [ + "Avatar of an Immortal", + "Avatar of an Immortal" + ], + [ + "Avatar of a Deity", + "Avatar of a Deity" + ], + [ + "Avatar of a Supremity", + "Avatar of a Supremity" + ], + [ + "Avatar of an Implementor", + "Avatar of an Implementor" + ], + [ + "Master of all Divinity", + "Mistress of all Divinity" + ], + [ + "Master Cleric", + "Master Cleric" + ], + [ + "Master Cleric", + "Master Cleric" + ], + [ + "Master Cleric", + "Master Cleric" + ], + [ + "Master Cleric", + "Master Cleric" + ], + [ + "Master Cleric", + "Master Cleric" + ], + [ + "Master Cleric", + "Master Cleric" + ], + [ + "Master Cleric", + "Master Cleric" + ], + [ + "Master Cleric", + "Master Cleric" + ], + [ + "Master Cleric", + "Master Cleric" + ], + [ + "Master Cleric", + "Master Cleric" + ], + [ + "Master Cleric", + "Master Cleric" + ], + [ + "Master Cleric", + "Master Cleric" + ], + [ + "Master Cleric", + "Master Cleric" + ], + [ + "Master Cleric", + "Master Cleric" + ], + [ + "Master Cleric", + "Master Cleric" + ], + [ + "Holy Hero", + "Holy Heroine" + ], + [ + "Holy Avatar", + "Holy Avatar" + ], + [ + "Angel", + "Angel" + ], + [ + "Demigod", + "Demigoddess" + ], + [ + "Immortal", + "Immortal" + ], + [ + "God", + "Goddess" + ], + [ + "Deity", + "Deity" + ], + [ + "Supreme Master", + "Supreme Mistress" + ], + [ + "Creator", + "Creator" + ], + [ + "Implementor", + "Implementress" + ] + ], + "thief": [ + [ + "Man", + "Woman" + ], + [ + "Pilferer", + "Pilferess" + ], + [ + "Footpad", + "Footpad" + ], + [ + "Filcher", + "Filcheress" + ], + [ + "Pick-Pocket", + "Pick-Pocket" + ], + [ + "Sneak", + "Sneak" + ], + [ + "Pincher", + "Pincheress" + ], + [ + "Cut-Purse", + "Cut-Purse" + ], + [ + "Snatcher", + "Snatcheress" + ], + [ + "Sharper", + "Sharpress" + ], + [ + "Rogue", + "Rogue" + ], + [ + "Robber", + "Robber" + ], + [ + "Magsman", + "Magswoman" + ], + [ + "Highwayman", + "Highwaywoman" + ], + [ + "Burglar", + "Burglaress" + ], + [ + "Thief", + "Thief" + ], + [ + "Knifer", + "Knifer" + ], + [ + "Quick-Blade", + "Quick-Blade" + ], + [ + "Killer", + "Murderess" + ], + [ + "Brigand", + "Brigand" + ], + [ + "Cut-Throat", + "Cut-Throat" + ], + [ + "Spy", + "Spy" + ], + [ + "Grand Spy", + "Grand Spy" + ], + [ + "Master Spy", + "Master Spy" + ], + [ + "Assassin", + "Assassin" + ], + [ + "Greater Assassin", + "Greater Assassin" + ], + [ + "Master of Vision", + "Mistress of Vision" + ], + [ + "Master of Hearing", + "Mistress of Hearing" + ], + [ + "Master of Smell", + "Mistress of Smell" + ], + [ + "Master of Taste", + "Mistress of Taste" + ], + [ + "Master of Touch", + "Mistress of Touch" + ], + [ + "Crime Lord", + "Crime Mistress" + ], + [ + "Infamous Crime Lord", + "Infamous Crime Mistress" + ], + [ + "Greater Crime Lord", + "Greater Crime Mistress" + ], + [ + "Master Crime Lord", + "Master Crime Mistress" + ], + [ + "Godfather", + "Godmother" + ], + [ + "Master Thief", + "Master Thief" + ], + [ + "Master Thief", + "Master Thief" + ], + [ + "Master Thief", + "Master Thief" + ], + [ + "Master Thief", + "Master Thief" + ], + [ + "Master Thief", + "Master Thief" + ], + [ + "Master Thief", + "Master Thief" + ], + [ + "Master Thief", + "Master Thief" + ], + [ + "Master Thief", + "Master Thief" + ], + [ + "Master Thief", + "Master Thief" + ], + [ + "Master Thief", + "Master Thief" + ], + [ + "Master Thief", + "Master Thief" + ], + [ + "Master Thief", + "Master Thief" + ], + [ + "Master Thief", + "Master Thief" + ], + [ + "Master Thief", + "Master Thief" + ], + [ + "Master Thief", + "Master Thief" + ], + [ + "Assassin Hero", + "Assassin Heroine" + ], + [ + "Avatar of Death", + "Avatar of Death" + ], + [ + "Angel of Death", + "Angel of Death" + ], + [ + "Demigod of Assassins", + "Demigoddess of Assassins" + ], + [ + "Immortal Assasin", + "Immortal Assassin" + ], + [ + "God of Assassins", + "God of Assassins" + ], + [ + "Deity of Assassins", + "Deity of Assassins" + ], + [ + "Supreme Master", + "Supreme Mistress" + ], + [ + "Creator", + "Creator" + ], + [ + "Implementor", + "Implementress" + ] + ], + "mage": [ + [ + "Man", + "Woman" + ], + [ + "Apprentice of Magic", + "Apprentice of Magic" + ], + [ + "Spell Student", + "Spell Student" + ], + [ + "Scholar of Magic", + "Scholar of Magic" + ], + [ + "Delver in Spells", + "Delveress in Spells" + ], + [ + "Medium of Magic", + "Medium of Magic" + ], + [ + "Scribe of Magic", + "Scribess of Magic" + ], + [ + "Seer", + "Seeress" + ], + [ + "Sage", + "Sage" + ], + [ + "Illusionist", + "Illusionist" + ], + [ + "Abjurer", + "Abjuress" + ], + [ + "Invoker", + "Invoker" + ], + [ + "Enchanter", + "Enchantress" + ], + [ + "Conjurer", + "Conjuress" + ], + [ + "Magician", + "Witch" + ], + [ + "Creator", + "Creator" + ], + [ + "Savant", + "Savant" + ], + [ + "Magus", + "Craftess" + ], + [ + "Wizard", + "Wizard" + ], + [ + "Warlock", + "War Witch" + ], + [ + "Sorcerer", + "Sorceress" + ], + [ + "Elder Sorcerer", + "Elder Sorceress" + ], + [ + "Grand Sorcerer", + "Grand Sorceress" + ], + [ + "Great Sorcerer", + "Great Sorceress" + ], + [ + "Golem Maker", + "Golem Maker" + ], + [ + "Greater Golem Maker", + "Greater Golem Maker" + ], + [ + "Maker of Stones", + "Maker of Stones" + ], + [ + "Maker of Potions", + "Maker of Potions" + ], + [ + "Maker of Scrolls", + "Maker of Scrolls" + ], + [ + "Maker of Wands", + "Maker of Wands" + ], + [ + "Maker of Staves", + "Maker of Staves" + ], + [ + "Demon Summoner", + "Demon Summoner" + ], + [ + "Greater Demon Summoner", + "Greater Demon Summoner" + ], + [ + "Dragon Charmer", + "Dragon Charmer" + ], + [ + "Greater Dragon Charmer", + "Greater Dragon Charmer" + ], + [ + "Master of all Magic", + "Master of all Magic" + ], + [ + "Master Mage", + "Master Mage" + ], + [ + "Master Mage", + "Master Mage" + ], + [ + "Master Mage", + "Master Mage" + ], + [ + "Master Mage", + "Master Mage" + ], + [ + "Master Mage", + "Master Mage" + ], + [ + "Master Mage", + "Master Mage" + ], + [ + "Master Mage", + "Master Mage" + ], + [ + "Master Mage", + "Master Mage" + ], + [ + "Master Mage", + "Master Mage" + ], + [ + "Master Mage", + "Master Mage" + ], + [ + "Master Mage", + "Master Mage" + ], + [ + "Master Mage", + "Master Mage" + ], + [ + "Master Mage", + "Master Mage" + ], + [ + "Master Mage", + "Master Mage" + ], + [ + "Master Mage", + "Master Mage" + ], + [ + "Mage Hero", + "Mage Heroine" + ], + [ + "Avatar of Magic", + "Avatar of Magic" + ], + [ + "Angel of Magic", + "Angel of Magic" + ], + [ + "Demigod of Magic", + "Demigoddess of Magic" + ], + [ + "Immortal of Magic", + "Immortal of Magic" + ], + [ + "God of Magic", + "Goddess of Magic" + ], + [ + "Deity of Magic", + "Deity of Magic" + ], + [ + "Supremity of Magic", + "Supremity of Magic" + ], + [ + "Creator", + "Creator" + ], + [ + "Implementor", + "Implementress" + ] + ], + "warrior": [ + [ + "Man", + "Woman" + ], + [ + "Swordpupil", + "Swordpupil" + ], + [ + "Recruit", + "Recruit" + ], + [ + "Sentry", + "Sentress" + ], + [ + "Fighter", + "Fighter" + ], + [ + "Soldier", + "Soldier" + ], + [ + "Warrior", + "Warrior" + ], + [ + "Veteran", + "Veteran" + ], + [ + "Swordsman", + "Swordswoman" + ], + [ + "Fencer", + "Fenceress" + ], + [ + "Combatant", + "Combatess" + ], + [ + "Hero", + "Heroine" + ], + [ + "Myrmidon", + "Myrmidon" + ], + [ + "Swashbuckler", + "Swashbuckleress" + ], + [ + "Mercenary", + "Mercenaress" + ], + [ + "Swordmaster", + "Swordmistress" + ], + [ + "Lieutenant", + "Lieutenant" + ], + [ + "Champion", + "Lady Champion" + ], + [ + "Dragoon", + "Lady Dragoon" + ], + [ + "Cavalier", + "Lady Cavalier" + ], + [ + "Knight", + "Lady Knight" + ], + [ + "Grand Knight", + "Grand Knight" + ], + [ + "Master Knight", + "Master Knight" + ], + [ + "Paladin", + "Paladin" + ], + [ + "Grand Paladin", + "Grand Paladin" + ], + [ + "Demon Slayer", + "Demon Slayer" + ], + [ + "Greater Demon Slayer", + "Greater Demon Slayer" + ], + [ + "Dragon Slayer", + "Dragon Slayer" + ], + [ + "Greater Dragon Slayer", + "Greater Dragon Slayer" + ], + [ + "Underlord", + "Underlord" + ], + [ + "Overlord", + "Overlord" + ], + [ + "Baron of Thunder", + "Baroness of Thunder" + ], + [ + "Baron of Storms", + "Baroness of Storms" + ], + [ + "Baron of Tornadoes", + "Baroness of Tornadoes" + ], + [ + "Baron of Hurricanes", + "Baroness of Hurricanes" + ], + [ + "Baron of Meteors", + "Baroness of Meteors" + ], + [ + "Master Warrior", + "Master Warrior" + ], + [ + "Master Warrior", + "Master Warrior" + ], + [ + "Master Warrior", + "Master Warrior" + ], + [ + "Master Warrior", + "Master Warrior" + ], + [ + "Master Warrior", + "Master Warrior" + ], + [ + "Master Warrior", + "Master Warrior" + ], + [ + "Master Warrior", + "Master Warrior" + ], + [ + "Master Warrior", + "Master Warrior" + ], + [ + "Master Warrior", + "Master Warrior" + ], + [ + "Master Warrior", + "Master Warrior" + ], + [ + "Master Warrior", + "Master Warrior" + ], + [ + "Master Warrior", + "Master Warrior" + ], + [ + "Master Warrior", + "Master Warrior" + ], + [ + "Master Warrior", + "Master Warrior" + ], + [ + "Master Warrior", + "Master Warrior" + ], + [ + "Knight Hero", + "Knight Heroine" + ], + [ + "Avatar of War", + "Avatar of War" + ], + [ + "Angel of War", + "Angel of War" + ], + [ + "Demigod of War", + "Demigoddess of War" + ], + [ + "Immortal Warlord", + "Immortal Warlord" + ], + [ + "God of War", + "God of War" + ], + [ + "Deity of War", + "Deity of War" + ], + [ + "Supreme Master of War", + "Supreme Mistress of War" + ], + [ + "Creator", + "Creator" + ], + [ + "Implementor", + "Implementress" + ] + ] +} \ No newline at end of file diff --git a/src/data/weapon_table.json b/src/data/weapon_table.json new file mode 100644 index 0000000..37a2357 --- /dev/null +++ b/src/data/weapon_table.json @@ -0,0 +1,50 @@ +{ + "sword": [ + "sword", + 3702, + 1, + "sword" + ], + "mace": [ + "mace", + 3700, + 4, + "mace" + ], + "dagger": [ + "dagger", + 3701, + 2, + "dagger" + ], + "axe": [ + "axe", + 3719, + 5, + "axe" + ], + "staff": [ + "staff", + 3718, + 3, + "spear" + ], + "flail": [ + "flail", + 3720, + 6, + "flail" + ], + "whip": [ + "whip", + 3721, + 7, + "whip" + ], + "polearm": [ + "polearm", + 3722, + 8, + "polearm" + ] +} \ No newline at end of file diff --git a/src/data/wis_app.json b/src/data/wis_app.json new file mode 100644 index 0000000..cc8fd07 --- /dev/null +++ b/src/data/wis_app.json @@ -0,0 +1,80 @@ +{ + "0": [ + 0 + ], + "1": [ + 0 + ], + "2": [ + 0 + ], + "3": [ + 0 + ], + "4": [ + 0 + ], + "5": [ + 1 + ], + "6": [ + 1 + ], + "7": [ + 1 + ], + "8": [ + 1 + ], + "9": [ + 1 + ], + "10": [ + 1 + ], + "11": [ + 1 + ], + "12": [ + 1 + ], + "13": [ + 1 + ], + "14": [ + 1 + ], + "15": [ + 2 + ], + "16": [ + 2 + ], + "17": [ + 2 + ], + "18": [ + 3 + ], + "19": [ + 3 + ], + "20": [ + 3 + ], + "21": [ + 3 + ], + "22": [ + 4 + ], + "23": [ + 4 + ], + "24": [ + 4 + ], + "25": [ + 5 + ] +} \ No newline at end of file diff --git a/src/data/wiznet_table.json b/src/data/wiznet_table.json new file mode 100644 index 0000000..ddbc256 --- /dev/null +++ b/src/data/wiznet_table.json @@ -0,0 +1,102 @@ +{ + "on": [ + "on", + 1, + 52 + ], + "prefix": [ + "prefix", + 262144, + 52 + ], + "ticks": [ + "ticks", + 2, + 52 + ], + "logins": [ + "logins", + 4, + 52 + ], + "sites": [ + "sites", + 8, + 56 + ], + "links": [ + "links", + 16, + 53 + ], + "newbies": [ + "newbies", + 131072, + 52 + ], + "spam": [ + "spam", + 524288, + 55 + ], + "deaths": [ + "deaths", + 32, + 52 + ], + "resets": [ + "resets", + 64, + 56 + ], + "mobdeaths": [ + "mobdeaths", + 128, + 56 + ], + "flags": [ + "flags", + 256, + 55 + ], + "penalties": [ + "penalties", + 512, + 55 + ], + "saccing": [ + "saccing", + 1024, + 55 + ], + "levels": [ + "levels", + 2048, + 52 + ], + "load": [ + "load", + 65536, + 58 + ], + "restore": [ + "restore", + 32768, + 58 + ], + "snoops": [ + "snoops", + 16384, + 58 + ], + "switches": [ + "switches", + 8192, + 58 + ], + "secure": [ + "secure", + 4096, + 59 + ] +} \ No newline at end of file diff --git a/src/data/world/instances/.gitkeep b/src/data/world/instances/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/rom24/game_utils.py b/src/rom24/game_utils.py index 9547683..ce5b796 100644 --- a/src/rom24/game_utils.py +++ b/src/rom24/game_utils.py @@ -549,7 +549,7 @@ def argument_parser(arg_string): num_or_count = None arg_num = 1 - if "" is arg_string: + if arg_string == "": return None, None, None, None arg_string = arg_string.lstrip()